Skip to content

Fix the four test failures currently red on main - #8254

Closed
danielhanchen wants to merge 2 commits into
mainfrom
fix-main-red-tests
Closed

danielhanchen wants to merge 2 commits into
mainfrom
fix-main-red-tests

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Four tests fail on a clean checkout of main, independent of any PR, so every branch
cut from it inherits them. Two separate causes, both semantic merge conflicts where
each PR was green on its own base.

1. The 3.9 floor guards vs vendored truststore (#8108)

test_no_pep604_unions_are_evaluated_on_the_declared_floor and
test_studio_evaluated_unions_do_not_grow. Vendoring truststore 0.10.4 added two
typing.TypeAlias values that are PEP 604 unions, which from __future__ import annotations does not defer, and three platform modules that pushed the studio
union-debt ratchet from 35 to 38.

Neither is fixable where it is flagged. The tree is checked in byte-identical to the
wheel and hash-pinned by vendor/truststore_manifest.json, with ruff and the kwargs
formatter configured to skip it so it keeps matching upstream, so converting those
aliases breaks the invariant the vendor README exists to defend. truststore is
requires-python >=3.10 upstream, so it cannot run on our floor either way, and
prebuilt_core.py already imports it inside try/except.

So the scan is scoped to our own sources, next to the existing __pycache__ and
node_modules exclusions, with a test pinning the reasoning.

2. The image precision contracts vs the refusal behaviour (#8162 vs #8165)

test_saved_image_metadata_precision_contract.py x3 and
test_diffusion_backend.py::test_load_refines_component_placement_after_text_encoder_quantization.

#8162 pinned the saved-recipe contracts against a tree where a declined explicit
precision fell back silently; #8165 landed the fail-closed refusal beside it. Both were
green on their own base and main got a combination neither ran.

Fixed on the test side, since #8165 is the newer intent:

Verification

Before: 4 tests red on a clean detached checkout of main. After: tests/test_python39_compatibility.py
5 passed, tests/test_saved_image_metadata_precision_contract.py 10 passed,
tests/test_diffusion_backend.py 226 passed. Ruff clean. No production code changed.

Vendoring truststore 0.10.4 (#8108) turned both floor guards red: its two
typing.TypeAlias values are PEP 604 unions, which the future import does not
defer, and its three platform modules pushed the studio union-debt ratchet from
35 to 38.

Neither is fixable where it was flagged. The tree is checked in byte-identical
to the wheel and hash-pinned by vendor/truststore_manifest.json, with ruff and
the kwargs formatter configured to skip it so it keeps matching upstream, so
converting those aliases breaks the invariant the vendor README defends.
truststore is requires-python >=3.10 upstream, so it cannot run on our floor
either way, and prebuilt_core.py already imports it inside try/except.

Scope the scan to our own sources instead, alongside the existing __pycache__
and node_modules exclusions, and pin the reasoning with a test.
#8162 pinned the saved-recipe contracts against a tree where a declined explicit
precision fell back silently, and #8165 landed the fail-closed refusal alongside
it. Each was green on its own base, so main got a combination neither PR ran.

Three fixes, all on the test side, since #8165 is the newer intent:
- opt into UNSLOTH_DIFFUSION_ALLOW_PRECISION_FALLBACK where the contract is about
  what the recipe records after a fallback, matching how test_diffusion_routes.py
  and test_diffusion_backend.py were already adapted
- assert the decline reason #8165 records rather than the old "GGUF transformer
  loaded" wording
- give the _EngagedBackend stub the assert_precision_available gate the route now
  calls, and return a TEQuantOutcome rather than a bare None from the stubbed
  text-encoder pass, which the loader now reads .mode off
@danielhanchen

Copy link
Copy Markdown
Member Author

Closing as superseded. Both halves of this PR are now redundant against main, and the remaining delta is comment text only.

The four Studio precision tests

Fixed by #8257, which took the same test-side approach this PR proposed and credited it. On current main (bcfc62657) the two files run clean:

studio/backend/tests/test_saved_image_metadata_precision_contract.py
studio/backend/tests/test_diffusion_backend.py
240 passed, 0 failed

Two notes from re-deriving the cause while working on #8257, in case it is useful later:

A test-side fix is the right call, and #8257 settled that explicitly rather than by default: quantize_text_encoders is annotated -> TEQuantOutcome and all seven return statements construct one, with no bare return and no fall-through. Nothing in production rebinds it, and video.py:1562 reads .mode off the same call unguarded. The None exists only because a test injects it, so an is None guard would be unreachable code that also weakens the contract the outcome type states.

The 3.9 floor guard

Fixed by #8252, which is merged; tests/test_python39_compatibility.py is 8 passed on main.

That fix keys the exemption on the guard rather than the path: it skips files under a package whose __init__ raises below a floor above ours, instead of excluding anything with vendor in its path. The difference matters in two cases. Unguarded code later added to the same vendor directory stays scanned, and if upstream ever drops truststore's requires-python >= 3.10 guard the gate correctly goes red again, because at that point the PEP 604 aliases really are reachable on our floor.

This PR's hunks for that file therefore conflict with main and would relax a rule that is deliberately stricter.

What is left

Diffing every line this PR adds against main, the only content main does not already have is comment wording, for example # #8165 records why the request was declined rather than what loaded instead. No functional difference remains, so there is nothing to rebase onto the 529 lines main has moved in test_diffusion_backend.py since this branch forked.

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