fix(fuse): kill cargo-mutants 27.1.0 struct-field survivors - #727
fix(fuse): kill cargo-mutants 27.1.0 struct-field survivors#727KooshaPari wants to merge 6 commits into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
📝 WalkthroughSummaryThis PR centralizes It adds no-mount tests for Verification reports 257 mutants, 222 caught, 35 unviable, and 0 missed. The Must FixNone identified. Should FixNone identified. ConsiderThe documentation explains why live-kernel-dependent mount entry points remain excluded. It also records no-mount coverage for registry operations and Approve / Request ChangesApprove. The PR fixes the missed mutants, improves shared mount-option handling, adds targeted regression coverage, and preserves the public API. WalkthroughThe Fuse session registry now centralizes mount option construction and entry resolution. It adds no-mount registry tests, platform-specific mutation triage, and separate default CoW roots for enabled and disabled modes. ChangesFuse session registry and CoW behavior
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant resolve_fs
participant FuseSessionRegistry
participant resolve_entry
resolve_fs->>resolve_entry: resolve mountpoint or sole registry entry
resolve_entry->>FuseSessionRegistry: inspect registered sessions
FuseSessionRegistry-->>resolve_entry: entry or empty/ambiguous error
resolve_entry-->>resolve_fs: resolved filesystem entry
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| pub(crate) fn session_mount_options(session_id: &str) -> FuseMountOptions { | ||
| FuseMountOptions { session_id: Some(session_id.to_string()), ..Default::default() } |
There was a problem hiding this comment.
Suggestion: On Windows, these default options are passed to CowMountHandle::from_options, which derives an unset cow_dir as backing/.sharecli-cow, even when CoW is disabled. The Unix implementation derives backing/.sharecli-cow-staging for the same options, so equivalent session mounts expose and operate on different staging roots across platforms. Set the platform-independent non-CoW default explicitly or make the Windows implementation follow the documented InterceptFsOptions contract. [api mismatch]
Severity Level: Major ⚠️
- ⚠️ Windows and Unix mounts expose different default staging roots.
- ⚠️ Commit/discard operations target platform-specific directories.
- ⚠️ Existing staging data is not portable across supported platforms.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** crates/sharecli-fuse/src/session_registry.rs
**Line:** 136:137
**Comment:**
*Api Mismatch: On Windows, these default options are passed to `CowMountHandle::from_options`, which derives an unset `cow_dir` as `backing/.sharecli-cow`, even when CoW is disabled. The Unix implementation derives `backing/.sharecli-cow-staging` for the same options, so equivalent session mounts expose and operate on different staging roots across platforms. Set the platform-independent non-CoW default explicitly or make the Windows implementation follow the documented `InterceptFsOptions` contract.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fixThere was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/sharecli-fuse/mutants.toml`:
- Around line 28-32: Update the FuseSessionRegistry exclusion in mutants.toml so
it covers only methods that require a live FUSE mount, preserving mutation
coverage for list, resolve_fs, and unmount’s no-registration path.
Alternatively, add unit tests for those no-mount paths and retain them in the
examine set, while keeping the existing session_mount_options handling
unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 46b05b8e-5d8c-4e29-b2f7-1a4d463db97f
📒 Files selected for processing (3)
crates/sharecli-fuse/mutants.tomlcrates/sharecli-fuse/src/session_registry.rsdocs/ops/mutants-hard-gate.md
📜 Review details
⏰ Context from checks skipped due to timeout. (31)
- GitHub Check: Guardrail (nextest)
- GitHub Check: Loom (sharecli-sync)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Lint & Format
- GitHub Check: test
- GitHub Check: macos_native (macos-latest)
- GitHub Check: lint
- GitHub Check: fuse-smoke-runner unit
- GitHub Check: linux_container (ubuntu-24.04)
- GitHub Check: dashboard keyboard Tab-cycle
- GitHub Check: linux_native (ubuntu-24.04)
- GitHub Check: live pool probe (soft)
- GitHub Check: windows_winfsp (windows-latest)
- GitHub Check: codeql
- GitHub Check: SAST Analysis
- GitHub Check: Dependency Audit
- GitHub Check: cargo bench (gate)
- GitHub Check: hyperfine healthz (soft)
- GitHub Check: Unit Tests
- GitHub Check: cargo bench (soft)
- GitHub Check: coverage
- GitHub Check: Reproducible build (L52)
- GitHub Check: Offline check after fetch (soft)
- GitHub Check: Offline build after fetch (soft)
- GitHub Check: dashboard PNG hard diff
- GitHub Check: healthz soak (soft)
- GitHub Check: healthz load burst (soft)
- GitHub Check: Mergify Merge Protections
- GitHub Check: Summary
- GitHub Check: linux_native (ubuntu-24.04)
- GitHub Check: windows_winfsp (windows-latest)
🧰 Additional context used
📓 Path-based instructions (3)
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use UTF-8 encoding for all text files; do not use Windows-1252 smart quotes or other special characters.
Use UTF-8 for all text files.
Files:
crates/sharecli-fuse/mutants.tomlcrates/sharecli-fuse/src/session_registry.rsdocs/ops/mutants-hard-gate.md
**/*.{rs,toml}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,toml}: Use Rust edition 2021 and the pinned toolchain fromrust-toolchain.toml; keep code compatible with the configured stable compiler, rustfmt, and clippy.
Ensure Rust code passes formatting, clippy with-D warnings, and the locked all-features test suite; CI usesRUSTFLAGS=-D warnings.
UsePascalCasefor Rust types,snake_casefor functions, methods, and modules, andSCREAMING_SNAKE_CASEfor constants.
Files:
crates/sharecli-fuse/mutants.tomlcrates/sharecli-fuse/src/session_registry.rs
**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
Use Rust for the project and validate Rust changes with Cargo build, Cargo test, and Cargo clippy.
**/*.rs: For new Rust modules, create the test file before the implementation; for bug fixes, write a failing test before the fix; for refactors, ensure existing tests pass before and after.
Use idiomatic, language-appropriate error handling, never useunwraporexpectin production Rust code, and log all errors with structured logging.
Files:
crates/sharecli-fuse/src/session_registry.rs
🔇 Additional comments (2)
crates/sharecli-fuse/src/session_registry.rs (1)
130-139: LGTM!Also applies to: 206-207, 229-230, 315-316, 326-327, 600-614
docs/ops/mutants-hard-gate.md (1)
108-112: LGTM!
Quality Gate Report✅ Unit Tests: PASSED |
Code Review SummaryStatus: 1 Issue Found | Recommendation: Merge with notes Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (1 file)
Fix these issues in Kilo Cloud Previous Review Summaries (2 snapshots, latest commit 3195caf)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 3195caf)Status: No Issues Found | Recommendation: Merge Overview
Files Reviewed (4 files)
Previous review (commit 17556ec)Status: No Issues Found | Recommendation: Merge Files Reviewed (6 files)
Reviewed by step-3.7-flash · Input: 66.4K · Output: 15K · Cached: 434.7K |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/sharecli-fuse/mutants.toml`:
- Around line 26-36: Replace the non-ASCII “≥27” comparison with the ASCII form
“>= 27” in the explanatory comment at crates/sharecli-fuse/mutants.toml lines
26-36 and the corresponding documentation at docs/ops/mutants-hard-gate.md lines
104-117; make no other changes.
In `@crates/sharecli-fuse/src/session_registry.rs`:
- Around line 547-560: In the single-mount branch of
FuseSessionRegistry::resolve_entry, replace mounts.values().next().expect("one
mount") with a non-panicking anyhow error path while preserving the existing
Result behavior. Do not add logging unless resolve_fs introduces a production
boundary that handles and logs these errors.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 779b07eb-83c8-46ce-b2d4-56e7818818a1
📒 Files selected for processing (4)
crates/sharecli-fuse/mutants.tomlcrates/sharecli-fuse/src/cow_session.rscrates/sharecli-fuse/src/session_registry.rsdocs/ops/mutants-hard-gate.md
📜 Review details
⏰ Context from checks skipped due to timeout. (29)
- GitHub Check: Rust
- GitHub Check: OSV / GHSA lockfile scan (required)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: cargo bench (gate)
- GitHub Check: hyperfine healthz (soft)
- GitHub Check: cargo bench (soft)
- GitHub Check: Lint & Format
- GitHub Check: SAST Analysis
- GitHub Check: axe dashboard (WCAG 2.x Level A)
- GitHub Check: Reproducible build (L52)
- GitHub Check: test
- GitHub Check: lint
- GitHub Check: dashboard PNG hard diff
- GitHub Check: windows_winfsp (windows-latest)
- GitHub Check: Dependency Audit
- GitHub Check: linux_native (ubuntu-24.04)
- GitHub Check: live pool probe (soft)
- GitHub Check: healthz soak (soft)
- GitHub Check: healthz load burst (soft)
- GitHub Check: codeql
- GitHub Check: coverage
- GitHub Check: Offline build after fetch (soft)
- GitHub Check: Unit Tests
- GitHub Check: Offline check after fetch (soft)
- GitHub Check: Kilo Code Review
- GitHub Check: Mergify Merge Protections
- GitHub Check: Summary
- GitHub Check: windows_winfsp (windows-latest)
- GitHub Check: linux_native (ubuntu-24.04)
🧰 Additional context used
📓 Path-based instructions (3)
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use UTF-8 encoding for all text files; do not use Windows-1252 smart quotes or other special characters.
Use UTF-8 for all text files.
Files:
crates/sharecli-fuse/src/cow_session.rscrates/sharecli-fuse/mutants.tomldocs/ops/mutants-hard-gate.mdcrates/sharecli-fuse/src/session_registry.rs
**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
Use Rust for the project and validate Rust changes with Cargo build, Cargo test, and Cargo clippy.
**/*.rs: For new Rust modules, create the test file before the implementation; for bug fixes, write a failing test before the fix; for refactors, ensure existing tests pass before and after.
Use idiomatic, language-appropriate error handling, never useunwraporexpectin production Rust code, and log all errors with structured logging.
Files:
crates/sharecli-fuse/src/cow_session.rscrates/sharecli-fuse/src/session_registry.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,toml}: Use Rust edition 2021 and the pinned toolchain fromrust-toolchain.toml; keep code compatible with the configured stable compiler, rustfmt, and clippy.
Ensure Rust code passes formatting, clippy with-D warnings, and the locked all-features test suite; CI usesRUSTFLAGS=-D warnings.
UsePascalCasefor Rust types,snake_casefor functions, methods, and modules, andSCREAMING_SNAKE_CASEfor constants.
Files:
crates/sharecli-fuse/src/cow_session.rscrates/sharecli-fuse/mutants.tomlcrates/sharecli-fuse/src/session_registry.rs
🔇 Additional comments (2)
crates/sharecli-fuse/src/cow_session.rs (1)
32-38: LGTM!Also applies to: 214-236
crates/sharecli-fuse/src/session_registry.rs (1)
206-230: LGTM!Also applies to: 315-327, 475-485, 646-793
| # * FuseSessionRegistry mount entry points (mount_background/_with, | ||
| # mount_foreground/_with, mount_inner, mount_winfsp, all platform | ||
| # variants) + with_context_mount — mounting can only be exercised through | ||
| # a live mount (no /dev/fuse on the lane); the cfg(windows) twins are | ||
| # unobservable on the Linux-only lane. The no-mount registry surface | ||
| # (global, normalize_key, list, resolve_fs, unmount's no-registration | ||
| # path) is NOT excluded: it is covered by registry_no_mount_tests, and | ||
| # the mount entry points share the pure `session_mount_options` helper | ||
| # whose struct-literal `delete field` mutants are caught by a unit test | ||
| # (cargo-mutants >= 27 pushes `delete field` mutants past exclude_re, | ||
| # so keep such literals in testable helpers). |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Replace non-ASCII comparison symbols.
crates/sharecli-fuse/mutants.toml#L26-L36: Replace≥27with>= 27.docs/ops/mutants-hard-gate.md#L104-L117: Replace≥27with>= 27.
As per coding guidelines, use UTF-8 text files but “do not use Windows-1252 smart quotes or other special characters.”
📍 Affects 2 files
crates/sharecli-fuse/mutants.toml#L26-L36(this comment)docs/ops/mutants-hard-gate.md#L104-L117
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/sharecli-fuse/mutants.toml` around lines 26 - 36, Replace the
non-ASCII “≥27” comparison with the ASCII form “>= 27” in the explanatory
comment at crates/sharecli-fuse/mutants.toml lines 26-36 and the corresponding
documentation at docs/ops/mutants-hard-gate.md lines 104-117; make no other
changes.
Source: Coding guidelines
Quality Gate Report✅ Unit Tests: PASSED |
Quality Gate Report✅ Unit Tests: PASSED |
1 similar comment
Quality Gate Report✅ Unit Tests: PASSED |
KooshaPari
left a comment
There was a problem hiding this comment.
resolve pending review
Quality Gate Report✅ Unit Tests: PASSED |
The Mutation Testing lane installs the latest cargo-mutants (27.1.0) and examines 261 fuse mutants, missing 6: the new \delete field\ operator targets the FuseMountOptions literals in the mount entry points and is pushed straight into the examine set, bypassing exclude_re (visit.rs pushes StructField mutants without the allows_mutant filter). Fix by extracting the shared \session_mount_options\ helper so the session-id wiring is unit-testable without a live mount: - the four platform entry points (Linux/macOS + Windows variants) now share one literal; the redundant \serialize: true\ (already the Default) is dropped, eliminating the equivalent mutants; - the remaining \delete field session_id\ mutant is caught by \session_mount_options_pins_session_id\. Local parity run (cargo-mutants 27.1.0, --timeout 60 --jobs 8, same config): 257 mutants, 222 caught, 35 unviable, 0 missed.
Addresses the PR 727 review:
- mutants.toml: narrow the FuseSessionRegistry exclusion from the whole
impl to the mount-bound entry points only
("replace FuseSessionRegistry::mount_" / "delete ! in
FuseSessionRegistry::mount_"). FnValue mutant names embed the function
without an "in <fn>" suffix, so the broad "FuseSessionRegistry::"
pattern silently excluded testable methods: global, normalize_key,
list, resolve_fs, and unmount's no-registration path now stay in the
examine set. The cfg(windows) / other-platform resolve_fs twins are
excluded by return type (unobservable on the Linux-only lane).
- session_registry.rs: new resolve_entry helper shared by the Unix and
WinFsp resolve_fs paths gives the no-mount resolution contract one
tested implementation (also removes the platform-twin == mutants). New
registry_no_mount_tests populates the registry directly to exercise
global (singleton identity), normalize_key (fallback + canonical),
list (empty + registered), resolve_fs (empty/sole/by-mountpoint/
multiple), and unmount (unregistered errors) without a live mount.
- cow_session.rs: CowMountHandle::from_options now derives the CoW root
per the documented InterceptFsOptions contract (.sharecli-cow when cow,
else .sharecli-cow-staging), matching the Unix InterceptFs path instead
of always using .sharecli-cow (WinFsp divergence flagged in review);
covered by cow_handle_default_root_follows_documented_contract.
Local parity run (cargo-mutants 27.1.0, --timeout 60 --jobs 8): 266
mutants, 228 caught, 38 unviable, 0 missed.
cargo fmt with stable 1.96.0 to match the ci-gate toolchain (FuseMountEntry literal, err().expect and multi-assert reflows).
cbc2b30 to
3195caf
Compare
Quality Gate Report❌ Unit Tests: FAILED |
2 similar comments
Quality Gate Report❌ Unit Tests: FAILED |
Quality Gate Report❌ Unit Tests: FAILED |
Resolved via branch updates
The auto-commit daemon's 67bfcad dropped the Ok(...) wrapper around the ok_or_else(...)? expression, so the None arm yields &V while the Some arm yields anyhow::Result<&V> (E0308, ci-gate test failure) and its one-line reflow tripped rustfmt. Restore the wrapped form with the short message matching the empty-registry variant; the single-mount arm stays non-panicking as CodeRabbit requested.
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
| } | ||
| None => match mounts.len() { | ||
| 0 => anyhow::bail!("fuse: no active FUSE mounts registered (run `fuse mount` first)"), | ||
| 1 => Ok(mounts |
There was a problem hiding this comment.
SUGGESTION: Redundant Ok()? pattern
mounts.values().next().ok_or_else(...) already returns Result<&V, anyhow::Error>. Wrapping it in Ok(...)? unwraps the Result with ? only to re-wrap it immediately. The match arm can return the Result directly without Ok() and without ?.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Quality Gate Report✅ Unit Tests: PASSED |
Recreates the reviewed-and-validated #727 fix (closed without merging) as a fresh change on current main. The Mutation Testing hard gate has been red on every main push since #722: cargo-mutants 27.1.0's new `delete field` mutants bypass exclude_re, leaving 6 survivors in the FuseMountOptions struct literals of the mount entry points. - Extract session_mount_options(session_id) pure helper shared by all four mount entry points; drop the redundant `serialize: true` (already the Default), eliminating the equivalent mutants. - Narrow mutants.toml exclusions to the genuinely mount-bound mount_* entry points (genre-aware regexes) and cover the no-mount registry surface (global, normalize_key, list, resolve_fs, unmount) with the new registry_no_mount_tests module via the shared resolve_entry resolver. - Align CowMountHandle::from_options with the documented contract: derive {backing}/.sharecli-cow when cow, else .sharecli-cow-staging. - resolve_entry single-mount arm is non-panicking (ok_or_else path). Verified: 266 mutants, 228 caught, 38 unviable, 0 missed (cargo-mutants 27.1.0); 51 lib tests; fmt + cargo check clean. FR reference: FR-003 (mutants hard gate), FR-009 (FUSE IO Intercept)
Recreates the reviewed-and-validated #727 fix (closed without merging) as a fresh change on current main. The Mutation Testing hard gate has been red on every main push since #722: cargo-mutants 27.1.0's new `delete field` mutants bypass exclude_re, leaving 6 survivors in the FuseMountOptions struct literals of the mount entry points. - Extract session_mount_options(session_id) pure helper shared by all four mount entry points; drop the redundant `serialize: true` (already the Default), eliminating the equivalent mutants. - Narrow mutants.toml exclusions to the genuinely mount-bound mount_* entry points (genre-aware regexes) and cover the no-mount registry surface (global, normalize_key, list, resolve_fs, unmount) with the new registry_no_mount_tests module via the shared resolve_entry resolver. - Align CowMountHandle::from_options with the documented contract: derive {backing}/.sharecli-cow when cow, else .sharecli-cow-staging. - resolve_entry single-mount arm is non-panicking (ok_or_else path). Verified: 266 mutants, 228 caught, 38 unviable, 0 missed (cargo-mutants 27.1.0); 51 lib tests; fmt + cargo check clean. FR reference: FR-003 (mutants hard gate), FR-009 (FUSE IO Intercept)



User description
Summary
The Mutation Testing main-push lane (ec353cb) failed: cargo-mutants 27.1.0 examines 261 fuse mutants and missed 6 \delete field\ mutants on the \FuseMountOptions\ literals in the mount entry points.
Root cause (cargo-mutants 27.1.0): the new \delete field\ operator targets struct literals with a ..base\ and \�isit_expr_struct\ pushes those mutants directly into the examine set, bypassing \�llows_mutant\ — so \�xclude_re\ cannot exclude them (the existing \FuseSessionRegistry::\ pattern silently stops matching for this genre).
Fix:
Verification
FR reference: FR-003 (mutants hard gate), FR-009 (FUSE IO Intercept).
CodeAnt-AI Description
Align FUSE session behavior across platforms and validate registry handling without live mounts
What Changed
.sharecli-cow, while non-CoW mounts use.sharecli-cow-stagingby default on every platform.Impact
✅ Consistent CoW directories across platforms✅ Session IDs preserved on every mount✅ Clearer errors for missing or ambiguous mounts💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.