Skip to content

test(api): repair the five integration tests that fail on main - #2147

Merged
dangusev merged 2 commits into
mainfrom
fix-api-integration-tests
Nov 20, 2026
Merged

dangusev merged 2 commits into
mainfrom
fix-api-integration-tests

Conversation

@dangusev

@dangusev dangusev commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Why

Five integration (api) tests fail on main, so the job fails on every open PR. The code changed as intended, and the tests did not follow:

Tests Failing since What changed What the test still expects
TestToolOutputRetentionSuite: TestAnAppPolicyOfNoneRecordsNoneOfAToolsOutput, TestAGroupThatKeepsNoneRecordsNoneOfItsToolsOutput #2088, seen first on #2133 A tool result records tokens, and redaction keeps it: tool usage counts it (internal/store/models.go redactedToolKeys) A redacted payload of call_id and redacted only
TestConnectorsSuite: TestABindingToAConnectorDeletedMeanwhileIsRefused, TestAConnectionToAConnectorDeletedMeanwhileIsRefusedAsUnknown, TestAnOAuthClientForAConnectorDeletedMeanwhileIsNotFound #2134 The connector delete is a bun builder, which quotes the table name A waiting query with the text DELETE FROM connector_oauth_clients, without quotes

#2088 merged while its own integration (api) run stopped at start (goose: duplicate version), so these tests did not run on it. #2133 fixed the version.

How it works

connector test: hold the delete, then find it in pg_stat_activity

what bun sends:
  DELETE FROM "connector_oauth_clients" AS "coc" WHERE (...)

before: strpos(query, 'DELETE FROM connector_oauth_clients')   -> never
after:  strpos(query, 'DELETE FROM "connector_oauth_clients"') -> found

Changes

  • internal/api/tool_output_retention_test.go:36,46: the expected redacted payload has "tokens": 12 too. The tests still prove that the tool's output and arguments are gone.
  • internal/api/connectors_test.go:720: the test looks for the delete as bun writes it.

Validation

  • go vet -tags integration ./internal/api: no findings.
  • The SQL text above is what bun v1.2.18 with the Postgres dialect builds for the delete in internal/store/connectors.go:641 (printed with .String() in a scratch test, not committed).
  • Not run locally: these are integration tests that need Postgres. This PR's integration (api) run is the check (unverified until then).
  • Not in this PR: two other failures seen once in that job, TestADrainingRouterWaitsForTheWorkerToAnswerItsClose (1.54 s against a 1.5 s limit) and TestTwoRoutersStopAnLLMSessionTogether (spend_check_unavailable). They did not occur in the other runs checked.

🤖 Generated with Claude Code

Redaction keeps what a tool call cost in tokens, because tool usage counts
it. The two retention tests still expected only the call ID and the
redacted mark.
The store now deletes a connector's OAuth clients with a bun builder, which
quotes the table name. The test looked for the statement without quotes in
the waiting queries, so it never found the delete.
@dangusev
dangusev marked this pull request as ready for review November 20, 2026 12:53
@dangusev
dangusev merged commit cfb8005 into main Nov 20, 2026
25 of 27 checks passed
@dangusev
dangusev deleted the fix-api-integration-tests branch November 20, 2026 14:17
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.

2 participants