Repository navigation
Commit fae04c3
authored
fix(errors): typed reasons for the session-app and session-or-selector refusals (#3194)
* feat(kernel): publish typed reasons for session-app and session-or-selector refusals
Both refusals answer before anything reaches a device, so a driver must branch on
details.reason plus dispatched:no rather than matching the message. Declares the two
reason values once at the owning kernel type, with the construction helpers and their
normalize/wire coverage.
Refs #3181
* fix(apple,android): attach the session-app reason to per-app setting refusals
Both owners already refused an appless `settings permission` and an appless iOS
`settings location`; each site now states the shared reason instead of leaving prose as
the only signal. Both platforms use one reason because the recovery is the same
whichever setting asked. The Apple and Android error assertions gained reason and
dispatched so the behavior is keyed on details, not on the message.
Refs #3181
* fix(daemon): state the session-or-selector reason on the refused route response
The daemon refuses a device-bound command before it resolves a target, which is exactly
the case where dispatched:no makes a retry safe. The refusal now carries the published
reason through errorResponse, and the request-router test proves the reason survives
finalizeDaemonResponse to the caller on the returned-error path rather than only at its
construction site.
Refs #3181
* fix(test): key the e2e appless-cleanup skip on the reason instead of its message
The mic-permission cleanup skip matched an exact error string, so a reworded refusal
would silently resume retrying a command that can never succeed. It now keys on
details.reason, and the suite asserts a byte-identical message with no reason still
exhausts its retries — the prose alone must never activate the guard.
Documents both published reasons with their recovery in the user docs.
Refs #3181
* style: repository-wide format
* refactor(apple,android): drop the unused assertThrowsAppError and split the details check
The affected audit surfaced both test helpers as dead exports and flagged the cyclomatic
growth from the new reason/dispatched branches. Removing the sync assertion, which no
test imported, and moving the machine-readable checks into their own function keeps each
assertion at the complexity it had before.
Refs #3181
* fix(settings): complete the session-app reason across the whole refusal family
Every per-app settings refusal must be identifiable by reason, not only the ones first
converted: the daemon's clear-app-state pre-check and the Apple, Android, and HarmonyOS
owner throws now answer with session_app_required and dispatched:no as well. The
clear-app-state doc bullet states the refusal.
Docs corrections: session_app_required is raised by the settings handlers after device
routing, so the dispatched vocabulary entry describes only the session-or-selector
refusal as pre-routing; and the permission bullet no longer claims Android on/off
location or macOS system-level permissions need a session app, which they do not.
The e2e skip's success case now pairs the reason with different message wording, so a
guard that also required the legacy string would fail: only the reason triggers the skip.
* docs(settings): name the app-id alternative for recovering from session_app_required
A setting that takes an app id, like clear-app-state, recovers by naming the app on the
request itself; scripts need not open the app just to satisfy that refusal.
* refactor(kernel): scope the refusal-reason map to what it declares
PRE_DISPATCH_REFUSAL_REASONS states the kernel-owned subset whose refusals always
disclose dispatched:no, instead of a name that implies it holds every published reason
(the WebDriver and other producer reasons live beside their own disclosures). The map's
own doc names the versioned docs as the wire vocabulary and the disclosure table as the
producer registry.
The session-or-selector refusal gains its daemon.route row in
contracts/fixtures/dispatch-disclosure.json, driven through the real router with an
unopened session. That command declares no recording effect, so the dispatched:no the row
asserts can only come from the producer rather than the read-only seam.
The e2e cleanup fixture builds its refusal from sessionAppRequiredDetails() instead of
re-typing the details shape, and the permission bullet stops implying a request can name
an app for settings permission while #3179 is open.1 parent 294dc7d commit fae04c3
22 files changed
Lines changed: 380 additions & 39 deletions
File tree
- contracts/fixtures
- packages
- kernel/src
- platform-android/src
- __tests__
- test-utils
- platform-apple/src
- __tests__
- core
- __tests__
- platform-harmonyos/src
- __tests__
- src/daemon
- __tests__
- handlers
- __tests__
- session-lifecycle/__tests__
- test/integration
- ios-simulator-e2e
- website/docs/docs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
14 | 75 | | |
15 | 76 | | |
16 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
254 | 309 | | |
255 | 310 | | |
256 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
314 | 315 | | |
315 | 316 | | |
316 | 317 | | |
317 | | - | |
| 318 | + | |
318 | 319 | | |
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
323 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
324 | 330 | | |
325 | 331 | | |
326 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
66 | 80 | | |
67 | 81 | | |
68 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
5 | 27 | | |
6 | 28 | | |
7 | 29 | | |
| |||
10 | 32 | | |
11 | 33 | | |
12 | 34 | | |
| 35 | + | |
13 | 36 | | |
14 | 37 | | |
15 | 38 | | |
| |||
25 | 48 | | |
26 | 49 | | |
27 | 50 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| |||
162 | 164 | | |
163 | 165 | | |
164 | 166 | | |
165 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
166 | 172 | | |
167 | 173 | | |
168 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
13 | 31 | | |
14 | 32 | | |
15 | 33 | | |
16 | 34 | | |
17 | 35 | | |
18 | 36 | | |
19 | 37 | | |
| 38 | + | |
20 | 39 | | |
21 | 40 | | |
22 | 41 | | |
| |||
37 | 56 | | |
38 | 57 | | |
39 | 58 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
318 | 373 | | |
319 | 374 | | |
320 | 375 | | |
| |||
0 commit comments