Loading...
Loading...
Compare original and translation side by side
"LLM-assisted code review, not LLM-generated code." Generation is cheap. Verification is where correctness lives.
"LLM-assisted code review, not LLM-generated code." 生成成本低廉,而验证才是确保正确性的关键。
[UNVERIFIED DRAFT]undefined[UNVERIFIED DRAFT]undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined
**Verification Techniques to Use:**
1. **Constraint-Driven Verification**
- Verify against explicit environment constraints
- Check version compatibility
- Validate type correctness
2. **Adversarial Verification**
- Attempt to construct inputs that break the code
- Focus on: race conditions, off-by-one, null paths, stale closures
3. **Differential Reasoning**
- Compare to naive/brute-force alternatives
- Explain tradeoffs
4. **Line-by-Line Semantic Audit** (for critical paths)
- Explain what each line does
- Flag any line whose removal wouldn't change behavior
**可使用的验证技术:**
1. **约束驱动验证**
- 根据明确的环境约束进行验证
- 检查版本兼容性
- 验证类型正确性
2. **对抗式验证**
- 尝试构造能破坏代码的输入
- 重点关注:竞态条件、差一错误、空值路径、过时闭包
3. **差分推理**
- 与朴素/暴力实现方案进行比较
- 解释权衡取舍
4. **逐行语义审计**(针对关键路径)
- 解释每一行代码的作用
- 标记任何移除后不影响行为的代码行undefinedundefined
---
---Task: Add a delete button to [inferred component/location]
Stage 1 - Initial Solution:
- Implement the delete button with proper UI
- Add click handler with confirmation
- Call appropriate API/mutation
- Handle loading/error states
- Update cache/state after deletion
Stage 2 - Verification Plan:
- [ ] Button placement follows design system
- [ ] Confirmation prevents accidental deletion
- [ ] API endpoint exists and is correct
- [ ] Optimistic update handles rollback on failure
- [ ] Cache invalidation is complete
- [ ] Loading state prevents double-clicks
- [ ] Error state is user-friendly
- [ ] Accessibility (aria-label, keyboard nav)
Stage 3 - Independent Verification:
[Verify each item]
Stage 4 - Final Verified Solution:
[Corrected implementation]Task: Add a delete button to [inferred component/location]
Stage 1 - Initial Solution:
- Implement the delete button with proper UI
- Add click handler with confirmation
- Call appropriate API/mutation
- Handle loading/error states
- Update cache/state after deletion
Stage 2 - Verification Plan:
- [ ] Button placement follows design system
- [ ] Confirmation prevents accidental deletion
- [ ] API endpoint exists and is correct
- [ ] Optimistic update handles rollback on failure
- [ ] Cache invalidation is complete
- [ ] Loading state prevents double-clicks
- [ ] Error state is user-friendly
- [ ] Accessibility (aria-label, keyboard nav)
Stage 3 - Independent Verification:
[Verify each item]
Stage 4 - Final Verified Solution:
[Corrected implementation]- [ ] useEffect dependency array is complete
- [ ] useMemo/useCallback dependencies are correct
- [ ] No stale closures in event handlers
- [ ] Keys are stable and unique
- [ ] Server/Client component boundary is correct
- [ ] Suspense boundaries handle loading
- [ ] Error boundaries catch failures- [ ] useEffect dependency array is complete
- [ ] useMemo/useCallback dependencies are correct
- [ ] No stale closures in event handlers
- [ ] Keys are stable and unique
- [ ] Server/Client component boundary is correct
- [ ] Suspense boundaries handle loading
- [ ] Error boundaries catch failures- [ ] Query keys are consistent and follow pattern
- [ ] Mutations invalidate correct queries
- [ ] Optimistic updates have proper rollback
- [ ] Stale time / cache time are appropriate
- [ ] Infinite queries handle page boundaries
- [ ] Prefetching doesn't cause waterfalls- [ ] Query keys are consistent and follow pattern
- [ ] Mutations invalidate correct queries
- [ ] Optimistic updates have proper rollback
- [ ] Stale time / cache time are appropriate
- [ ] Infinite queries handle page boundaries
- [ ] Prefetching doesn't cause waterfalls- [ ] Procedure types match (query vs mutation)
- [ ] Input validation is complete (Zod schema)
- [ ] Error handling uses TRPCError
- [ ] Context has required auth/session
- [ ] Batching is considered for multiple calls- [ ] Procedure types match (query vs mutation)
- [ ] Input validation is complete (Zod schema)
- [ ] Error handling uses TRPCError
- [ ] Context has required auth/session
- [ ] Batching is considered for multiple calls- [ ] Transactions wrap related operations
- [ ] Isolation level is appropriate
- [ ] N+1 queries are avoided (include/select)
- [ ] Unique constraints are enforced
- [ ] Cascade deletes are intentional
- [ ] Indexes exist for query patterns- [ ] Transactions wrap related operations
- [ ] Isolation level is appropriate
- [ ] N+1 queries are avoided (include/select)
- [ ] Unique constraints are enforced
- [ ] Cascade deletes are intentional
- [ ] Indexes exist for query patterns- [ ] No `any` types (explicit or implicit)
- [ ] Null/undefined handled properly
- [ ] Type narrowing is sound
- [ ] Generics are constrained appropriately
- [ ] Return types are explicit for public APIs- [ ] No `any` types (explicit or implicit)
- [ ] Null/undefined handled properly
- [ ] Type narrowing is sound
- [ ] Generics are constrained appropriately
- [ ] Return types are explicit for public APIs- [ ] Promise.all used for independent operations
- [ ] Race conditions are prevented
- [ ] Cleanup functions in useEffect
- [ ] AbortController for cancellable requests
- [ ] Debounce/throttle where appropriate- [ ] Promise.all used for independent operations
- [ ] Race conditions are prevented
- [ ] Cleanup functions in useEffect
- [ ] AbortController for cancellable requests
- [ ] Debounce/throttle where appropriateAttempt to construct a sequence of events that would cause:
1. Race condition between two concurrent calls
2. Stale data displayed after mutation
3. Memory leak from uncancelled subscription
4. Deadlock or infinite loopAttempt to construct a sequence of events that would cause:
1. Race condition between two concurrent calls
2. Stale data displayed after mutation
3. Memory leak from uncancelled subscription
4. Deadlock or infinite loopAttempt to reach an invalid state by:
1. Rapid successive user actions
2. Network failure mid-operation
3. Component unmount during async operation
4. Browser back/forward navigationAttempt to reach an invalid state by:
1. Rapid successive user actions
2. Network failure mid-operation
3. Component unmount during async operation
4. Browser back/forward navigationAttempt to break this endpoint with:
1. Missing or malformed input
2. Unauthorized access
3. SQL/NoSQL injection
4. Excessive payload size
5. Concurrent conflicting requestsAttempt to break this endpoint with:
1. Missing or malformed input
2. Unauthorized access
3. SQL/NoSQL injection
4. Excessive payload size
5. Concurrent conflicting requestsAttempt to cause incorrect rendering by:
1. Props changing faster than render cycle
2. Parent re-rendering with same props
3. Context value changing mid-render
4. Suspense boundary resolution orderAttempt to cause incorrect rendering by:
1. Props changing faster than render cycle
2. Parent re-rendering with same props
3. Context value changing mid-render
4. Suspense boundary resolution order// Initial implementation
const { data, fetchNextPage, hasNextPage } = useInfiniteQuery({
queryKey: ['users'],
queryFn: ({ pageParam = 0 }) => fetchUsers({ offset: pageParam, limit: 20 }),
getNextPageParam: (lastPage) => lastPage.nextOffset,
})// Initial implementation
const { data, fetchNextPage, hasNextPage } = useInfiniteQuery({
queryKey: ['users'],
queryFn: ({ pageParam = 0 }) => fetchUsers({ offset: pageParam, limit: 20 }),
getNextPageParam: (lastPage) => lastPage.nextOffset,
})- [ ] Query key includes filter/sort params
- [ ] Offset calculation is correct at boundaries
- [ ] Loading state shown during fetch
- [ ] Empty state handled
- [ ] Error state handled
- [ ] Total count displayed correctly
- [ ] Page size is configurable
- [ ] URL state synced with pagination
- [ ] Keyboard navigation works
- [ ] Screen reader announces page changes- [ ] Query key includes filter/sort params
- [ ] Offset calculation is correct at boundaries
- [ ] Loading state shown during fetch
- [ ] Empty state handled
- [ ] Error state handled
- [ ] Total count displayed correctly
- [ ] Page size is configurable
- [ ] URL state synced with pagination
- [ ] Keyboard navigation works
- [ ] Screen reader announces page changes✗ FAILED: Query key includes filter/sort params
- Evidence: queryKey is just ['users'], doesn't include filters
- Fix: queryKey: ['users', { filters, sort }]
✗ FAILED: URL state synced with pagination
- Evidence: Page state is local, lost on refresh
- Fix: Use URL search params or router state
✓ PASSED: Offset calculation
- Evidence: getNextPageParam correctly returns nextOffset from API
⚠ WARNING: Total count displayed
- Evidence: API returns total but we don't display it
- Recommendation: Show "Page X of Y" or "Showing 1-20 of 156"✗ FAILED: Query key includes filter/sort params
- Evidence: queryKey is just ['users'], doesn't include filters
- Fix: queryKey: ['users', { filters, sort }]
✗ FAILED: URL state synced with pagination
- Evidence: Page state is local, lost on refresh
- Fix: Use URL search params or router state
✓ PASSED: Offset calculation
- Evidence: getNextPageParam correctly returns nextOffset from API
⚠ WARNING: Total count displayed
- Evidence: API returns total but we don't display it
- Recommendation: Show "Page X of Y" or "Showing 1-20 of 156"// Corrected implementation with all fixes applied
const [searchParams, setSearchParams] = useSearchParams()
const page = Number(searchParams.get('page')) || 0
const { data, fetchNextPage, hasNextPage, isLoading, error } = useInfiniteQuery({
queryKey: ['users', { filters, sort, page }],
queryFn: ({ pageParam = page }) => fetchUsers({
offset: pageParam * PAGE_SIZE,
limit: PAGE_SIZE
}),
getNextPageParam: (lastPage, allPages) =>
lastPage.hasMore ? allPages.length : undefined,
})
// Sync to URL
const goToPage = (newPage: number) => {
setSearchParams({ page: String(newPage) })
}// Corrected implementation with all fixes applied
const [searchParams, setSearchParams] = useSearchParams()
const page = Number(searchParams.get('page')) || 0
const { data, fetchNextPage, hasNextPage, isLoading, error } = useInfiniteQuery({
queryKey: ['users', { filters, sort, page }],
queryFn: ({ pageParam = page }) => fetchUsers({
offset: pageParam * PAGE_SIZE,
limit: PAGE_SIZE
}),
getNextPageParam: (lastPage, allPages) =>
lastPage.hasMore ? allPages.length : undefined,
})
// Sync to URL
const goToPage = (newPage: number) => {
setSearchParams({ page: String(newPage) })
}/wavybaby/cove/wavybaby [task] → native dispatch + skill discovery + CoVe
/cove [task] → just the 4-stage verification protocol/wavybaby/cove/wavybaby [task] → native dispatch + skill discovery + CoVe
/cove [task] → just the 4-stage verification protocol