fix(memcard): preserve watchdog timeout reasons across completion

This commit is contained in:
2026-10-14 10:26:30 +01:00
parent e0e01ed1de
commit bad942fb25
4 changed files with 314 additions and 25 deletions
@@ -40,12 +40,33 @@ already completed result, which exposed an ownership leak during integration.
Cancellation and entry into publication share an atomic control state. At the
deadline, a canceled attempt that never entered publication can report failure.
Once publication may have started, the result remains indeterminate until
reconciliation. A blocked host requires restart escalation even when publication
Once publication may have started, cancellation alone cannot determine the outcome.
A worker that returns a known success before escalation still reports success;
an uncertain publication requires reconciliation. A blocked host requires restart escalation even when publication
was provably prevented: storage and source ownership still have to remain valid.
The runtime neither kills the thread nor starts a replacement worker over its
resources. The watchdog runs outside that worker.
The watchdog cause is a third observation, independent of durable outcome and
resource lifetime. Keeping it only in the terminal result loses information:
a worker's generic cancellation error can overwrite the reason the cancellation
was requested. Conversely, setting a terminal timeout before the worker returns
can accidentally suppress its eventual success. The request now records the
first watchdog cancellation separately, leaves the result Pending, and preserves
the original worker error for native diagnostics. Completion before escalation
combines the actual durable state with guest reason 15, including Success/15.
Removal or termination cancellation that happened first retains its own reason.
This correction follows accepted decision DEC-0058. Deterministic regression
fixtures hold queued work until after the simulated 500ms poll and deliver it
at 501ms. Channel barriers hold IO before or inside publication, exercising
Failure/15, Success/15, Indeterminate/15 and immutable restart results after 1s.
The tests invoke the actual guest query handler and assert all three ABI slots;
wall-clock receive limits only detect a hung fixture. They also verify deferred
and composite bootstrap saves, dirty snapshots, durable bytes after reopening,
result release and teardown isolation. These checks establish behavior under
controlled scheduling, not real-device latency.
## A checksum does not make an old reference safe
Two valid map pages can reference different generations of payload and public