GeezerVison is showing github.com — aggregator(views): ViewsStore load keeps malformed rows — a missing/non-string name makes save()/rename() throw TypeError, and a non-object filters silently becomes a match-everything default view · Issue #4150 · developing-today/code
aggregator(views): ViewsStore load keeps malformed rows — a missing/non-string name makes save()/rename() throw TypeError, and a non-object filters silently becomes a match-everything default view #4150Labels 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 jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DescriptionProblem
pm-stack/aggregator saved views (#1276): ViewsStore.doLoad promises in the module header that "an unparseable or wrongly-shaped file is quarantined … never silently overwritten" (views.ts:11-14), but the row-level check only requires each row to be an object with a string id (views.ts:198-200). Malformed-but-parseable rows are neither quarantined nor dropped, and they break the store in two verified ways:
- A row whose
name is missing or not a string makes every later save() (views.ts:257, v.name.toLowerCase()) and rename() for that owner throw a TypeError — the owner can never save or rename a view again while that row is in the file, and nothing tells them why.
- A row whose
filters is not an object (e.g. the string "repo:x/y") is served as-is: defaultFor() returns it, and itemMatchesView reads filters.repo etc. as undefined, so every filter dimension is skipped and the "filtered" default view silently matches every item. viewQuery likewise encodes none of its filters.
Evidence (verified this run, main c8a21912)
pm-stack/aggregator/src/views.ts:198-200 — doLoad filter: (v) => typeof v === "object" && v !== null && typeof v.id === "string"; no check of name, owner, filters, isDefault, or createdAt.
pm-stack/aggregator/src/views.ts:255-258 — save() duplicate-name scan calls v.name.toLowerCase() on every same-owner row.
- Laptop probe (verbatim
views.ts from main c8a21912, md5 dfe51cfc329ba111f8603f112f5787eb; stub model.ts type only; probe ~/git/fleet/probe-2026-11-01-laneA-views/ on the laptop, bun):
- File with one good-shaped row except
name omitted → no quarantine file created; all()/forOwner()/defaultFor() return the row; save({owner:"gh:1", …}) → TypeError: undefined is not an object (evaluating 'v.name.toLowerCase').
- Same with
name: 42 → save() → TypeError: v.name.toLowerCase is not a function.
- File with
filters: "repo:x/y" on an isDefault: true row → defaultFor("gh:1") returns it with filters still the string; applyView([{repo:"a/b",…},{repo:"x/y",…}], filters) returns both items — the repo filter is silently not applied.
- Control: a fully well-formed row loads, saves, and defaults normally.
Why it matters
The store's stated discipline (comments-store #906 pattern) is that a wrongly-shaped file is quarantined loudly rather than half-trusted. Today one hand-edited, partially migrated, or foreign-written row in PM_AGG_VIEWS_FILE (a) wedges that owner's view mutations with an unhandled TypeError on the mediated action path, and (b) can silently widen a person's default landing view from a narrow filter to the whole board — the exact failure a saved view exists to prevent, with no log line naming the bad row. Distinct from #4140 (CoverageSnapshotStore) and #2347 (comments/actions store): this is the new views store from #1276/#4013, whose only corrupt-file test covers unparseable JSON, not parseable-but-malformed rows.
Acceptance criteria
-
ViewsStore load validates each row's full shape (id/name/owner strings, filters passing validateViewFilters or an equivalent row check, boolean isDefault, string timestamps): a file with a malformed row is either quarantined per the header contract or the malformed rows are dropped with a loud log naming the row — behaviour pinned by a test; well-formed rows in the same file are not silently lost without that quarantine/log trail.
- With a malformed row present in the on-disk file,
save() and rename() for the affected owner no longer throw TypeError.
- A malformed
filters value can never reach defaultFor()/applyView as a match-everything view.
- Existing views tests pass, including the corrupt-file quarantine test.
Activityadded kind/bugSomething isn't working (prefixed form of the classic bug label) task/triageQueue packet kind: verify, reproduce, and route this item effort/sSmall: expected under 2 hours of work on Nov 2, 2026dezren39 commented on Nov 2, 2026 🤖 Agent note · filed
- Agent: new-issue-creator job (lane A,
new-issue-creator-code-a)
- Session / ID: cron run 2026-11-01 21:05 CST (2026-11-02T03:05Z)
- Found via: filed this run
- Task: Filed issue aggregator(views): ViewsStore load keeps malformed rows — a missing/non-string name makes save()/rename() throw TypeError, and a non-object filters silently becomes a match-everything default view #4150 —
ViewsStore.doLoad (pm-stack/aggregator/src/views.ts:198-200) keeps any row with a string id, despite the header's quarantine promise for wrongly-shaped files (views.ts:11-14): a missing/non-string name makes save()/rename() throw TypeError at views.ts:257, and a non-object filters is returned by defaultFor() and silently matches every item in itemMatchesView/applyView. Verified this run on the laptop with verbatim views.ts from main c8a21912 (md5 dfe51cfc329ba111f8603f112f5787eb): name omitted → save TypeError, no quarantine; name: 42 → same; filters: "repo:x/y" on a default row → applyView returned both a matching and a non-matching repo item; well-formed control row normal.
- Expectation: effort/s — load validates each row's full shape (malformed rows quarantined with the file or dropped with a loud log, per the header contract, pinned by a test); malformed filters can never become a match-everything default; existing views tests pass.
- Links: probe
~/git/fleet/probe-2026-11-01-laneA-views/ (laptop); queue packet enqueued this run (repo-health-code-pilot).
dezren39 commented on Nov 2, 2026 dezren39 commented on Nov 2, 2026 agent-note:v1 — state: parked at=2026-11-02T04:41:32Z (OpenChamber scheduled lane)
dezren39 commented on Nov 2, 2026 agent-note:v1 — state: done at=2026-11-02T05:05Z (Lane D queue worker)
MetadataMetadataapp/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 jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DevelopmentNo branches or pull requestsIssue actions
|