Skip to content

Honor PostgreSQL TLS settings in pool key#278

Merged
debba merged 2 commits into
TabularisDB:mainfrom
arsis-dev:fix-postgres-ssl-pool-key
Jun 4, 2026
Merged

Honor PostgreSQL TLS settings in pool key#278
debba merged 2 commits into
TabularisDB:mainfrom
arsis-dev:fix-postgres-ssl-pool-key

Conversation

@arsis-dev
Copy link
Copy Markdown
Contributor

Summary

  • Include PostgreSQL ssl_mode in the pool key so cached pools are scoped by the selected TLS mode.
  • Include PostgreSQL ssl_ca in the pool key for verify-ca and verify-full, where the connector actually uses a CA file.
  • Add regression coverage for PostgreSQL pool-key changes while keeping SQLite unaffected by TLS fields.

Context

This is a follow-up to #263. PostgreSQL pool creation already honors ssl_mode and ssl_ca, but the shared pool key only varied by TLS settings for MySQL. After editing a PostgreSQL connection from one TLS mode or CA path to another, the main connection path could reuse an incompatible cached pool.

I did not find an existing open issue or PR for this exact PostgreSQL pool-key scoping bug. Related items checked:

This is intentionally scoped to PostgreSQL pool-key construction and does not change PostgreSQL TLS connector behavior.

Validation

  • cargo test postgres_pool_key_changes_when_ssl -> 2 passed
  • cargo test pool_manager -> 23 passed
  • git diff --check -> passed
  • npm --cache /tmp/gitnexus-npm-cache exec --yes gitnexus -- analyze -> indexed successfully, 11,576 nodes / 21,769 edges / 300 flows
  • npm --cache /tmp/gitnexus-npm-cache exec --yes gitnexus -- impact build_connection_key --direction upstream -> CRITICAL risk, 74 impacted symbols, 5 direct callers, 6 affected flows
  • npm --cache /tmp/gitnexus-npm-cache exec --yes gitnexus -- detect-changes --scope compare --base-ref main -> medium risk, 6 changed symbols, 4 affected flows

Comment thread src-tauri/src/pool_manager_tests.rs Outdated
#[test]
fn postgres_pool_key_ignores_mysql_ssl_key_fields() {
fn postgres_pool_key_changes_when_ssl_mode_changes() {
let required = connection_params("postgres", Some("required"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Use "require" instead of "required" for PostgreSQL SSL mode

The test now validates PostgreSQL-specific pool-key behavior, but "required" is a MySQL-style mode name. PostgreSQL uses "require". All other PostgreSQL tests in this file already use "require", so updating this keeps the test consistent and avoids confusing future maintainers.

Suggested change
let required = connection_params("postgres", Some("required"));
let required = connection_params("postgres", Some("require"));

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot Bot commented Jun 3, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The previously reported typo ("required""require") in src-tauri/src/pool_manager_tests.rs has been fixed.

Files Reviewed (2 files)
  • src-tauri/src/pool_manager.rs
  • src-tauri/src/pool_manager_tests.rs

Reviewed by kimi-k2.6-20260420 · 155,470 tokens

@NewtTheWolf
Copy link
Copy Markdown
Contributor

LGTM 🚀 @arsis-dev @debba — verified the key matches what build_postgres_tls_connector actually consumes: ssl_mode always, ssl_ca only for verify-ca/verify-full, and ssl_cert/ssl_key correctly omitted since the PG connector uses with_no_client_auth(). Any over-scoping only costs a redundant pool, never a wrongly-shared one. Nice test coverage too.

@debba
Copy link
Copy Markdown
Collaborator

debba commented Jun 4, 2026

Thanks a lot @arsis-dev and @NewtTheWolf for the review
I will merge it

@debba debba merged commit 7def318 into TabularisDB:main Jun 4, 2026
2 checks passed
@arsis-dev
Copy link
Copy Markdown
Contributor Author

Thanks to you @debba! 🙏 Tabularis has been really useful and inspiring to me. I really appreciate your work.

@debba
Copy link
Copy Markdown
Collaborator

debba commented Jun 4, 2026

Always welcome to contribute!
Feel free to create a PRs and join in our Discord server if you want!

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.

3 participants