website-htmx-rustelo/.ontoref/reflection/modes/validate-route-superset.ncl

38 lines
2.4 KiB
Text
Raw Normal View History

2026-07-10 03:33:46 +01:00
let d = import "../defaults.ncl" in
# Verifier for the route superset (ADR-001, single-image deploy).
# The baked route table must be a SHARED SUPERSET: every standard content kind
# {blog, projects, adr, catalog} must declare BOTH a ContentIndex (the /kind
# listing) and a PostViewer (the /kind/{slug} detail) in site/config/routes.ncl,
# so a consumer's menu/About link to that kind resolves against the shared binary
# instead of 404-ing (the build/runtime split gotcha). Routing stays compiled
# (ADR-001 forbids runtime-routing) — completeness is checked, not dynamism.
# Runnable as `just validate-route-superset` (hard gate).
d.make_mode String {
id = "validate-route-superset",
trigger = "Validate the baked route table is a complete shared superset: ContentIndex + PostViewer present for every standard content kind so consumer links never 404. ADR-001 single-image deploy.",
preconditions = [
"rg (ripgrep) available on PATH",
"code/site/config/routes.ncl exists",
],
steps = [
{
id = "check-superset-kinds",
action = "For each standard content kind {blog, projects, adr, catalog}, assert site/config/routes.ncl declares both make_content_route \"ContentIndex\" \"<kind>\" and make_content_route \"PostViewer\" \"<kind>\". A missing index or viewer is a superset gap — a consumer linking to that kind 404s on the shared binary. FAIL names the kind and which record is missing.",
cmd = "cd code && fails=0; for k in blog projects adr catalog; do i=$(rg -c \"make_content_route \\\"ContentIndex\\\" \\\"$k\\\"\" site/config/routes.ncl 2>/dev/null || true); p=$(rg -c \"make_content_route \\\"PostViewer\\\" \\\"$k\\\"\" site/config/routes.ncl 2>/dev/null || true); if [ \"${i:-0}\" -ge 1 ] && [ \"${p:-0}\" -ge 1 ]; then echo \"PASS $k\"; else echo \"FAIL $k (index=${i:-0} viewer=${p:-0})\"; fails=$((fails+1)); fi; done; echo \"superset gaps: $fails\"",
actor = 'Both,
on_error = { strategy = 'Continue },
},
{
id = "report",
action = "ALL kinds PASS ⇒ the baked route table is a complete superset and a consumer's links resolve. ANY FAIL ⇒ add the missing kind to site/config/routes.ncl (ContentIndex + PostViewer) and content.ncl (ContentType), then `just local-install` — the route table is baked, so a rebuild is required (ADR-001: routing stays compiled).",
actor = 'Both,
depends_on = [{ step = "check-superset-kinds" }],
on_error = { strategy = 'Stop },
},
],
}