Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ci-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ never a state that persists by default.
| opencode-config-guard | nightly schedule | yes |
| mcpx fix-test guard | nightly schedule | yes |
| production-line guard | nightly schedule | yes |
| root-status guard | nightly schedule | yes |
| go modules build | nightly schedule | yes |
| identity build | nightly schedule | yes |
| map build | nightly schedule | yes |
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/check-ci-policy-agreement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ REGISTRY=(
"opencode-config-guard.yml|opencode-config-guard|nightly"
"mcpx-fix-test-guard.yml|mcpx fix-test guard|nightly"
"production-line-guard.yml|production-line guard|nightly"
"root-status-guard.yml|root-status guard|nightly"
"go-modules-build.yml|go modules build|nightly"
"identity-build.yml|identity build|nightly"
"map-build.yml|map build|nightly"
Expand Down
61 changes: 61 additions & 0 deletions .github/scripts/check-root-status-files.sh
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"
102 changes: 102 additions & 0 deletions .github/scripts/check-root-status-files.test.sh
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"
13 changes: 13 additions & 0 deletions .github/test-suite-registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,19 @@
"status": "mapped",
"related_issues": [1411]
},
{
"id": "ci.root-status-files",
"paths": [".github/scripts/check-root-status-files.test.sh"],
"invocation": "bash .github/scripts/check-root-status-files.test.sh",
"venue": {
"workflow": ".github/workflows/root-status-guard.yml",
"job_step": "Guard contract tests (#12136)",
"state": "active",
"dispatchable": true
},
"status": "mapped",
"related_issues": [12136]
},
{
"id": "bin.node-tests",
"paths": ["bin/*.test.mjs"],
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/root-status-guard.yml
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 * * *"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Register the new nightly guard in the schedule registry

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 👍 / 👎.

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