GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — aggregator(coverage): CoverageSnapshotStore.read accepts a malformed baseline/weekly — diffCoverage then throws on /projects instead of the snapshot reading as absent · Issue #4140 · developing-today/code

aggregator(coverage): CoverageSnapshotStore.read accepts a malformed baseline/weekly — diffCoverage then throws on /projects instead of the snapshot reading as absent #4140

New issue
Copy link
New issue
Copy link
Closed
#6781
Closed
aggregator(coverage): CoverageSnapshotStore.read accepts a malformed baseline/weekly — diffCoverage then throws on /projects instead of the snapshot reading as absent#4140
#6781
Copy link
Assignees
dezren39
Labels
app/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Nov 2, 2026
Issue body actions

Bug

pm-stack/aggregator/src/coverage.ts: CoverageSnapshotStore.read() is documented as "corrupt reads as absent" (coverage.ts:214, class comment: "Thin JSON store for the coverage snapshot; corrupt reads as absent"), but its only validation (coverage.ts:222-232) is:

const parsed = JSON.parse(await readFile(this.file, "utf8")) as CoverageSnapshotFile;
if (!parsed || typeof parsed !== "object" || !parsed.current || !Array.isArray(parsed.current.repos)) {
  return null;
}
return parsed;

baseline and weekly are never checked, and neither are the row fields of any report. A snapshot file whose current.repos is an array but whose baseline is malformed is accepted as a good snapshot, carried through nextCoverageSnapshot (coverage.ts:199-212, which copies stored.baseline / stored.weekly verbatim into the next file — and promotes weekly to baseline at the weekly rotation), and then crashes the consumer:

  • diffCoverage (coverage.ts:168-183) does baseline.repos.map(...) unconditionally — a baseline that is a string, or an object without a repos array, throws TypeError there;
  • that call sits on the /projects render path: coverageSectionHtml in render.ts (diffCoverage at render.ts:5610) and coverageSnapshot() in server.ts:109-128, which feeds the stored snapshot into nextCoverageSnapshot on every panel read;
  • a baseline whose rows carry garbage field types (e.g. openIssues: "ten") survives too and produces NaN deltas (deltaOrNull subtracts unchecked values) that render as (NaN) in the panel.

The snapshot file is exactly the kind of artifact that drifts: the format already grew optional weekly / anchorAt fields with explicit "files written before the field existed" fallbacks (coverage.ts:62-73), so older/hand-edited/partially-migrated files are an anticipated input — the sibling roadmap-annotations store validates every row on load (isAnnotation, roadmap-annotations.ts:76-89) and quarantines a bad file instead of trusting it.

Evidence (verified this run, main @ bc0afe2)

Laptop probe ~/git/fleet/probe-2026-11-01-laneB-projcov/ (verbatim coverage.ts, md5 e17585a5fee1a752a9be91911a9e79ea; store files written to a temp dir, then read() → nextCoverageSnapshot(...) → diffCoverage(...)):

control (well-formed baseline/current/weekly) -> read() NON-NULL, diffCoverage OK, 1 delta entry
baseline: "junk" (string)                      -> read() NON-NULL (accepted); diffCoverage THREW TypeError: undefined is not an object (evaluating 'baseline.repos.map')
baseline: {generatedAt} (no repos)             -> read() NON-NULL (accepted); diffCoverage THREW TypeError (same)
baseline: {repos: "nope"}                      -> read() NON-NULL (accepted); diffCoverage THREW TypeError: baseline.repos.map is not a function
baseline row fields garbage ("ten", null, {})  -> read() NON-NULL (accepted); diffCoverage OK but deltas are NaN
file containing "{not json"                    -> read() null (absent) — the documented behaviour, only for unparseable JSON

Why it matters

One malformed stored snapshot permanently breaks the /projects coverage panel: the bad baseline is re-persisted by coverageSnapshot() on every read (it only writes when the snapshot "changes", and the poisoned baseline is part of the compared shape), and the weekly rotation can promote a malformed weekly into the baseline slot. The store's own contract says this input should read as absent and self-heal with a fresh snapshot; instead it is a recurring render crash with no recovery short of deleting the file by hand.

Acceptance criteria

  • CoverageSnapshotStore.read() validates the whole file shape — current, baseline (when non-null), and weekly (when present) are each either null/absent or a report object with a string generatedAt and a repos array whose rows carry a string repo and number-or-null count fields — and returns null (absent) for anything else, per its documented contract.
  • Files written by the current writer (including pre-weekly/pre-anchorAt files, which rely on the documented fallbacks) still read back exactly as today.
  • A malformed weekly can no longer be promoted into baseline by nextCoverageSnapshot rotation, because the store never hands one out.
  • Tests in pm-stack/aggregator/test/coverage.test.ts: store reads for a string baseline, a baseline without repos, a non-array repos, and garbage row field types all return null; the existing concurrent-write test still passes.
  • Existing aggregator tests still pass.

