Repository navigation
refactor(host-kit): add request Scope and use it for the wait capture deadline - #4794
Conversation
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 51f66a2. The verdict and the full list are in the summary comment.
|
No blocking code problems at 51f66a2. Smoke Tests (android, ios, macos), Coverage and the remaining checks are still running, so none has failed yet. The diff changes how every wait and Not blocking, and you can take or leave these: the stable-loop caller Could step 1 be about 60 production lines: |
|
Pushed
|
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
This PR is ready at d806b44. The fix for the earlier review is in: all 18 checks now pass, including Coverage, which failed at 51f66a2 on the settle stall classification, and the iOS, macOS and other Smoke Tests lanes that exercise the wait and settle routes this change touches. The code matches the minimal design. The late-answer window (cutoff passed, timer callback not yet run) cannot be forced in a live device run, so the smoke lanes do not cover that race. Not blocking: On the open inline thread about No conflicts are known, and nothing else needs to happen before merge. |
* origin/main: (70 commits) refactor(apple-runner): one RUNNER_ERROR_CODES row per runner error code with parity/docs gates (callstack#4774) fix(android): require acknowledgements for test IME typing (callstack#4722) feat(scroll): add scroll refresh for pull-to-refresh (callstack#4770) refactor(host-kit): add request Scope and use it for the wait capture deadline (callstack#4794) fix(android): let permission all change nothing on an app that declares no permissions (callstack#4796) fix(cli): replace the CLI session and generated remote config instead of rewriting them in place (callstack#4797) fix(host-kit): accept a group-writable script directory the user owns (callstack#4799) fix(cli): escape control characters at the CLI's stdout and stderr writes (callstack#4778) fix(audit): do not report rows under a persistent bar that scrolling reveals (callstack#4775) fix(daemon): refuse an unsafe state directory before first use (callstack#4783) refactor: settle remaining single-deadline races through settleWithin (callstack#4788) refactor(host-kit): settle deadline races via settleWithin with R87 race ratchet (callstack#4766) fix(android): authenticate and bound persistent snapshot helper sessions (callstack#4729) fix(daemon): bound upload ingress and finalization (callstack#4721) chore(gates): ratchet wire-published reason literals by value (R89) (callstack#4779) feat(audit): evaluate role-less clickable views on Android (callstack#4780) fix(mutation): keep umask-setting tests out of Stryker's thread pool (callstack#4785) feat(audit): report controls that share one accessible name (callstack#4771) fix(contracts): pair open runtime hints with their apply operation (callstack#4754) refactor(daemon): report startup progress over the launch channel instead of marker files (callstack#4777) ...
* origin/main: feat(gesture): hold before the move with gesture pan --hold-ms (#4767) docs: clarify device verification and security proposals (#4805) fix(daemon-client): say that a hung daemon is stopped before ensureDaemon starts a new one (#4803) test: remove five timing races from CI (#4800) refactor(remote): save a remote script from memory with the local publisher (#4802) refactor(apple-runner): one RUNNER_ERROR_CODES row per runner error code with parity/docs gates (#4774) fix(android): require acknowledgements for test IME typing (#4722) feat(scroll): add scroll refresh for pull-to-refresh (#4770) refactor(host-kit): add request Scope and use it for the wait capture deadline (#4794) fix(android): let permission all change nothing on an app that declares no permissions (#4796) fix(cli): replace the CLI session and generated remote config instead of rewriting them in place (#4797) fix(host-kit): accept a group-writable script directory the user owns (#4799)
Summary
Adds a small request
Scopeto host-kit and uses it for thewaitcapture deadline. Part of #4789.openScope(signal, limit, now)returns{ signal, commit, close }. It has one controller and one lazily armed, unref'd timer.commitchecks the inherited abort, then the existingDeadline. The timer andcommitcall one expiry operation.child,deferand seal propagation are not in this step. They land withrequest-cancel.ts, where a real caller tests them.Behavior changes:
wait: a capture that answers after its cutoff is now a timeout. Before,runWithinWaitDeadlineread a flag that only the timer callback set, so a capture that finished after the cutoff, but before that callback ran, counted as readable.--settleandwait stableuse the same function (captureStableSignalWithinDeadline). A capture that the deadline cancelled in flight is stillstalled. A capture that answered after the cutoff is nowexpired: the loop reports that it never settled, and the late capture does not reachpacing.observeor the budget recovery, because it is not evidence for this budget.performance.now()) unless the caller injected a runtime clock, so a wall-clock jump cannot refuse a capture.Parent-cancel precedence, the
TimeoutErrorreason, and waiting for the capture to settle are unchanged.Placement:
Scopeis inpackages/host-kit/src/internal/retry.ts, beside theDeadlineit uses, and is exported through@agent-device/host-kit/retry. A separate module failed the eager-closure gate (ADR 0027) on nine entry surfaces. The placement question forrequest-cancel.tsis on #4789.7 files changed, 288 insertions(+), 24 deletions(-). Production: +114/−24 lines. No wire declaration changed.
Validation
Base
854bba6c5a. Headd806b4472c.wait-deadline.ts(1 failed, 16 passed) and passes at the head.stable-capture.tschange and passes at the head. It drives the stable loop with a fake clock.pnpm check:affected --run: passed with an exact-head receipt.scripts/__tests__/eager-closure-budgets.test.ts: passed.pnpm run check:production-exports: no issues.commitrefuses after the deadline with no timer fired, an inherited abort keeps its reason, the timer aborts the signal at the deadline,closeseals publication and stops the timer.51f66a2onsettle-observation.test.ts. That was this PR: a late settle capture was reported as stalled. The second behavior change above fixes it.