fix(ci): serve a loopback-base_url build to browser-based gates - #46
Merged
Conversation
pa11y and playwright render pages in a real browser, so any get_url()-derived absolute reference in the rendered HTML resolves against config.toml's production base_url, not the local static server these gates spin up. ci/github-workflow.yml.tmpl already builds a public-local/ copy with --base-url http://127.0.0.1:8080 for this reason, but ci/kanon-ci.toml.tmpl and bin/typikon-check — despite the former's own header claiming it "mirrors ci/github-workflow.yml.tmpl stage-for-stage" — still built once and served public/, the production build, to both gates. Mirrors the already-fixed GH Actions recipe into both remaining implementations: a zola-build-local stage produces public-local/ (--force, since typikon-check reruns against the same checkout and zola refuses to reuse an existing --output-dir unprompted), and pa11y/ playwright now serve that copy. public/ is untouched for csp-enforce, lychee, and deploy. Adds ci/local-base-gate-check.sh, wired into ci/run-fixtures.sh: proves public-local/ exists and its HTML carries no reference to the site's production host (scoped to *.html, matching csp-enforce.sh's own rationale — a browser only loads what an HTML reference points it at, so a hand-authored absolute URI in atom.xml's <author><uri> is correct output, not a leak). Refs #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finding
ci/github-workflow.yml.tmplalready builds apublic-local/copy with--base-url http://127.0.0.1:8080and serves that to pa11y/playwright — butci/kanon-ci.toml.tmpl(which its own header claims "mirrorsci/github-workflow.yml.tmplstage-for-stage") andbin/typikon-check(the local pre-push gate) both still build once and servepublic/, the production build, to the browser-based gates.Evidence
ci/kanon-ci.toml.tmpl[stages.serve-public]stillcd public— the production build — before pa11y/playwright run.bin/typikon-checkstages 6-7 (pre-fix numbering) stillcd public && python3 -m http.server 8080for both pa11y and playwright.examples/sample-blogand rebuilding with--base-url http://127.0.0.1:8080 --output-dir public-localshows everyget_url()-derived reference (canonical,og:url, JSON-LD, sitemap) correctly rebases to loopback in the second build but not the first — proving the two builds genuinely differ, and confirming which one browser gates need to see.Correction
Mirrors the already-fixed GH Actions recipe into both remaining implementations: a
zola-build-localstage buildspublic-local/(--force, sincetypikon-checkreruns against the same checkout on every local invocation andzolarefuses to reuse an existing--output-dirunprompted — caught by the new test below), and pa11y/playwright now serve that copy.public/is untouched forcsp-enforce,lychee, and deploy.public-local/added to.gitignorealongsidepublic/.docs/AGENTIC.md's stage list updated to match.Test
New
ci/local-base-gate-check.sh, wired intoci/run-fixtures.sh(which CI already runs via.github/workflows/gate-attestation.ymland.kanon-ci.toml): assertspublic-local/exists and its*.htmlfiles carry zero references to the site's configured production host. Scoped to.html(same rationale asci/csp-enforce.sh) —atom.xml's<author><uri>is a legitimate hand-authored absolute URL by Atom convention and isn't fetched by a browser gate, so checking it would flag correct output as a regression.Verified locally: on the pre-fix
bin/typikon-check,public-local/is never created and the new check fails withexit 1(does not exist — the loopback-base_url build never ran); against this branch it passes for bothexamples/sample-blogandexamples/sample-shop, and reruns idempotently against a leftoverpublic-local/from a prior run.Refs #29