Skip to content

Consolidate muse-dev2 Supabase tables: merge workbook-era duplicates, retire deprecated views #4401

Closed

Description

@dezren39

Why

On 2026-11-02 Drew ordered Supabase-only for the model/plan data: every Drive workbook was audited, the one gap was ingested, and the Drive files were renamed DEPRECATED (see the ainventory Maintenance_Log entry "Supabase-only consolidation", 2026-11-02). What remains is the table sprawl the workbook era left inside muse-dev2 itself: several overlapping stores hold the same facts, and reads keep landing in the wrong one. Concrete proof, same day: the AA Intelligence Index v5 load (2026-10-31) lives ONLY in ainventory.sheet_rows Rankings rows, while measurement_events and benchmark_results hold no v5 at all — a direct question about v5 data was first answered "we don't have it" because the event log was checked instead of the sheet mirror.

Scope

ainventory (first):

  • Decide the canonical store for benchmark facts. Three layers overlap today: sheet_rows (JSON-cell workbook mirror), benchmark_results (typed, workbook-era, frozen at the 2026-10-26 import), measurement_events (append-only event log, holds II v4.3.2 + CAI only). The 2026-10-26 design (Model data pipeline: workbook-free append-only event log + agent interpretation #1248) names the event log as the target shape.
  • Backfill the canonical store from Rankings AA|v5 + AA|v4.3.2 rows (incl. the 2026-11-02 source-44 rows: DeepSeek V4.1 Flash 1017 keying, cost/time fills) so no dataset exists only as sheet cells.
  • Retire benchmark_results as a table — drop it or rebuild it as a view over the canonical store.
  • Retire the deprecated alias view v_latest_workbook_batch (marked DEPRECATED 2026-11-02; use v_latest_import_batch). Consumers to migrate/audit first: the coding-plan-watch job (switched 2026-11-02), ainventory_append.py, the pm-aggregator AA collector/explorer (pm-aggregator /aa explorer data feed broken: Supabase query 403 after muse-dev2 migration #3294, AA explorer: dataset version switcher — browse older AA import batches, not just latest #3302 touch this surface).
  • Data hygiene inside the sheet mirror: duplicate variant keys for the same model+effort (Claude Haiku 5.5 and GPT-6.1 Sol each appear twice per effort — |reasoning| and |yes| key forms); the two model_value_data sources (ids 42 + 43) — keep both for provenance, dedupe at read time or via the canonical store.

Other schemas:

  • automation / engineering / finance / home / research all carry the same workbook-era sheet_rows + ingest_batches + sources clone shape. Decide per domain: converge on the typed events shape their append helpers already write, or formally keep the mirror — no silent third state.
  • agent.mirror_* tables: verify each mirror still has a live consumer; drop or document the ones nothing reads.

Constraints

  • No history loss: merges preserve provenance (source ids, import batches, snapshot dates, estimated-vs-measured flags such as the Rankings |estimated rows).
  • No DROP before a consumer audit + readback verification of the replacement path (pm-aggregator collector, quota gatherer, coding-plan-watch, pool-intelligence all read this data).
  • One schema/domain at a time, each step verified by readback before the next.
  • Finish by updating ~/hatch-personal/workspace/supabase/ARCHITECTURE.md so the documented shape matches reality.

Acceptance

  • Exactly one canonical read path per dataset, named in ARCHITECTURE.md.
  • No live job, view, or doc references v_latest_workbook_batch or describes Drive workbooks as a data source.
  • v5 benchmark data is queryable from the canonical store (not only from sheet cells).

Related: #1248 (the event-log design this executes), #3142 (pm stack into Supabase — adjacent, not this), #3294 / #3302 (AA explorer consumers).

Activity

  1. added
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  2. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up + triage verdict: CONFIRMED, still live, routed (no schema changed)

    • Agent: queue worker (repo-worker-code), OpenChamber scheduled lane 8ac61616-3815-4e7b-b33d-840a3829154a
    • Session / ID: queue task 8401 (triage packet for this issue)
    • Found via: queue claim
    • Verified: live muse-dev2 (keihfchslgjetkmnmzra) read-only via the Management API on 2026-11-03; developing-today/code main eef89b983

    The split-brain is real and the mirror is still winning. Measured state:

    store rows freshness v5 present shape
    ainventory.sheet_rows 85,289 latest batch 2026-11-02 15:12 yes — 832 rows JSON workbook mirror
    ainventory.benchmark_results 1,141 last batch 2026-10-26 13:16 no typed, frozen
    ainventory.measurement_events 779 last ingest 2026-10-26 13:16, 0 rows in the last 7 days no append-only event log

    measurement_events only knows AA@?, AA@4.3.2, CAI@1.4, CAI@1.5 — AA Intelligence Index v5 exists nowhere but sheet cells, exactly the failure recorded in the body. The recent coding-plan-watch batches (2026-11-02) wrote maintenance_log/plan_events only, so the event log is dormant while the mirror keeps taking writes: the split is widening, not converging.

    Other scope items, checked:

    • v_latest_workbook_batch still exists and its pg_get_viewdef is byte-identical to v_latest_import_batch (pure alias — retiring it is a rename, not a semantics change). No reference in this repo; live references are only the ainventory_append.py:7 docstring and ARCHITECTURE.md:103.
    • agent.mirror_*: 28 tables.
    • The workbook-era sheet_rows clone shape is present in automation, engineering, finance, home, research — five schemas, as the body says.
    • #1248 (the event-log design this executes) is still OPEN and blocked; #3294 closed, #3302 open (explorer version switcher, adjacent).

    Routing

    • Enqueued task 8491 (repo-health-code-pilot, small_fix, risk high: production-data / drop-table / multi-step-migration) as the single execution task for this issue, carrying the issue's own constraints: canonical-store decision first, v5 backfill with readback, benchmark_results retirement, alias drop, mirror hygiene, per-schema verdicts, mirror audit, ARCHITECTURE.md update — one step at a time, no DROP before consumer audit + readback.
    • Suggested order inside 8491 (my read): (1) drop the alias (mechanical, zero-semantic-change, verify v_latest_import_batch uuid readback); (2) backfill measurement_events from the Rankings AA v5 / v4.3.2 sheet rows and readback the counts; (3) benchmark_results → view over the canonical store; (4) duplicate variant-key + sources 42/43 read-time dedupe; (5) the five other schemas' verdicts; (6) the 28-mirror audit.
    • Blocker to note: nothing here is gated on Model data pipeline: workbook-free append-only event log + agent interpretation #1248 for reads (v5 backfill can land on the shapes that already exist), but the canonical-table decision should follow Model data pipeline: workbook-free append-only event log + agent interpretation #1248's target shape rather than inventing a third one.
    • No code or schema was changed by this triage.
  3. added
    status/triagedTriaged and routed (see agent note)
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 3, 2026
  4. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  5. 157 remaining items

  6. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 11, 2026
  7. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up — executing tranche 2 (the recorded resume condition)

    • Agent: repo queue worker, lane any-c (repo-worker-code), task 14717. Assignment direct. This is this shift's FIRST task, per the resume condition set by prior lanes.
    • Revalidated fresh: issue Consolidate muse-dev2 Supabase tables: merge workbook-era duplicates, retire deprecated views #4401 OPEN, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit all absent). Tranche 1 verified on this issue (lane any-d, note at 2026-11-11T09:20:00Z): 143 AA v5 measurement_events inserted under batch 21b09af3-66b6-40df-8f39-a58044d57271, 0 mismatches, total events 922, ARCHITECTURE.md names measurement_events as canonical.
    • Plan this shift (tranche 2): (1) inspect pm-stack/aggregator aa-batch-sql.ts benchmark_results queries and model.ts expected columns, (2) migrate those queries to measurement_events or rebuild benchmark_results as a view with exact expected columns, (3) verify aggregator read paths against the canonical store, (4) only then retire benchmark_results, with readback evidence posted here.
    • Links: issue Consolidate muse-dev2 Supabase tables: merge workbook-era duplicates, retire deprecated views #4401, task 14717
  8. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 11, 2026
  9. added a commit that references this issue on Nov 11, 2026
  10. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · tranche 2 DONE — benchmark_results retired, #4401 complete (task 14717, lane any-c)

    Aggregator migration (PR #8681, merged 0566f38):

    • pm-stack/aggregator/src/aa-batch-sql.ts: the AA payload's configs and cai sections now read the canonical ainventory.measurement_events, scoped to the latest workbook-import ingest batch (the events' equivalent of the latest sheet import batch); speedTps projects from output_tps. Configs keep benchmark_version is null; cai keeps rows whose raw carries benchmark_version. Comment references in aa.ts, model.ts, collect-fleet-feed.ts updated.

    Consumer audit (recorded before the drop, per acceptance): repo-wide grep found the aggregator as the only live code reader of benchmark_results; the other packet-named consumers (quota gatherer, coding-plan-watch, pool-intelligence) have no references; no Supabase views, functions, or matviews reference the table.

    Parity verification (live, pre-drop): full-row EXCEPT comparison of the old table's latest-batch rows vs the new query scope — configs 35/35, cai 27/27, zero differences in either direction. No history loss: every row the aggregator ever read is represented in measurement_events with provenance (ingest batch, source_kind, raw).

    Drop + post-drop verification: ainventory.benchmark_results (1,141 rows, frozen at the 2026-10-26 import) dropped; readback confirms it no longer exists. The full merged aaPayloadSql(null) was then executed against the live database: configs 35, cai 27, rankings 283, thresholds 1144, prices 4, sources 4 — the complete AA section builds from the canonical store alone.

    Tests: aggregator bun test for aa-batches, aa-explorer-computations, aa-gate-2415/4169/5289 — 46 pass, 0 fail. (test/aa.test.ts fails pre-existing in this environment on clean main too — live-server port / package environment issues, unrelated.)

    Docs: ARCHITECTURE.md updated — measurement_events remains the one canonical read path; the benchmark_results retirement is recorded.

    All acceptance items on this issue are now met (tranche 1: canonical decision + AA v5 backfill, batch 21b09af3; tranche 2: this note). Closing.

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

Metadata

Metadata

Assignees

Labels

effort/lLarge: multi-day or open-ended; expect staged check-inskind/infrastructureInfrastructure / host-portability workpriority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions