Skip to content

chore(gitignore): ignore public/sources/ and tie the rule to the build (#6498) - #6506

Merged
koala73 merged 1 commit into
mainfrom
chore/6498-gitignore-public-sources
Aug 12, 2026
Merged

koala73 merged 1 commit into
mainfrom
chore/6498-gitignore-public-sources

Conversation

@koala73

@koala73 koala73 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Closes #6498. Follow-up to #6491 / PR #6492.

The gap

scripts/build-crawlable-corpus.mjs declares its own output directories and deletes each one before rewriting it:

const GENERATED_DIRS = [
  'countries', 'chokepoints', 'crises', 'tools',
  'reference/changelog', 'research', 'sources',
];

Six of the seven have a matching .gitignore rule. sources — added by #6492 — did not, so any worktree that had run a build carried a permanent ?? public/sources/: noise on every unrelated PR, and one git add -A from committing a build artifact that the next build deletes and rewrites.

The fix

One ignore rule, plus the part that keeps it from happening again.

Nothing tied .gitignore to GENERATED_DIRS, so the next directory added would repeat the omission. GENERATED_DIRS is now exported and a test asserts .gitignore covers every entry. 'reference/changelog' is matched by the broader public/reference/, so the assertion checks the top-level segment.

Removing the new rule turns the test red:

AssertionError: public/sources/ is missing from .gitignore —
the build rewrites it every run, so it must not be tracked

This does not affect the live page

worldmonitor.app/sources/ returns 200 and will continue to. These directories are rebuilt from committed data at deploy time — npm run build runs build:crawlable-corpus before vite build copies public/ into the output — so git never needed to carry them.

public/countries/ is the precedent already in production: gitignored, and worldmonitor.app/countries/norway/ serves 200. This change puts sources on the same footing as its six siblings.

Not to be confused with public/sitemap.xml, which is generated and committed on purpose — it is not in GENERATED_DIRS, comes from the separate build:sitemap step, and has build:sitemap:check gating the committed copy. No equivalent exists for sources.

Verification

$ npm run build:crawlable-corpus
Wrote crawlable corpus: 196 countries, 13 chokepoints, ... 1 source catalog page.
$ git status --short
# clean — was '?? public/sources/'
Check Result
tests/crawlable-corpus.test.mjs 5 pass (1 new)
Mutant: remove the new ignore rule new test goes red
tests/deploy-config.test.mjs 176 pass
docs:check, sources:check, biome pass

https://claude.ai/code/session_01Wm1w4JR4u6NU5yRui56jL6

#6498)

`build:crawlable-corpus` deletes and rewrites every directory in
GENERATED_DIRS on each run. Six of the seven have a matching .gitignore
rule; `sources` — added by #6491 (PR #6492) — did not, so any worktree
that had built carried a permanent `?? public/sources/`. That is noise on
every unrelated PR and one `git add -A` away from committing a build
artifact the next build destroys.

Nothing connected the two lists, so the next directory added to
GENERATED_DIRS would repeat it. Export the list and assert .gitignore
covers it, which is the part that stops this recurring rather than fixing
one instance of it. Removing the new rule turns the test red.

The page itself is unaffected: `public/countries/` has been gitignored
and live at 200 all along. These directories are rebuilt from committed
data at deploy time (`npm run build` runs build:crawlable-corpus before
vite copies public/ into the output), so git never needed to carry them.

Verified: `npm run build:crawlable-corpus` now leaves `git status` clean.

Claude-Session: https://claude.ai/code/session_01Wm1w4JR4u6NU5yRui56jL6
@vercel

vercel Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
worldmonitor Ready Ready Preview Aug 12, 2026 10:57am

Request Review

@koala73
koala73 merged commit cc55e41 into main Aug 12, 2026
33 checks passed
@koala73
koala73 deleted the chore/6498-gitignore-public-sources branch August 12, 2026 10:59

This branch was successfully deployed

1 active deployment
Preview — 058c1dff Deployed Aug 12, 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.

chore(gitignore): public/sources/ is a crawlable-corpus output but is not ignored

1 participant