Repository navigation
fix(web): keep the download storage API out of the launch bundle - #2204
Conversation
RealtimeEventsProvider loads with the app and imported adminDownloadStorageRootKey from the download storage API module, which pulled that whole module into the launch chunk. The key now lives in adminDownloadStorageCache, as adminSessionsKey does, so the API stays in the admin Downloads chunk. The launch bundle drops from 326,619 B to 326,313 B brotli, back inside the budget check's tolerance.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…is green Any change under scripts/ makes CI run the web jobs, and main fails the web launch bundle budget until Silo-Server#2204 lands (Silo-Server#2203). This PR changes no web code, so the pins wait for that. CI's Go DB pins job already ran all five contracts on 88cfac0, whose code this commit leaves as it is, and they passed.
…dle" This branch only carried that commit so the web launch bundle budget check would pass. Silo-Server#2246 fixed the budget on main, so the change now stays in Silo-Server#2204 alone. This reverts commit e954671.
|
Review of e201f76: I found no defects. The key keeps the same value, and the storage API no longer loads at launch. What I checked
Remaining issues: none. Optional follow-up, outside this PR: the provider still imports the whole #2203: since #2246 stopped CI from gating on the launch bundle size, the failure in #2203 no longer happens on Validated features: I couldn't read the v1.0 validation board from this session, so I haven't checked any passed cases against it. The diff changes no runtime behavior: the key value, its importers, and the refresh matching are all the same. I don't expect it to reach any validated case, and User manual: unaffected, since nothing a user sees or configures changes. Apple/Android: no follow-up needed. This changes only how the web app is bundled, not the API. Fit: 9/10 · Readiness: 9/10 — ready
Reviewed with Claude Code (claude-opus-5-5). |
…uring it (#2205) * fix(autoscan): don't record a failed poll's error on a source reset during it RecordError stamped last_error and last_run_at unconditionally. A poll that was running when an admin repointed or reconfigured its source, and that then failed, wrote the old server's error onto the source, and its last_run_at stamp made the source wait out its interval before polling the new upstream. RecordError now takes the rows the poll read and writes only while they still hold, using the same check AdvanceMarker uses: the source's marker, connection binding and source_config, and the connection's upstream read FOR SHARE. When they don't, the error stays on the poll's event only. Closes #2202 * fix(autoscan): note a dropped error on the poll event and cover the review's cases - The poll event says when a failed poll's error was kept off the source because an admin reset it during the poll, as a skipped marker advance already does. - The shared write helper rejects a connection row that isn't the source's binding, for both AdvanceMarker and RecordError. - docs/admin-api.md describes the failure path next to the success path. - Tests: an API key rotation still records the error, each dropping edit is checked to have reset the source, a skipped write still finishes the event as an error holding the marker, and a resolve failure carries the connection row only when it was read. The AdvanceMarker stale-poll tests and the unknown-source test now run as DB contracts in CI. * chore(ci): hold the autoscan DB contract pins until main's web build is green Any change under scripts/ makes CI run the web jobs, and main fails the web launch bundle budget until #2204 lands (#2203). This PR changes no web code, so the pins wait for that. CI's Go DB pins job already ran all five contracts on 88cfac0, whose code this commit leaves as it is, and they passed.
…ayed mark (#2217) * fix(web): keep the download storage API out of the launch bundle RealtimeEventsProvider loads with the app and imported adminDownloadStorageRootKey from the download storage API module, which pulled that whole module into the launch chunk. The key now lives in adminDownloadStorageCache, as adminSessionsKey does, so the API stays in the admin Downloads chunk. The launch bundle drops from 326,619 B to 326,313 B brotli, back inside the budget check's tolerance. * fix(userstore): keep a played mark made in the same second as a removal A history removal stores its watermark to the microsecond, but imported progress and history were checked against it as whole-second RFC 3339 text. A played mark in the same second as an earlier removal compared at or before the watermark and stayed hidden, while webhook sync recorded the event as applied. The Postgres store now compares imported writes with the watermark as timestamptz, and watch state hands imported history to the store with its full time. Imported history keeps its whole-second stamp unless that second is at or before the watermark, so replays still match rows stored before. SQLite keeps whole-second text and truncates sub-second input. * fix(userstore): count imports in the same second as one play An import that lands in a removal's second keeps its precise time, so an exact-time duplicate check let the same play through twice when two sources reported it a few milliseconds apart. Imported history now treats any row in the same second as the same play, which also still matches whole-second rows stored before. AddHistory inserts the time it checked. * test(userdb): check the error from closing the test database * Revert "fix(web): keep the download storage API out of the launch bundle" This branch only carried that commit so the web launch bundle budget check would pass. #2246 fixed the budget on main, so the change now stays in #2204 alone. This reverts commit e954671. --------- Co-authored-by: Quick104 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Problem
Related issue: #2203
Validation tasks: none
RealtimeEventsProvider, which loads with the app, takesadminDownloadStorageRootKeyfromapi/v2/adminDownloadStorage.ts. That pulls the whole download storage API module into the launch chunk, even though only the admin Downloads page calls it. This change moves the key out, so the API goes back into the Downloads chunk.I opened this when #2168 pushed
mainover the launch bundle budget (#2203). #2246 has since broughtmainback under it, so this no longer fixes a failing check. It now just trims 292 B brotli off the launch bundle.Approach
api/v2/adminDownloadStorageCache.ts, the same wayadminSessionsKeylives inadminSessionsCache.tsfor the same provider. The provider and the storage query hooks import it from there, and the storage module no longer exports it.Validation
budget:checkstep in CI'sWeb (build)job:mainat eecb7f5: 307,216 B brotlitsc -band Prettier were clean, and ESLint reported only the eight warningsRealtimeEventsProvider.tsxalready has onmain.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-2204/
The page has the budget check from CI and where the storage API lands in each build, measured before #2246; the Validation numbers above are current. Nothing a user sees changes: every page, the admin Downloads page included, behaves the same.
Risks
Checklist
AI Disclosure
AI-assisted with Claude Opus. I directed the task and designed the work.
Note
Move
adminDownloadStorageRootKeyout of the download storage API moduleMoves the admin download-storage root-key helper from adminDownloadStorage.ts into a new cache module, adminDownloadStorageCache.ts. This keeps the launch bundle from pulling the storage API module. The helper builds the same scoped query-key tuple as before; only imports change in RealtimeEventsProvider.tsx and downloadStorage.ts. No behavior change.
Macroscope summarized e201f76.