Skip to content

Test SQLAlchemy offline on the declared minimum and the latest release (GH-1543) - #1620

Merged
laughingman7743 merged 9 commits into
masterfrom
ci/1543-sqlalchemy-version-matrix
Dec 1, 2026
Merged

laughingman7743 merged 9 commits into
masterfrom
ci/1543-sqlalchemy-version-matrix

Conversation

@laughingman7743

@laughingman7743 laughingman7743 commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

WHAT

  • just test offline-sqla SERIES|VERSION. The recipe runs the SQLAlchemy tests that need no AWS (tests/pyathena/sqlalchemy/, tests/pyathena/aio/sqlalchemy/, -m "not aws") on another SQLAlchemy release. It also collects the compliance suites (tests/sqlalchemy/, synchronous and --dburi async); collecting imports them without connecting.
    • A series such as 2.0 runs its latest release that the sqlalchemy/aiosqlalchemy extras allow. uv resolves it with uv pip compile --resolution highest and a >=2.0,<2.1 constraint, so pyproject.toml stays the only place that declares the allowed range. The other dependencies stay at their locked versions. A full version such as 2.1.9 runs that version.
    • The tests run with uv run --offline --no-sync --with "sqlalchemy[asyncio]==X", which changes neither the developer's .venv nor uv.lock. The packages are resolved and cached before the no-AWS environment removes the proxy settings. The recipe prints the SQLAlchemy version that it runs.
    • The no-AWS environment of just test offline moves unchanged into a shared _offline recipe that both targets use. just test passes extra arguments to its target.
  • A new offline-sqla job in .github/workflows/test.yaml. It runs each supported series, 2.0 and 2.1 (fail-fast: false), for every event, as the offline job does.
    • Each series runs on the newest Python version for which its releases publish compiled wheels: 2.0 on 3.14 (SQLAlchemy 2.0 has only a pure-Python wheel for 3.15, without the C extensions) and 2.1 on 3.15. The matrix comment says why the versions differ, and to move a series to a newer Python version once it publishes compiled wheels. Both rows use setup-python, because uv's Python 3.13+ cannot compile Python.h.
    • The AWS suites do not wait for it, so a new SQLAlchemy release that breaks it does not stop the AWS suites of unrelated pull requests. The Release workflow requires it, as it requires every job of the Test workflow.
    • The locked version stays covered by offline.
  • The compliance suite on SQLAlchemy 2.1. NameDenormalizeTest (new in 2.1) reads column names from the result; Athena returns them in lowercase, including quoted names (ALL_UPPERCASE → all_uppercase). Its driver-SQL and textual statements are skipped, and the core select, which maps columns by position, still runs.
  • Docs. docs/testing.md (the offline section and GitHub Actions), docs/contributing.md (SQLAlchemy dialect changes) and AGENTS.md describe the new target.

WHY

Closes #1543. CI tested SQLAlchemy only at the locked version, so the declared minimum and new releases broke unnoticed: #1542 (2.0.48), #1563 and #1569 (2.1). The design follows Claude Fable 5.2's proposal, consulted in parallel with Codex; the maintainer chose it over a version-pinned job with path filters. The maintainer then replaced the minimum/latest rows with one row per series, which keeps the latest 2.0 release tested after the lock moves to 2.1.

The maintainer decided to run once, against Athena, the compliance tests that SQLAlchemy 2.1.9 adds over the locked 2.0.58. Whether the compliance suites also run on these versions in CI stays out of this PR, because they need AWS.

TEST

