Skip to content

fix: add client url to support custom url options for DB connection.#284

Merged
kalenkevich merged 1 commit intomainfrom
fix/connection_string
Apr 21, 2026
Merged

fix: add client url to support custom url options for DB connection.#284
kalenkevich merged 1 commit intomainfrom
fix/connection_string

Conversation

@kalenkevich
Copy link
Copy Markdown
Collaborator

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

2. Or, if no issue exists, describe the change:

Problem:
When using DatabaseSessionService with non-SQLite database connection URIs via the --session_service_uri flag, the existing logic decomposed the connection string and only returned basic connection options (host, port, user, password, and dbName). This stripped out query parameters (such as sslmode=require) and broke standard Postgres Unix-domain socket URL formats containing query parameters or percent-encoded paths, making it impossible to connect to instances requiring specific driver parameters or socket-based routing.

Solution:
Simplified getConnectionOptionsFromUri to directly return the clientUrl option for all non-SQLite drivers, bypassing manual URI parsing completely. Passing the full, untouched connection string down to MikroORM ensures that query parameters and Unix-domain socket configurations are handled natively and correctly by the underlying database drivers.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
 RUN  v3.2.4 /Users/kalenkevich/projects/adk-js

 ✓ |unit:core| core/test/sessions/db/operations_test.ts (14 tests) 46ms
 ✓ |unit:core| core/test/sessions/database_session_service_test.ts (15 tests) 193ms

 Test Files  5 passed (5)
      Tests  51 passed (51)

Manual End-to-End (E2E) Tests:

  • Verified that valid Postgres URLs (with/without SSL mode parameters and Unix-socket paths) are preserved and successfully mapped to clientUrl in the database configuration.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

@kalenkevich kalenkevich merged commit bf8fade into main Apr 21, 2026
8 checks passed
@kalenkevich kalenkevich deleted the fix/connection_string branch April 21, 2026 01:19
@kalenkevich kalenkevich mentioned this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants