Skip to content

Commit 6bcc3bb

Browse files
author
jcode
committed
test(preflight): make an exclusion's reason a required field, not a comment
A comment beside an entry can drift out of sync with it and nothing notices, so a reader months later cannot tell a stale justification from a live one. Moving the reason into the data the gate reads makes an unexplained widening unparseable rather than merely undocumented. Entries are now "path|reason". A missing or empty reason fails the check before it runs, because running while blind to a file for reasons nobody recorded is the same silent-success shape this whole line of work has been about. The two guards are independent on purpose and were verified separately, since the count check fires first and would otherwise mask the field check: removing a reason without changing the count fails with "exclusion '.rename-outloud.py' has no reason", and adding an entry fails with "3 entries, expected 2". Re-ran the original defect afterwards. It still fails, so the hardening did not neuter what it hardens.
1 parent 95a1192 commit 6bcc3bb

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

‎scripts/preflight.sh‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,14 @@ check_tcc_ids() {
256256
#
257257
# Both entries below name stale artifacts by necessity, so counting them as
258258
# "written" made the check vouch for the very names it exists to reject.
259+
# "path|reason", both required. The reason is a FIELD rather than a comment
260+
# because a comment beside an entry can drift out of sync with it and nothing
261+
# notices; a missing field fails the check. The question this answers months
262+
# later is "why is this file not ground truth", and the answer has to survive
263+
# next to the entry rather than above it.
259264
ARTIFACT_GROUND_TRUTH_EXCLUSIONS=(
260-
# This file: its own comments quote the aqua-spike defect as evidence.
261-
"preflight.sh"
262-
# The rename script: its before/after table lists every old name.
263-
".rename-outloud.py"
265+
"preflight.sh|its own comments quote the aqua-spike defect as evidence"
266+
".rename-outloud.py|its before/after table lists every superseded name"
264267
)
265268

266269
check_workflow_artifacts() {
@@ -277,9 +280,19 @@ check_workflow_artifacts() {
277280
return
278281
fi
279282
# What the build scripts actually write.
280-
local exclude_args=() ex
281-
for ex in "${ARTIFACT_GROUND_TRUTH_EXCLUSIONS[@]}"; do
282-
exclude_args+=("--exclude=$ex")
283+
local exclude_args=() entry path reason
284+
for entry in "${ARTIFACT_GROUND_TRUTH_EXCLUSIONS[@]}"; do
285+
path="${entry%%|*}"
286+
reason="${entry#*|}"
287+
# An entry with no reason, or whose reason is just the path repeated,
288+
# is a widening nobody has justified. Refusing to run beats running
289+
# while blind to a file for reasons nobody recorded.
290+
if [[ -z "$path" || "$reason" == "$entry" || -z "${reason// /}" ]]; then
291+
record FAIL "workflow-artifacts" \
292+
"exclusion '$entry' has no reason. NEXT: write it as \"path|why this file cannot be ground truth\""
293+
return
294+
fi
295+
exclude_args+=("--exclude=$path")
283296
done
284297

285298
local written

0 commit comments

Comments
 (0)