From 7fae5f8dee5ae28f39107f7b5e2ac57d303e6914 Mon Sep 17 00:00:00 2001 From: Bretton Date: Sat, 8 Aug 2026 01:22:22 -0700 Subject: [PATCH] test(e2e): fix an unsatisfiable getStatus wait, and gofmt the queue tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit awaitStatus could never report done. PendingIfNotFound returns (done, err) — its nil case means "the read succeeded, that IS the answer" — and the guard read that first value as "pending", so every successful read returned false and the status comparison below was dead code. Each wait polled until the 45s budget expired, spending the contract's 100/min bucket on the way. Replaced with the direct form: a not-found is "no decision yet", any other error is terminal, and a successful read is where the comparison starts. The comment records why PendingIfNotFound is the wrong helper here rather than leaving the next reader to rediscover it. Also gofmt on queue_test.go, which make fmt-check rejected. Verified: gofmt -l over tests/e2e/ and internal/core/posts/ is empty, go vet -tags e2e passes, and contract-manifest still resolves all three markers at their new line numbers. NOTE: make fmt-check still fails on tests/lexicon_fixtures_test.go, which is pre-existing (committed unformatted in 10349f6, task 4) and outside the scope authorized here. Co-Authored-By: Claude Fable 5 --- internal/core/posts/queue_test.go | 6 +++--- tests/e2e/author_post_contract_test.go | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/internal/core/posts/queue_test.go b/internal/core/posts/queue_test.go index 0315873..f32f4c5 100644 --- a/internal/core/posts/queue_test.go +++ b/internal/core/posts/queue_test.go @@ -115,9 +115,9 @@ func (e *fakeEngine) communityOrder() []string { // queueClock is a mutable instant the driver reads through Clock. type queueClock struct{ at time.Time } -func (c *queueClock) now() Clock { return func() time.Time { return c.at } } -func (c *queueClock) advance(d time.Duration) { c.at = c.at.Add(d) } -func newQueueClock() *queueClock { return &queueClock{at: time.Date(2026, 8, 8, 9, 0, 0, 0, time.UTC)} } +func (c *queueClock) now() Clock { return func() time.Time { return c.at } } +func (c *queueClock) advance(d time.Duration) { c.at = c.at.Add(d) } +func newQueueClock() *queueClock { return &queueClock{at: time.Date(2026, 8, 8, 9, 0, 0, 0, time.UTC)} } func subject(community, rkey string) PendingSubject { return PendingSubject{ CommunityDID: community, diff --git a/tests/e2e/author_post_contract_test.go b/tests/e2e/author_post_contract_test.go index 645a935..a634e81 100644 --- a/tests/e2e/author_post_contract_test.go +++ b/tests/e2e/author_post_contract_test.go @@ -148,8 +148,15 @@ func awaitStatus(t *testing.T, p *pipeline, postURI, communityDID, want, descrip var observed postStatusView p.Await(t, description, func() (bool, error) { view, err := p.PostStatus(context.Background(), postURI, communityDID) - if pending, wrapped := testkit.PendingIfNotFound(err); wrapped != nil || pending { - return false, wrapped + // NOT testkit.PendingIfNotFound: it is for probes where a successful read + // IS the answer, so its nil case reports DONE — which here would end the + // wait before the status was compared. This wait needs the opposite: a + // successful read is where the question starts. + if err != nil { + if testkit.IsNotFound(err) { + return false, nil + } + return false, err } observed = view return view.Status == want, nil -- 2.51.2