Skip to content

test: stop the browser smoke self-test waiting out a 10 s readiness budget (nightly) - #513

Merged
haiyuan-eng-google merged 2 commits into
GoogleCloudPlatform:mainfrom
caohy1988:fix/ci-flake-1007
Oct 8, 2026
Merged

haiyuan-eng-google merged 2 commits into
GoogleCloudPlatform:mainfrom
caohy1988:fix/ci-flake-1007

Conversation

@caohy1988

@caohy1988 caohy1988 commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

dashboard/looker_studio/tools/browser_smoke.sh --self-test runs 13 fixtures. Fixture 13 (alive-but-unready server) proves that a readiness timeout with a live child fails at once, with no retry. Its expected outcome is the readiness budget running out, so every run waited the full production budget: 20 nonce polls, 0.5 s apart, about 10 s of sleeping.

The self-test runs 6 times per CI run: once in the Configurator browser smoke job, and once inside each of the five required Test (Python 3.10–3.14) jobs through test_browser_smoke_negative_fixtures_are_detected (#497 put it there on purpose). #497 listed the slowness of these browser gates as out of scope for a follow-up. This PR is that follow-up for the one part that is pure waiting.

Evidence

  • CI, 14 green runs. I read the Configurator browser smoke job logs of the 14 most recent successful CI runs (2026-10-06/07); each fixture prints a timestamped self-test N OK line. Fixture 13 took 10.09–10.28 s in all 14 (median 10.20 s), which is 16–35% of the whole self-test (median 36.3 s).
  • Local (macOS arm64, Python 3.13.7, main @ 1fdc9d7): fixture 13 took 10.80 s of a 100.2 s self-test.
  • Not a flake claim. No red run was observed. This PR removes fixed waiting and claims no change in flake rate.

Fix (2 files, +35/−2)

  • browser_smoke.sh reads the readiness budget from SMOKE_READY_POLLS. The default stays 20, so the real check and the other 12 fixtures are unchanged. Anything but a positive integer is rejected before a server or browser starts, with its own message rather than a misleading readiness timeout.
  • Fixture 13 alone passes SMOKE_READY_POLLS=4 (about 2 s). The code after the poll loop is the same for any budget. The fixture's shim logs its line about 20 ms after the spawn (median of 30; max 24 ms), and 42 ms median / 60 ms max with 28 busy loops on 14 CPUs, so 2 s leaves more than 30× headroom.
  • tests/test_looker_studio_dashboard.py gains one parametrized test (0, -1, abc) for that validation. It needs no browser, and it fails against the old script (which ignores the variable and runs the whole check).
  • Unchanged: fixture 13's three assertions (the check fails, exactly one server spawn, the diagnostic carries the server output), every other fixture, the port retry, the Chrome deadline and grace loops, and the workflows.

Before / after

before (main @ 1fdc9d7) after (ef35d72)
fixture 13, local 10.80 s 2.25 s
whole self-test, standalone, local 100.2 s 92.3 s
test_browser_smoke_negative_fixtures_are_detected in a full-suite run 100.25 s 91.93 s
new fixture 13, 50 repeated runs — 50/50 pass, 2.25–2.31 s
new fixture 13, 30 runs with 28 busy loops on 14 CPUs — 30/30 pass, 2.31–2.43 s
full suite 5463 passed, 83 skipped 5466 passed, 83 skipped (3 new)
per-test outcomes of the 5546 shared tests — 0 differences
CI: fixture 13 in the Configurator browser smoke job 10.09–10.28 s, median 10.20 s (14 runs) 2.10 s (this PR, run 37611576268)
CI: whole self-test in that job 29.1–63.4 s, median 36.3 s (14 runs) 29.2 s
CI: the -q progress line holding both browser gates, per Test job 28.3–47.0 s, median 39.2 s (15 jobs in main runs 37503684586, 37531231391, 37574830017) 30.9–36.1 s, median 31.7 s (5 jobs); this line is noisy across runners, so the smoke-job timestamp above is the direct measure
CI test counts (all five Test jobs) 5465 passed, 81 skipped 5468 passed, 81 skipped (the 3 new cases)

Mutation probe. A harness runs fixture 13's exact text, copied from each script version, against a mutated copy of that version's main check:

main-check state old fixture 13 new fixture 13
M0: unmutated pass (10.99 s) pass (2.46 s)
M1: a live-but-unready server is retried on a fresh port fail (2 spawns) fail (2 spawns)
M2: that diagnostic drops the server output fail fail

The verdicts match, so the shorter budget doesn't change what the fixture catches.

Verification commands

# self-test with per-fixture timestamps (before on main, after on this branch)
cd dashboard/looker_studio
bash tools/browser_smoke.sh --self-test 2>&1 | perl -MTime::HiRes=time -ne '$|=1; printf "%.3f %s", time, $_'

# full suite as CI runs it, plus junit for a per-test outcome diff
pytest --tb=short -q --durations=10 --junitxml=after.xml   # 5466 passed, 83 skipped

# the new validation test
pytest tests/test_looker_studio_dashboard.py -k invalid_readiness_budget -q   # 3 passed

# format gate at CI's pins (pyink 25.12.0, isort 9.0.2), then CI's diff check
bash autoformat.sh && git diff --exit-code src/ tests/ examples/ scripts/ dashboards/   # 367 files unchanged
shellcheck dashboard/looker_studio/tools/browser_smoke.sh   # clean; bash -n also clean under /bin/bash 3.2.57

Audit scope (nightly CI flake/slow pass, 2026-10-07)

This does not revisit #497 (port retry) or #505 (offline deploy-script test).

candidate evidence verdict
fixture 13 of the browser smoke self-test fixed 10.1–10.3 s in 14 of 14 CI smoke jobs, 6 runs of the self-test per CI run slow: fixed here
"2 headless-Chrome tests fail locally on main" Not reproduced: both pass alone (112 s) and in the full suite (5463 passed, 0 failed). They fail only when Chrome produces no DOM: with HOME pointed at an empty temp dir, Chrome writes nothing and test_configurator_loads_in_a_real_browser fails after 56 s with a bare exit status 1 (see the next row). The gate runs whenever a Chrome binary exists by design, and skipping a present-but-broken Chrome would hide real failures. keep: environment, not a missing skip guard
browser_smoke.sh exits 1 with no message when Chrome writes no DOM MARKER_TAG="$(printf … | grep -o … | head -1)" fails under set -e + pipefail before the "instrumentation marker missing" line can run; reproduced with CHROME_BIN=/usr/bin/true on main and on this branch diagnostic bug, not slow or flaky: follow-up
CI reds since 2026-10-02 (300 runs, back to 2026-09-18) PR #510 fork: two startup failures with no jobs ("workflow file issue"), then attempt 1 action_required and attempt 2 green after approval; Producers CI hash-lock drift ×3 on the #509 branch (new upstream releases, e.g. google-cloud-pubsub 2.42.0, proto-plus 1.29.0); External access attestation staleness (schedule): attestation overdue, so it bumps #498 and exits 1 by design keep: no red-then-green flake on one tree
CI-only progress line near 89–91% (1.2 / 5.4 / 20.9 s min / median / max over 60 Test jobs in 12 main runs) Across 4 commits the slow line always holds test_telemetry, test_terraform_property_graph_mode, test_trace_filter_factory and skipped live tests. Locally the same 72 tests take 0.164 s with ADC hidden and CI=true. An audit-hook probe saw no network access there and one subprocess, terraform fmt, which doesn't wait for Terraform's checkpoint call even through a hanging proxy (0.24 s with Terraform 1.15.4 locally; the runner image has 1.16.4). unsure: most likely the runner's first terraform start; needs per-test CI timing before any change
TestCompileExtractor line (20–41 s in CI) per-compile subprocess isolation; same cost before and after #510 keep: real work
test_self_evolving_agent_demo.py::test_require_complete_session_metrics_rejects_zero_token_schema without ADC, load_config() makes google-auth probe 169.254.169.254 three times (8.9 s on a Mac); its CI line takes 0.4–0.5 s local-only: follow-up
Chrome fixtures, ~11.8 s each locally vs ~1.5 s in CI macOS headless Chrome wrote the DOM in 0.46 s but was still running 34 s later, so each local fixture waits out the 10 s exit grace window and is killed local-only: not changed
…udget (nightly)

Self-test fixture 13 (alive-but-unready server) checks that a readiness
timeout with a live child fails at once, with no retry. Its expected
outcome is the readiness budget running out, so every run waited the
full production budget: 20 nonce polls, 0.5 s apart. In 14 green CI
runs the standalone smoke job spent 10.09-10.28 s on it (median 10.20 s,
16-35% of the self-test), and the same self-test also runs inside each
of the five required Test jobs, so CI paid it six times per run.

browser_smoke.sh now reads the budget from SMOKE_READY_POLLS (default
20, so the real check is unchanged). Anything but a positive integer is
rejected before a server or browser starts. Fixture 13 alone passes
SMOKE_READY_POLLS=4 (about 2 s). The code after the poll loop does not
depend on the budget, and the fixture's shim logs its line about 20 ms
after the spawn (60 ms at most with every CPU busy).

Local results (macOS, Python 3.13):
- fixture 13: 10.80 s -> 2.25 s; whole self-test 100.2 s -> 92.3 s.
- The new fixture passed 50 of 50 runs, and 30 of 30 with 28 busy loops
  on 14 CPUs.
- Mutation probes give the same verdicts for the old and new fixture:
  retrying a live-but-unready server fails (2 spawns), and dropping the
  server output from that diagnostic fails.
- A new parametrized test covers the knob's validation without a
  browser; it fails against the old script.
- Full suite: 0 outcome changes across 5546 shared tests, plus the 3
  new passing cases.

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: APPROVE @ ef35d72

Blind review: PR #513 @ ef35d72 (nightly slow-test fix)

Blind review from the PR body, commits, code, and CI only. Reviewed as attempted disproof.

Rejection criteria (set before reading the diff)

  • RC1 — Slowness not real on main: fixture 13 does not actually burn ~10 s of fixed waiting on base 1fdc9d7, or the self-test does not run 6x per CI run.
  • RC2 — Coverage weakened / failure masked: the shorter budget changes what fixture 13 catches (retry detection, spawn count, diagnostic content), or the new env var alters the production check / other fixtures when unset.
  • RC3 — Evidence does not reproduce: the before/after timings, test counts, new-test behavior (pass on head, fail on base), or mutation parity cannot be reproduced.

All three criteria failed (i.e. the PR survived each disproof attempt). Details below.

RC1: slowness is real — NOT MET

  • ci.yml:93-105 runs --self-test in the smoke job; ci.yml:71-91 runs pytest in 5 Test jobs, and tests/test_looker_studio_dashboard.py:1047-1051 runs --self-test inside the suite. 6 runs per CI run confirmed.
  • Independent CI check: main run 37574830017 smoke log, fixture 12 line 05:08:37.49 to fixture 13 line 05:08:47.66 = 10.17 s, inside the claimed 10.09–10.28 s band.
  • Poll-loop arithmetic reproduced locally: 20 iterations of curl + sleep 0.5 took 10.58 s; 4 iterations took 2.08 s.
  • Isolated fixture-13 harness (same shim text, same assertions): budget 20 = 10.78 s; budget 4 = 2.27–2.68 s. Same ~8 s saving per run.

RC2: no coverage loss — NOT MET

  • Diff is 2 files, +35/−2. Production loop browser_smoke.sh:654 changes seq 1 20 to seq 1 "$READY_POLLS" with default 20 (:81), behaviorally identical when the var is unset. Only fixture 13 passes SMOKE_READY_POLLS=4 (:511); the other 12 fixtures, port retry, and Chrome deadline/grace loops are untouched.
  • Fixture 13's three assertions are byte-identical before/after: inner must fail (:512-514), exactly one spawn (:515-517), diagnostic carries server output (:518-519).
  • Mutation probe replicated with budget 4: M0 unmutated passes (2.4–2.9 s, 1 spawn, diagnostic present); M1 (alive-unready retried) yields 2 spawns, caught by the spawn assertion; M2 (diagnostic drops server output) yields 1 spawn but fails the grep assertion. Verdicts match the PR's table.
  • Validation (:81-86) rejects 0, -1, abc, 00, 01, 04, " 4", "4 ", "+4", "4.0", exits 1 in ~0.016 s before any server/browser start, and the EXIT trap still cleans the temp dir. Accepts 4, 20.
  • Blast radius: only 3 tests invoke the script (lines 1024, 1048, 1060); no workflow sets SMOKE_READY_POLLS globally.

RC3: evidence reproduces — NOT MET

  • PR run 37611576268 smoke log: fixture 12 11:04:46.32 to fixture 13 11:04:48.42 = 2.10 s (claimed 2.10 s). All checks green, including all 6 self-test runs.
  • Test counts from CI logs: main 37574830017 = 5465 passed / 81 skipped in all 5 jobs; PR run = 5468 passed / 81 skipped in all 5 jobs (+3 new cases). Exact match.
  • pytest tests/test_looker_studio_dashboard.py -k invalid_readiness_budget → 3 passed in 0.23 s. Old script contains 0 occurrences of SMOKE_READY_POLLS, so the new test fails on base as claimed.
  • Isolated fixture 13 with budget 4: 6/6 pass, assertions hold every run.
  • shellcheck clean, bash -n clean (also under /bin/bash 3.2.57), pyink --check and isort --check-only clean on the touched test file.
  • Limitation: full local self-test and full-suite reruns were blocked by this sandbox (localhost bind denied, unsandboxed run unavailable), so CI logs served as the independent oracle, plus the isolated fixture harness above.

Findings

  • P3: SMOKE_READY_POLLS="" (empty) silently defaults to 20 via :- rather than being rejected, so "anything but a positive integer is rejected" is slightly overbroad. Empty-as-unset is standard and harmless; optionally soften the sentence. browser_smoke.sh:81.
  • P3: Leading-zero values (04, 01) are rejected though numerically positive. Over-strict but safe (clear message, retry with 4). No change needed. browser_smoke.sh:82-86.
  • P3: An outer SMOKE_READY_POLLS export would leak into fixtures 1–12 (only 13 overrides). Nothing in CI sets it (verified), the var is new and header-documented, and real http.server readies in ~1 poll, so this is hardening-only: consider having the self-test pin or unset it for the other fixtures.
  • P0–P2: none.

What I tried (disproof log)

  1. Verified 6 self-test runs per CI from ci.yml + test file; timed fixture 13 on main (10.17 s) and PR (2.10 s) CI logs.
  2. Ran poll-loop timing (10.58 s vs 2.08 s) and an isolated fixture-13 harness (10.78 s vs 2.27–2.68 s, 6/6 pass).
  3. Probed validation with 13 values incl. edge cases; confirmed fail-fast timing and exit codes.
  4. Replicated M1/M2 mutations against budget 4; both caught as the PR claims.
  5. Confirmed new test passes on head, fails on base; ran dashboard file minus network gates (30 passed); checked shellcheck, bash-3.2 syntax, pyink, isort.
  6. Grepped for other callers of the script and setters of the var; confirmed workflows unchanged and tree clean.

VERDICT: APPROVE @ ef35d72

@caohy1988 caohy1988 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: APPROVE @ ef35d72

Independent blind review of this head against main/base 1fdc9d7e20eb1a6cca9b105977af3f1953748cb5. I read the PR body, commit, code and CI, without consulting other reviews or the context vault. No P0, P1, P2 or P3 findings. None of the following rejection criteria was met.

Before reading the diff, I recorded these criteria in rejection-criteria.md:

  1. Reject if the reported flake or pathological duration cannot be reproduced on the relevant main/base code under a credible matching setup, or the stated cause conflicts with observed behavior.
  2. Reject if the change masks a real failure, reduces meaningful coverage, alters production behavior unsafely, or introduces a missing case that lets incorrect behavior pass.
  3. Reject if controlled main/base-versus-head runs do not reproduce the claimed stability/duration improvement, or adversarial reruns expose a regression within the claimed scope.

The body explicitly claims a fixed-wait reduction and makes no flake-rate claim. The code matches that scope: dashboard/looker_studio/tools/browser_smoke.sh:81–86 retains the default of 20 polls and validates the override; only fixture 13 supplies 4 at line 511. Its failure, single-spawn and captured-output assertions remain at lines 512–519. The nonce check, retry classification and cleanup after the poll loop are unchanged (:654–675). No workflow or SDK behavior changes with the variable unset.

I independently reran the following:

Attempt Main/base Reviewed head
Full suite: python -m pytest --tb=short -q --durations=20 --junitxml=<version>.xml 5,463 passed, 83 skipped 5,466 passed, 83 skipped
Self-test duration within that full suite 100.468 s 91.397 s
Real configurator browser test within that full suite 11.781 s 11.807 s
Complete standalone bash tools/browser_smoke.sh --self-test, two runs each 2/2 passed; 133.64 s, 132.63 s 2/2 passed; 124.93 s, 124.22 s
Fixture 13 within those standalone runs, timestamped from fixture 12's completion 11.18 s, 10.97 s 2.43 s, 2.51 s
Exact fixture 13 and shim extracted from each version, five alternating runs each 5/5 passed; 11.057–11.190 s 5/5 passed; 2.483–2.554 s
Fixture 13 with 16 CPU-busy workers on 14 logical CPUs — 10/10 passed; 2.686–2.822 s
Artificially delay the shim's diagnostic by 0.25, 1.0 and 1.5 seconds — 3/3 passed at each delay

JUnit comparison found zero outcome differences across all 5,546 shared tests, no removed tests, and exactly the three new passing validation cases. Full suites used the same fresh macOS arm64 Python 3.13.7 environment. Standalone/probe pairs used the same host Bash 3.2 and Python 3.13.5 environment. Some local validation overlapped; aggregate durations include host noise. Fixture-level timing independently shows the fixed-wait reduction.

I also checked the published CI evidence directly. Fixture 13 took 10.204 s, 10.238 s and 10.170 s in main runs 37503684586, 37531231391 and 37574830017, versus 2.095 s in head run 37611576268. The head's five Python CI jobs all passed with 5,468 passed / 81 skipped, three more passing cases than the sampled base run.

To try to break coverage, I ran the exact old and new fixture assertions against separate copies with these mutations:

Injected fault in the main check Old fixture New fixture Observed rejection output
Retry a live-but-unready child Rejected Rejected must fail immediately with no retry (server spawns: 2)
Drop the captured server output from the live-child diagnostic Rejected Rejected the diagnostic must include the captured server output
Return success for the live-but-unready child Rejected Rejected an alive-but-unready server passed
Skip all readiness polls Rejected Rejected must fail immediately with no retry (server spawns: 0)

Additional missing-case probes covered unset/empty budgets and explicit 1, 4, 20: unset and empty retain the approximately 10-second default; explicit values scale the wait. Startup spies confirmed that 0, -1, abc, 1.5, whitespace, +1, 01, 00, an embedded newline and 0x10 all fail with the dedicated diagnostic before Python or a browser starts. pytest tests/test_looker_studio_dashboard.py -k invalid_readiness_budget -q --durations=10 passed all three new cases; invoking those same test functions against main's script failed all three at the diagnostic assertion (tests/test_looker_studio_dashboard.py:1068, with CHROME_BIN=/bin/false to keep the negative control fast).

Reproduction artifacts are in /Users/haiyuancao/Documents/bqaa-513-review/: run_suites.py, run_smoke.py, probe_fixture.py, probe_validation.py, per-run logs/JSON, both JUnit XML files and suite-comparison.json. The probe commands were:

python3 probe_fixture.py --mode repeat --count 5
python3 probe_fixture.py --mode mutations
python3 probe_fixture.py --mode budgets
python3 probe_fixture.py --mode delays --count 3
python3 probe_fixture.py --mode stress --count 10
python3 probe_validation.py

/bin/bash -n, shellcheck, and git diff --check also passed. The reviewed worktree remains unchanged. These are bounded reproductions, not a statistical flake-rate guarantee; I sampled three of the historical CI runs rather than repeating the full 14-run census or the author's 50/30-run history. No code was pushed.

VERDICT: APPROVE @ ef35d72

@haiyuan-eng-google
haiyuan-eng-google merged commit c1af834 into GoogleCloudPlatform:main Oct 8, 2026
15 checks passed
haiyuan-eng-google pushed a commit that referenced this pull request Oct 8, 2026
…umns (#514)

* chore(release): 0.6.0 — span OTel correlation, ViewManager denied_columns

Bump [project].version from 0.5.4 to 0.6.0 and cut CHANGELOG.md for
the 10 PRs merged since v0.5.4 (#502, #504–#510, #512, #513).

[Unreleased] becomes [0.6.0] - 2026-10-08 with a release-highlights
lead, and a new empty [Unreleased] sits above it. The #510 entries
already under [Unreleased] are kept and checked against the code:
denied_columns is keyword-only and exact-case, a bare string raises
TypeError, the six per-event views it skips are named, the CLI exits 2
on an invalid name, and the event-specific view columns move two
positions later. The SDK.md correlation guide moves to Documentation.
Every other PR in the range gets an entry marked as in the wheel or
repo side; the Removed entry lists the incidental module attributes
#504 dropped.

0.6.0 rather than 0.5.5: besides new public API, per-event views now
select two more columns ahead of the event-specific ones, and over an
events table without an attributes column they deploy only with
denied_columns=["attributes"].

No code, dependency or workflow change.

* docs(changelog): scope the non-string ID guarantee to the attributes fallback

The [0.6.0] Span entry said the three correlation IDs stay None on rows
"with non-string values". Span.from_bigquery_row() applies that check
only to values it reads from attributes: a truthy same-named column
value is returned unchanged ({"otel_span_id": 123} gives 123), while a
non-string value in attributes is ignored and gives None. Say that the
attributes fallback ignores non-string values, and that the fields stay
None on rows without those columns or keys.

CHANGELOG wording only; the version stays 0.6.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants