Repository navigation
fix(contracts): pair open runtime hints with their apply operation - #4754
Conversation
The invariant "runtime hints are optional only when no transport hint is requested" existed only as prose on OpenApplicationInput, so three producers threw reason 'runtime-hints-operation-missing' without setting dispatched, forcing a consumer-side reason exclusion in session-open-execution. OpenApplicationInput.runtimeHints is now one optional field pairing the requested values with the fact-admitted apply callback (OpenApplicationRuntimeHints), so a hints request cannot exist without its transport. The daemon producer pairs them in session-runtime; the Apple and Android lifecycle throw sites are deleted because the type makes the unadmitted state unconstructible (facts admission already refuses the open earlier). The clear-hints refusal in session-open-prepare sets dispatched: 'no' (it fires before any native effect), so the relaunch catch keys only on the dispatch disclosure and needs no reason-based exclusion. OpenApplicationInput is in-process only: it is absent from the wire-compat surface and from the agent-device/plugins type-only contract (ADR 0034), so no wire digest or plugin shape moves.
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
|
The pairing change in d585a23 looks right, but the changed hint-apply route has no live run yet. All 18 checks pass at this head, and there are no conflicts. Before merge, we need that live run. The PR changes the native hint-apply step of app open on Android (lifecycle.ts:124) and on Apple (lifecycle.ts:255-269 and Not blocking, and you can take or leave these: (1) |
…ispatch disclosure
Review follow-ups on the runtime-hints pairing:
- openApplicationRuntimeHints now refuses transport hints without the
fact-admitted apply operation as a caller bug (dispatched: 'no', thrown
while building the open input, before any dispatch) instead of silently
dropping the request one layer up.
- The clear-hints refusal in session-open-prepare now discloses
dispatched: 'unknown': prepareApplicationOpen above may already have
booted the device, a device-reaching step, so 'no' would overstate.
- lifecycle-expo-dev-client.test passes the { values, apply } pair
directly per case instead of re-declaring the producer rule inline.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Review follow-ups applied + live device verification (head
|
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.
|
The PR is ready at c7f36a9. The live device output you posted covers the evidence the earlier review asked for, there are no remaining code problems, and the builder refusal test fails against the pre-change code as it should. Not blocking: the doc comment at https://github.com/callstack/agent-device/blob/c7f36a9/packages/daemon/src/sessions/session-runtime.ts#L62 says the builder refuses before any dispatch, but its only caller runs after The Runner Build (tvOS + visionOS + watchOS) job failed during action setup with a missing |
* 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) ...
Summary
Fixes #4408's class of bug at the owning type. The invariant "runtime hints are optional only when no transport hint is requested" was prose-only on
OpenApplicationInput, so three producers threwreason: 'runtime-hints-operation-missing'withoutdispatched, forcing a consumer reason exclusion insession-open-execution.ts.OpenApplicationInput.runtimeHintsis now one optional field,OpenApplicationRuntimeHints, pairing the requestedvalueswith the fact-admittedapplycallback — a hints request cannot exist without its transport. The daemon pairs them viaopenApplicationRuntimeHints(session-runtime.ts); the Apple/Android throw sites are deleted (facts admission already refuses the open earlier, so the unadmitted state is unconstructible). The clear-hints refusal insession-open-prepare.tssetsdispatched: 'no', so the relaunch catch keys only on the dispatch disclosure. 17 files touched.BEFORE: prose + 3 producer throw sites + 1 consumer reason exclusion. AFTER: one typed pairing at the contract. The input is not plugin-exposed (ADR 0034) and not on the wire surface, so no digest or protocol change.
SIZE: +21 net lines; removes 2 throw sites + 1 exclusion clause, adds one typed declaration. PERF: none. COLLOCATION: the invariant moves from prose + 3 producers + 1 consumer into one typed declaration at the owning contract.
Validation
Tested SHA:
d585a237f9a9c9e4306f6944ef82d042669b121a(basee766e8890f). Focused vitest all pass (session-open runtime/relaunch, contracts, apple/android lifecycle, expo, limrun, revyl, wire-compat: 694 tests).pnpm check:quickandpnpm check:layeringpass;pnpm formatbefore commit.pnpm check:affected --run --head d585a237f9...receipt (exactCommit: true): format, lint, typecheck, layering, fallow, build, vitest-related passed;unitfailed; CI lanes skipped as GitHub-authoritative. Base-blocked:unitfails only inrelease-publish,fuzz/harness,macos-helper-package-contents,release-assetstests (5s timeouts under concurrent gate load from other worktrees); the same 4 files fail identically on unchanged basee766e8890f, and depgraph shows no path from the changed files to them. Not looped per testing.md. CI owns coverage/smoke/replay/provider lanes; re-read unit there. Unresolved risks: none for the change itself.