fix: un dépôt est délivré une fois et retiré, comme en amont

This commit is contained in:
Sylvain Duchesne
2026-08-26 14:11:56 +02:00
parent abfb619c76
commit f6a48a4507
24 changed files with 1486 additions and 176 deletions
@@ -325,7 +325,8 @@ describe("switching identity", () => {
fake._deliver(inTransit);
await converge();
// An inbox is not consumed by being ignored: connecting again drains what was left.
// An inbox is not consumed by being IGNORED — only by being applied. Alice never
// drained this one, so connecting again finds the deposit still queued.
await signIn("alice");
await converge();
@@ -348,15 +349,17 @@ describe("a deposit that cannot be applied", () => {
await converge();
});
expect(reported.filter((l) => /could not apply what is in this inbox/.test(l)).length)
expect(reported.filter((l) => /could not finish draining this inbox/.test(l)).length)
.toBeGreaterThan(0);
// Prefixed by the connected identity, like every other polyfill-layer line.
expect(reported.find((l) => /could not apply what is in this inbox/.test(l)))
expect(reported.find((l) => /could not finish draining this inbox/.test(l)))
.toContain("[alice][polyfill]");
expect(getCaps().capForHolder("alice", first.doc)).toBeUndefined();
// The broker recovers. The observation is still running — one unapplicable item denies
// nothing — and the deposit that failed was never consumed, so both land now.
// nothing — and this deposit was never consumed, which since 2026-08-26 is a claim worth
// being precise about: what failed here is the READ, before anything could be taken out
// of the queue. A deposit that had been popped and whose ARM then failed would be gone.
fake._failReadsOn.delete(aliceInbox);
fake._deliver(second.inTransit);
await converge();