Skip to content

Fix three frontend contract tests that main is red on - #8703

Merged
danielhanchen merged 1 commit into
mainfrom
fix/main-stale-frontend-contracts
Aug 13, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/main-stale-frontend-contracts

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What changed

Repo tests (CPU) is currently failing on main, so every branch cut from it inherits a red job it did not cause. Three tests, all of which assert against source text rather than behaviour, which is why a refactor that kept the behaviour still turned them red.

FAILED tests/studio/test_desktop_reliability_frontend_contract.py::test_clipboard_file_paste_is_bounded_and_wired_to_both_composers
FAILED tests/studio/test_chat_title_generation.py::test_tool_call_only_first_assistant_still_uses_first_user_message
FAILED tests/studio/test_ui_font_scale_contract.py::test_no_raw_pixel_text_utilities

Clipboard paste. The contract reads clipboard-files.ts and looks for clipboardData.files, item.getAsFile() and friends. #8472 moved the DataTransfer reading half into clipboard-payload.ts when long pastes became attachments. Every string it wants is still present, just in the sibling file, so it reads both as the one contract they always were. No behaviour change.

Title generation. The contract pins the exact line that reads the first user message. #8472 replaced extractTextParts with titleTextOf, which wraps it and appends an attachment sample for a user turn. The first user message still titles the thread, so the assertion follows the rename. I added one more on titleTextOf itself, so the new indirection cannot quietly stop reading the text and leave the test passing on a name alone.

Font scale. This one is a real finding rather than a stale assertion. attachment.tsx used a raw text-[11px], which ignores the UI font size preference, so that attachment size label stayed fixed while everything around it scaled. Swapped for the text-ui-11 token, which is the same 11px at scale 1 and scales from there.

Testing

tests/studio/                     3661 passed, 3 skipped
studio/frontend  npm test         2238 passed, 0 failed
studio/frontend  npm run typecheck  clean

All three assert against source text, so a refactor that keeps the behaviour can
still turn them red. That is what happened here, and the result is that every PR
branching off main inherits a red Repo tests (CPU) job it did not cause.

The clipboard contract reads clipboard-files.ts, but #8472 moved the DataTransfer
half into clipboard-payload.ts when long pastes became attachments. The strings
it looks for are all still there, just in the sibling file, so it now reads both
as the one contract they always were.

The title contract pins the exact line that reads the first user message. #8472
replaced extractTextParts with titleTextOf, which wraps it and appends an
attachment sample for a user turn. The first user message still titles the
thread, so the assertion follows the rename, plus one on titleTextOf itself so
the indirection cannot quietly drop the text.

The font-scale contract is the one real finding: attachment.tsx used a raw
text-[11px], which ignores the UI font size preference, so that label stayed
fixed while the rest of the UI scaled. Swapped for the text-ui-11 token, which
is the same 11px at scale 1.
@danielhanchen
danielhanchen merged commit b2158c2 into main Aug 13, 2026
33 of 45 checks passed
@danielhanchen
danielhanchen deleted the fix/main-stale-frontend-contracts branch August 13, 2026 14:27

@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: 3b18450737

ℹ️ 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 +364 to +366
helper = CLIPBOARD_FILES.read_text(encoding = "utf-8") + CLIPBOARD_PAYLOAD.read_text(
encoding = "utf-8"
)

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 Keep clipboard parsing assertions tied to the paste helper

Concatenating these sources lets the contract remain green if clipboard-files.ts stops importing and calling browserClipboardFiles, clipboardAdvertisesFiles, and clipboardHasPlainText: the asserted DataTransfer logic would still exist in clipboard-payload.ts for the independently wired pasted-text path, while the composer assertions only prove they call pasteClipboardFiles. Browser file pasting could therefore fall through without this test detecting it; assert the delegation from CLIPBOARD_FILES explicitly or test each helper separately.

Useful? React with 👍 / 👎.

in generate_block
)
title_block = " ".join(_balanced_block(source, "function titleTextOf").split())
assert "const text = extractTextParts(m);" in title_block

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 extracted text flows out of titleTextOf

This assertion only proves that titleTextOf calls extractTextParts; it does not verify that the extracted text participates in the return value. If the attachment-title logic later returns only attachmentsSample(...) or otherwise discards text, a text-only first user followed by a tool-call-only assistant will fall back to New Chat, while every assertion in this test remains green. Assert the relevant return paths or cover this scenario behaviorally.

