refactor(daemon): route perf support gate through PlatformPlugin perf facet (#974)#995
Merged
Conversation
… facet
Add the `perf` facet to `PlatformPlugin`, typed platform-neutral as
`{ supportsMetrics(device: DeviceInfo): boolean }` (never the iOS provider
seam). Populate it by wrapping the Apple + Android arms of the existing
`supportsPlatformPerfMetrics` predicate verbatim (both return `true`), leave
linux/web factless, and route `supportsPlatformPerfMetrics` in
`daemon/handlers/session-perf.ts` through `tryGetPlugin(...).perf?.supportsMetrics`
with a `?? false` fallthrough that preserves the former hand disjunction.
Pinned by a table-equivalence parity test
(`daemon/__tests__/perf-plugin-routing-parity.test.ts`) that mirrors the merged
appLog gate: an independent verbatim copy of the former predicate is the BEFORE
oracle across the exhaustive platform x kind x target device matrix, facet
presence/fallthrough are asserted, and `buildPerfResponseData` is exercised with
no-app sessions to prove the daemon actually routes through the facet.
Only the support gate is routed; the perf sampling body (`buildPerfResponseData`)
and the Android-only native-collector gate stay on their daemon branch until each
clears the same gate. Follows the merged appLog facet template (type-only
core->daemon edge, lazy `registerBuiltinPlatformPlugins()`).
Refs #974
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
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.
Continues #974 (Phase 3 step b.3): add ONE MORE platform-neutral daemon facet to
PlatformPlugin, following the mergedappLogfacet (#991) as the exact template. This slice lands theperffacet's support gate.What landed
src/core/platform-plugin/plugin.ts): new platform-neutral, daemon-ownedperf?facet —{ supportsMetrics(device: DeviceInfo): boolean }. Never references the iOS-simulator provider seam.src/core/platform-plugin/register-builtins.ts): the Apple and Android plugins each carryperf: { supportsMetrics: () => true }, wrapping the twotruearms of the formersupportsPlatformPerfMetricsdisjunction (android || ios || macos). linux/web stay factless.src/daemon/handlers/session-perf.ts):supportsPlatformPerfMetricsnow returnstryGetPlugin(session.device.platform)?.perf?.supportsMetrics(session.device) ?? false, with a lazyregisterBuiltinPlatformPlugins()at module load (mirrorsdaemon/app-log.ts). The?? falsefallthrough preserves the historical result for linux/web/unregistered platforms. All three internal call-sites (buildPerfResponseData/buildPerfFramesResponseData/buildPerfMemoryResponseData) are unchanged.Parity test
src/daemon/__tests__/perf-plugin-routing-parity.test.tsmirrors the mergedapplog-plugin-routing-parity.test.ts:platform x kind x targetdevice matrix + the real discovery fixtures.undefined) andfalsefallthrough.buildPerfResponseDataon no-app sessions (which do no device I/O) classifies support via the routed cpu reason, so breaking the facet flips the classification and fails the test.Scope / what remains on #974
Deliberately the smallest honest, fully-pinned slice (per the issue's scope guidance). Still on their daemon branch as source of truth:
perf: the sampling bodybuildPerfResponseDataand the Android-only native-collector gate (session-native-perf.ts) — different semantics; left for a follow-up.recording: needs the de-iOS-naming start/stop-context redesign.providers: load-bearing request-scope orchestration seam.Does not close #974 (facets remain).
Verification (binaries directly)
tsc · oxlint --deny-warnings (src test) · oxfmt write+check ·
node --experimental-strip-types scripts/layering/check.ts· rslib build ·CI=true vitest run --project unit(301 files / 2917 tests, no android flake this run) ·fallow audit --base origin/main(no new findings) — all green.