chore(toolchain): pin rust 1.94.1, fix clippy/fmt workspace-wide, deflake config tests (BUNYIP-36) #39

Merged
nrupard merged 2 commits from chore/bunyip-36-rust-1.94-toolchain into main 2026-06-02 21:27:05 +02:00
Owner

Closes BUNYIP-36.

What

  • Toolchain pin bumped to 1.94.1 (from the 1.93.0 holdback pin). 1.94.1 is the exact version shipped in the ghcr.io/niceguyit/rust-builder-*:v1.0.0-rust1.94-* images, so CI, Dockerfile builds, and container checks on toolchain-less dev boxes now all resolve to a preinstalled toolchain - no downloads anywhere.
  • All clippy violations under 1.94 fixed workspace-wide. Mechanical lints (redundant closures, manual clamp, manual prefix strip, derivable Default, needless return, unnecessary map_or / map-identity / casts, field-reassign-with-default, unnecessary unwrap) are fixed as clippy suggests. FeedbackStatus::from_str becomes a proper std::str::FromStr impl. The three large auth result enums (LoginResult, MagicLinkResult, AcceptInviteResult) box their UserResponse payload (clippy::large_enum_variant). too_many_arguments hits that are actix extractor lists, OIDC protocol parameters, or independent nullable columns get targeted #[allow]s with rationale comments instead of pointless params structs.
  • Dead code removed: EmailService::feedback_excerpt and its tests (no production caller, no template references an excerpt variable).
  • Config test flakiness fixed (the BUNYIP-36 comment item): all env-var-mutating tests in bunyip-domain/src/config.rs now serialize on a shared ENV_LOCK mutex with poison recovery. Config::from_env reads every sub-config's env vars, so any two of these tests could race; now they cannot. Verified with 10 consecutive runs, all clean.
  • CLAUDE.md documents the pinned toolchain and the exact docker run command for running checks on dev boxes without a local Rust toolchain.
  • rustfmt drift: none remained after the fixes; cargo fmt --all --check is clean under 1.94.1.

Verification (rust-builder-glibc 1.94.1 container, SQLX_OFFLINE=true)

  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo fmt --all --check: clean
  • cargo build --workspace --all-targets: clean
  • cargo test --workspace --lib: 18 + 176 + 7 + 0 passed, 0 failed
  • config::tests x10 consecutive runs: 17 passed each, no flakes
  • just check-docker (api Dockerfile builder stage): clean (release build, 2m 51s)

The existing .forgejo/workflows/check.yml needs no changes: the runner's rustup honours rust-toolchain.toml, and the components list in the pin installs clippy/rustfmt automatically.

