fix(betas): emit claude-code-20250219 after prompt-caching-scope to match CC order
Live CC 2.1.113 on Haiku 4.5 emits anthropic-beta in this exact order
(captured 2026-04-17, minimal-hi scenario):
oauth-2025-04-20,
interleaved-thinking-2025-05-14,
context-management-2025-06-27,
prompt-caching-scope-2026-01-05,
claude-code-20250219,
advisor-tool-2026-03-01
Before this change the plugin pushed CLAUDE_CODE_BETA_FLAG first in the
signature branch of buildAnthropicBetaHeader(), which made the plugin emit
'claude-code-20250219' at position 0 instead of position 4. Membership
matched; only ordering diverged. See evidence at
.sisyphus/evidence/phase-1-claim-validation/2026-04-17/
proxyman-minimal-hi-2.1.113/minimal-hi-og-capture.json:20 (CC order) vs
minimal-hi-plugin-capture.json:12 (pre-fix plugin order).
Changes:
- src/betas.ts:
- Remove the early 'betas.push(CLAUDE_CODE_BETA_FLAG)' at the top of the
signature branch.
- Re-push CLAUDE_CODE_BETA_FLAG immediately after
'prompt-caching-scope-2026-01-05' (line 218-221) and before the
advisor/advanced-tool-use block. This mirrors CC's live emission
order.
- Update the header comment in the signature branch to document the
CC-derived emission order as the authoritative source of truth so
future edits do not silently reintroduce the regression.
- tests/unit/betas/emission-order.test.ts (new):
- Golden-order assertion that matches CC's 6-beta Haiku emission order
exactly (toEqual on the split array, not toContain).
- Determinism guard: 10 identical calls produce identical output.
- tests/unit/profiles/index.test.ts:
- Update two pre-existing golden-order assertions (one for default
Haiku, one for Opus 4-6 with context-1m) to reflect the new
(correct) ordering.
- tests/regression/fingerprint/fingerprint-regression.test.ts:
- Update two pre-existing golden-order assertions for Opus 4-6 paths
(selected 2.1.109 optional betas + 2.1.110 manifest backfill) to
reflect the new ordering.
- scripts/verification/check-beta-order.ts (new):
- One-shot verifier that extracts 'anthropic-beta' from two capture
JSONs and asserts equality by content and order. Exits 0 on match,
1 on mismatch with a side-by-side diff printed to stderr.
- Usage: bun scripts/verification/check-beta-order.ts --og <path> --plugin <path>
- Pre-existing Phase-1 captures reflect the pre-fix plugin order by
design (they are evidence of the bug). Post-fix captures taken from
a sandboxed or live plugin will pass the check.
Verification:
- 76 test files / 1343 tests green (up from 75 / 1341).
- lint clean, typecheck clean.
- Ordering is now deterministic and matches CC 2.1.113 byte-for-byte on
Haiku 4.5 for the minimal-hi scenario.
Scope notes:
Sonnet 4.6 and Opus 4.7 ordering validation deferred. Their Phase-1
captures have beta MEMBERSHIP differences (plugin emits
context-1m-2025-08-07 when OG does not). Aligning membership is
out of A.1 scope; ordering can be re-validated once membership gaps
close in a follow-up task. V
Vacbo committed
b3a64ebe07a4f4151b260d6d1bd8a5b6457a0d4f
Parent: 497153a