From 349a2e43eaf11259741c3d3d791a81d492201e91 Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 06:41:21 +0000 Subject: [PATCH] Keep the phone model-label sweep from reading the browser's clipped label (#9934) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test(app): wait for the model control to re-measure in the label sweep The phone label sweep read the folded model control twice, 100ms apart, after each resize. A resize reflows the page at once and the browser clips the model label with its own ellipsis until the control's layout event arrives. On a slow runner both reads landed in that window, so the sweep recorded a truncated label beside the thinking label and stopped. A settled read now also requires the model label to fit its box, and gives up after 10s with the last state. Co-Authored-By: Claude Opus 5.5 * test(app): settle the label sweep on the label its box fits The previous commit rejected one in-between state: the browser clipping the model label beside the thinking label. A slow runner can also leave the label truncated to "Ten second…" after the thinking label is gone, because the label's box widens at once but its text waits for the next layout event. A settled read now requires the shown label to match the box: the full text when the invisible full-text sizer fits, otherwise a truncation that fits. That covers both states, so the clipped-label special case goes. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- .../helpers/composer-control-density.ts | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/packages/app/e2e/support/helpers/composer-control-density.ts b/packages/app/e2e/support/helpers/composer-control-density.ts index 089b112b7..e41add56c 100644 --- a/packages/app/e2e/support/helpers/composer-control-density.ts +++ b/packages/app/e2e/support/helpers/composer-control-density.ts @@ -170,6 +170,11 @@ export interface ModelTriggerLabelState { modelShown: boolean; modelText: string; modelTruncated: boolean; + /** + * The model label shows what its box fits right now: the full text when it fits, otherwise a + * truncation that fits. False while the control has yet to catch up with a reflow. + */ + modelFitsBox: boolean; } declare global { @@ -194,12 +199,18 @@ function readModelTriggerLabelStateInPage(): ModelTriggerLabelState { }; const modelShown = model !== undefined && shown(model); const modelText = model?.textContent ?? ""; + const overflows = (node: Element) => node.scrollWidth > node.clientWidth; + const modelOverflows = model !== undefined && overflows(model); + // The label's box is sized by an invisible copy of the full text, its first child, so the box + // follows a reflow at once while the shown text waits for the control's next layout event. + const fullTextSizer = model?.parentElement?.parentElement?.firstElementChild; + const fullTextFits = fullTextSizer ? !overflows(fullTextSizer) : true; return { modelShown, modelText, thinkingShown: modelShown && thinking !== undefined, - modelTruncated: - model !== undefined && (modelText.endsWith("…") || model.scrollWidth > model.clientWidth), + modelTruncated: modelText.endsWith("…") || modelOverflows, + modelFitsBox: !modelOverflows && modelText.endsWith("…") !== fullTextFits, }; } @@ -217,13 +228,26 @@ export async function recordModelTriggerFramesFromLoad(page: Page): Promise { + const deadline = Date.now() + 10_000; let previous = await page.evaluate(readModelTriggerLabelStateInPage); for (;;) { await page.waitForTimeout(100); const next = await page.evaluate(readModelTriggerLabelStateInPage); - if (JSON.stringify(next) === JSON.stringify(previous)) return next; + const agrees = JSON.stringify(next) === JSON.stringify(previous); + if (agrees && next.modelFitsBox) return next; + if (Date.now() > deadline) { + throw new Error( + `the model control never settled on a label that fits its box: ${JSON.stringify(next)}`, + ); + } previous = next; } }