Skip to content

Repin six UI contracts on what they guard, not how it was spelled - #8197

Merged
danielhanchen merged 5 commits into
mainfrom
fix/stale-ui-contracts
Aug 9, 2026
Merged

danielhanchen merged 5 commits into
mainfrom
fix/stale-ui-contracts

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Repo tests (CPU) is red on main. Six failures, all in source-shape contract tests, all caused by their subject being rewritten under them:

tests/studio/test_model_picker_contracts.py::test_a_hidden_diffusion_page_does_not_load_when_its_download_lands
tests/studio/test_model_picker_contracts.py::test_a_routed_curated_pick_uses_the_same_load_spec_as_a_direct_one
tests/studio/test_model_picker_contracts.py::test_diffusion_pages_never_drop_a_gguf_pick_silently
tests/studio/test_update_release_notes.py::test_the_desktop_stack_is_capped_like_the_browser_one
tests/studio/test_update_release_notes.py::test_the_download_panel_can_shrink_inside_the_capped_stack
tests/studio/test_update_release_notes.py::test_the_overlay_stack_fits_the_viewport

I checked each one against the code before touching the test. In every case the behaviour the test exists to protect is intact, and in two cases it is better than what the assertion described. Nothing in studio/ changes here.

The overlay stack cap

The three release-notes tests asserted the literal class max-h-[calc(100dvh_-_2rem)]. #8082 replaced that fixed cap with stackGeometry, which subtracts the same 2rem when nothing is in the way and subtracts more when the Live monitor is, so the stack dodges the monitor instead of sitting under it.

The arithmetic is already checked numerically, in studio/frontend/tests/monitor-stack-inset.test.ts, fourteen cases including the exact successor of the old class:

assert.equal(stackGeometry(null, W, H).maxHeight, H - 32);

So the python test should not try to re-check the number. What it can still add is that every stack element reads the geometry, which it now does by counting:

stacks = provider.count("z-[9998] flex flex-col items-end gap-2")
assert stacks, "the bottom-right overlay stack is gone"
assert provider.count("maxHeight: stack.maxHeight") == stacks, "every stack is capped"

Counting rather than checking presence is the point. There are two such elements, browser and desktop, and capping one and forgetting the other is precisely the mistake worth catching; a substring check cannot see it. A fourth, new test names the node test by path, so deleting the numeric check does not quietly leave the cap unguarded.

The three picker contracts

Routed pick. The test pinned diffusionRoutePick's second argument, which was respelled from routeSearch.quant to routedFilename ?? undefined. The catalog spec is the third argument and is the thing the test is named for. The regex no longer pins the second; the loadSpecFor(wanted, IMAGE_CATALOG) assertion is unchanged.

GGUF guard. The test required a toast.error in the branch that used to reject a repo-id pick outright. #8149 made that branch resolve the repo's own .gguf through loadGgufRepoPick instead, which is the better answer for the user. The invariant that survives the rewrite is that the branch does something: a bare return there drops the pick with no request and no message, which is the failure the test is named for.

Deferred load. The test required the flush effect to end with }, [active]); and to call handleLoadRef directly. The load body moved into runStagedLoad, now shared with the visible path, so the dependency array grew to [active, runStagedLoad]. The test accepts either spelling and, when the helper is used, follows through into it to confirm it actually loads.

Mutation results

Eight mutations, all caught. Each breaks one thing an assertion claims to guard; the tree was restored and re-run green after each.

mutation caught by
browser stack loses its cap overlay-stack, desktop-stack, download-panel
desktop stack alone loses its cap desktop-stack
desktop stack stops measuring itself desktop-stack
node test stops pinning H - 32 the new geometry-is-checked test
repo-id GGUF pick returns bare gguf-guard
routed pick drops its catalog spec routed-pick
deferred flush clears the flag and stops deferred-load
runStagedLoad loads nothing deferred-load

The first two survived an earlier draft that used a plain in check on the provider source, since the other stack still carried the string. That is why the counting form is there rather than a substring test.

Verification

tests/studio/: 3 failed, 2795 passed, 4 skipped, 1 error. The three are test_studio_gguf_export_script_pin.py and the error is test_rocm_rdna_routing.py; both fail identically on a clean main worktree and are outside this job's scope.

