Skip to content

chore(web): regenerate the SEO lastmod manifest on main, not in PRs - #713

Merged
blove merged 4 commits into
mainfrom
chore/seo-lastmod-ci
Sep 18, 2026
Merged

blove merged 4 commits into
mainfrom
chore/seo-lastmod-ci

Conversation

@blove

@blove blove commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Problem

apps/web/app/seo/lastmod.generated.json is a generated artifact that every docs branch had to regenerate, because a test asserted the committed file was current. Two branches touching any page therefore conflicted inside that artifact. On #691 that cost five rebases in one day, four of which conflicted only on this file.

What this does

  • A SEO lastmod workflow regenerates and commits the manifest on main, after a content change lands. It is scoped to the paths the manifest derives from, and its own commit touches only the manifest, so it cannot retrigger itself. It is serialized with a non-cancelling concurrency group, refuses to push if the run dirtied anything other than the manifest, and rebases rather than forces if it loses a race.
  • The freshness tests now assert the generator's own round trip rather than asserting the committed file is current, so a stale timestamp no longer fails a PR.
  • A new --check-routes mode keeps the half a PR must still own. A stale timestamp is harmless and gets corrected on main. A route the manifest has never seen has no timestamp at all, and requireValidLastModified throws during the build, so adding or removing a page still fails the PR until the author regenerates.

A side benefit: the recorded timestamp is now when the content reached main, rather than whenever the author happened to run the script, which is what the sitemap is actually claiming.

Why the file is still committed

I did not remove it, and I think removing it would be wrong:

  • It is the only record of when each route last changed. The generator preserves a timestamp while the source digest matches and stamps "now" when it does not. Nothing else stores that history, and the generator never consults Git, deliberately, so that a shallow deploy checkout matches a full clone.
  • It is imported statically by apps/web/app/seo/lastmod.ts, so it must exist on disk for typecheck and next build.

Generating it from scratch during a build would stamp every route with the build's own clock, so every deploy would claim every page had just changed. That is a worse outcome than the conflicts it would fix.

Verification

  • Edited a docs page without regenerating: the whole apps/web suite passes, 636 tests. That is the case that used to fail.
  • Added a page without regenerating: --check-routes fails and names the route. That is the case that must still fail.
  • New tests cover a missing route, a removed route, and a drifted timestamp being tolerated.
  • Full apps/web suite, the docs completeness checker, and Biome all pass.

Reviewer note

This grants the workflow contents: write and pushes one generated file to main. Branch protection allows it today, required_pull_request_reviews is not enabled. That is the one policy decision in here and worth your explicit yes.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
b4-run Ready Ready Preview Sep 18, 2026 1:05am UTC

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

blove and others added 2 commits September 17, 2026 17:43
Every docs branch had to run the generator to satisfy a freshness
assertion, so two branches touching any page conflicted inside a
generated artifact. That cost five rebases on one PR in a single day.

- New SEO lastmod workflow regenerates and commits the manifest after a
  content change reaches main, serialized against itself and scoped to
  the paths the manifest derives from so it cannot retrigger itself.
- The freshness tests now assert the generator's own round trip instead
  of asserting the committed file is current, so a stale timestamp no
  longer fails a PR.
- A new --check-routes mode keeps the half a PR must still own: a route
  the manifest has never seen has no timestamp at all, and
  requireValidLastModified throws during the build. Adding or removing a
  page still fails until the author regenerates.

The file stays committed deliberately. It is the only record of when
each route last changed, and the sitemap imports it statically, so
generating it from scratch during a build would stamp every route with
the build clock and destroy the signal.

Co-Authored-By: Claude Opus 5 <[email protected]>
The workflow contracts pin every workflow's executable entrypoints in
two allowlists, so a new workflow file is rejected until both describe
it. The audit reports a mismatch without a diff, deliberately, so these
entries are the descriptor it computes: the three pinned actions, the
three run steps, and the job's contents: write permission.

Pinning the push step's exact shell text is the point — changing it
later has to be a deliberate, re-audited edit.

Co-Authored-By: Claude Opus 5 <[email protected]>
blove and others added 2 commits September 17, 2026 18:03
…main rule

#712 landed a bullet telling contributors to regenerate the SEO manifest in
the same commit or CI goes red. This branch's own bullet, a few lines above,
says the opposite — do NOT regenerate for an ordinary content edit — because
the workflow now does it on main. Leaving both made the standards doc
contradict itself on the one point it was added to settle.

Removes the older bullet and keeps the half of it that is still true and not
covered by the new one: what to do when the manifest does conflict, which a
route add or removal can still cause.

Co-Authored-By: Claude Opus 5 <[email protected]>
Biome reports the fixture this branch adds as unformatted, which is an error
rather than a warning, so `pnpm lint` exits non-zero and reds source-validate
and the required validate check.

Formatting only. `pnpm test:release-integrity` and the workflow-contracts
digest snapshot both still pass, so no pinned digest moved.

Co-Authored-By: Claude Opus 5 <[email protected]>

This branch was successfully deployed

1 active and 1 inactive deployments
vercel-preview — f6bfc02a Deployed Sep 18, 2026 by blove via vercel-native #2056
Preview — f6bfc02a Deployed Sep 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant