Skip to content

cargo-tops v0.5.0

Latest

Choose a tag to compare

@github-actions github-actions released this 25 Nov 14:21
· 47 commits to main since this release
f968c0f

Breaking 0.x minor. First release shipping protocol 1.3.0 and protocol 1.4.0. Package plane moves to 0.5.0.

Added

  • Skills from BeautifulRust v1.5.0, rewritten in our own words and credited in NOTICE (MIT). Nushell 0.108.0 is their required runtime ([tools] nushell in rust-tops.lock). cargo tops init --skills now writes five skills and the rule catalog, and prints a line naming the Nushell requirement.

    • Rule catalog (#40): rules.toml with 75 rules, each an ID and a kind (lint, probe or judgment), and docs/beautifulrust-map.md, which maps the upstream bullets to rule IDs or to dropped: <reason>.
    • Lint proof (#41): a test proves every lint rule in the catalog is a lint clippy knows and fires on a probe line.
    • rust-tops-style (#42): check [--path] [--base] runs clippy for the lint rules and twelve Nushell probes, prints sorted JSON findings with the catalog's fix text, and keeps only changed lines with --base.
    • rust-tops-port (#44): inventory lists the original tests of a C, C++, Python, Go, JavaScript or TypeScript tree, and verify fails when an original test has no passing Rust counterpart. The catalog gains the port rule PORT-13.
    • rust-tops-review (#45): the new style command gives the style findings on the review range, and answers checks that every judgment rule was answered. files and diff are unchanged byte for byte.
    • Eval regression (#46): fixtures that check the skills against upstream's eval cases.
  • Verdict pack (protocol 1.3.0). Protocol file rename and wiring: #53.

    • Tidy-up (#49, #48): port inventory finds C and C++ tests outside tests/, answers prints relative paths, the skills share one command rule and one golden variable (RUST_TOPS_BLESS), the README pin table names Nushell and xtask docs guards it, the adopter nextest.toml carries no kit-only overrides, the init unsafe note is exact for the forbid fallback, and the toolchain-pin search walks up to the workspace or git root.
    • One report (#51): every cargo tops gate run writes <target>/rust-tops/report.json (schema schema/gate-report.schema.json) with per-layer verdicts, commands, tool versions and seconds, and the law verdicts. cases.json is still written for Bend.
    • Exit codes (#51): 0 pass; 1 the gate ran and failed (including a dry run and the short-command rule); 2 the config is invalid; 3 the environment (a required tool, or cargo metadata, is unavailable). Any non-zero exit still fails CI; the codes only say which kind.
    • Gate skill (#52): rust-tops-gate reads report.json, not cases.json.
    • Fixed tiers (#50): a layer's tier comes from its id (§3), and security-advisory moved from tier 5 to tier 0 so the default --max-tier 1 gate runs the advisory check. cargo tops check now fails an instance whose layer tier differs from the table, whose floor is looser than its class profile, or that disables a layer its class requires.
    • Protocol file rename (#53): RUST_TOPS.md is now PROTOCOL.md (§14.4 still requires each repo's root RUST-TOPS.md). A test fails if a tracked file other than this changelog names the old file.
  • Honest pack (protocol 1.4.0). The gate passes a layer only on evidence from the run.

    • Mutation base (#55): the diff starts at the merge base with --base <ref>, then gates.base_ref, then origin/HEAD. A missing base fails under CI (fix: fetch-depth: 0 and --base) and is vacuous otherwise, and the report names the base used.
    • Credited layers (#56): a credited property or acceptance layer passes only when the credited run's nextest JUnit report holds a passed test with a :: segment of its name starting with gates.<layer>.test_filter (default the layer id; letters, digits and underscore only). A layer that runs itself selects tests the same way, with -E 'test(/(^|::)<filter>/)' instead of a positional filter. acceptance now runs (it was NotRun). Fix for a failing layer: add a matching test, or set the filter.
    • Tidy-up (#54): the fresh-init test gets a nextest slow-timeout override, and the Bend script, its README and BEND2-INTEGRATION.md use neutral wording.
    • Exemptions and survivors (#57): an expired exemption, or one whose expires is not a real day, fails the gate with exit 1 whatever its layer, whether that layer is on, and whatever --max-tier; check prints it as a warning. The mutation layer reads cargo-mutants' outcomes.json and judges each missed mutant per function: only a live layer: mutation record whose symbol names the function and whose path covers the file explains it, and gates.mutation.unexplained_survivors_max always decides. A survivor outside any function is explained only by a record with no symbol. Fix for a failing run: kill the mutant, or add a dated record that names the function.
    • Tool pins (#59): every tool in rust-tops.lock that a running layer uses is checked against its pin, not only cargo-crap. A tool at another version fails its layer with the verdict tool-mismatch and exit 3 (the cargo-crap pin mismatch exited 1 before). A new cargo tops lock --verify checks the pins and --write rewrites them. Fix: install the pinned version, or run cargo tops lock --write and review the diff.
    • Enforcement map and protocol 1.4.0 (#60): schema/enforcement.json classes every schema key as judged or declarative, with the reading file for the judged ones, and cargo run -p xtask -- docs prints the ratio and fails when the README table disagrees. cargo tops version prints protocol 1.4.0. The schema changes are additive: gates.base_ref, gates.property.test_filter and the new gates.acceptance object with test_filter; the gate report gains the tool-mismatch verdict and the survivor and exemption detail.

    Behaviour changes in this group, each with its fix:

    • A CI run with no resolvable base now fails the mutation layer (it used to be a silent vacuous pass). Fix: fetch-depth: 0 and --base.
    • A credited property or acceptance layer now needs a matching passed test in the credited run. Fix: add one, or set test_filter.
    • An expired exemption of any layer now fails the gate. Fix: renew it with a reason, or remove it.
    • Mutation survivors are judged per function. Fix: name the function in the record's symbol; use the qualified form (§19).
    • A cargo-crap pin mismatch now exits 3, not 1, and every pinned tool is checked. Fix: install the pinned version.

Changed

  • The AGENTS.md template (and its copies) no longer calls the upstream review skill an optional style pass; rust-tops-review runs it.
  • .gitignore lists /mutants.out*, the output the gate's mutation layer leaves in the repository root.

Upgrade

  • cargo tops gate --base and cargo tops lock --verify require cargo-tops 0.5.0 (earlier releases reject --base with exit 2 and have no lock subcommand).
  • Protocol 1.3.0: set protocol.version: "1.3.0" (or "1.4.0"). cargo tops check now fails these, each with a message naming the file, key, class value and fix:
    • layers[id=<layer>].tier that differs from §3: set the table's tier or delete the key.
    • A floor looser than the class profile (gates.coverage.line_min_pct, region_min_pct, gates.crap.threshold_agent, threshold_human, gates.mutation.kill_rate_min_pct, unexplained_survivors_max) or a missing one: set the class value, or add a dated exemption for that layer with path: "**" and no symbol.
    • A disabled or absent security-advisory layer, or a layer your class requires: add it with enabled: true.
    • Links to RUST_TOPS.md break: use PROTOCOL.md.