55training/dss-training-ops/docs/plans/2026-08-30-agentic-sites-conversion-plan.md, Phase 4.
66
77Every failure this looks for is one that leaves a page that renders fine and reads wrong: an authoring
8- note in the page source, a figure that 404s, a cross-reference to a chapter that moved. None of them
9- would fail a render, which is why they need a check of their own.
8+ note in the page source, a figure that 404s, a cross-reference to a chapter that moved, a landing-page
9+ control whose chapter was retitled. None of them would fail a render, which is why they need a check
10+ of their own.
1011
1112 check-site.py [--site _site] [--source source]
1213
@@ -31,7 +32,7 @@ def normalise(text: str) -> str:
3132 return " " .join (text .split ())
3233
3334
34- def check (site : Path , source_dir : Path ) -> list [str ]:
35+ def check (site : Path , source_dir : Path , root : Path ) -> list [str ]:
3536 problems : list [str ] = []
3637 pages = sorted (site .rglob ("*.html" ))
3738 if not pages :
@@ -116,6 +117,20 @@ def check(site: Path, source_dir: Path) -> list[str]:
116117 for stray in re .findall (r"§\d+[a-z]?" , prose ):
117118 problems .append (f"{ page .relative_to (site )} : { stray } is not a link — "
118119 "no such chapter in _quarto.yml's chapter-map?" )
120+ # 7. Every console recipe points at a chapter that exists. The landing page is a hand-drawn
121+ # console (console.js on the research site, garage.js on the toolkit site) whose controls link to
122+ # chapters by slug, and it builds those links in JavaScript at runtime -- so they never appear in
123+ # the rendered HTML and check 4 cannot see them. A retitled chapter changes its slug and leaves
124+ # the recipe pointing at nothing, which is exactly how the landing page went stale on 2026-09-27
125+ # while every static link resolved. Checked against chapters/*.qmd, the sync's output, rather
126+ # than against _site: Quarto never prunes _site, so a stale render of the old slug can still be
127+ # sitting there and would let a dead recipe pass.
128+ chapters = {p .stem for p in (root / "chapters" ).glob ("*.qmd" )}
129+ for js in sorted (root .glob ("*.js" )):
130+ for slug in re .findall (r'slug:\s*"([^"]+)"' , js .read_text (errors = "replace" )):
131+ if slug not in chapters :
132+ problems .append (f"{ js .name } : recipe slug { slug } has no chapters/{ slug } .qmd — "
133+ "a retitled or removed chapter; update the console's recipe list" )
119134 return problems
120135
121136
@@ -135,7 +150,9 @@ def main() -> None:
135150 if not source_dir .is_dir ():
136151 sys .exit (f"error: no source copy at { source_dir } " )
137152
138- problems = check (site , source_dir )
153+ # The site root is the parent of the source copy: the console file and chapters/ live there,
154+ # and _site does not (locally it is a symlink to a build directory outside the repository).
155+ problems = check (site , source_dir , source_dir .parent )
139156 if problems :
140157 print (f"{ len (problems )} problem(s) in the rendered site:" )
141158 for p in problems [:40 ]:
@@ -145,7 +162,8 @@ def main() -> None:
145162 sys .exit (1 )
146163 pages = len (list (site .rglob ("*.html" )))
147164 print (f"rendered site is clean: { pages } pages, no leaked comments, no raw LaTeX, "
148- "every image and link resolves, every section reference in prose is a link" )
165+ "every image and link resolves, every section reference in prose is a link, "
166+ "every console recipe points at a chapter" )
149167
150168
151169if __name__ == "__main__" :
0 commit comments