Skip to content

fix(context): worktree writer persists nested payloads (#62 C1/F2/F3/F4) - #90

Merged
huiyu merged 1 commit into
3.0from
fix/62-worktree-writer-camelize
Aug 24, 2026
Merged

fix(context): worktree writer persists nested payloads (#62 C1/F2/F3/F4)#90
huiyu merged 1 commit into
3.0from
fix/62-worktree-writer-camelize

Conversation

@huiyu

@huiyu huiyu commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Campaign-2 fix #1 — CRITICAL C1 (re-opens #62 S1). From the independent re-verification.

The bug

#86 added update-cache but wired it to nothing: cli.mjs's deep camelizeKeys recursed into the entry/attempt data payloads, turning work_idworkId, pull_requestpullRequest, pipeline_phasepipelinePhase, updated_atupdatedAt — keys the snake_case cache validator rejects. mergeCache returned invalid-update, the writer persisted nothing, and active_pr/pipeline_phase were permanently null. The earlier "FIXED" was verified by grep (command exists), not end-to-end.

Fixes

  • C1 camelizeKeys(value, opaqueKeys)entry/attempt values pass through verbatim (key camelized, value untouched).
  • F4 inject the repository-resolved projectId last so a caller-supplied project_id can't override it.
  • F3 mergeCache treats an explicit null on the existing side as absent → enriching pull_request: null → a real PR is progressive enhancement, not a contradiction.
  • F2 the meta-lesson: the old UC-G8/G9 tests called mergeCache directly, bypassing the camelize break. New tests/project-context/cli-update-cache.test.mjs drives the real CLI over stdin with snake_case and asserts the persisted keys.

Verification

  • New e2e: 3/3 (persist pointers, round-trip recovery attempt, F4 identity injection)
  • Full test:project-context: 65/65
  • Adapters regenerated — the codex mirrors carried the identical bug.

🤖 Generated with Claude Code

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
huiyu merged commit d38ed24 into 3.0 Aug 24, 2026
1 check passed
@huiyu
huiyu deleted the fix/62-worktree-writer-camelize branch August 24, 2026 13:08
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant