Skip to content

[AI-3613] Test a failing call-events and floor-checks read - #2237

Merged
kanat merged 2 commits into
mainfrom
kanat/ai-3613-timeline-read-error-test
Nov 23, 2026
Merged

kanat merged 2 commits into
mainfrom
kanat/ai-3613-timeline-read-error-test

Conversation

@kanat

@kanat kanat commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

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

callEventsOnClosedRedis opens a second store on the suite's database and Redis, closes it, and puts its CallEvents in 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.

Read What the GET answers when it fails Where it is logged
floor checks (/timeline) 200, turns without floor_checks msg="could not read the floor checks for a timeline" at ERROR, with call and error
decisions (/events) 500 the handler returns the error and has no log of its own; the served a request access line is ERROR

Changes

  • acceleration/internal/api/calls_test.go: two tests in CallsSuite and the helper (+55 lines).

Validation

  • go test -tags integration ./internal/api/ -run TestCallsSuite: pass.
  • Mutations on 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 the error attribute.

Production caller: none (test-only).

🤖 Generated with Claude Code

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 kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: GO. No Blocker, no Should fix; one Nit (below).

Checked at 0299984 merged onto current main (108539d):

  • TestCallsSuite passes with -race; gofmt and go vet -tags integration are 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; runSuite only 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" from CallEvents.Select.
  • The author's 7 mutations on calls.go were re-run: 7 killed.
  • CI on the head: draft, go and integration skipped (#2130); CI runs at gh 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")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@kanat
kanat marked this pull request as ready for review November 23, 2026 16:43
@kanat
kanat merged commit 89623e9 into main Nov 23, 2026
15 checks passed
@kanat
kanat deleted the kanat/ai-3613-timeline-read-error-test branch November 23, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant