Skip to content

Usage snapshots: move ingestion out of the aggregator read path and report writer health #1205

Closed

Description

@dezren39

Part of epic #1184 (PM stack coherence review, 2026-10-26).

Snapshot history depends on a write side-effect inside a read path and on manual backfill scripts. Evidence: live.ts usage() appends feed snapshots during a GET — 'the one write this reader makes' — and history otherwise depends on scripts/backfill-usage-snapshots.ts and append-usage-snapshots.ts being run by owning jobs. Empty history renders as a bare 'No snapshots yet' with no writer-health context.

Acceptance:

  • GET /quota and /quota/service/* perform no writes (test with a read-only store dir).
  • Snapshot freshness per service is visible on the service page/health.
  • Backfill remains a documented one-shot, not a load-bearing manual step.

Acceptance criteria

  • GET /quota and /quota/service/* perform no writes (verified with a read-only store dir).
  • Snapshot freshness per service is visible on the service page and/or /health.
  • Backfill remains a documented one-shot step, not a load-bearing manual step.

Activity

  1. added
    kind/choreRoutine maintenance, housekeeping, dependency hygiene
    on Oct 27, 2026
  2. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  3. added
    priority/normalOrdinary priority (the default)
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Oct 27, 2026
  4. added
    source/humanFiled directly by a human
    effort/mMedium: expected under 1 day of work
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Oct 28, 2026
  5. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Intake review — fleet monitor

    Liveness: Verified still live at intake (2026-10-28): issue is open and unheld, and a merged-PR search for #1205 returned only unrelated text matches (no PR title or fix reference resolves this item). Part of epic #1184 (PM stack coherence review, 2026-10-26); sibling batch #1210–#1222 was enriched in the previous monitor run.

    Notes: A write inside a GET is the root smell; moving ingestion to the writer jobs also makes freshness measurable. Risk: snapshot cadence changes must not starve history — keep the backfill script as the documented one-shot it already is.

    Risks: Scope creep across the pm-stack pages is the main risk for this batch; the acceptance criteria above (converted from the issue's original Acceptance list) bound the work. CI on the aggregator's render/derive tests is the verification surface.

    Suggested approach: Take the acceptance criteria in order; keep the JSON twins in lockstep with the HTML pages, per the batch convention.

    Labels normalised this pass: source/human (coherence-review filer), effort/m, meta/enriched; existing kind/priority/status/app labels kept.

  6. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 1, 2026
  7. 17 remaining items

  8. added
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  9. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 40 (priority/normal). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  10. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 3, 2026
  11. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — already done (verified at current main)

    • Agent: queue worker (repo-worker-code), Lane C shift
    • Session / ID: queue task 7657 (triage)
    • Found via: queue claim · repo-health-code-pilot
    • Task: Re-triage Usage snapshots: move ingestion out of the aggregator read path and report writer health #1205 (usage snapshots: move ingestion out of the aggregator read path + report writer health). Prior verdicts stand in the history: task 2480 CONFIRMED the gap (2026-11-01); implementation task 4913 opened PR fix(aggregator): ingest usage snapshots outside reads #3955.
    • Verdict: ALREADY DONE. PR fix(aggregator): ingest usage snapshots outside reads #3955 "fix(aggregator): ingest usage snapshots outside reads" MERGED 2026-11-02 (9 files). Verified fresh at origin/main a8dbda7 against every acceptance criterion:
      • GETs perform no writes: live.ts usage() now only reads the store ("This reader only reads it"); the append moved to a dedicated ingestSnapshots() on the source, called only from server.ts's background writer tick (setInterval(SNAPSHOT_INGEST_INTERVAL_MS) + one startup recovery call, server.ts:1857-1871) — never from a GET handler.
      • Freshness visible per service: quota service cards carry freshnessStamp(measuredAt, sourceClass, cadenceDays) with stale flagging (render.ts ~2212-2227); /health reports feed freshness against the 5m threshold (health.ts:355).
      • Backfill is a documented one-shot: aggregator README documents scripts/backfill-usage-snapshots.ts as an "idempotent one-shot recovery, not normal history startup" and inventories the three snapshot writers (README ~553-556).
    • Action: closing this issue as completed on the evidence above. No follow-up task needed; the coverage-pass re-queue (task 7657) is completed as already_done.
  12. removed
    user/reviewNeeds a user-look: Muse reviews first and handles what it can
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/mMedium: expected under 1 day of workkind/choreRoutine maintenance, housekeeping, dependency hygienemeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/humanFiled directly by a humantask/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