Skip to content

test: use assert_eq! for empty checks (clippy::assert_is_empty, Rust 1.99) - #173

Merged
gonzafg2 merged 1 commit into
mainfrom
fix/clippy-assert-is-empty
Oct 11, 2026
Merged

gonzafg2 merged 1 commit into
mainfrom
fix/clippy-assert-is-empty

Conversation

@gonzafg2

Copy link
Copy Markdown
Owner

Summary

Rust 1.99.0 (stable since 2026-10-01) adds clippy::assert_is_empty. The CI build job runs cargo clippy --workspace --all-targets -- -D warnings on the stable channel, so the job has failed on every PR since 2026-10-05. That includes #172 and the dependabot PRs; the last green run was 2026-09-28.

The lint flags four test assertions:

File Before After
crates/quantumssh/src/main.rs:576,593,626 assert!(r.overrides.is_empty()) assert_eq!(r.overrides, Vec::<&str>::new())
crates/quantumssh-core/tests/accept.rs:862 assert!(stdout.is_empty()) assert_eq!(stdout, b"") (matches the stderr assertion on the next line)

These follow what the lint asks for: on failure the assertion prints the value. The change is test-only, with no behaviour change. Clippy's own suggestion, [] as [&str; 0], was swapped for the equivalent Vec::<&str>::new() for readability.

Verification

  • rustup run 1.99.0 cargo clippy --workspace --all-targets -- -D warnings: reproduced the 4 errors on main, and exits 0 after the change.
  • cargo clippy with 1.97.1 (local stable) and -D warnings: exits 0.
  • cargo fmt --all --check: clean.
  • cargo test -p quantumssh --bins: 34 passed. cargo test -p quantumssh-core --test accept: 35 passed (both with 1.99.0).

Not in scope

The root cause of the breakage is that rust-toolchain.toml tracks channel = "stable" per ADR-0010, so each Rust release can add lints that -D warnings turns into CI failures. Pinning an exact toolchain version would change that ADR's decision, so it belongs in a superseding ADR, not in this fix.

No linked issue: this is a CI repair that is not tracked anywhere.

https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW

…1.99)

Rust 1.99.0 (stable since 2026-10-01) adds clippy::assert_is_empty, and
the CI build job runs clippy with -D warnings on the floating stable
channel, so every PR since 2026-10-05 fails on four test assertions:

- crates/quantumssh/src/main.rs: three assert!(r.overrides.is_empty())
- crates/quantumssh-core/tests/accept.rs: assert!(stdout.is_empty())

They become assert_eq! against an empty value, which is what the lint
asks for (the value is shown on failure). Test-only; no behaviour change.
Verified with clippy 1.99.0 and 1.97.1 (-D warnings) and the affected
tests (quantumssh bin tests, quantumssh-core accept).

Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW
Signed-off-by: Gonzalo Fleming <[email protected]>
@github-actions

Copy link
Copy Markdown

Reviewer: Codex (openai/codex-action, model gpt-5.6-terra)

