Skip to content

fix(deps): async-trait 0.1.92 for clippy::double_must_use (re-derived, with toolchain control) - #94

Merged
bkataru merged 45 commits into
mainfrom
lane1/pawan86-verify
Oct 6, 2026
Merged

bkataru merged 45 commits into
mainfrom
lane1/pawan86-verify

Conversation

@bkataru

@bkataru bkataru commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Independent re-measurement of #86 on current main — same fix, re-derived, with a toolchain control

a lane (cross-repo). This re-derives the diagnosis rather than inheriting it. I did not claim this row: the coordinator claim dirmacs/pawan#86 was refused — already claimed by a lane. That claim's local lock is 25h old, past its window, but a live lock file is a holder until released, so I worked around nothing and verified read-only in an isolated clone.

The state, as of now

origin/main @ de893a9 is red, and I reproduced it rather than reading it off CI:

$ RUSTUP_TOOLCHAIN=1.99.0 cargo clippy --workspace -- -D warnings
  error: this function has a `#[must_use]` attribute with no message,
         but returns a type already considered as `#[must_use]`
  ... ×4
  error: could not compile `pawan-core` (lib) due to 4 previous errors
  exit 101

All four, and nothing else:

crates/pawan-core/src/agent/backend/mod.rs:18:15
crates/pawan-core/src/agent/pool.rs:44:28
crates/pawan-core/src/coordinator/mod.rs:444:15
crates/pawan-core/src/tools/mod.rs:42:15

Toolchain pinned in-invocation, per the estate context — this host's ambient RUSTUP_TOOLCHAIN is 1.95.0, and 1.95's clippy does not carry this lint, which is why the failure looks unreproducible to anything relying on the ambient value.

Is it a new lint, or new code? The control settles it

toolchain tree exit double_must_use
1.98.0 main @ de893a9 0 0
1.99.0 main @ de893a9 101 4

Same tree, same command, only the toolchain differs. The code did not change; the lint is new. The four sites were last touched by fd2580c/ba8d000 (v0.5.0 work), long before the 1.99 clippy release. So the title's framing is right for once, and main went red with no commit to point at.

Root cause: upstream macro expansion, not pawan

$ grep -rn '#\[must_use' crates/ --include='*.rs' | wc -l
0

There is no #[must_use] anywhere in pawan's source. async-trait 0.1.89 pushes one onto every function it generates (expand.rs: method.attrs.push(parse_quote!(#[must_use]))); those return Pin<Box<dyn Future>>, and both Pin and Box are already #[must_use]. All four sites are #[async_trait] expansions — I checked each.

This is why a blanket #[allow(clippy::double_must_use)] would be wrong: it would suppress a genuine upstream defect at four call sites while leaving the same macro output wrong everywhere else it appears. No #[allow] is added in this diff — 0 sites.

Both arms, CI's exact flags

$ RUSTUP_TOOLCHAIN=1.99.0 cargo clippy --workspace -- -D warnings

  arm                async-trait   exit   sites
  baseline (main)        0.1.89     101     4
  treatment (this)       0.1.92       0     0

Same tree, same toolchain, same flags; only the macro version differs. The exit-code flip is load-bearing — a warning-level run exits 0 while printing all four sites, which would let a broken merge through. Cargo.lock only, 1 file, +14 −3.

Relation to #87

#87 (fix/async-trait-092-double-must-use, OPEN) already carries this exact fix and already says Fixes #86. I did not need to open a second one. This PR is a re-derivation from current main with an added 1.98-vs-1.99 control that #87 does not have, and it should be treated as duplicate-and-superseded — closing it in favour of #87 is the tidier outcome and I have no basis to claim otherwise.

The larger gap, unchanged

main pins no toolchain: no rust-toolchain.toml, and CI uses floating dtolnay/rust-toolchain@stable. That is what turns a clippy release into an unexplained red on an unchanged tree, and it will happen again. Pinning it (or passing toolchain: to the action) is the durable fix. That decision is separate and is the owner's.

Read-only apart from this branch: nothing merged, main untouched.

