Files
Bo 1d4c003e05 Cut plan: gate registry diet, legacy bash gate removal, CI collapse, pawl warm-service removal (#906)
## Summary
- **Wave 1** — remove the `always.wiring-closure` meta-gate, demote
`docs.skill-refs` to Full tier, delete 8 orphan scripts.
- **Wave 2** — delete the legacy bash pre-push gate (`pre-push-gate.sh`,
2,279 lines) and its parity machinery; collapse `validate.yml` from 18
jobs to 5.
- **Wave 3** — remove the pawl warm NTM standing service; the cold
review spine (pawl-review / pawl-verdict / pre-push check) is untouched.
- **Wave 4** — gate registry diet: cut 24 doctrine/meta check IDs and
~70 backing scripts/workflows/bats; trim nightly knowledge-cycle job.

Net: gate registry 112 → 83 checks (incl. main's additions), ~24k lines
of scripts/CI/bats deleted. Routine one-file fast gate now runs in ~19s.

## Test plan
- [x] `go build` / `go vet` / gates+goals+ports package tests green
- [x] `ao gate check --fast --scope range:origin/main..HEAD` — 66
passed, 0 failed, 1 skipped (199 changed files)
- [x] `validate-ci-policy-parity.sh` PASS; validate.yml / nightly.yml
parse
- [x] `regen-changed-scope --check` green; registry.json regenerated
- [x] Grepped tree for dangling references to every deleted script/check
ID

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: boshu <241868352+boshu2@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-13 14:45:20 -04:00

114 lines
4.0 KiB
Bash

#!/usr/bin/env bats
#
# Tests for scripts/lib/docs-scope.sh — the shared LIVE-doc scope resolver
# (docs_scope_live_files) and the historical-exemption test
# (docs_scope_is_exempt) for LIVE-doc scoping
# (age-gate-the-ungated-egwt.1).
#
# Sibling pattern: matches tests/scripts/check-workflow-no-retired-tracker.bats
# and test-check-docs-learning-references.bats — build a fixture docs tree in
# BATS_TEST_TMPDIR, point the lib at it via the injectable DOCS_ROOT seam, and
# assert scope membership + exemption verdicts.
#
# The lib is SOURCED (not executed); it deliberately does NOT set strict mode on
# behalf of a caller, so these tests source it directly and call its functions.
setup() {
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../.." && pwd)"
LIB="$REPO_ROOT/scripts/lib/docs-scope.sh"
[ -r "$LIB" ]
# shellcheck source=/dev/null
. "$LIB"
# Fixture docs tree under an injected DOCS_ROOT.
export DOCS_ROOT="$BATS_TEST_TMPDIR/fix"
mkdir -p "$DOCS_ROOT/docs" \
"$DOCS_ROOT/docs/adr" \
"$DOCS_ROOT/docs/audits" \
"$DOCS_ROOT/docs/plans"
# A plain live doc (in scope, not exempt).
printf '# Overview\n\nThis is a live doc.\n' > "$DOCS_ROOT/docs/live.md"
# A live doc that self-declares historical via a first-line banner.
printf '# Old Design (RETIRED)\n\nSuperseded content.\n' > "$DOCS_ROOT/docs/banner.md"
# A doc whose RETIRED banner sits at line 20 (OUTSIDE the first 15 lines).
{ for i in $(seq 1 19); do printf 'filler line %s\n' "$i"; done; \
printf 'This section is RETIRED and no longer used.\n'; } \
> "$DOCS_ROOT/docs/late-banner.md"
# A doc under docs/adr/ (excluded from scope AND exempt).
printf '# ADR-0099 Some Decision\n\nContext.\n' > "$DOCS_ROOT/docs/adr/ADR-0099-thing.md"
# A doc under a dated-snapshot excluded dir (docs/audits/).
printf '# Audit snapshot\n' > "$DOCS_ROOT/docs/audits/2026-07-01-snapshot.md"
# A migration-named doc (exempt by filename glob) — put it in scope so its
# filename exemption is what matters.
printf '# Moving off the old thing\n' > "$DOCS_ROOT/docs/some-migration-notes.md"
}
# ---- docs_scope_live_files (scope membership) -------------------------------
@test "live doc is included in the live-doc set" {
run docs_scope_live_files
[ "$status" -eq 0 ]
[[ "$output" == *"docs/live.md"* ]]
}
@test "file in a dated-snapshot excluded dir is NOT in the live set" {
run docs_scope_live_files
[ "$status" -eq 0 ]
[[ "$output" != *"docs/audits/2026-07-01-snapshot.md"* ]]
}
@test "docs/adr file is NOT in the live set (excluded from scope)" {
run docs_scope_live_files
[ "$status" -eq 0 ]
[[ "$output" != *"docs/adr/ADR-0099-thing.md"* ]]
}
@test "emitted paths are relative and begin with docs/" {
run docs_scope_live_files
[ "$status" -eq 0 ]
while IFS= read -r line; do
[ -z "$line" ] && continue
[[ "$line" == docs/* ]]
done <<< "$output"
}
# ---- docs_scope_is_exempt (exemption verdict) -------------------------------
@test "banner-exempt doc (RETIRED in first 15 lines) is exempt" {
run docs_scope_is_exempt "docs/banner.md"
[ "$status" -eq 0 ]
}
@test "docs/adr file is exempt" {
run docs_scope_is_exempt "docs/adr/ADR-0099-thing.md"
[ "$status" -eq 0 ]
}
@test "plain live doc is NOT exempt" {
run docs_scope_is_exempt "docs/live.md"
[ "$status" -eq 1 ]
}
@test "migration-named doc is exempt by filename glob" {
run docs_scope_is_exempt "docs/some-migration-notes.md"
[ "$status" -eq 0 ]
}
# EDGE: a RETIRED banner at line 20 (outside the first 15 lines) must NOT exempt.
@test "RETIRED banner at line 20 (outside first 15 lines) is NOT exempt" {
run docs_scope_is_exempt "docs/late-banner.md"
[ "$status" -eq 1 ]
}
# The exemption test also resolves a path directly (already readable) — the
# check script cd's to the root and passes docs/... paths that resolve as-is.
@test "exemption resolves a directly-readable path too" {
( cd "$DOCS_ROOT" && docs_scope_is_exempt "docs/banner.md" )
}