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
{{ message }}
Repository navigation
aggregator(aa-explorer): cached historical AA batches freeze the v_current_prices overlay — version switching silently switches token rates #8211
PR #7564 (the #3302 AA dataset-version switcher) caches one payload per ainventory
import batch. Each cached section carries the batch-bound measurements and prices from v_current_prices plus the price-derived rates in catalog
(aaSectionFromSupabase in pm-stack/aggregator/src/aa.ts, ~lines 1127–1156).
v_current_prices is a current-price overlay, not a historical price snapshot — the /aa page says so explicitly ("Token prices remain the current v_current_prices
overlay, not a historical price snapshot"). But once a payload is cached, that
snapshot of prices is frozen at build time. When token prices change and the collector
rebuilds only the latest batch, every previously cached historical batch keeps serving
its old prices/catalog rates. Switching dataset versions therefore also switches
token rates, while the page states they are a current overlay.
Cache skip path: scripts/collect-fleet-feed.ts skips a batch when cacheMeta.get(row.importBatch)?.cached is true, i.e. whenever the config
fingerprint is unchanged — prices are not part of that key.
The read path just returns parsed.section (src/sources/live.ts, historical
branch), so the frozen prices are what render.
Fix direction
Keep the batch-bound payload and the batch-independent overlay separate:
Cache only batch-bound data (sources, rankings, thresholds, configs, testRuns, cai, coverage) per batch.
Refresh prices from v_current_prices each tick (the collector already queries
them for the latest payload) and re-derive the catalog rates on read/build for
every served batch, latest and historical.
If a re-overlay is impossible (e.g. the price query failed), mark the section stale with a reason rather than silently showing old rates.
Acceptance
A test that builds two cached batches with differing prices payloads, refreshes
prices once, and asserts both the latest and the historical section report the new
rates.
/aa?batch=… renders the same rates as /aa for the price overlay, with no change
to the batch-bound figures.
Plan: separate the batch-bound payload from the price overlay in pm-stack/aggregator (aa.ts / aa-batches.ts / live.ts / collect-fleet-feed.ts), re-derive rates per served batch, stale-mark when overlay refresh fails, per the packet acceptance; bun test test/aa.test.ts test/aa-batches.test.ts.
Activity
developing-today commentedon Nov 10, 2026
CODE-2432
dezren39 commentedon Nov 10, 2026
🤖 Agent note · picked up
bun test test/aa.test.ts test/aa-batches.test.ts.Merge pull request #8349 from developing-today/queue/14715-8211-aa-pr…
dezren39 commentedon Nov 10, 2026
🤖 Agent note · done — serve-time price overlay landed
aaApplyPriceOverlay(src/aa.ts) separates the batch-bound payload from the v_current_prices overlay, and the live source (src/sources/live.ts) now re-derives a cached historical batch's prices + catalog rates from the feed's current overlay at serve time when the entry's overlay fingerprint differs — no batch refetch. When no current overlay exists, priced cached batches are served stale-marked with a price-overlay reason instead of silently. (Collector-side validity-keying from PR feat(aggregator): browse historical AA dataset batches #7564 remains as the rebuild backstop.)bun test test/aa.test.ts test/aa-batches.test.ts— 65 pass, 0 fail, including 4 new aggregator(aa-explorer): cached historical AA batches freeze the v_current_prices overlay — version switching silently switches token rates #8211 tests (two-batch overlay refresh at the function level; live serve with refreshed overlay; live stale-mark with no overlay).bunx tsc --noEmiterror count unchanged from main (16, all pre-existing). Codex review on PR fix(aggregator): re-derive the price overlay at serve time for cached AA batches (#8211) #8349 was still running with no findings posted at merge time.