I did not run the frontend node suite locally: this worktree has no node_modules, and without it every test fails to resolve react. Frontend CI is green on main and covers monitor-stack-inset.test.ts, and no frontend source changes here.

danielhanchen and others added 2 commits August 8, 2026 18:08
Repo tests (CPU) is red on main with six failures. All six are source-shape
contracts whose subject was rewritten by #8082 and #8149; in every case the
behaviour they exist to protect is intact, and in two cases it is better than
what the assertion described.

Three in test_update_release_notes.py asserted the literal Tailwind class
max-h-[calc(100dvh_-_2rem)]. #8082 replaced that fixed cap with stackGeometry,
which subtracts the same 2rem when nothing is in the way and subtracts more when
the Live monitor is, so the stack dodges it instead of sitting under it. The
arithmetic is checked numerically in monitor-stack-inset.test.ts, which pins
stackGeometry(null, W, H).maxHeight to H - 32 among thirteen other cases. What
these tests can still add is that every stack element reads it, so they now
count stack containers and require a cap on each. Counting matters: there are two
such elements, browser and desktop, and capping one and not the other is the
mistake worth catching. A fourth test names the node test, so deleting the
numeric check does not quietly leave the cap unguarded.

Three in test_model_picker_contracts.py:

- The routed pick test pinned diffusionRoutePick's second argument, which was
  respelled from routeSearch.quant to routedFilename. The catalog spec is the
  third argument and is the thing the test is named for, so the second is no
  longer matched.
- The GGUF guard test required a toast.error in a branch that used to reject a
  repo-id pick. #8149 made that branch resolve the repo's own .gguf instead,
  which is the better answer. The invariant that survives is that the branch does
  something: a bare return there drops the pick with no request and no message.
- The deferred-load test required the flush effect to end with }, [active]); and
  to call handleLoadRef directly. The load body moved into runStagedLoad, shared
  with the visible path, so the dependency array grew. It now accepts either
  spelling and, when the helper is used, follows through into it.

Mutation-tested, all eight caught: cap dropped from the browser stack; from the
desktop stack alone; desktop stack stops measuring itself; node test stops
pinning H - 32; repo-id GGUF pick returns bare; routed pick drops its catalog
spec; deferred flush clears the flag and stops; runStagedLoad loads nothing. The
first two survived an earlier draft that used a plain substring check, which is
why the counting form is there.

tests/studio: 3 failed, 2795 passed. The three are
test_studio_gguf_export_script_pin.py, which fails identically on main and is
outside this job's scope.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Keying the closing boundary on `[active` let a validly reordered dependency
array run the match past the effect and on to the next hook, where loadOrStage's
own handleLoadRef call satisfied the loader assertion for a flush that loads
nothing. Stop at the first boundary and check the deps separately.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

The capture is every argument after `wanted`, so a substring check did not prove
the spec reached the third parameter. `diffusionRoutePick(wanted, routedFilename
?? loadSpecFor(wanted, IMAGE_CATALOG)?.filename)` type-checks, passes the catalog
filename as the quant and drops the spec, which sends curated single-file
artifacts down the GGUF branch, and it satisfied the old assertion. Split the
argument list on its own commas and pin the third.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 8, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 8, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6301786fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1154 to +1156
assert (
"stackGeometry(null, W, H).maxHeight, H - 32" in src
), "nothing pins the no-obstacle cap to the 2rem the class used to spell"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify the hook forwards the tested geometry

The new numeric check exercises stackGeometry directly, while the provider checks only count calls to useStackGeometry() and uses of stack.maxHeight; nothing verifies that the hook forwards the helper's result unchanged. If useStackGeometry overrides maxHeight with Number.POSITIVE_INFINITY or another uncapped value after calling the helper, the node geometry test and all four affected Python contract tests still pass while both overlay stacks can again overflow the viewport. Add a check of the hook-to-helper connection or exercise the hook result directly.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing on this one. useStackGeometry ends in return stackGeometry(published, viewport.width, viewport.height); - the hook is the memoised viewport read and nothing else, so the gap is a single return with no branch that could rewrite the value. Guarding it would mean pinning that spelling in a Python source-scan test, which is the exact class of assertion this PR is removing: the previous version pinned max-h-[calc(100dvh_-_2rem)] and broke when the cap moved from a class to arithmetic, without the cap ever changing. The arithmetic is owned by monitor-stack-inset.test.ts, the provider side is pinned to using the hook's value for every stack, and a hook that discarded its own result is not a refactor anyone reaches by accident.

