Skip to content

ci: unbreak CI — venv cache restore, mypy 3.12 target, ruff 0.16.3 format - #362

Merged
CameronBrooks11 merged 3 commits into
mainfrom
fix/ci-venv-cache-broken-symlink
Aug 20, 2026
Merged

CameronBrooks11 merged 3 commits into
mainfrom
fix/ci-venv-cache-broken-symlink

Conversation

@CameronBrooks11

@CameronBrooks11 CameronBrooks11 commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Three coupled fixes that together restore a green CI. Each unmasks the next, so
they land as one PR.

1. Broken-venv cache restore (setup-python action)

The action restored .venv from the Actions cache and treated any existing
directory as usable (if [ -d ".venv" ]). A cached venv's bin/python symlinks
to a hosted-Python interpreter path; when that path changes (Python patch bump,
or the setup-uv v10 install-dir change) the symlink breaks, the directory check
still passes, and the next step fails:

error: Broken symlink at `.venv/bin/python3`, was the underlying Python interpreter removed?

Once the shared cache is poisoned it recurs every run via restore-keys until
eviction — red-lining the main push CI on b1b7750 and blocking lock-maintenance
PR #360. Fix: trust the cache only if the interpreter actually executes;
otherwise recreate the venv. Fast path unchanged.

2. mypy vs numpy 2.5 stubs

With setup fixed, mypy ran and failed: numpy ≥2.5 ships stubs using PEP 695
type statements that mypy rejects under a 3.11 target. Fix: set
[tool.mypy] python_version = "3.12". Project code checks clean; 3.11 runtime
stays covered by the Backend Test matrix (requires-python = ">=3.11" unchanged).

3. ruff 0.16.3 formatting

With mypy fixed, ruff format --check failed: the lock bump moved ruff to
0.16.3, which reflows the embedded ```python blocks in three Markdown docs.
Fix: reformat those files with 0.16.3. No semantic changes.

This PR's own green CI — which restores the same poisoned cache and installs the
same bumped toolchain — is the end-to-end proof.

https://claude.ai/code/session_017N6LZRKsJYXcNMQZqeEvpd

The setup-python composite action restored `.venv` from cache and treated
any existing directory as usable (`if [ -d ".venv" ]`). A cached venv's
`bin/python` symlinks to a hosted-Python interpreter path; when that path
changes (Python patch bump, setup-uv install-dir change) the symlink
breaks, and the directory check still passes, so `uv pip install` fails
with "Broken symlink at .venv/bin/python3".

Once the shared cache entry is poisoned it recurs on every run via
restore-keys until eviction, red-lining unrelated PRs and main pushes.

Validate that the restored interpreter actually executes; recreate the
venv (rm -rf + `uv venv`) when it is missing or broken. The fast path
(valid cache -> skip) is unchanged.

Claude-Session: https://claude.ai/code/session_017N6LZRKsJYXcNMQZqeEvpd
numpy >=2.5 ships type stubs using PEP 695 `type` statements, which mypy
rejects under a 3.11 target ("Type statement is only supported in Python
3.12 and greater"), halting the whole check. This was masked on main by
the broken-venv cache and surfaced once setup was fixed.

Bump [tool.mypy] python_version to 3.12. The project's own code
type-checks clean, and 3.11 runtime support stays covered by the Backend
Test matrix (requires-python = ">=3.11" is unchanged).

Claude-Session: https://claude.ai/code/session_017N6LZRKsJYXcNMQZqeEvpd
@CameronBrooks11 CameronBrooks11 changed the title ci: recreate venv when the cached interpreter symlink is broken ci: fix broken-venv cache restore + type-check against 3.12 for numpy 2.5 stubs Aug 20, 2026
The lock-file maintenance bump moved ruff to 0.16.3, which reflows
```python code blocks in the docs (collapsing short multi-line calls,
adding trailing commas, blanking between methods). No semantic changes;
this only realigns three Markdown files with the new formatter so
`ruff format --check` passes in CI.

Claude-Session: https://claude.ai/code/session_017N6LZRKsJYXcNMQZqeEvpd
@CameronBrooks11 CameronBrooks11 changed the title ci: fix broken-venv cache restore + type-check against 3.12 for numpy 2.5 stubs ci: unbreak CI — venv cache restore, mypy 3.12 target, ruff 0.16.3 format Aug 20, 2026
@CameronBrooks11
CameronBrooks11 merged commit 23a4a48 into main Aug 20, 2026
21 checks passed
@CameronBrooks11
CameronBrooks11 deleted the fix/ci-venv-cache-broken-symlink branch August 20, 2026 19:09
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.

1 participant