Repair offline project-docs snapshot head matching - #82
erinepshovel-code wants to merge 3 commits into
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc28238523
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "id": "2026-09-26-a-copy-is-not-a-witness", | ||
| "date": "2026-09-26", | ||
| "time": "12:21:51-07:00", | ||
| "model": "hmmm: Grok Bot executor (xAI); the exact runtime model version is not exposed to this runtime", |
There was a problem hiding this comment.
Supply the exact runtime model before merging
When this commit is merged, the required builder-journal entry will explicitly record that the model version is unknown rather than providing the exact runtime model mandated by the journal contract. validateModel only rejects a small set of generic labels, so this placeholder passes check:builder despite defeating the provenance requirement; obtain the exact model identity or keep the website-change transaction blocked.
Useful? React with 👍 / 👎.
| if (!boundary && prior && !prior.unavailable && repo.head_sha && prior.headSha === repo.head_sha) { | ||
| fallbackCount += 1; | ||
| byRepository[repo.name] = { | ||
| ...prior, | ||
| fallback: true, | ||
| hmmm: [...new Set([...(prior.hmmm || []), 'OFFLINE=1: retained the same-head last-known-good documentation projection.'])] |
There was a problem hiding this comment.
Validate snapshot entries before reusing them
When a snapshot is syntactically valid JSON but an entry is structurally corrupt, a matching headSha is sufficient to enter this branch. For example, an entry with the matching head and "hmmm": {} throws while spreading prior.hmmm, aborting the offline refresh instead of emitting the promised unavailable projection; an entry missing documentation is likewise counted as a successful fallback even though the page renders it as unavailable. Require a valid observed projection shape, including array-valued hmmm and usable documentation, before treating an entry as same-head fallback.
Useful? React with 👍 / 👎.
Scope
Follow-up to #76 ("Repair clean offline project-docs bootstrap"), repairing Review bot findings 1–4 from its independent review of #76.
Base: this PR targets
repair/project-docs-offline-bootstrap-20260923(#76's head branch), notmain. #76 is still open and unmerged, and the code being repaired (unavailableProjection, the offline snapshot test, the unavailable template branches) exists only on that branch. Once #76 merges, this PR should be retargeted tomain.Cause
OFFLINE=1and a snapshot present,fetch-project-docs.mjscopied the snapshot wholesale and setfallback: trueonly at the top level. Per-repository entries never carriedfallback, so pages rendered "exact-head build observation", and entries whoseheadShano longer matchedrepos.jsonhead_shawere kept. Snapshot headaaaavs currentbbbbrendered "No root README.md…", count 0, exact-head mode.repos.jsonmissing from the snapshot (or a snapshot withoutbyRepository) got norepoDocs, andrepo.njk's finalelsebranches rendered the "copied from the exact repository head" intro and exact-head mode.readSnapshotswallowed every error, so a corrupt snapshot was reported as "no last-known-good snapshot exists".repo.njksource instead of rendered HTML, and assertedprojectedDocumentCount: 0for unobserved documentation.Fix
scripts/fetch-project-docs.mjs: offline projection now iteratesrepos.json. A snapshot entry is reused (with per-entryfallback: true) only when it is observed andheadSha === repo.head_sha; otherwise the repository getsunavailableProjectionwith a reason-specifichmmm(different head, unknown current head, no entry in snapshot, or snapshot missing/unreadable/corrupt).readSnapshotnow distinguishesmissing(ENOENT),unreadable(other read errors) andcorrupt(parse error / non-object root). Unavailable projections useprojectedDocumentCount: nullandprojectedBytes: nullinstead of 0. Top-levelfallback/fallbackCountnow reflect the per-repository result. BOUNDARIES block updated to match.src/projects/repo.njk: separate intro for same-head fallback; the finalelsebranches (intro, content, mode) now say unavailable /hmmminstead of implying an exact-head observation; the count shows a number only whenprojectedDocumentCount is number, otherwisehmmm.tests/offline-project-snapshot.test.mjs: runs the real script in isolated temp trees, then renders the realrepo.njkthrough Eleventy (minimal layout and stand-in filters) and asserts on the rendered HTML. Cases: no snapshot, snapshot at matching head, stale snapshot head (aaaa…vsbbbb…), mixed repositories (one present, one missing), corrupt snapshot, and no emitted projection.src/_data/builder.json+tests/generated-site.test.mjs: required By the builder append (website-builder-journal) and the entry-count expectation (5 → 6).Verification
Node v24.21.0,
npm ci, then:npm teston Repair clean offline project-docs bootstrap #76 head96fdf3d(before): 110 tests, 109 pass, 1 fail. The failure istests/textbook-integrity.test.mjs:19, which fails offline on the base too and is unrelated.npm teston this branch (after): 115 tests, 114 pass, 1 fail. Sametests/textbook-integrity.test.mjs:19offline failure; the 5 added tests pass.node --test tests/offline-project-snapshot.test.mjs: 7/7 pass. With this PR's script and template changes reverted and the new tests kept, 6/7 fail, so the tests catch the regressions.npm run check:builder -- --base 96fdf3d98864af32bb12e4ac89c823cd0277bfd8: passes.OFFLINE=1 npm run build: the refresh step printedproject-docs metadata-only offline (missing snapshot), then Eleventy stopped atsrc/eai/aicontext.11ty.js("aicontext production requires eight current textbook chapters without fallback"). That is the same offline textbook limitation, so no full-site rendered page was produced locally. Rendered-page behaviour is covered by the Eleventy rendering in the tests. Hostednpm run checkis the full-build gate.hmmm
modelfield readshmmm: Grok Bot executor (xAI); the exact runtime model version is not exposed to this runtime. website-builder-journal says the transaction stays blocked athmmmwhen the exact model cannot be identified. This PR records that honestly rather than inventing a model name. Whether that is enough is a decision for the maintainer before merge.The-Interdependency.github.io_msdmd.tsimports./.agents/skills/msdmd/collection, and.agents/skills/msdmd/does not exist in this repository.tests/textbook-integrity.test.mjs:19and the offline full-site build both need current textbook chapters, so neither can run offline. Local verification of a rendered repo page is limited to the test-harness Eleventy render.where/statusClass/projectDocMarkdownfilters and a minimal layout, not the production.eleventy.js. It checks template branch logic, not production markdown rendering.