Skip to content

Auto-prune registered pages whose wiki source has disappeared - #162

Open
fcbond wants to merge 1 commit into
mainfrom
auto-prune-stale-pages
Open

Auto-prune registered pages whose wiki source has disappeared#162
fcbond wants to merge 1 commit into
mainfrom
auto-prune-stale-pages

Conversation

@fcbond

@fcbond fcbond commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to the BergenTop auto-registration fix (already merged directly to main). This closes the other half of the gap: a registered page whose wiki file gets deleted or renamed currently takes down the entire site build, since createdocs.py throws FileNotFoundError trying to open it and the run fails until a human hand-edits sitesdefinitions.json.

  • apply_new_pages.py now also removes stale Pages entries, but only once a page has been missing for two separate runs (tracked via a "MissingSince" marker persisted in sitesdefinitions.json itself) -- cheap insurance against a one-off flaky wiki checkout wrongly deleting a real page.
  • If a flagged page reappears before the second run, the marker is cleared and nothing is removed.
  • The "<ignore>" section is a deliberate blackhole for links to pages that are never expected to exist (personal wiki-username pages, wiki system pages) and is explicitly never touched by this logic.

Testing

Ran a full local build against the real delph-in/docs.wiki checkout and:

  • Confirmed a no-op run (nothing added/removed) produces zero diff
  • Simulated BergenSchedule.md going missing: run 1 flagged it (kept), run 2 (still missing) removed it
  • Simulated BergenParticipants.md going missing then reappearing before a second run: marker cleared, page kept
  • Confirmed the <ignore> section (87 entries) was untouched throughout
  • Confirmed createdocs.py still builds cleanly (exit 0) against the resulting file in every case

Test plan

  • Trigger BuildDocs on this branch (workflow_dispatch) once to confirm the new step runs cleanly in CI
  • After merging, watch the next scheduled run's commit diff to confirm no unexpected removals

🤖 Generated with Claude Code

Right now if a registered page's wiki file is deleted or renamed,
createdocs.py throws trying to open it and the *entire* build fails
(assert False) until a human notices and hand-edits sitesdefinitions.json
-- one missing page currently takes down every site.

apply_new_pages.py now also removes stale entries, but only once a page
has been seen missing on two separate runs (tracked via a "MissingSince"
marker persisted in sitesdefinitions.json itself), as insurance against a
one-off flaky checkout deleting a real, still-existing page. If the file
reappears before the second run, the marker is cleared instead. The
"<ignore>" section (a deliberate blackhole for links to pages that are
never expected to exist, like personal wiki-username pages) is never
touched by this.

Tested against a full local build: simulated a page going missing for
one run (flagged, kept), staying missing for a second run (removed), and
reappearing after being flagged (marker cleared, page kept) -- all three
paths produce valid sitesdefinitions.json and a clean createdocs.py build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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