Restrict the frame-regression release gate to the emulator

The on-device profile is demoted to a diagnostic: the run force-stops
the app and seeds/removes a file in its storage, and the developer may
be using the phone while a release runs. The release gate is now
explicitly (1) TestNoFramesWhileIdle in the go-test suite and (2)
scripts/profile_emulator.sh on the EMULATOR.

- script: auto-select picks an emulator only (previously any connected
  device); no emulator -> clear error; a physical device passed via -s
  prints a DIAGNOSTIC (non-gating) banner and a heads-up.
- doc: architecture.md §11 states the two gate tiers and the diagnostic
  use of the physical-device run.
This commit is contained in:
gmp
2026-08-20 14:40:24 -04:00
parent ac1c32e4c0
commit 8bdf916d8a
2 changed files with 42 additions and 19 deletions
+18 -11
View File
@@ -568,17 +568,24 @@ cannot measure this app because it renders into a `SurfaceView`).
`[0, MaxScroll]`) and emit a frame; `open <path>` opens a file from any
page (same `OpenFile` path as a browser tap) and emits. This lets a test
drive scrolls and file opens deterministically without pixel taps.
- **Frame-regression guard** (pre-release): frame emission is event-driven, so
a healthy app emits small per-action bursts and nothing while idle. Two
layers check that: `TestNoFramesWhileIdle` (internal/test/e2e, in the
regular go-test suite) asserts the logic emits ZERO frames across an idle
window after the browser and the editor (load + scroll + find cycle)
settle; and `scripts/profile_emulator.sh` runs the full sequence on a
device/emulator — 8 s idle, open, 16 s idle, three scrolls — via the debug
commands above, seeds a known 4000-line file for the open, and FAILs if any
idle-split phase of the CSV exceeds its frame budget (a ≥ 1/s spinner
exceeds a 16 s idle budget; a faster one balloons a phase or shows up in
PERF-PRESENT).
- **Frame-regression guard**: frame emission is event-driven, so a healthy
app emits small per-action bursts and nothing while idle. The guard has
two RELEASE-GATE tiers and one diagnostic use:
1. `TestNoFramesWhileIdle` (internal/test/e2e, in the regular go-test
suite) asserts the logic emits ZERO frames across an idle window
after the browser and the editor (load + scroll + find cycle) settle.
2. `scripts/profile_emulator.sh`, run on the **emulator** (auto-selected;
physical devices are never auto-picked), as the pre-release checklist
item: it drives 8 s idle, open, 16 s idle, three scrolls via the debug
commands above, seeds a known 4000-line file for the open, and FAILs
if any idle-split phase of the CSV exceeds its frame budget (a ≥ 1/s
spinner exceeds a 16 s idle budget; a faster one balloons a phase or
shows up in PERF-PRESENT).
The same script on a **physical device is diagnostic only, never a gate**
(pass `-s <serial>` explicitly; a banner says so): the run force-stops the
app and seeds/removes a file in its storage, and the developer may be using
the phone while a release runs. It exists to investigate a suspected
frame/battery problem, not to certify a release.
- The profiler is owned by the goroutine that creates it and is single-goroutine
(no locks). It does **not** `Sync()` the CSV per flush (only per row batch) to
avoid periodic fsync hitches in the logic path.