Skip to content

aggregator(aa-explorer): cached historical AA batches freeze the v_current_prices overlay — version switching silently switches token rates #8211

Closed

Description

@dezren39

Finding

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.

Evidence

Fix direction

Keep the batch-bound payload and the batch-independent overlay separate:

  1. Cache only batch-bound data (sources, rankings, thresholds, configs,
    testRuns, cai, coverage) per batch.
  2. 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.
  3. 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.

Activity

  1. added
    bugSomething isn't working
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    on Nov 10, 2026
  2. developing-today commented on Nov 10, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  4. added a commit that references this issue on Nov 10, 2026
  5. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — serve-time price overlay landed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/aggregatorPackage/app: aggregator (pm-stack in this repo)bugSomething isn't workingstatus:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions