Repository navigation
Commit 4ae5441
authored
feat(snapshot): carry a presented-surface fact through capture and settle (#3577)
* feat(ios): carry the presented-surface fact from capture producers to consumers
A settle confirmation that has to prove a dismissal (#1831) has nothing to compare
against: the capture contract says nothing about whether a modal presentation was over
the app, so a consumer can only infer it from tree shape — and a tree shape that happens
to hold before a tap is exactly what makes the confirmation arm on a no-op. iOS is where
it matters most, because there an overlay is usually the same app process, so it moves
neither the surface identity nor the foreground-owner fact.
Publish the producer's own reading instead, on the state that is already built from the
capture's unfiltered nodes:
- `SnapshotState.presentedSurface` takes 'presented' | 'absent' | 'unknown', and
`readPresentedSurfaceFact` is the one wire reader. A producer that inspected its whole
subject and saw nothing presenting says 'absent'; one whose evidence cannot answer says
'unknown'; only a producer that never classified stays silent. Anything the vocabulary
cannot name reads as 'unknown', so an unrecognised value can never become a false
absence.
- The fact rides the response envelope on every iOS capture route, including a digest, and
travels with the nodes wherever a capture crosses a layer: the backend capture and
interactor snapshot results, the daemon capture cache, the interactive-retry and
deferred-re-observation nodes, the ref-target frame, and the settle baseline. A consumer
that adopts an interaction's own capture therefore keeps the fact that capture
established rather than re-deriving a weaker one.
- Both settle routes mint that baseline from one function, which moves to capture-kit
beside the assembly that builds the state it reads: the interaction route lives in
`commands/` and the generic route in `daemon/`, and the layering forbids the second from
importing the first. So the next fact a baseline owes cannot be carried by one route and
dropped by the other.
- The runner forwards the reading of the tier that answered. Its accessibility tree carries
no window classes, so it states 'presented' from a resolved blocking system modal and
never 'absent'; the shared classifier comes next.
Consumers are untouched: nothing decides on the fact yet.
* fix(kernel): keep the presented-surface read off the shared wire reader's closure
Review of #3577 found four problems with how the fact crosses the wire.
`readPresentedSurfaceFact` validated against `PRESENTED_SURFACE_STATES`, which made every eager
consumer of `kernel/record` evaluate `kernel/snapshot.ts` as well. ADR 0019's loading-shape probe
measures exactly that: thirteen carried entries grew by one module and 70 eager statements, which
`scripts/__tests__/eager-closure-budgets.test.ts` refuses — the growth is a pre-existing module made
eager, so no split explains it and shrinkage elsewhere cannot fund it. The reader now decides from a
table it owns, keyed by `PresentedSurface`, so a vocabulary state without a row fails to compile
rather than reading as `unknown`. The lookup is own-property, which also closes the inherited-member
path an `in` test would have opened: a payload naming `constructor` is not a state.
`PRESENTED_SURFACE_STATES` is frozen. `as const` was only a type-level promise on an array the reader
trusted payloads against, so any consumer could move the boundary between a state and `unknown` for
the whole process.
The client normalized the fact on the default response path and returned a digest payload verbatim,
which meant the same field was read two ways depending on `--response-level`. Passing a leveled
payload through without reshaping it is not a licence to skip the fact's own vocabulary, so the
digest path reads it through the same reader; a payload with no key stays byte-identical.
Two doc comments claimed a capture "came from read" something. Both now name the producer that did
the reading.
* refactor(interaction): hand find's leaf the baseline surfaceScopedNodes minted
PreresolvedInteractionTarget carries one SurfaceScopedNodes minted from
find's own capture instead of mirroring nodes, surface and presentation
field by field, so the adopting leaf's settle baseline is that value
as-is. PresentedSurface becomes a plain union, and the fact travels
only inside SnapshotState: the top-level BackendSnapshotResult field had
no production writer. Moves the moving-target gate onto the capture-kit
baseline mint.
* fix(daemon): carry the presented-surface fact on the rest-proof baseline
The moving-target rest tree copied the baseline shape by hand and left
out presentedSurface, so the baseline after a rest proof differed from
every other one. It now carries the same facts surfaceScopedNodes mints;
it stays local because the snapshot-baseline import would grow the eager
closure of most daemon entries.1 parent ff3947c commit 4ae5441
45 files changed
Lines changed: 715 additions & 69 deletions
File tree
- apple
- runner/AgentDeviceRunner/AgentDeviceRunnerUITests
- UnitTests
- snapshot-presentation/Sources/AgentDeviceSnapshotPresentation
- packages
- capture-kit
- src
- contracts/src
- daemon/src
- core
- __tests__
- execution
- interaction/internal
- __tests__
- server
- __tests__
- kernel/src
- platform-apple/src
- runner
- __tests__
- scripts/layering
- src
- __tests__
- daemon-composition/interaction
- commands
- capture/runtime
- interaction/runtime
- output
- core/__tests__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
441 | 446 | | |
442 | 447 | | |
443 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
73 | 83 | | |
74 | 84 | | |
75 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| |||
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
2 | 7 | | |
3 | 8 | | |
4 | 9 | | |
| |||
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
122 | | - | |
123 | | - | |
124 | 127 | | |
125 | | - | |
126 | | - | |
127 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | | - | |
| 132 | + | |
130 | 133 | | |
131 | | - | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
| |||
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
151 | 161 | | |
152 | 162 | | |
153 | 163 | | |
| |||
0 commit comments