Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

test(benchmark): close phase five emulator gate

David Nashashfc547a8c61ff
diff --git a/benchmark/src/main/java/com/streamvault/benchmark/BenchmarkConfig.kt b/benchmark/src/main/java/com/streamvault/benchmark/BenchmarkConfig.kt
index 705e54f8..ad4546e2 100644
--- a/benchmark/src/main/java/com/streamvault/benchmark/BenchmarkConfig.kt
+++ b/benchmark/src/main/java/com/streamvault/benchmark/BenchmarkConfig.kt
@@ -55,6 +55,11 @@ private val instrumentation: Instrumentation
private val device: UiDevice
get() = UiDevice.getInstance(instrumentation)
+/** Ensures independent cold-start iterations begin with the release target stopped. */
+internal fun MacrobenchmarkScope.stopTargetApp() {
+ device.executeShellCommand("am force-stop $RELEASE_TARGET_PACKAGE")
+}
+
internal fun MacrobenchmarkScope.startTargetApp() {
pressHome()
startActivityAndWait()
diff --git a/benchmark/src/main/java/com/streamvault/benchmark/StreamVaultMacrobenchmark.kt b/benchmark/src/main/java/com/streamvault/benchmark/StreamVaultMacrobenchmark.kt
index c204ad16..cad0e4fa 100644
--- a/benchmark/src/main/java/com/streamvault/benchmark/StreamVaultMacrobenchmark.kt
+++ b/benchmark/src/main/java/com/streamvault/benchmark/StreamVaultMacrobenchmark.kt
@@ -28,7 +28,10 @@ class StreamVaultMacrobenchmark {
metrics = listOf(StartupTimingMetric()),
compilationMode = CompilationMode.None(),
startupMode = StartupMode.COLD,
- iterations = STARTUP_BENCHMARK_ITERATIONS
+ iterations = STARTUP_BENCHMARK_ITERATIONS,
+ setupBlock = {
+ stopTargetApp()
+ }
) {
startTargetApp()
}
@@ -41,7 +44,10 @@ class StreamVaultMacrobenchmark {
baselineProfileMode = BaselineProfileMode.Require
),
startupMode = StartupMode.COLD,
- iterations = STARTUP_BENCHMARK_ITERATIONS
+ iterations = STARTUP_BENCHMARK_ITERATIONS,
+ setupBlock = {
+ stopTargetApp()
+ }
) {
startTargetApp()
}
diff --git a/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md b/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md
index a391053e..f68bed6c 100644
--- a/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md
+++ b/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md
@@ -975,10 +975,13 @@ paths, plus reversible quick-filter save/reload/remove persistence. The full
clean-build guardrails remain open. Current-checkout clean/warm samples and
Beta/Release packaging are recorded. Profile generation now passes on the
seeded API 36 TV emulator, with fresh sources containing zero stale app
- Home/EPG descriptors and nonzero `feature/live` descriptors; the eight
- separate macrobenchmark tests were skipped by configuration and remain an
- open performance gate. The app-owned Live route golden was reviewed and
- regenerated with its connected assertion passing. Catalog is now structurally
+ Home/EPG descriptors and nonzero `feature/live` descriptors. The explicit
+ Macrobenchmark selector now runs all eight journeys: 8/8 passed, 0 skipped,
+ including both 10-iteration release cold-start methods and six seeded
+ interaction journeys; the emulator execution gate is closed. Matched paired
+ performance and physical-device measurements remain open. The app-owned Live
+ route golden was reviewed and regenerated with its connected assertion
+ passing. Catalog is now structurally
extracted under `:feature:catalog`; its execution report records passing
connected goldens, a public-M3U Home/Live/Movies/Series/Search smoke pass,
and a diagnostic temporary Xtream fixture run covering 63-item VOD/series
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_CATALOG_REPORT.md b/docs/COMPOSE_REDUCTION_PHASE5_CATALOG_REPORT.md
index 9ff045b6..89ea3583 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_CATALOG_REPORT.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_CATALOG_REPORT.md
@@ -13,9 +13,10 @@ strings, arguments, return destinations, callbacks, focus/test semantics, and
the four golden test names were preserved; the feature-only baselines were
re-recorded after the original app-shell fixtures proved non-equivalent.
-This report covers the Catalog slice only. Playback, Provider, Settings, and
-Live status remain governed by their existing Phase 5 reports; Phase 5 is not
-complete and `:feature:system` is still unstarted.
+This report covers the Catalog slice only. Playback, Provider, Settings, Live,
+and System status remain governed by their existing Phase 5 reports; Phase 5 is
+not complete because cross-slice acceptance and paired-performance gates remain
+open. `:feature:system` is now structurally extracted.
## Delivery sequence and rollback
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md b/docs/COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md
index 49904009..0f40545f 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_LIVE_REPORT.md
@@ -132,6 +132,14 @@ following Live checkpoints (plus the final lint fix):
missing FrameTiming/navigation measurements; the macrobenchmark gate remains
open and no generated profile was hand-edited.
+- The explicit Macrobenchmark rerun on 2026-09-05 completed 8/8 tests with
+ 0 failures and 0 skipped after the cold-start methods began force-stopping
+ the release target in per-iteration setup. Both release startup methods
+ completed 10 iterations; the six seeded interaction journeys completed five
+ iterations each. This closes the emulator execution gate. The matched paired
+ performance comparison and physical-device measurement remain open. Full
+ metrics are recorded in `validation/phase5_system/macrobenchmark-validation.md`.
+
## Runtime acceptance
Using `E:\androidSdk\platform-tools\adb.exe` on `emulator-5554`
@@ -309,14 +317,17 @@ local fixture server was stopped.
final-tree warm no-change samples passed with a 13.690s median.
`verifyBaselineProfileSources`, Beta assembly, and Release assembly pass
against the regenerated 49,409 baseline / 32,151 startup rules. The
- baseline-profile producer's eight macrobenchmark tests were skipped by
- configuration, so
- macrobenchmark performance remains open even though profile generation and
- descriptor freshness now pass. Details are in
+ baseline-profile producer's aggregate task still selects only its profile
+ rules, but the explicit Macrobenchmark rerun now passes all eight journeys.
+ The matched paired macrobenchmark comparison remains open even though
+ profile generation, descriptor freshness, and emulator execution now pass.
+ Details are in
`validation/phase5_live/profile-validation.md`.
- Deferred — neighboring slices: Playback, Provider, and Settings
acceptance/performance gates remain governed by their existing reports. The
separate Provider and Settings `check` tasks pass; the aggregate neighboring
command stops at the pre-existing Playback lint gate (29 errors, first at
- `PlayerOverlayGoldenTest.kt:51`). Catalog and System were not started. Phase
- 5 is not complete until the deferred gates and remaining slices are resolved.
+ `PlayerOverlayGoldenTest.kt:51`). Catalog and System extraction slices are
+ now structurally complete; Phase 5 is not complete until the deferred
+ acceptance, paired-performance, physical-device, and production-credential
+ gates are resolved.
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_PLAYBACK_REPORT.md b/docs/COMPOSE_REDUCTION_PHASE5_PLAYBACK_REPORT.md
index eb6cf623..969670e0 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_PLAYBACK_REPORT.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_PLAYBACK_REPORT.md
@@ -309,6 +309,6 @@ the app source tree.
Phase 5 structural extraction: **complete**.
Runtime playback acceptance: **open pending live-recovery stability, manual
-journeys, and macrobenchmark/physical-device validation**. The focused and full
+journeys, matched macrobenchmark comparison, and physical-device validation**. The focused and full
release-like profile journeys passed after the benchmark harness fix, including
baseline-profile generation, merge, and installation.
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md b/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md
index 02f78421..c77856ae 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md
@@ -110,10 +110,17 @@ The exhaustive fixture-dependent journeys and formal paired performance and
clean-build guardrails remain explicit. Current-checkout clean/warm samples
and successful Beta/Release packaging are recorded. Profile generation now
passes on the seeded API 36 TV emulator, with fresh sources containing zero
-stale app Home/EPG descriptors and nonzero `feature/live` descriptors; the
-eight separate macrobenchmark tests were skipped by configuration and remain
-an open performance gate. The app-route Live golden was reviewed and
-regenerated from the current palette, with its connected assertion passing.
+stale app Home/EPG descriptors and nonzero `feature/live` descriptors. The
+explicit Macrobenchmark selector now runs all eight journeys: 8/8 passed, 0
+skipped, including both 10-iteration release cold-start methods and six
+seeded interaction journeys. This closes the emulator execution gate; matched
+paired performance and physical-device measurements remain open. The app-route
+Live golden was reviewed and regenerated from the current palette, with its
+connected assertion passing.
+All six feature `testDebugUnitTest` tasks pass. Feature lint passes for
+Provider, Settings, Live, Catalog, and System; Playback lint remains blocked by
+29 existing translation/Compose errors, and repository-wide app lint remains
+blocked by its pre-existing debt.
Catalog extraction is structurally implemented with passing connected golden
checks and current-checkout build-isolation samples. The public-M3U seeded
Home/Live/Movies/Series/Search smoke pass is supplemented by a diagnostic
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md b/docs/COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md
index 300b92ca..afa1ac3c 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md
@@ -217,11 +217,15 @@ The supported profile command was corrected from the stale plan path
UiAutomator idle after launching the target. The startup journey passed 1/1,
and the seeded critical journey subsequently completed successfully. The
supported `:app:copyBaselineProfileIntoSrc` workflow then passed its connected
-run with zero failures and refreshed both generated sources. Each source has
+run with zero failures and refreshed both generated sources. The explicit
+Macrobenchmark selector subsequently completed all 8/8 journeys with zero
+failures and zero skipped tests; both release cold-start methods completed ten
+iterations and all six seeded interaction methods completed five. Each source has
nonzero `feature/system` descriptors and no old app Welcome/Downloads/Plugins,
`WelcomeGraph`, or `SystemGraph` descriptors. See
-`validation/phase5_system/profile-validation.md` for the command and scan
-evidence.
+`validation/phase5_system/profile-validation.md` and
+`validation/phase5_system/macrobenchmark-validation.md` for the command and
+scan/benchmark evidence.
`graphify update .` completed with 16,550 nodes and 32,460 edges. The refreshed
graph resolves feature `SystemGraph` ownership and an `AppNavHost` to
diff --git a/validation/phase5_system/macrobenchmark-validation.md b/validation/phase5_system/macrobenchmark-validation.md
new file mode 100644
index 00000000..ccbf44fc
--- /dev/null
+++ b/validation/phase5_system/macrobenchmark-validation.md
@@ -0,0 +1,48 @@
+# Phase 5 macrobenchmark validation
+
+Captured 2026-09-05 on the API 36 `Television_1080p(AVD) - 16` emulator
+(`emulator-5554`) after the System extraction and benchmark-harness fix.
+
+## Command
+
+```text
+gradlew.bat :benchmark:connectedNonMinifiedReleaseAndroidTest \
+ -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=Macrobenchmark \
+ -Pandroid.testInstrumentationRunnerArguments.class=com.streamvault.benchmark.StreamVaultMacrobenchmark \
+ --no-daemon --console=plain --warning-mode=none
+```
+
+The explicit `Macrobenchmark` selector is required because the baseline-profile
+plugin's aggregate task otherwise selects only the profile generator rules.
+The cold-start journeys now force-stop `com.streamvault.app` in their
+per-iteration setup, so independent startup tests satisfy Macrobenchmark's
+cold-start precondition even when another test method ran immediately before
+them.
+
+## Result
+
+- 8 tests passed, 0 failures, 0 errors, and 0 skipped.
+- Instrumentation result: `OK (8 tests)`; measured time `1,381.073 s`.
+- Gradle result: `BUILD SUCCESSFUL in 24m 10s`.
+- The two release cold-start methods each completed all 10 iterations.
+- The six seeded interaction methods each completed all 5 iterations.
+
+| Journey | Iterations | Result | Key metric |
+|---|---:|---|---|
+| `coldStartupNoCompilation` | 10 | pass | TTID median 2,416.7 ms |
+| `coldStartupWithBaselineProfile` | 10 | pass | TTID median 2,224.2 ms |
+| `dashboardVerticalScroll` | 5 | pass | frame-count median 76 |
+| `epgHorizontalAndVerticalNavigation` | 5 | pass | frame-count median 44 |
+| `liveTvCategoryAndChannelNavigation` | 5 | pass | frame-count median 39 |
+| `liveTvCategoryReentryCategoryBuild` | 5 | pass | frame-count median 61 |
+| `playerControlsOpenAndNavigate` | 5 | pass | frame-count median 49 |
+| `settingsScrollAndDialogNavigation` | 5 | pass | frame-count median 72 |
+
+## Gate interpretation
+
+This closes the Phase 5 emulator execution gate for the explicit macrobenchmark
+suite and confirms the release cold-start harness is isolated between methods.
+The results are diagnostic: the run uses an emulator and the seeded interaction
+journeys target the debuggable `com.streamvault.app.debug` fixture. A matched
+pre/post performance comparison, physical-device measurements, and the other
+feature-specific acceptance gates remain open.