Commit 0d303a2
authored
Stop a ref resolving against a dead computer session (#173)
The generation a computer stamps on a snapshot is unique only within one
run of it. A replaced container counts from one again, so a ref the model
is still holding from the run before matches a row nothing has
overwritten, and the element handed to the policy belongs to a page that
no longer exists. The audit row then names that element too, so the trail
agrees with the wrong decision.
`resetComputer` clears the row for exactly this reason and is the only
thing that does. Replacing a computer whose image has changed does not,
and the server is never told, so the row outlives the run that wrote it.
That path is one I added earlier today, which turned a narrow race into
something an upgrade walks every Bot through.
A snapshot now carries the run that took it, read from the same
`/ensure` that already locates the computer for every action. `resolve`
refuses a ref whose run is not the current one, and a save from a
different run replaces the row whatever its generation, because a new run
counting from one is not a stale write to be refused: it is the only
write that can be right.
The supervisor had to start reporting it. `listOwned` carried `startedAt`
and `ensure` did not, so the first version of this stored nothing and did
nothing, and the unit tests passed anyway because their fake provider
supplied a session the real one never sent. `State.StartedAt` rather than
`Created`: a restart is a new run, since the browser has lost every page
it had.
Unknown is not mismatched. A provider that cannot report a run, which is
a deployment with one shared computer and no supervisor, leaves the
generation check exactly as it was.
Closes #162.1 parent 3fee5d1 commit 0d303a2
12 files changed
Lines changed: 2676 additions & 7 deletions
File tree
- server
- drizzle
- meta
- src
- computer
- db/schema
- tests
- supervisor/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
| |||
| 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 | + | |
0 commit comments