refactor: close the daemon platform boundary - #2072
Conversation
31192d8 to
3148b3d
Compare
Size Report
npm unpacked components
Startup median (7 runs, lower is better):
Top changed chunks:
Top changed packed files
|
3148b3d to
a4d28bd
Compare
a4d28bd to
d1c7971
Compare
|
P1: R65 proves zero direct import edges, but #1739’s terminal condition is broader: every surviving daemon platform branch/tag must be enumerated and identifier-only, never selecting behavior. This head still selects Android snapshot-helper cleanup and Web browser cleanup in |
|
Re-reviewed head d1c7971. The only material delta is the rebase/eager-closure budget update; the P1 semantic platform-selection finding remains unresolved (src/daemon/session-teardown.ts still selects Android/Web cleanup and src/daemon/handlers/snapshot-session.ts selects Apple cleanup). R65 is unchanged. This is not ready. |
d1c7971 to
374879e
Compare
|
Addressed in a41a147. Android snapshot-helper, Web browser, Apple sessionless cleanup, and runner-retention selection now live behind the root-composed PlatformResourceCleanup contract; daemon teardown only orchestrates neutral operations. R65 guards cleanup orchestrators semantically and covers platform predicates, tags, destructuring, static/type/dynamic/re-export/require/createRequire/triple-slash imports. The planted daemon cleanup violation was observed red and the rebased layering gate passes. |
6d0e239 to
96ca4d5
Compare
96ca4d5 to
a41a147
Compare
|
Addressed in a1873f6. Android snapshot-helper, Web browser, Apple sessionless cleanup, and runner-retention selection now live behind the root-composed PlatformResourceCleanup contract; daemon teardown only orchestrates neutral operations. R65 guards cleanup orchestrators semantically and covers platform predicates, tags, destructuring, static/type/dynamic/re-export/require/createRequire/triple-slash imports. The planted daemon cleanup violation was observed red and the rebased layering gate passes. |
a41a147 to
a1873f6
Compare
|
[P2] Preserve synchronous cleanup methods in the unavailable fallback unavailablePlatformResourceCleanup wraps every property in an async Proxy function, but retainExecutionHostAfterClose is deliberately synchronous and session-close-lifecycle-teardown branches on its boolean result without awaiting it. When platform-resource cleanup is unavailable, that call therefore returns a truthy Promise (and rejects asynchronously) instead of false, so the daemon can incorrectly retain the execution host and emit an unhandled rejection. Please replace the async-only Proxy with an explicit typed unavailable implementation (or otherwise preserve each method's sync/async contract) and add a missing-injection regression that exercises the synchronous retention decision. |
|
Re-reviewed the rewritten head: the previously reported synchronous unavailable-cleanup P2 remains unresolved. The only delta is an unrelated daemon-runtime lifecycle-shutdown test mock; unavailablePlatformResourceCleanup still returns an async Proxy function for the synchronous retainExecutionHostAfterClose method. The requested typed fallback and missing-injection synchronous-retention regression are still required. Exact-head CI is queued/in progress. |
a1873f6 to
d5eb2f0
Compare
|
Addressed in d5eb2f0. The missing PlatformResourceCleanup fallback is now an exact typed object: its three async methods reject, while retainExecutionHostAfterClose throws synchronously. I added a production-router regression that omits the injection and proves close returns INTERNAL_ERROR before teardown or dispatch. I also fixed both prior coverage-shard failures: orientation now injects the existing Android observation fixture instead of reaching real ADB through a retired mock path, and the lock-serialization poll has a CI-safe timeout. Local validation: full pnpm test:coverage:ci passed (1,169 files, 8,718 tests, 90.57% lines), focused coverage tests passed, and format, lint, typecheck, and layering passed. |
d5eb2f0 to
ae3cb6c
Compare
|
Follow-up coverage fix is now on |
ae3cb6c to
57b29e4
Compare
|
Final coverage follow-up is on |
|
The synchronous PlatformResourceCleanup fallback P2 is resolved on this head: the typed unavailable object preserves the sync/async method contracts, and the production-handler close regression would fail against the former async Proxy. However, this exact head is not ready because Coverage (1) fails in the changed request-router-screenshot serialization regression: scrollResponse.ok is false at line 281. The log does not expose the returned error, so this needs an exact-head reproduction or added assertion diagnostics followed by a green coverage run before readiness. |
57b29e4 to
b1ba32d
Compare
|
Fixed the remaining screenshot serialization failure. Exact #2072-head validation:
The full affected run passed every product assertion but encountered 10 late Vitest module-runner teardown errors under host contention after 3,760 passing assertions; the exact implicated suite passed immediately in isolation. |
|
Re-reviewed the replacement head. The prior Coverage failure is addressed without weakening the serialization invariant: the lock test and its ordering assertions are unchanged, while router tests that do not exercise Android state now receive an explicitly benign observation fixture instead of accidentally reaching real ADB state. Platform-state tests still inject their behavior-specific fixtures, and production still composes the real adapter. I found no new code issue. Exact-head coverage and several CI/native lanes are still running. |
|
Summary
Finish #1739's terminal daemon boundary: readiness and lifecycle mechanics, Android/Web durable cleanup, Apple runner resources, selector probing, and recording health now resolve through focused root owners. Production
src/daemonhas zero imports ofsrc/platformsor concrete platform packages and has been removed from the R3 seam.Add R65, a tracked-production AST gate that rejects static, dynamic, type-only, TS import types, re-exports, CommonJS/TS require forms, template literals, and statically constructed platform specifiers. The planted-red suite also proves comments, ordinary strings, tests, and non-daemon files do not create false positives.
Closes #1739.
Validation
The terminal scan moved from 38 edges across 15 files to zero. Descriptor checks remain at zero
legacyexecution modes and zero production capability buckets. The full 196-test layering suite passes withsrc/daemonremoved from R3.Focused readiness, teardown, request-lock, recording-health, selector, session refresh, and sessionless cleanup tests pass (107 assertions across the final slice). Two Luna-max adversarial reviews found no lifecycle P0-P2 issues and drove closure of four syntactic gate bypass classes.
The complete affected run passed format, lint, typecheck, layering, fallow, build/package, Node integration, and provider integration. It reached 458/459 related files and 3,429/3,430 tests; the only failure was an unrelated Apple-runner concurrency test exceeding its 5-second timeout under full load, then passing alone in 149 ms. Native and coverage lanes remain GitHub-authoritative.
The complete stack touches 57 files and is +288 net production lines; most additions are typed owner seams and the terminal AST gate. No docs or skills changed because command behavior is unchanged. HarmonyOS perf remains unsupported and receives no new implementation.