You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #41 (coverage and fidelity metadata) and PR #76 are the upstream — they add fidelity flags to TurnRecord. The archive needs the equivalent columns so SQL queries can filter / group by them without re-deriving in memory.
Today, compare and summary cells render — instead of $0.00 / 0% for missing data; that decision currently lives in the analyze layer. Once the archive carries the flags, downstream consumers can express it as WHERE has_full_attribution = 1 rather than re-checking each row.
attribution_fidelity TEXT — one of full, aggregate_only, cost_only, missing, zero.
tokens_present INTEGER — boolean: did the source give us per-turn token counts?
cost_present INTEGER — boolean: cost only?
Add session-level rollups to sessions:
min_fidelity TEXT — worst fidelity observed in the session.
has_full_attribution INTEGER.
Bump ARCHIVE_VERSION only if the additive ALTER strategy doesn't fit; otherwise, keep it stable so existing archives pick up the new columns on next build.
Update buildArchive() to read the fidelity flags from TurnRecord and persist them; update foldStamps() callers if any stamp source contributes to fidelity.
Tests:
ALTER TABLE migration on an existing archive populates the new columns on next build.
A mixed-fidelity fixture (Claude full + Codex aggregate-only) yields the right per-turn attribution_fidelity and the right session-level min_fidelity.
compare / summary queries can filter by fidelity (WHERE attribution_fidelity = 'full') and produce the expected subset.
Context
PR #78's archive schema deliberately omits coverage / fidelity columns:
Issue #40 calls out the requirement explicitly:
Issue #41 (coverage and fidelity metadata) and PR #76 are the upstream — they add fidelity flags to
TurnRecord. The archive needs the equivalent columns so SQL queries can filter / group by them without re-deriving in memory.Today,
compareandsummarycells render—instead of$0.00 / 0%for missing data; that decision currently lives in the analyze layer. Once the archive carries the flags, downstream consumers can express it asWHERE has_full_attribution = 1rather than re-checking each row.Proposal
TurnRecord, add the columns to the archive'sturnstable additively (no rebuild required —ALTER TABLE ... ADD COLUMNwith sensible defaults). Suggested:attribution_fidelity TEXT— one offull,aggregate_only,cost_only,missing,zero.tokens_present INTEGER— boolean: did the source give us per-turn token counts?cost_present INTEGER— boolean: cost only?sessions:min_fidelity TEXT— worst fidelity observed in the session.has_full_attribution INTEGER.ARCHIVE_VERSIONonly if the additiveALTERstrategy doesn't fit; otherwise, keep it stable so existing archives pick up the new columns on next build.buildArchive()to read the fidelity flags fromTurnRecordand persist them; updatefoldStamps()callers if any stamp source contributes to fidelity.Tests:
ALTER TABLEmigration on an existing archive populates the new columns on next build.attribution_fidelityand the right session-levelmin_fidelity.compare/summaryqueries can filter by fidelity (WHERE attribution_fidelity = 'full') and produce the expected subset.Acceptance criteria
turnsandsessionscarry fidelity columns matching the upstreamTurnRecordflags from Coverage and fidelity metadata: distinguish missing, zero, aggregate-only, and partial usage #41 / PR Add coverage and fidelity metadata to TurnRecord (#41) #76.ALTERif possible; rebuild otherwise).burn archive status --jsonrow-count summary surfaces a fidelity histogram.burn compare) demonstrates filtering by fidelity through SQL rather than in-memory.Out of scope
—vs$0.00is rendered in CLI output (the analyze layer already gates this).burn archive status(text mode) beyond the JSON histogram.Refs
burn archive(#40) #78 (Derived analytics archive: materialize the ledger into a local queryable store #40 follow-up)