Repository navigation
deps: SQLAlchemy 2.1.8, staying on psycopg2 (DEC-134) - #981
Merged
Merged
Conversation
…l (DEC-134) SQLAlchemy 2.1 resolves a bare postgresql:// to psycopg 3, which this package does not ship, so #966 failed every PG job. normalize_database_url rewrites the bare scheme to postgresql+psycopg2:// as text; every engine in AINDY/ and alembic/env.py passes its URL through it, guarded by a source-derived census (mutation-tested). Operators' DATABASE_URLs are unchanged. PG integration fixtures that build their own engines do the same; the CLI test still passes the bare URL to the runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…et the 2.1 default Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Changelog fragment renamed |
… YAML #981's Integration job failed in runtime-ci.yml's "Verify schema bootstrap on PostgreSQL" step: an inline create_engine(os.environ["DATABASE_URL"]) the .py census could not see. latency-floor.yml had the same. psycopg2.connect calls (upgrade-path-guard.yml) are libpq and keep the bare URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
DEP-UPGRADE-DEFERRED-1, SQLAlchemy half / DEC-134 (owner chose option A).
SQLAlchemy 2.1 changed the default PostgreSQL driver from psycopg2 to psycopg 3. This package ships psycopg2, and every URL operators set is the bare
postgresql://, so #966 failed Integration, Boot Smoke and Upgrade Path withNo module named 'psycopg'. 2.1's notes say psycopg2 "remains fully supported" when the URL names it.The change:
AINDY.config.normalize_database_urlrewrites a barepostgresql://topostgresql+psycopg2://.make_url, becausestr(URL)'s escaping also changed in 2.1.db/database.py,db/schema_ops.py,platform_layer/health_service.py×2,startup.py, andalembic/env.py'sget_url.settings.DATABASE_URLstill reads exactly as the operator wrote it.SQLAlchemy2.0.52 → 2.1.8 at both pin sites.test_cli_fresh_interpreterstill passes the bare URL to the CLI subprocess, so it also proves the runtime handles one under 2.1.Guard (
tests/unit/test_database_url_driver.py):AINDY/andalembic/env.pyfinds everycreate_engine/engine_from_config, asserts each URL goes through the function, and asserts the census isn't empty. Mutation: unwrappingdatabase.py:75fails it and names the line.psycopg2dialect, and a control shows that a bare URL resolves to psycopg 3 on 2.1. That control is the reason the function exists.Other 2.1 changes, checked against this code:
greenletis pinned explicitly, so the asyncio-extra change doesn't matter.tagsis JSONB, which has its own containment operator, so the JSON.contains()deprecation doesn't apply.text()queries. That could change ordering in sessions that mix ORM writes withtext(). The unit subset passes locally on 2.1.8; CI's real-PG Integration, Boot Smoke and Upgrade Path jobs are the judge.Tests run locally on 2.1.8: the guard suite (12), plus
test_runtime_schema_contract,test_fr70_activity_caller,test_effect_compensation,test_lease_fenceandtest_runtime_alembic_head, all green. Ruff is clean. Only a targeted subset ran because host memory was ~570 MB free.After merge: unignore SQLAlchemy 2.1.x for Dependabot (it was ignored on #966), or later 2.1 patches won't arrive.
Records: DEC-134, DEP-UPGRADE-DEFERRED-1 (SQLAlchemy half resolved), CLAUDE.md index line.
🤖 Generated with Claude Code