Skip to content

chore(deps): migrate to sqlx 0.9 (and ipnetwork 0.21)#111

Merged
swlynch99 merged 4 commits into
mainfrom
claude/bump-sqlx-0.9
Jun 10, 2026
Merged

chore(deps): migrate to sqlx 0.9 (and ipnetwork 0.21)#111
swlynch99 merged 4 commits into
mainfrom
claude/bump-sqlx-0.9

Conversation

@swlynch99

Copy link
Copy Markdown
Contributor

What

Migrates the workspace from sqlx 0.8 → 0.9, and ipnetwork 0.20 → 0.21 in lockstep (sqlx-postgres pins ipnetwork, and the runtime passes values across the sqlx boundary, so the two cannot move independently).

This is the large one flagged earlier: durable-sqlx is a ~8,300-line custom sqlx driver, and 0.9 reworks the core driver traits. The bump produced 135 compile errors initially; this PR resolves all of them.

Driver (durable-sqlx) changes

  • Lifetime removals: Database::Arguments, ArgumentBuffer, and Statement lose their lifetime parameters (only ValueRef<'r> keeps one). Updated the associated types and every ArgumentBuffer<'q> reference across the type impls.
  • Arguments / IntoArguments lose their lifetime parameter; add moves the lifetime onto the method.
  • Statement now owns a SqlStr (no lifetime), is Clone, and exposes into_sql / sql() -> &SqlStr.
  • Connection / ConnectOptions trait methods became RPITIT — implemented with async fn. TransactionManager moved to sqlx_core::transaction and now uses impl Future.
  • Executor: Execute::sql consumes self and returns SqlStr, so take_arguments is now called before sql(); prepare_with / describe take an owned SqlStr. describe is gated behind sqlx-core's offline feature, which we now enable unconditionally so the impl is consistent whether the crate is built alone or with the rest of the workspace.
  • Blanket-impl conflicts: dropped the driver's Type / Encode / Decode impls for &T, Cow, Box<[T]>, and JsonRawValue / Box<JsonRawValue> that now conflict with blanket impls added in sqlx 0.9. Behaviour is preserved — the new blankets delegate back to the base impls the driver still defines (e.g. JsonRawValueJson<&Self> → the driver's Json impl → jsonb).
  • Public query* helpers take impl SqlSafeStr to mirror the new sqlx 0.9 API.

Host-side changes

  • durable-runtime: PgArgumentBuffer lost its lifetime; dynamic SQL in the sql plugin wrapped with AssertSqlSafe.
  • durable-migrate: dynamic DDL/DML and raw_sql calls wrapped with AssertSqlSafe (the new injection-audit gate).
  • durable-test: replaced the removed runtime-tokio-rustls combo feature with runtime-tokio + tls-rustls.

Verification

  • cargo check --workspace --all-features --locked
  • cargo clippy --workspace --all-targets --all-features ✅ (0 warnings)

The DB-backed nextest and cargo sqlx prepare --check jobs run in CI (no Postgres available in my environment). No query!/query_as! macro invocations changed, so the checked-in .sqlx offline cache is unaffected.

https://claude.ai/code/session_01KN3PaeQ1pFq1B3uReMqHjp


Generated by Claude Code

@swlynch99 swlynch99 enabled auto-merge (squash) June 10, 2026 08:35
sqlx 0.9 reworks several traits that the custom `durable-sqlx` driver
implements. ipnetwork is bumped in lockstep because sqlx-postgres pins it.

Driver (durable-sqlx) changes:
- Database::Arguments, ArgumentBuffer and Statement lose their lifetime
  parameters; ValueRef keeps its lifetime. Updated the associated types
  and every `ArgumentBuffer<'q>` reference across the type impls.
- Arguments / IntoArguments lose their lifetime parameter; `add` moves
  the lifetime onto the method.
- Statement now owns a `SqlStr` (no lifetime), is `Clone`, and exposes
  `into_sql`/`sql() -> &SqlStr`.
- Connection / ConnectOptions trait methods became RPITIT; implemented
  with `async fn`. TransactionManager moved to `sqlx_core::transaction`
  and uses `impl Future`.
- Executor: `Execute::sql` now consumes self and returns `SqlStr`, so
  `take_arguments` is called before `sql()`; `prepare_with`/`describe`
  take an owned `SqlStr`. `describe` is gated behind sqlx-core's
  `offline` feature, which we now enable unconditionally to keep the
  impl consistent across builds.
- Dropped the driver's `Type`/`Encode`/`Decode` impls for `&T`, `Cow`,
  `Box<[T]>` and `JsonRawValue`/`Box<JsonRawValue>` that now conflict
  with blanket impls added in sqlx 0.9 (behaviour is preserved as the
  blankets delegate to the remaining base impls).
- Public `query*` helpers take `impl SqlSafeStr` to mirror sqlx 0.9.

Host-side changes:
- durable-runtime: `PgArgumentBuffer` lost its lifetime; dynamic SQL in
  the sql plugin wrapped with `AssertSqlSafe`.
- durable-migrate: dynamic DDL/DML and `raw_sql` calls wrapped with
  `AssertSqlSafe`.
- durable-test: replaced the removed `runtime-tokio-rustls` feature with
  `runtime-tokio` + `tls-rustls`.

Verified with `cargo check --workspace --all-features --locked` and
`cargo clippy --workspace --all-targets --all-features` (both clean). The
DB-backed nextest and `cargo sqlx prepare --check` jobs run in CI; no
`query!` macro invocations changed, so the .sqlx cache is unaffected.

https://claude.ai/code/session_01KN3PaeQ1pFq1B3uReMqHjp
@swlynch99 swlynch99 force-pushed the claude/bump-sqlx-0.9 branch from 3204072 to 4beafb6 Compare June 10, 2026 08:38
claude added 3 commits June 10, 2026 08:41
Break long method chains, collapse the Connection::begin signature, and
re-wrap two comments to satisfy the nightly rustfmt config used in CI.

https://claude.ai/code/session_01KN3PaeQ1pFq1B3uReMqHjp
- Regenerate the offline query cache with sqlx-cli 0.9 (adds the new
  per-column `origin` provenance field and a trailing newline to each
  file). Generated with --all-targets --all-features so the test-only
  queries the clippy job needs offline are retained.
- Re-export `AssertSqlSafe` / `SqlSafeStr` / `SqlStr` from durable-sqlx so
  callers of the `query*` helpers (which now take `impl SqlSafeStr`) can
  wrap dynamic SQL.
- Update the SQL-injection doctest to wrap the dynamic string in
  `AssertSqlSafe`, mirroring sqlx 0.9's own updated example.

https://claude.ai/code/session_01KN3PaeQ1pFq1B3uReMqHjp
Order the external sqlx re-export before the crate-local ones per
group_imports, and keep the doctest statement on a single line. Verified
with nightly rustfmt matching CI.

https://claude.ai/code/session_01KN3PaeQ1pFq1B3uReMqHjp
@swlynch99 swlynch99 merged commit fc73ad8 into main Jun 10, 2026
7 checks passed
@swlynch99 swlynch99 deleted the claude/bump-sqlx-0.9 branch June 10, 2026 09:00
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.

2 participants