harness: a docs tier for the pre-push gate (#2068) #2109

Closed
matou-build-agent wants to merge 1 commit from agent/issue-2068 into main

closes #2068

What this lands

A third docs tier in the pre-push gate (.sandcastle/gate-lib.sh), closing the
hole that let GOTCHAS #143's bare-%% red CI a second time (run 52773, sig
93e101f240ab, in docs/slices/report-and-request.mermaid).

gate_langs_for_files mapped paths to go/ts only, so a change touching just
docs/** yielded no language token — the mermaid-parse (#343) and slice-map YAML
(#834) seam contracts were CI-only, discovered one full run too late on a branch
a human had to re-open.

The tier (mirrors the cheap gofmt host door, #1458)

  • gate_langs_for_files emits docs for docs/architecture/**,
    docs/slices/**, docs/ux/flows/**.
  • gate_docs_stage resolves the command first-match-wins: GATE_DOCS_CMD →
    executable .sandcastle/docs-gate.sh → node (gate_docs_default_cmd), and
    fails closed when none resolve.
  • gate_docs_default_cmd runs the in-repo check-mermaid.mjs +
    check-slices-yaml.mjs and honours the checker's exit-code contract: exit 1 =
    a broken diagram (refuse the push); any other non-zero = a CRASH (e.g. no
    happy-dom in a sandbox with no pnpm install, GOTCHAS #400) reported LOUDLY
    as a harness fault naming happy-dom — never as a parse failure, never
    silently skipped.
  • gate_run dispatches it on every push path (cheap, so independent of the Go
    tier).

Acceptance criteria

  • ✅ A push touching only docs/slices/*.mermaid runs the mermaid checker and is
    REFUSED on a parse failure.
  • ✅ The bare-%% incident source is the test fixture: rejected, then accepted
    with line 5 given content (real-checker test, guarded on node + happy-dom).
  • ✅ A push touching no docs/go/ts path still prints nothing to check and passes.
  • ✅ Driven offline by .sandcastle/tests/gate-lib-test.sh (53→56; the 3
    real-node checks skip in the factory's bash-only env), with a case proving a
    missing happy-dom is a harness fault, not a parse failure.
  • ✅ GOTCHAS #143's Rule gains the push-gate pointer.

Vendoring (ADR 0180)

The gate is factory-vendored. Landed on dev-factory backport/idss-2068
(f36604c, off the pin 06f65763, #1684 still open) and re-vendored —
FACTORY_REF 06f65763→f36604c, FACTORY_MANIFEST no churn, drift-gate OK.
Forward-port onto dev-factory main (a reviewed PR) is owed as #2108.

Proof

bash .sandcastle/tests/gate-lib-test.sh → gate-lib: 56 checks passed
(includes the bare-%% reject/accept fixture and the happy-dom harness-fault
case). gate_docs_default_cmd over the live docs trees: 78/78 mermaid blocks
parse, 17 slice YAMLs clean.

Screenshots: none — a pre-push gate (shell + a node CLI check) has no visible UI surface; the proof is the offline test suite and the real-checker fixture, both quoted above.

closes #2068 ## What this lands A third `docs` tier in the pre-push gate (`.sandcastle/gate-lib.sh`), closing the hole that let GOTCHAS #143's bare-`%%` red CI a **second** time (run 52773, sig `93e101f240ab`, in `docs/slices/report-and-request.mermaid`). `gate_langs_for_files` mapped paths to `go`/`ts` only, so a change touching just `docs/**` yielded no language token — the mermaid-parse (#343) and slice-map YAML (#834) seam contracts were CI-only, discovered one full run too late on a branch a human had to re-open. ## The tier (mirrors the cheap gofmt host door, #1458) - `gate_langs_for_files` emits `docs` for `docs/architecture/**`, `docs/slices/**`, `docs/ux/flows/**`. - `gate_docs_stage` resolves the command first-match-wins: `GATE_DOCS_CMD` → executable `.sandcastle/docs-gate.sh` → `node` (`gate_docs_default_cmd`), and **fails closed** when none resolve. - `gate_docs_default_cmd` runs the in-repo `check-mermaid.mjs` + `check-slices-yaml.mjs` and honours the checker's exit-code contract: exit 1 = a broken diagram (refuse the push); **any other non-zero = a CRASH** (e.g. no `happy-dom` in a sandbox with no `pnpm install`, GOTCHAS #400) reported LOUDLY as a **harness fault naming happy-dom** — never as a parse failure, never silently skipped. - `gate_run` dispatches it on every push path (cheap, so independent of the Go tier). ## Acceptance criteria - ✅ A push touching only `docs/slices/*.mermaid` runs the mermaid checker and is REFUSED on a parse failure. - ✅ The bare-`%%` incident source is the test fixture: rejected, then accepted with line 5 given content (real-checker test, guarded on node + happy-dom). - ✅ A push touching no docs/go/ts path still prints `nothing to check` and passes. - ✅ Driven offline by `.sandcastle/tests/gate-lib-test.sh` (53→56; the 3 real-node checks skip in the factory's bash-only env), with a case proving a missing `happy-dom` is a harness fault, not a parse failure. - ✅ GOTCHAS #143's Rule gains the push-gate pointer. ## Vendoring (ADR 0180) The gate is factory-vendored. Landed on dev-factory `backport/idss-2068` (`f36604c`, off the pin `06f65763`, #1684 still open) and re-vendored — `FACTORY_REF` `06f65763`→`f36604c`, `FACTORY_MANIFEST` no churn, drift-gate OK. Forward-port onto dev-factory `main` (a reviewed PR) is owed as **#2108**. ## Proof `bash .sandcastle/tests/gate-lib-test.sh` → `gate-lib: 56 checks passed` (includes the bare-`%%` reject/accept fixture and the happy-dom harness-fault case). `gate_docs_default_cmd` over the live docs trees: 78/78 mermaid blocks parse, 17 slice YAMLs clean. **Screenshots:** none — a pre-push gate (shell + a node CLI check) has no visible UI surface; the proof is the offline test suite and the real-checker fixture, both quoted above.
harness: a docs tier for the pre-push gate so a bare %% is refused at the push (#2068)
Some checks failed
ci / seam (pull_request) Successful in 18m2s
ci / publish (pull_request) Has been skipped
ci / publish-broker (pull_request) Has been skipped
ci / deploy-broker (pull_request) Has been cancelled
e74457e1f1
A docs-only change carried no go/ts token, so gate_langs_for_files mapped it to
nothing and the pre-push hook passed — the mermaid-parse (#343) and slice-map
YAML (#834) seam contracts were CI-only. GOTCHAS #143 (a bare `%%` glues onto
the diagram header) red CI a second time through exactly this hole, in a slice
DAG (run 52773, sig 93e101f240ab).

Add a third `docs` tier mirroring the cheap gofmt host door (#1458):
gate_langs_for_files emits `docs` for docs/architecture, docs/slices and
docs/ux/flows; gate_docs_stage resolves GATE_DOCS_CMD -> .sandcastle/docs-gate.sh
-> `node` (gate_docs_default_cmd runs the in-repo check-mermaid.mjs +
check-slices-yaml.mjs) and fails closed when none resolve; gate_run dispatches it
on every push path. A checker CRASH (e.g. no happy-dom in a sandbox with no
`pnpm install`, GOTCHAS #400) is reported LOUDLY as a harness fault naming
happy-dom — never as a parse failure, never silently skipped.

Factory-vendored (ADR 0180): landed on dev-factory backport/idss-2068
(f36604c, off pin 06f65763) and re-vendored; FACTORY_REF bumped, FACTORY_MANIFEST
no churn. GOTCHAS #143 Rule + STATUS.md updated. Forward-port to dev-factory main
owed (#2108).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Factory-Account: d631bd58e1e9
Owner

Reviewed for merge at Ben's request (2026-11-16 PR sweep) — not merged; left open. Its FACTORY_REF pin is a dev-factory backport/idss-* commit 6–9 commits BEHIND the pin main now carries (291c9bf, after #2179), and not an ancestor of it — merging would roll the vendored harness back. Needs its dev-factory commit re-backported on top of 291c9bf and re-vendored (drift-clean), then a fresh PR.

Reviewed for merge at Ben's request (2026-11-16 PR sweep) — **not merged; left open.** Its FACTORY_REF pin is a dev-factory `backport/idss-*` commit 6–9 commits BEHIND the pin main now carries (`291c9bf`, after #2179), and not an ancestor of it — merging would roll the vendored harness back. Needs its dev-factory commit re-backported on top of `291c9bf` and re-vendored (drift-clean), then a fresh PR.
Owner

Superseded by a7483d0e on main. That commit re-vendors #2068, #2111 and #2114 together onto the current pin (dev-factory backport/idss-2068-2111-2114 @ bbcf34e, off 69d5c0d), so the #2057 snapshot fix stays in. Merging this PR would have rolled FACTORY_REF back. One change: the docs tier now reads its trees from .sandcastle/docs-gate.globs rather than hardcoding idss paths in vendored gate-lib.sh (dev-factory #47 guard).

Superseded by a7483d0e on main. That commit re-vendors #2068, #2111 and #2114 together onto the current pin (dev-factory `backport/idss-2068-2111-2114` @ bbcf34e, off 69d5c0d), so the #2057 snapshot fix stays in. Merging this PR would have rolled `FACTORY_REF` back. One change: the docs tier now reads its trees from `.sandcastle/docs-gate.globs` rather than hardcoding idss paths in vendored `gate-lib.sh` (dev-factory #47 guard).
ben closed this pull request 2026-11-17 12:55:46 +00:00
Some checks failed
ci / seam (pull_request) Successful in 18m2s
ci / publish (pull_request) Has been skipped
ci / publish-broker (pull_request) Has been skipped
ci / deploy-broker (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss!2109
No description provided.