fix(db): fix Postgres LIMIT=0 crash and collapse DbConfig pool fields#6121
Merged
Conversation
SessionStore::list and 3 sibling list_* helpers in zeph-session/zeph-memory
bound LIMIT with -1 as a limit=0 ("unlimited") sentinel, which is a
SQLite-only convenience that PostgreSQL rejects at execution time. Add a
shared zeph_db::limit_clause() helper that omits the LIMIT clause entirely
when unlimited, applied consistently across all 5 affected call sites.
Also fixes a related pre-existing bug surfaced by the new Postgres test
coverage: SessionStore::get/list/get_by_conversation_id decoded
created_at/updated_at as String against Postgres TIMESTAMPTZ columns,
breaking every SessionStore query under the postgres feature.
Collapse DbConfig::max_connections and pool_size into a single pool_size
field. The two fields had contradictory documentation and behavior
(pool_size actually governed the Postgres pool despite being documented
"SQLite only"; max_connections was dead under postgres and combined via
max() under sqlite), kept in sync only by caller convention. Pre-v1.0.0,
so removed max_connections outright rather than deprecating it.
Closes #5980
Closes #5970
bug-ops
enabled auto-merge (squash)
July 12, 2026 00:40
bug-ops
force-pushed
the
fix/5980-postgres-limit-pool-cfg
branch
from
July 12, 2026 00:40
f01867a to
713e0b4
Compare
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.
Summary
SessionStore::listand 3 siblinglist_*helpers boundLIMIT ?with-1as alimit == 0("unlimited") sentinel — a SQLite-only convenience that PostgreSQL rejects at execution time. Added a sharedzeph_db::limit_clause()helper that omits theLIMITclause entirely when unlimited, applied consistently across all 5 affected call sites.SessionStore::get/list/get_by_conversation_iddecodedcreated_at/updated_atasStringagainst PostgresTIMESTAMPTZcolumns, breaking everySessionStorequery under thepostgresfeature.DbConfig::max_connections/pool_sizeinto a singlepool_sizefield. The two fields had contradictory documentation and behavior (pool_sizeactually governed the Postgres pool despite being documented "SQLite only";max_connectionswas dead under postgres and combined via.max()under sqlite), kept in sync only by caller convention across ~15 call sites. Pre-v1.0.0, somax_connectionswas removed outright rather than deprecated — confirmed via workspace-wide grep it was never a user-facingconfig.tomlkey, CLI flag, or--initwizard prompt, so no migration step is needed.Closes #5980
Closes #5970
Test plan
cargo +nightly fmt --check— cleancargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings— cleancargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 12999/12999 passedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"— cleanRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— cleancargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler"— all passpostgresfor zeph-db;daemon/llm-planningwhere modules are feature-gated) — cleanzeph-sessionpostgres_integration (3/3, including a new test coveringget/get_by_conversation_id's TIMESTAMPTZ decode path),zeph-memorypostgres_integration (49/49, 0 regressions).local/testing/playbooks/zeph-db-dual-backend.md§14 and.local/testing/coverage-status.mdupdated with live-verification resultsCHANGELOG.mdupdated under[Unreleased]