checkwright 0.26.0 → 0.28.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 +7 -7
- package/bin/checkwright.ps1 +59 -40
- package/bin/checkwright.sh +53 -53
- package/package.json +3 -3
- package/payload/artifact/aarch64-apple-darwin/checkwright-gates +0 -0
- package/payload/artifact/aarch64-apple-darwin/checkwright-gates.sha256 +1 -1
- package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe +0 -0
- package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -1
- package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
- package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates +0 -0
- package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates.sha256 +1 -0
- package/payload/artifact/targets.list +29 -16
- package/payload/artifact/x86_64-apple-darwin/checkwright-gates +0 -0
- package/payload/artifact/x86_64-apple-darwin/checkwright-gates.sha256 +1 -1
- package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe +0 -0
- package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -1
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
- package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates.sha256 +1 -0
- package/payload/canon-kit/README.md +3 -1
- package/payload/canon-kit/checks/check-citation-link.gate +4 -0
- package/payload/canon-kit/checks/check-comment-tier.gate +1 -1
- package/payload/canon-kit/checks/check-deprecation-task.gate +1 -1
- package/payload/canon-kit/checks/check-docs-page-repeat.gate +4 -0
- package/payload/canon-kit/checks/check-spec-pointer.gate +1 -1
- package/payload/canon-kit/checks/check-todo-task-liveness.gate +1 -1
- package/payload/canon-kit/gate-tests/check-citation-link/bad/expect.txt +6 -0
- package/payload/canon-kit/gate-tests/check-citation-link/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-citation-link/bad/site/page.md +13 -0
- package/payload/canon-kit/gate-tests/check-citation-link/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-citation-link/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-citation-link/good/site/page.md +28 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/.github/workflows/ci.yml +15 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/.github/workflows/ci.yml +23 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/config.yml +2 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -1
- package/payload/canon-kit/gate-tests/check-comment-tier/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/bad/site/page.md +8 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/good/site/page.md +24 -0
- package/payload/context-kit/README.md +2 -2
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/docs/footprint.md +2 -0
- package/payload/context-kit/templates/session-context.sh +1 -1
- package/payload/delegation-kit/README.md +6 -6
- package/payload/doctrine-kit/README.md +1 -1
- package/payload/drift-kit/README.md +9 -9
- package/payload/evidence-kit/README.md +8 -4
- package/payload/gate-sdk/README.md +4 -4
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/docs/enforcement.md +2 -2
- package/payload/gate-sdk/templates/gates-workflow.yml +6 -35
- package/payload/guard-kit/README.md +4 -4
- package/payload/guard-kit/gate-tests/scratch-run.test.sh +3 -2
- package/payload/lifecycle-kit/README.md +10 -8
- package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +6 -4
- package/payload/lifecycle-kit/gate-tests/capture-linked-worktree.test.sh +53 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +23 -20
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +11 -4
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -1
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +11 -4
- package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +25 -17
- package/payload/lifecycle-kit/gate-tests/stamp-before-write.test.sh +13 -2
- package/payload/lifecycle-kit/templates/lead.md +6 -2
- package/payload/lifecycle-kit/templates/stages/build.md +1 -1
- package/payload/lifecycle-kit/templates/stages/close.md +2 -2
- package/payload/lifecycle-kit/templates/stages/scope.md +1 -1
- package/payload/lifecycle-kit/templates/stages/spec.md +1 -1
- package/payload/queue-kit/README.md +13 -2
- package/payload/queue-kit/checks/check-queue-hygiene.gate +1 -1
- package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +6 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/queue-verbs.test.sh +183 -0
- package/payload/site-kit/README.md +5 -2
- package/payload/site-kit/checks/check-docs-collapsible.gate +3 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/bad/docs/regions.md +23 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/bad/expect.txt +4 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/good/docs/plain.md +3 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/good/docs/regions.md +26 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/good/expect.txt +1 -0
- package/payload/site-kit/templates/site-health.yml +10 -101
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: queue-kit/SPEC.md §The queue verbs — the verbs over a seeded history, the properties a crate
|
|
3
|
+
# unit test cannot reach because they are properties of a git history and of a spawned post-check:
|
|
4
|
+
# (1) `promote` and `icebox` build the history a later `demote` and `thaw` read back, restoring the
|
|
5
|
+
# position, the board tags and the body; (2) `--emit queue-history` prints the same history's rows,
|
|
6
|
+
# oldest first; (3) the exit contract — 1 on a planted post-check red with the move written, 2 on a
|
|
7
|
+
# refusal with the file byte-for-byte unchanged.
|
|
8
|
+
#
|
|
9
|
+
# Run by the --run-gate-tests arm (any <tests-dir>/*.test.sh; must exit 0).
|
|
10
|
+
set -uo pipefail
|
|
11
|
+
source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
|
|
12
|
+
|
|
13
|
+
SANDBOX="$(mktemp -d)"
|
|
14
|
+
trap 'rm -rf "$SANDBOX"' EXIT
|
|
15
|
+
|
|
16
|
+
fails=0
|
|
17
|
+
checks=0
|
|
18
|
+
note() { echo " FAIL [$1]: $2"; fails=$((fails + 1)); }
|
|
19
|
+
|
|
20
|
+
git -C "$SANDBOX" init -q
|
|
21
|
+
git -C "$SANDBOX" config user.email seed@example.invalid
|
|
22
|
+
git -C "$SANDBOX" config user.name Seed
|
|
23
|
+
|
|
24
|
+
# The post-check's registry: one stub gate coupled to the queue file, red while a marker exists.
|
|
25
|
+
mkdir -p "$SANDBOX/gates"
|
|
26
|
+
{
|
|
27
|
+
printf '#!/usr/bin/env bash\n'
|
|
28
|
+
printf '# graph: couples=TASK-QUEUE.md dir=one valve=none tier=precommit\n'
|
|
29
|
+
printf '[[ -e "%s/RED" ]] && { echo "g_queue: planted red"; exit 1; }\n' "$SANDBOX"
|
|
30
|
+
printf 'echo "G-QUEUE: clean"\n'
|
|
31
|
+
} >"$SANDBOX/gates/g_queue.sh"
|
|
32
|
+
chmod +x "$SANDBOX/gates/g_queue.sh"
|
|
33
|
+
echo g_queue >"$SANDBOX/gates/gates.list"
|
|
34
|
+
|
|
35
|
+
cat >"$SANDBOX/TASK-QUEUE.md" <<'EOF'
|
|
36
|
+
# TASK-QUEUE.md
|
|
37
|
+
|
|
38
|
+
## Iteration: seeded
|
|
39
|
+
|
|
40
|
+
## New Features
|
|
41
|
+
|
|
42
|
+
## Technical Debt
|
|
43
|
+
|
|
44
|
+
## Deferred
|
|
45
|
+
|
|
46
|
+
### def-a
|
|
47
|
+
|
|
48
|
+
[cost: event/low] [surface: gates]
|
|
49
|
+
|
|
50
|
+
the first entry.
|
|
51
|
+
|
|
52
|
+
### def-b
|
|
53
|
+
|
|
54
|
+
[cost: iteration/high] [surface: gates]
|
|
55
|
+
|
|
56
|
+
the promoted entry.
|
|
57
|
+
|
|
58
|
+
### def-c
|
|
59
|
+
|
|
60
|
+
[cost: once/low] [surface: gates]
|
|
61
|
+
|
|
62
|
+
the evicted entry, with a body the icebox drops.
|
|
63
|
+
|
|
64
|
+
a second paragraph.
|
|
65
|
+
|
|
66
|
+
### def-d
|
|
67
|
+
|
|
68
|
+
[cost: event/low] [surface: gates]
|
|
69
|
+
|
|
70
|
+
the last entry.
|
|
71
|
+
|
|
72
|
+
## Icebox
|
|
73
|
+
|
|
74
|
+
## Done
|
|
75
|
+
|
|
76
|
+
## Lessons Learned
|
|
77
|
+
EOF
|
|
78
|
+
|
|
79
|
+
commit() {
|
|
80
|
+
git -C "$SANDBOX" add TASK-QUEUE.md
|
|
81
|
+
GIT_AUTHOR_DATE="$2T12:00:00" GIT_COMMITTER_DATE="$2T12:00:00" git -C "$SANDBOX" commit -q -m "$1"
|
|
82
|
+
}
|
|
83
|
+
sha() { git -C "$SANDBOX" rev-parse --short=8 "$1"; }
|
|
84
|
+
|
|
85
|
+
verb() {
|
|
86
|
+
( cd "$SANDBOX" && gate_env GATE_SDK_GATES_DIR="$SANDBOX/gates" GATE_SDK_KIT_DIRS="$SANDBOX/gates" \
|
|
87
|
+
GATE_SDK_TMP_DIR="$SANDBOX/.tmp" QUEUE_KIT_ICEBOX_SECTION=Icebox && gate_arm_run --queue "$@" 2>&1 )
|
|
88
|
+
}
|
|
89
|
+
history() {
|
|
90
|
+
( cd "$SANDBOX" && gate_env QUEUE_KIT_ICEBOX_SECTION=Icebox && gate_arm_run --emit-queue-history "$@" 2>&1 )
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# --- the seeded history, built by the verbs themselves ----------------------------------
|
|
94
|
+
commit "file four entries" 2026-01-01
|
|
95
|
+
FILED="$(sha HEAD)"
|
|
96
|
+
|
|
97
|
+
checks=$((checks + 1))
|
|
98
|
+
out="$(verb promote def-b "New Features" --spec SPEC-b.md)"; rc=$?
|
|
99
|
+
[[ "$rc" -eq 0 ]] || note promote-exit "promote did not exit 0 under a green post-check (exit $rc): $out"
|
|
100
|
+
grep -qF 'promote def-b: Deferred -> New Features; dropped [cost: iteration/high] [surface: gates]; added [spec: SPEC-b.md]' <<<"$out" \
|
|
101
|
+
|| note promote-act "the act line is not the one the move made: $out"
|
|
102
|
+
grep -qF 'G-QUEUE: clean' <<<"$out" || grep -qF 'All 1 gates passed' <<<"$out" \
|
|
103
|
+
|| note promote-postcheck "the post-check's output is absent: $out"
|
|
104
|
+
commit "promote def-b" 2026-02-01
|
|
105
|
+
PROMOTED="$(sha HEAD)"
|
|
106
|
+
|
|
107
|
+
checks=$((checks + 1))
|
|
108
|
+
out="$(verb icebox def-c "dormant c.")"; rc=$?
|
|
109
|
+
[[ "$rc" -eq 0 ]] || note icebox-exit "icebox did not exit 0 (exit $rc): $out"
|
|
110
|
+
grep -qF 'a second paragraph.' "$SANDBOX/TASK-QUEUE.md" && note icebox-body "the evicted body is still in the file"
|
|
111
|
+
commit "evict def-c" 2026-03-01
|
|
112
|
+
EVICTED="$(sha HEAD)"
|
|
113
|
+
|
|
114
|
+
# --- queue-history prints the same history, oldest first ---------------------------------
|
|
115
|
+
checks=$((checks + 1))
|
|
116
|
+
h="$(history def-b)"; rc=$?
|
|
117
|
+
[[ "$rc" -eq 0 ]] || note history-exit "queue-history did not exit 0 (exit $rc): $h"
|
|
118
|
+
want="def-b
|
|
119
|
+
2026-01-01 $FILED (absent) -> Deferred file four entries
|
|
120
|
+
2026-02-01 $PROMOTED Deferred -> New Features promote def-b"
|
|
121
|
+
[[ "$h" == "$want" ]] || note history-rows "the rows are not the seeded history's:
|
|
122
|
+
$h"
|
|
123
|
+
checks=$((checks + 1))
|
|
124
|
+
h="$(history def-c)"
|
|
125
|
+
grep -qF " 2026-03-01 $EVICTED Deferred -> Icebox evict def-c" <<<"$h" \
|
|
126
|
+
|| note history-evict "the eviction row is absent: $h"
|
|
127
|
+
none="$(history no-such-slug)"; rc=$?
|
|
128
|
+
[[ "$rc" -eq 2 ]] || note history-refusal "a slug in no set exited $rc rather than 2: $none"
|
|
129
|
+
|
|
130
|
+
# --- demote restores the board tags and the place after its old predecessor ---------------
|
|
131
|
+
checks=$((checks + 1))
|
|
132
|
+
out="$(verb demote def-b)"; rc=$?
|
|
133
|
+
[[ "$rc" -eq 0 ]] || note demote-exit "demote did not exit 0 (exit $rc): $out"
|
|
134
|
+
grep -qF 'the first entry.
|
|
135
|
+
|
|
136
|
+
### def-b
|
|
137
|
+
|
|
138
|
+
[cost: iteration/high] [surface: gates]
|
|
139
|
+
|
|
140
|
+
the promoted entry.' "$SANDBOX/TASK-QUEUE.md" \
|
|
141
|
+
|| note demote-restore "def-b is not back after def-a with its board tags: $(cat "$SANDBOX/TASK-QUEUE.md")"
|
|
142
|
+
|
|
143
|
+
# --- thaw restores the whole body at its place and stamps the recurrence ------------------
|
|
144
|
+
checks=$((checks + 1))
|
|
145
|
+
out="$(verb thaw def-c --date 2026-04-01)"; rc=$?
|
|
146
|
+
[[ "$rc" -eq 0 ]] || note thaw-exit "thaw did not exit 0 (exit $rc): $out"
|
|
147
|
+
grep -qF 'the first entry.
|
|
148
|
+
|
|
149
|
+
### def-c
|
|
150
|
+
|
|
151
|
+
[cost: once/low] [surface: gates] [recurrence: 2026-04-01]
|
|
152
|
+
|
|
153
|
+
the evicted entry, with a body the icebox drops.
|
|
154
|
+
|
|
155
|
+
a second paragraph.' "$SANDBOX/TASK-QUEUE.md" \
|
|
156
|
+
|| note thaw-restore "def-c's body is not restored after def-a: $(cat "$SANDBOX/TASK-QUEUE.md")"
|
|
157
|
+
grep -qF 'dormant c.' "$SANDBOX/TASK-QUEUE.md" && note thaw-sentence "the icebox sentence survived the thaw"
|
|
158
|
+
|
|
159
|
+
# --- the exit contract: 1 written under a planted red, 2 with the file unchanged ----------
|
|
160
|
+
checks=$((checks + 1))
|
|
161
|
+
touch "$SANDBOX/RED"
|
|
162
|
+
cp "$SANDBOX/TASK-QUEUE.md" "$SANDBOX/before.md"
|
|
163
|
+
out="$(verb recur def-d 2026-05-01)"; rc=$?
|
|
164
|
+
[[ "$rc" -eq 1 ]] || note red-exit "a planted post-check red exited $rc rather than 1: $out"
|
|
165
|
+
grep -qF 'g_queue: planted red' <<<"$out" || note red-findings "the post-check's findings are not printed: $out"
|
|
166
|
+
cmp -s "$SANDBOX/before.md" "$SANDBOX/TASK-QUEUE.md" && note red-written "the move was not written under the red post-check"
|
|
167
|
+
rm -f "$SANDBOX/RED"
|
|
168
|
+
|
|
169
|
+
checks=$((checks + 1))
|
|
170
|
+
cp "$SANDBOX/TASK-QUEUE.md" "$SANDBOX/before.md"
|
|
171
|
+
for refusal in "promote no-such-slug New Features" "recur def-d 2026-04-30" "icebox def-a" "done"; do
|
|
172
|
+
# shellcheck disable=SC2086 # each refusal is a word list on purpose
|
|
173
|
+
out="$(verb $refusal)"; rc=$?
|
|
174
|
+
[[ "$rc" -eq 2 ]] || note refusal-exit "'$refusal' exited $rc rather than 2: $out"
|
|
175
|
+
cmp -s "$SANDBOX/before.md" "$SANDBOX/TASK-QUEUE.md" || note refusal-unchanged "'$refusal' changed the file"
|
|
176
|
+
done
|
|
177
|
+
|
|
178
|
+
if [[ "$fails" -gt 0 ]]; then
|
|
179
|
+
echo "queue-verbs.test.sh: $fails case(s) failed"
|
|
180
|
+
exit 1
|
|
181
|
+
fi
|
|
182
|
+
echo "queue-verbs.test.sh: clean (promote and icebox build a history that demote and thaw read back — position, board tags and body restored — queue-history prints its rows oldest first and refuses a slug in no set, a planted post-check red exits 1 with the move written, and a refusal exits 2 with the file unchanged; $checks checks)"
|
|
183
|
+
exit 0
|
|
@@ -8,11 +8,13 @@ Deployment-truth governance for a docs site served from the repo (GitHub Pages a
|
|
|
8
8
|
|
|
9
9
|
`check-docs-liquid-parse` parses every docs file the Pages build runs Liquid over — the markdown pages, any file carrying front matter, and the layout, include and post templates — through the Liquid parser Pages runs, so one unbalanced `{{` or unclosed tag reds in the tree instead of failing the site's build and freezing the deployment. It fails closed when the parser is absent or cannot detect an error.
|
|
10
10
|
|
|
11
|
+
`check-docs-collapsible` holds every `<details>` region on a docs page to the form the Pages parser renders: `markdown="1"` on the opening tag, a `<summary>` naming what opens, no heading inside and a closing tag. It reads source only, so it needs no renderer.
|
|
12
|
+
|
|
11
13
|
`check-docs-highlight-coverage` holds a layout that restyles code highlighting to the theme it restyles: every token class a tracked snapshot says the theme colours must have an override rule, or it keeps the theme's colour — black on a dark code background, for one. It is disarmed until `SITE_KIT_HIGHLIGHT_TOKENS` names the snapshot.
|
|
12
14
|
|
|
13
15
|
The template — `templates/site-health.yml` — is a scheduled probe of the live site (apex/www/http HTTPS, redirects, certificate expiry, release-body note pointers, and theme highlight-class drift against that snapshot). It verifies a *deployment*, not a tree, so it ships as a workflow a consumer copies, never a gate: the line is where the asserted object lives, and none of what it asserts is in any checkout. See [SPEC.md](https://checkwright.dev/site-kit/SPEC#the-monitor-boundary) for why that boundary is load-bearing.
|
|
14
16
|
|
|
15
|
-
This file ships in the installer payload; what that payload withholds, and where this page's `SPEC.md` links then resolve, is gate-sdk/SPEC.md §Consumer payload.
|
|
17
|
+
This file ships in the installer payload; what that payload withholds, and where this page's `SPEC.md` links then resolve, is [gate-sdk/SPEC.md §Consumer payload](https://github.com/checkwright/checkwright/blob/master/gate-sdk/SPEC.md#consumer-payload).
|
|
16
18
|
|
|
17
19
|
## Install
|
|
18
20
|
|
|
@@ -25,6 +27,7 @@ Vendor the kit beside [gate-sdk](../gate-sdk/) (required), then:
|
|
|
25
27
|
check-docs-cname-parity
|
|
26
28
|
check-docs-highlight-coverage
|
|
27
29
|
check-docs-render-fidelity
|
|
30
|
+
check-docs-collapsible
|
|
28
31
|
check-docs-liquid-parse
|
|
29
32
|
```
|
|
30
33
|
<!-- gate-roster:end -->
|
|
@@ -37,7 +40,7 @@ Vendor the kit beside [gate-sdk](../gate-sdk/) (required), then:
|
|
|
37
40
|
|
|
38
41
|
4. Optional highlight coverage — if your layout restyles code highlighting, track a snapshot of the classes your theme's stylesheet colours (one `.<class>` per line under a `# contract:` header) and set `SITE_KIT_HIGHLIGHT_TOKENS` to it in `site-config.knobs`. The monitor's theme-drift arm prints the list to paste.
|
|
39
42
|
|
|
40
|
-
5. Optional live monitor — copy `templates/site-health.yml` verbatim into `.github/workflows/`, then set three groups of step env or delete the arm each belongs to: `ALT_DOMAIN` (drop the alternate-host probe if you serve no redirect alias), `RELEASE_NOTE_GLOB` / `RELEASE_NOTE_TAG_KEY` / `RELEASE_NOTE_URL_PATH` (drop the release-body arm if you publish no release notes), and `HIGHLIGHT_CSS_PATH` / `HIGHLIGHT_TOKENS_FILE` (the theme-drift arm, skipped while both are empty). It opens/updates/closes a `site-health` issue on its own schedule. The release-body arm needs the template's `contents: read` permission — it is an allowlist, not an addition — and `RELEASE_NOTE_URL_PATH` is the value worth checking twice: site-kit/SPEC.md §templates/site-health.yml names the trap.
|
|
43
|
+
5. Optional live monitor — copy `templates/site-health.yml` verbatim into `.github/workflows/`, then set three groups of step env or delete the arm each belongs to: `ALT_DOMAIN` (drop the alternate-host probe if you serve no redirect alias), `RELEASE_NOTE_GLOB` / `RELEASE_NOTE_TAG_KEY` / `RELEASE_NOTE_URL_PATH` (drop the release-body arm if you publish no release notes), and `HIGHLIGHT_CSS_PATH` / `HIGHLIGHT_TOKENS_FILE` (the theme-drift arm, skipped while both are empty). It opens/updates/closes a `site-health` issue on its own schedule. The release-body arm needs the template's `contents: read` permission — it is an allowlist, not an addition — and `RELEASE_NOTE_URL_PATH` is the value worth checking twice: [site-kit/SPEC.md §templates/site-health.yml](https://checkwright.dev/site-kit/SPEC#templatessite-healthyml) names the trap.
|
|
41
44
|
|
|
42
45
|
## Test
|
|
43
46
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# graph: couples=knob:SITE_KIT_DOCS_DIR/*.md,knob:SITE_KIT_DOCS_DIR/*/index.md,knob:SITE_KIT_DOCS_DIR/posts/*.md dir=one valve=none tier=precommit
|
|
2
|
+
# install: on-surface
|
|
3
|
+
# spec: site-kit/SPEC.md §check-docs-collapsible — every collapsible region on a tracked docs page opens with markdown="1", names what it holds in a <summary>, hides no heading and closes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Regions that break the form
|
|
2
|
+
|
|
3
|
+
<details>
|
|
4
|
+
<summary>Raw body</summary>
|
|
5
|
+
|
|
6
|
+
Its **markdown** prints raw.
|
|
7
|
+
</details>
|
|
8
|
+
|
|
9
|
+
<details markdown="1">
|
|
10
|
+
|
|
11
|
+
A region with no summary.
|
|
12
|
+
</details>
|
|
13
|
+
|
|
14
|
+
<details markdown="1">
|
|
15
|
+
<summary>A hidden section</summary>
|
|
16
|
+
|
|
17
|
+
## Hidden heading
|
|
18
|
+
</details>
|
|
19
|
+
|
|
20
|
+
<details markdown="1">
|
|
21
|
+
<summary>Never closed</summary>
|
|
22
|
+
|
|
23
|
+
The page ends inside it.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Regions in the form
|
|
2
|
+
|
|
3
|
+
Run the one-line install first.
|
|
4
|
+
|
|
5
|
+
<details markdown="1">
|
|
6
|
+
<summary>Step by step</summary>
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
# a comment line, not a heading
|
|
10
|
+
echo step
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
| Step | Command |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| one | `echo one` |
|
|
16
|
+
|
|
17
|
+
<details markdown="1">
|
|
18
|
+
<summary>A nested region</summary>
|
|
19
|
+
|
|
20
|
+
Its own body.
|
|
21
|
+
</details>
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<details>
|
|
26
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DOCS-COLLAPSIBLE: clean (2 tracked markdown page(s) under docs, 2 collapsible region(s)
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
# deployment, not a tree, so it reds on causes no commit produced (DNS, a Pages
|
|
3
|
-
# incident, a stalled cert renewal), breaking both the low-false-positive gate
|
|
4
|
-
# contract and the CI backstop's checkout+bash hermeticity — see
|
|
5
|
-
# gate-sdk/SPEC.md §Enforcement tiers. It therefore lives beside your gates
|
|
6
|
-
# workflow, never inside it: a failed probe opens (or updates, never duplicates)
|
|
7
|
-
# a site-health issue and reds this run, never a merge. Recovery self-clears (a
|
|
8
|
-
# green run closes the open issue). No README badge, by the standing ruling.
|
|
9
|
-
#
|
|
10
|
-
# Copy verbatim into .github/workflows/, then set three groups of env below or
|
|
11
|
-
# delete the arm each belongs to: ALT_DOMAIN (drop probe #4 if you serve no
|
|
12
|
-
# redirect alias), the three RELEASE_NOTE_* knobs (drop probe #6 if you
|
|
13
|
-
# publish no release notes), and the two HIGHLIGHT_* knobs (probe #7, skipped
|
|
14
|
-
# while both are empty). The apex host is read from the CNAME file — no
|
|
15
|
-
# second place to keep it.
|
|
1
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — copy verbatim; set each arm's env or delete the arm
|
|
16
2
|
# enforce: class=monitor live docs-site deployment — apex/www/http HTTPS, redirects, cert expiry, release-body note pointers, and theme highlight-class drift against the tracked snapshot
|
|
17
3
|
name: site-health
|
|
18
4
|
|
|
@@ -26,10 +12,7 @@ on:
|
|
|
26
12
|
type: boolean
|
|
27
13
|
default: false
|
|
28
14
|
|
|
29
|
-
#
|
|
30
|
-
# none. issues:write carries the open/update/close path; contents:read is what
|
|
31
|
-
# lets the probe read the tag list and the Release bodies. Without it those reads
|
|
32
|
-
# 404, which reads like "no such Release" rather than "not permitted".
|
|
15
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — the permissions block is an allowlist
|
|
33
16
|
permissions:
|
|
34
17
|
issues: write
|
|
35
18
|
contents: read
|
|
@@ -38,41 +21,24 @@ jobs:
|
|
|
38
21
|
probe:
|
|
39
22
|
runs-on: ubuntu-latest
|
|
40
23
|
steps:
|
|
41
|
-
# The CNAME file is the single source of truth for the apex host; reading
|
|
42
|
-
# it here gives the monitor a cutover for free.
|
|
43
24
|
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
44
25
|
|
|
45
26
|
- name: probe live site
|
|
46
27
|
id: probe
|
|
47
28
|
env:
|
|
48
|
-
#
|
|
49
|
-
# literal (a docs-cname-parity gate bars the alias in ://url form);
|
|
50
|
-
# the probe builds the URL from this at run time. Set to your redirect
|
|
51
|
-
# alias, or delete this env and probe #4 below if you have none.
|
|
29
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — your redirect alias, or delete it with its arm
|
|
52
30
|
ALT_DOMAIN: alt.example.com
|
|
53
|
-
#
|
|
54
|
-
# with probe #6 below. Step-level workflow env, not the kit's SITE_KIT_*
|
|
55
|
-
# knobs: this file is copied and edited, never sourced, so it must not
|
|
56
|
-
# reach into a vendored gates dir. The host is deliberately absent —
|
|
57
|
-
# the CNAME file stays its single source, so a rename is one edit.
|
|
31
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — set all three, or delete them with the release-body arm
|
|
58
32
|
RELEASE_NOTE_GLOB: 'docs/posts/*.md'
|
|
59
33
|
RELEASE_NOTE_TAG_KEY: 'release'
|
|
60
|
-
#
|
|
61
|
-
# form your host actually serves — a generator that emits
|
|
62
|
-
# /posts/<slug>.html often serves the extensionless form too, and the
|
|
63
|
-
# value must match what your release bodies are written to carry.
|
|
34
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — path only; {slug} is the note filename minus extension
|
|
64
35
|
RELEASE_NOTE_URL_PATH: '/posts/{slug}'
|
|
65
|
-
#
|
|
66
|
-
# probe #7 below; left empty, the arm is skipped. The site path of the
|
|
67
|
-
# theme stylesheet, and the tracked snapshot file your
|
|
68
|
-
# SITE_KIT_HIGHLIGHT_TOKENS knob names (the same file).
|
|
36
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — set both, or delete them with the theme-drift arm
|
|
69
37
|
HIGHLIGHT_CSS_PATH: ''
|
|
70
38
|
HIGHLIGHT_TOKENS_FILE: ''
|
|
71
39
|
FORCE_FAIL: ${{ inputs.force_fail }}
|
|
72
40
|
GH_TOKEN: ${{ github.token }}
|
|
73
41
|
run: |
|
|
74
|
-
# A probe expects individual checks to fail; -e would abort the battery
|
|
75
|
-
# on the first red, so disable it and collect failures explicitly.
|
|
76
42
|
set +e
|
|
77
43
|
set -uo pipefail
|
|
78
44
|
|
|
@@ -85,36 +51,28 @@ jobs:
|
|
|
85
51
|
|
|
86
52
|
failures=()
|
|
87
53
|
|
|
88
|
-
# 1. apex answers 200 over HTTPS; curl validates the cert at handshake,
|
|
89
|
-
# so a TLS fault also reds here.
|
|
90
54
|
code="$(curl -sS -m 20 -o /dev/null -w '%{http_code}' "https://$apex/")"
|
|
91
55
|
[ "$code" = 200 ] || failures+=("apex https did not answer 200 (got '$code')")
|
|
92
56
|
|
|
93
|
-
# 2. www 301s to the apex.
|
|
94
57
|
read -r code loc < <(curl -sS -m 20 -o /dev/null -w '%{http_code} %{redirect_url}' "https://www.$apex/") || true
|
|
95
58
|
case "${code}::${loc}" in
|
|
96
59
|
301::*"//$apex/"*) ;;
|
|
97
60
|
*) failures+=("www did not 301 to apex (got '$code' -> '$loc')") ;;
|
|
98
61
|
esac
|
|
99
62
|
|
|
100
|
-
# 3. http:// 301s to https:// — proves Enforce-HTTPS has not silently flipped.
|
|
101
63
|
read -r code loc < <(curl -sS -m 20 -o /dev/null -w '%{http_code} %{redirect_url}' "http://$apex/") || true
|
|
102
64
|
case "${code}::${loc}" in
|
|
103
65
|
301::https://*) ;;
|
|
104
66
|
*) failures+=("http did not 301 to https (got '$code' -> '$loc')") ;;
|
|
105
67
|
esac
|
|
106
68
|
|
|
107
|
-
#
|
|
108
|
-
# block along with ALT_DOMAIN above if you serve no redirect alias.
|
|
69
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — the ALT_DOMAIN arm; delete it with its env if unused
|
|
109
70
|
read -r code loc < <(curl -sS -m 20 -o /dev/null -w '%{http_code} %{redirect_url}' "https://$ALT_DOMAIN/install.html") || true
|
|
110
71
|
case "${code}::${loc}" in
|
|
111
72
|
301::*"//$apex/install.html"*) ;;
|
|
112
73
|
*) failures+=("$ALT_DOMAIN did not 301 to apex keeping path (got '$code' -> '$loc')") ;;
|
|
113
74
|
esac
|
|
114
75
|
|
|
115
|
-
# 5. certificate expiry >= 14 days — the real payload. Pages renews ~30d
|
|
116
|
-
# out, so inside 14 days means renewal has silently stalled. curl -v
|
|
117
|
-
# prints the handshake's "expire date:", keeping this curl-only.
|
|
118
76
|
expire="$(curl -sSv -m 20 "https://$apex/" 2>&1 >/dev/null | sed -n 's/^\* *expire date: //p' | head -1)"
|
|
119
77
|
if [ -z "$expire" ]; then
|
|
120
78
|
failures+=("could not read certificate expiry for $apex")
|
|
@@ -128,14 +86,7 @@ jobs:
|
|
|
128
86
|
fi
|
|
129
87
|
fi
|
|
130
88
|
|
|
131
|
-
#
|
|
132
|
-
# whose body points at that note, and every apex URL that body
|
|
133
|
-
# carries resolves. The two assertions run over two different
|
|
134
|
-
# strings — presence over the URL derived here, resolution over the
|
|
135
|
-
# URLs the body actually carries — and collapsing them re-opens the
|
|
136
|
-
# defects this arm exists for (site-kit/SPEC.md §templates/site-health.yml).
|
|
137
|
-
# Delete this whole block along with the RELEASE_NOTE_* env above if
|
|
138
|
-
# you publish no release notes.
|
|
89
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — the release-body arm; delete it with its env if unused
|
|
139
90
|
notes=()
|
|
140
91
|
shopt -s nullglob
|
|
141
92
|
for f in $RELEASE_NOTE_GLOB; do
|
|
@@ -146,19 +97,11 @@ jobs:
|
|
|
146
97
|
failures+=("release-note glob matched nothing: '$RELEASE_NOTE_GLOB' — set the RELEASE_NOTE_* env above, or delete this arm")
|
|
147
98
|
fi
|
|
148
99
|
|
|
149
|
-
#
|
|
150
|
-
# tags at depth 1, so a git-driven arm finds zero released notes and
|
|
151
|
-
# reads green forever. --paginate concatenates the pages' arrays, so
|
|
152
|
-
# count by streaming the names — --jq 'length' returns the last page's
|
|
153
|
-
# count, which understates exactly once pagination starts to matter.
|
|
100
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — the tag list comes from the API, paginated
|
|
154
101
|
tag_err="$(mktemp)"
|
|
155
102
|
tags="$(gh api --paginate 'repos/{owner}/{repo}/tags' --jq '.[].name' 2>"$tag_err")"
|
|
156
103
|
tag_rc=$?
|
|
157
104
|
if [ "$tag_rc" -ne 0 ]; then
|
|
158
|
-
# Asserted on the call's own exit status, never inferred from the
|
|
159
|
-
# count below: this step runs under `set +e`, so a failed call yields
|
|
160
|
-
# an empty tag list and a zero exit, every note then reads "not yet
|
|
161
|
-
# released", and the arm reports a clean run forever.
|
|
162
105
|
failures+=("could not read the tag list (gh exit $tag_rc): $(tr '\n' ' ' < "$tag_err")")
|
|
163
106
|
tags=""
|
|
164
107
|
fi
|
|
@@ -168,21 +111,13 @@ jobs:
|
|
|
168
111
|
n_found="${#notes[@]}"; n_keyed=0; n_released=0; n_checked=0
|
|
169
112
|
for f in "${notes[@]:-}"; do
|
|
170
113
|
[ -n "$f" ] || continue
|
|
171
|
-
# Anchored inside the opening front-matter fence. A bare ^key: match
|
|
172
|
-
# also hits the body.
|
|
173
114
|
tag="$(awk -v key="$RELEASE_NOTE_TAG_KEY" '
|
|
174
115
|
/^---[[:space:]]*$/ { fm++; next }
|
|
175
116
|
fm == 1 && index($0, key ":") == 1 {
|
|
176
117
|
v = substr($0, length(key) + 2); sub(/^[[:space:]]+/, "", v); print v; exit
|
|
177
118
|
}' "$f")"
|
|
178
|
-
# A post carrying no tag key is not a release note. Silent by ruling:
|
|
179
|
-
# the census line below is how that case stays readable.
|
|
180
119
|
[ -n "$tag" ] || continue
|
|
181
120
|
n_keyed=$(( n_keyed + 1 ))
|
|
182
|
-
# A note whose tag is not on the remote is a legitimate skip — its
|
|
183
|
-
# release is deferred. This is why the tag list is not replaceable by
|
|
184
|
-
# the per-tag lookup below: a 404 there cannot tell that apart from a
|
|
185
|
-
# tag whose Release is genuinely missing.
|
|
186
121
|
grep -Fxq -- "$tag" <<<"$tags" || continue
|
|
187
122
|
n_released=$(( n_released + 1 ))
|
|
188
123
|
|
|
@@ -200,23 +135,11 @@ jobs:
|
|
|
200
135
|
rm -f "$rel_err"
|
|
201
136
|
n_checked=$(( n_checked + 1 ))
|
|
202
137
|
|
|
203
|
-
# Presence: containment, never equality — an older body may write a
|
|
204
|
-
# suffixed variant of its URL. Scheme-qualified, because a markdown
|
|
205
|
-
# link's visible label often repeats the URL scheme-less and would
|
|
206
|
-
# satisfy a scheme-less match while the link target went unchecked.
|
|
207
138
|
case "$body" in
|
|
208
139
|
*"$want"*) ;;
|
|
209
140
|
*) failures+=("$tag: Release body does not carry the note URL $want") ;;
|
|
210
141
|
esac
|
|
211
142
|
|
|
212
|
-
# Resolution: every apex URL as literally written in the body — this
|
|
213
|
-
# is what catches a trailing-slash URL that presence's containment
|
|
214
|
-
# lets through. Scheme-anchored so a label is never mistaken for a
|
|
215
|
-
# target. The trailing punctuation that occurs in practice is
|
|
216
|
-
# markdown-structural, `)` closing a link target and `)**` closing
|
|
217
|
-
# one inside bold, so the set covers `)` and `*` and strips a run.
|
|
218
|
-
# Deliberately not filtered to note URLs: a body's other apex links
|
|
219
|
-
# are covered too.
|
|
220
143
|
while read -r u; do
|
|
221
144
|
[ -n "$u" ] || continue
|
|
222
145
|
case "$u" in
|
|
@@ -228,16 +151,9 @@ jobs:
|
|
|
228
151
|
done < <(grep -oE 'https?://[^[:space:]<>"]+' <<<"$body" | sed -E 's/[).,;:!?*]+$//' | sort -u)
|
|
229
152
|
done
|
|
230
153
|
|
|
231
|
-
# Which zero-case a reader is in. A diagnostic, not an assertion — the
|
|
232
|
-
# rulings above are what make a vacuous pass impossible.
|
|
233
154
|
echo "release-body: $n_found note(s) found, $n_keyed keyed '$RELEASE_NOTE_TAG_KEY:', $n_released released of $n_tags remote tag(s), $n_checked checked"
|
|
234
155
|
|
|
235
|
-
#
|
|
236
|
-
# match the tracked snapshot check-docs-highlight-coverage reads, in
|
|
237
|
-
# both directions. On a finding, paste the printed list into the
|
|
238
|
-
# snapshot below its header, then add the overrides that gate reds
|
|
239
|
-
# on. Delete this block along with the HIGHLIGHT_* env above if you
|
|
240
|
-
# do not restyle code highlighting.
|
|
156
|
+
# spec: site-kit/SPEC.md §templates/site-health.yml — the theme-drift arm; delete it with its env if unused
|
|
241
157
|
if [ -z "${HIGHLIGHT_CSS_PATH:-}${HIGHLIGHT_TOKENS_FILE:-}" ]; then
|
|
242
158
|
echo "theme-drift: skipped (HIGHLIGHT_CSS_PATH and HIGHLIGHT_TOKENS_FILE unset)"
|
|
243
159
|
elif [ -z "${HIGHLIGHT_CSS_PATH:-}" ] || [ -z "${HIGHLIGHT_TOKENS_FILE:-}" ]; then
|
|
@@ -252,9 +168,6 @@ jobs:
|
|
|
252
168
|
if [ "$css_rc" -ne 0 ]; then
|
|
253
169
|
failures+=("theme-drift: could not fetch https://$apex$HIGHLIGHT_CSS_PATH (curl exit $css_rc): $(tr '\n' ' ' < "$css_err")")
|
|
254
170
|
else
|
|
255
|
-
# The extraction rule: rules split at }, kept when the declaration
|
|
256
|
-
# block sets color, background or background-color; each selector
|
|
257
|
-
# list split on , and kept when exactly .highlight .<class>.
|
|
258
171
|
extracted="$(tr '\n' ' ' < "$css" | sed -E 's#/\*([^*]|\*+[^*/])*\*+/##g' | awk '
|
|
259
172
|
BEGIN { RS = "}" }
|
|
260
173
|
{
|
|
@@ -288,8 +201,6 @@ jobs:
|
|
|
288
201
|
rm -f "$css" "$css_err"
|
|
289
202
|
fi
|
|
290
203
|
|
|
291
|
-
# DoD hook: a workflow_dispatch with force_fail=true exercises the issue
|
|
292
|
-
# path on demand without waiting for a real outage.
|
|
293
204
|
if [ "$FORCE_FAIL" = true ]; then
|
|
294
205
|
failures+=("synthetic failure (force_fail dispatch input)")
|
|
295
206
|
fi
|
|
@@ -317,7 +228,6 @@ jobs:
|
|
|
317
228
|
run: |
|
|
318
229
|
set -euo pipefail
|
|
319
230
|
label=site-health
|
|
320
|
-
# Idempotent: creates the label on first use, no-ops once it exists.
|
|
321
231
|
gh label create "$label" --color b60205 \
|
|
322
232
|
--description "Live-site monitoring probe failure" 2>/dev/null || true
|
|
323
233
|
|
|
@@ -336,7 +246,6 @@ jobs:
|
|
|
336
246
|
gh issue create --label "$label" \
|
|
337
247
|
--title "Site health: live-site probe failed" --body "$body"
|
|
338
248
|
fi
|
|
339
|
-
# Red this run as the operator's second signal (reds no merge).
|
|
340
249
|
exit 1
|
|
341
250
|
fi
|
|
342
251
|
|