Useful? React with 👍 / 👎.

danielhanchen added a commit that referenced this pull request Aug 13, 2026
#8586 went in as a single squashed commit, so main's copy of that work shares no
history with the copies this branch merged, and git saw every line the two have
in common as a conflict. Resolved file by file:

* install.sh, studio/setup.sh and tests/sh/test_uv_pinned_release.sh are #8586's
  alone and this branch never touched them, so they take main's version whole.
  That is also the newer one: #8586 gained commits after the last merge here.

* install.ps1, six hunks. The Studio launcher command, the launch-studio.ps1
  byte comparison and its Unblock-File rationale stay this branch's, since they
  are #8586's substance plus this branch's changes on top. The UNC launcher
  check, the uv source-precedence comment and the staged-probe comment take
  main's: all three are newer there, and the UNC one now covers mapped drives
  through DriveInfo, which the version here did not.

* studio/setup.ps1 takes main's on both hunks. It reads the pinned-install
  verdict off a script-scope flag rather than the pipeline, because
  Invoke-SetupCommand returns [int]$LASTEXITCODE and not the block's value, so
  the Select-Object form here could not have driven the winget fallback at all.

* studio/src-tauri/src/process.rs, one region where both sides added disjoint
  functions: this branch's managed CLI invocation builders and main's
  working-directory and environment context helpers. Both kept. The conflict cut
  through build_managed_cli_command_tokio, whose closing brace was on the far
  side, so that had to be put back by hand.

* preflight/managed.rs merged clean but not correct: main widened run_cli_probe
  and probe_cli_capability to Result so a context failure can be told apart from
  a bad install, and the two early returns this branch added still handed back
  bare values. They return Ok(false) and Ok(None): a venv with no interpreter
  beside the launcher is a verdict, not a failure to ask.

Verified on the merged tree: 4657 Python tests, 359 Rust tests, every PowerShell
suite, and #8586's test_uv_pinned_release.sh. The three frontend contract tests
and test_amd_venv_repair_loop.ps1 that were red on this branch an hour ago are
green, fixed by #8703 on main.
danielhanchen added a commit that referenced this pull request Aug 13, 2026
#8586 went in as a single squashed commit, so main's copy of that work shares no
history with the copies this branch merged, and git saw every line the two have
in common as a conflict. Resolved file by file:

* install.sh, studio/setup.sh and tests/sh/test_uv_pinned_release.sh are #8586's
  alone and this branch never touched them, so they take main's version whole.
  That is also the newer one: #8586 gained commits after the last merge here.

* install.ps1, six hunks. The Studio launcher command, the launch-studio.ps1
  byte comparison and its Unblock-File rationale stay this branch's, since they
  are #8586's substance plus this branch's changes on top. The UNC launcher
  check, the uv source-precedence comment and the staged-probe comment take
  main's: all three are newer there, and the UNC one now covers mapped drives
  through DriveInfo, which the version here did not.

* studio/setup.ps1 takes main's on both hunks. It reads the pinned-install
  verdict off a script-scope flag rather than the pipeline, because
  Invoke-SetupCommand returns [int]$LASTEXITCODE and not the block's value, so
  the Select-Object form here could not have driven the winget fallback at all.

* studio/src-tauri/src/process.rs, one region where both sides added disjoint
  functions: this branch's managed CLI invocation builders and main's
  working-directory and environment context helpers. Both kept. The conflict cut
  through build_managed_cli_command_tokio, whose closing brace was on the far
  side, so that had to be put back by hand.

* preflight/managed.rs merged clean but not correct: main widened run_cli_probe
  and probe_cli_capability to Result so a context failure can be told apart from
  a bad install, and the two early returns this branch added still handed back
  bare values. They return Ok(false) and Ok(None): a venv with no interpreter
  beside the launcher is a verdict, not a failure to ask.

Verified on the merged tree: 4657 Python tests, 359 Rust tests, every PowerShell
suite, and #8586's test_uv_pinned_release.sh. The three frontend contract tests
and test_amd_venv_repair_loop.ps1 that were red on this branch an hour ago are
green, fixed by #8703 on main.
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