Tested commit: 8d30938 (on b2620f4).

  • just lint, just docs lint: passed. actionlint on test.yaml: no findings.
  • just test offline-sqla 2.0 on Python 3.14 (SQLAlchemy 2.0.58) and just test offline-sqla 2.1 on Python 3.15 (2.1.9), with UV_PYTHON as in CI: 734 passed each; collection of the compliance suites (synchronous and async) succeeded.
  • just test offline-sqla 2.1.9: 734 passed (6 warnings).
  • just test offline after the refactor: 4572 passed.
  • Live, SQLAlchemy 2.1.9, the compliance tests collected on 2.1.9 but not on 2.0.58 (-k on ArgSignatureTest, TableDDLTest/FutureTableDDLTest if-(not-)exists, HasTableTest.test_has_multi_table*, NameDenormalizeTest, TableViaSelectTest, WindowFunctionTest range/caching; 80 cases):
    • synchronous: 47 passed, 27 skipped by requirements, 6 failed, all NameDenormalizeTest (lowercase names, as above);
    • async (--dburi async): the same, 47 passed, 27 skipped, 6 failed, all NameDenormalizeTest;
    • with the skip: NameDenormalizeTest 2 passed, 6 skipped, on both.
  • Not run: a full compliance suite on 2.1.

🤖 Generated with Claude Code

laughingman7743 and others added 3 commits November 30, 2026 22:28
GH-1543)

