Skip to content

test(kani): guard every command-error proof constructor (#12109) - #14588

Draft
EffortlessSteven wants to merge 3 commits into
mainfrom
fix/12109-command-error-proof-domain
Draft

EffortlessSteven wants to merge 3 commits into
mainfrom
fix/12109-command-error-proof-domain

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Close the command-error proof's constructor-drift gap under #12109. The old
u8 < 3 selector and catch-all arm could keep a passing proof after a new
CommandError variant was added, or after a constructor was omitted from the
symbolic domain. One declaration now generates the cases, a wildcard-free
compiler check, and per-input-variant covers. The existing production exit-code
method is unchanged.

Published head: 5163325ab13fbd3515916d1902967b468b6538fc. The complete Git tree is identical to local
qualified candidate 51d0396939d47bff9f467be55ae48f1d96454640, tree
b8a350bd197c7b3127e2f4c91af6d1247e318c30. Draft; the bounded source repair has been reviewed: exact
extracted-owner Rust tests, compiler-refusal controls, and isolated actual-item
native Kani positive / intended wrong-mapping / restored runs passed. The actual
ripr library's exact harness also passed under the supported custom Rust-only
feature profile in a separately admitted warm-cache run: 37 distinct properties,
all three input covers satisfied, and the actual model retained. The earlier cold
attempt timed out during compilation. Actual-package mutation/restoration,
default-profile registration, repository-native policy and protected integration
remain unexecuted on this candidate.

Swarm / Source Boundary

  • Internal proof maintenance in EffortlessMetrics/ripr-swarm.
  • Normal product mapping and user-visible exit behavior remain unchanged.

Source-of-truth Links

Proposal: the command-error finite-domain gap recorded in #12109's implementation
checkpoint, #12109 (comment).

Spec: docs/specs/RIPR-SPEC-0371-kani-bounded-model-checking-lane.md and the
literal mapping in docs/EXIT_CODES.md.

ADR: none; apply the existing constructor-domain discipline introduced by
#12975 without changing proof-engine or product architecture.

Plan item: #12109 / #12904 self-assurance, command-error exit obligation.

Governing issue or accepted claim: #12109; this bounded repair does not close
the programme.

Acceptance delta (one sentence): The command-error proof visits every declared
constructor using a compiler-checked domain, rejects missing or duplicate cases
and new variants at compilation, and compares the real production result with
the independently literal 2/3/130 table while covers remain tied to inputs.

Candidate Relationships

Candidate branch: fix/12109-command-error-proof-domain; the GitHub head is bound
to the identical local reviewed tree stated above.

Stack parent or prerequisite PR: #14469 at
172fe0e6965aae8ac2a901821079befe3de176d8. Its complete-cover admission and
constant-harness witness are retained. This child adds no runner change.

Proposed replacement of PR: none.

Acceptance retained from a replaced candidate: none replaced; the normal
CommandError::exit_code implementation and #14469 acceptance remain intact.

Accepted winner and losing candidate disposition: no competing domain repair
found. All-state exact-subject search returned only historical #11954; the
exit_kani.rs search returned #11954, #14469 and unrelated #13108. #14556 owns
registry governance and is not modified by this candidate.

Scope, oracle and maintenance

Six files, 102 additions and 13 deletions against #14469:

  • exit_proof_domain.rs owns the constructor declaration, generated exact
    match and input covers, with two ordinary tests.
  • exit_kani.rs selects from that domain's actual length and calls the normal
    production method; expected codes are literal data independent of that method
    and its constants.
  • cli/mod.rs includes the domain only under ordinary tests or Kani.
  • SPEC-0371, its existing traceability fragment and the changelog document the
    same bounded behavior.

The native domain retains empty String payloads. No claim is added about
message handling, command dispatch, process cleanup, receipt delivery or
whole-program correctness. Input covers are intentionally independent of the
observed exit code: a wrong mapping must fail the assertion while every
constructor can still be reached. Any future registry admission must use fresh
native property/cover identities and the appropriate generation; the aggregate
registry's old output-cover anchors must not be carried over as current evidence.

Changelog: changelog.d/12109-command-error-proof-domain.md, canonical
Internal / CI section marker, bullet and trailing issue reference checked
against changelog.d/README.md.

Qualification observed

Rust 1.95.0 (59807616e1fa2540724bfbac14d7976d7e4a3860), Linux x86-64.
To respect the unresolved full-product codegen resource boundary, qualification
compiled the exact production constant declarations, complete CommandError
enum and complete impl CommandError, together with the complete actual new
domain module. There are no replacement method bodies or mock enum variants in
the positive build. The wrapper's module/extraction boundary is explicit; this
is not a complete Cargo build of ripr or a native Kani result.

Case Observed result
Candidate original source Compiled with warnings denied; both actual domain tests passed, none filtered
Omit Decision constructor Compilation refused with E0004 at the generated domain match
Duplicate Decision constructor Compilation refused by deny(unreachable_patterns) at that match
Add an actual enum variant and update both production matches Compilation refused with E0004 at the domain match, rather than an incomplete production method
Omit Decision and remove the domain guard Both tests pass, demonstrating why the compiler guard is required
Change production Decision exit to the wrong nonzero value 2 Compiles; literal mapping test fails with actual 2 / expected 3; the other test passes
Exact original restored Both tests pass again; original source bytes unchanged

Strict direct Clippy on the exact positive extraction and Rustfmt checks on all
three affected Rust source files passed. git diff --check passed. The seven
control outcomes and source/binary hashes are retained in the qualification
receipt. The first isolated invocation omitted cfg(test) from its explicit
check-cfg list and failed before tests; that instrument setup failure is retained
separately and is not a behavioral red witness.

Native Kani 0.68.0 / CBMC 6.11.0 also ran the exact extracted production items
with both complete actual proof modules in a dependency-free isolated Cargo
package. Its required Rust runtime was the official bundle's exact
1.100.0-nightly (8925ea358 2026-08-20). All ordinary assertion, safety and
unwinding checks remained enabled; the command selected the exact harness with
default unwind 32 and regular, verbose output.

Native stage Exit Observed properties
Original candidate items 0 34 SUCCESS, 3 input covers SATISFIED
Production Decision mapping changed from 3 to 2 1 33 SUCCESS, 3 input covers SATISFIED, exactly 1 mapping assertion FAILURE
Exact original restored 0 34 SUCCESS, 3 input covers SATISFIED

The one failure is
cli::exit_kani::command_error_exit_code_total_and_matches_table.assertion.2,
the code == *expected assertion at exit_kani.rs:33. The nonzero assertion
remains successful in the mutant. Native covers are
cli::exit_proof_domain::cover_command_errors.cover.1, .cover.2 and .cover.3,
with distinct Failure, Decision and Interrupted descriptions. They share macro
invocation location exit_proof_domain.rs:31; the reviewed identities and
descriptions distinguish the inputs. No failed unsupported or unwinding check,
and no UNDETERMINED or UNREACHABLE result, appears among the 37 reported
properties per stage.
Repository source bytes are unchanged and the isolated source is restored.

This is actual Kani execution over exact production items and the actual proof
modules, with an explicit extraction/module boundary. It is not execution of the
full ripr Cargo package, admission of a registered assurance claim, or proof of
receipt authentication or publication authority. Raw output and every native
property are retained with source and transcript hashes. Native receipt SHA-256:
d524525f89a31e63832f4f6985d50989bec36a501d47f358b4f0db3437c98c7e;
reviewed-property receipt SHA-256:
2996493a55da549db144b9159a123655a782215c40cb46c4faed76daad74dff9.

The actual-package attempts used this exact command:

cargo kani --manifest-path Cargo.toml -p ripr --lib \
  --no-default-features --features lang-rust \
  --harness cli::exit_kani::command_error_exit_code_total_and_matches_table \
  --exact --default-unwind 32 --output-format regular --verbose

The existing manifest and library explicitly support this Rust-only product
profile. It differs from the default Rust/TypeScript/Python feature set and does
not inherit a default-profile claim. With one job and incremental compilation
disabled, the cold dependency graph and ripr-contract compiled, and the final
ripr library invocation began. The independent 600-second outer deadline then
sent SIGTERM to its owned process group; the command returned -15 and the controller
was terminal after 605.422 seconds. There were no native properties or model,
no observed compiler error, and no Kani reachability/codegen-completion message.
The last partial artifacts include dep-info and an unpublished temporary Rust
metadata file; they are not a completed ripr artifact or proof witness.

The dedicated target ended at 394,641,822 bytes against a 2 GiB ceiling. Sampled
available memory stayed above 3.76 GB and free disk above 51.40 GB; no storage or
memory guard triggered. Source and Cargo.lock bytes are unchanged, and Git
status is clean. This is incomplete compilation, separate from the intended
semantic negative witnessed in the isolated trio. Cold-attempt receipt SHA-256:
ac28fb247a111a8f991fd0be6f65d6e35b8ae46cd78eaadd045735066cfbc074.

A separately admitted warm attempt reused that mutable dependency cache after
recording all 1,352 cache files (394,641,822 bytes) and their hashes. It used the
same exact source, command, feature profile, tool homes, one-job/incremental-zero
settings and independent 600-second/resource bounds. The actual native command
finished normally with exit 0 in 369.557 seconds; the complete controller,
including cache inventory and readback, finished in 385.337 seconds.

All 37 distinct actual-package properties were read back: 34 SUCCESS and
three SATISFIED input covers. The exact table assertion .assertion.2 and the
nonzero assertion .assertion.3 passed at crates/ripr/src/cli/exit_kani.rs.
Each Failure/Decision/Interrupted input cover has its own native property ID
and description at crates/ripr/src/cli/exit_proof_domain.rs:31:1. There were
no failed, unreachable, or undetermined properties. Four completed actual
harness model files totaling 89,087 bytes were copied and hash-verified.

The warm controller verified Linux child-subreaper ownership before launching
Kani and recorded the main command reaped at exit 0 with an empty in-session
owned descendant/group census before and after cleanup. It required no process
termination. The dedicated target finished at 535,302,208 bytes; minimum sampled
available memory was 2,112,892,928 bytes and free disk 52,096,086,016 bytes.
Source, Cargo.lock, head and tree stayed unchanged; the worktree remains clean.
Warm actual-package receipt SHA-256:
c46a8b2ccf55ab2db1e154d9e9f51d781780554c03cf68b05912b9e03722ee2e.

This closes the actual-package positive gap for the custom Rust-only profile.
It does not establish a package-level intended-mutant/restored pair, the default
Rust/TypeScript/Python profile, registered assurance admission, shared producer/
parser replay, or authenticated publication. The isolated native 0/1/0 sequence
retains its explicit extraction boundary. No further package run or mutation
was attempted automatically.

Not run: ordinary full ripr Cargo tests/build, check-fast, precommit,
repository-native policy and protected combined-tree qualification. The narrow
Clippy invocation is not the workspace Clippy gate. Compilation refusal is the
intended enum-domain control, separate from the native functional counterexample
above.

Next proof and delivery route

  1. Preserve the isolated exact-item native 0/1/0 sequence and the distinct actual
    custom-profile package positive. Any package-level mutation/restoration needs
    its own bounded admission; it has not been executed or inferred from the
    isolated run.
  2. Qualify the applicable repository gates and protected combined tree through
    the admitted hosted route once the prerequisite composition is ready.
  3. Rebind any future command-error registration to these actual input covers
    through the existing registry owner, with its own exact source/configuration
    and artifact custody. A custom-profile package pass does not inherit the
    default profile or acquire authentication/execution authority.

Rollback

Revert these six files as one ordinary change. The earlier production exit map
is untouched, and the original harness remains available in the parent. Do not
reuse evidence from this constructor-domain generation for a reverted harness.

Authorship: Codex authored this candidate; authenticated connector metadata,
if used for publication, records publication identity rather than manual authoring.

Current source inspection

reviewed_head_sha: 5163325ab13fbd3515916d1902967b468b6538fc; exact tree b8a350bd197c7b3127e2f4c91af6d1247e318c30.
integration_basis: #14469 at 172fe0e6965aae8ac2a901821079befe3de176d8.

The complete six-file change, unchanged production CommandError mapping, its
consumers, literal EXIT_CODES contract, generated constructor guard, input
covers, ordinary oracle tests, SPEC-0371 and traceability were reviewed. The
omitted/new/duplicate cases and wrong-production-mapping controls discriminate
the intended failures. Independent readback verified all 37 actual-package
properties, all three constructor covers, four retained model hashes and
terminal owned-process cleanup. No unresolved material source finding remains.

Source conclusion: SOURCE_REVIEW_READY for this bounded constructor-domain
repair. Overall merge review: REVIEW_INCOMPLETE pending required repository
policy and protected integration evidence. The actual-package positive applies
to the explicit Rust-only profile; mutation/restoration applies to the exact-item
extraction. Neither promotes a canonical registry claim or proves whole-program
behavior. No required check has been waived and no CI request is made here.

Add the exact fixture exception with its owner, purpose and retained replay controls. Production and proof bytes are unchanged.

Authored-by: Codex <codex@openai.com>
Local-source-equivalent: 53b16e3bec5bf2ca77a74ced3996fca630a3da6e
Generate the symbolic inputs, exhaustive guard and input covers from one declaration while retaining the literal exit-code oracle.

Authored-by: Codex
Local-source-equivalent: 51d0396939d47bff9f467be55ae48f1d96454640
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 143 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: dc790070-4fc7-4e7a-86f0-559b8672ada9
Commits

Reviewing files that changed from the base of the PR and between a088ab4 and 5163325.

Files selected for processing: 34

  • .gitattributes
  • .ripr/traceability.d/12470-kani-process-integration.toml
  • .ripr/traceability.d/kani-bounded-model-checking-lane.toml
  • changelog.d/12109-command-error-proof-domain.md
  • changelog.d/14460-kani-cover-evidence.md
  • crates/ripr/src/bounded_input_kani.rs
  • crates/ripr/src/cli/exit_kani.rs
  • crates/ripr/src/cli/exit_proof_domain.rs
  • crates/ripr/src/cli/mod.rs
  • crates/ripr/src/domain/repair_card/kani_proofs.rs
  • crates/ripr/src/lsp/refresh_scheduler/kani_proofs.rs
  • docs/CI.md
  • docs/specs/RIPR-SPEC-0371-kani-bounded-model-checking-lane.md
  • policy/non-rust-allowlist.toml
  • xtask/src/kani_lane.rs
  • xtask/tests/fixtures/kani-cover-evidence/README.md
  • xtask/tests/fixtures/kani-cover-evidence/cover-fail.rs.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-fail.stderr.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-fail.stdout.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-pass-compact.rs.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-pass-compact.stderr.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-pass-compact.stdout.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-undetermined-compact.rs.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-undetermined-compact.stderr.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-undetermined-compact.stdout.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-unreachable.rs.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-unreachable.stderr.txt
  • xtask/tests/fixtures/kani-cover-evidence/cover-unreachable.stdout.txt
  • xtask/tests/fixtures/kani-cover-evidence/no-cover.rs.txt
  • xtask/tests/fixtures/kani-cover-evidence/no-cover.stderr.txt
  • xtask/tests/fixtures/kani-cover-evidence/no-cover.stdout.txt
  • xtask/tests/fixtures/kani-cover-evidence/provenance.json
  • xtask/tests/fixtures/kani-cover-evidence/tool-version.txt
  • xtask/tests/kani_lane_process.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOURCE_REVIEW_READY

Reviewed the complete six-file constructor-domain repair at 5163325ab13fbd3515916d1902967b468b6538fc, tree b8a350bd197c7b3127e2f4c91af6d1247e318c30, identical to qualified local source 51d0396939d47bff9f467be55ae48f1d96454640 over #14469 at 172fe0e6965aae8ac2a901821079befe3de176d8.

The unchanged production exit mapping is checked against independently literal 2/3/130 expectations. The generated wildcard-free guard refuses omitted, duplicated and newly added constructors; removing that guard permits the intentional omission. Native Kani over the exact production items records positive / wrong-mapping / restored exits 0/1/0, with every constructor cover satisfied and the single intended mapping assertion detecting the mutation. The actual ripr library's exact harness separately passed under the explicit Rust-only profile with 34 successful properties and all three covers satisfied. Four retained model hashes and owned-process completion were independently read back.

The source, ordinary/Kani oracles, specification, traceability and changelog agree. No unresolved material source finding remains. This is a bounded source attestation; the detailed PR body retains the distinct extraction/custom-profile scopes, earlier compilation timeout, assumptions and protected-integration requirements.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a robust constructor-domain discipline for CommandError exit proofs and tests by defining a new exit_proof_domain module. It replaces hardcoded matches in exit_kani.rs with a macro-generated domain that enforces compile-time exhaustiveness and unreachable pattern checks, alongside adding unit tests and updating Kani traceability configurations. The review feedback suggests a minor improvement to the macro's exhaustiveness check, recommending the use of an anonymous constant block instead of a closure coercion to a function pointer to ensure better compatibility with older Rust compiler versions.

Comment on lines +17 to +22
const _: fn(&CommandError) = |error| {
#[deny(unreachable_patterns)]
match error {
$(CommandError::$variant(_) => (),)+
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Using a closure coercion to a function pointer in a const item can be less portable across older Rust compiler versions (MSRV). A more idiomatic and widely compatible way to perform compile-time exhaustiveness and unreachable pattern checks is to use an anonymous constant block (const _: () = { ... }) containing a helper function.

Suggested change
const _: fn(&CommandError) = |error| {
#[deny(unreachable_patterns)]
match error {
$(CommandError::$variant(_) => (),)+
}
};
const _: () = {
#[deny(unreachable_patterns)]
fn _assert_exhaustive(error: &CommandError) {
match error {
$(CommandError::$variant(_) => (),)+
}
}
};

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Coordination note (evidence-only reviewer): this branch is now conflicted with main (mergeStateStatus=DIRTY at sweep time; main is at 5ba252eede). Any review markers on this PR were scoped to their exact heads and stay valid only as evidence for those trees. A rebase/restack restarts review: push the rebased head (my push watch picks it up) and the native-Windows evidence lane will re-run at the new head before a fresh marker posts. No defect is asserted — this is a landing-order state, not a code finding.

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