Repository navigation
Stop two Studio contract tests reddening main on a rename and a 2px nudge - #8115
danielhanchen wants to merge 4 commits into
Conversation
…udge unslothai#8092 replaced `_release_self_exe_lock_windows` with the launcher transaction, and the update-gate test sliced `studio.py` up to that name, so the rename took the whole slice down as `ValueError: substring not found`. It now ends at the next definition, asserts the transaction sits inside the gate, and reports a moved anchor by name instead of a bare index error. unslothai#8102 nudged the mac titlebar by 2px and reddened the repo the same way, because the frontend contract spelled the numbers out. What the layout depends on is the row keeping its shape, so the offset is bounded and the chat header is asserted to stay 5px below it. A wrong value still fails: moving the padding to 12px reproduces the failure.
|
On the red here, so it is not read as this branch's:
Nothing else outstanding: the two contract tests this PR fixes pass, 35 passed / 11 skipped locally. |
|
The four Confirmed by comparing this branch with #8115/#8110: the two share no files with each other and neither touches Fixed in #8120, with a guard that reads the tuple width from the function's own return annotation so the next arity change cannot drift past the tests again. |
|
main is red in three independent places right now, and each of these three PRs fixes exactly one of them, so every one of them still shows the other two as failures. Merging all three in any order turns main green; merging any one alone will not.
None of the three touches the others' files, so there are no conflicts between them. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b8b9cefa2
ℹ️ 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".
| body = source[source.index("def update(") : source.index("def _release_self_exe_lock_windows")] | ||
| # Ended at the next definition, not a helper inside the body: #8092 removed | ||
| # `_release_self_exe_lock_windows` and the old anchor took the slice with it. | ||
| body = _slice_between(source, "def update(", "class _WindowsLauncherUpdateTransaction") |
There was a problem hiding this comment.
Derive the update boundary from the next declaration
If _WindowsLauncherUpdateTransaction is moved above update during a behavior-preserving reorganization, _slice_between finds the end anchor before the start anchor and returns an empty string, so this contract fails at the first body.index(...). This recreates the source-layout brittleness the change is intended to remove; determine the next top-level declaration after def update( (or inspect the function via the AST) instead of naming a particular later class.
Useful? React with 👍 / 👎.
| provider = APP_PROVIDER.read_text(encoding = "utf-8") | ||
| found = re.findall(rf'"{re.escape(name)}":\s*"(-?\d+)px"', provider) | ||
| assert found, f"the provider no longer sets {name}" | ||
| assert len(set(found)) == 1, f"{name} is set to more than one value: {sorted(set(found))}" |
There was a problem hiding this comment.
Scope the CSS lookup to the Mac chrome style
If CUSTOM_CHROME_STYLE needs a different --studio-chat-header-padding-top from MAC_NATIVE_CHROME_STYLE, this helper collects both values and fails the uniqueness assertion even when the Mac titlebar relationship remains unchanged. The provider already defines these as separate platform styles, so the lookup used by the Mac contract should be limited to the MAC_NATIVE_CHROME_STYLE block rather than imposing an unrelated cross-platform equality.
Useful? React with 👍 / 👎.
| encoding = "utf-8" | ||
| ) | ||
| # Zero puts the row on the traffic lights; large drops it out of the 48px bar. | ||
| assert 0 < _provider_css_px("--studio-titlebar-navigation-offset-y") <= 8 |
There was a problem hiding this comment.
Bound the navigation nudge by its actual titlebar
When the offset is increased to 8px, this assertion passes even though the native Mac style provides a 34px desktop titlebar and each navigation button is 30px tall, so the translated box extends beyond the titlebar (8 + 30 > 34). Read the button size and the applicable --studio-desktop-titlebar-height and compare those values instead of using the unrelated magic upper bound of 8.
Useful? React with 👍 / 👎.
| assert ( | ||
| _provider_css_px("--studio-chat-header-padding-top") | ||
| - _provider_css_px("--studio-titlebar-navigation-offset-y") | ||
| ) == 5 |
There was a problem hiding this comment.
Keep the chat controls within their header
If the navigation offset and chat padding are changed together to 7px and 12px, both new contracts pass because the offset remains within 8 and the difference remains 5, but the Mac header is 44px tall and its controls are 33px tall, so the padding requires 45px and pushes the controls outside the row. In addition to checking relative alignment, assert that padding plus control height does not exceed the applicable header height.
Useful? React with 👍 / 👎.
|
Superseded by #8132, closing. #8132 repaired Nothing here is left to land. The wider point this was part of is also resolved: the three-way CI deadlock between this, #8120 and #8110 is gone, and #8110 has been rebased onto main and narrowed to the one defect that is still real. |
Two source-scraping contract tests are failing on
mainright now, and both fail for the same reason: they pin a spelling rather than the behaviour, so an ordinary change to the code under test reads as a repo-wide red.tests/python/test_studio_runtime_gate.py::test_terminal_update_holds_the_gate_through_environment_mutation#8092 replaced
_release_self_exe_lock_windowswith_WindowsLauncherUpdateTransaction. The test slicedstudio.pyfromdef update(up to that helper name, so the rename took the whole slice down with it:It now ends at the next definition rather than at a name inside the body, and asserts the ordering that actually matters, including that the launcher transaction sits INSIDE the gate: the transaction renames the running launcher aside, so a second Studio the gate never excluded would be mutating the same install underneath it.
tests/studio/test_desktop_reliability_frontend_contract.py#8102 nudged the mac titlebar by 2px (
--studio-titlebar-navigation-offset-y2px to 4px,--studio-chat-header-padding-top7px to 9px) and reddened two tests, because they spelled the numbers out as literals. What the layout depends on is the row keeping its shape, so the offset is now bounded (positive, and inside the 48px titlebar) and the chat header is asserted to stay 5px below it.Still catches a real break: moving the padding to 12px reproduces the failure.
Both slices also go through a helper that reports a moved anchor by name, so the next rename says which one went instead of raising a bare index error.
Verified with
pytest tests/python tests/studio: 3721 passed, the two failures gone. The two remaining local failures (test_e2e_no_torch_sandbox,test_tokenizers_and_torch_constraint) build a no-torch venv and fail in my sandbox onmaintoo; CI reports neither.