Skip to content

chore(lint): query_as in database tests is checked against the schema - #721

Open
PiquelChips wants to merge 1 commit into
mainfrom
chore/ban-unchecked-sqlx
Open

PiquelChips wants to merge 1 commit into
mainfrom
chore/ban-unchecked-sqlx

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

What and why

SQL should be compiled against the schema, so just db prepare can catch a renamed column or a changed type. sqlx::query_as (the function, which checks nothing) is now banned in clippy.toml; the eight test sites use sqlx::query! instead, with the eight new statements in the committed query cache. No production code used it.

This is the first of three PRs that ban sqlx::query_as, query_scalar and query; each adds its own entry to the disallowed-methods list.

No #[expect] was needed.

Testing

just db test passes (509 tests, then the query cache check), and cargo clippy --workspace --all-targets -- -D warnings passes.

Note

Written by Claude Sonnet 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 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 59 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: 1a462034-d66a-42ca-b262-6a4c19ecae9b
Commits

Reviewing files that changed from the base of the PR and between e99cc0e and 822965b.

Files selected for processing: 15

  • clippy.toml
  • crates/database/.sqlx/query-111b89cb6a430cf19f34b900a964242078c1e82ef0f73e5acab20a6483f8865c.json
  • crates/database/.sqlx/query-1b57b19c750035ac02c6299907e570b33b8f8e89ed2ca1423088f9f6b69225f1.json
  • crates/database/.sqlx/query-365bbb4c4f6b707d7394712f37499a6b17cbf1b0d300fb8f3fd8943a3f2d12bc.json
  • crates/database/.sqlx/query-5ef18d9b4bb6badbfd56cbdfb2cabb15c25659b5d66ae62c8d5a0b85fc20b3ee.json
  • crates/database/.sqlx/query-671e557d84f12dda78cfdd0414c7eef2a6ba3e323c482c6ca81677cdc7679826.json
  • crates/database/.sqlx/query-896b57210f15ad263747da6781f69fca4938243fb0bbe6a5993c8260b2b8d6a7.json
  • crates/database/.sqlx/query-c19cba4181ec8bddddb82ec457f247defafde572e1b5c275094088bf6509eabb.json
  • crates/database/.sqlx/query-ccd172e920ce55c8a777d68561bd0e3ec39f12f53f86f549e94427540914c09a.json
  • crates/database/src/connection/tests.rs
  • crates/database/src/exclusive/tests.rs
  • crates/database/src/repositories/deletions/tests.rs
  • crates/database/src/repositories/deliveries/tests.rs
  • crates/database/src/repositories/events/tests.rs
  • crates/database/src/repositories/maintenance/tests.rs
  • 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

@PiquelChips
PiquelChips marked this pull request as ready for review November 22, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant