checkwright 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +385 -19
- package/lib/common/digest.sh +18 -0
- package/lib/common/lock.sh +11 -0
- package/lib/common/recipe.sh +8 -11
- package/lib/doctor.sh +49 -0
- package/lib/init.sh +152 -29
- package/package.json +2 -2
- package/payload/artifact/targets.list +30 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
- package/payload/canon-kit/README.md +1 -0
- package/payload/canon-kit/SPEC.md +281 -26
- package/payload/canon-kit/checks/check-comment-tier.sh +7 -2
- package/payload/canon-kit/checks/check-docs-link-convention.sh +11 -4
- package/payload/canon-kit/checks/check-md-refs.sh +22 -9
- package/payload/canon-kit/checks/check-payload-claim.sh +133 -0
- package/payload/canon-kit/checks/check-prose-enum.sh +1 -1
- package/payload/canon-kit/checks/check-spec-pointer.sh +15 -4
- package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
- package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +26 -3
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
- package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +5 -3
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +24 -1
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
- package/payload/canon-kit/lib/spec.sh +22 -12
- package/payload/canon-kit/smoke/install.sh +20 -1
- package/payload/canon-kit/templates/SPEC-amendment.md +5 -1
- package/payload/context-kit/SPEC.md +38 -7
- package/payload/context-kit/lib/toolfloor.sh +1 -1
- package/payload/context-kit/smoke/install.sh +3 -1
- package/payload/delegation-kit/README.md +2 -1
- package/payload/delegation-kit/SPEC.md +590 -48
- package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
- package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +61 -0
- package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -1
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/agents/silent.md +7 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/args +1 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/agents/explicit-cheap.md +7 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/agents/explicit-inherit.md +8 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/args +1 -0
- package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/expect.txt +1 -0
- package/payload/delegation-kit/lib/delegation.sh +3 -0
- package/payload/delegation-kit/smoke/install.sh +3 -1
- package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
- package/payload/delegation-kit/templates/agent-execution.md +171 -15
- package/payload/delegation-kit/templates/delegation-config.sh +4 -0
- package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
- package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
- package/payload/doctrine-kit/DOCTRINE.md +27 -0
- package/payload/doctrine-kit/README.md +5 -0
- package/payload/doctrine-kit/SPEC.md +62 -3
- package/payload/doctrine-kit/bin/install-doctrine.sh +84 -4
- package/payload/doctrine-kit/smoke/install.sh +77 -1
- package/payload/drift-kit/README.md +3 -2
- package/payload/drift-kit/SPEC.md +253 -20
- package/payload/drift-kit/bin/stage-economics.sh +157 -3
- package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
- package/payload/drift-kit/smoke/install.sh +155 -1
- package/payload/drift-kit/templates/economics.md +9 -0
- package/payload/drift-kit/templates/kpis.list +6 -1
- package/payload/evidence-kit/README.md +20 -6
- package/payload/evidence-kit/SPEC.md +355 -17
- package/payload/evidence-kit/bin/run-validate.sh +51 -9
- package/payload/evidence-kit/checks/check-battery-roster.sh +86 -0
- package/payload/evidence-kit/checks/check-producer-liveness.sh +34 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
- package/payload/evidence-kit/lib/evidence.sh +18 -0
- package/payload/evidence-kit/smoke/install.sh +17 -3
- package/payload/gate-sdk/README.md +4 -1
- package/payload/gate-sdk/SPEC.md +1955 -79
- package/payload/gate-sdk/bin/gen-pre-commit.sh +13 -3
- package/payload/gate-sdk/bin/run-consumer-smoke.sh +121 -1
- package/payload/gate-sdk/bin/run-gate-tests.sh +40 -9
- package/payload/gate-sdk/bin/run-gates.sh +32 -3
- package/payload/gate-sdk/bin/upgrade-smoke.sh +3 -3
- package/payload/gate-sdk/checks/check-action-gh-repo.gate +2 -0
- package/payload/gate-sdk/checks/check-action-pinning.gate +2 -0
- package/payload/gate-sdk/checks/check-action-run-shell.sh +3 -1
- package/payload/gate-sdk/checks/check-core-files.sh +27 -4
- package/payload/gate-sdk/checks/check-exec-bit.sh +20 -1
- package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +106 -0
- package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +6 -7
- package/payload/gate-sdk/checks/check-gate-output.sh +9 -1
- package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +302 -0
- package/payload/gate-sdk/checks/check-graph.sh +7 -8
- package/payload/gate-sdk/checks/check-readme-roster.sh +5 -0
- package/payload/gate-sdk/checks/check-reads-couples.sh +73 -22
- package/payload/gate-sdk/checks/check-template-registry-parity.sh +81 -0
- package/payload/gate-sdk/checks/check-tree-terms.sh +11 -7
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
- package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +123 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +41 -1
- package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
- package/payload/gate-sdk/lib/consumer-smoke.sh +26 -1
- package/payload/gate-sdk/lib/gate.sh +104 -13
- package/payload/gate-sdk/lib/inject.sh +21 -1
- package/payload/gate-sdk/smoke/install.sh +19 -1
- package/payload/guard-kit/README.md +4 -3
- package/payload/guard-kit/SPEC.md +88 -10
- package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
- package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
- package/payload/guard-kit/lib/guard.sh +1 -0
- package/payload/guard-kit/templates/close-triage.md +35 -7
- package/payload/guard-kit/templates/guard-config.sh +3 -0
- package/payload/lifecycle-kit/README.md +1 -0
- package/payload/lifecycle-kit/SPEC.md +589 -33
- package/payload/lifecycle-kit/bin/enter-stage.sh +13 -3
- package/payload/lifecycle-kit/bin/file-gap.sh +42 -1
- package/payload/lifecycle-kit/bin/file-survey.sh +50 -0
- package/payload/lifecycle-kit/checks/check-merge-attrs.sh +1 -1
- package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
- package/payload/lifecycle-kit/checks/check-survey-record.sh +102 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +84 -0
- package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +94 -0
- package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
- package/payload/lifecycle-kit/lib/stages.sh +8 -2
- package/payload/lifecycle-kit/smoke/install.sh +17 -1
- package/payload/lifecycle-kit/templates/consult.md +73 -0
- package/payload/lifecycle-kit/templates/lead.md +141 -10
- package/payload/lifecycle-kit/templates/stages/align.md +12 -0
- package/payload/lifecycle-kit/templates/stages/build.md +8 -0
- package/payload/lifecycle-kit/templates/stages/close.md +25 -4
- package/payload/lifecycle-kit/templates/stages/scope.md +34 -0
- package/payload/lifecycle-kit/templates/stages/spec.md +8 -0
- package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
- package/payload/queue-kit/README.md +4 -1
- package/payload/queue-kit/SPEC.md +230 -6
- package/payload/queue-kit/bin/queue-edges.sh +78 -0
- package/payload/queue-kit/checks/check-queue-entry-budget.sh +5 -3
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
- package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
- package/payload/queue-kit/smoke/install.sh +4 -1
- package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
- package/payload/site-kit/SPEC.md +135 -29
- package/payload/site-kit/checks/check-docs-render-fidelity.sh +100 -27
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +158 -0
- package/payload/site-kit/lib/site.sh +16 -2
- package/payload/site-kit/smoke/install.sh +9 -1
- package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
- package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
package/payload/site-kit/SPEC.md
CHANGED
|
@@ -58,11 +58,29 @@ told to load but cannot find. Knobs:
|
|
|
58
58
|
aliases, and dated posts are immutable published artifacts.
|
|
59
59
|
- `SITE_KIT_DOCS_DIR` — the docs-site root `check-docs-render-fidelity` walks
|
|
60
60
|
for tracked markdown pages, default `docs`.
|
|
61
|
-
- `SITE_KIT_RENDERER` — array, the stdin→stdout GFM-to-HTML
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
- `SITE_KIT_RENDERER` — array, the stdin→stdout **single-document** GFM-to-HTML
|
|
62
|
+
command, default the kramdown CLI invocation with GFM input —
|
|
63
|
+
`ruby -e '…Kramdown::Document…input: "GFM"…'`, the parser GitHub Pages pins.
|
|
64
|
+
It is the contract `check-docs-render-fidelity` renders each page through when
|
|
65
|
+
`SITE_KIT_RENDERER_BATCH` is empty: one of the gate's two renderer contracts,
|
|
66
|
+
and the fallback of the pair. A consumer whose Pages stack differs points this
|
|
65
67
|
at its own renderer; an unresolvable one fails the gate closed.
|
|
68
|
+
- `SITE_KIT_RENDERER_BATCH` — array, **optional**: a command rendering N
|
|
69
|
+
documents over one stream, `NUL`-terminated in both directions and
|
|
70
|
+
count-preserving, the framing specified in §check-docs-render-fidelity. Setting
|
|
71
|
+
it collapses the gate's per-page interpreter restarts into a single process,
|
|
72
|
+
which is where substantially all of that gate's cost lives. Its default is the
|
|
73
|
+
batch form of the same kramdown-with-GFM-input invocation `SITE_KIT_RENDERER`
|
|
74
|
+
defaults to — a `ruby -e` loop splitting stdin on `NUL` and writing one
|
|
75
|
+
`NUL`-terminated HTML document per input — filled **only when
|
|
76
|
+
`SITE_KIT_RENDERER` is itself still at its kit default.** Filling it
|
|
77
|
+
unconditionally would defeat a deliberate pin: a consumer who points
|
|
78
|
+
`SITE_KIT_RENDERER` at the version-locked bundle below, not knowing a second
|
|
79
|
+
knob now exists, would have that pinned oracle replaced by this unpinned one
|
|
80
|
+
and the gate would report clean against a parser build they explicitly
|
|
81
|
+
rejected — a false clean produced by an upgrade. Under the rule they instead
|
|
82
|
+
keep the per-document path at its own cost and its own semantics, and opt in by
|
|
83
|
+
pointing this knob at the batch form of their own pinned renderer.
|
|
66
84
|
- `SITE_KIT_CONFIG_FILE` — the loader override; when set it must resolve, else
|
|
67
85
|
the gate exits 2 rather than silently run on defaults.
|
|
68
86
|
|
|
@@ -184,6 +202,49 @@ consumer registers this gate; it stays outside env-probe's probe-set floor, and
|
|
|
184
202
|
published docs site simply omits the gate by the registry-not-array convention
|
|
185
203
|
and never installs the dependency.
|
|
186
204
|
|
|
205
|
+
**The batch stream, and why the count is the fail-closed.** One renderer process
|
|
206
|
+
per page is the gate's whole cost — the interpreter restarts, not the rendering —
|
|
207
|
+
so where `SITE_KIT_RENDERER_BATCH` is non-empty the gate renders the corpus over
|
|
208
|
+
one stream instead. The framing is `NUL`-terminated in both directions: the gate
|
|
209
|
+
writes each front-matter-stripped body, `NUL`-terminated, to the command's stdin,
|
|
210
|
+
and the command writes each rendered document to stdout in the **same order**,
|
|
211
|
+
each `NUL`-terminated. `NUL` is a *terminator* rather than a separator, so N
|
|
212
|
+
documents produce exactly N `NUL`s with no trailing-empty ambiguity, and it is
|
|
213
|
+
unforgeable by page content for a stronger reason than rarity: bash cannot hold a
|
|
214
|
+
`NUL` in a variable, so the gate's own reader has already dropped any `NUL` in
|
|
215
|
+
the source before framing happens. A sentinel line would be forgeable — by a docs
|
|
216
|
+
page describing this contract, first of all. Length-prefixed framing is equally
|
|
217
|
+
sound and loses only on the obligation it puts on a consumer, who would have to
|
|
218
|
+
implement exact-byte reads where splitting on a byte is a one-liner in every
|
|
219
|
+
language a Pages stack might use.
|
|
220
|
+
|
|
221
|
+
Two implementation constraints follow, and a natural reading of the contract
|
|
222
|
+
breaks both. **Command substitution strips `NUL`**, so the batch output must
|
|
223
|
+
never pass through `$(…)`; the gate reads it through a **process substitution**
|
|
224
|
+
instead, which also keeps the loop body in the current shell so the findings it
|
|
225
|
+
appends to survive. Writer and reader being separate processes
|
|
226
|
+
is what makes the exchange deadlock-free. **Process substitution discards the
|
|
227
|
+
renderer's exit status**, so the batch path cannot keep the per-page fail-closed
|
|
228
|
+
the per-document loop has — and a renderer that dies mid-stream yields fewer
|
|
229
|
+
documents than pages. The gate therefore compares documents-read against
|
|
230
|
+
pages-enumerated after the loop, which detects renderer death, truncation and
|
|
231
|
+
framing error alike, one check standing in for the status the shell threw away.
|
|
232
|
+
It exits 2 — a refusal to run the oracle — never 1, which would report a finding
|
|
233
|
+
about the docs. Per-document scanning is unchanged: each document read off the
|
|
234
|
+
stream goes through the same assertions, and the source-side scans are untouched.
|
|
235
|
+
|
|
236
|
+
**Probe routing.** The gate probes the oracle it will actually run, and only that
|
|
237
|
+
one. With the batch knob empty it probes `SITE_KIT_RENDERER` on a one-line
|
|
238
|
+
document exactly as above. With the batch knob set it probes the batch command
|
|
239
|
+
instead, on a probe that exercises the framing as well as the parser: two
|
|
240
|
+
one-line documents in, exactly two non-empty documents back. Probing the
|
|
241
|
+
per-document renderer too would refuse a batch-only consumer over a renderer this
|
|
242
|
+
run never invokes. A **failing** batch probe exits 2 and does not fall back: a
|
|
243
|
+
set knob is the consumer's deliberate statement about which parser is
|
|
244
|
+
authoritative, so quietly rendering through a different one is the same
|
|
245
|
+
false-clean class the fill condition in §Layout and configuration closes from the
|
|
246
|
+
other direction. A gate that cannot run its configured oracle refuses.
|
|
247
|
+
|
|
187
248
|
The false-positive floor is the assertion's hard boundary, deliberately set. The
|
|
188
249
|
backtick symptom rests on a property of well-formed markdown: every backtick
|
|
189
250
|
belongs to a code span, which renders inside `<code>` and is excluded from the
|
|
@@ -228,14 +289,34 @@ line) landed then, and this assertion mechanizes the channel. The good/bad
|
|
|
228
289
|
fixture pair exercises the span-corruption symptom (a bad page whose severed span
|
|
229
290
|
leaks a stray backtick and a raw placeholder tag, a good page whose faithful code
|
|
230
291
|
spans render clean) alongside the fence/heading case. Because that bad page would
|
|
231
|
-
red on its fence run alone,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
292
|
+
red on its fence run alone, every assertion the pair cannot isolate carries a
|
|
293
|
+
hermetic unit test of its own, named here rather than described:
|
|
294
|
+
`check-docs-render-fidelity-span.test.sh`,
|
|
295
|
+
`check-docs-render-fidelity-table.test.sh`,
|
|
296
|
+
`check-docs-render-fidelity-foreign.test.sh` and
|
|
297
|
+
`check-docs-render-fidelity-batch.test.sh`.
|
|
298
|
+
|
|
299
|
+
The span test runs a page with no fence, no surplus heading and no table, whose
|
|
300
|
+
only defect is the severed span: it reds span-only and clears in the
|
|
301
|
+
doubled-backtick form, so a widening that reds nothing new cannot pass. The table
|
|
302
|
+
test is that same shape — a collapsed table reds table-only, a trailing blank
|
|
303
|
+
clears. The foreign test holds the SVG/MathML exemption to its *scope*: a page
|
|
304
|
+
carrying inline `<svg>` clears, because the exemption follows the subtree by
|
|
305
|
+
open/close depth rather than a name list, while a bare `<path>` outside any
|
|
306
|
+
`<svg>` still reds — and that second half is what keeps the first from passing
|
|
307
|
+
under a blanket widening, which would clear the good page at the cost of the
|
|
308
|
+
placeholder tokens the assertion exists for. The batch test exists because the
|
|
309
|
+
good/bad pair sets no renderer knob, so it already runs the batch path and cannot
|
|
310
|
+
by itself distinguish that path from the fallback; it asserts that the kit's two
|
|
311
|
+
renderer defaults render a corpus byte-identically, that a pinned
|
|
312
|
+
`SITE_KIT_RENDERER` suppresses the batch default, that the batch path and the
|
|
313
|
+
per-document fallback return the same verdict on the same pages, and that a wrong
|
|
314
|
+
document count and an unresolvable batch command each exit 2. The count case uses
|
|
315
|
+
a stub that always emits two documents, so it passes the two-document probe and is
|
|
316
|
+
caught only by the corpus count — a stub the probe already rejected would never
|
|
317
|
+
reach the assertion under test.
|
|
237
318
|
The positional form `check-docs-render-fidelity.sh [docs-dir] [config-file]`
|
|
238
|
-
lets a fixture point the docs dir and renderer at a synthetic tree without
|
|
319
|
+
lets a fixture point the docs dir and renderer knobs at a synthetic tree without
|
|
239
320
|
touching consumer config. `precommit` tier, coupling the docs tree.
|
|
240
321
|
|
|
241
322
|
Parser-version fidelity (a second honest limit). The oracle is faithful to the
|
|
@@ -247,19 +328,41 @@ introduced between the two versions. The exact-pin recipe closes that gap for a
|
|
|
247
328
|
consumer that needs it: point `SITE_KIT_RENDERER` at a version-locked bundle —
|
|
248
329
|
a `bundle exec ruby …Kramdown…` invocation whose `Gemfile.lock` pins kramdown
|
|
249
330
|
(and `kramdown-parser-gfm`) to the versions the `github-pages` gem resolves — so
|
|
250
|
-
the oracle and the deploy render byte-for-byte the same parser build.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
331
|
+
the oracle and the deploy render byte-for-byte the same parser build. Pin
|
|
332
|
+
`SITE_KIT_RENDERER_BATCH` in the same motion, at the batch form of that same
|
|
333
|
+
locked bundle, or leave it unset: those are the two states in which the gate runs
|
|
334
|
+
the parser build the pin names. Overriding only the per-document knob already
|
|
335
|
+
leaves the batch knob empty by its fill rule, so a half-applied pin costs speed
|
|
336
|
+
rather than fidelity — but a consumer who set a batch renderer earlier and pins
|
|
337
|
+
only the per-document one afterwards has pinned the knob the gate will not use.
|
|
338
|
+
The kit does not auto-resolve the pin: fetching the Pages-locked gemset at gate
|
|
339
|
+
time would break the hermetic no-network render contract the oracle depends on (a
|
|
340
|
+
gate must run offline and deterministically), so it stays a consumer's deliberate
|
|
341
|
+
override, not kit-run machinery.
|
|
342
|
+
|
|
343
|
+
Renderer agreement (a third honest limit). Where a consumer sets both renderer
|
|
344
|
+
knobs, the kit cannot verify that their batch renderer agrees document-for-
|
|
345
|
+
document with their per-document one; a divergent pair yields a divergent oracle,
|
|
346
|
+
and nothing in the framing contract can detect that. What the kit does hold is
|
|
347
|
+
its own pair: the two defaults are asserted byte-identical over a corpus by
|
|
348
|
+
fixture, so the zero-config path is covered by construction rather than by
|
|
349
|
+
assumption.
|
|
255
350
|
|
|
256
351
|
## lib/site.sh
|
|
257
352
|
|
|
258
353
|
The sourced config loader: it loads `SITE_KIT_CONFIG_FILE` (or the gates-dir
|
|
259
|
-
`site-config.sh` when that env is unset), then fills
|
|
354
|
+
`site-config.sh` when that env is unset), then fills each knob's default, so a
|
|
260
355
|
gate and a fixture read one resolved configuration. It carries no gate logic —
|
|
261
356
|
structure stays in the check, values in config, defaults here.
|
|
262
357
|
|
|
358
|
+
Every knob's default is filled whenever the consumer left it unset, with one
|
|
359
|
+
exception the loader is the only place to state: `SITE_KIT_RENDERER_BATCH` is
|
|
360
|
+
filled only where the loader also owns `SITE_KIT_RENDERER` — where the consumer
|
|
361
|
+
overrode neither. A consumer who overrode the per-document renderer and left the
|
|
362
|
+
batch knob unset gets an empty batch array instead of a default, so the gate
|
|
363
|
+
keeps running the oracle they chose; §Layout and configuration states the rule
|
|
364
|
+
with the false clean it exists to prevent.
|
|
365
|
+
|
|
263
366
|
## templates/site-health.yml
|
|
264
367
|
|
|
265
368
|
The scheduled live-site probe, copied verbatim into a consumer's
|
|
@@ -409,18 +512,21 @@ Deliberately uncapped and unknobbed: a "newest N only" bound would stop probing
|
|
|
409
512
|
exactly the old releases where this class of defect has actually been found.
|
|
410
513
|
|
|
411
514
|
The kit's `smoke/install.sh` installs the template verbatim into the scratch tree
|
|
412
|
-
as governed surface
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
action pins, its `gh` repository
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
515
|
+
as governed surface, and registers the gates that read it. The scratch battery is
|
|
516
|
+
the union of what each kit's `smoke/install.sh` registers; this kit contributes
|
|
517
|
+
`check-docs-cname-parity` and — because it writes the only Actions-shaped surface
|
|
518
|
+
any install writes — the gates that lint a workflow's Actions shape:
|
|
519
|
+
`check-action-pinning`, `check-action-run-shell`, `check-action-gh-repo`.
|
|
520
|
+
`check-tree-terms` reads the installed file too, for tree terms. So a template
|
|
521
|
+
regression in the workflow's bash, its action pins, or its `gh` repository
|
|
522
|
+
context reds the smoke rather than surfacing at a consumer.
|
|
523
|
+
|
|
524
|
+
Those four qualify under the registration accounting's predicate — a gate earns a
|
|
525
|
+
scratch-battery slot when it reads a surface the install writes — because this
|
|
526
|
+
install writes the workflow they lint. The predicate binds every kit and is owned
|
|
527
|
+
by gate-sdk/SPEC.md §Consumer smoke, which also rules on the omissions: what this
|
|
528
|
+
kit leaves unregistered is decided by the accounting's probe, not by a judgment
|
|
529
|
+
recorded here.
|
|
424
530
|
|
|
425
531
|
## Out of scope
|
|
426
532
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#
|
|
5
5
|
# usage: check-docs-render-fidelity.sh [docs-dir] [config-file]
|
|
6
6
|
# defaults SITE_KIT_DOCS_DIR; config-file overrides SITE_KIT_CONFIG_FILE so a
|
|
7
|
-
# fixture supplies its own
|
|
7
|
+
# fixture supplies its own renderer knobs / docs dir.
|
|
8
8
|
set -uo pipefail
|
|
9
9
|
|
|
10
10
|
KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
@@ -23,12 +23,28 @@ git rev-parse --git-dir >/dev/null 2>&1 || {
|
|
|
23
23
|
echo "check-docs-render-fidelity: not a git repository — cannot enumerate tracked pages" >&2; exit 2; }
|
|
24
24
|
[[ -d "$DOCS" ]] || { echo "check-docs-render-fidelity: docs dir not found: $DOCS" >&2; exit 2; }
|
|
25
25
|
|
|
26
|
-
probe
|
|
27
|
-
if [[
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
# spec: site-kit/SPEC.md §check-docs-render-fidelity — probe the oracle the gate will actually run, and only that one: a set batch knob is the consumer's statement of which parser is authoritative, so a batch-only setup is never refused over a per-document renderer this run will not invoke
|
|
27
|
+
if [[ ${#SITE_KIT_RENDERER_BATCH[@]} -gt 0 ]]; then
|
|
28
|
+
bprobe=0
|
|
29
|
+
while IFS= read -r -d '' d; do
|
|
30
|
+
[[ -n "${d//[[:space:]]/}" ]] && bprobe=$((bprobe + 1))
|
|
31
|
+
done < <(printf '%s\n\000' '# probe one' '# probe two' | "${SITE_KIT_RENDERER_BATCH[@]}" 2>/dev/null)
|
|
32
|
+
if [[ "$bprobe" -ne 2 ]]; then
|
|
33
|
+
echo "check-docs-render-fidelity: batch renderer '${SITE_KIT_RENDERER_BATCH[*]}' failed its probe" >&2
|
|
34
|
+
echo " (2 documents in, $bprobe non-empty document(s) back)" >&2
|
|
35
|
+
echo " help: SITE_KIT_RENDERER_BATCH must read NUL-terminated documents from stdin and write" >&2
|
|
36
|
+
echo " one NUL-terminated HTML document per input, in order; unset it to fall back to" >&2
|
|
37
|
+
echo " the per-document SITE_KIT_RENDERER contract" >&2
|
|
38
|
+
exit 2
|
|
39
|
+
fi
|
|
40
|
+
else
|
|
41
|
+
probe="$(printf '# probe\n' | "${SITE_KIT_RENDERER[@]}" 2>/dev/null)"; pst=$?
|
|
42
|
+
if [[ "$pst" -ne 0 || -z "$probe" ]]; then
|
|
43
|
+
echo "check-docs-render-fidelity: renderer '${SITE_KIT_RENDERER[*]}' could not run (exit $pst)" >&2
|
|
44
|
+
echo " help: install the Pages parser — ruby plus the kramdown-parser-gfm gem — or point" >&2
|
|
45
|
+
echo " SITE_KIT_RENDERER at a stdin->stdout GFM-to-HTML command" >&2
|
|
46
|
+
exit 2
|
|
47
|
+
fi
|
|
32
48
|
fi
|
|
33
49
|
|
|
34
50
|
listing="$(git ls-files -- "$DOCS")"; st=$?
|
|
@@ -48,15 +64,14 @@ if [[ ${#pages[@]} -eq 0 ]]; then
|
|
|
48
64
|
exit 0
|
|
49
65
|
fi
|
|
50
66
|
|
|
51
|
-
strip_fm='NR==1 && $0=="---" { fm=1; next } fm==1 && $0=="---" { fm=0; next } fm==1 { next } { print }'
|
|
52
|
-
|
|
53
67
|
rendered_scan='
|
|
54
68
|
BEGIN {
|
|
55
|
-
inpre=0; leak=0; h=0; tbl=0; fgn=0
|
|
56
69
|
# spec: site-kit/SPEC.md §check-docs-render-fidelity — the known-HTML-element set is a kit built-in, not a config seam
|
|
57
70
|
split("a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script search section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr", A, " ")
|
|
58
71
|
for (i in A) HTMLEL[A[i]]=1
|
|
59
72
|
}
|
|
73
|
+
# spec: site-kit/SPEC.md §check-docs-render-fidelity — BEGINFILE/ENDFILE (GNU awk) reset the per-page state and emit the result the instant the file ends, so one process fed every page html file reproduces what re-execing this program once per page produced
|
|
74
|
+
BEGINFILE { inpre=0; leak=0; h=0; tbl=0; fgn=0 }
|
|
60
75
|
{
|
|
61
76
|
t=$0
|
|
62
77
|
while (match(t, /<h[1-6][ >]/)) { h++; t=substr(t, RSTART+RLENGTH) }
|
|
@@ -85,10 +100,10 @@ BEGIN {
|
|
|
85
100
|
gsub(/<[^>]*>/, "", s)
|
|
86
101
|
if (s ~ /`/) leak=1
|
|
87
102
|
}
|
|
88
|
-
|
|
103
|
+
ENDFILE { print leak+0, h+0, tbl+0 }'
|
|
89
104
|
|
|
90
105
|
source_headings='
|
|
91
|
-
|
|
106
|
+
BEGINFILE { infence=0; fchar=""; flen=0; count=0; prevblank=1; previsatx=0 }
|
|
92
107
|
{
|
|
93
108
|
s=$0; n=0
|
|
94
109
|
while (substr(s,1,1)==" ") { s=substr(s,2); n++ }
|
|
@@ -109,11 +124,11 @@ BEGIN { infence=0; fchar=""; flen=0; count=0; prevblank=1; previsatx=0 }
|
|
|
109
124
|
if (n<=3 && s ~ /^#{1,6}([ \t]|$)/) { count++; prevblank=0; previsatx=1; next }
|
|
110
125
|
prevblank=($0 ~ /^[ \t]*$/); previsatx=0
|
|
111
126
|
}
|
|
112
|
-
|
|
127
|
+
ENDFILE { print count+0 }'
|
|
113
128
|
|
|
114
129
|
# spec: site-kit/SPEC.md §check-docs-render-fidelity — count source GFM table starts (a pipe row followed by a | --- | delimiter row) outside code fences
|
|
115
130
|
source_tables='
|
|
116
|
-
|
|
131
|
+
BEGINFILE { infence=0; fchar=""; flen=0; count=0; prevpipe=0 }
|
|
117
132
|
{
|
|
118
133
|
s=$0; n=0
|
|
119
134
|
while (substr(s,1,1)==" ") { s=substr(s,2); n++ }
|
|
@@ -133,21 +148,79 @@ BEGIN { infence=0; fchar=""; flen=0; count=0; prevpipe=0 }
|
|
|
133
148
|
if ($0 ~ /^[ \t]*$/) { prevpipe=0; next }
|
|
134
149
|
prevpipe = (index($0, "|") > 0) ? 1 : 0
|
|
135
150
|
}
|
|
136
|
-
|
|
151
|
+
ENDFILE { print count+0 }'
|
|
152
|
+
|
|
153
|
+
# spec: site-kit/SPEC.md §check-docs-render-fidelity — one awk process strips front matter from every page at once (a page-indexed temp file per output, gawk's ARGIND keying the filename to the page it came from) rather than re-execing awk once per page; BEGINFILE/ARGIND are GNU awk (already the family's toolchain floor, docs/install.md)
|
|
154
|
+
WORK="$(mktemp -d)" || { echo "check-docs-render-fidelity: could not create a scratch dir" >&2; exit 2; }
|
|
155
|
+
trap 'rm -rf "$WORK"' EXIT
|
|
156
|
+
|
|
157
|
+
for i in "${!pages[@]}"; do : > "$WORK/body.$i"; done
|
|
158
|
+
|
|
159
|
+
awk -v outdir="$WORK" '
|
|
160
|
+
BEGINFILE { outfile = outdir "/body." (ARGIND - 1); fm = 0 }
|
|
161
|
+
FNR==1 && $0=="---" { fm=1; next }
|
|
162
|
+
fm==1 && $0=="---" { fm=0; next }
|
|
163
|
+
fm==1 { next }
|
|
164
|
+
{ print > outfile }
|
|
165
|
+
' "${pages[@]}"
|
|
166
|
+
bst=$?
|
|
167
|
+
fail_closed "$bst" DOCS-RENDER-FIDELITY front-matter-strip
|
|
168
|
+
|
|
169
|
+
bodies=()
|
|
170
|
+
body_files=()
|
|
171
|
+
for i in "${!pages[@]}"; do
|
|
172
|
+
bodies+=("$(<"$WORK/body.$i")")
|
|
173
|
+
body_files+=("$WORK/body.$i")
|
|
174
|
+
done
|
|
175
|
+
|
|
176
|
+
htmls=()
|
|
177
|
+
if [[ ${#SITE_KIT_RENDERER_BATCH[@]} -gt 0 ]]; then
|
|
178
|
+
# spec: site-kit/SPEC.md §check-docs-render-fidelity — command substitution strips NUL, so the framed stream is read through a process substitution: it never passes through $(…), and the loop body stays in this shell
|
|
179
|
+
while IFS= read -r -d '' html; do
|
|
180
|
+
while [[ "$html" == *$'\n' ]]; do html="${html%$'\n'}"; done
|
|
181
|
+
htmls+=("$html")
|
|
182
|
+
done < <(printf '%s\n\000' "${bodies[@]}" | "${SITE_KIT_RENDERER_BATCH[@]}")
|
|
183
|
+
# spec: site-kit/SPEC.md §check-docs-render-fidelity — the count assertion stands in for the per-page exit status process substitution discarded, so it catches renderer death, truncation and framing error alike, and refuses (2) rather than reporting a finding (1)
|
|
184
|
+
if [[ ${#htmls[@]} -ne ${#pages[@]} ]]; then
|
|
185
|
+
echo "check-docs-render-fidelity: batch renderer returned ${#htmls[@]} document(s) for ${#pages[@]} page(s)" >&2
|
|
186
|
+
echo " help: SITE_KIT_RENDERER_BATCH must write exactly one NUL-terminated HTML document per" >&2
|
|
187
|
+
echo " NUL-terminated input document, in order; a short count is a renderer that died" >&2
|
|
188
|
+
echo " mid-stream, truncated its output, or framed it wrongly" >&2
|
|
189
|
+
exit 2
|
|
190
|
+
fi
|
|
191
|
+
else
|
|
192
|
+
for body in "${bodies[@]}"; do
|
|
193
|
+
html="$(printf '%s\n' "$body" | "${SITE_KIT_RENDERER[@]}")"; rst=$?
|
|
194
|
+
fail_closed "$rst" DOCS-RENDER-FIDELITY renderer
|
|
195
|
+
htmls+=("$html")
|
|
196
|
+
done
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
# spec: site-kit/SPEC.md §check-docs-render-fidelity — each of the three per-page scans batches into one awk process across every page's file (gawk's ENDFILE emits the scan's result line the instant a file finishes, in ARGV order, so one process substitution-free command substitution yields one result line per page) rather than re-execing awk once per page per scan
|
|
200
|
+
html_files=()
|
|
201
|
+
for i in "${!pages[@]}"; do
|
|
202
|
+
printf '%s\n' "${htmls[$i]}" > "$WORK/html.$i"
|
|
203
|
+
html_files+=("$WORK/html.$i")
|
|
204
|
+
done
|
|
205
|
+
|
|
206
|
+
rscan_out="$(awk "$rendered_scan" "${html_files[@]}")"; ast=$?
|
|
207
|
+
fail_closed "$ast" DOCS-RENDER-FIDELITY rendered-scan
|
|
208
|
+
mapfile -t rscan_lines <<< "$rscan_out"
|
|
209
|
+
|
|
210
|
+
heading_out="$(awk "$source_headings" "${body_files[@]}")"; sst=$?
|
|
211
|
+
fail_closed "$sst" DOCS-RENDER-FIDELITY source-scan
|
|
212
|
+
mapfile -t heading_lines <<< "$heading_out"
|
|
213
|
+
|
|
214
|
+
table_out="$(awk "$source_tables" "${body_files[@]}")"; tst=$?
|
|
215
|
+
fail_closed "$tst" DOCS-RENDER-FIDELITY source-table-scan
|
|
216
|
+
mapfile -t table_lines <<< "$table_out"
|
|
137
217
|
|
|
138
218
|
findings=()
|
|
139
|
-
for
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
read -r leak rcount rtbl < <(printf '%s\n' "$html" | awk "$rendered_scan"); ast=$?
|
|
146
|
-
fail_closed "$ast" DOCS-RENDER-FIDELITY rendered-scan
|
|
147
|
-
scount="$(printf '%s\n' "$body" | awk "$source_headings")"; sst=$?
|
|
148
|
-
fail_closed "$sst" DOCS-RENDER-FIDELITY source-scan
|
|
149
|
-
stbl="$(printf '%s\n' "$body" | awk "$source_tables")"; tst=$?
|
|
150
|
-
fail_closed "$tst" DOCS-RENDER-FIDELITY source-table-scan
|
|
219
|
+
for i in "${!pages[@]}"; do
|
|
220
|
+
page="${pages[$i]}"
|
|
221
|
+
read -r leak rcount rtbl <<< "${rscan_lines[$i]}"
|
|
222
|
+
scount="${heading_lines[$i]}"
|
|
223
|
+
stbl="${table_lines[$i]}"
|
|
151
224
|
|
|
152
225
|
[[ "$leak" -eq 1 ]] && findings+=("$page: a code-span corruption symptom (a stray backtick, or a raw non-HTML-element tag) leaked into rendered text — a code span or fenced block failed to parse")
|
|
153
226
|
[[ "$rcount" -gt "$scount" ]] && findings+=("$page: $rcount rendered heading(s) exceed $scount source heading(s) outside code — a code-fenced '#' line was promoted")
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Direct unit test of check-docs-render-fidelity's batch renderer contract
|
|
3
|
+
# (SITE_KIT_RENDERER_BATCH), which the good/bad pair cannot express on its own.
|
|
4
|
+
# The pair sets no renderer knob, so lib/site.sh fills the batch default and the
|
|
5
|
+
# pair already runs the batch path — what it leaves untested is everything that
|
|
6
|
+
# needs a second configuration: the kit's two defaults agreeing, the delta-4
|
|
7
|
+
# fill condition, the per-document fallback, and the two exit-2 refusals.
|
|
8
|
+
#
|
|
9
|
+
# Six assertions:
|
|
10
|
+
# 1. parity — the corpus rendered per-document and batched is byte-identical,
|
|
11
|
+
# which is what makes the zero-config agreement claim an
|
|
12
|
+
# assertion rather than a hope.
|
|
13
|
+
# 2. fill rule — a consumer who pinned SITE_KIT_RENDERER gets an EMPTY batch
|
|
14
|
+
# knob, so an upgrade never swaps a pinned oracle for the
|
|
15
|
+
# kit's unpinned one; unpinned, the default arrives.
|
|
16
|
+
# 3/4. verdicts — the batch path and the per-document fallback return the SAME
|
|
17
|
+
# verdict on the same pages, so the speedup changed no finding.
|
|
18
|
+
# 5. count — a batch renderer that passes the probe but returns the wrong
|
|
19
|
+
# document count exits 2 (fail-closed), never 1.
|
|
20
|
+
# 6. probe — an unresolvable batch command exits 2 rather than silently
|
|
21
|
+
# falling back to a different parser.
|
|
22
|
+
# The gate enumerates tracked pages via git ls-files, so the fixture is a
|
|
23
|
+
# throwaway git repo.
|
|
24
|
+
#
|
|
25
|
+
# Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
|
|
26
|
+
set -uo pipefail
|
|
27
|
+
source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
|
|
28
|
+
|
|
29
|
+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # site-kit/
|
|
30
|
+
GATE="$DIR/checks/check-docs-render-fidelity.sh"
|
|
31
|
+
|
|
32
|
+
fails=0
|
|
33
|
+
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
34
|
+
|
|
35
|
+
(
|
|
36
|
+
cd "$tmp" || exit 1
|
|
37
|
+
git init -q
|
|
38
|
+
git config user.email fixture@example.invalid
|
|
39
|
+
git config user.name fixture
|
|
40
|
+
mkdir -p docs
|
|
41
|
+
) || { echo " FAIL: could not init fixture repo"; exit 1; }
|
|
42
|
+
|
|
43
|
+
cat > "$tmp/docs/leak.md" <<'MD'
|
|
44
|
+
# Heading
|
|
45
|
+
|
|
46
|
+
The consequence clause appends after the ` -> <verdict>` arrow, leaving it
|
|
47
|
+
disjoint from the invariant below.
|
|
48
|
+
MD
|
|
49
|
+
|
|
50
|
+
cat > "$tmp/docs/ok.md" <<'MD'
|
|
51
|
+
# Heading
|
|
52
|
+
|
|
53
|
+
The consequence clause appends after the `` -> <verdict> `` arrow, leaving it
|
|
54
|
+
disjoint from the invariant below.
|
|
55
|
+
|
|
56
|
+
| knob | default |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| one | two |
|
|
59
|
+
MD
|
|
60
|
+
|
|
61
|
+
for n in 1 2 3; do printf '# Page %s\n\nBody.\n' "$n" > "$tmp/docs/p$n.md"; done
|
|
62
|
+
|
|
63
|
+
# --- 1. parity: the kit's two defaults agree, document for document ------------
|
|
64
|
+
(
|
|
65
|
+
# shellcheck source=../lib/site.sh
|
|
66
|
+
source "$DIR/lib/site.sh"
|
|
67
|
+
bodies=("$(cat "$tmp/docs/ok.md")" "$(cat "$tmp/docs/leak.md")")
|
|
68
|
+
|
|
69
|
+
one=()
|
|
70
|
+
for b in "${bodies[@]}"; do one+=("$(printf '%s\n' "$b" | "${SITE_KIT_RENDERER[@]}")"); done
|
|
71
|
+
|
|
72
|
+
two=()
|
|
73
|
+
while IFS= read -r -d '' h; do
|
|
74
|
+
while [[ "$h" == *$'\n' ]]; do h="${h%$'\n'}"; done
|
|
75
|
+
two+=("$h")
|
|
76
|
+
done < <(printf '%s\n\000' "${bodies[@]}" | "${SITE_KIT_RENDERER_BATCH[@]}")
|
|
77
|
+
|
|
78
|
+
[[ ${#two[@]} -eq ${#one[@]} ]] \
|
|
79
|
+
|| { echo " FAIL: batch returned ${#two[@]} document(s) for ${#one[@]} page(s)"; exit 1; }
|
|
80
|
+
for i in "${!one[@]}"; do
|
|
81
|
+
[[ "${one[$i]}" == "${two[$i]}" ]] \
|
|
82
|
+
|| { echo " FAIL: document $i diverges between the per-document and batch defaults"; exit 1; }
|
|
83
|
+
done
|
|
84
|
+
exit 0
|
|
85
|
+
) || fails=$((fails + 1))
|
|
86
|
+
|
|
87
|
+
# --- 2. the delta-4 fill condition: a pinned renderer suppresses the default ---
|
|
88
|
+
n_pinned="$( SITE_KIT_RENDERER=(true) ; source "$DIR/lib/site.sh" ; echo "${#SITE_KIT_RENDERER_BATCH[@]}" )"
|
|
89
|
+
[[ "$n_pinned" -eq 0 ]] \
|
|
90
|
+
|| { echo " FAIL: a pinned SITE_KIT_RENDERER still got a batch default ($n_pinned element(s)) — an upgrade would replace the pinned oracle"; fails=$((fails + 1)); }
|
|
91
|
+
n_default="$( source "$DIR/lib/site.sh" ; echo "${#SITE_KIT_RENDERER_BATCH[@]}" )"
|
|
92
|
+
[[ "$n_default" -gt 0 ]] \
|
|
93
|
+
|| { echo " FAIL: an unpinned SITE_KIT_RENDERER got no batch default — the zero-config speedup is not armed"; fails=$((fails + 1)); }
|
|
94
|
+
|
|
95
|
+
# A config that declares the batch knob empty leaves the per-document path in
|
|
96
|
+
# force with the kit's own renderer — the fallback branch, with no second copy
|
|
97
|
+
# of the renderer literal to drift.
|
|
98
|
+
printf '%s\n' '# shellcheck shell=bash' \
|
|
99
|
+
'# comment-tier-exempt: fixture config — an empty batch knob forces the per-document fallback branch' \
|
|
100
|
+
'# shellcheck disable=SC2034 # sourced by the gate under test' \
|
|
101
|
+
'SITE_KIT_RENDERER_BATCH=()' > "$tmp/batch-off.sh"
|
|
102
|
+
|
|
103
|
+
# --- 3/4. both paths, same verdicts -------------------------------------------
|
|
104
|
+
git -C "$tmp" add docs/leak.md
|
|
105
|
+
for mode in batch per-document; do
|
|
106
|
+
cfg=(); [[ "$mode" == per-document ]] && cfg=("$tmp/batch-off.sh")
|
|
107
|
+
out="$( cd "$tmp" && "$GATE" docs "${cfg[@]+"${cfg[@]}"}" 2>&1 )"; rc=$?
|
|
108
|
+
[[ "$rc" -eq 1 ]] \
|
|
109
|
+
|| { echo " FAIL: $mode path: severed span expected exit 1, got $rc: $out"; fails=$((fails + 1)); }
|
|
110
|
+
grep -qF -- "leaked into rendered text" <<<"$out" \
|
|
111
|
+
|| { echo " FAIL: $mode path: red output lacks the span finding: $out"; fails=$((fails + 1)); }
|
|
112
|
+
done
|
|
113
|
+
|
|
114
|
+
git -C "$tmp" rm -q --cached docs/leak.md
|
|
115
|
+
git -C "$tmp" add docs/ok.md
|
|
116
|
+
for mode in batch per-document; do
|
|
117
|
+
cfg=(); [[ "$mode" == per-document ]] && cfg=("$tmp/batch-off.sh")
|
|
118
|
+
out="$( cd "$tmp" && "$GATE" docs "${cfg[@]+"${cfg[@]}"}" 2>&1 )"; rc=$?
|
|
119
|
+
[[ "$rc" -eq 0 ]] \
|
|
120
|
+
|| { echo " FAIL: $mode path: faithful page expected exit 0, got $rc: $out"; fails=$((fails + 1)); }
|
|
121
|
+
done
|
|
122
|
+
|
|
123
|
+
# --- 5. count mismatch is fail-closed (exit 2), not a finding -----------------
|
|
124
|
+
# The stub emits exactly two documents whatever it is fed, so it PASSES the
|
|
125
|
+
# two-document probe and only the corpus count catches it — which is the point:
|
|
126
|
+
# a stub the probe already rejected would never reach the count assertion.
|
|
127
|
+
printf '%s\n' '# shellcheck shell=bash' \
|
|
128
|
+
'# comment-tier-exempt: fixture config — a batch renderer that always emits two documents' \
|
|
129
|
+
'# shellcheck disable=SC2034 # sourced by the gate under test' \
|
|
130
|
+
'SITE_KIT_RENDERER_BATCH=(bash -c '\''printf "<p>a</p>\000<p>b</p>\000"'\'')' > "$tmp/miscount.sh"
|
|
131
|
+
|
|
132
|
+
git -C "$tmp" add docs/p1.md docs/p2.md docs/p3.md
|
|
133
|
+
out="$( cd "$tmp" && "$GATE" docs "$tmp/miscount.sh" 2>&1 )"; rc=$?
|
|
134
|
+
[[ "$rc" -eq 2 ]] \
|
|
135
|
+
|| { echo " FAIL: batch count mismatch expected exit 2 (fail-closed), got $rc: $out"; fails=$((fails + 1)); }
|
|
136
|
+
grep -qF -- "document(s) for" <<<"$out" \
|
|
137
|
+
|| { echo " FAIL: count-mismatch refusal does not name the counts: $out"; fails=$((fails + 1)); }
|
|
138
|
+
|
|
139
|
+
# --- 6. an unresolvable batch renderer refuses, and does not fall back ---------
|
|
140
|
+
printf '%s\n' '# shellcheck shell=bash' \
|
|
141
|
+
'# comment-tier-exempt: fixture config — an unresolvable batch renderer must refuse, never downgrade' \
|
|
142
|
+
'# shellcheck disable=SC2034 # sourced by the gate under test' \
|
|
143
|
+
'SITE_KIT_RENDERER_BATCH=(site-kit-no-such-batch-renderer)' > "$tmp/unresolvable.sh"
|
|
144
|
+
|
|
145
|
+
out="$( cd "$tmp" && "$GATE" docs "$tmp/unresolvable.sh" 2>&1 )"; rc=$?
|
|
146
|
+
[[ "$rc" -eq 2 ]] \
|
|
147
|
+
|| { echo " FAIL: unresolvable batch renderer expected exit 2, got $rc: $out"; fails=$((fails + 1)); }
|
|
148
|
+
grep -qF -- "failed its probe" <<<"$out" \
|
|
149
|
+
|| { echo " FAIL: batch probe refusal does not name the probe: $out"; fails=$((fails + 1)); }
|
|
150
|
+
grep -qF -- "DOCS-RENDER-FIDELITY: clean" <<<"$out" \
|
|
151
|
+
&& { echo " FAIL: unresolvable batch renderer silently fell back to a clean verdict: $out"; fails=$((fails + 1)); }
|
|
152
|
+
|
|
153
|
+
if [[ "$fails" -gt 0 ]]; then
|
|
154
|
+
echo "check-docs-render-fidelity-batch.test: $fails assertion(s) failed"
|
|
155
|
+
exit 1
|
|
156
|
+
fi
|
|
157
|
+
echo "check-docs-render-fidelity-batch.test: ok (defaults agree byte-for-byte; a pinned renderer suppresses the batch default; both paths agree on verdicts; count mismatch and probe failure both exit 2)"
|
|
158
|
+
exit 0
|
|
@@ -25,5 +25,19 @@ unset _st_cfg
|
|
|
25
25
|
declare -p SITE_KIT_ALIASES &>/dev/null || SITE_KIT_ALIASES=()
|
|
26
26
|
declare -p SITE_KIT_EXEMPT_PATHS &>/dev/null \
|
|
27
27
|
|| SITE_KIT_EXEMPT_PATHS=("*/gate-tests/*" "*docs/posts/*")
|
|
28
|
-
declare -p SITE_KIT_RENDERER &>/dev/null
|
|
29
|
-
|
|
28
|
+
if declare -p SITE_KIT_RENDERER &>/dev/null; then
|
|
29
|
+
_st_renderer_overridden=1
|
|
30
|
+
else
|
|
31
|
+
_st_renderer_overridden=0
|
|
32
|
+
SITE_KIT_RENDERER=(ruby -e 'require "kramdown"; require "kramdown-parser-gfm"; STDOUT.write(Kramdown::Document.new(STDIN.read, input: "GFM").to_html)')
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# spec: site-kit/SPEC.md §lib/site.sh — the one conditional default: filling the batch knob for a consumer who pinned SITE_KIT_RENDERER would replace their pinned oracle with this unpinned one and report clean against a parser build they rejected
|
|
36
|
+
if ! declare -p SITE_KIT_RENDERER_BATCH &>/dev/null; then
|
|
37
|
+
if [[ "$_st_renderer_overridden" -eq 0 ]]; then
|
|
38
|
+
SITE_KIT_RENDERER_BATCH=(ruby -e 'require "kramdown"; require "kramdown-parser-gfm"; d = STDIN.read.split("\x00", -1); d.pop; d.each { |s| STDOUT.write(Kramdown::Document.new(s, input: "GFM").to_html); STDOUT.write("\x00") }')
|
|
39
|
+
else
|
|
40
|
+
SITE_KIT_RENDERER_BATCH=()
|
|
41
|
+
fi
|
|
42
|
+
fi
|
|
43
|
+
unset _st_renderer_overridden
|
|
@@ -8,6 +8,14 @@ SDK="$SMOKE_KIT_ROOT/../gate-sdk" # the vendored gate-sdk beside this kit
|
|
|
8
8
|
cat >> scripts/gates.list <<'EOF'
|
|
9
9
|
# site-kit
|
|
10
10
|
check-docs-cname-parity
|
|
11
|
+
# spec: gate-sdk/SPEC.md §Consumer smoke — gate-sdk gates registered by the kit whose
|
|
12
|
+
# install writes their subject: the site-health workflow copied in below is the only
|
|
13
|
+
# Actions-shaped surface any install writes, so these three lint installed content
|
|
14
|
+
# rather than passing vacuously.
|
|
15
|
+
check-action-pinning
|
|
16
|
+
check-action-run-shell
|
|
17
|
+
check-action-gh-repo
|
|
18
|
+
check-docs-render-fidelity
|
|
11
19
|
EOF
|
|
12
20
|
|
|
13
21
|
# spec: gate-sdk/SPEC.md §Consumer smoke — the gated source of truth for the
|
|
@@ -23,4 +31,4 @@ mkdir -p .github/workflows
|
|
|
23
31
|
cp "$SMOKE_KIT_ROOT/templates/site-health.yml" .github/workflows/site-health.yml
|
|
24
32
|
|
|
25
33
|
bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
|
|
26
|
-
bash "$SDK/checks/check-graph.sh" --emit >
|
|
34
|
+
bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
|