Repository navigation
Conversation
Size Report
Startup median (7 runs, lower is better):
|
043f351 to
c4a0881
Compare
c4a0881 to
170f954
Compare
170f954 to
855bd0f
Compare
|
Coordinator: rebased onto the current tip of the PR below (stack sync, no content changes). |
|
The daemon-side test fixtures duplicate root platform rules, and five root-module mocks remain in src/daemon, so this is not ready at 855bd0f. All 14 checks pass, and there are no conflicts.
Issue 11a-4 requires that no src/daemon file imports or Could the services members be spies with canned answers, with the lifecycle-ops and services fixtures as thin I did not run the test lanes, so the 96-file, 624-test composition run and the daemon lane results are the author's. I did not execute the five mocks to confirm they are dead. I also could not find the residue scan in the repo, so the count above comes from my own reading of the import specifiers. Before merge, the five mocks need to go and the duplicated rules need one owner. |
|
@thymikee all three findings addressed on top of 1. Duplicated platform rules in daemon fixtures — composition lane owns the rules.
2. Five remaining root-module mocks — executed, they were dead; deleted. 3. Why the scan said 0 — fixed, and the scan is now in-repo. Lanes/gates. Full unit-core: 1591 files, 13447 passed / 1 skipped / 0 failures. Daemon lane 316 files / 2306 tests and composition lane 97 files / 638 tests: 0 failures. Per-file test-name parity vs |
…servation, and platform-services ports in daemon suites Daemon suites no longer import root platform-runtime modules: the host-diagnostics, perf-capture, android-observation, and platform-services/ claim-recovery edges are answered by daemon-local port fixtures whose members are spies or resolve through platform-package leaves (Safari/deep-link rules, iOS app resolution, android package mechanics), while suites that pin what the real composed root modules do keep a root-owned composition fixture at src/__tests__/daemon-composition/. Relocated to the composition lane: the perf-capture session-resource suite, readiness spawn suites, the runner-retention trio, the foreign-dead-owner claim-recovery cases, and three android system-dialog suites converted to port spies where their assertions were daemon policy.
… in daemon suites The daemon lane now binds a canned lifecycle fixture built on the contracts direct-lifecycle binding plus port spies (readiness pause, android discovery, dispatch, hint apply/clear, runner prepare). The real composed fixture moves to the root-owned daemon-composition lane, built on the same seam set so both lanes observe one spy family. Hint-observation suites retarget to the fixture's port spies (assertion bodies unchanged); suites whose assertions pin what the real apple/android runtime modules do under composition relocate: session-relaunch-close and session-open-url-prewarm whole-file, and the close-finalization, shutdown-gating, recording-finalization, post-open observation, runtime-hint lazy-evaluation, and android IME cancellation cases as extracted composition siblings. The gateway and session-command harness take an injectable lifecycle-operations loader so composition suites build the real gateway behind the same handler harness. Scan for daemon -> non-package src/ edges: 0.
…suites The four replay-repair suites mocked clearRuntimeHintValues out of platform-runtime-runtime-hints.ts, and session-open-runtime patched createAppleApplicationTools for a prewarm spy. Nothing under src/daemon imports either module any more (hint apply/clear reach the device through the admitted binding's operations, observed at the fixture port spies), so the mocks answered no call. Deleted; the corrected residue scan now reports 0 edges.
…th canned spies Per review: the composition lane owns the platform rules, so the daemon fixtures stop re-implementing them. Every services/lifecycle member is now a plain vi.fn spy with a canned default a test overrides per case: - platform-services-fixture: appleSessionObservation, deviceBootObservation, ensureLocalDeviceReady, resolveRequestedOpenSurface, validateOpenRelaunchTarget and resolveSessionAppBundleIdForTarget are spies; the open-target/surface/readiness/boot rule copies are deleted, and the shared fixtureResolveSessionAppBundleIdForTarget the lifecycle fixture imported goes with them. - application-lifecycle-runtime-fixture: resolveOpenTarget, prepareApplicationOpen and openApplication are spies delegating to the contract's canonical direct-lifecycle members; the macOS frontmost rule and the android stopped-AVD discovery branch are gone. Tests that pinned real rules move to the composition lane unchanged: 8 cases to session-lifecycle/session-open-existing.test.ts, 5 relaunch guards to handlers/session-relaunch-guards.test.ts, and device-ready whole-file (it pins what the composed readiness port does per family). 11 cases keep their names and assertion bodies daemon-side, retargeted to the port spies (boot observation, open-target identity per case, readiness failure injection). Suites under src/__tests__/daemon-composition now use the lane's own root-composed services fixture. Per-file test-name parity holds (2744 names, moved or kept); scan edges 0.
The review could not find the scan the PR body reported, and the previous ad-hoc copy under-reported edges: its single alternation bridged `import|export … [\s\S]*? from`, so a vi.mock() specifier sitting between an importOriginal type-import and the file's next static from clause was swallowed by the earlier match and never reported. Five mocks of root platform-runtime modules went unnoticed under it. This scan matches every specifier form independently — statement-anchored static import/export, side-effect import, dynamic import()/require(), vi.mock/doMock/unmock/importMock/importActual/importOriginal with string or template-literal arguments, and importOriginal<typeof import()> — and exits 1 on any relative edge leaving src/daemon. Run: node scripts/daemon-edge-residue-scan.mjs. 11b's R11 package-boundary rule (#3546) makes it permanent once the daemon is its own package.
…r the scan entry Only the spies suites actually observe per case are exported; the rest stay module-private behind the fixture factory. The residue scan joins the .fallowrc entry list beside the other hand-run scripts.
…open router suite request-router-open pinned the reboot-stale claim answers by mocking the apple simulator-boot leaf, which the daemon no longer loads; both cases now arm observeBootTimeMsFixture, the port member the claim settlement actually asks.
2b85844 to
4fb9cb3
Compare
|
Coordinator: rebased onto #3517's new head 2354fd0, which now sits on current main. The rebase applied cleanly and none of this PR's commits changed. Verified at this head: |
What
Daemon-extraction slice 11a-4: eliminates every edge where a file under
src/daemon/imports (orvi.mocks) a non-package module outsidesrc/daemon/. Residue scan: 0 edges (node scripts/daemon-edge-residue-scan.mjs, committed in this PR; definition below).Stacked on
refactor/daemon-test-data-fakes(#3517).How
Daemon suites now answer platform questions at the daemon's own ports, and every port member is a plain
vi.fnspy with a canned default answer that carries no platform rule (owner decision on review):src/daemon/__tests__/platform-services-fixture.ts) — all six members (appleSessionObservation,deviceBootObservation,ensureLocalDeviceReady,resolveRequestedOpenSurface,validateOpenRelaunchTarget,resolveSessionAppBundleIdForTarget) are spies; the former near-verbatim copies ofplatform-runtime-open-target.ts,platform-runtime-device-boot.tsandplatform-runtime-device-ready.tsare deleted, and so is the sharedfixtureResolveSessionAppBundleIdForTargetthe lifecycle fixture imported.resolveOpenTarget,prepareApplicationOpenandopenApplicationare spies whose canned answers delegate to the contracts' canonical direct-lifecycle members (identity pass-through, readiness pause, admitted-hint apply). The macOS frontmost-surface rule and the android stopped-AVD discovery branch are gone. The real composed fixture lives root-side (src/__tests__/daemon-composition/application-lifecycle-runtime-fixture.ts) and is built on the same seam set, so both lanes observe one spy family; the gateway and session-command harness take an injectable lifecycle-operations loader.platform-runtime-runtime-hints.tsmocks and thesession-open-runtimeplatform-runtime-apple-application-tools.tsmock were dead (no daemon file loads either module; hint apply/clear reach the device through the admitted binding's operations) and are deleted, not retargeted.Tests that assert what the REAL composed rules answer do not stay in the daemon lane: they move to the composition lane (
src/__tests__/daemon-composition/), where the lane's own fixture hands them the root-composed services and the real composed lifecycle. Assertion bodies are copied verbatim; no assertion was edited to fit a fake. Thedevice-readysuite (it pins what the composed readiness port does per device family) whole-file-moves to the composition lane; 19 composition-lane suites that imported the daemon's services fixture now import the composition lane's own real one.Rule-ownership relocation (this revision, per review)
Sorted with the throwing-fake / canned-success probes against the spy fixture:
session-open-existingopen-target/surface cases ×8 →session-lifecycle/session-open-existing.test.ts;open --relaunchtarget-validation cases ×5 →handlers/session-relaunch-guards.test.ts;device-readyTTL-plus-real-readiness cases ×5 →device/device-ready.test.ts.request-router-open/request-router-open-claim×3 now armobserveBootTimeMsFixture; open-target identity ×2 (session-open-runtime,session-open-execution-runtime) answerresolveOpenTargetFixtureper case; the app-event lifetime case answersresolveSessionAppBundleIdForTargetFixture; the claim-rollback case injects its failure atprepareApplicationOpenFixture.Per-file test-name parity vs the previous head holds: 2671 names, identical multiset; 18 relocated with their names, 0 renamed, 0 added, 0 dropped.
Residue scan (definition, as requested)
scripts/daemon-edge-residue-scan.mjswalks every.ts/.tsx/.mjsundersrc/daemon/and matches each specifier form independently (the earlier ad-hoc scan used one alternation bridgingimport|export … [\s\S]*? from, which swallowed avi.mock()specifier sitting between an earlierimportOriginal<typeof import(...)>and the file's next staticfrom— that is how five mocks hid under its "0"):import/export … fromwith the keyword anchored at a statement start (line start or;), so no match ever spans statements (coversimport type, multi-line specifier clauses);import '…';import('…')andrequire('…')with string or no-substitution template-literal arguments (this also catchesimportOriginal<typeof import('…')>);vi.mock/vi.doMock/vi.unmock/vi.importMock/vi.importActual/vi.importOriginalfirst argument, any position in the file, string or template literal.A relative specifier that normalizes outside
src/daemon/is an edge; bare specifiers (workspace packages, externals) are allowed. Exit 1 on any edge. Verified: 5 edges on855bd0f, 0 on this head. Once the daemon is its own package, 11b's R11 package-boundary rule (#3546) enforces this permanently incheck:layering; until then this committed scan is the measurement.Gates
vitest run --project unit-core, full): 1591 files / 13447 passed, 1 skipped, 0 failures; within it daemon lane 316 files / 2306 tests, composition lane 97 files / 638 tests, both 0 failurescheck:quick,check:layering,check:di-seams,check:gate-manifest,check:fallow,check:affected --run, eager-closure-budgets + test-file-size ratchets,pnpm format: OKPure moves / renames dominate the diff; hand-written additions are the port fixtures, the install seam, the composition siblings, and the committed scan.