Repository navigation
[AI-3613] Test a failing call-events and floor-checks read - #2237
Conversation
A voice call's decisions and floor checks come from the shared Redis. No test made either read fail, so a change that swallowed the read error or dropped the floor-check ERROR line passed every suite. The test swaps the suite store's CallEvents for one built on a closed Redis client and asserts what each read answers: the timeline still answers 200 without checks and logs the ERROR line, the decisions answer 500. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kanat
left a comment
There was a problem hiding this comment.
Verdict: GO. No Blocker, no Should fix; one Nit (below).
Checked at 0299984 merged onto current main (108539d):
TestCallsSuitepasses with-race;gofmtandgo vet -tags integrationare clean.- The swap is per test and restored by
t.Cleanup, so a failing test still restores it. Without the restore (probe) the next tests of the suite fail; without the swap both new tests fail. Tests in one suite run in turn;runSuiteonly parallelises whole suites, and each has its own store. - The closed store makes the Redis read itself fail: the access line carries
error="store: call events: rueidis client is closing or unable to connect redis"fromCallEvents.Select. - The author's 7 mutations on
calls.gowere re-run: 7 killed. - CI on the head: draft,
goandintegrationskipped (#2130); CI runs atgh pr ready.
| s.Require().NotEmpty(requestID) | ||
| served := func() string { return lineWith(s.logged, `msg="served a request"`, " request_id="+requestID) } | ||
| s.Require().Eventually(func() bool { return served() != "" }, 5*time.Second, 20*time.Millisecond, s.logged.String()) | ||
| s.Contains(served(), "level=ERROR") |
There was a problem hiding this comment.
[Nit] R1.1 The test asserts a 500 and an ERROR access line, which any other failure of the handler would also give. The access line carries the cause (error="store: call events: rueidis client is closing ..."), so s.Contains(served(), "store: call events") would tie the 500 to the Redis read, as the floor-check test does with store: floor checks. Not blocking: no mutation of the handler survives; ticket or take it in passing.
There was a problem hiding this comment.
Fixed in 869929e: the test now also asserts the access line names the failed read (store: call events). Checked by swapping the handler to fail with another store error: the new assertion fails, then the code was restored and TestCallsSuite passes.
The test's 500 and ERROR access line also hold for any other handler failure. Assert the access line names the failed read, as the floor-check test does. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Why
A voice call's decisions and floor checks are read from the shared Redis. No test made either read fail, so the round-1 review of #2204 found two surviving mutants: one that swallows the read error and one that drops the floor-check ERROR line. Tests only, no change to the handler.
How it works
callEventsOnClosedRedisopens a second store on the suite's database and Redis, closes it, and puts itsCallEventsin place of the suite store's for one test (put back at the test's end). A read through it fails as an unreachable Redis does. No DDL, no shared Redis touched./timeline)floor_checksmsg="could not read the floor checks for a timeline"at ERROR, withcallanderror/events)served a requestaccess line is ERRORChanges
acceleration/internal/api/calls_test.go: two tests inCallsSuiteand the helper (+55 lines).Validation
go test -tags integration ./internal/api/ -run TestCallsSuite: pass.calls.go, each killed: swallow the events error, answer it as 404, fail the timeline on a floor-check error, swallow the floor-check error without a log, drop the log, log it at WARN, drop theerrorattribute.Production caller: none (test-only).
🤖 Generated with Claude Code