bkataru added 30 commits May 30, 2026 02:33
T45–T49: TUI slash handler fixes, test fixes, cleanup
- Remove unused imports (PawanConfig, ToolDefinition) in execute.rs
- Remove dead duplicate functions from construction.rs (already in mod.rs)
- Gate test-only re-exports behind #[cfg(test)] in agent/mod.rs, config/mod.rs
- Remove unused QUEUE_DONE_TTL_MS constant from tools/task.rs
- Add #[allow(dead_code)] on future-API items in pawan-cli (theme, layout, etc.)
- Add v0.5.7 changelog entry with refactoring, features, and test summary
- Update test counts from 988+ to 1627+ across README, crate READMEs, and docs
- pawan-core: remove unused imports, fix mut variables
- pawan-cli: fix clamp, sort_by_key, checked_div, needless borrows
- rename ExportFormat::from_str to parse to avoid std trait confusion
- fix unused variables in tests with .. rest patterns
fix: resolve all clippy -D warnings across workspace
- README.md, crate READMEs, guide.md, triage.md, CHANGELOG.md
docs: update test count and version refs for v0.5.7
…#27)

* fix: remove maki refs, fix NVIDIA model catalog auth, trim fallback list

- Remove 'inspired by maki-ui' from theme.rs and layout.rs comments
- Send Authorization Bearer header when NVIDIA_API_KEY is set
- Replace 500+ hardcoded models with 13 curated fallback models
- Fix clippy sort_by_key and redundant import warnings

* fix: update model catalog tests and snapshot for curated fallback list

- Lower test_default_models_not_empty threshold from 50 to 10
- Accept new model selector snapshot with 13 curated models

* refactor: decompose high-CRAP functions into focused helpers

CRAP Reduction (execute.rs):
- execute_with_all_callbacks: 730 lines → 179 lines (75% reduction)
- Extracted 9 helpers: inject_eruka_context, build_user_prompt,
  apply_iteration_budgets, call_llm_with_retry, accumulate_token_usage,
  strip_thinking_blocks, handle_no_tool_response, check_tool_permissions,
  execute_pending_tools, collect_tool_results

CRAP Reduction (session_ops.rs):
- export_as_html: CC 46 → ~3 (4 helpers: build_html_header, build_html_footer,
  render_message_html, render_tool_calls_html)
- generate_handoff_prompt: CC 49 → ~4 (5 helpers: extract_recent_context,
  extract_mentioned_files, extract_task_items, extract_constraints,
  build_prompt_header)

All 1643 tests pass. Clippy clean.

* refactor: decompose main.rs run(), parse_compaction_summary, quality_score_for

CRAP Reduction:
- main.rs run(): CC 60 → ~30 via setup_config, resolve_session_resume extraction
- parse_compaction_summary: CC 35 → 1 via 6 helper functions (extract_section_content,
  parse_summary_field, parse_token_counts, parse_compressed_sections,
  parse_preserved_sections, parse_numbered_items)
- quality_score_for: CC 37 → 1 via 3 helpers (score_by_vendor, score_by_capability,
  score_by_size)

Coverage baseline captured: 77.28% lines / 79.08% functions / 76.83% branches
All 1643 tests pass. Clippy clean.

* chore(pawan): sync 3 file(s)

* test: add unit tests for pure TUI functions

- scrollbar.rs: 9 tests (construction, render edge cases, color handling)
- fuzzy_search.rs: 12 tests (filter, navigation, command_prefix)
- status_bar.rs: 11 tests (abbrev_model, format_tokens, context_bar)

All 1655 tests pass. Clippy clean.

* refactor(tui): convert render.rs to render/ directory module

* chore(pawan): sync 3 file(s)

* refactor(cli): decompose high-complexity main.rs run functions

Break down run_headless (CC=51), run_commit (CC=40), run_doctor (CC=31),
and run_tasks (CC=31) into focused helper functions to reduce cyclomatic
complexity and CRAP scores. Behavior preserved verbatim.

* test(tui): relocate render snapshots and make CWD redaction width-stable

Move render snapshots into render/snapshots/ after the render module split
and regenerate them against current TUI output. Pad the [CWD] redaction to
preserve line width so the welcome box border stays aligned regardless of
working-directory length, making the snapshot portable across environments.

* refactor: decompose high-complexity functions across cli and core

