Commit 997c10d
test(ocap-kernel): pin the release failure lost at the remote savepoint
Failing repro, not a fix.
## The issue
#1012 hardens `releaseSavepoint` so that a failed `RELEASE` discards the
enclosing transaction, clearing the driver's `_spStack` on the way. Two callers
it does not touch depend on the old behaviour, and both are now worse off than
before the change.
`RemoteHandle.handleRemoteMessage` releases inside the `try` and rolls back in
the `catch`:
this.#kernelStore.setRemoteHighestReceivedSeq(this.remoteId, seq);
this.#kernelStore.releaseSavepoint(savepointName); // fails
} catch (error) {
this.#kernelStore.rollbackSavepoint(savepointName); // "No such savepoint"
throw error; // never reached
}
Since the release already cleared the stack, the rollback throws
`No such savepoint: receive_r0_1`, which escapes the `catch` and replaces the
real failure. Not demoted to `cause` — replaced. `RemoteManager` has the same
shape at its `peerIncarnation_*` savepoint.
A/B verified against origin/main with a real driver: main's rollback succeeds
and `database or disk is full` propagates; on this branch the caller gets the
missing-savepoint error instead. So the PR description's "the release failure
still propagates" holds for the crank path it fixed and not for these two.
`crank.ts:57-63` shows the author recognised exactly this hazard — a stale
savepoint list producing `No such savepoint` over the real error — and fixed it
for the crank only. The remote paths were missed because nothing exercised them.
Note the secondary effect these tests don't reach: `ctx.savepoints` still lists
the crank's own savepoints after this, so the next `endCrank` throws
`No such savepoint: t0` over whatever is left of the failure.
## What we hope to see instead
The failure the database reported is what reaches the caller. Any of these does
it, and the assertion doesn't care which:
- move the release out of the `try`, so a release failure isn't followed by a
rollback attempt at all
- have the `catch` tolerate a rollback that reports a savepoint already
discarded, rethrowing the original either way
- make the driver's discard leave the name rollback-able as a no-op
The mock models the drivers' bookkeeping rather than the expected outcome, so it
is `RemoteHandle`'s error handling under test, not the mock's.
## Current failure
AssertionError: expected Error: No such savepoint: receive_r0_1
to be Error: database or disk is full
packages/ocap-kernel/src/remotes/kernel/RemoteHandle.test.ts
> reports the release failure rather than a missing savepoint
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent ad07e8a commit 997c10d
1 file changed
Lines changed: 43 additions & 0 deletions
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
223 | 266 | | |
224 | 267 | | |
225 | 268 | | |
| |||
0 commit comments