CI ran the SQLAlchemy tests only on the locked version, so defects at
the declared minimum and on new releases (#1542, #1563, #1569) went
unnoticed. Add `just test offline-sqla <min|latest|VERSION>`: uv
resolves the lowest and the highest release that the extras allow, and
the recipe runs the dialect tests that need no AWS on it and collects
the compliance suites (synchronous and async), which imports them
without connecting. The offline environment moves to a shared _offline
recipe, used by `just test offline` too.

A new offline-sqla job runs the minimum on Python 3.11 and the latest on
Python 3.15 for every event. The AWS suites do not wait for it, so a new
SQLAlchemy release that breaks it does not stop unrelated pull requests.

On SQLAlchemy 2.1, NameDenormalizeTest reads column names from the
result; Athena returns them in lowercase, including quoted names. Skip
those statements and keep the core select, which maps by position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…minimum (GH-1543)

From self-review: build the inner uv command as a bash array, so the
requirement is not word-split or globbed; let the runs inside _offline
use only uv's cache (--offline), since they start after the proxy
settings are removed; default `just test offline-sqla` to `min`; note
that the Release workflow requires the job, and add its matrix to the
Python-version sync comment; place the new docs after the offline
target's scope paragraph and describe the contribution-guide scope as
the dialect tests that need no AWS plus collection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread justfile Outdated
# allow, resolved by uv; any other value is a version. The packages are
# resolved and cached before _offline removes the proxy settings, and the runs
# inside it use that cache only (--offline).
_test-offline-sqla version="min":

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Self-review round one (implementation): FINDINGS, repaired

Base b2620f4b5ba52a23b809f5c5faebc646c0d04ddd, heads 50b16ef7 → 522df7f1030135dd619141265afd7e56de595b07. Passes: /code-review high and /simplify (reuse, simplification, efficiency, altitude).

Repaired (09f7b84e, 522df7f1):

  • The inner uv run command is a bash array, so the requirement sqlalchemy[asyncio]==X is neither word-split nor globbed.
  • The runs inside _offline use uv's cache only (--offline), because they start after the proxy settings are removed. The packages are resolved, and uv run --with ... true caches them, before that.
  • just test offline-sqla without an argument uses min.
  • The PYTHON_VERSIONS sync comment names this job's matrix and its setup-python condition.
  • The workflow comment and the testing guide state that the Release workflow requires the job.
  • docs/contributing.md describes the scope as the dialect tests that need no AWS plus collection. The testing guide's new block follows the offline target's scope paragraph.
  • Version resolution is one case that uses a resolve helper.

Kept:

  • The Release workflow requiring the job: a release should not go out while it is incompatible with the newest allowed SQLAlchemy.
  • The repeated no-op uv run true syncs in _offline, which are cheap.
  • [positional-arguments], which just needs to pass *command to the shebang script.
  • Separate setup steps per job, which follows the workflow's existing pattern.

Validation: just lint and just docs lint passed, and actionlint reported nothing. just test offline-sqla (2.0.52), latest and 2.1.9 each passed 734 tests and collected the suites. just test offline passed 4572 tests.

# do not wait for this job, so a new SQLAlchemy release that breaks it does
# not stop the AWS suites of unrelated pull requests. The Release workflow
# requires it, as it requires every job of this workflow.
offline-sqla:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Self-review round two (claims, operations, evidence): CLEAN

Base b2620f4b5ba52a23b809f5c5faebc646c0d04ddd, head 522df7f1030135dd619141265afd7e56de595b07. Claims checked:

  • "uv resolves min/latest from pyproject.toml": uv pip compile --resolution lowest-direct|highest gives 2.0.52 and 2.1.9, and the recipe prints them.
  • "Collection catches Decode float ARRAY elements and run the compliance suite on SQLAlchemy 2.1 #1569's import error": master before Decode float ARRAY elements and import the compliance suite on SQLAlchemy 2.1 (GH-1569) #1577 fails to collect on 2.1.9 with ImportError: DeprecatedCompoundSelectTest (checked earlier in this session), and pytest exits non-zero, which fails the recipe under set -e.
  • AWS: the job runs offline with no credentials; the targeted live run of the tests that 2.1.9 adds was approved by the maintainer and cost about 80 cases per driver. Results are in the PR body. NameDenormalizeTest is the only failure, and it is now skipped with its reason: 2 passed and 6 skipped on both drivers.
  • CI: no needs: link to the AWS jobs, so a new SQLAlchemy release that breaks the job does not stop the AWS suites of unrelated PRs. The min row uses Python 3.11, the oldest supported version; the locally verified rows use 3.15.

@laughingman7743 laughingman7743 added this to the 5.0.0 milestone Nov 30, 2026
…tion precisely (GH-1543)

From the independent review: the recipe takes the version as a
positional argument instead of interpolating it into the script; it
unsets UV_NO_CACHE, since the runs inside _offline read the packages
from uv's cache; collecting the compliance suites opens a DB-API
connection without contacting AWS, so the docs say so; the workflow
comment says the offline job covers the dialect tests on the locked
version and the AWS suites the compliance suites; and the
NameDenormalizeTest comment says Athena returns a core select's names as
written and the names of SELECT * in lowercase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread justfile Outdated
# resolved and cached before _offline removes the proxy settings, and the runs
# inside it use that cache only (--offline).
[positional-arguments]
_test-offline-sqla version="min":

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent review (Codex codex exec -s read-only, session 01a22d20-10c1-7703-a253-f6025ef73df1) of b2620f4b..522df7f1: 5 findings, all fixed in 85f66fcf.

Codex ran both rows in a temporary clone with external networking off. Python 3.11 with 2.0.52 and Python 3.15 with 2.1.9 each passed 734 tests and collected 1360 and 1428 compliance cases, synchronous and async. A resolver failure and a pytest failure both propagated through _offline. It also confirmed the Release workflow's dependency on the job and the 2.0 hasattr guard.

  1. The NameDenormalizeTest comment said a core select maps by position. With driver_column_names=True it reads names too, and it passes on Athena because Athena returns a core select's names as its column list writes them. The comment now says so.
  2. The version was interpolated into the bash script. _test-offline-sqla now takes it as a positional argument ($1).
  3. With UV_NO_CACHE=1, the --offline runs could not find the package. The recipe unsets it; UV_NO_CACHE=1 just test offline-sqla now passes 734.
  4. Collection opens a DB-API connection, with no AWS call. The docs and the recipe comment say "without contacting AWS".
  5. The workflow comment said the offline job covers the locked version. It now says the offline job runs the dialect tests and the AWS suites run the compliance suites on it.

Follow-up running on 522df7f1..85f66fcf.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent follow-ups (Codex codex exec -s read-only)

  • Follow-up 1 (522df7f1..85f66fcf, session 01a22d2f-e6d5-7220-b3d5-22f4051027b6): findings 1, 4 and 5 resolved. Two new findings, both fixed in adda5d98: just test interpolated {{args}}, so it now forwards positional arguments (a version with a space reaches uv as one value); and unsetting UV_NO_CACHE broke a read-only cache.
  • Follow-up 2 (85f66fcf..adda5d98, session 01a22d3b-71ea-7592-a3f2-b8e99db70376): the temporary cache that adda5d98 gave UV_NO_CACHE misread UV_NO_CACHE=false and, with UV_LINK_MODE=symlink, deleted files the environment linked to. Rather than patching each configuration, 48fd2b7b removes the cache handling: the recipe needs uv's cache, and its comment says so. With the cache disabled, uv itself reports the missing package, which matches the repository rule of letting tools report misuse. This also resolves follow-up 1's UV_NO_CACHE finding.
  • Follow-up 3 (adda5d98..48fd2b7b, session 01a22d4b-a2b1-7d62-af18-366fdd8c6600): CLEAN. The default cache path passed on Python 3.11.18 with SQLAlchemy 2.0.52 (734 tests; 1360 compliance cases collected in each mode).

laughingman7743 and others added 2 commits December 1, 2026 01:13
…ry (GH-1543)

From the independent follow-up: `just test` passes its arguments to the
target recipe as positional arguments, so a version reaches uv as one
value; and when the caller disables uv's cache (UV_NO_CACHE), the
offline-sqla recipe uses a temporary cache shared by its uv runs
instead of the persistent one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replacing a disabled cache with a temporary one broke other
configurations (UV_NO_CACHE=false, a symlinked environment). The recipe
needs uv's cache, as its comment now says; with the cache disabled, uv
reports that the package is not cached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@laughingman7743
laughingman7743 marked this pull request as ready for review November 30, 2026 16:36
The job's purpose is to test each supported SQLAlchemy series, 2.0 and
2.1. "min" and "latest" tested the declared minimum and the newest
release instead: once the lock moves to 2.1, the latest 2.0 release would
go untested, and lowest-direct resolution also lowered boto3, fsspec, and
the other direct dependencies.

`just test offline-sqla SERIES` now runs the latest release of a series
that the extras allow, and a full version still runs that version. Each
series runs on the newest Python version for which its releases publish
wheels (2.0 on 3.14, 2.1 on 3.15), and the matrix comment says why the
versions differ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# for Python 3.15, where uv would build it from source. Move a series to
# a newer Python version once its releases publish wheels for it.
include:
- sqlalchemy: '2.0'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maintainer-requested change and self-review (both perspectives): 48fd2b7b..26a9e278

The maintainer asked for the job to test the 2.0 and 2.1 series rather than the minimum and the latest release, and for 2.0 to use the newest Python version for which it publishes wheels, with a comment explaining why the Python versions differ.

  • The recipe takes a series (2.0) or a version (2.1.9). A series is resolved with uv pip compile --constraint <(echo "sqlalchemy>=2.0,<2.1") within the extras' range. The other dependencies stay locked; lowest-direct used to lower them all.
  • Wheels on PyPI: SQLAlchemy 2.0.58 publishes up to cp314 and 2.1.9 up to cp315. So the matrix is 2.0 on Python 3.14 and 2.1 on 3.15. Only the 3.15 row needs setup-python, as before.
  • The docs (testing.md, contributing.md, AGENTS.md) and the just test help describe the series. The PYTHON_VERSIONS sync comment still applies, since the matrix uses 3.14 and 3.15.
  • Compatibility: min/latest are removed from an unreleased recipe. The recipe now needs an argument, and just reports the missing parameter.

Validation:

  • just lint and just docs lint: passed.
  • With UV_PYTHON and a temporary UV_PROJECT_ENVIRONMENT, as in CI:
    • just test offline-sqla 2.0 on 3.14 (2.0.58): 734 passed; both compliance collections succeeded.
    • just test offline-sqla 2.1 on 3.15 (2.1.9): 734 passed; both compliance collections succeeded.
  • just test offline-sqla 2.1.9: 734 passed.

…H-1543)

