Repository navigation
Description
Problem
Two silent reverts have reached main with all 38 checks green, by two different
mechanisms. One of them is now gated. The other is not.
- Incident 1 — stale-base squash (fix(repo-fleet-hygiene): report bare repos with live working trees #2633). The branch was cut before feat(repo-fleet-hygiene): gather merge evidence via aliased GraphQL #2642 and
squashed without rebasing, so the merge reinstated the pre-feat(repo-fleet-hygiene): gather merge evidence via aliased GraphQL #2642 file wholesale:
audit-fleet.sh−1108 lines,audit-fleet.test.sh−578, net −616. Two merged
features silently reverted. Repaired by fix(repo-fleet-hygiene): restore GraphQL merge evidence and rollups after #2633 #2640, and now gated by
scripts/check-fleet-finding-test-coverage.sh(test(repo-fleet-hygiene): restore bare-repo-with-working-tree coverage #2658). - Incident 2 — docs rebase carrying stale prose (docs(repo-fleet-hygiene): define fleet coordination contract for epic #2597 #2646). Merged eight minutes
after fix(repo-fleet-hygiene): accept bare paths and drive roots as --root #2638, from a branch whoseSKILL.mdpredated it. The rebase was textually
clean and reverted the skill layer only, leavingaudit-fleet.shuntouched, so
the skill body instructed agents to reject the exact invocation the script accepts.
Repaired by docs(repo-fleet-hygiene): restore the documented argument grammar #2670. Nothing gates this class today.
CI structurally cannot catch incident 2. plugin-gate ran the full suite on #2646
and passed, because every test lives on the script side: the parser was correct and
stayed correct. Nothing in the repository asserts that SKILL.md's documented
argument grammar matches what audit-fleet.sh actually accepts. A skill body is
the agent's only instruction surface — when it disagrees with the script, the agent
refuses a valid invocation and no test anywhere notices.
A require-branch-up-to-date rule would have stopped #2633 but not #2646 —
#2646 rebased cleanly. Two distinct causes, one symptom. (Org settings are
Pulumi-managed in melodic-software/github-iac and are out of scope here.)
Evidence
Incident 1 is already red-lined. Running the shipped sibling gate against
cc58cbc5's trees with the live baseline:
UNCOVERED FINDING KIND: remote-branch-inventory-unavailable (no Finding: assertion in the suite)
STALE BASELINE ENTRY: discovery-skip (now Finding:-asserted; remove from baseline)
Incident 2 has no gate. At a6be07f9 the script and the skill disagree, and the
disagreement is entirely on the documentation side — the two script versions are
behaviourally identical on every probe:
| probe | a6be07f9 audit-fleet.sh |
main audit-fleet.sh |
|---|---|---|
bare positional <dir> |
accepted as --root |
accepted as --root |
| no-scope run | stops, exit 2, remedy block | stops, exit 2, remedy block |
| remedy block scope forms | <dir> --root --repo --config |
<dir> --root --repo --config |
Against that unchanged behaviour, SKILL.md at a6be07f9:
argument-hintreads"[--root <dir>]... [--repo <dir>]..."— no bare positional
form, while the script's own usage saysA bare DIR is equivalent to --root DIR.- The Input-resolution grammar list carries
--root,--repo,--configbullets but
no`<dir>`bullet, under the instruction "Before execution, reject any
arguments outside this grammar." So/repo-fleet-hygiene:audit D:— the documented
primary invocation — reads as out-of-grammar and gets refused. - It claims
--project-diris "the no-scope fallback target" and that "the script
uses the project directory as an exact--repotarget". The script does neither; it
stops withno scope resolved.
Proposed change
Add scripts/check-fleet-audit-doc-grammar.sh, wired as its own CI lane, asserting
that plugins/repo-fleet-hygiene/skills/audit/SKILL.md agrees with what
plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh actually does. It
lives outside both protected files — the shape check-fleet-finding-test-coverage.sh
established — so a stale-base rewrite of either file cannot delete its own defender.
Agreement is established by probing the script and reading its answers, never by
pattern-matching the parser source:
- Bare positional is in both or neither. Probe the parser with
--apply-plan <missing> <dir>, which resolves immediately after the argument loop
and before config resolution or discovery, so the three outcomes are distinguishable
(unknown argument= rejected,cannot be combined with audit discovery flags=
accepted as a discovery arg,apply-plan file not found= silently ignored). Require
argument-hintto carry a bare positional form iff the probe says accepted. - Every scope form the script names is documented. Run the no-scope probe, parse the
scope tokens out of the script's own remedy block, and require each to have a grammar
bullet inSKILL.md. The expected set is derived from the script at run time, so it
updates itself when the grammar changes — there is no hand-maintained list to go stale. - No-scope behaviour matches. The no-scope probe must stop non-zero and emit the
remedy block rather than produce a report.
Non-flakiness is the design constraint, since a gate that cries wolf gets disabled:
- Probes never reach discovery or GitHub, so no network and no
ghdependency. - The environment is sealed inside the gate (
HOME,USERPROFILE,
CLAUDE_PROJECT_DIR,XDG_CONFIG_HOMEredirected to a scratch dir), so a maintainer
with a~/.claude/repo-fleet-hygiene.confgets the same verdict as CI. - Any probe whose output matches none of the recognized outcomes is a hard
exit 2
"probe inconclusive", never a pass — the analogue of the sibling gate's
finding-kind extraction floor. A reworded script error cannot silently false-green. - Doc predicates read structured surfaces (the
argument-hintfrontmatter field, the
grammar bullet list), not free prose.
FLEET_DOC_GRAMMAR_SCRIPT / FLEET_DOC_GRAMMAR_SKILL override the paths so the
self-test can point the gate at trees extracted from the historical commits.
Acceptance criteria
scripts/check-fleet-audit-doc-grammar.sh --checkfails againsta6be07f9's
SKILL.mdpaired with that same commit'saudit-fleet.sh, naming the missing bare
positional form.- The same command passes against current
main. scripts/check-fleet-audit-doc-grammar.test.shships that demonstration as an
executable historical proof, alongside synthetic-tree cases for each assertion and
for the inconclusive-probe guard.- The gate runs as a
ci.ymllane aggregated byci-status, unconditionally (a skipped
lane fails the aggregate). - The gate performs no network access and completes in seconds.
- No absolute machine path is written into a tracked file.
Activity
ci: add a post-merge silent-revert canary (#2808)
refactor(scripts): dissolve incident history in gate scripts (group 4)