Skip to content

refactor(core): antigravity decode into core, stitching and caches host-side (phase 8, stateful tier) - #839

Merged
iamtoruk merged 1 commit into
feat/core-extractionfrom
phase8/stateful-antigravity
Jul 27, 2026
Merged

refactor(core): antigravity decode into core, stitching and caches host-side (phase 8, stateful tier)#839
iamtoruk merged 1 commit into
feat/core-extractionfrom
phase8/stateful-antigravity

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Phase 8 stateful tier (tracking #809), first of three: antigravity. All five parse arms' pure decode moves into @codeburn/core (proto wire reader, gen_metadata row decode, RPC metadata decode, statusline decode + run-collapse + deltas, model canonicalization); everything stateful stays host-side by design — the results cache, memo Maps, project attribution, timestamp stabilization, normalizePricingModel, and all I/O (sqlite, RPC, process probing). Bespoke adapter preserved (per the recipe, stateful providers do not use the bridge). No state type needed: every arm is a whole-batch pure function.

Cache integrity was the gating property: the version-5 results cache is NOT re-derivable (the RPC-failure fallback serves cascades whose only surviving usage record is the cache). Verified by byte-diff, not inspection: loadCache/flushCache identical, cache-write-BEFORE-dedup-filter ordering preserved in both arms, both fallback arms byte-exact, CACHE_VERSION and PROVIDER_PARSE_VERSIONS untouched.

Flow: Opus spec (8-source store map, 14-golden plan) → Kimi two-phase (goldens 14/14 pre-verified with only a sanctioned temporary export; then the migration) → Opus validation with an in-place oracle restoration (51/51 against pre-migration source) and a mutation battery on the six-operation statusline emit loop (one mutation proven unobservable by value analysis; two real detection gaps closed with a new golden G15). Validator fixes:

  • Content-smuggling fixture was vacuous — wrong record shape decoded to [], so planted secrets never entered the pipeline. Corrected + non-vacuousness guard.
  • G14 re-implemented the host mapping locally instead of asserting it — re-pointed at the exported toProviderCall, making the RPC arm's emitted shape a real oracle.
  • The Phase 0 pricing misfit (costBasis: 'estimated' + pricingModel, no costUSD) is now emitted by ONE shared toProviderCall with key-presence gates on every golden.

Gates: core 436/436; CLI suite and root npm test both 2428 passed, 5 skipped (delta vs base exactly the +15 new goldens); tsc --noEmit clean; the injected wall clock is the sole semantic edit (host passes at once per payload, matching the original).

Known residual (pre-existing): the RPC arms have no end-to-end execution coverage anywhere (require a live language server) — covered by byte-diff + decoder-level goldens, as before.

…st-side (phase 8, stateful tier)

Moves every record-parsing arm into @codeburn/core/providers/antigravity:
the protobuf wire reader, the gen_metadata row decode, the RPC
generatorMetadata decode, the statusline JSONL run-collapse/delta decode,
and model canonicalization. All five emit arms (statusline, cache-hit,
sqlite, RPC, RPC-failure fallback) plus the snapshot write-path keep their
host-side control flow byte-for-byte.

Cache integrity: CACHE_VERSION stays 5 and antigravity-results.json keeps
its shape. The cache is not re-derivable — the RPC-failure fallback arm
replays cached.calls for cascades whose language server is gone — so no
bump, and the cache-write-before-seenKeys-filter ordering is preserved in
both the sqlite and RPC arms.

Pricing stays host-side: normalizePricingModel / PRICING_ALIASES remain in
the CLI, and every arm now emits through one shared toProviderCall carrying
costBasis 'estimated' plus pricingModel, and no costUSD.

parseStatusLinePayload's wall clock becomes an injected `at` parameter; the
host passes new Date().toISOString() at each call site, once per payload.

Validator fixes on top of the migration:
- content-smuggling: the hostile statusline record used the hook-payload
  shape, so the decoder dropped it and the cwd/session_id assertions proved
  nothing; corrected to the recorded-event shape, with a call-count guard.
- goldens: G14 maps through the exported host toProviderCall instead of a
  private copy, and a new G15 pins the emit loop's turnIndex-before-seenKeys
  and previousSnapshotUsage-before-skip ordering, which no golden could
  previously detect.
- core: removed an unused type import and a dead CANONICAL_TOOL_NAME const;
  restored the statusline reasoningTokens rationale comment.
@iamtoruk
iamtoruk merged commit be00eed into feat/core-extraction Jul 27, 2026
4 checks passed
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