Repository navigation
tests: anchor the gguf ordering assertion on the branch that owns the marker - #7443
Merged
Merged
Conversation
… marker _load_model_impl contains more than one `if config.is_gguf:`, so source.index() returned the earlier one, which belongs to a different check than the branch the assertion is reasoning about. The inheritance call sits at line 4543, the earlier branch at 4508 and the branch holding the load marker at 4567, so the comparison read 186995 < 185014 and failed on main. The branch is now located from the load marker itself, which is the landmark the rest of the test already relies on, so the assertion compares the inheritance call against the branch that actually guards it. The slice used by the following assertions is anchored the same way, which also tightens them: they previously searched from the earlier branch to end of file. The invariant is unchanged and still has teeth: moving the inheritance call after the branch makes the assertion fail.
This was referenced Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_load_marker_precedes_hub_guard_and_unloadfails on main, which turns Repo tests (CPU) and the Python 3.10 through 3.13 backend jobs red on every branch.What happens
The assertion added in #7251 is:
_load_model_implcontains more than oneif config.is_gguf:, andstr.indexreturns the first match in the file. That first match belongs to an earlier check, not to the branch the assertion is reasoning about:if config.is_gguf:= _resolve_inherited_extra_args(if config.is_gguf:holding the load markerSo the comparison reads
186995 < 185014and fails, even though the ordering it means to check is satisfied: the inheritance call at 4543 does precede the branch at 4567.The fix
Locate the branch from the load marker itself, which is the landmark the rest of the test already relies on, then compare against that. The slice the following assertions use is anchored the same way, which tightens them as well: they previously searched from the earlier branch to end of file.
The invariant from #7251 is unchanged, and still has teeth. Moving the inheritance call after the branch makes the assertion fail.
Verification
python -m pytest tests/test_gguf_load_cache_reuse.pyinstudio/backend: 33 passed, against 1 failed / 32 passed on main.