From the independent follow-up review:
- `uv pip compile` gets `--resolution highest`, so a UV_RESOLUTION
  setting cannot resolve a series to an older release.
- Both rows use setup-python: uv's Python 3.13+ cannot compile Python.h,
  which the 3.14 row may need too.
- The matrix comment and the testing guide say "compiled wheels":
  SQLAlchemy 2.0 also publishes a pure-Python wheel, which Python 3.15
  would install without the C extensions.
- The testing guide shows the recipe's required argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread justfile
if [[ "$1" =~ ^([0-9]+)\.([0-9]+)$ ]]; then
series="sqlalchemy>=$1,<${BASH_REMATCH[1]}.$((BASH_REMATCH[2] + 1))"
version=$(uv pip compile pyproject.toml --extra sqlalchemy --extra aiosqlalchemy \
--constraint <(echo "$series") --resolution highest \

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent follow-up 4 (Codex, 48fd2b7b..26a9e278): FINDINGS, repaired in 397f4fa2

  1. With UV_RESOLUTION=lowest-direct, 2.0 resolved to 2.0.52. uv pip compile now gets --resolution highest, and the same environment resolves 2.0.58.
  2. The 3.14 row skipped setup-python, which uv's Python 3.13+ needs to compile Python.h. Both rows now use it, and the PYTHON_VERSIONS sync comment no longer mentions a condition.
  3. SQLAlchemy 2.0.58 also publishes py3-none-any, so Python 3.15 would install the pure-Python wheel, not build from source. The matrix comment and the testing guide now say "compiled wheels".
  4. The testing guide now shows the required argument (just test offline-sqla <series-or-version>).

The reviewer also ran both series in isolation. Each passed 734 tests and collected both compliance suites, and the other packages matched the lock. 1.4 was rejected by the extras' bound.

Validation: just lint, just docs lint, and actionlint: passed.

From the independent follow-up review: the GitHub Actions section showed
the recipe without its required argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread docs/testing.md

The Test workflow runs for pull requests that change files other than `docs/` and Markdown.
It runs the offline checks (`just lint`, and `just test offline` on the newest supported Python version) on each of them, including Drafts and external forks.
It also runs `just test offline-sqla 2.0` and `just test offline-sqla 2.1`, for each supported SQLAlchemy series, each on the newest Python version for which that series publishes compiled wheels; the AWS suites do not wait for these, and the Release workflow requires them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent follow-up 5 (Codex, session 01a22ee2-80f3-7a31-9330-571f29f26098, 26a9e278..397f4fa2): FINDINGS, repaired in 8d309389

The reviewer confirmed that three of the four follow-up 4 findings are resolved. UV_RESOLUTION=lowest still selects 2.0.58, both rows run setup-python, and the wheel comment is accurate.

Remaining: the GitHub Actions section of the testing guide showed just test offline-sqla without its required argument. It now shows just test offline-sqla 2.0 and just test offline-sqla 2.1. just docs lint: passed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent follow-up 6 (Codex, session 01a22ef0-b1e7-7601-942e-661dc222dbd2, 397f4fa2..8d309389): CLEAN. Both CI invocations in the testing guide now pass the series argument, matching the matrix.

@laughingman7743
laughingman7743 merged commit dd92bd4 into master Dec 1, 2026
14 checks passed
@laughingman7743
laughingman7743 deleted the ci/1543-sqlalchemy-version-matrix branch December 1, 2026 14:32
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.

CI tests SQLAlchemy only at the locked version, not the declared minimum or the latest release

1 participant