Skip to content

fix(database): unify PostgreSQL selection with legacy indexing connections - #72

Merged
spelech merged 4 commits into
mainfrom
jules-15709480853732629288-1a472612
Oct 28, 2026
Merged

spelech merged 4 commits into
mainfrom
jules-15709480853732629288-1a472612

Conversation

@spelech

@spelech spelech commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Unifies PostgreSQL relational database selection with legacy indexing, repository, setting, credential, ADR, search, and file deletion paths via PostgresConnectionAdapter. Replaces SQLite-specific statements with ANSI SQL ON CONFLICT DO UPDATE SET, asserts no fallback SQLite files are created under PostgreSQL, and documents migration/rollback procedures.

Fixes #45


PR created automatically by Jules for task 15709480853732629288 started by @spelech

…tions

- Implement PostgresConnectionAdapter and DictRow in connection.py for PostgreSQL relational database selection
- Ensure get_db_connection() never creates or queries fallback SQLite database when PostgreSQL is selected
- Standardize INSERT OR REPLACE INTO queries to standard ON CONFLICT(...) DO UPDATE SET across credentials, embedding_cache, git_syncer, and local_syncer
- Update column migration check functions for PostgreSQL information_schema compatibility
- Document schema migration, database selection, and rollback procedures in DEVELOPER_DOCS.md
- Add comprehensive test suite in tests/test_postgres_unified_connection.py

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

…tions

- Implement PostgresConnectionAdapter and DictRow in connection.py for PostgreSQL relational database selection
- Ensure get_db_connection() never creates or queries fallback SQLite database when PostgreSQL is selected
- Standardize INSERT OR REPLACE INTO queries to standard ON CONFLICT(...) DO UPDATE SET across credentials, embedding_cache, git_syncer, and local_syncer
- Update column migration check functions for PostgreSQL information_schema compatibility
- Configure asyncio_default_fixture_loop_scope in pytest.ini for CI pytest runs
- Document schema migration, database selection, and rollback procedures in DEVELOPER_DOCS.md
- Add comprehensive test suite in tests/test_postgres_unified_connection.py

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@spelech

spelech commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

@jules Please review and address the following items for this PR:

Issues to Fix

  1. CRITICAL ARCHITECTURE - Enforce Maximum 500 Lines per File Rule:
    • app/services/database/connection.py has grown to 736 lines, violating the project standard (<= 500 lines per file).
    • Extract the SQLite-to-PostgreSQL compatibility shim (PostgresCompatCursor and PostgresCompatConnection) into a dedicated module: app/services/database/postgres_compat.py.
    • Ensure both connection.py and postgres_compat.py remain strictly under 500 lines of code.
  2. Requirement Traceability:
    • Tag tests in tests/test_postgres_unified_connection.py with @pytest.mark.requirement("DB-POSTGRES-UNIFIED-01").
    • Re-sync docs/REQUIREMENTS.md.

How to Confirm the Fix

Run the following commands to confirm everything passes:

wc -l app/services/database/connection.py app/services/database/postgres_compat.py
pytest tests/test_postgres_unified_connection.py -v
python3 scripts/generate_requirements.py
pytest tests/backend/test_requirements_sync.py

spelech and others added 2 commits October 28, 2026 01:57
…tions

- Implement PostgresConnectionAdapter and DictRow in connection.py for PostgreSQL relational database selection
- Ensure get_db_connection() never creates or queries fallback SQLite database when PostgreSQL is selected
- Standardize INSERT OR REPLACE INTO queries to standard ON CONFLICT(...) DO UPDATE SET across credentials, embedding_cache, git_syncer, and local_syncer
- Update column migration check functions for PostgreSQL information_schema compatibility
- Configure asyncio_default_fixture_loop_scope in pytest.ini for CI pytest runs
- Document schema migration, database selection, and rollback procedures in DEVELOPER_DOCS.md
- Add comprehensive test suite in tests/test_postgres_unified_connection.py

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@spelech
spelech merged commit 99df67a into main Oct 28, 2026
10 checks passed
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.

fix(database): unify PostgreSQL selection with legacy indexing connections

1 participant