test(daemon): session-open-url-prewarm through the request seam - #2304
Merged
Conversation
Rewrites session-open-url-prewarm.test.ts (16 open/prepare scenarios covering URL bundle-id inference and iOS runner prewarm timing) to drive through the production request router (createRequestHandler + lifecycleDeviceRuntimeGateway, the seam request-router-open.test.ts and the #2262 session-relaunch-close rewrite already use) instead of calling the daemon's session handler directly through the bypassed session-test-harness.ts. Every scenario title and observable assertion (response payload, session-store state, dispatch context, prewarm call order, prepare timing/response data) is unchanged; only the entry point and mock surface moved. The file no longer imports session-test-harness.ts or session-command-harness.ts (both still back their other consumers, untouched). It keeps only the module mocks these open/prepare scenarios actually reach: platform-apple runner operations, app-resolution, macos, device-ready, and the Android open-target shim. logPath assertions now match the real session-scoped runner.log path the router computes (rather than the harness's single hardcoded daemon.log stand-in), and the blocked-prewarm error assertion reads the top-level normalized error.hint field instead of a details.hint that this seam never carried.
Size Report
npm unpacked components
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. Top changed packed filesNo changed packed files. |
… ios-runner tests PR #2304 review found the router-seam rewrite silently dropped two assertions the original suite had: that `prepare ios-runner` inspects facts and binds exactly once on an explicit iOS selector, and that it inspects facts once but never binds before rejecting a non-Apple device. The shared `lifecycleDeviceRuntimeGateway` fixture is frozen and reused across many suites, so it can't be spied on in place. Add `createLifecycleDeviceRuntimeGatewaySpies()` to test-device-runtime-gateway.ts: a fresh, unfrozen gateway whose inspectFacts/bind are vi.fn() spies backed by the same binding logic, scoped per test so no call counts leak across files. Use it in the two affected tests to reassert the original call-count expectations. Planted red: flipped each restored assertion's expected count/call and confirmed the test failed, then reverted. Command: npx vitest run --project unit-core -t "prepare ios-runner starts the XCTest runner on an explicit iOS selector" src/daemon/session-lifecycle/internal/__tests__/session-open-url-prewarm.test.ts Message: AssertionError: expected "vi.fn()" to be called 2 times, but got 1 times Command: npx vitest run --project unit-core -t "prepare ios-runner rejects non-Apple runner devices" src/daemon/session-lifecycle/internal/__tests__/session-open-url-prewarm.test.ts Message: AssertionError: expected "vi.fn()" to be called at least once
Member
Author
|
Sentinel review at c44cadf. No actionable findings. The existing request router/gateway now exercises URL inference, prewarm ordering/errors and prepare admission; restored gateway spies preserve inspect-once/no-bind coverage. Assertions correctly use routed runner.log and wire error.hint. Tests-only; CI completion remains separate from code readiness. |
|
thymikee
added a commit
that referenced
this pull request
Sep 5, 2026
* origin/main: perf: bundle runtime dependencies and report full install size (#2310) ci: avoid unrelated Apple runner cache invalidation (#2303) fix(web): preserve the backend ref so snapshot refs match actionable refs (#2283) test(daemon): session-open-url-prewarm through the request seam (#2304) test(daemon): session-devices-batch-runtime through the request seam (#2305) chore(gates): layering baselines ratchet against merge-base (#2299) test(daemon): one typed conformance helper for the daemon runtime suites (#2298) chore(layering): derive the contracts export inventory from package.json (#2297) perf: bundle tar-stream to reduce install footprint (#2286) docs: simplify agent context and resolve conflicting guidance (#2287) refactor(cli): let help resolve command aliases itself and retire R12 (#2293)
thymikee
added a commit
that referenced
this pull request
Sep 5, 2026
* origin/main: perf: bundle runtime dependencies and report full install size (#2310) ci: avoid unrelated Apple runner cache invalidation (#2303) fix(web): preserve the backend ref so snapshot refs match actionable refs (#2283) test(daemon): session-open-url-prewarm through the request seam (#2304) test(daemon): session-devices-batch-runtime through the request seam (#2305) chore(gates): layering baselines ratchet against merge-base (#2299) test(daemon): one typed conformance helper for the daemon runtime suites (#2298) chore(layering): derive the contracts export inventory from package.json (#2297) perf: bundle tar-stream to reduce install footprint (#2286) docs: simplify agent context and resolve conflicting guidance (#2287) refactor(cli): let help resolve command aliases itself and retire R12 (#2293) refactor(commands): retire the navigation-only type projection (#2294) feat(runtime): route managed leases through contained transports (#2285) refactor(contracts): build unavailable runtime facts once (#2291) refactor(cli): derive the common flag readers from the common-field table (#2292) feat(daemon): add managed allocation operation journal (#2284)
thymikee
added a commit
that referenced
this pull request
Sep 5, 2026
* origin/main: perf: bundle runtime dependencies and report full install size (#2310) ci: avoid unrelated Apple runner cache invalidation (#2303) fix(web): preserve the backend ref so snapshot refs match actionable refs (#2283) test(daemon): session-open-url-prewarm through the request seam (#2304) test(daemon): session-devices-batch-runtime through the request seam (#2305) chore(gates): layering baselines ratchet against merge-base (#2299) test(daemon): one typed conformance helper for the daemon runtime suites (#2298) chore(layering): derive the contracts export inventory from package.json (#2297) perf: bundle tar-stream to reduce install footprint (#2286)
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.
Summary
Rewrites
src/daemon/session-lifecycle/internal/__tests__/session-open-url-prewarm.test.ts(16 scenarios covering URL/app-bundle-id inference and iOS runner prewarm
timing on
open/prepare) to drive through the production request router(
createRequestHandler+lifecycleDeviceRuntimeGateway, the seamrequest-router-open.test.tsandsession-relaunch-closealready use)instead of the bypassed
session-test-harness.ts/session-command-harness.ts.The rewrite initially dropped two assertions from the two
prepare ios-runnertests (
inspectFacts/bindcall counts, verifying fact-inspection runs onceand binding is correctly skipped before the android-device rejection). Fixed:
test-device-runtime-gateway.tsgainedcreateLifecycleDeviceRuntimeGatewaySpies(),a fresh unfrozen gateway with
vi.fn()-wrappedinspectFacts/bind(theshared frozen fixture can't be spied on in place without leaking call counts
into other suites); the two tests now use it and reassert the original counts.
Two assertions also changed to match what the real seam produces:
logPathnow matches the router's session-scoped
runner.logpath, and theblocked-prewarm error reads the top-level
error.hintfield this seam uses.Validation
npx vitest run --project unit-core src/daemon/session-lifecycle/internal/__tests__/session-open-url-prewarm.test.ts— 16/16 pass.request-router-open.test.ts,request-router-lock-policy.test.ts,request-router-replay-scope.test.ts,request-router-response-level.test.ts,request-router-session-address.test.ts,request-router-typed-error.test.ts,session-relaunch-close.test.ts) — all pass.tsc -p tsconfig.json --noEmit— clean.inspectFacts/bindexpected counts in bothprepare ios-runnertests — each failed with the expectedAssertionError— reverted, verified green.