refactor(daemon): route perf metrics sampling body through PlatformPlugin facet#1191
Conversation
…ugin facet Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
Review — 🟢 SHIPA clean, minimal refactor. Moves per-platform
The Apple sampler is 2-arity and silently ignores the newly-passed 🤖 Generated with Claude Code |
|
Review finding (P2): the new sampler routing is not exercised by the claimed end-to-end test. |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Re: the P2 finding on the routing test — good catch. The parity suite only proved registry parity and never reached the shipped dispatch (
Verified it fails when the facet lookup is bypassed: flipping the Android plugin to |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Re-review finding (P2): the new test reaches sampling, but still does not prove facet routing. The injected-ADB assertions exercise the Android sampler, yet the removed |
…atform Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Re the re-review P2 (facet routing not yet proven) — fixed in 33ecb9c. Added a test that varies the facet independently of the device platform: it overrides the Apple plugin's Mutation check — reverting So restoring the production lookup now fails the suite, closing the gap on issue #1188. |
|
Final re-review at |
|
Summary
Closes the last daemon-owned platform branch in perf handling (issue #1188).
buildPerfResponseDatastill dispatched the metrics-sampling body by hand:The perf facet already carried the support gate (
supportsMetrics); this extends it with a neutral sampler discriminant and routes the sampling body through it, mirroring theRecordingBackendTagpattern byte-for-byte:PerfMetricsSamplerTag = 'apple' | 'android'and an exhaustivePERF_METRICS_SAMPLERS_BY_TAGmap (daemon keeps ownership of sampler composition).PlatformPlugin.perfgainsmetricsSamplerTag(device)(type-only import of the tag, exactly like recording). Apple plugin returns'apple', Android returns'android'; web/linux carry no perf facet (unchanged).buildPerfResponseDatanow doesresolvePerfMetricsSampler(device)→ tag lookup → sampler, after the support + app-bundle gates. The twoapply*PerfMetricswrappers are gone;applySampledPerfMetricsis shared.Public behavior is byte-identical — no new metrics, no daemon-owned types leaked into platforms. The tag is consulted only after
supportsPlatformPerfMetricsadmits the platform, so the facet is always present; theundefinedfallthrough preserves the former base response.Parity is pinned in
perf-plugin-routing-parity.test.tsagainst an independent verbatim copy of the former branch (device.platform === 'android' ? 'android' : 'apple') across the exhaustive device matrix, plus assertions that the factless families expose nometricsSamplerTag.Removes the now-resolved
b.3 perf sampling bodydeferred note fromCONTEXT.md.Verification
format:check, typecheck, lint, layering, and Fallow (
--base origin/main) all clean.test:unit(3532 tests), the perf parity test, apple/android perf suites,request-router-android-perf, provider-integration (apple-leak guard),test:smoke, andpnpm buildall pass on the CI Node 24.13 toolchain.Link to Devin session: https://app.devin.ai/sessions/4f6c547c71ac41a899c0ece81403bd6f
Requested by: @thymikee