Skip to content

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

docs(system): report phase 5 feature extraction

David Nashasha6d2281c6ca2
diff --git a/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md b/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md
index fab03ec4..55605c51 100644
--- a/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md
+++ b/docs/COMPOSE_REDUCTION_AND_UI_ARCHITECTURE_PLAN.md
@@ -897,6 +897,7 @@ Detailed delivery artifacts:
- [Catalog feature extraction design](superpowers/specs/2026-09-02-phase-5-catalog-feature-extraction-design.md)
- [Catalog feature extraction implementation plan](superpowers/plans/2026-09-02-catalog-feature-extraction.md)
- [Catalog feature extraction execution report](COMPOSE_REDUCTION_PHASE5_CATALOG_REPORT.md)
+- [System feature extraction implementation plan](superpowers/plans/2026-09-04-system-feature-extraction.md)
Recommended extraction order:
@@ -996,9 +997,12 @@ paths, plus reversible quick-filter save/reload/remove persistence. The full
successful
diagnostic Dashboard benchmark rerun after populating a scrollable seeded
Home shelf, open paired benchmark gate, refreshed release-like profiles, and
- current app lint baseline failure remain explicitly tracked. System remains
- unstarted; Playback, Provider, and Settings gates remain governed by their
- separate reports.
+ current app lint baseline failure remain explicitly tracked. System is now
+ structurally extracted under `:feature:system`; its connected acceptance
+ passes 19/19 and paired incremental thresholds pass. The System profile
+ refresh, paired clean/warm comparison, physical-device/accessibility gates,
+ and authorized production journeys remain open; Playback, Provider, and
+ Settings gates remain governed by their separate reports.
### Phase 6 - Optional Views migrations
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md b/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md
index 99d8df37..a9957dc0 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_ROADMAP.md
@@ -96,6 +96,8 @@ out of :app without behavior or stability regressions.
docs/superpowers/plans/2026-09-02-catalog-feature-extraction.md
- Catalog execution report:
docs/COMPOSE_REDUCTION_PHASE5_CATALOG_REPORT.md
+- System extraction implementation plan:
+ docs/superpowers/plans/2026-09-04-system-feature-extraction.md
- Transitional dependency ledger:
docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -142,4 +144,11 @@ The paired Dashboard comparison is intentionally deferred until the
benchmark environment has stable capacity for matched baseline and current
runs.
The release-like profile workflow now passes with feature Catalog descriptors.
-System remains unstarted.
+System presentation extraction is structurally complete under `:feature:system`:
+Welcome, Downloads, Plugins, controller-free graph registration, resources,
+contracts, and tests are feature-owned while app adapters and plugin/platform
+runtime remain app-owned. Connected acceptance passes 19/19 and paired
+incremental source/test thresholds pass. The supported System profile refresh,
+paired clean/warm comparison, physical-device/touch validation, accessibility
+service traversal, and authorized production-provider/plugin journeys remain
+open; see `COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md`.
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md b/docs/COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md
new file mode 100644
index 00000000..d3d813b3
--- /dev/null
+++ b/docs/COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md
@@ -0,0 +1,230 @@
+# Compose Reduction Phase 5 — System feature extraction report
+
+Date: 2026-09-04
+
+## Outcome
+
+Welcome, Downloads, and Plugins presentation is now owned by `:feature:system`.
+The feature owns its controller-free graph registration, routes, ViewModels,
+rendering, neutral plugin contracts/models, resources, unit tests, connected
+tests, and reviewed goldens. `:app` remains the Android composition root and
+retains startup orchestration, shell composition, platform adapters, plugin
+discovery/IPC/work/provider/playback infrastructure, and Android entry points.
+
+The extraction is structurally complete and the incremental feature-value
+thresholds pass. The formal clean/warm paired comparison and startup/profile
+refresh remain open because the supported seeded profile workflow stalled in
+its unrelated Live/player critical journey. The module is therefore retained
+as a provisional Phase 5 decision, with the remaining gates explicitly owned
+as follow-up work.
+
+## Rollback and commit sequence
+
+Rollback SHA: `cddef1526924634819c7fb27d15c8a49b3945a1d`.
+
+The implementation was split into these focused commits:
+
+```text
+e9e89e65 docs(system): record phase 5 extraction baseline
+b189b977 test(system): lock existing presentation behavior
+c9f7b3cd build(system): add isolated feature module
+fac29462 feat(system): define feature contracts and routes
+6ce6517a refactor(system): bridge app startup and plugin services
+541dd966 refactor(system): move welcome presentation
+0c7d911d refactor(system): move downloads presentation
+3ab9239b refactor(system): move plugins presentation
+dcd74f59 refactor(system): register feature-owned navigation
+35ff4f03 test(system): stabilize presentation semantics
+57182dee test(system): verify ownership and resources
+```
+
+Connected acceptance and final documentation are intentionally separate
+follow-up commits after the final evidence review.
+
+## Ownership and size
+
+The Task 0 baseline contained eight app production files and 2,120 physical
+lines: the three screen/state/ViewModel groups plus the two old graph files.
+The authoritative pre-extraction inventory is
+`validation/phase5_system/task0-inventory.md`.
+
+Current feature counts are:
+
+| Area | Files | Physical lines / assets |
+|---|---:|---:|
+| `src/main/java` Kotlin | 13 | 2,459 |
+| `src/test/java` Kotlin | 9 | 700 |
+| boundary fixtures | 12 | 45 |
+| `src/androidTest/java` Kotlin | 7 | 970 |
+| `src/main/res` | 51 | 33 default System keys, 26 qualifiers |
+| reviewed connected goldens | 6 | 1920×1080 PNG each |
+
+The old app screen directories and app `WelcomeGraph.kt`/`SystemGraph.kt` are
+absent. The feature has one `SystemGraph` registration and the app root
+registers it once.
+
+## Boundary and contracts
+
+`:feature:system` has exactly these project dependencies:
+
+```text
+:core:navigation, :core:ui, :domain
+```
+
+The boundary verifier scans production Kotlin/Java and negative fixtures. The
+production result is zero forbidden references for app/data/player/root
+controllers/all sibling features; the fixtures detect app, data, player,
+`MainActivity`, `NavController`, `NavHostController`, and each sibling feature
+token as required. The report is in
+`feature/system/build/reports/feature-system-boundary/report.txt`.
+
+`SystemWelcomePort` exposes `Flow<WelcomeSyncProgress?>` and a
+`WelcomeDevProviderConfig`. `AppSystemWelcomeAdapter` maps the app's
+`SyncProgressBus` and `BuildConfig` values without moving either dependency.
+
+`SystemPluginManagementPort` exposes discovery, provider-source lookup, APK
+install, enable/disable, configuration load/save/refresh, and configuration
+actions. `AppSystemPluginManagementAdapter` delegates directly to the existing
+`StreamVaultPluginManager` and `ProviderSourceRegistry`.
+
+The feature contains no plugin manager, messenger, work coordinator, provider
+ownership, or playback-routing implementation. Those remain under
+`app/src/main/java/com/streamvault/app/plugins` and related app infrastructure.
+
+## Navigation and behavior preservation
+
+The feature owns the exact `welcome`, `downloads`, and `plugins` route
+patterns. `SystemGraph` is controller-free and receives navigation actions,
+startup redirect callbacks, and a scaffold callback from `AppNavHost`. The app
+retains `NavHostController`, `NavHost`, `AppRouteCodec`, startup policy, and
+top-level shell adaptation.
+
+Characterization tests were added before the moves. Feature ViewModel and
+presentation tests preserve loading/error/result handling, download actions,
+plugin configuration JSON/draft behavior, Welcome progress and setup/later
+actions, semantics, focus/test tags, and callback delegation. The connected
+graph test proves one registration for all three routes. Full authorized
+production-provider/plugin journeys were unavailable and are not claimed as
+passed; details are in `validation/phase5_system/task10-device-journeys.md`.
+
+## Resources
+
+The feature owns the exact 33 System string keys from the Task 0 inventory.
+The default and all 25 localized qualifiers were compared (26 total):
+
+```text
+duplicate_system_entries=0
+missing_system_values=0
+value_mismatches=0
+placeholder_mismatches=0
+```
+
+Thirty feature-only app definitions were removed. `app_name`, `nav_downloads`,
+and `settings_cancel` remain app-owned because the manifest, TV input service,
+app shell, Settings, Live, Catalog, and Playback still consume them. The full
+audit is in `validation/phase5_system/task9-resource-cleanup.md`.
+
+## Automated validation
+
+Passing gates:
+
+- `:feature:system:verifyFeatureSystemBoundary`
+- `:feature:system:dependencies`
+- `:feature:system:testDebugUnitTest`
+- `:feature:system:lintDebug`
+- `:feature:system:compileDebugAndroidTestKotlin`
+- `:feature:system:assembleDebug`
+- `:core:navigation:test`
+- `:core:ui:testDebugUnitTest`
+- `:domain:test`
+- `:app:testDebugUnitTest`
+- `:app:assembleDebug`
+- `:app:assembleBeta`
+- `:app:assembleRelease`
+- root `:verifyBaselineProfileSources` (source shape valid)
+
+The final focused matrix completed successfully in 1m29s with 324 actionable
+tasks, including the System boundary, feature lint, connected-test compile,
+feature assembly, app tests, and app debug assembly.
+
+`:app:lintDebug` remains red from existing app-wide debt (675 errors); the
+first unchanged error is `AppStartupCoordinator.kt:192`, `NewApi` on
+`Trace.beginAsyncSection`. No app lint baseline or startup code was changed by
+this extraction.
+
+## Connected acceptance and visual review
+
+On the only available device, `Television_1080p(AVD) - 16`, API 36,
+1920×1080:
+
+- six deterministic goldens were recorded, visually inspected, and compared
+ pixel-for-pixel;
+- the final System connected suite passed 19/19;
+- the suite covers nine presentation tests, one graph test, six golden cases,
+ and three RTL/1.3 font-scale cases;
+- the reduced-motion variant passed with global animation scales set to zero
+ and the original scales restored afterward;
+- the retained log evidence reports no app fatal/runtime/resource/launcher
+ match and no sensitive-pattern match.
+
+The first 19-test attempt had two transient PixelCopy/window-capture failures;
+the exact same cases passed in isolation. `GoldenCapture.kt` now retries
+capture three times with a 250ms delay, while retaining exact bitmap
+dimensions and pixel comparisons. The rerun passed 19/19.
+
+No phone/tablet profile or TalkBack service was available. Semantics actions
+and connected RTL/large-text/reduced-motion assertions pass, but touch/mouse
+and service-mediated accessibility traversal remain unavailable gates.
+
+The Live-TV long-duration protocol is waived for this slice because no player
+composition, stream preparation, recovery, lifecycle, surfaces, overlays,
+Cast URL rewriting, or plugin playback routing changed.
+
+Evidence: `validation/phase5_system/task10-connected-validation.md`,
+`task10-device-journeys.md`, `task10-screenshots/`, and `task10-logcat.txt`.
+
+## Performance and isolation
+
+The paired warm incremental medians pass the optional-module thresholds:
+
+| Measurement | Before | After | Improvement | Threshold |
+|---|---:|---:|---:|---:|
+| source edit | 20.6311s | 7.3199s | 64.56% faster | ≥25% |
+| unit-test compile | 18.1523s | 7.6457s | 57.88% faster | ≥20% |
+
+All five raw samples per series, cache state, hashes, and build guardrails are
+in `validation/phase5_system/performance-after.md`.
+
+With a reversible System-only edit, the app dry run showed sibling Kotlin
+compile tasks as graph entries marked `SKIPPED`; the actual `:app:assembleDebug`
+run showed sibling Kotlin tasks `UP-TO-DATE` and did not execute sibling Kotlin
+compilation. The System and required app integration/package tasks were the
+only relevant work. Evidence is in
+`validation/phase5_system/system-edit-dry-run.txt` and
+`system-edit-task-output.txt`.
+
+Clean debug, warm debug, Beta, and Release guardrails passed. A cache-equivalent
+paired before/after clean/warm duration comparison has not been completed, so
+the ≤10% build-overhead gate is open rather than inferred.
+
+## Profiles, graph, and remaining work
+
+The supported profile command was corrected from the stale plan path
+`:benchmark:pixel2Api36Setup` to the current app-level
+`:app:generateBaselineProfile`. Startup collection completed and emitted a
+fresh profile containing nonzero System descriptors. The seeded critical
+journey then stalled at 1/10 without diagnostic output and was stopped safely;
+the checked-in generated profiles were not hand-edited and still contain stale
+pre-extraction System descriptors. A future successful end-to-end generator
+run must promote fresh output through the existing workflow. See
+`validation/phase5_system/profile-validation.md`.
+
+`graphify update .` completed with 16,550 nodes and 32,460 edges. The refreshed
+graph resolves feature `SystemGraph` ownership and an `AppNavHost` to
+`PluginsScreen` path through `AppNavigation`.
+
+Open follow-ups are the supported profile refresh, paired clean/warm duration
+comparison, physical-device/touch validation, TalkBack service traversal, and
+authorized production-provider/plugin journeys. This report does not close
+Playback, Provider, Settings, Live, Catalog, accessibility, or repository-wide
+performance gates, and does not claim full Phase 5 modernization completion.
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index 22e6ca3c..a2a090b2 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -233,9 +233,8 @@ Phase 7 follow-up: keep these ports narrow; do not move plugin IPC, provider
ownership, playback routing, or Android startup infrastructure into the feature.
The pre-extraction source, import, resource, test, and consumer evidence is in
-`validation/phase5_system/`. The System module remains unimplemented until the
-characterization, boundary, and performance gates in the approved plan are
-verified.
+`validation/phase5_system/`. The Task 0 note above records the pre-extraction
+state; the current implementation and gate status are recorded below.
## System extraction status (Task 9, 2026-09-04)
@@ -258,5 +257,8 @@ app-owned.
Task 9 structural, resource, unit-test, compilation, lint, and assembly gates
are recorded in `validation/phase5_system/task9-structural-verification.md`.
App-wide lint remains a pre-existing baseline-drift failure and is not a
-System extraction failure. Connected acceptance, reviewed goldens, and paired
-performance measurements remain open under Tasks 10-11.
+System extraction failure. Task 10 connected acceptance and reviewed goldens
+pass 19/19, and the paired incremental thresholds pass. The full System
+execution report is `docs/COMPOSE_REDUCTION_PHASE5_SYSTEM_REPORT.md`; the
+supported profile refresh and cache-equivalent clean/warm comparison remain
+open follow-ups.
diff --git a/validation/phase5_system/performance-after.md b/validation/phase5_system/performance-after.md
new file mode 100644
index 00000000..55c00320
--- /dev/null
+++ b/validation/phase5_system/performance-after.md
@@ -0,0 +1,75 @@
+# Phase 5 System extraction — post-extraction performance
+
+Captured: 2026-09-04 on `feature/improveCompose`, after the System
+presentation extraction. The paired pre-extraction baseline is recorded in
+`performance-before.md`.
+
+## Protocol
+
+- Gradle 8.12; Oracle JVM 21.0.5; Windows 11 amd64.
+- Each sample used `--profile --no-daemon --console=plain --warning-mode=none`.
+- The source and test measurements used reversible one-blank-line edits and
+ restored the files byte-for-byte after each series.
+- Source hash after restoration:
+ `WelcomeScreen.kt = ca1c597ed3c8a3c4bfa47ce9749bd1c4e9e21ad5`.
+- Test hash after restoration:
+ `WelcomeViewModelTest.kt = 928b17738c55a0035b1adb8aacf6b031b4800ce8`.
+
+## `:feature:system:compileDebugKotlin` source-edit samples
+
+| Sample | Duration | Result |
+|---|---:|---|
+| source-1 | 22.9892s | success |
+| source-2 | 7.2796s | success |
+| source-3 | 7.3984s | success |
+| source-4 | 7.3602s | success |
+| source-5 | 7.2687s | success |
+
+Raw durations: 22.9892s, 7.2796s, 7.3984s, 7.3602s, 7.2687s.
+All-sample min/median/max: 7.2687s / 7.3602s / 22.9892s. The first sample
+is the configuration/cache warm-up outlier. Warm samples 2–5 have a median of
+7.3199s.
+
+## `:feature:system:compileDebugUnitTestKotlin` test-edit samples
+
+| Sample | Duration | Result |
+|---|---:|---|
+| test-1 | 25.1138s | success |
+| test-2 | 7.6541s | success |
+| test-3 | 7.5883s | success |
+| test-4 | 7.7130s | success |
+| test-5 | 7.6373s | success |
+
+Raw durations: 25.1138s, 7.6541s, 7.5883s, 7.7130s, 7.6373s.
+All-sample min/median/max: 7.5883s / 7.6373s / 25.1138s. The first sample
+is the configuration/cache warm-up outlier. Warm samples 2–5 have a median of
+7.6457s.
+
+## Paired value gate
+
+Compared with the pre-extraction warm medians in `performance-before.md`:
+
+| Measurement | Before | After | Change | Gate |
+|---|---:|---:|---:|---|
+| System source edit | 20.6311s | 7.3199s | 64.56% faster | pass (≥25%) |
+| System unit-test compile | 18.1523s | 7.6457s | 57.88% faster | pass (≥20%) |
+
+The results are comparable warm paired measurements. The first sample in each
+series is reported, but excluded from the paired median because it includes
+configuration/cache initialization.
+
+## Build guardrails
+
+- `clean :app:assembleDebug`: passed; `BUILD SUCCESSFUL in 1m 9s`, 255
+ actionable tasks, 113 executed, 142 from cache. This was a clean invocation
+ with remote build-cache reuse.
+- Warm `:app:assembleDebug`: passed; `BUILD SUCCESSFUL in 14s`, 242
+ actionable tasks, 1 executed, 241 up-to-date.
+- `:app:assembleBeta :app:assembleRelease`: passed; `BUILD SUCCESSFUL in
+ 18m35s`, 464 actionable tasks, 276 executed, 149 from cache, 39 up-to-date.
+- The app lint task remains red on pre-existing app-wide debt and is tracked
+ separately in the final System report; feature lint passes.
+
+The source-edit and unit-test thresholds pass. Sibling Kotlin isolation,
+startup/profile status, and the remaining verification matrix are recorded in
+the System report rather than inferred from these two measurements.
diff --git a/validation/phase5_system/profile-validation.md b/validation/phase5_system/profile-validation.md
new file mode 100644
index 00000000..ea4352ba
--- /dev/null
+++ b/validation/phase5_system/profile-validation.md
@@ -0,0 +1,56 @@
+# Phase 5 System extraction — profile validation
+
+Date: 2026-09-04.
+
+## Supported workflow
+
+The implementation uses the existing app baseline-profile workflow. The
+prescribed plan command was attempted but this checkout has no
+`:benchmark:pixel2Api36Setup` project:
+
+```text
+./gradlew.bat :benchmark:pixel2Api36Setup:generateBaselineProfile :app:assembleRelease --no-daemon --console=plain --warning-mode=none
+FAILURE: project ':benchmark:pixel2Api36Setup' not found in project ':'.
+```
+
+The current task is app-level `:app:generateBaselineProfile`. It built and
+installed the non-minified release target and started the benchmark generator
+on `Television_1080p(AVD) - 16`.
+
+## Result
+
+The `BaselineProfileGenerator.startup` method completed successfully and
+emitted a fresh startup profile during the run. The captured output contained
+nonzero System descriptors including:
+
+```text
+com/streamvault/feature/system/R$string
+com/streamvault/feature/system/api/SystemWelcomePort
+com/streamvault/feature/system/api/WelcomeDevProviderConfig
+com/streamvault/feature/system/navigation/SystemGraphKt
+com/streamvault/app/system/AppSystemWelcomeAdapter
+```
+
+The subsequent `criticalJourneys` method remained at `1/10` with no failure
+diagnostic for the bounded collection window. It was stopped safely; the
+overall generator process therefore ended with user-interrupt status and did
+not complete the profile install/copy step. This benchmark journey exercises
+seeded Home/Live/player navigation and does not cover the System routes.
+
+The maintained files under `app/src/main/generated/baselineProfiles/` were
+not manually edited. They still contain stale pre-extraction System entries,
+including old app `WelcomeGraph`, `SystemGraph`, Welcome, Downloads, and
+Plugins descriptors. The generated fresh startup output was inspected during
+the run and had no old app System descriptors, but it was not promoted into
+source because the supported generator did not finish its complete workflow.
+
+## Interpretation
+
+- Baseline-profile refresh is open and must be rerun when the seeded benchmark
+ journey completes end-to-end.
+- No claim is made that the stale checked-in generated profile is refreshed.
+- No physical Android device was available; only the TV emulator was present.
+- The System extraction does not alter player composition, stream preparation,
+ recovery, lifecycle, surfaces, or playback routing. The critical-journey
+ stall is consequently recorded as a benchmark/seeded-environment follow-up,
+ not as evidence of a System presentation failure.