Skip to content

fix(db): fix Postgres LIMIT=0 crash and collapse DbConfig pool fields#6121

Merged
bug-ops merged 1 commit into
mainfrom
fix/5980-postgres-limit-pool-cfg
Jul 12, 2026
Merged

fix(db): fix Postgres LIMIT=0 crash and collapse DbConfig pool fields#6121
bug-ops merged 1 commit into
mainfrom
fix/5980-postgres-limit-pool-cfg

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • SessionStore::list and 3 sibling list_* helpers bound LIMIT ? with -1 as a limit == 0 ("unlimited") sentinel — a SQLite-only convenience that PostgreSQL rejects at execution time. Added 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.
  • Collapsed DbConfig::max_connections/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 across ~15 call sites. Pre-v1.0.0, so max_connections was removed outright rather than deprecated — confirmed via workspace-wide grep it was never a user-facing config.toml key, CLI flag, or --init wizard prompt, so no migration step is needed.

Closes #5980
Closes #5970

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings — clean
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 12999/12999 passed
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler" — clean
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked — clean
  • cargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler" — all pass
  • Per-crate rustdoc gate for touched published crates (zeph-db, zeph-session, zeph-memory, zeph-scheduler, zeph-orchestration, zeph-mcp, zeph-durable, zeph-index), with correct feature flags per crate (postgres for zeph-db; daemon/llm-planning where modules are feature-gated) — clean
  • Live-verified against real Postgres via testcontainers/Docker: zeph-session postgres_integration (3/3, including a new test covering get/get_by_conversation_id's TIMESTAMPTZ decode path), zeph-memory postgres_integration (49/49, 0 regressions)
  • .local/testing/playbooks/zeph-db-dual-backend.md §14 and .local/testing/coverage-status.md updated with live-verification results
  • CHANGELOG.md updated under [Unreleased]

@github-actions github-actions Bot added documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes dependencies Dependency updates bug Something isn't working size/XL Extra large PR (500+ lines) labels Jul 12, 2026
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
bug-ops enabled auto-merge (squash) July 12, 2026 00:40
@bug-ops
bug-ops force-pushed the fix/5980-postgres-limit-pool-cfg branch from f01867a to 713e0b4 Compare July 12, 2026 00:40
@bug-ops
bug-ops merged commit 8212ab4 into main Jul 12, 2026
47 checks passed
@bug-ops
bug-ops deleted the fix/5980-postgres-limit-pool-cfg branch July 12, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Dependency updates documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant