GeezerVison is showing github.com — impl(pm-stack): move the aggregator laptop-local JSON stores to Supabase muse-dev2 (#3989 slice) · Issue #6815 · developing-today/code
impl(pm-stack): move the aggregator laptop-local JSON stores to Supabase muse-dev2 (#3989 slice) #6815DescriptionSlice of #3989, routed by lane code-n triage 2026-11-07 (see the ownership-map comment on #3989).
The aggregator still holds canonical mutable state as laptop-local JSON in ~/.local/state/pm-aggregator/ (actions.json, activity-ingestion.json, usage snapshot JSONL, aa-last-good.json). Drew's #1258 ruling (2026-11-03): all PM-stack state goes to Supabase muse-dev2; nothing is intentionally laptop-only (Q7: none). The alerts ledger and quota readings already live in muse-dev2 — this slice finishes the aggregator side, consuming #3142's schema contracts (do not redesign them).
Acceptance criteria:
Activitydezren39 commented on Nov 7, 2026 developing-today commented on Nov 8, 2026 ContributorAuthor More actions dezren39 commented on Nov 14, 2026 Released to the queue under Drew's 2026-11-13 unblock-all order (main chat, 23:53 CT). Task(s) 15215 moved from blocked/parked to queued in the fleet unblock-all pass (worker main-unblock-all-2026-11-13). Dependency gates still recorded on a task remain recorded — the dependency checker will re-block it if a gate is genuinely unmet. dezren39 commented on Nov 14, 2026
agent-note:v1
state: triaged
Triage verdict (fresh at origin/main 0f95933, 2026-11-14): CONFIRMED still live; coherent packet produced (this replaces packet-defective task 11416).
- The four named stores (actions.json, activity-ingestion.json, usage snapshot JSONL, aa-last-good.json) still default to laptop-local files under ~/.local/state/pm-aggregator/ (pm-stack/aggregator/src/config.ts). Nothing has migrated them yet; no PR, no live fix task before this triage.
- The migration is implementation, not design: src/supabase.ts exists and the alerts ledger + quota readings already live in muse-dev2; the storage contracts are recorded in pm-stack/SHARED-SCHEMA-MAP.md / SHARED-SCHEMA-MIGRATION-PLAN.md (Long-term: migrate the pm stack into Supabase — refactor component state into schemas for central management #3142, epic verified live and correctly structured 2026-11-08). The Long-term: migrate the pm stack into Supabase — refactor component state into schemas for central management #3142 Moves-3+ gate covers native service stores (Kaneo/Grist/Pad), not this aggregator Move-1 store group.
- Scope discipline: more stores are laptop-local today than the issue listed in November (freshness, notifications, needs-drew, decisions, decision-events, stack-health, item-history). Those are impl(pm-stack): move stateful services off the laptop and prove host failover #3989 siblings — explicitly excluded from this slice so the packet stays bounded; the follow-on PR must name them as remaining scope.
- Follow-on: queue task 16747 (small_fix, dedupe repo-health:v1:fix:developing-today/code:issue:6815, priority 70) enqueued with per-store acceptance, the one-writer rule, env-configured backend with explicit dev/test fallback (no dual writes), and the fresh-state boot reconstruction test.
Task 15215 completes as triaged naming task 16747.
dezren39 commented on Nov 16, 2026 Fleet conductor dispatch: repo-queue task 16747 claimed; worker session ses_e5e1c632445ffeQdUQ3Ny7DB6D in worktree fix-aggregator-stores-supabase on model opencode-route/workhorse. Scope: move actions.json, activity-ingestion.json, usage snapshot JSONL and aa-last-good.json from ~/.local/state/pm-aggregator/ to Supabase muse-dev2 per #3142 contracts; sibling stores excluded (owned by #3989). Worker will report checkpoint/PR/merge progress in the queue task and again in this issue. Note: two duplicate trial sessions for the same task were launched during dispatch and have been deleted; the bound session above is the single owner. dezren39 commented on Nov 16, 2026 Conductor dispatch (2026-11-16T10:50Z) — task 16747 re-dispatched.
- Session:
ses_e5e1c077cd0ffeHAT1nsre7o73 (route workhorse, agent build)
- Worktree:
/home/user/git/fleet/16747-6815-aggregator-stores
- Branch:
queue/16747-6815-aggregator-stores off origin/main @ 0cd68b0
- Queue: repo-health-code-pilot, task 16747, attempt 3 (prior session ses_e5e1c632445ffeQdUQ3Ny7DB6D failed with zero artifacts — this run starts clean)
Scope is the four aggregator-owned stores only (actions.json, activity-ingestion.json, usage snapshot JSONL, aa-last-good.json) to muse-dev2; #3989 siblings stay out of scope. dezren39 commented on Nov 16, 2026 RPO / #1514 backup note (implementation: PR #10722)
Applied to muse-dev2 (previously no agg_% tables existed there):
Import (bun run scripts/migrate-stores-to-supabase.ts, idempotent upserts):
actions=18, ingestion=3, gaps=1351, snapshots=18093, documents=1 — read back through the new adapters with the same counts.
RPO path. The four stores were the laptop's only copy, so a laptop loss was total loss. Current state:
- canonical copy: Supabase muse-dev2 (
PM_AGG_STORE_BACKEND=supabase in the unit and install.sh render; file remains the dev/test path and rollback target);
- daily backup:
pm-dashboard-backup.sh exports the five tables as JSON into supabase/agg_*.json in the same dated archive that already goes to local + R2 + Drive, records them as conditionally-required manifest members, and fails the run before any upload if the export ran but a member is missing;
- local files under
~/.local/state/pm-aggregator/ are now documented as a rebuildable cache — a fresh state dir boots and reconstructs from muse-dev2 (covered by test/store-remote-backends.test.ts).
Cutover order and the post-deploy re-run. DDL → import → deploy (PM_AGG_STORE_BACKEND=supabase) → re-run the import once after the deploy. The re-run is a no-op for rows already present and closes writes made between the import and the switch. Re-run:
cd ~/git/code/pm-stack/aggregator && bun run scripts/migrate-stores-to-supabase.ts
Rollback: set PM_AGG_STORE_BACKEND=file and restart; the file stores were never deleted. The new tables are additive and each down migration refuses to drop a non-empty table.
Scope note: the sibling stores (freshness.json, notifications.jsonl, needs-drew.json, decisions.json, decision-events*.jsonl, stack-health.json, item-history.jsonl) are not in this change — they remain laptop-local and are follow-on scope (#3989). dezren39 commented on Nov 16, 2026
Agent note — task 16747 done: PR #10722 merged (lane code-d, 2026-11-16)
State: done (fixed_merged)
- PR Move the PM aggregator's four local stores to Supabase muse-dev2 (#6815) #10722 MERGED 2026-11-16T14:04:25Z, merge commit 96afdb6, supervised/merged by lane code-d under the standing merge criteria. The four named stores (actions, activity-ingestion, usage snapshots, aa-last-good) are canonical in Supabase muse-dev2 behind PM_AGG_STORE_BACKEND; exactly one active backend, no dual writes, fail-closed on remote failure; local files are a documented rebuildable cache; fresh-state boot reconstruction is tested.
- Verification per PR Move the PM aggregator's four local stores to Supabase muse-dev2 (#6815) #10722 body: bunx tsc --noEmit clean; bun test test/store-remote-backends.test.ts 14 pass (incl. empty-state-dir reconstruction); test/supabase-export.test.ts 20 pass; test/actions.test.ts has 6 HTTP-boot failures proven identical at origin/main baseline (environmental, not this change). Migrations applied to muse-dev2 with read-back counts matching (actions=18, ingestion=3, gaps=1351, snapshots=18093, documents=1). Codex gate: zero reviews/review comments — no findings to disposition.
- RPO / backup note for the pm-stack databases (Kaneo Postgres, Grist, Pad) have no backup routine — docker volumes are the only copy #1514 path: pm-dashboard-backup.sh now exports the five agg tables as JSON into supabase/agg_*.json whenever the deployed backend is supabase (conditionally-required manifest members) — that export is the restore source now that the local files are only a cache.
- Follow-on scope (impl(pm-stack): move stateful services off the laptop and prove host failover #3989 siblings, NOT migrated here): freshness.json, notifications.jsonl, needs-drew.json, decisions.json, decision-events*.jsonl, stack-health.json, item-history.jsonl remain laptop-local.
- Per PR Move the PM aggregator's four local stores to Supabase muse-dev2 (#6815) #10722 this issue stays open to carry the RPO note and follow-on scope.
dezren39 commented on Nov 23, 2026
Agent note — Lane CT done-check: #6815 closed as completed (archer, 2026-11-22)
Premise check: the four named stores were migrated by PR #10722 (merged 2026-11-16, merge 96afdb66b1), but the issue stayed open "to carry the RPO note and follow-on scope". Since then the destination itself was superseded, and every acceptance criterion now verifies against current main + the live service:
- Criterion 1 (canonical remote store; local files are a documented rebuildable cache): PR Move the PM aggregator's four local stores to Supabase muse-dev2 (#6815) #10722 moved actions / activity-ingestion / usage snapshots / aa-last-good to muse-dev2. PR Migrate remaining PM writers and backup wiring to Turso #11919 (merged 2026-11-18) migrated the remaining PM writers and backup wiring to Turso, and PR refactor: remove the remaining Supabase code paths; Turso is the only remote store #12156 (merged 2026-11-21,
be0d2b9f34c) removed the remaining Supabase code paths — "Turso is the only remote store"; PR cold-store, deploy: stop reaching for the retired Supabase project #12005 stopped the deploy reaching for the retired Supabase project. Live check today: pm-aggregator.service is active/running with PM_AGG_STORE_BACKEND=turso.
- Criterion 2 (one writer; dev/test path works; rollback-safe without dual writes): the live unit env carries
PM_AGG_STORE_WRITER=pm-aggregator.service; install.sh on main renders the turso backend with PM_AGG_STORE_BACKEND=file documented as the rollback / dev-test path; the turso adapter fails closed without a client instead of falling back to a local file (test-pinned).
- Criterion 3 (tests pass; fresh-state boot reconstructs from the remote): re-run today at origin/main
09d665fad13 in a clean laptop worktree: bun test test/store-remote-backends.test.ts → 20 pass / 0 fail, including "turso mode reconstructs from the remote and never creates the file" and "turso mode without a client fails closed instead of using a local file".
- Criterion 4 (RPO via the pm-stack databases (Kaneo Postgres, Grist, Pad) have no backup routine — docker volumes are the only copy #1514 backup path): pm-stack databases (Kaneo Postgres, Grist, Pad) have no backup routine — docker volumes are the only copy #1514 is closed.
nixos/home/pm-dashboard-backup.sh on main exports the five agg tables from Turso (turso/agg_actions.json, agg_activity_ingestion.json, agg_activity_gaps.json, agg_usage_snapshots.json, agg_store_documents.json) as conditionally-required manifest members and fails the run before any upload if the export ran but a member is missing; the canonical copy itself now lives off-laptop in Turso.
Follow-on scope is NOT in this issue: the sibling stores (freshness.json, notifications.jsonl, needs-drew.json, decisions.json, decision-events*.jsonl, stack-health.json, item-history.jsonl) were explicitly carved out to parent #3989, which remains open and carries them; sibling slice #6816 (Kaneo/Grist/Pad canonical stores) is separate and still open.
Closing as completed. The muse-dev2 wording in the title is historical: the stores did land there first (#10722) and were then carried to Turso with the rest of the PM stack (#11919 / #12156).
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|