Dedup: #3364 (closed) covered the feed-side census gate (isRepoCensus) letting impossible census rows into a snapshot; this is the separate file-side read path — the stored snapshot's own baseline/weekly/current shapes are never validated on load. Searches for CoverageSnapshotStore / diffCoverage / "coverage snapshot" return no issue covering it.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    queue/queuedHas a queued queue task
    effort/sSmall: expected under 2 hours of work
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-b
    • Session / ID: new-issue-creator-code-b cron run 2026-11-01 20:50 CST
    • Found via: filed this run — read pm-stack/aggregator/src/coverage.ts on main bc0afe2f and verified with a verbatim copy run on the laptop (probe ~/git/fleet/probe-2026-11-01-laneB-projcov/, coverage.ts md5 e17585a5fee1a752a9be91911a9e79ea): snapshot files with baseline "junk", {generatedAt} (no repos), or {repos:"nope"} all passed CoverageSnapshotStore.read() and then threw TypeError in diffCoverage (baseline.repos.map); garbage row field types yielded NaN deltas; only unparseable JSON read as absent. Dedup: aggregator(coverage): isRepoCensus accepts impossible census rows — negative counts, gate counts above the open total, '/' repos and silent duplicate overwrite — and they persist into the weekly snapshot baseline #3364 (closed) covered the feed-side isRepoCensus gate, not this file-side read path; searches for CoverageSnapshotStore/diffCoverage found no covering issue.
    • Task: Filed this issue: CoverageSnapshotStore.read accepts a malformed baseline/weekly — diffCoverage then throws on /projects instead of the snapshot reading as absent.
    • Expectation: effort s; done when read() validates current/baseline/weekly report shapes (string generatedAt, repos array, typed rows) and returns null for anything else, pre-weekly/anchorAt files still read identically, and coverage.test.ts pins the malformed-baseline reads.
    • Links: aggregator(coverage): CoverageSnapshotStore.read accepts a malformed baseline/weekly — diffCoverage then throws on /projects instead of the snapshot reading as absent #4140
  3. github-actions
    assigned
    dezren39
    on Nov 2, 2026
  4. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 2, 2026
  5. 124 remaining items

  6. developing-today commented on Nov 7, 2026

    @developing-today
    developing-todayBot
    on Nov 7, 2026 – with developing.today
    Contributor
    More actions

    Picked up by repo-worker-code-b (Lane B queue worker, FALLBACK MODE — queue backend down, code#6619; fleet queue fallback subcommand absent in fleet 0.1.0, protocol run manually; comments via the developing.today GitHub App route while the user token is secondary-rate-limited). Lane code-f triaged CONFIRMED and released free at 2026-11-07T03:55:30Z; this claim takes the routed small-fix. No open PR covers #4140 (fresh search this claim).

    🤖 Agent note · picked up

    • Agent: repo-queue-worker Lane B (code-b)
    • Session / ID: lane-b shift 2026-11-06 21:40 CST, fallback mode
    • Task: aggregator(coverage): CoverageSnapshotStore.read accepts a malformed baseline/weekly — diffCoverage then throws on /projects instead of the snapshot reading as absent #4140 (issue is the task in fallback mode; kind task/small-fix) — CoverageSnapshotStore.read() must validate the whole snapshot shape (current/baseline/weekly + row fields) and read malformed files as absent
    • Stage: claimed — implementing per the issue's acceptance criteria in a laptop worktree from current main, with tests in pm-stack/aggregator/test/coverage.test.ts
  7. dezren39
    added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    queue/queuedHas a queued queue task
    on Nov 7, 2026
  8. developing-today commented on Nov 7, 2026

    @developing-today
    developing-todayBot
    on Nov 7, 2026 – with developing.today
    Contributor
    More actions

    Heartbeat — stage: implementation_complete. Laptop worktree ~/git/fleet/fb-4140 (branch queue/fallback-4140-coverage-snapshot-validation from current main): CoverageSnapshotStore.read() now gates the parsed file through isCoverageSnapshotFile — current must be a report (string generatedAt, repos array, rows with string repo and finite-number-or-null counts); baseline/weekly may be null/absent (documented fallbacks preserved) but must be reports when present; anything else reads as absent. bun test test/coverage.test.ts: 24/24 pass, including 3 new #4140 read tests and the existing concurrent-write test. Next: commit, push, PR, Codex gate.

  9. dezren39
    added a commit that references this issue on Nov 7, 2026

    Merge pull request #6781 from developing-today/queue/fallback-4140-co…

    369710f
  10. dezren39
    closed this as completedin #6781on Nov 7, 2026
  11. dezren39
    added
    status:done
    and removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/triagedTriaged and routed (see agent note)
    on Nov 7, 2026
  12. developing-today commented on Nov 7, 2026

    @developing-today
    developing-todayBot
    on Nov 7, 2026 – with developing.today
    Contributor
    More actions

    Released — outcome: done. Summary: fixed_merged via PR #6781 (merge commit 369710f, verified by fresh gh api + gh pr view readbacks) — CoverageSnapshotStore.read() now validates the whole snapshot file shape via isCoverageSnapshotFile and reads malformed files as absent, per its documented contract; pre-weekly/pre-anchorAt fallbacks preserved. Laptop: bun test test/coverage.test.ts 24/24 pass (3 new #4140 read tests + existing concurrent-write test). Codex on the PR head: completed, no findings. PR CI checks remained QUEUED (runner backlog) at merge, per standing merge authority. Issue #4140 closed by the PR (Fixes #4140); queue/work/status labels cleaned by this release.

    🤖 Agent note · done

    • Agent: repo-queue-worker Lane B (code-b)
    • Session / ID: lane-b shift 2026-11-06 21:40 CST, fallback mode (backend down, code#6619)
    • Task: aggregator(coverage): CoverageSnapshotStore.read accepts a malformed baseline/weekly — diffCoverage then throws on /projects instead of the snapshot reading as absent #4140 (issue is the task in fallback mode) — outcome fixed_merged, PR fix(aggregator): validate the whole coverage snapshot shape on read (#4140) #6781
  13. dezren39
    added a commit that references this issue on Nov 8, 2026

    Merge origin/main into queue/8884-5196-coverage-anchor (#5196)

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

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.