Decompose App::main_loop, MiseTool::execute, OpenAiCompatBackend
streaming/generate, App::slash_route, and handle_input_panel_key into
focused helper functions. Behavior preserved verbatim.
- LspTool::execute: 10 tests (error paths, arg validation, schema)
- InjectionDetector: 22 tests (scan_file, scan_file_streaming, helpers)
- main.rs helpers: 20 tests (parse_git_status, commit prompt, headless)
- TUI model picker: 8 tests (navigation, input, selection)

Total workspace tests: 1715+
- Workspace version 0.5.8, workspace deps pawan-core/pawan-mcp 0.5.8
- CHANGELOG: add v0.5.8 entry (CRAP reduction, render decomposition, 60 tests)
- Fix CHANGELOG corruption (embedded line numbers, snapshot tags)
- Update test counts 1643→1779 across README, guide, triage, crate READMEs
- Regenerate insta welcome snapshots for v0.5.8
- Update pawan-api health endpoint version in README
TUI redesign + animate-core value tweens (v0.5.9)
chore: v0.5.9 version bump + docs update
Replaces the unmaintained `atty 0.2.14` crate with the stdlib `std::io::IsTerminal` trait (stable since Rust 1.70). Resolves RUSTSEC-2024-0375 (unmaintained) and RUSTSEC-2021-0145 (Windows unaligned read) for pawan-cli's direct dependency on `atty`.

**Changes**
- `crates/pawan-cli/src/main.rs`: 3 call sites switched from `atty::is(Stream::*)` to `std::io::{stdin,stderr}().is_terminal()` (one new `use std::io::IsTerminal;` import)
- `crates/pawan-cli/Cargo.toml`: drop `atty = "0.2.14"`
- `Cargo.lock`: atty and its transitive `hermit-abi` are no longer resolved
- `.cargo/audit.toml`: document accepted-risk suppressions for the 11 advisories (5 vulnerabilities + 6 unmaintained warnings) that remain in the lockfile but are out of reach or already patched
- `cargo fmt --all`: bring workspace into compliance with the current rustfmt (35 files, 446+/396-, no semantic changes)
- Refresh stale welcome-screen snapshot (v0.5.8 → v0.5.9) for the lib and bin targets

**Verification**
- `cargo check -p pawan`: clean
- `cargo test -p pawan`: 269/269 pass locally
- `cargo audit`: clean (0 advisories with the new `.cargo/audit.toml` suppressions)
- `cargo fmt --all -- --check`: clean

**Note on CI**
The 4 `test_render_welcome_snapshot` / `test_session_tags_persist_on_save` failures in CI are pre-existing on `main` (the welcome snapshot still has v0.5.8 but the code is v0.5.9, and `test_session_tags_persist_on_save` is environment-flaky on the session-dir path). The atty fix is unrelated to those failures. They should be addressed in a separate PR.

Closes #4 (RUSTSEC-2024-0375) and #13 (RUSTSEC-2021-0145) via auto-close on merge.
Adds RMUX-backed terminal workflow support, /rmux typed slash command, /model key-release fix, and PTY-backed TUI QA.
Bump workspace crates to v0.5.10 and finalize release notes after RMUX terminal workflow integration.
Adds RMUX live roundtrip testing, kill_session support, /rmux kill routing, and stricter RMUX validation/diagnostics.
Bump workspace crates to v0.5.11 and finalize release notes for RMUX hardening.
Render RMUX snapshot tool results as terminal-focused TUI cards and switch fixed TUI statics to LazyLock.
Bump workspace crates to v0.5.12 and finalize release notes for RMUX snapshot cards.
Adds rmux list_sessions support, /rmux list routing, live roundtrip list assertions, and docs.
Bump workspace crates to v0.5.13 and finalize release notes for RMUX session discovery.
Adds rmux list_panes support, /rmux panes routing, live pane inventory assertions, and docs.
Bump workspace crates to v0.5.14 and finalize release notes for RMUX pane discovery.
Renders rmux list_panes tool results as active-pane inventory cards while preserving generic tool rendering.
Bump workspace crates to v0.5.15 and finalize release notes for RMUX pane-list cards.
Renders rmux list_sessions tool results as active-session inventory cards while preserving other tool rendering.
Bump workspace crates to v0.5.16 and finalize release notes for RMUX session-list cards.
Renders rmux send, key, wait, and kill tool results as action-focused TUI cards.
Bump workspace crates to v0.5.17 and finalize release notes for RMUX status cards.
bkataru added 5 commits June 14, 2026 08:54
Fixes #86. Lockfile-only; `async-trait = "0.1"` already admits 0.1.92.

