Repository navigation
Repair seven tests left behind by their own subjects - #8132
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a81692f11
ℹ️ 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".
| titlebar = _px(values.get("--studio-desktop-titlebar-height")) | ||
| assert offset is not None and offset > 0, (name, values) | ||
| assert titlebar is not None, (name, values) | ||
| assert offset + button <= titlebar, (name, offset, button, titlebar) |
There was a problem hiding this comment.
Include the navigation's existing top offsets in the bound
Fresh evidence in this revision is that the new formula still omits offsets already present in the rendered paths: DesktopTitlebarNavigation always has mt-1, while its macOS placements add either pt-px or top-px. With the current values, the button's bottom is therefore 1 + 4 + 4 + 30 = 39px within a 34px titlebar, but this assertion passes because it checks only 4 + 30 <= 34; include those fixed offsets so the test actually rejects navigation extending beyond the titlebar row.
Useful? React with 👍 / 👎.
| match = re.fullmatch(r"(\d+)px", (value or "").strip()) | ||
| return int(match.group(1)) if match else None |
There was a problem hiding this comment.
Accept fractional pixel values in the contract parser
When either visual nudge is legitimately retuned to a fractional pixel value such as 8.5px, this helper returns None, causing the new contract assertions to fail even when the padding or navigation geometry remains within its bound. Fractional pixel tuning is valid CSS and is already used elsewhere in this frontend, so restricting the parser to unsigned integers reintroduces the brittle retuning failures these changes are intended to eliminate; parse decimal px values and compare them as floats.
Useful? React with 👍 / 👎.
| setup = body.index("_run_setup_script(", launcher) | ||
| verify = body.index("_fail_if_install_damaged()", setup) | ||
| assert consume < guard < idle_scan < release_self < setup < verify | ||
| assert consume < guard < idle_scan < launcher < setup < verify |
There was a problem hiding this comment.
Verify the mutating calls remain nested under the gate
If _WindowsLauncherUpdateTransaction() and _run_setup_script() are dedented to run immediately after _studio_runtime_launch_guard exits, every index in this ordering remains increasing and the test still passes, even though the managed environment is then mutated without the runtime gate. Because the contract depends on lexical nesting rather than textual order, inspect the guarded block's indentation or AST so this test detects the gate being released before setup.
Useful? React with 👍 / 👎.
Seven tests are failing on
mainright now. All seven are cases where the code they cover moved on and the test did not, so they blockRepo tests (CPU)and the Python matrix for every open PR without describing a real defect.Reproduced on a clean
mainworktree before touching anything:1.
_stream_completionarity (4 tests)_stream_completionreturns(report, reasoning, finish_reason, usage). Every production caller unpacks four; six of the ten test call sites were updated and four were missed, so they still assert three:Finished the update in the style the already-updated sites use.
2.
test_terminal_update_holds_the_gate_through_environment_mutationThe test slices
update()'s body up todef _release_self_exe_lock_windows, and asserts that helper is called inside the guarded region. Both are gone:_WindowsLauncherUpdateTransactionreplaced the self-exe lock release, and the source comment instudio.pysays so.The contract the test is named for still holds, so it now checks the same ordering against the current step, and bounds the slice at the next top-level
definstead of naming whichever function happens to follow.3. Two
test_desktop_reliability_frontend_contracttestsThese pin exact pixel values for two CSS custom properties:
Both variables are still set; they are
9pxand4pxnow. These are visual nudges that get retuned, so a literal pins the day the test was written rather than the behaviour. They now assert every assigned value is a positive px, which keeps the intent (the control is nudged off the titlebar edge) and survives the next tweak.Verification
Each fix is mutation-checked, so none of them merely silences a test:
usagefrom the_stream_completionreturnupdate()so setup precedes the idle scan0pxSuites after the change:
tests/python/+ the frontend contract file is 962 passed, andtest_research_runs_hardening.py+test_research_runs_storage.pyis 231 passed. Two failures remain intests/python/(test_e2e_no_torch_sandbox,test_tokenizers_and_torch_constraint); both fail identically on unmodifiedmainand are install/network sandbox tests, untouched here.No production code is changed.