Closes BUNYIP-36. ## What - **Toolchain pin bumped to 1.94.1** (from the 1.93.0 holdback pin). 1.94.1 is the exact version shipped in the `ghcr.io/niceguyit/rust-builder-*:v1.0.0-rust1.94-*` images, so CI, Dockerfile builds, and container checks on toolchain-less dev boxes now all resolve to a preinstalled toolchain - no downloads anywhere. - **All clippy violations under 1.94 fixed workspace-wide.** Mechanical lints (redundant closures, manual clamp, manual prefix strip, derivable Default, needless return, unnecessary map_or / map-identity / casts, field-reassign-with-default, unnecessary unwrap) are fixed as clippy suggests. `FeedbackStatus::from_str` becomes a proper `std::str::FromStr` impl. The three large auth result enums (`LoginResult`, `MagicLinkResult`, `AcceptInviteResult`) box their `UserResponse` payload (clippy::large_enum_variant). `too_many_arguments` hits that are actix extractor lists, OIDC protocol parameters, or independent nullable columns get targeted `#[allow]`s with rationale comments instead of pointless params structs. - **Dead code removed**: `EmailService::feedback_excerpt` and its tests (no production caller, no template references an excerpt variable). - **Config test flakiness fixed** (the BUNYIP-36 comment item): all env-var-mutating tests in `bunyip-domain/src/config.rs` now serialize on a shared `ENV_LOCK` mutex with poison recovery. `Config::from_env` reads every sub-config's env vars, so any two of these tests could race; now they cannot. Verified with 10 consecutive runs, all clean. - **CLAUDE.md documents** the pinned toolchain and the exact docker run command for running checks on dev boxes without a local Rust toolchain. - **rustfmt drift**: none remained after the fixes; `cargo fmt --all --check` is clean under 1.94.1. ## Verification (rust-builder-glibc 1.94.1 container, SQLX_OFFLINE=true) - `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo fmt --all --check`: clean - `cargo build --workspace --all-targets`: clean - `cargo test --workspace --lib`: 18 + 176 + 7 + 0 passed, 0 failed - `config::tests` x10 consecutive runs: 17 passed each, no flakes - `just check-docker` (api Dockerfile builder stage): clean (release build, 2m 51s) The existing `.forgejo/workflows/check.yml` needs no changes: the runner's rustup honours `rust-toolchain.toml`, and the components list in the pin installs clippy/rustfmt automatically.
chore(toolchain): pin rust 1.94.1, fix clippy/fmt workspace-wide, deflake config tests (BUNYIP-36)
All checks were successful
Check / fmt / clippy / build / test (pull_request) Successful in 2m36s
ce689313d3
- Bump rust-toolchain.toml from the 1.93.0 holdback pin to 1.94.1, the exact version in the ghcr.io/niceguyit/rust-builder-*:v1.0.0-rust1.94-* images, so CI, Dockerfile builds, and container checks on toolchain-less dev boxes all resolve to a preinstalled toolchain.
- Fix every clippy violation under 1.94: redundant closures, manual clamp, manual prefix strip, derivable Default, needless return, unnecessary map_or/map-identity/casts, field-reassign-with-default, unnecessary unwrap; FeedbackStatus::from_str becomes a std::str::FromStr impl; LoginResult/MagicLinkResult/AcceptInviteResult box their UserResponse payload (large_enum_variant); too_many_arguments hits that are actix extractor lists, OIDC protocol parameters, or independent nullable columns get targeted #[allow]s with rationale comments.
- Remove dead EmailService::feedback_excerpt and its tests (no production caller, no template references an excerpt variable).
- Deflake bunyip-domain config tests (BUNYIP-36 comment item): env-var-mutating tests serialize on a shared ENV_LOCK mutex with poison recovery; Config::from_env reads every sub-config's env vars so any two such tests could race before.
- Document the pinned toolchain and the container check workflow for toolchain-less dev boxes in CLAUDE.md.

Verified in the rust-builder-glibc 1.94.1 container: clippy --workspace --all-targets -D warnings clean, fmt clean, build all targets clean, 201 workspace lib tests pass, config tests 10x consecutive runs clean, api Dockerfile builder stage builds clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: nrupard <natrsmith11@gmail.com>
fix(toolchain): address PR #39 review findings
All checks were successful
Check / fmt / clippy / build / test (pull_request) Successful in 1m17s
Create release / Create release from merged PR (pull_request) Has been skipped
75cf0f7448
- Replace scattered #[allow(clippy::too_many_arguments)] attributes (9 sites) with a single [workspace.lints.clippy] policy; bunyip-api/domain/oci/oidc opt in via [lints] workspace = true (bunyip-web keeps its local table since cargo forbids combining workspace = true with the crate's dead_code allow).
- Unbox the auth result enums: LoginResult/MagicLinkResult/AcceptInviteResult carry UserResponse inline again with a targeted #[allow(clippy::large_enum_variant)], avoiding a pointless per-login heap allocation for transient single-use return values.
- Move the env-var test lock to a crate-shared test_support module so middleware/auto_ban.rs's AUTO_BAN_* test serializes with the config tests (the lock was module-local before, leaving a residual race window).
- Collapse the three byte-identical has_member_access() copies (oci token handler, oci bearer middleware, oidc provider) onto the existing User::is_access_allowed() so membership policy has one definition.
- Add `just check-container` wrapping fmt + clippy + workspace lib tests in the pinned rust-builder image; CLAUDE.md now points at the recipe instead of an inline docker command that could drift.
- Make check.yml commands workspace-wide (--workspace / --all) so CI matches the documented check exactly.
- Document why rust-toolchain.toml exact-pins the patch version and that it must move in lockstep with the rust-builder image tag.

Verified in the rust-builder-glibc 1.94.1 container: clippy --workspace --all-targets -D warnings clean, fmt clean, 201 workspace lib tests pass, env-var tests (config + auto_ban modules together) 10x consecutive runs clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: nrupard <natrsmith11@gmail.com>
nrupard deleted branch chore/bunyip-36-rust-1.94-toolchain 2026-06-02 21:27:05 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/bunyip!39
No description provided.