Skip to content

clippy::collapsible_match fails quality:fix on main (live_resolve_query_decomposition_shapes.rs) #2259

Closed

Description

@mstomar125

bun run quality:fix exits 101 on a clean main checkout. rust:lint (cargo clippy --all-targets -- -D warnings) rejects a nested if inside a match arm in a test file:

error: this `if` can be collapsed into the outer `match`
   --> packages/agent/tests/live_resolve_query_decomposition_shapes.rs:326:17
    = note: `-D clippy::collapsible-match` implied by `-D warnings`

Scope

Pre-existing on main (5c4f3cba) and unrelated to any open branch — the file was last touched by #2186 and is not in the diff of any PR currently open. Surfaced while running the mandatory quality:fix step on PR #2257; deliberately not fixed there to keep that diff to its own subject.

Why it appears now

The lint is clippy::collapsible_match, which the installed toolchain (rustc 1.95.0) applies to a match arm whose body is a single if. Nothing in the file changed; the toolchain did.

Effect

quality:fix cannot exit 0 on any branch until this is fixed, so every PR's mandatory quality step reports a failure that has nothing to do with its own changes. The pre-push gate is unaffected (it runs test:all + cargo build + test:e2e, not clippy), so this blocks the workflow step rather than the push.

Fix

Apply the suggested collapse (a match guard on the Some("prompt") arm), or cargo clippy --fix --test live_resolve_query_decomposition_shapes -p nodespace-agent. Test-only file; no production behaviour involved.

Activity

  1. mstomar125 commented on Aug 25, 2026

    @mstomar125
    ContributorAuthor

    Verified: no longer reproduces on current main. Already fixed in passing by #2258 — closing, no PR raised.

    Reproduction attempt

    Isolated worktree off main @ 5ad3cd68, on the same toolchain named in the report (rustc 1.95.0 (59807616e 2026-04-14) / clippy 0.1.95):

    $ cargo clippy --all-targets -- -D warnings -D clippy::unused-async
        Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 15s
    EXIT=0
    

    Zero errors across all nine workspace members. --all-targets did reach the named target rather than skipping it — the run produces target/debug/deps/liblive_resolve_query_decomposition_shapes-*.rmeta, so live_resolve_query_decomposition_shapes.rs was genuinely linted and is clean.

    Why it stopped reproducing

    The reported code was fixed incidentally by #2258 (1ef49eb5), which merged after this issue was filed. At 5c4f3cba — the commit this report names — decomposition_responses had exactly the shape described, with the nested if at the reported line:

    match v.get("kind").and_then(Value::as_str) {
        Some("prompt") => {
            if v.get("prompt")
                .and_then(Value::as_str)
                .is_some_and(|p| p.contains(DECOMP_MARKER))
            {
                decomp_seqs.push(seq);
            }
        }

    1ef49eb5 replaced it with the match-guard form:

    match v.get("kind").and_then(Value::as_str) {
        Some("prompt")
            if v.get("prompt")
                .and_then(Value::as_str)
                .is_some_and(|p| p.contains(DECOMP_MARKER)) =>
        {
            decomp_seqs.push(seq);
        }

    That is precisely the remedy this issue's Fix section prescribes ("apply the suggested collapse (a match guard on the Some("prompt") arm)"), so there is nothing left to change — a PR here would carry an empty diff. Behaviour is identical either way: a "prompt" record whose text lacks DECOMP_MARKER fell through to no-op before and now falls through to the _ => {} arm.

    Separate finding, not fixed here

    While reproducing, cargo clippy --all-targets failed twice in a fresh worktree for reasons unrelated to any lint — both are git-ignored build inputs that a new worktree does not inherit, and both abort nodespace-app's build script before a single lint runs:

    1. resource path 'binaries/nodespaced-aarch64-apple-darwin' doesn't exist — the Tauri sidecars (externalBin).
    2. glob pattern resources/skill/**/* path not found or didn't match any files. — needs bun run build:skill.

    So the observation in this issue's Effect section ("quality:fix cannot exit 0 on any branch") still holds in a fresh worktree, just for these two bootstrap reasons rather than for a lint. Worth its own issue if we want quality:fix to be runnable in a clean worktree without manual priming; recording it here so it isn't lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions