Skip to content

fix(sovereign-ci): bin-only crates could never pass test or coverage - #44

Open
noahgift wants to merge 1 commit into
mainfrom
fix/sovereign-ci-bin-only-crates
Open

fix(sovereign-ci): bin-only crates could never pass test or coverage#44
noahgift wants to merge 1 commit into
mainfrom
fix/sovereign-ci-bin-only-crates

Conversation

@noahgift

Copy link
Copy Markdown
Contributor

The defect

Every branch of the test and coverage fallback chains passes --lib:

TEST_SCOPE: ${{ inputs.test_workspace && '--workspace --lib' || '--lib' }}

And cargo test --lib does not merely fail on a crate without a [lib] target — it errors:

error: no library targets found in package `cohete`   (exit 101)

So a bin-only repo had no reachable configuration. test_workspace only toggles --workspace; both of its values keep --lib.

Where it showed up

cohete's ci / coverage job, red for this and nothing else:

error: process didn't exit successfully: `cargo test ... --lib` (exit status: 101)
error: process didn't exit successfully: `cargo test ... --lib -p cohete` (exit status: 101)
::error::Coverage failed — check workspace path dependencies

Its CI last passed 2026-04-03, before this chain took its current shape.

The same --lib assumption independently made cohete's local pre-push hook unpassable — so every push there used --no-verify, and 84 rustfmt diffs plus 2 clippy errors accumulated behind the bypass (paiml/cohete#4). A gate that cannot pass is worse than no gate: it trains everyone to bypass it, and then real findings ride in behind the bypass.

The fix

One more link on each chain, without --lib. Covers bins, integration tests and doctests; works with or without a [lib].

Purely additive. A crate that has a lib target satisfies an earlier branch and never reaches the new line, so behaviour is unchanged for every repo that works today.

I verified the || \-with-comment chains still short-circuit correctly in both directions — fallback skipped when the prior command succeeds, run when it fails — rather than assuming either way.

⚠️ Review please — blast radius

This workflow is called by roughly 30 fleet repos. I am not self-merging it.

Refs PMAT-203.

🤖 Generated with Claude Code

Every branch of the test and coverage fallback chains passes `--lib`:

    TEST_SCOPE: ${{ inputs.test_workspace && '--workspace --lib' || '--lib' }}

and `cargo test --lib` does not merely FAIL on a crate without a [lib] target —
it ERRORS: "no library targets found in package <name>" (exit 101). So a bin-only
repo had no reachable configuration: `test_workspace` only toggles `--workspace`,
and both of its values keep `--lib`.

Found in cohete, whose `ci / coverage` job is red for this and nothing else:

    error: process didn't exit successfully: `cargo test ... --lib` (exit 101)
    error: process didn't exit successfully: `cargo test ... --lib -p cohete` (exit 101)
    ::error::Coverage failed — check workspace path dependencies

The same `--lib` assumption independently made cohete's local pre-push hook
unpassable, so every push there used --no-verify and 84 rustfmt diffs plus 2
clippy errors accumulated behind the bypass. A gate that cannot pass is worse
than no gate.

Fix: append one more link to each chain, without `--lib`. That covers bins,
integration tests and doctests, and works with or without a [lib].

PURELY ADDITIVE — a crate that HAS a lib target satisfies an earlier branch and
never reaches the new line, so behaviour is unchanged for every repo that works
today. Verified the `|| \`-with-comment chains still short-circuit correctly in
both directions: fallback skipped when the prior command succeeds, run when it
fails.

⚠️ Blast radius: this workflow is called by ~30 fleet repos. Not self-merging.

Refs PMAT-203
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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