`async-trait` 0.1.89 synthesises a bare `#[must_use]` onto every function it
generates. Those return `Pin<Box<dyn Future>>`, and both `Pin` and `Box` are
already `#[must_use]`, which clippy's `double_must_use` rejects. There is no
`#[must_use]` anywhere in pawan's own source -- it appears only at macro
expansion -- so this is an upstream defect, not a pawan defect, and the fix is
upstream rather than a suppression.

Measured at origin/main @ 46b8118, clippy 1.99.0, CI's exact flags
(cargo clippy --workspace -- -D warnings), toolchain pinned per invocation
because this host's ambient RUSTUP_TOOLCHAIN is 1.95.0:

  arm                    async-trait   exit   double_must_use sites
  baseline (main)            0.1.89     101     4
  treatment (this)           0.1.92       0     0

The exit-code flip is load-bearing, not a smaller warning count. Same tree,
same toolchain, same flags; the only difference is the macro version. All four
sites are `#[async_trait]` expansions in pawan-core, none added here.
@bkataru

bkataru commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

Toolchain differential for this bump — measured on both toolchains

Adding evidence rather than a fourth copy of the lockfile diff. The question a
reviewer has to answer for this bump is "does it trade one drift for another?",
and that needs both toolchains, not just @stable.

Measured on this branch, workspace-wide, --all-targets -- -D warnings:

clippy 1.99   cargo clippy --workspace --all-targets -- -D warnings    0 errors
clippy 1.98   cargo clippy --workspace --all-targets -- -D warnings    0 errors

So the bump clears double_must_use on the toolchain that started failing it
and does not introduce anything on the pinned one.

The lint is generated, not written. None of the four sites
(agent/backend/mod.rs:18, agent/pool.rs:44, coordinator/mod.rs:444,
tools/mod.rs:42) carries a #[must_use]; #[async_trait] 0.1.89's expansion
emits one with no message on a function already returning a #[must_use] type.
It is a false positive in the macro, which is why the bump is the right fix
rather than #[allow(clippy::double_must_use)] on four sites — an allow would
need re-justifying as the lint evolves and would hide the diagnostic if it ever
fired for a real reason.

Independent confirmation: Check & Lint went from failure to success,
11 steps executed
on the identical lockfile change at 8b34a508.

Note the residual failure is a different check — Security Audit / cargo audit
fails on main and on every branch (main's last green was de893a9 at
2026-10-05 13:03, before stable moved). Not caused by this bump, but it will
block the required-check set until someone takes it.

@bkataru

bkataru commented Oct 6, 2026 •

Copy link
Copy Markdown
Member Author

Reviewed — recommend merge to clear the double_must_use red wall.

What it is: lockfile-only change (Cargo.lock, 1 file). async-trait 0.1.89 -> 0.1.92.

Why it clears the gate: the clippy::double_must_use failure on every open PR is macro-generated — async-trait 0.1.89's expansion emits a #[must_use] with no message on a fn returning an already-#[must_use] type, and -D warnings + clippy 1.99 promote it to a hard error. 0.1.92 stops the macro emitting that attribute, so the lint clears at the source. Verified: this PR's Check & Lint PASSES while the same gate is red on #105/#112/#113/#114/#115.

Scope check: introduces syn 3.0.6 alongside existing syn 1.0.109 / 2.0.117 (a 3-way split). This is the normal consequence of the async-trait bump — syn major versions coexist without issue in Cargo. No source files touched.

Note: its only failing check is cargo audit, a separate pre-existing RUSTSEC matter unrelated to the lint. That should not block this merge (the audit findings exist on main too).

This is preferable to pinning the toolchain (which would freeze pawan off the rust 1.99 migration) or adding #[allow(double_must_use)] (which would hide the diagnostic if it ever fired for a real reason). #87 and #92 are the same bump — merge one, close the other two as duplicates.

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