htaccess test harness: Windows Git Bash fix + live/origin resolution checks - #49
Open
stevenchalem wants to merge 6 commits into
Open
htaccess test harness: Windows Git Bash fix + live/origin resolution checks#49stevenchalem wants to merge 6 commits into
stevenchalem wants to merge 6 commits into
Conversation
MSYS path conversion rewrote the container-side bind-mount target (/usr/local/apache2/htdocs/.htaccess) into a Windows path, so the file mounted nowhere Apache looks and every request 404'd. Disable the conversion (MSYS_NO_PATHCONV=1) and translate the host path with cygpath for the docker calls on MSYS/MINGW/Cygwin shells. Also resolve HTACCESS to an absolute path so a relative value works, and document the quirk plus the correct ../w3id.org/semanticarts/.htaccess path. Generated with Claude Code (Semantic Arts)
w3id.org commit "Fix ontology file rewrite rules" broadened the whole-ontology conneg rules from ^ontology/([^/]+) to a greedy ^(.+), so redirect targets now preserve the full request path (including the leading ontology/ segment) and the old 302 catch-all pass-through was disabled. Update the 7 affected expectations: whole-ontology targets keep the ontology/ segment, and the catch-all now asserts a 303 to a .ttl on the SA server (path preserved) instead of a 302 pass-through. Generated with Claude Code (Semantic Arts)
check-live-deref.sh hits the real w3id.org IRIs, follows redirects to completion, and asserts a final 200 whose body parses in the negotiated format. Unlike run-tests.sh (first hop only, offline), this catches the /gistCore.rdf incident: the redirect fired fine but the unversioned "latest" alias 404'd on ontologies.semanticarts.com. Pairs each unversioned case with the versioned pass-through as a control and flags the exact alias-missing signature. Body validators (rdflib/jq) are optional; network-unreachable cases WARN rather than FAIL. Generated with Claude Code (Semantic Arts)
The detector picked the first `python`/`python3` on PATH even when it lacked rdflib, silently skipping body validation. Now it probes python3, python, and the Windows `py` launcher and keeps the first that can `import rdflib`, and honors an explicit PYTHON override for when several interpreters coexist (e.g. MSYS2 python vs a native C:\Python install). Generated with Claude Code (Semantic Arts)
The live-deref section was wedged between run-tests.sh's own sections, leaving the intro and "What it checks"/Requirements/Run implicitly about run-tests.sh only. Reorganize into two peer sections — run-tests.sh (offline routing, pre-deploy) and check-live-deref.sh (live resolution, post-deploy) — with a shared intro and a pre-deploy -> deploy -> post-deploy narrative. Add a .markdownlint.json with MD024 siblings_only so the intentional parallel sub-headings don't trip the linter. Generated with Claude Code (Semantic Arts)
Nothing verified that the whole-ontology files the new .htaccess will
redirect to actually exist on the origin BEFORE deploying — the exact gap
behind the /gistCore.rdf incident (run-tests.sh checks only the redirect
hop; its CHECK_TARGETS only checks per-term Pages files).
MODE=targets requests each origin file directly on
ontologies.semanticarts.com (unversioned gistCore.{rdf,ttl,jsonld} + the
versioned control + the WIDOCO docs) and asserts a 200 that parses,
reusing the existing body-validation and alias-missing signature logic.
The signature now prints pre-deploy guidance ("publish it BEFORE
deploying"). MODE=deref (default) is unchanged. The HTML case is bucketed
"none" so a docs 404 no longer trips the alias signature.
Generated with Claude Code (Semantic Arts)
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.
This branch started as a Windows Git Bash fix for
run-tests.shand grew to add a live resolution harness that covers the failure mode behind the/gistCore.rdfincident.1. Windows / Git Bash fix for
run-tests.shProblem: on Windows under Git Bash, all 17 routing tests returned
404/Location = <none>— the rewrite rules never fired. MSYS POSIX-path conversion rewrote the container-side bind-mount target/usr/local/apache2/htdocs/.htaccessinto a Windows path, so the.htaccessmounted nowhere Apache looks and no rules loaded.Fix: on MSYS/MINGW/Cygwin,
export MSYS_NO_PATHCONV=1and translate the host path withcygpath -mfor thedockercalls (Linux/macOS unchanged); resolveHTACCESSto an absolute path up front (Docker bind mounts require it); README gains a Windows/Git Bash note. Tests also updated to match current rewrite behavior.2. New
check-live-deref.sh— whole-ontology resolution checksrun-tests.shasserts the redirect target (Location), not that the target resolves — the exact gap behind the/gistCore.rdfincident, where the redirect fired correctly but the destination onontologies.semanticarts.com404'd. This script verifies the whole-ontology files actually exist and resolve, in two modes:MODE=targets(pre-deploy) — requests each origin file directly onontologies.semanticarts.com(gistCore.{rdf,ttl,jsonld}, the versioned control, and the WIDOCO docs) and asserts a200that parses. Answers "do the destinations the new rules will point at exist yet?" before deploying.MODE=deref(default, post-deploy) — hits the real w3id.org IRIs, follows every redirect to a final200, and validates the body per negotiated format.Both pair the unversioned alias with the versioned file as a control and flag the exact
SIGNATURE unversioned latest alias missing on ontologies.semanticarts.comwhen the alias is gone but the version resolves — distinct from a generic rule break. Body validation usesrdflib/jqwhen present (degrades to a warning, never a false fail; picks a Python that actually has rdflib, incl. the Windowspylauncher, with aPYTHONoverride). Network-unreachable cases WARN rather than FAIL.3. Docs
README restructured around the two tools with a pre-deploy → deploy → post-deploy workflow. Adds
.markdownlint.json(MD024: siblings_only) so the intentional parallel sub-headings don't trip the linter.Verification
All suites green on a Windows host:
run-tests.sh— 17/17check-live-deref.sh MODE=targets— 7/7, 0 warningscheck-live-deref.sh(deref) — 9/9, 0 warningsThe alias-missing
SIGNATUREpath was verified against a local mock (versioned 200, unversioned 404 → flagged, exit 1). This also confirmed the original/gistCore.rdfincident is currently resolved (all aliases resolve and parse).Generated with Claude Code (Semantic Arts)