@danielhanchen

Copy link
Copy Markdown
Member Author

main's CI red is three independent causes, not one, and none of the three PRs is green on its own. That is why these have all been sitting at CI_FAILING with no review items of their own.

Failing suite on main Actual failure Fixed by
Core (all 3 matrix cells) 2 in tests/test_generated_fullgraph_fallback.py (that file is unsloth_zoo's; Core clones zoo and runs its suite) unslothai/unsloth-zoo#1018
Repo tests (CPU) 6 in tests/studio/test_model_picker_contracts.py and tests/studio/test_update_release_notes.py #8197
Chat UI Tests playwright._impl._errors.TimeoutError clicking floating-monitor's Close: a menu-soft-surface inside fixed right-4 z-[9998] intercepts pointer events #8190

The two Studio PRs each cover exactly the other's failure. On #8197, Chat UI fails on the overlay intercept and Repo tests (CPU) passes. On #8190, Chat UI passes and Repo tests (CPU) fails with those same 6. Core fails on both, because its cause is in zoo.

Checked together on a staging repo rather than on the org queue: unsloth main 161a3017d with #8197 and #8190 both merged in (clean, no conflicts), and the Core job's zoo clone pinned to zoo#1018's head.

Core (HF=4.57.6 + TRL<1)      pass
Core (HF=default + TRL=default)  pass
Core (HF=latest + TRL=latest)    pass
Repo tests (CPU)                 pass
Chat UI Tests                    pass

32 checks pass, 0 fail. The zoo suite inside Core goes from 2 failed, 4242 passed, 293 skipped on main to 4269 passed, 286 skipped, 2 deselected, with both test_maybe_compile_routes_fullgraph_through_the_fallback and test_the_alias_routes_a_fullgraph_compile_through_the_fallback collected and passing, and no FAILED anywhere in the job log.

So the merge order that clears the board is zoo#1018 first, then #8197 and #8190 in either order. Once those land, #7867, #7951, #8051, #8121 and #8128 should all go green as well; every one of them has zero open review items and is red only because it inherits this.

The staging composition used #8197 at b6301786f. Its head has since moved to 1b549d96b, which is a comments and docstrings only pass with no runtime change, so the result above still stands.

@danielhanchen

Copy link
Copy Markdown
Member Author

Checked on current main (a6914ed83): the six failures this PR repins are red on main right now, and they are the whole of Repo tests (CPU).

Every other red check on this PR belongs to a different open PR, not to this one:

check owner
Repo tests (CPU) this PR fixes it
Chat UI Tests x2, Chat UI, API and Update Tests #8199. All three fail at tests/studio/playwright_chat_ui.py:522, exercise_floating_monitor_geometry, the monitor Close button intercepted by menu-soft-surface in the same z-[9998] stack. Same file and line on main.
Core (HF=*) x3 unsloth-zoo. The two test_generated_fullgraph_fallback.py failures run out of /home/runner/work/_temp/unsloth-zoo/tests/.
(Python 3.10) #8175. test_idle_loop_unloads_after_ttl_and_stashes_for_reload, the idle-unload TTL race.

So none of the four PRs can go green on its own. Merged together onto a6914ed83 they do, with no conflicts:

plain main       6 failed, 318 passed
+ 8197 8199 8175 0 failed, 328 passed

(tests/studio/test_model_picker_contracts.py, test_update_release_notes.py, test_overlay_layering.py; plus studio/backend/tests/test_openai_auto_switch.py 337 passed both sides, since that one only races on a loaded CI runner.)

@danielhanchen
danielhanchen merged commit 37f43eb into main Aug 9, 2026
22 of 29 checks passed
@danielhanchen
danielhanchen deleted the fix/stale-ui-contracts branch August 9, 2026 05:33
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