Skip to content

fix(guard): Gate 1 of the pre-release skill has been checking an empty directory - #2483

Closed
noahgift wants to merge 2 commits into
mainfrom
fix/vacuous-guards
Closed

fix(guard): Gate 1 of the pre-release skill has been checking an empty directory#2483
noahgift wants to merge 2 commits into
mainfrom
fix/vacuous-guards

Conversation

@noahgift

Copy link
Copy Markdown
Contributor

check_package_includes.sh is the CB-510 guard: a Cargo.toml exclude pattern
can strip an include!() target from the published crate while git still tracks
it, so the crate compiles in-tree and fails for everyone installing from
crates.io. That has shipped twice -- models/ matching src/models/, and an
unanchored "tests/" dropping 443 files from published aprender-serve in 0.63.0.

It scanned src/ and packaged -p aprender: the PRE-MONOREPO layout. After
consolidation the root src/ holds 2 files with zero include!(), while 1798
live under crates/. So it reported, truthfully and uselessly:

OK: All 0 include!() files are included in cargo package

Zero of zero, exit 0, for every release since the consolidation -- while being
Gate 1 of .claude/skills/pre-release/SKILL.md.

It now enumerates publishable workspace crates from cargo metadata, resolves
every include!() against the including file's directory, and diffs against that
crate's OWN cargo package --list. 10 crates, 1539 include targets. A vacuity
assertion fails below 100 targets, so the empty-scan mode cannot return.

RESULT: the tree is CLEAN. Every one of the 1539 targets survives packaging.

Three bugs of my own, each caught by a mutation that refused to turn red. Worth
recording because each produced a confident wrong answer:

  1. cargo package inside while read ... <<< "$pkgs" consumed the heredoc on
    stdin. The scan silently dropped a crate (11 -> 10) AND compared one crate's
    include targets against another crate's listing, inventing a CB-510 violation
    on src/bench/backend.rs. Fixed with < /dev/null.
  2. One forked grep -qxF per target -- 922 for aprender-serve alone -- treating
    ANY non-zero as "not packaged". grep exits >1 on ERROR, and a forked grep can
    die under load, so the guard named a different innocent file on each run.
  3. Replacing that with python, I put a heredoc script AND a <<< data
    redirection on the same call. Last redirection wins, so python received the
    include list as its SCRIPT and printed nothing. The guard then PASSED a
    mutation that provably dropped a file from the package -- I had written
    another gate that cannot fail, inside the fix for a gate that cannot fail.
    Both inputs now go through explicit files.

Mutation-verified, with the mutation itself proven to engage first
(cargo package --list | grep -c goes 1 -> 0 before the guard is consulted):

  • exclude "src/bench/" -> RED, 27 files named
  • scan a nonexistent dir -> RED on vacuity
  • restored -> GREEN

Wired into the merge-blocking guard block. bashrs 0 errors; the three embedded
python fragments moved to scripts/lib/ because bashrs parses an inline heredoc as
shell (8 phantom SC1007s from python assignments, 2 SC1078s from nested quotes
across a line continuation).

Refs #2481, #2474

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

@noahgift
noahgift enabled auto-merge August 14, 2026 18:14
@noahgift
noahgift added this pull request to the merge queue Aug 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 14, 2026
@noahgift
noahgift enabled auto-merge August 15, 2026 09:27
…y directory

`check_package_includes.sh` is the CB-510 guard: a Cargo.toml `exclude` pattern
can strip an `include!()` target from the published crate while git still tracks
it, so the crate compiles in-tree and fails for everyone installing from
crates.io. That has shipped twice -- `models/` matching `src/models/`, and an
unanchored `"tests/"` dropping 443 files from published aprender-serve in 0.63.0.

It scanned `src/` and packaged `-p aprender`: the PRE-MONOREPO layout. After
consolidation the root `src/` holds 2 files with zero `include!()`, while 1798
live under `crates/`. So it reported, truthfully and uselessly:

    OK: All 0 include!() files are included in cargo package

Zero of zero, exit 0, for every release since the consolidation -- while being
Gate 1 of `.claude/skills/pre-release/SKILL.md`.

It now enumerates publishable workspace crates from `cargo metadata`, resolves
every `include!()` against the including file's directory, and diffs against that
crate's OWN `cargo package --list`. 10 crates, 1539 include targets. A vacuity
assertion fails below 100 targets, so the empty-scan mode cannot return.

RESULT: the tree is CLEAN. Every one of the 1539 targets survives packaging.

Three bugs of my own, each caught by a mutation that refused to turn red. Worth
recording because each produced a confident wrong answer:

1. `cargo package` inside `while read ... <<< "$pkgs"` consumed the heredoc on
   stdin. The scan silently dropped a crate (11 -> 10) AND compared one crate's
   include targets against another crate's listing, inventing a CB-510 violation
   on src/bench/backend.rs. Fixed with `< /dev/null`.
2. One forked `grep -qxF` per target -- 922 for aprender-serve alone -- treating
   ANY non-zero as "not packaged". grep exits >1 on ERROR, and a forked grep can
   die under load, so the guard named a different innocent file on each run.
3. Replacing that with python, I put a heredoc script AND a `<<<` data
   redirection on the same call. Last redirection wins, so python received the
   include list as its SCRIPT and printed nothing. The guard then PASSED a
   mutation that provably dropped a file from the package -- I had written
   another gate that cannot fail, inside the fix for a gate that cannot fail.
   Both inputs now go through explicit files.

Mutation-verified, with the mutation itself proven to engage first
(`cargo package --list | grep -c` goes 1 -> 0 before the guard is consulted):
  * exclude "src/bench/"  -> RED, 27 files named
  * scan a nonexistent dir -> RED on vacuity
  * restored              -> GREEN

Wired into the merge-blocking guard block. bashrs 0 errors; the three embedded
python fragments moved to scripts/lib/ because bashrs parses an inline heredoc as
shell (8 phantom SC1007s from python assignments, 2 SC1078s from nested quotes
across a line continuation).

Refs #2481, #2474

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@noahgift
noahgift force-pushed the fix/vacuous-guards branch from d453084 to 57fb82a Compare August 15, 2026 09:30
@noahgift
noahgift added this pull request to the merge queue Aug 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 15, 2026
@noahgift
noahgift enabled auto-merge August 16, 2026 10:59
Conflict in ci.yml's guard block only. Every guard PR appends steps to
that one block, so its conflicts are structural rather than semantic and
they are ADDITIVE: taking either side silently drops the other branch's
gates, which is precisely how a guard stops running without anyone
editing it. Both sides kept, main's first. Verified by parsing the YAML
and counting the steps rather than by reading the diff.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant