Skip to content

fix(ci): unbreak main's clippy, and let the tmux audit test the exemption - #117

Merged
Dygreens merged 1 commit into
mainfrom
fix/tmux-audit-test-shares-the-scanner
Aug 18, 2026
Merged

fix(ci): unbreak main's clippy, and let the tmux audit test the exemption#117
Dygreens merged 1 commit into
mainfrom
fix/tmux-audit-test-shares-the-scanner

Conversation

@Dygreens

Copy link
Copy Markdown
Collaborator

Two things, and the first is urgent: main is red and it's my fault.

1. clippy (deny warnings) fails on main as of f0be7a46 (my #107 merge)

warning: unnecessary use of `clone` to create a slice from a reference
    --> crates/amux-server/src/runtime_jobs/scheduler.rs:2306:45

One line: &[o.clone()]std::slice::from_ref(&o).

Why it got through: I verified with cargo clippy -p amux-server --lib. CI runs cargo clippy --workspace --all-targets -- -D warnings. The lint is in a test, which --lib never compiles. I checked a narrower surface than the gate does and read the green as if it meant the same thing.

Verified here with CI's exact command rather than a convenient shorthand.

2. AEAB-23 — the planted-offender test re-implemented the scanner

offenders() and the_audit_detects_a_planted_non_exact_target held two copies of the same ~30-line loop, so the test could not observe a change to the real scanner.

Extracted scan(src) -> Vec<(usize, String)>, used by both. The exemption logic and its comment are 8db4326's, moved verbatim — a test-only refactor with no behaviour change.

The card overstated this, and I'm correcting it

I wrote that "NOTHING tests" the exemption. Not quite. every_tmux_target_uses_the_exact_match_helpers covers the narrow direction incidentally — remove the exemption and it fails, because email.rs really does contain a touch -t. That coverage is accidental (it evaporates the moment that unrelated file changes) but it isn't nothing.

The real hole is the other direction, and it's the one that matters. Measured, not argued — widen the exemption so it swallows tmux too (if matches!(name, Some(_n))):

result
against main's tests 2 passed, 0 failed — guard fully disabled, CI green
against these tests 1 failed — caught

An exemption a shade too broad silences the guard while leaving main green, which is indistinguishable from the guard working. That's the expensive direction, and main could not see it.

So the_non_tmux_exemption_silences_touch_but_never_tmux asserts all three:

  • touch -t is exempt — the false positive that failed CI
  • a literal Command::new("tmux") is still flagged — or the fix deleted the guard
  • a helper-invoked tmux target still audited — api/metrics.rs's real cmd_output("tmux", …) shape, where there's no literal program to attribute. This is the fail-safe case a broader exemption loses first.

Verification — CI's exact commands, all three

cargo check --workspace --all-targets            clean
cargo clippy --workspace --all-targets -D warnings   exit 0
cargo test --workspace                           39 result lines, 0 failed
tmux_target_audit                                3 passed

🤖 Generated with Claude Code

https://claude.ai/code/session_01B4vuEScunv4K6RMwQoT9xx

…tion (AEAB-23)

TWO things, and the first is urgent: main is RED and it is my fault.

1. clippy (deny warnings) fails on main as of f0be7a4 (my #107 merge).

   `should_warn_undelivered(&[o.clone()])` trips `cloned_ref_to_slice_refs`.
   One line: `std::slice::from_ref(&o)`.

   Why it got through: I verified with `cargo clippy -p amux-server --lib`. CI
   runs `cargo clippy --workspace --all-targets -- -D warnings`. The lint is in a
   TEST, which `--lib` does not compile. I checked a narrower surface than the
   gate does and read the green as if it meant the same thing. Verified here with
   CI's exact command, not a convenient shorthand — exit 0.

2. AEAB-23: the tmux audit's planted-offender test re-implemented the scanner.

   `offenders()` and `the_audit_detects_a_planted_non_exact_target` held two
   copies of the same ~30-line loop, so the test could not observe a change to
   the real scanner. Extracted `scan(src) -> Vec<(usize, String)>`, used by both.
   The exemption logic and its comment are 8db4326's, moved verbatim — this is a
   test-only refactor with no behaviour change.

   THE CARD OVERSTATED THE PROBLEM AND I AM CORRECTING IT: I wrote that "NOTHING
   tests" the exemption. Not quite. `every_tmux_target_uses_the_exact_match_helpers`
   covers the narrow direction INCIDENTALLY — remove the exemption and it fails,
   because email.rs really does contain a `touch -t`. That coverage is accidental
   (it evaporates the moment that unrelated file changes) but it is not nothing.

   The real hole is the other direction, and it is the one that matters. Measured,
   not argued — widen the exemption so it swallows tmux too
   (`if matches!(name, Some(_n))`):

     against main's tests   2 passed, 0 failed   <- guard fully disabled, CI green
     against these tests    1 failed             <- caught

   An exemption a shade too broad silences the guard while leaving main green,
   which is indistinguishable from the guard working. That is the expensive
   direction and main could not see it.

   So `the_non_tmux_exemption_silences_touch_but_never_tmux` asserts all three:
   `touch -t` exempt; a literal `Command::new("tmux")` still flagged; and a
   helper-invoked tmux target (api/metrics.rs's real `cmd_output("tmux", ...)`
   shape, where there is no literal program to attribute) still audited. That
   last is the fail-safe case a broader exemption loses first.

CI's exact commands, all three: cargo check --workspace --all-targets clean,
clippy --workspace --all-targets -D warnings exit 0, test --workspace 39 result
lines 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4vuEScunv4K6RMwQoT9xx

Amux-Session: amux-errors-and-bugs
@Dygreens
Dygreens merged commit 5296dea into main Aug 18, 2026
3 checks passed
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