Title: aggregator stores: non-ENOENT read errors silently start empty — next persist overwrites the audit history PR #2099 meant to protect · Issue #2980 · developing-today/code · GitHub
Open Graph Title: aggregator stores: non-ENOENT read errors silently start empty — next persist overwrites the audit history PR #2099 meant to protect · Issue #2980 · developing-today/code
X Title: aggregator stores: non-ENOENT read errors silently start empty — next persist overwrites the audit history PR #2099 meant to protect · Issue #2980 · developing-today/code
Description: Finding PR #2099 taught the aggregator's two audit stores to quarantine a corrupt file instead of silently overwriting it (#1452), but the read-error path still silently treats any failure as "no store yet" — and the next persist then ov...
Open Graph Description: Finding PR #2099 taught the aggregator's two audit stores to quarantine a corrupt file instead of silently overwriting it (#1452), but the read-error path still silently treats any failure as "no s...
X Description: Finding PR #2099 taught the aggregator's two audit stores to quarantine a corrupt file instead of silently overwriting it (#1452), but the read-error path still silently treats any failure as &...
Opengraph URL: https://github.com/developing-today/code/issues/2980
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"aggregator stores: non-ENOENT read errors silently start empty — next persist overwrites the audit history PR #2099 meant to protect","articleBody":"## Finding\n\nPR #2099 taught the aggregator's two audit stores to quarantine a corrupt file instead of silently overwriting it (#1452), but the **read-error path still silently treats any failure as \"no store yet\"** — and the next persist then overwrites the existing store. In both stores, `doLoad`'s first `catch` swallows every `readFile` error, not just ENOENT, despite the code comment directly above it stating that \"a missing file is the only silent empty start\".\n\nConcretely: if the store file exists and holds valid audit history but the read fails for a non-missing reason (EACCES after a permissions change, a transient I/O error, the path momentarily being something unreadable), the store starts empty with no log line at all, and the next `add()` persist — `mkdir` + write temp file + `rename` over the store path — replaces the unread history with a fresh file containing only the new record. That is exactly the silent audit-history loss #1452/#2099 set out to eliminate, reached through the read path instead of the parse path.\n\n## Evidence\n\n- Source PR: #2099 (merged, head `37ceccbe9f5b43a9fb0acdeaa803931e92b55eef`) — https://github.com/developing-today/code/pull/2099 — \"fix(aggregator): quarantine corrupt actions/comments stores (#1452)\"\n- Verified still present on current main `6a19fec557c172b57e5f704d7b7f9163a76e43bb`:\n - `pm-stack/aggregator/src/actions.ts:434-447` — `doLoad`: comment at :435-441 says a missing file is the only silent empty start; the `catch` at :444-447 around `readFile` (:443) treats **all** errors that way and returns with `this.actions = []`, no logging, no quarantine attempt.\n - `pm-stack/aggregator/src/comments.ts:114-127` — identical structure: comment :115-121, `readFile` :123, catch-all :124-127 setting `this.comments = []`.\n - Persist overwrites unconditionally in both stores: `actions.ts` `persist()` (mkdir + `writeFile(tmp)` + `rename(tmp, this.file)`) and the mirrored `persist()` in `comments.ts` — so the first write after a failed read destroys the on-disk history the read never saw.\n- The parse/shape path in the same functions (actions.ts :448+, comments.ts :128+) does the right thing — quarantine to `\u003cfile>.corrupt-\u003ctimestamp>` plus a loud `console.error` — which makes the read path's silence an inconsistency in the same function, not a design choice.\n- Deduped 2026-10-31: `gh issue list --state all` searches for \"1452 quarantine\", \"corrupt store quarantine\", \"doLoad readFile\", \"store file unreadable overwrite\" return only #1452 itself (closed, the eval this PR implemented) — no issue covers the read-error path.\n\n## Why it matters\n\nThese two files are the dashboard's append-only audit history (actions and comments). #1452's whole point was that silently starting empty destroys that history. A permissions slip or transient read failure is at least as plausible as a truncated write, and today it produces the worst outcome in the matrix: no quarantine copy, no log line, and a routine persist that erases the original bytes.\n\n## Acceptance criteria\n\n- [ ] In both `ActionsStore.doLoad` and `CommentsStore.doLoad`, only ENOENT (file genuinely absent) takes the silent empty start; any other read error is loud: a `console.error` naming the file and the error, in the same style as the quarantine warning.\n- [ ] After a non-ENOENT read failure, a subsequent persist must not silently overwrite the unread store — e.g. attempt the same `.corrupt-\u003ctimestamp>` quarantine rename before starting empty, and if that fails, surface it explicitly (as the parse path already does) rather than proceeding silently.\n- [ ] Regression tests in `pm-stack/aggregator/test/store-corrupt.test.ts` (or a sibling) pin the non-ENOENT case for both stores (e.g. store path made unreadable / a directory-in-place probe where the platform allows, or an injected read error), alongside the existing missing/corrupt/wrong-shape/valid cases, which keep passing unchanged.\n- [ ] Behaviour for the genuinely-missing-file case is byte-for-byte what it is today (silent empty start, first write creates the file).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-31T07:27:15Z","url":"https://github.com/developing-today/code/issues/2980"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:48b6e055-116a-c1f1-e08b-9bae241b3ec8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E152:16C525:34E675:48DA16:6B074E10 |
| html-safe-nonce | 7bc8b6dc0ffeb9845c37ff3cc2b2da2cd8bc55910c3a88c2b3dae7b476788d5f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTUyOjE2QzUyNTozNEU2NzU6NDhEQTE2OjZCMDc0RTEwIiwidmlzaXRvcl9pZCI6IjQxMDU0Mjc0NDQ2NzU1OTU3OTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1048b34433484010959bf1f8e4ce9a8d79def7720b8587780707ce7116a1f3f4 |
| hovercard-subject-tag | issue:6132398897 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/2980/issue_layout |
| twitter:image | https://opengraph.githubassets.com/077699e91bf16405b4524dcd0503996ce0563cd0624f4e918b2d8837ae16fccc/developing-today/code/issues/2980 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/077699e91bf16405b4524dcd0503996ce0563cd0624f4e918b2d8837ae16fccc/developing-today/code/issues/2980 |
| og:image:alt | Finding PR #2099 taught the aggregator's two audit stores to quarantine a corrupt file instead of silently overwriting it (#1452), but the read-error path still silently treats any failure as "no s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 26f151990bcb5b67b87df8b3f96ed340f849939d44e36f348402de5e39cca989 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cd00d8452bcb4e56a60ba7c0e61a697b46513fe9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width