Skip to content

fix(check): report unavailable cargo as FPRSL902, not a manifest fault - #128

Merged
kvlonge merged 1 commit into
mainfrom
fix/cargo-unavailable
Nov 6, 2026
Merged

kvlonge merged 1 commit into
mainfrom
fix/cargo-unavailable

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Why

On a machine without a Rust toolchain, fensu check blamed a valid Cargo.toml: cargo metadata failed to start, and the failure was reported as FPRSL901 "restore a readable, valid Cargo manifest" (0.28), or as a generic "Rust analysis found 0 Rust files" error that carries the RSL901 cause (0.29).

Changes

  • cargo metadata failures are classified. A spawn failure (cargo not on PATH, or CARGO pointing nowhere), or rustup reporting that it has no usable toolchain, now produces the new FPRSL902. Anything else, including a manifest a working cargo rejects, keeps FPRSL901.

  • fensu check exits 2 on FPRSL902 before any rule is evaluated, so it never passes silently and the result is never cached:

    FPRSL902 Rust analysis cannot run: cargo not found; install the Rust toolchain (see rust-toolchain.toml)
    

    The (see …) part appears only when the repository has rust-toolchain.toml or rust-toolchain. A rustup failure reads cargo could not run: <rustup's error>; install the Rust toolchain ….

  • The existing "0 Rust files" error now names its code (FPRSL901 …).

  • FPRSL902 is registered in the rule catalogue (the catalogue was regenerated), and docs/rust.md describes it.

Verification

  • New CLI test with three cases: cargo missing (exit 2, FPRSL902, no FPRSL901); a valid manifest with working cargo (the selected rule runs, no FPRSL90x); a manifest that parses as TOML but that cargo rejects (exit 2, FPRSL901, no FPRSL902).
  • The existing fail-closed test for an unavailable cargo now expects the FPRSL902 text, and still exits 2.
  • The Rust pack's expected rule count goes from 120 to 121.

Locally with Rust 1.95.0 and Python 3.12: make verify, make skills-content-check and make test-rust all pass.

When cargo is not installed or rustup has no usable toolchain, cargo
metadata fails before it reads the manifest, and fensu reported FPRSL901
"restore a readable, valid Cargo manifest" for a valid Cargo.toml.

Spawn failures and rustup toolchain errors now produce FPRSL902, and
fensu check exits 2 with "cargo not found; install the Rust toolchain",
naming rust-toolchain.toml when the repository has one. A manifest that
cannot be read or parsed, or that a working cargo rejects, keeps FPRSL901.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying fensu with  Cloudflare Pages  Cloudflare Pages

Latest commit: ffa94a8
Status: ✅  Deploy successful!
Preview URL: https://e49542e3.fensu.pages.dev
Branch Preview URL: https://fix-cargo-unavailable.fensu.pages.dev

View logs

@kvlonge
kvlonge merged commit 70c2100 into main Nov 6, 2026
49 of 52 checks passed
@kvlonge
kvlonge deleted the fix/cargo-unavailable branch November 6, 2026 01:01
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