fix(context): worktree writer persists nested payloads (#62 C1/F2/F3/F4) - #90
Merged
Conversation
Independent re-verification found the #86 "worktree writer" wired to nothing: cli.mjs's deep camelizeKeys recursed into the update-cache `entry`/`attempt` payloads, mangling work_id/pull_request/pipeline_phase/updated_at into keys the snake_case cache validator rejects → mergeCache returned invalid-update and persisted nothing; active_pr/pipeline_phase were permanently null. - C1: camelizeKeys takes an opaque-key set; `entry`/`attempt` values pass through verbatim (key camelized, value untouched) so the schema keys survive. - F4: inject the repository-resolved projectId LAST so a caller-supplied project_id cannot override it. - F3: mergeCache treats an explicit `null` on the existing side as absent, so enriching `pull_request: null` -> a real PR is progressive enhancement, not a contradiction. - F2: the old UC-G8/G9 tests called mergeCache directly and bypassed the exact camelize break. Added tests/project-context/cli-update-cache.test.mjs — a real end-to-end drive of the CLI over stdin with snake_case, asserting the writer persists the pointer keys, round-trips a recovery attempt, and enforces F4. Adapters regenerated (the codex mirrors carried the identical bug). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KwyFyRC6pepaK6DuMK7YeT
huiyu
added a commit
that referenced
this pull request
Aug 24, 2026
…resolved PRs #90-#94 merged to 3.0; the 3 CRITICAL (C1 #62 writer, C2/C3 #51 claude path) that the independent pass overturned are re-fixed with real end-to-end tests, and the 18 further Important/Medium/Minor defects are closed. Residual risks R1-R4 remain post-3.0 by intent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KwyFyRC6pepaK6DuMK7YeT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Campaign-2 fix #1 — CRITICAL C1 (re-opens #62 S1). From the independent re-verification.
The bug
#86addedupdate-cachebut wired it to nothing:cli.mjs's deepcamelizeKeysrecursed into theentry/attemptdata payloads, turningwork_id→workId,pull_request→pullRequest,pipeline_phase→pipelinePhase,updated_at→updatedAt— keys the snake_case cache validator rejects.mergeCachereturnedinvalid-update, the writer persisted nothing, andactive_pr/pipeline_phasewere permanently null. The earlier "FIXED" was verified by grep (command exists), not end-to-end.Fixes
camelizeKeys(value, opaqueKeys)—entry/attemptvalues pass through verbatim (key camelized, value untouched).projectIdlast so a caller-suppliedproject_idcan't override it.mergeCachetreats an explicitnullon the existing side as absent → enrichingpull_request: null→ a real PR is progressive enhancement, not a contradiction.mergeCachedirectly, bypassing the camelize break. Newtests/project-context/cli-update-cache.test.mjsdrives the real CLI over stdin with snake_case and asserts the persisted keys.Verification
test:project-context: 65/65🤖 Generated with Claude Code