Repository navigation
feat(ci): guard against new root *COMPLETE* / *SUMMARY* status files (#12136) #13060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dezren39
wants to merge
1
commit into
xaltha/12136-root-cleanup
Choose a base branch
from
xaltha/12136-root-status-guard
base: xaltha/12136-root-cleanup
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #!/usr/bin/env bash | ||
| # Repo-root status-file guard (#12136). | ||
| # | ||
| # Fails when a file at the repository root has a name containing | ||
| # COMPLETE or SUMMARY (case-insensitive). Those names mark one-shot | ||
| # status documents ("implementation complete", slice summaries, | ||
| # completion reports) that go stale the moment they land; #12136 | ||
| # removed 26 of them, plus two helper scripts and a committed chat | ||
| # transcript, in PR #13047. Status belongs in the issue tracker or | ||
| # under doc/, never as a new root file. | ||
| # | ||
| # Only the root is guarded: the same names inside a directory (for | ||
| # example the pm-stack/opencode-claimant/ copies the issue's evidence | ||
| # names) are that directory's own business. | ||
| # | ||
| # No grandfather list: the removal landed first (this guard is | ||
| # stacked on PR #13047), so the invariant holds on the whole tree | ||
| # from the day the guard lands. The repo's grandfather-list ratchet | ||
| # (check-production-line-limit.sh) exists for violations that take | ||
| # many PRs to burn down; here a single already-open PR removes them | ||
| # all, so a list would be dead entries the moment #13047 merges. | ||
| # | ||
| # Argument contract (#3352): the whole command line is the single | ||
| # optional positional argument below; anything else is a usage | ||
| # error (exit 2) before any work happens. | ||
| # | ||
| # Usage: check-root-status-files.sh [ROOT] (default: repo root) | ||
| set -euo pipefail | ||
|
|
||
| [[ $# -le 1 ]] || { | ||
| echo "Usage: check-root-status-files.sh [ROOT]" >&2 | ||
| exit 2 | ||
| } | ||
|
|
||
| ROOT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}" | ||
|
|
||
| if [ ! -d "$ROOT" ]; then | ||
| echo "::error::root status guard: root not found: $ROOT" | ||
| exit 1 | ||
| fi | ||
|
|
||
| fail=0 | ||
| checked=0 | ||
| while IFS= read -r -d '' file; do | ||
| base="$(basename "$file")" | ||
| lower="${base,,}" | ||
| checked=$((checked + 1)) | ||
| case "$lower" in | ||
| *complete* | *summary*) | ||
| echo "::error::ROOT STATUS FILE $base: root files named *COMPLETE* / *SUMMARY* are one-shot status documents that go stale on landing (#12136). Record the status in the issue tracker or under doc/ instead." | ||
| fail=1 | ||
| ;; | ||
| esac | ||
| done < <(find "$ROOT" -maxdepth 1 \( -type f -o -type l \) -print0 | sort -z) | ||
|
|
||
| echo "root-status-guard: checked $checked root files" | ||
| if [ "$fail" -ne 0 ]; then | ||
| echo "root-status-guard: FAILED - root status file(s) listed above" | ||
| exit 1 | ||
| fi | ||
| echo "root-status-guard: OK" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| #!/usr/bin/env bash | ||
| # Contract tests for check-root-status-files.sh (#12136). | ||
| # Builds fixture roots in a temp dir: a clean root passes (including | ||
| # a *COMPLETE* file nested in a subdirectory - only the root is | ||
| # guarded), and a root *COMPLETE* / *SUMMARY* file fails, named. | ||
| # Path-only, so it runs offline. | ||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| CHECK="$SCRIPT_DIR/check-root-status-files.sh" | ||
| TMP="$(mktemp -d)" | ||
| trap 'rm -rf "$TMP"' EXIT | ||
|
|
||
| failures=0 | ||
| note_fail() { | ||
| echo "FAIL: $1" | ||
| failures=$((failures + 1)) | ||
| } | ||
|
|
||
| # A clean root passes: ordinary root files, plus a *COMPLETE* file | ||
| # nested in a subdirectory (out of scope - the guard is root-only). | ||
| CLEAN="$TMP/clean" | ||
| mkdir -p "$CLEAN/doc" | ||
| : >"$CLEAN/README.md" | ||
| : >"$CLEAN/Cargo.toml" | ||
| : >"$CLEAN/doc/TASK_COMPLETE.md" | ||
| if bash "$CHECK" "$CLEAN" >/dev/null 2>&1; then | ||
| echo "ok: a clean root passes (nested *COMPLETE* is out of scope)" | ||
| else | ||
| note_fail "a clean root should pass" | ||
| fi | ||
|
|
||
| # A root *COMPLETE* file fails, and the failure names it. | ||
| BAD="$TMP/complete" | ||
| mkdir -p "$BAD" | ||
| : >"$BAD/README.md" | ||
| : >"$BAD/TASK_COMPLETE.md" | ||
| if out=$(bash "$CHECK" "$BAD" 2>&1); then | ||
| note_fail "a root TASK_COMPLETE.md should fail" | ||
| elif ! printf '%s' "$out" | grep -qF 'TASK_COMPLETE.md'; then | ||
| note_fail "the failure should name the offending file" | ||
| printf '%s\n' "$out" | sed 's/^/ /' | ||
| else | ||
| echo "ok: a root TASK_COMPLETE.md fails, naming the file" | ||
| fi | ||
|
|
||
| # Matching is case-insensitive, like the lowercase slice-1 names | ||
| # #12136 removed (slice1_final_verification.md and friends). | ||
| LOWER="$TMP/lower" | ||
| mkdir -p "$LOWER" | ||
| : >"$LOWER/implementation_summary.txt" | ||
| if bash "$CHECK" "$LOWER" >/dev/null 2>&1; then | ||
| note_fail "a lowercase root implementation_summary.txt should fail" | ||
| else | ||
| echo "ok: a lowercase root *summary* file fails" | ||
| fi | ||
|
|
||
| # The exact shape #12136 cleaned up fails too. | ||
| SLICE="$TMP/slice" | ||
| mkdir -p "$SLICE" | ||
| : >"$SLICE/SLICE1_COMPLETION_SUMMARY.txt" | ||
| if bash "$CHECK" "$SLICE" >/dev/null 2>&1; then | ||
| note_fail "a root SLICE1_COMPLETION_SUMMARY.txt should fail" | ||
| else | ||
| echo "ok: a root SLICE1_COMPLETION_SUMMARY.txt fails" | ||
| fi | ||
|
|
||
| # Scope boundary: the issue's guard bullet names *COMPLETE* and | ||
| # *SUMMARY* only, so a *STATUS* name alone still passes. | ||
| STATUS="$TMP/status" | ||
| mkdir -p "$STATUS" | ||
| : >"$STATUS/IMPLEMENTATION_STATUS.md" | ||
| if bash "$CHECK" "$STATUS" >/dev/null 2>&1; then | ||
| echo "ok: a root *STATUS*-only name passes (guard covers *COMPLETE* / *SUMMARY*)" | ||
| else | ||
| note_fail "a *STATUS*-only name should pass" | ||
| fi | ||
|
|
||
| if bash "$CHECK" "$TMP/missing" >/dev/null 2>&1; then | ||
| note_fail "a missing root should fail" | ||
| else | ||
| echo "ok: a missing root fails" | ||
| fi | ||
|
|
||
| # Argument contract (#3352): anything beyond the one optional ROOT | ||
| # positional is a usage error, exit 2, with the usage message. | ||
| rc=0 | ||
| out=$(bash "$CHECK" "$CLEAN" extra 2>&1) || rc=$? | ||
| if [ "$rc" -ne 2 ]; then | ||
| note_fail "an extra argument should exit 2 (usage error), got $rc" | ||
| elif ! printf '%s' "$out" | grep -qF 'Usage:'; then | ||
| note_fail "the extra-argument failure should print the usage message" | ||
| printf '%s\n' "$out" | sed 's/^/ /' | ||
| else | ||
| echo "ok: an extra argument is a usage error (exit 2, usage printed)" | ||
| fi | ||
|
|
||
| if [ "$failures" -ne 0 ]; then | ||
| echo "check-root-status-files.test: $failures failure(s)" | ||
| exit 1 | ||
| fi | ||
| echo "check-root-status-files.test: OK" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: root-status-guard | ||
|
|
||
| # Repo-root status-file guard (#12136): no file at the repository | ||
| # root may be named *COMPLETE* / *SUMMARY* - those are one-shot | ||
| # status documents that go stale on landing. Pure bash - no nix, no | ||
| # toolchain - so this stays a seconds-long basic check. | ||
|
|
||
| on: | ||
| schedule: | ||
| # Nightly instead of on every push to main (Drew, 2026-11-16; see | ||
| # .github/ci-policy.md "Nightly main CI"). | ||
| - cron: "17 7 * * *" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: root-status-guard-${{ github.event_name == 'push' && github.run_id || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| root-status-guard: | ||
| name: "basic: root status files" | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Guard passes on this tree (#12136) | ||
| run: bash .github/scripts/check-root-status-files.sh | ||
| - name: Guard contract tests (#12136) | ||
| run: bash .github/scripts/check-root-status-files.test.sh | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new daily GitHub Actions schedule also needs a same-pass entry in
doc/fleet-schedule-registry.md: Surface 4 explicitly covers scheduled workflows in this repository. This commit adds no such entry, leaving the recurring guard absent from the fleet’s placement and schedule-review inventory. The CI-policy and test-suite registry additions do not replace that separate requirement.AGENTS.md reference: AGENTS.md:L60-L65
Useful? React with 👍 / 👎.