refactor(core): tail migrations — hermes, warp, cursor-agent, quickdesk, devin (phase 8, sqlite batch 2) - #834
Merged
Conversation
…sk, devin (phase 8, sqlite batch 2) Move the pure record decode for five sqlite-backed providers into @codeburn/core, keeping discovery, sqlite I/O, pricing, and bash base-name extraction CLI-side behind the dual-registry bridge. sqlite variant: the host opens the database, runs the SQL, textualizes BLOBs (warp stylized_command, quickdesk content/tool_names), probes sqlite_master table variants (quickdesk), and re-throws SQLITE_BUSY so a transient lock on a live database retries instead of being cached as an empty result (hermes). The core decoders receive already-normalized rows. Validator fixes over the drafted migration (original behavior is the authority in every case): - warp: restored the `run_command` tool-name check as an identity comparison. The draft had rewritten it as a bare Record lookup, so 'constructor'/'toString'/'__proto__' resolved to inherited Object members instead of passing through. Added a regression test. - warp: restored `safeNumber` to the host's semantics (positive finite numbers only). The draft's rewrite accepted numeric strings and negative values, changing token budgets and dominant-model selection for untrusted conversation_data. - warp: `estimateTokensFromChars` now mirrors the host helper exactly. - devin: model DISPLAY names move back CLI-side. The draft shipped a 7-line regex standing in for the host's `getShortModelName`, which mis-rendered every non-Claude model id. The decoder now emits the raw generation_model / model_name ids and the CLI formats them. - devin: dropped the added `costBasis: 'measured'`; the pre-migration call carried `costUSD` with no basis marker. Golden corrected. - quickdesk: fixed an inverted source-variant predicate that routed `sourceId: 'metrics'` on a sessions.db path (and `sourceId: 'sessions-db'` on a metrics path) to the wrong parser. - cursor-agent: the "unrecognized transcript format" warning is now re-emitted from the real decode result via a decode wrapper. The draft re-derived `recognized` host-side as `hasUser && hasAssistant`, which silently dropped the warning whenever a jsonl transcript had both roles but produced no turns. - cursor-agent: restored the per-conversation summary cache, so the attribution database is opened once per conversation id, not per source. - cursor-agent/devin: the session id is derived once, host-side, and passed through, removing a second derivation that could disagree with the host's on Windows-style paths. - hermes: `browser_vision` maps to Vision, matching the original table. Goldens re-verified by running each bridge fixture through the pre-migration provider implementation: all five reproduce field-for-field.
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.
Phase 8 sqlite batch 2 (tracking #809): migrates the row→call decode for hermes, warp, cursor-agent, quickdesk, devin into
@codeburn/coreper the recipe's sqlite variant — driver, SQL, blobToText, sqlite_master probing, and busy-error handling all stay CLI-side; only pure row decode, types, and tool maps move.Two-tier protocol (Kimi draft → independent Opus arm-by-arm validation vs the pre-migration originals). The validator found and fixed 10 defects the green suites missed, notably:
Recordtool-map rewrite reintroduced the batch-1 prototype-member leak;safeNumberrewritten to accept numeric strings/negatives (feeds token budgets + dominant-model selection). Both restored exactly.sessions.db/metrics sources to the wrong parser. Restored.getShortModelNameas a Claude-only regex (user-visible display bug for every non-Claude id) — display resolution moved back CLI-side, core emits raw ids; plus a spuriouscostBasis: 'measured'the original never emitted.Golden authenticity independently re-derived by running the fixtures through the extracted pre-migration originals: this caught that devin's golden had been captured from the draft, not the original — after correction, 15/15 reproduce field-for-field under both implementations. All goldens are full-object
toEqualpins.stderr parity verified site-by-site (hermes 4, warp 2, cursor-agent 1 restored, quickdesk/devin none). All five carry userMessage: arch-gate allowlist + content-smuggling blocks added for each.
Gates: core 317/317; CLI suite from packages/cli and root
npm testboth 2345 passed, 5 skipped; no parse-version changes; shared wiring files merged as add-only unions with batch 1.Pre-existing (untouched, flagged): bare-
Recordlookup maps in hermes/quickdesk/cursor-agent/warp originals share the prototype-exposure class — candidates for one sweep fix later alongside gooseToolNameMap.