Repository navigation
Providers phase 5b (engine slice 1): route switchProvider through the neutral hub - #409
Merged
Merged
Conversation
…e neutral hub Replace the direct toClaude/toCodex calls in switchProvider with the neutral-hub translate seam: toClaude(codexLines, opts) -> translateToClaude(CodexCodec.decode(codexLines), opts).lines toCodex(claudeEntries, opts) -> translateToCodex(ClaudeCodec.decode(claudeEntries), opts).lines This is BYTE-IDENTICAL to the old direct calls — the codec decode wraps every source record in the passthrough region losslessly, translateTo* reconstructs that exact source array and runs the same legacy converter with the same options. The equivalence is pinned by atp's testing/translate-equivalence.ts (verify:neutral-translate), which I ran against the pinned atp commit (b50d73f): all codex↔claude equivalences hold in both fidelity and lossy modes. WHY do a byte-identical refactor: switchProvider becomes the FIRST production consumer of the neutral hub, so when the atp engine migrates to true per-entry neutral translation (a later slice, verified against the same corpus), provider switching inherits it with zero further edits — and a third provider's codec makes its switch pairs work here for free. Deliberately isolated from the more delicate work: the resume sanitizers (claudeResumeSanitizer/codexResumeSanitizer) and id/file-layout policy stay app-side; absorbing them into the codecs is the separate slice this one de-risks by landing the safe seam swap first. Verification: verify:neutral-translate green; tsc node+web 0 errors; electron-vite build ok; 170/170 unit tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9 tasks
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.
What
Routes
switchProvider's translation through the neutral-hub codec seam instead of calling the pairwise converters directly:Byte-identical to the old direct calls: codec
decodewraps every source record in the lossless passthrough region,translateTo*reconstructs that exact source array and runs the same legacy converter with the same options. Pinned by atp'stesting/translate-equivalence.ts(ClaudeCodec.encode(CodexCodec.decode(x)) ≡ toClaude(x)and the symmetric case), which I ran green against the pinned atp commitb50d73f.Why a byte-identical refactor
switchProviderbecomes the first production consumer of the neutral hub. When the atp engine migrates to true per-entry neutral translation (a later slice, verified against the same corpus), provider switching inherits it with zero further edits — and a third provider's codec makes its switch pairs work here for free.This deliberately isolates the safe seam swap from the more delicate work: the resume sanitizers (
claudeResumeSanitizer/codexResumeSanitizer) and id/file-layout policy stay app-side. Absorbing them into the codecs is the separate, riskier slice (#394 phase 5b) that this one de-risks by landing the seam first.duplicateSession/rewindSessionfollow the same pattern and are follow-ups.Verification
verify:neutral-translate(atp, at pinned commit) → all codex↔claude equivalences hold, fidelity + lossytsc -p tsconfig.node.json→ 0 ·tsc --noEmit -p tsconfig.web.json→ 0electron-vite build✓ ·npm test→ 170/170 (1 pre-existing voice-dictation "No test suite found" quirk)🤖 Generated with Claude Code