let d = import "../defaults.ncl" in # Verifier for consumer↔superset config drift (ADR-001, single-image deploy). # A consumer supplies its own routes.ncl (drives menus/footer at runtime), but the # servable routes are the SHARED SUPERSET baked into the binary. If the consumer # declares a route path absent from the superset, its menu/link 404s — the exact # build/runtime split gotcha. This checks: consumer route paths ⊆ superset paths. # Cross-repo (needs a consumer config dir); runnable as # `just validate-config-drift ` (defaults to self = zero drift). d.make_mode String { id = "validate-config-drift", trigger = "Validate a consumer's route paths are a subset of the baked route superset so its menu/links never 404 against the shared binary. ADR-001 single-image deploy.", preconditions = [ "nickel and jq available on PATH", "code/site/config/routes.ncl exists (the superset)", "a consumer site/config dir with routes.ncl is provided (defaults to this repo's)", ], steps = [ { id = "check-subset", action = "Export both routes.ncl to JSON, collect the en+es path strings of each, and report any path declared by the consumer that is NOT in the superset (those 404 on the shared binary). {slug} template routes compare as identical strings, so param routes match by shape.", cmd = "cd code && NICKEL={{ rustelo_root }}/resources/nickel; paths(){ nickel export --import-path \"$NICKEL\" --import-path \"$1\" \"$1/routes.ncl\" 2>/dev/null | jq -r '[.routes[].paths.en,.routes[].paths.es]|map(select(.))|.[]' 2>/dev/null | sort -u; }; sup=$(paths site/config); cons=$(paths \"${CONSUMER_CONFIG:-site/config}\"); comm -23 <(echo \"$cons\") <(echo \"$sup\") | sed 's/^/DRIFT /'; echo done", actor = 'Both, on_error = { strategy = 'Continue }, }, { id = "report", action = "No DRIFT lines ⇒ consumer routes ⊆ superset, every consumer link resolves. Any DRIFT path ⇒ either add it to the framework superset (site/config/routes.ncl + content.ncl + rebuild) or remove it from the consumer; until then that menu/link 404s.", actor = 'Both, depends_on = [{ step = "check-subset" }], on_error = { strategy = 'Stop }, }, ], }