Skip to content

refactor(daemon): route perf support gate through PlatformPlugin perf facet (#974)#995

Merged
thymikee merged 1 commit into
mainfrom
phase3-b3-more-facets
Jul 1, 2026
Merged

refactor(daemon): route perf support gate through PlatformPlugin perf facet (#974)#995
thymikee merged 1 commit into
mainfrom
phase3-b3-more-facets

Conversation

@thymikee

@thymikee thymikee commented Jul 1, 2026

Copy link
Copy Markdown
Member

Continues #974 (Phase 3 step b.3): add ONE MORE platform-neutral daemon facet to PlatformPlugin, following the merged appLog facet (#991) as the exact template. This slice lands the perf facet's support gate.

What landed

  • Facet type (src/core/platform-plugin/plugin.ts): new platform-neutral, daemon-owned perf? facet — { supportsMetrics(device: DeviceInfo): boolean }. Never references the iOS-simulator provider seam.
  • Populated verbatim (src/core/platform-plugin/register-builtins.ts): the Apple and Android plugins each carry perf: { supportsMetrics: () => true }, wrapping the two true arms of the former supportsPlatformPerfMetrics disjunction (android || ios || macos). linux/web stay factless.
  • Routed the daemon lookup (src/daemon/handlers/session-perf.ts): supportsPlatformPerfMetrics now returns tryGetPlugin(session.device.platform)?.perf?.supportsMetrics(session.device) ?? false, with a lazy registerBuiltinPlatformPlugins() at module load (mirrors daemon/app-log.ts). The ?? false fallthrough 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.ts mirrors the merged applog-plugin-routing-parity.test.ts:

  • An independent verbatim copy of the former predicate is the BEFORE oracle.
  • Table-equivalence across the exhaustive platform x kind x target device matrix + the real discovery fixtures.
  • Facet presence (Apple+Android carry it, same Apple instance for ios/macos; linux/web undefined) and false fallthrough.
  • End-to-end routing proof: buildPerfResponseData on 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 body buildPerfResponseData and 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.

… 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
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.5 MB 1.4 MB -16.9 kB
JS gzip 469.8 kB 464.8 kB -5.1 kB
npm tarball 572.0 kB 564.4 kB -7.6 kB
npm unpacked 2.0 MB 2.0 MB -27.8 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 25.7 ms 25.7 ms -0.0 ms
CLI --help 45.7 ms 45.5 ms -0.2 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/9722.js -9.9 kB -3.1 kB
dist/src/session.js -2.5 kB -602 B
dist/src/cli-help.js -2.1 kB -477 B
dist/src/2948.js -1.6 kB -476 B
dist/src/1986.js -146 B -17 B

@thymikee thymikee merged commit 6e8e45f into main Jul 1, 2026
21 checks passed
@thymikee thymikee deleted the phase3-b3-more-facets branch July 1, 2026 11:37
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-01 11:37 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 3 b.3: platform-neutral daemon facets (providers/recording/appLog/perf) on PlatformPlugin

1 participant