chore(deps): update sqlx requirement from 0.8 to 0.9#272
chore(deps): update sqlx requirement from 0.8 to 0.9#272dependabot[bot] wants to merge 1 commit into
Conversation
Updates the requirements on [sqlx](https://github.com/launchbadge/sqlx) to permit the latest version. - [Changelog](https://github.com/launchbadge/sqlx/blob/main/CHANGELOG.md) - [Commits](transact-rs/sqlx@v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: sqlx dependency-version: 0.9.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
There was a problem hiding this comment.
Summary
This PR upgrades sqlx from version 0.8 to 0.9, a major version bump with significant breaking changes. While the dependency change itself is straightforward (single line in Cargo.toml), the codebase contains multiple usages that will fail to compile with sqlx 0.9 due to the new SqlSafeStr requirement for dynamic queries.
Verdict: BLOCKED - Cannot merge without fixing the dynamic query usages identified below.
Research notes
I reviewed the sqlx 0.9.0 changelog extensively. Key breaking changes relevant to this codebase:
-
[#3723]:
SqlSafeStrtrait - Allquery*()functions now takeimpl SqlSafeStr, which is only implemented for&'static strandAssertSqlSafe. This is a security feature to make dynamic SQL construction more visible during code review. -
MSRV increased to 1.94.0 - Per sqlx's MSRV policy, this release cycle supports Rust 1.94.0+
-
Other breaking changes (not affecting this codebase): Changes to
Migratetrait,RawSql,PgHasArrayType,Cowdecoding behavior, PostgreSQL options escaping
The codebase does NOT use the other breaking change patterns (no manual PgHasArrayType impls, no Migrator::set_* methods, no RawSql usage).
Suggested next steps
- BLOCKING: Wrap all dynamic SQL strings in
sqlx::AssertSqlSafe()or refactor to usesqlx::query()with static strings where possible - Verify Rust MSRV is compatible (1.94.0+)
- Regenerate
.sqlx/query cache after making code changes - Run full test suite to ensure no regressions
- Consider adding a note to CLAUDE.md about the
AssertSqlSafepattern for future contributors
General findings
Dependency upgrade scope
This is a well-scoped PR that only changes the sqlx version constraint. However, the impact extends beyond this single line change because sqlx 0.9 introduces API-breaking changes that affect existing code patterns.
Features used by this codebase
The fusillade codebase uses sqlx for:
- Compile-time checked queries via
sqlx::query!(),sqlx::query_as!(),sqlx::query_scalar!()macros - Runtime-checked dynamic queries via
sqlx::query(),sqlx::query_as(),sqlx::query_scalar() - Type derives:
#[derive(sqlx::FromRow)],#[derive(sqlx::Type)] - Migrations via
sqlx::migrate!() - Connection pooling via
sqlx::PgPool - Advisory locks via
pg_try_advisory_lock()
All of these continue to work in 0.9 EXCEPT the dynamic query construction pattern.
| hostname = "0.4" | ||
| dashmap = { version = "6", features = ["serde"] } | ||
| sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "uuid", "chrono", "json", "tls-rustls"], optional = true } | ||
| sqlx = { version = "0.9", features = ["runtime-tokio", "postgres", "uuid", "chrono", "json", "tls-rustls"], optional = true } |
There was a problem hiding this comment.
Blocking: This version upgrade will cause compilation failures due to the SqlSafeStr breaking change introduced in sqlx 0.9.
Why it matters: In sqlx 0.9, all query*() functions now require impl SqlSafeStr parameter, which is only implemented for &'static str and AssertSqlSafe. The codebase has at least 6 locations using format!() to construct dynamic SQL queries:
src/manager/postgres.rs:3678-count_sql = format!(...)src/manager/postgres.rs:3697-sqlx::query_scalar(&count_sql)src/manager/postgres.rs:3723-sqlx::query_scalar(&format!(...))src/manager/postgres.rs:3755-sqlx::query_as(&format!(...))src/manager/response_step.rs:122-sqlx::query(&query)where query is fromformat!()src/manager/response_step.rs:138- same patternsrc/manager/response_step.rs:172- same pattern
These will all fail to compile with sqlx 0.9 because String (from format!()) does not implement SqlSafeStr.
Suggested fix: Wrap each dynamic query string in sqlx::AssertSqlSafe(). For example:
// Before:
let query = format!("SELECT {} FROM ...", columns);
sqlx::query(&query)
// After:
let query = format!("SELECT {} FROM ...", columns);
sqlx::query(sqlx::AssertSqlSafe(&query))Alternatively, consider whether these queries can be refactored to use static SQL with parameter binding instead of string interpolation (safer long-term).
| hostname = "0.4" | ||
| dashmap = { version = "6", features = ["serde"] } | ||
| sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "uuid", "chrono", "json", "tls-rustls"], optional = true } | ||
| sqlx = { version = "0.9", features = ["runtime-tokio", "postgres", "uuid", "chrono", "json", "tls-rustls"], optional = true } |
There was a problem hiding this comment.
Non-blocking: MSRV (Minimum Supported Rust Version) consideration.
Why it matters: According to the sqlx 0.9 changelog, this release increases the MSRV to Rust 1.94.0. You should verify that your CI pipeline and deployment targets support this Rust version.
Check your .github/workflows/ or CI configuration to ensure the Rust toolchain version is compatible.
Suggested fix: Update CI configuration if necessary to use Rust 1.94.0 or later. Add an rust-version field to Cargo.toml to document the MSRV for future maintainers:
[package]
rust-version = "1.94"| hostname = "0.4" | ||
| dashmap = { version = "6", features = ["serde"] } | ||
| sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "uuid", "chrono", "json", "tls-rustls"], optional = true } | ||
| sqlx = { version = "0.9", features = ["runtime-tokio", "postgres", "uuid", "chrono", "json", "tls-rustls"], optional = true } |
There was a problem hiding this comment.
Nit: After resolving the breaking changes, remember to regenerate the .sqlx/ query cache.
Run cargo sqlx prepare after making code changes to update the offline query metadata cache. This ensures the project can build in CI environments without direct database access and keeps compile-time query checking working correctly.
Updates the requirements on sqlx to permit the latest version.
Changelog
Sourced from sqlx's changelog.
... (truncated)
Commits
75bc048Release 0.9.0 (#4256)6956cefPrefer to give real data to.bind()inREADME.md(#4257)45ba990Add the possibility to skip migrations (#3846)66533faEnsure Deterministic Migration Order (#4136)db47fe3ci: check direct minimal versions (#4173)9ecb76dUnescape PostgreSQL passfile password (#3993)c0a3218breaking(any+mysql): correctly convert text and blob types toAnyTypeInfo(...d82b781test(sqlite): add regression test for ORDER BY + LIMIT nullability (#4223)b77ba16chore: update to axum 0.8 (#4253)c0ec9c0fix(tls): potential deadlock inStdSocket::poll_ready()(#4251)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)