PR Review: test: use assert_eq! for empty checks (clippy::assert_is_empty, Rust 1.99) (#173)

Decision: 🟢 Approved
Iteration: First review
Lenses applied: Rust under crates/

Executive summary

This PR updates four test-only empty assertions to satisfy the new Clippy lint while preserving the assertions’ semantics. It introduces no production-path, dependency, cryptographic, transport, or licensing changes.

No findings meet the reporting threshold.

Decision: 🟢 Approved

@opencode-agent

Copy link
Copy Markdown

PR Review: test: use assert_eq! for empty checks (clippy::assert_is_empty, Rust 1.99) (#173)

Decision: 🟢 Approved
Iteration: First review
Lenses applied: Rust under crates/ (test-only assertions, clippy gate), hard constraints

Executive summary

A four-line test-only change replacing assert!(x.is_empty()) with assert_eq! at three sites in crates/quantumssh/src/main.rs and one in crates/quantumssh-core/tests/accept.rs, to clear the new clippy::assert_is_empty lint that Rust 1.99 promoted under the repo's pedantic = "warn" plus CI's -D warnings. I verified the change compiles, is semantically equivalent, and that the failure it repairs is real; no hard constraint from CLAUDE.md or the threat model is touched. Nothing reaches the reporting threshold.

Verification performed

  • cargo clippy --workspace --all-targets -- -D warnings on the PR head with rustc 1.99.0 → exit 0 (clean).
  • cargo test -p quantumssh --bins → 34 passed; cargo test -p quantumssh-core --test accept → 35 passed.
  • The premise is confirmed from CI history: the last green ci.yml run on main/PRs was 2026-09-28; every run since (2026-10-05 dependabot, 2026-10-08 RFC-0012) concluded failure, matching the description.
  • Semantics: Resolved.overrides is Vec<&'static str> (crates/quantumssh/src/main.rs:162), so assert_eq!(r.overrides, Vec::<&str>::new()) unifies the elided lifetime to 'static, allocates nothing, and compares element-wise. collect_session returns (Vec<u8>, Vec<u8>, …), so assert_eq!(stdout, b"") uses content comparison via PartialEq<&[u8; N]> for Vec<u8> (crates/quantumssh-core/tests/accept.rs:862). No pointer-identity or truncation hazard.
  • Completeness: the only remaining assert!(…is_empty()) in the tree, crates/quantumssh-core/src/channel.rs:1046, is on the user type PendingOut, which the lint's suggestion logic (slice/array/String/Vec) does not match — independently confirmed by a targeted -W clippy::assert-is-empty run. It is not a missed site.

New findings

None. The change adds no unsafe (unsafe_code = "forbid" untouched), touches no KEX/cipher/auth/audit surface, introduces no dependency, and has no behaviour change — so there is no anchor to a CLAUDE.md rule, threat-model section, or ADR to justify a finding.

Decision: 🟢 Approved

github run

@claude

claude Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

PR Review: test: use assert_eq! for empty checks (clippy::assert_is_empty, Rust 1.99) (#173)

Decision: 🟢 Approved
Iteration: First review
Lenses applied: Rust under crates/ (test code), Conventional Commits

Executive summary

This is a targeted CI repair: Rust 1.99.0 (stable since 2026-10-01) introduced clippy::assert_is_empty, and the CI build job runs clippy -D warnings on the floating stable channel, causing every PR to fail. The four affected assertions in test/integration-test code are mechanically replaced with assert_eq! equivalents that preserve semantics while satisfying the new lint. No production code is touched.

All five MANIFIESTO commitments are unaffected (no unsafe, no new dependencies, no crypto surface, no scope expansion, no license change). The hard security rules (pre-auth path, type-state transport, key material, audit log) are unaffected. DCO sign-off is present; the commit type test: is a valid Conventional Commits type.

Limitation: Commit GPG/SSH signature verification is enforced by branch protection CI, not accessible from this review environment — confirmed as a known limitation per the review instructions.

New findings

None. No findings reached the reporting threshold (≥ 80 confidence).

@gonzafg2
gonzafg2 merged commit 4df8aef into main Oct 11, 2026
13 checks passed
@gonzafg2
gonzafg2 deleted the fix/clippy-assert-is-empty branch October 11, 2026 04:38
gonzafg2 added a commit that referenced this pull request Oct 12, 2026
…posed) (#180)

Rust 1.99.0 (2026-10-01) added clippy::assert_is_empty, and CI ran the
floating stable channel with -D warnings, so the required build checks
failed on every PR from 2026-10-05 until #173. ADR-0039 supersedes the
channel = "stable" part of ADR-0010: rust-toolchain.toml pins 1.99.0,
every CI job reads the version from that file, and a bump is one
reviewed PR, opened by Dependabot's rust-toolchain ecosystem.

Refs #109

Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW

Signed-off-by: Gonzalo Fleming <[email protected]>
gonzafg2 added a commit that referenced this pull request Oct 12, 2026
…DR-0039) (#181)

* docs(adr): ADR-0039 — pin the Rust toolchain to an exact release (Proposed)

Rust 1.99.0 (2026-10-01) added clippy::assert_is_empty, and CI ran the
floating stable channel with -D warnings, so the required build checks
failed on every PR from 2026-10-05 until #173. ADR-0039 supersedes the
channel = "stable" part of ADR-0010: rust-toolchain.toml pins 1.99.0,
every CI job reads the version from that file, and a bump is one
reviewed PR, opened by Dependabot's rust-toolchain ecosystem.

Refs #109

Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW
Signed-off-by: Gonzalo Fleming <[email protected]>

* ci(toolchain): pin Rust 1.99.0 in rust-toolchain.toml; CI reads it (ADR-0039)

rust-toolchain.toml moves from channel = "stable" to "1.99.0", the
release CI already runs. The build, openssh-interop and audit jobs read
`channel` from that file and pass it to dtolnay/rust-toolchain instead
of asking for `stable`; the step fails unless the value is an exact
MAJOR.MINOR.PATCH, which also keeps the action input to digits and
dots. cargo deny needs no change: cargo-deny-action already installs
the toolchain the file names.

Dependabot gains a rust-toolchain entry so each release arrives as one
bump PR, where new lints are fixed before merge. docs/infrastructure.md
no longer says the file tracks current stable.

Refs #109

Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW
Signed-off-by: Gonzalo Fleming <[email protected]>

* docs(adr): accept ADR-0039 with #181; record the partial supersession of ADR-0010

ADR-0039 flips to Accepted and names #181 as its implementation.
ADR-0010's Status records that its channel = "stable" part is
superseded by ADR-0039; the components list and every other bullet
stand. Status-only edit per ADR-0015, worded like ADR-0020's record of
ADR-0034.

Refs #109

Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW
Signed-off-by: Gonzalo Fleming <[email protected]>

* docs(adr): ADR-0039 — cite what dtolnay's README says about the @master revision

The Context paraphrased README lines 43–45 as pairing an explicit
`toolchain` input with "a SHA or @master ref"; those lines name only
the @master revision. The SHA rule comes from lines 102–108. Wording
fix before acceptance; no change to the decision.

Refs #109

Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW
Signed-off-by: Gonzalo Fleming <[email protected]>

---------

Signed-off-by: Gonzalo Fleming <[email protected]>
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