fix: resolve critical and major issues from code review#145
fix: resolve critical and major issues from code review#145vscarpenter merged 2 commits intomainfrom
Conversation
- Add dryRun support to bulkUpdateTasks (was silently mutating data) - Separate deleted vs updated counts in bulk operation responses - Fix fallback totalTasks using nullable instead of misleading pending counts - Thread request Origin through auth middleware for correct CORS on errors - Add environment parameter to CORS response helpers for dev-port support - Optimize list-tasks cache to serve filtered queries from cached all-tasks - Initialize encryption once per batch instead of per-task in decryption loop - Fix import ordering in list-tasks.ts - Bump version to 6.8.8 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d worker Frontend: - Use structured logObject for all log levels (not just error) in logger.ts - Add 'email' to sensitive-key sanitization list for PII protection - Fix import ordering in oauth-handshake/subscriber.ts - Wrap error string in Error object in oauth-callback-handler.tsx - Fix misleading "localStorage" log message (writes to sessionStorage) - Fix indentation in pwa-register.tsx - Clean up controllerchange listener and fallback timer in pwa-update-toast.tsx MCP Server: - Gate debug logs behind LOG_LEVEL env var in MCP logger - Fix help text: 18 → 20 total tools, add missing tool listings - Remove unsafe type cast for statsReset; use properly typed result object - Fix Math.max(...spread) stack overflow risk; use reduce for large arrays - Downgrade config guidance strings from ERROR to INFO level - Add error context to sync-status catch for better diagnostics Worker: - Replace positional ALLOWED_ORIGINS[0]/[1] with named constants - Fix double encodeURIComponent in buildErrorRedirect - Add runtime type coercion for D1 query results (fixes pre-existing TS error) - Downgrade pull processing log from INFO to DEBUG, remove vector clock noise - Clean up informal "FIX #N" and "BULLETPROOF FIX" comment labels Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
PR Review — fix: resolve critical and major issues from code reviewOverall this is a solid set of targeted fixes. The critical dryRun bug, the double-counted bulk results, and the meaningless fallback What's well done
Issue:
|
| Area | Status |
|---|---|
| dryRun bug fix | Correct |
| Bulk result counts | Correct |
totalTasks fallback semantics |
Correct |
| Origin threading in auth middleware | Correct |
environment param wiring in auth |
Incomplete |
| Cache write path for filtered queries | Misses warm on first filtered call |
task.tags undefined guard |
Can throw on legacy data |
Math.max spread fix |
Correct |
| PWA listener cleanup | Correct |
Double encodeURIComponent fix |
Correct |
| Device type coercions | Correct |
| Structured logging consistency | Correct |
The three items marked Incomplete/Can throw/Misses are worth addressing before merge — especially the task.tags guard (runtime crash risk on legacy data) and the cache write-path gap (the optimization doesn't deliver its benefit when a filtered call runs first). The environment threading gap is lower priority if dev CORS was working through other means, but worth clarifying either way.
🤖 Generated with Claude Code



Summary
Fixes 1 critical and 5 major issues identified during comprehensive code review of commit fd2ffc8.
dryRuntobulk_update_tasks— was silently mutating data whendryRun: truewas passed; the schema accepted it but the implementation dropped ittotalTaskssemantics — fallback path returnedpendingPushCount + pendingPullCountas total tasks (wrong); now returnsnullfor unknown countsOriginthrough auth middleware — all 5errorResponsecalls in auth.ts now pass the request origin, fixing CORS on auth errors in devenvironmentparam to CORS helpers —jsonResponse,errorResponse,createCorsHeadersnow accept optionalenvironmentto activate dev-port allowlistlistTaskscalls now check the cached all-tasks list first, avoiding redundant network + decrypt round tripsAdditional improvements
initializeEncryption()called once per batch instead of per-task (perf fix)list-tasks.tsmaxTasksuses??instead of||to correctly handle0Test plan
bun typecheck— cleanbun lint— cleanbun run test— 1,713 tests passing (89 suites)bulk_update_taskswithdryRun: truereturns preview without mutating🤖 Generated with Claude Code