From 816f3bc0a3c93715d8ca19894db0f13aae4ea40e Mon Sep 17 00:00:00 2001 From: core-devops Date: Wed, 10 Jun 2026 22:10:01 -0700 Subject: [PATCH] fix(handlers-tests): align pinned activity_logs expectations with 13-arg LogActivity (message_id) Main went red on Platform (Go) at 518a5f13: #2560 added message_id as the 13th positional param to the LogActivity INSERT (idempotent ON CONFLICT upsert), while two parallel-merged PRs (#2306 bearer-derive test, chat-uploads poll-filter test) pinned 12-arg WithArgs expectations. Each PR was green alone; together main fails: --- FAIL: TestProxyA2A_CallerIDDerivedFromBearer --- FAIL: TestHandleA2ADispatchError_BusyEnqueueLogsQueuedNotFailure --- FAIL: TestPollUpload_ActivityRowDiscriminator ExecQuery 'INSERT INTO activity_logs ...' arguments do not match: expected 12, but got 13 arguments Fix: add sqlmock.AnyArg() for $13 message_id to the three pinned expectation blocks + update the positional-args doc comment. No production code change. Full ./internal/handlers green locally. Co-Authored-By: Claude Opus 4.8 (1M context) --- workspace-server/internal/handlers/a2a_proxy_test.go | 2 ++ workspace-server/internal/handlers/chat_files_poll_test.go | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/workspace-server/internal/handlers/a2a_proxy_test.go b/workspace-server/internal/handlers/a2a_proxy_test.go index d0c5e7d8..c7398f4a 100644 --- a/workspace-server/internal/handlers/a2a_proxy_test.go +++ b/workspace-server/internal/handlers/a2a_proxy_test.go @@ -702,6 +702,7 @@ func TestProxyA2A_CallerIDDerivedFromBearer(t *testing.T) { sqlmock.AnyArg(), // $10 duration_ms sqlmock.AnyArg(), // $11 status sqlmock.AnyArg(), // $12 error_detail + sqlmock.AnyArg(), // $13 message_id (#2560 idempotent upsert) ). WillReturnResult(sqlmock.NewResult(0, 1)) @@ -2055,6 +2056,7 @@ func TestHandleA2ADispatchError_BusyEnqueueLogsQueuedNotFailure(t *testing.T) { sqlmock.AnyArg(), "ok", nil, + sqlmock.AnyArg(), // $13 message_id (#2560 idempotent upsert) ). WillReturnResult(sqlmock.NewResult(0, 1)) diff --git a/workspace-server/internal/handlers/chat_files_poll_test.go b/workspace-server/internal/handlers/chat_files_poll_test.go index ca8458a5..a93d1dd4 100644 --- a/workspace-server/internal/handlers/chat_files_poll_test.go +++ b/workspace-server/internal/handlers/chat_files_poll_test.go @@ -187,10 +187,12 @@ func expectUploadPollTxRollback(mock sqlmock.Sqlmock) { // fields so a refactor that flips activity_type back to a custom value is // caught here instead of at runtime by a confused poller. // -// Positional args (LogActivity uses ExecContext with 12 positional params): +// Positional args (LogActivity uses ExecContext with 13 positional params +// since #2560 added message_id for idempotent upserts): // $1 workspace_id, $2 activity_type, $3 source_id, $4 target_id, // $5 method, $6 summary, $7 request_body, $8 response_body, -// $9 tool_trace, $10 duration_ms, $11 status, $12 error_detail. +// $9 tool_trace, $10 duration_ms, $11 status, $12 error_detail, +// $13 message_id. func expectActivityInsertWithTypeAndMethod(mock sqlmock.Sqlmock, workspaceID, activityType, method string) { mock.ExpectExec(`INSERT INTO activity_logs`). WithArgs( @@ -206,6 +208,7 @@ func expectActivityInsertWithTypeAndMethod(mock sqlmock.Sqlmock, workspaceID, ac sqlmock.AnyArg(), // $10 duration_ms sqlmock.AnyArg(), // $11 status sqlmock.AnyArg(), // $12 error_detail + sqlmock.AnyArg(), // $13 message_id ). WillReturnResult(sqlmock.NewResult(1, 1)) } -- 2.52.0