Repository navigation
test: poll headless Chrome every 0.1 s in the browser smoke check (nightly) - #536
Merged
Merged
Conversation
…ghtly) dump_dom() in dashboard/looker_studio/tools/browser_smoke.sh checked the background browser once per second. Its first check runs right after the launch, before Chrome has written anything, so every browser pass slept a full second even when Chrome finished in a few hundred milliseconds. One self-test makes 12 browser passes (10 real Chrome page loads plus two stand-in browsers) and the main check makes 2. CI runs both in the smoke job and in each of the five Test jobs, so the fixed wait recurs on every CI run. Poll every 0.1 s instead. The loops get 450 and 100 polls, so the 45 s of sleep behind the output deadline and the 10 s grace window are the same. Exit-status reaping, the deadline kill, the readiness loop (SMOKE_READY_POLLS) and every fixture are unchanged. Local before/after (macOS arm64, Chrome 155): - one-page main check, stand-in browser that writes its DOM and exits at once, 20 runs: median 1.653 s -> 0.756 s - same check with real Chrome, 10 runs: median 1.671 s -> 1.094 s - test_browser_smoke_negative_fixtures_are_detected: 24.33-24.44 s -> 17.44-18.11 s (3 runs each) - test_configurator_loads_in_a_real_browser: 2.71-2.74 s -> 1.54-1.60 s
haiyuan-eng-google
approved these changes
Oct 20, 2026
caohy1988
added a commit
that referenced
this pull request
Oct 20, 2026
haiyuan-eng-google
added a commit
that referenced
this pull request
Oct 20, 2026
* release: 0.6.1 * release: add #536 to the 0.6.1 changelog --------- Co-authored-by: Haiyuan Cao <haiyuan@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
dashboard/looker_studio/tools/browser_smoke.shstarts headless Chrome in the background, then polls it indump_dom(). Both poll loops slept a whole second between checks. The first check runs right after the launch, before Chrome has written anything, so every browser pass took at least one full second, even when Chrome was done in a few hundred milliseconds.CI pays this wait many times per run:
--self-testmakes 12 browser passes: 10 real Chrome page loads, plus the stand-in browsers of fixtures 3 and 4. The main check makes 2.Configurator browser smokejob, and inside each of the five requiredTest (Python 3.10–3.14)jobs (test_browser_smoke_negative_fixtures_are_detectedandtest_configurator_loads_in_a_real_browser).Evidence
CI, the 10 most recent
mainruns (2026-10-12 to 2026-10-20), read from the timestampedself-test N OKlines of theConfigurator browser smokejob:/bin/falseas the browser): 0.56–0.57 s in 3 runs, 1.53–1.57 s in 7.Local (macOS arm64, Chrome 155), the main check on a one-page healthy fixture, timed over many runs:
The browser's own speed does not show: all three sit on the same floor.
Not a flake claim. No red run was observed. This PR removes fixed waiting and claims no change in flake rate.
Root cause
A pass can end only on a whole-second boundary after the launch.
Fix (1 file, +7/−4)
SMOKE_READY_POLLS(test: stop the browser smoke self-test waiting out a 10 s readiness budget (nightly) #513);Before / after
main@e6fae8f)5cc6312)test_browser_smoke_negative_fixtures_are_detected(3 runs)test_configurator_loads_in_a_real_browser(3 runs)pytest --tb=short -q-qprogress line holding both browser gates, perTestjobTestjobs)Other CI fixtures in this PR's smoke job: fixture 4 took 1.58 s (before: 1.54 s once, 2.53–2.57 s otherwise); fixture 10 took 2.39 s (before: 3.08–3.16 s); fixture 14 took 1.68 s (before: 2.57–2.65 s). Fixtures 2 and 11–13 kept their times (1.57, 0.06, 0.57 and 2.09 s). Fixture 3 took 0.57 s, the low end of its before range.
Baseline CI runs (
main, newest first): 39379992440, 39316965669, 39287644332, 39210807323, 39171416943, 38806126365, 38642206430, 38516803828, 38514851642, 38283088580. The per-fixture numbers come from each run'sConfigurator browser smokejob log.Local per-fixture times of one
--self-testrun (seconds; same command on each tree):Fixtures 2, 3 and 11–13 never get as far as a browser page load, and they are unchanged.
Failure paths still behave the same
Self-test. All 14 fixtures keep their required outcome: every negative fixture fails, and the bind-collision retry passes.
Grace window. A stand-in browser that writes a healthy DOM and then stays alive is still killed only after the grace window. The run passes, as before.
Output deadline. A stand-in browser that never writes output still fails with the same
instrumentation marker missing — the page never finished loading.sleep 0.1costs about 14 ms of process start, so 550 polls stretch this failure-only path by about 7 s. A healthy run never reaches it.Moderate CPU load (8 busy loops on 14 cores):
--self-test: 3/3 passed before (24–25 s) and 3/3 after (19–22 s).Saturated CPU (14 or 20 busy loops): local Chrome 155 itself exits with status 2 about 10 s after writing the DOM. The check then fails the same way on
mainand on this branch.--self-testat 20: fixture 10 fails on each, because its healthy run needs Chrome to exit 0.This is a limit of the local Chrome, not of this change.
Test results
pytest --tb=short -q): 6215 passed, 83 skipped on both trees, with 0 per-test outcome differences across the 6298 tests.autoformat.shat CI's pins leaves 387 files unchanged, and CI'sgit diff --exit-codeis clean.bash -nand shellcheck are clean.Test (Python 3.10–3.14),Format check,Build package,Configurator browser smoke,cla/google,scan-pr,check-changes.Commands
Audit scope (nightly CI flake/slow pass, 2026-10-20)
This does not revisit #497 (port retry), #505 (offline deploy-script test), #513 (fixture 13 readiness budget) or #525 (ADC lookup in the self-evolving demo).
dump_dom()CIruns among the 30 most recentmainruns passed on attempt 1. All 15 attempt-2 runs (any workflow) were fork PRs'action_requiredapprovals. 14CIfailures were fork-PR startup failures with no jobs. The real failures were Format on one branch and producers hash-lock drift; attestation staleness fails by design.test_concurrent_launches_yield_exactly_one_owner(1.58 s)TestCompileExtractor(~1.5 s each)test_skill_evo_job_publication_regressions.py(12 tests, 10.6 s locally)test_no_v2_as_default_in_source(1.0 s locally)ROOT.rglob("*.py")also reads a local.venv(8,362 of 8,852 files); a CI checkout has nonetest_terraform_fmt_clean)sleep 1before using its decoy server; the readiness loop's 0.5 s pollSMOKE_READY_POLLSbudget from #513