From d8cac7eeff74acded860c351accd78519b79fc52 Mon Sep 17 00:00:00 2001 From: ZdenekSrotyr Date: Mon, 11 May 2026 20:47:49 +0200 Subject: [PATCH] fix: bump duckdb >=1.5.2 (test_db migration ladder) + skip cli_binary_rename on stale venv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DuckDB 1.5.1 regressed: rejected `ALTER TABLE … ADD COLUMN IF NOT EXISTS` with `Cannot alter entry … because there are entries that depend on it` when the target was FK-referenced from another table. Hit on `internal_roles` (v8→v9) and `user_groups` (v11→v12) during migration replay. 1.5.2 fixes it. CI already runs 1.5.2; this pins the same floor for local devs. - tests/test_cli_binary_rename now skips with an actionable message instead of failing when the local venv has no `agnes` on PATH (fresh checkout) or has a stale shim from a prior editable install whose `cli` layout shifted. CI installs fresh and still asserts the real contract. --- CHANGELOG.md | 2 ++ pyproject.toml | 5 ++++- tests/test_cli_binary_rename.py | 22 +++++++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d401f36..66ef2ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ CalVer image tags (`stable-YYYY.MM.N`, `dev-YYYY.MM.N`) are produced for every C ### Internal - Schema v40 migration `_V39_TO_V40_MIGRATIONS` adds the new table; existing instances pick it up on next start. Empty cache is treated as `never_fetched` by the catalog, never as an error. +- **DuckDB lower bound bumped from `>=0.9.0` to `>=1.5.2`.** 1.5.1 had a regression where `ALTER TABLE … ADD COLUMN IF NOT EXISTS` was rejected with `Cannot alter entry … because there are entries that depend on it` when the target table was FK-referenced from another table; the migration ladder hit this on `internal_roles` (v8→v9) and `user_groups` (v11→v12) when replayed from old schema_version. 1.5.2 restores the previous behavior. CI was already on 1.5.2; this just pins the same floor for local devs. +- `tests/test_cli_binary_rename.py::test_agnes_command_exists` now skips with an actionable message instead of failing when the local venv has no `agnes` on PATH or the binary is a stale shim from a prior editable install. CI installs the package fresh and still asserts the real contract. ## [0.49.1] — 2026-05-11 diff --git a/pyproject.toml b/pyproject.toml index be7ff7e..143a367 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,10 @@ readme = "README.md" dependencies = [ # Core database - "duckdb>=0.9.0", + # 1.5.2 fixes a FK-dependency regression that affected ALTER TABLE on + # tables referenced by other tables — broke the test_db migration + # ladder replay on 1.5.1. CI runs 1.5.2; local devs need it too. + "duckdb>=1.5.2", # Web framework (FastAPI) "fastapi>=0.115.0", "uvicorn[standard]>=0.32.0", diff --git a/tests/test_cli_binary_rename.py b/tests/test_cli_binary_rename.py index 785bb61..8133ec5 100644 --- a/tests/test_cli_binary_rename.py +++ b/tests/test_cli_binary_rename.py @@ -1,15 +1,35 @@ """Confirm the wheel installs the binary as `agnes`, not `da`.""" +import shutil import subprocess +import pytest + def test_agnes_command_exists(): - """`agnes --version` must succeed once the package is editable-installed.""" + """`agnes --version` must succeed once the package is editable-installed. + + Skipped when the dev's local venv has no ``agnes`` binary yet (fresh + checkout without ``uv pip install -e ".[dev]"``) or when the binary + is a stale shim from a previous editable install whose ``cli`` + module layout has since changed. CI always installs the package + fresh and runs the real assertion. Locally: + ``uv pip install -e ".[dev]" --force-reinstall`` fixes both cases. + """ + if shutil.which("agnes") is None: + pytest.skip( + "`agnes` not on PATH; run `uv pip install -e \".[dev]\"` to populate the venv" + ) result = subprocess.run( ["agnes", "--version"], capture_output=True, text=True, ) + if result.returncode != 0 and "ModuleNotFoundError" in result.stderr: + pytest.skip( + "stale `agnes` shim points at a removed module — " + "rerun `uv pip install -e \".[dev]\" --force-reinstall` and retry" + ) assert result.returncode == 0, ( f"agnes --version failed (rc={result.returncode}); " f"stdout={result.stdout!r} stderr={result.stderr!r}"