Skip to content

fix(database): the database crate compiles and tests on its own, and lint checks every crate alone - #347

Merged
PiquelChips merged 1 commit into
mainfrom
fix/crate-test-util-gating
Nov 4, 2026
Merged

PiquelChips merged 1 commit into
mainfrom
fix/crate-test-util-gating

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

piquel-repository didn't compile on its own: cargo clippy -p piquel-repository --all-targets and cargo test -p piquel-repository both failed.

error[E0599]: no method named `history_for_client` found for struct `repositories::EventRepository<'a>`

The crate's own OIDC test calls EventRepository::history_for_client, which was gated only on feature = "test-util". The crate's cfg(test) build doesn't turn that feature on. Workspace builds hid the problem because auth-service dev-depends on the crate with test-util, and Cargo unifies features.

Fix: every test-util gate in the database crate now uses #[cfg(any(test, feature = "test-util"))], which is what piquel-auth and piquel-telemetry already do. Converting all 13 gates, not just the broken one, means the next helper a test reaches for can't break the build the same way. No other crate had the problem: I ran clippy -p <crate> --all-targets on each of the 8 members and only this one failed.

CI: just rust lint still runs the workspace pass, then also lints each crate alone with --manifest-path. This needs no workflow change because CI already runs just rust lint. It's cheap: about 30s extra on a warm cache, and only the workspace crates get rechecked. The workspace pass still matters because it is the only one that lints a crate's library with features its dependents enable.

Proof

Before, with only the history_for_client gate reverted:

$ just rust lint
error[E0599]: no method named `history_for_client` found for struct `repositories::EventRepository<'a>` in the current scope
error: could not compile `piquel-repository` (lib test) due to 1 previous error
error: recipe `lint` failed with exit code 101

After: just rust lint exits 0. So do cargo clippy --locked -p piquel-repository --all-targets -- -D warnings, the same command without --all-targets, and the same command with --features test-util.

just db scratch cargo nextest run --locked -p piquel-repository --run-ignored all runs the crate's tests without auth-service in the build: 70/70 pass.

Reviewed with review-loop: 1 round with 2× GPT 6.1 Sol and Claude Opus 5.5. Verdict: approved

Note

Written by Claude Opus 5.5 in Claude Code and reviewed by GPT 6.1 Sol and Claude Opus 5.5 (via T3 Code)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d1dbd31-4d8a-4791-9804-dcf7f8b79a6f
Commits

Reviewing files that changed from the base of the PR and between 590d7b5 and 3cf0497.

Files selected for processing: 11
  • crates/database/src/connection/mod.rs
  • crates/database/src/exclusive/mod.rs
  • crates/database/src/lib.rs
  • crates/database/src/repositories/audit/mod.rs
  • crates/database/src/repositories/deliveries/mod.rs
  • crates/database/src/repositories/events/mod.rs
  • crates/database/src/repositories/recoveries.rs
  • crates/database/src/repositories/tokens/mod.rs
  • crates/database/src/repositories/users/mod.rs
  • crates/database/src/transaction.rs
  • just/rust.just
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Its own tests called a helper gated only on its `test-util` feature, so
`cargo clippy -p piquel-repository --all-targets` failed to compile. The
workspace build hid it because auth-service's dev-dependency enables
`test-util` and Cargo unifies features.

Every `test-util` gate in the crate now reads `any(test, feature =
"test-util")`, like piquel-auth and piquel-telemetry, and `just rust lint`
also lints each crate alone, so CI catches this class of bug.
@PiquelChips
PiquelChips force-pushed the fix/crate-test-util-gating branch from 25a82c9 to 3cf0497 Compare November 4, 2026 15:09
@PiquelChips PiquelChips self-assigned this Nov 4, 2026
@PiquelChips PiquelChips added bug Something isn't working ci-cd CI-CD labels Nov 4, 2026
@PiquelChips PiquelChips added this to the 0.1 milestone Nov 4, 2026
@PiquelChips PiquelChips moved this to In Progress in sourceorigin.dev Nov 4, 2026
@PiquelChips
PiquelChips merged commit 0612898 into main Nov 4, 2026
9 checks passed
@PiquelChips
PiquelChips deleted the fix/crate-test-util-gating branch November 4, 2026 15:41
@github-project-automation github-project-automation Bot moved this from In Progress to Done in sourceorigin.dev Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci-cd CI-CD

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant