Repository navigation
Fix runtime string predicates and PostgreSQL native parameter binding - #112
Merged
Merged
Conversation
added 4 commits
October 6, 2026 21:47
Dastari
marked this pull request as ready for review
October 6, 2026 22:39
This was referenced Oct 6, 2026
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.
Runtime
EndsWith("")returned only the empty SQLite value, and PostgreSQL prefix/suffix predicates failed because driver normalization split repeated native parameters into different slots. This independent fix makes empty operands match all non-null strings and preserves complete-statement PostgreSQL native binding identity.The base is
df474c761c4057cb643e27a6582dd0376f56e31f, the source of publishedworkspace-2026.10.03.2(ORM/macros 0.39.0). Main and the latest published release were rechecked on October 6; neither contains this fix. This branch aligns ORM/macros at 0.39.1 (macros alignment only).Compatibility
is_nullcan include it. Unicode and literal%,_, backslash and placeholder-shaped values stay bound parameters.PostgresBackend::normalize_sql, native-only complete statements preserve$nidentity and repeated references. Positive start N adds N−1 to each index. Native out-of-order references also retain their true slots. This intentional correction removes reliance on occurrence order for native statement indices.SqlDialect::normalize_sqlkeeps static fragment rebasing: generated fragments can use arbitrary indices or restart numbering for separate values. Changing that behavior would break existing generated filters. Tests cover both contracts and nested generated clauses.Verification
Final base:
df474c761c4057cb643e27a6582dd0376f56e31f.Final head:
01d4134da18028ec58e318e0ffd30ab244d0d8e1.ORM/macros: 0.39.1, required lane features
sqliteorpostgreswith default features disabled. Rust 1.97.1. Disk-backed scratch/build caches,CARGO_BUILD_JOBS=2, sequential backend builds, debugline-tables-only, incremental disabled. No workspace all-features command.Before production edits, the baseline SQLite seven-row fixture failed with empty-suffix count 1 instead of 7; PostgreSQL runtime execution failed safely as
backend_execution, and the native-repeat test producedSELECT $1, $2instead ofSELECT $1, $1. The corrected first seven non-null rows return prefix π = 2, suffix foo = 1, empty prefix/suffix = 7 on both backends. Extended execution covers Unicode/emoji/newline, case, literal%/_/backslash/quotes/placeholder-shaped data, longer operands, SQL NULL and explicit null inclusion, AND/OR/NOT, separately bound visibility, both keyset directions, tied keys and matching total counts. Invalid cursors are rejected against a closed pool before I/O; safe errors omit caller values.PostgreSQL exercises plain driver reads, transaction executor reads, pool/executor writes with repeated parameters, authenticated read/count pairs, counted/uncounted runtime reads, and a verified nonowner/NOBYPASSRLS role. Current tenant authorization applies before pages/counts, different identities see their own partitions, and transaction-local settings do not leak into subsequent unauthenticated requests. SQLite/PostgreSQL no-op replans after reads prove the physical target is unchanged. Static nested generated filters preserve fragment rebasing.
Audit: the seven PostgreSQL normalization call sites use this complete-statement boundary; transaction adapters delegate to those executor paths. Runtime relation batch row/count rendering also calls the shared
RuntimePredicate::render(runtime_relations.rs), and uses the same authenticated backend paths. Existing SQLite relation batching tests passed; no separate live PostgreSQL relation-predicate conformance is claimed here.Actual commands/results (each cargo command used the two-job disk-cache environment above):
cargo fmt --all -- --check cargo fmt --manifest-path crates/graphql-orm/tests/fixtures/repository-aggregate-consumer/Cargo.toml -- --check python3 scripts/check-documentation.py --base df474c761c4057cb643e27a6582dd0376f56e31f python3 scripts/generate-workspace-inventory.py --check scripts/check-workspace-dependencies.sh scripts/check-package-release-policy.sh df474c761c4057cb643e27a6582dd0376f56e31f scripts/check-semver.sh df474c761c4057cb643e27a6582dd0376f56e31f python3 scripts/check-release-state.py scripts/check-release-manifest.sh python3 scripts/test-release-manifest.py python3 scripts/test-router-notices.py python3 scripts/check-pr-documentation-impact.py # PASS; PR_BODY supplied for the documentation-impact check.PostgreSQL tests own loopback Docker PostgreSQL 17 containers and verify immutable container ID/ownership before cleanup; the new fixtures additionally check database/user identity. SQLite uses exclusively owned in-memory pools and verifies no on-disk path before close. Ambient database URLs are refused. The updated CI, release validation and owned-backend scripts are configured to execute the normally ignored PostgreSQL runtime/consumer tests.
The standalone runtime string example uses existing schema-bound APIs, current structural visibility and private projection without handwritten query SQL. Core runtime APIs/cursor formats are preserved. This is an upstream release candidate, not downstream adoption: Digibase remains unchanged, and its ignored release gates were not run or counted as passing.
Documentation impact
Updated the canonical runtime-query reference with exact empty/null/string behavior, complete-statement versus fragment binding, provider limitations, examples and verification commands. Updated both package READMEs, CHANGELOG, MIGRATION, aligned manifests/locks and generated workspace inventory. No accepted ADR or runtime-platform proposal changes.
No merge or release has been performed for this fix. Owner review/authorization is required; downstream adoption follows an immutable reviewed release and consumer-owned backend gates.
Hosted verification: the owner paused GitHub Actions during final handoff. Eleven checks passed; the companions check was canceled after the owner paused Actions. The run is completed with a canceled conclusion. No reruns, dispatches or workflow enablement will be performed. Local verification above completed independently.