Repository navigation
Description
Problem
apps/web/app/seo/lastmod.generated.json is a generated file that is committed, and nearly every PR regenerates part of it. Two PRs that touch the same docs page therefore conflict, and the conflict is painful to resolve for two independent reasons.
1. The conflict is guaranteed, and it is never informative
generate-seo-lastmod.mjs stamps one generationTimestamp onto every route whose sourceDigest changed. Two branches that edit the same .mdx page each rewrite that route's three-line record with a different timestamp and a different digest, so the records overlap textually and git cannot merge them.
Recent examples on main, all within about a day:
| Route | Rewritten by |
|---|---|
/docs/deployment/kubernetes |
#694 and #699 |
/docs/middleware |
#694 and #702 |
/docs/api/permissions |
#699 and #707 |
This is not limited to docs-focused PRs. #707 (memory-pgvector), #699 (postgres-storage) and #702 (sdk) all rewrote manifest records, because the API reference pages under content/docs/api/ move whenever a package's surface does.
The conflict never carries information. The manifest is entirely derived from content plus previously recorded timestamps, so the correct resolution is always "discard both sides and regenerate". There is no judgement call to make.
2. A conflicted manifest cannot be regenerated
Because there is no .gitattributes entry, git writes conflict markers into the JSON. That leaves the file unparseable, so the generator refuses to run against it and the obvious fix is blocked until someone hand-edits markers out of generated content. Verified locally:
$ git merge other # no .gitattributes
{
"routes": {
<<<<<<< HEAD
"/a": { "t": "MINE" },
=======
3. The staleness failure does not say what is wrong
The generator prints a genuinely useful message:
SEO last-modified manifest is stale: regenerate with pnpm --dir apps/web seo:lastmod --as-of 2026-09-17
But app/seo/generate-lastmod.test.ts asserts only on the exit code, so CI shows this instead, with the real message nowhere in the log:
AssertionError: expected 1 to be +0 // Object.is equality
❯ app/seo/generate-lastmod.test.ts:30:27
This reds source-validate, and therefore the required validate check, with no indication of the cause or the fix. node scripts/check-docs.mjs passes, so the docs gate does not catch it either.
Impact
PR #694 hit all three. It was rebased twice, and each rebase required manually restoring the file from main before regenerating. Any PR touching web content will keep hitting this.
Proposal
- Add a
.gitattributesentry marking the manifest unmergeable (-merge). Git still reports the conflict, but leaves valid JSON in the worktree, sopnpm --dir apps/web seo:lastmodresolves it in one command. Verified locally; needs no per-clone git config, unlike a custom merge driver. - Mark it
linguist-generatedso GitHub collapses it in review. - Surface the generator's own message in the test assertion so a stale manifest explains itself.
- Document the one-command resolution.
This does not stop the conflict from being reported, which would need either a merge driver requiring local setup or moving regeneration to a post-merge job on main. Both are more invasive than the problem warrants; the aim here is to make the conflict trivial to resolve rather than to eliminate it.
Activity
fix(web): make the SEO lastmod manifest resolvable on conflict and ex…