chore(deps): migrate to sqlx 0.9 (and ipnetwork 0.21)#111
Merged
Conversation
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
3204072 to
4beafb6
Compare
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-sqlxis 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) changesDatabase::Arguments,ArgumentBuffer, andStatementlose their lifetime parameters (onlyValueRef<'r>keeps one). Updated the associated types and everyArgumentBuffer<'q>reference across the type impls.Arguments/IntoArgumentslose their lifetime parameter;addmoves the lifetime onto the method.Statementnow owns aSqlStr(no lifetime), isClone, and exposesinto_sql/sql() -> &SqlStr.Connection/ConnectOptionstrait methods became RPITIT — implemented withasync fn.TransactionManagermoved tosqlx_core::transactionand now usesimpl Future.Executor:Execute::sqlconsumesselfand returnsSqlStr, sotake_argumentsis now called beforesql();prepare_with/describetake an ownedSqlStr.describeis gated behind sqlx-core'sofflinefeature, which we now enable unconditionally so the impl is consistent whether the crate is built alone or with the rest of the workspace.Type/Encode/Decodeimpls for&T,Cow,Box<[T]>, andJsonRawValue/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.JsonRawValue→Json<&Self>→ the driver'sJsonimpl → jsonb).query*helpers takeimpl SqlSafeStrto mirror the new sqlx 0.9 API.Host-side changes
PgArgumentBufferlost its lifetime; dynamic SQL in the sql plugin wrapped withAssertSqlSafe.raw_sqlcalls wrapped withAssertSqlSafe(the new injection-audit gate).runtime-tokio-rustlscombo feature withruntime-tokio+tls-rustls.Verification
cargo check --workspace --all-features --locked✅cargo clippy --workspace --all-targets --all-features✅ (0 warnings)The DB-backed
nextestandcargo sqlx prepare --checkjobs run in CI (no Postgres available in my environment). Noquery!/query_as!macro invocations changed, so the checked-in.sqlxoffline cache is unaffected.https://claude.ai/code/session_01KN3PaeQ1pFq1B3uReMqHjp
Generated by Claude Code