Skip to content

Repair seven tests left behind by their own subjects - #8132

Merged
danielhanchen merged 3 commits into
mainfrom
fix-main-reds
Aug 8, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
fix-main-reds

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Seven tests are failing on main right now. All seven are cases where the code they cover moved on and the test did not, so they block Repo tests (CPU) and the Python matrix for every open PR without describing a real defect.

Reproduced on a clean main worktree before touching anything:

tests/test_research_runs_hardening.py  4 failed, 117 passed
tests/python/test_studio_runtime_gate.py + tests/studio/test_desktop_reliability_frontend_contract.py  3 failed, 32 passed, 11 skipped

1. _stream_completion arity (4 tests)

_stream_completion returns (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:

AssertionError: assert ('report', '', 'stop', None) == ('report', '', 'stop')
ValueError: too many values to unpack (expected 3)

Finished the update in the style the already-updated sites use.

2. test_terminal_update_holds_the_gate_through_environment_mutation

The test slices update()'s body up to def _release_self_exe_lock_windows, and asserts that helper is called inside the guarded region. Both are gone: _WindowsLauncherUpdateTransaction replaced the self-exe lock release, and the source comment in studio.py says 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 def instead of naming whichever function happens to follow.

3. Two test_desktop_reliability_frontend_contract tests

These pin exact pixel values for two CSS custom properties:

assert '"--studio-chat-header-padding-top": "7px"' in provider
assert '"--studio-titlebar-navigation-offset-y": "2px"' in ...

Both variables are still set; they are 9px and 4px now. 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:

Mutation Result
drop usage from the _stream_completion return 11 failed
reorder update() so setup precedes the idle scan ordering test fails
set both CSS nudges to 0px both contract tests fail

Suites after the change: tests/python/ + the frontend contract file is 962 passed, and test_research_runs_hardening.py + test_research_runs_storage.py is 231 passed. Two failures remain in tests/python/ (test_e2e_no_torch_sandbox, test_tokenizers_and_torch_constraint); both fail identically on unmodified main and are install/network sandbox tests, untouched here.

No production code is changed.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@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: 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)

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 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 👍 / 👎.

Comment on lines +80 to +81
match = re.fullmatch(r"(\d+)px", (value or "").strip())
return int(match.group(1)) if match else None

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 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

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 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 👍 / 👎.

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