Skip to content

Keep path_utils off PEP 604, which the 3.9 floor gate rejects - #9335

Merged
danielhanchen merged 2 commits into
mainfrom
fix-pep604-path-utils
Aug 20, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix-pep604-path-utils

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Core is failing on main at python floor compatibility (HARD GATE), on all three HF/TRL cells:

36 studio files now evaluate PEP 604 unions on the floor, up from 35

The 36th is studio/backend/utils/paths/path_utils.py, from #8919. That change is right - it just added

subject_key: Callable[[str], object] | None = None

to a module with no from __future__ import annotations, so the annotation is evaluated at import and X | None is a TypeError on the declared 3.9 floor.

Why Optional[...] and not the future import

The ratchet's message suggests adding from __future__ import annotations, and that would work, but it is the wider change: five other modules import this one, and the ratchet's own docstring warns that converting a file wants Studio booted, because FastAPI resolves annotations when it builds each endpoint. Optional is already imported in this file, so this touches one annotation and nothing else.

Verified on main

offenders back to 35, against a debt of 35
tests/test_python39_compatibility.py 8 passed
studio/backend/tests/test_appledouble_guards.py 9 passed - the behaviour #8919 added is unchanged
ruff clean

Reproduced locally before fixing: a checkout of origin/main counts 36, my branch point counted 35, and the diff is exactly this one file.

danielhanchen and others added 2 commits August 20, 2026 03:29
`Core` has been failing on main at 'python floor compatibility (HARD GATE)',
all three HF/TRL cells:

  36 studio files now evaluate PEP 604 unions on the floor, up from 35

The 36th is studio/backend/utils/paths/path_utils.py, from #8919. That change is
right; it just added

  subject_key: Callable[[str], object] | None = None

to a module with no `from __future__ import annotations`, so the annotation is
evaluated at import and `X | None` is a TypeError on the declared 3.9 floor.

Uses Optional[...], which the module already imports, rather than adding the
future import. Five other modules import this one, and deferring every
annotation in it is a wider change than the one union needs -- the ratchet's own
docstring warns that converting a file wants Studio booted, because FastAPI
resolves annotations when it builds endpoints.

Verified on main: offenders back to 35 against a debt of 35, the whole
test_python39_compatibility.py suite passes (8), and the AppleDouble guards the
original change added still pass (9).
@danielhanchen
danielhanchen merged commit 78a3587 into main Aug 20, 2026
34 of 36 checks passed
@danielhanchen
danielhanchen deleted the fix-pep604-path-utils branch August 20, 2026 03:58
danielhanchen added a commit that referenced this pull request Aug 20, 2026
The branch was 60 commits behind main, which is the only reason the stack was
red: main has since fixed the four failure families this stack's CI was
inheriting (#9342 for the sliced chat-adapter harness and the install.sh
fallback range, #9348 for the two backend guards on the 3.13 leg, #9335 for the
3.9 union floor).
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