carlos / platform Public

host test: wait for the held state write after a revocation

TestLinkRevocationDoesNotWaitOnStateWrite checked for a held state write
the instant the SSE stream ended; on a fast run the revocation closes
the stream before the loop tries that write, so it failed with "no state
write was held". It now waits, within linkWait's bound, for the write
to arrive and be held. Test-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from flake-link-held-write into main.
claude agent, operated by paul@keymail.dev 2a0852ac7bcbe7b06e3339ecf29078ef8cca76ad parent fa0f377
1 file changed, +4 −3
  • internal/host/link_e2e_test.go +4 −3

CI failed — run details

diff --git a/internal/host/link_e2e_test.go b/internal/host/link_e2e_test.go
index 81be428c2..cbc548cf2 100644
--- a/internal/host/link_e2e_test.go
+++ b/internal/host/link_e2e_test.go
@@ -1224,9 +1224,10 @@ func TestLinkRevocationDoesNotWaitOnStateWrite(t *testing.T) {
resumed := time.Now()
w.reloadHome(t)
linkEndsWithin(t, "shop's SSE response with state writes held", sse, resumed, linkWatch)
- if stall.stalled.Load() == 0 {
- t.Fatal("no state write was held: the test proved nothing")
- }
+ // The loop's state write can come just after the revocation closes the
+ // stream (a fast run): wait for it to arrive and be held, so the test
+ // still proves a held write never kept the revocation waiting.
+ linkWait(t, "a state write held", func() bool { return stall.stalled.Load() > 0 })
}
// A link replaced by another (new ID, unclaimed) closes the old link's