checkwright 0.19.0 → 0.21.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/package.json +2 -2
- package/payload/canon-kit/SPEC.md +2 -2
- package/payload/canon-kit/checks/check-md-refs.sh +22 -9
- package/payload/canon-kit/checks/check-spec-pointer.sh +6 -2
- package/payload/context-kit/SPEC.md +13 -6
- package/payload/context-kit/lib/toolfloor.sh +1 -1
- package/payload/delegation-kit/README.md +2 -1
- package/payload/delegation-kit/SPEC.md +207 -35
- package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +61 -0
- 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 +2 -0
- package/payload/delegation-kit/smoke/install.sh +1 -0
- package/payload/delegation-kit/templates/agent-execution.md +74 -9
- package/payload/gate-sdk/SPEC.md +6 -5
- package/payload/gate-sdk/bin/gen-pre-commit.sh +1 -1
- package/payload/gate-sdk/bin/run-gates.sh +1 -1
- package/payload/gate-sdk/checks/check-graph.sh +3 -3
- package/payload/gate-sdk/checks/check-reads-couples.sh +3 -1
- package/payload/gate-sdk/checks/check-tree-terms.sh +11 -7
- package/payload/gate-sdk/lib/gate.sh +29 -13
- package/payload/lifecycle-kit/SPEC.md +14 -4
- package/payload/lifecycle-kit/templates/lead.md +38 -3
- package/payload/site-kit/README.md +12 -5
- package/payload/site-kit/SPEC.md +284 -28
- 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/templates/site-health.yml +128 -6
|
@@ -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
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
# a site-health issue and reds this run, never a merge. Recovery self-clears (a
|
|
8
8
|
# green run closes the open issue). No README badge, by the standing ruling.
|
|
9
9
|
#
|
|
10
|
-
# Copy verbatim into .github/workflows
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
10
|
+
# Copy verbatim into .github/workflows/, then set two groups of env below or
|
|
11
|
+
# delete the arm each belongs to: ALT_DOMAIN (drop probe #4 if you serve no
|
|
12
|
+
# redirect alias), and the three RELEASE_NOTE_* knobs (drop probe #6 if you
|
|
13
|
+
# publish no release notes). The apex host is read from the CNAME file — no
|
|
14
|
+
# second place to keep it.
|
|
15
|
+
# enforce: class=monitor live docs-site deployment — apex/www/http HTTPS, redirects, cert expiry, and release-body note pointers
|
|
14
16
|
name: site-health
|
|
15
17
|
|
|
16
18
|
on:
|
|
@@ -23,10 +25,13 @@ on:
|
|
|
23
25
|
type: boolean
|
|
24
26
|
default: false
|
|
25
27
|
|
|
26
|
-
#
|
|
27
|
-
# open/update/close path
|
|
28
|
+
# A permissions: block is an allowlist, not an addition — every scope it omits is
|
|
29
|
+
# none. issues:write carries the open/update/close path; contents:read is what
|
|
30
|
+
# lets the probe read the tag list and the Release bodies. Without it those reads
|
|
31
|
+
# 404, which reads like "no such Release" rather than "not permitted".
|
|
28
32
|
permissions:
|
|
29
33
|
issues: write
|
|
34
|
+
contents: read
|
|
30
35
|
|
|
31
36
|
jobs:
|
|
32
37
|
probe:
|
|
@@ -44,7 +49,20 @@ jobs:
|
|
|
44
49
|
# the probe builds the URL from this at run time. Set to your redirect
|
|
45
50
|
# alias, or delete this env and probe #4 below if you have none.
|
|
46
51
|
ALT_DOMAIN: alt.example.com
|
|
52
|
+
# Release-note pointer arm (#6) — set all three, or delete them along
|
|
53
|
+
# with probe #6 below. Step-level workflow env, not the kit's SITE_KIT_*
|
|
54
|
+
# knobs: this file is copied and edited, never sourced, so it must not
|
|
55
|
+
# reach into a vendored gates dir. The host is deliberately absent —
|
|
56
|
+
# the CNAME file stays its single source, so a rename is one edit.
|
|
57
|
+
RELEASE_NOTE_GLOB: 'docs/posts/*.md'
|
|
58
|
+
RELEASE_NOTE_TAG_KEY: 'release'
|
|
59
|
+
# Path only; {slug} is the note filename minus its extension. Check the
|
|
60
|
+
# form your host actually serves — a generator that emits
|
|
61
|
+
# /posts/<slug>.html often serves the extensionless form too, and the
|
|
62
|
+
# value must match what your release bodies are written to carry.
|
|
63
|
+
RELEASE_NOTE_URL_PATH: '/posts/{slug}'
|
|
47
64
|
FORCE_FAIL: ${{ inputs.force_fail }}
|
|
65
|
+
GH_TOKEN: ${{ github.token }}
|
|
48
66
|
run: |
|
|
49
67
|
# A probe expects individual checks to fail; -e would abort the battery
|
|
50
68
|
# on the first red, so disable it and collect failures explicitly.
|
|
@@ -103,6 +121,110 @@ jobs:
|
|
|
103
121
|
fi
|
|
104
122
|
fi
|
|
105
123
|
|
|
124
|
+
# 6. every tracked release note naming an existing tag has a Release
|
|
125
|
+
# whose body points at that note, and every apex URL that body
|
|
126
|
+
# carries resolves. The two assertions run over two different
|
|
127
|
+
# strings — presence over the URL derived here, resolution over the
|
|
128
|
+
# URLs the body actually carries — and collapsing them re-opens the
|
|
129
|
+
# defects this arm exists for (site-kit/SPEC.md §templates/site-health.yml).
|
|
130
|
+
# Delete this whole block along with the RELEASE_NOTE_* env above if
|
|
131
|
+
# you publish no release notes.
|
|
132
|
+
notes=()
|
|
133
|
+
shopt -s nullglob
|
|
134
|
+
for f in $RELEASE_NOTE_GLOB; do
|
|
135
|
+
notes+=("$f")
|
|
136
|
+
done
|
|
137
|
+
shopt -u nullglob
|
|
138
|
+
if [ "${#notes[@]}" -eq 0 ]; then
|
|
139
|
+
failures+=("release-note glob matched nothing: '$RELEASE_NOTE_GLOB' — set the RELEASE_NOTE_* env above, or delete this arm")
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
# The tag list comes from the API, never `git tag`: checkout fetches no
|
|
143
|
+
# tags at depth 1, so a git-driven arm finds zero released notes and
|
|
144
|
+
# reads green forever. --paginate concatenates the pages' arrays, so
|
|
145
|
+
# count by streaming the names — --jq 'length' returns the last page's
|
|
146
|
+
# count, which understates exactly once pagination starts to matter.
|
|
147
|
+
tag_err="$(mktemp)"
|
|
148
|
+
tags="$(gh api --paginate 'repos/{owner}/{repo}/tags' --jq '.[].name' 2>"$tag_err")"
|
|
149
|
+
tag_rc=$?
|
|
150
|
+
if [ "$tag_rc" -ne 0 ]; then
|
|
151
|
+
# Asserted on the call's own exit status, never inferred from the
|
|
152
|
+
# count below: this step runs under `set +e`, so a failed call yields
|
|
153
|
+
# an empty tag list and a zero exit, every note then reads "not yet
|
|
154
|
+
# released", and the arm reports a clean run forever.
|
|
155
|
+
failures+=("could not read the tag list (gh exit $tag_rc): $(tr '\n' ' ' < "$tag_err")")
|
|
156
|
+
tags=""
|
|
157
|
+
fi
|
|
158
|
+
rm -f "$tag_err"
|
|
159
|
+
n_tags="$(grep -c . <<<"$tags")"
|
|
160
|
+
|
|
161
|
+
n_found="${#notes[@]}"; n_keyed=0; n_released=0; n_checked=0
|
|
162
|
+
for f in "${notes[@]:-}"; do
|
|
163
|
+
[ -n "$f" ] || continue
|
|
164
|
+
# Anchored inside the opening front-matter fence. A bare ^key: match
|
|
165
|
+
# also hits the body.
|
|
166
|
+
tag="$(awk -v key="$RELEASE_NOTE_TAG_KEY" '
|
|
167
|
+
/^---[[:space:]]*$/ { fm++; next }
|
|
168
|
+
fm == 1 && index($0, key ":") == 1 {
|
|
169
|
+
v = substr($0, length(key) + 2); sub(/^[[:space:]]+/, "", v); print v; exit
|
|
170
|
+
}' "$f")"
|
|
171
|
+
# A post carrying no tag key is not a release note. Silent by ruling:
|
|
172
|
+
# the census line below is how that case stays readable.
|
|
173
|
+
[ -n "$tag" ] || continue
|
|
174
|
+
n_keyed=$(( n_keyed + 1 ))
|
|
175
|
+
# A note whose tag is not on the remote is a legitimate skip — its
|
|
176
|
+
# release is deferred. This is why the tag list is not replaceable by
|
|
177
|
+
# the per-tag lookup below: a 404 there cannot tell that apart from a
|
|
178
|
+
# tag whose Release is genuinely missing.
|
|
179
|
+
grep -Fxq -- "$tag" <<<"$tags" || continue
|
|
180
|
+
n_released=$(( n_released + 1 ))
|
|
181
|
+
|
|
182
|
+
slug="${f##*/}"; slug="${slug%.*}"
|
|
183
|
+
want="https://$apex${RELEASE_NOTE_URL_PATH//\{slug\}/$slug}"
|
|
184
|
+
|
|
185
|
+
rel_err="$(mktemp)"
|
|
186
|
+
body="$(gh api "repos/{owner}/{repo}/releases/tags/$tag" --jq '.body // ""' 2>"$rel_err")"
|
|
187
|
+
rel_rc=$?
|
|
188
|
+
if [ "$rel_rc" -ne 0 ]; then
|
|
189
|
+
failures+=("$tag: no readable Release for a tag that exists (gh exit $rel_rc): $(tr '\n' ' ' < "$rel_err")")
|
|
190
|
+
rm -f "$rel_err"
|
|
191
|
+
continue
|
|
192
|
+
fi
|
|
193
|
+
rm -f "$rel_err"
|
|
194
|
+
n_checked=$(( n_checked + 1 ))
|
|
195
|
+
|
|
196
|
+
# Presence: containment, never equality — an older body may write a
|
|
197
|
+
# suffixed variant of its URL. Scheme-qualified, because a markdown
|
|
198
|
+
# link's visible label often repeats the URL scheme-less and would
|
|
199
|
+
# satisfy a scheme-less match while the link target went unchecked.
|
|
200
|
+
case "$body" in
|
|
201
|
+
*"$want"*) ;;
|
|
202
|
+
*) failures+=("$tag: Release body does not carry the note URL $want") ;;
|
|
203
|
+
esac
|
|
204
|
+
|
|
205
|
+
# Resolution: every apex URL as literally written in the body — this
|
|
206
|
+
# is what catches a trailing-slash URL that presence's containment
|
|
207
|
+
# lets through. Scheme-anchored so a label is never mistaken for a
|
|
208
|
+
# target. The trailing punctuation that occurs in practice is
|
|
209
|
+
# markdown-structural, `)` closing a link target and `)**` closing
|
|
210
|
+
# one inside bold, so the set covers `)` and `*` and strips a run.
|
|
211
|
+
# Deliberately not filtered to note URLs: a body's other apex links
|
|
212
|
+
# are covered too.
|
|
213
|
+
while read -r u; do
|
|
214
|
+
[ -n "$u" ] || continue
|
|
215
|
+
case "$u" in
|
|
216
|
+
"https://$apex"|"https://$apex/"*|"http://$apex"|"http://$apex/"*) ;;
|
|
217
|
+
*) continue ;;
|
|
218
|
+
esac
|
|
219
|
+
code="$(curl -sS -m 20 -o /dev/null -w '%{http_code}' "$u")"
|
|
220
|
+
[ "$code" = 200 ] || failures+=("$tag: Release body URL $u did not answer 200 (got '$code')")
|
|
221
|
+
done < <(grep -oE 'https?://[^[:space:]<>"]+' <<<"$body" | sed -E 's/[).,;:!?*]+$//' | sort -u)
|
|
222
|
+
done
|
|
223
|
+
|
|
224
|
+
# Which zero-case a reader is in. A diagnostic, not an assertion — the
|
|
225
|
+
# rulings above are what make a vacuous pass impossible.
|
|
226
|
+
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"
|
|
227
|
+
|
|
106
228
|
# DoD hook: a workflow_dispatch with force_fail=true exercises the issue
|
|
107
229
|
# path on demand without waiting for a real outage.
|
|
108
230
|
if [ "$FORCE_FAIL" = true ]; then
|