From e05fb6911d5117f63baabbdaed73d4f6c07e0e48 Mon Sep 17 00:00:00 2001 From: Molecule AI Core-BE Date: Mon, 11 May 2026 22:33:55 +0000 Subject: [PATCH 1/2] feat(ci): add per-package diagnostic step to platform-build job Adds a continue-on-error step that runs ./internal/handlers/... and ./internal/pendinguploads/... with -v -timeout 60s, tee-ing output to /tmp/ and emitting last-100-lines to step summary. Gitea Actions logs API returns 404 (gitea/gitea#22168), making the run-page step summary the only available signal when CI stalls. Step is stripped before merge. Co-authored-by: Claude Opus 4.7 --- .gitea/workflows/ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index fdf36295..198e4bc6 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -148,6 +148,21 @@ jobs: - if: needs.changes.outputs.platform == 'true' name: Run golangci-lint run: golangci-lint run --timeout 3m ./... || true + - if: needs.changes.outputs.platform == 'true' + name: Diagnostic — per-package verbose 60s + run: | + set +e + go test -race -v -timeout 60s ./internal/handlers/... 2>&1 | tee /tmp/test-handlers.log + handlers_exit=$? + go test -race -v -timeout 60s ./internal/pendinguploads/... 2>&1 | tee /tmp/test-pu.log + pu_exit=$? + echo "::group::handlers exit=$handlers_exit (last 100 lines)" + tail -100 /tmp/test-handlers.log + echo "::endgroup::" + echo "::group::pendinguploads exit=$pu_exit (last 100 lines)" + tail -100 /tmp/test-pu.log + echo "::endgroup::" + continue-on-error: true - if: needs.changes.outputs.platform == 'true' name: Run tests with race detection and coverage run: go test -race -coverprofile=coverage.out ./... From 57bf2eccc62120dfffc70c5b9b3d2459d2dbcf18 Mon Sep 17 00:00:00 2001 From: Molecule AI Core-BE Date: Mon, 11 May 2026 23:25:01 +0000 Subject: [PATCH 2/2] fix(test/delegation): add CanCommunicate mock expectations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit executeDelegation(sourceID, targetID) fires proxyA2ARequest which calls registry.CanCommunicate(sourceID, targetID) when source != target. Both IDs are different test fixtures (ws-source-159, ws-target-159), so the lookup fires two separate getWorkspaceRef queries: SELECT id, parent_id FROM workspaces WHERE id = $1 -- sourceID SELECT id, parent_id FROM workspaces WHERE id = $1 -- targetID expectExecuteDelegationBase only mocked the URL/status fallback query. sqlmock would fail with "unexpected query" when the CanCommunicate lookups fired — this was a silent failure because the tests never verified ExpectationWereMet on the CanCommunicate path. Fix: add two ExpectQuery rows for both parent_id lookups (both NULL, root-level siblings, allowed). Co-authored-by: Claude Opus 4.7 --- workspace-server/internal/handlers/delegation_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/workspace-server/internal/handlers/delegation_test.go b/workspace-server/internal/handlers/delegation_test.go index 38c63206..b2d1c93a 100644 --- a/workspace-server/internal/handlers/delegation_test.go +++ b/workspace-server/internal/handlers/delegation_test.go @@ -983,7 +983,16 @@ func expectExecuteDelegationBase(mock sqlmock.Sqlmock) { WithArgs("dispatched", "", testSourceID, testDelegationID). WillReturnResult(sqlmock.NewResult(0, 1)) - // CanCommunicate (source=target self-call is always allowed — no DB lookup needed) + // CanCommunicate: source != target → fires two getWorkspaceRef lookups. + // Both test fixtures have parent_id = NULL (root-level siblings) → allowed. + // Order matches call order: source first, then target. + mock.ExpectQuery("SELECT id, parent_id FROM workspaces WHERE id"). + WithArgs(testSourceID). + WillReturnRows(sqlmock.NewRows([]string{"id", "parent_id"}).AddRow(testSourceID, nil)) + mock.ExpectQuery("SELECT id, parent_id FROM workspaces WHERE id"). + WithArgs(testTargetID). + WillReturnRows(sqlmock.NewRows([]string{"id", "parent_id"}).AddRow(testTargetID, nil)) + // resolveAgentURL: reads ws:{id}:url from Redis, falls back to DB for target mock.ExpectQuery("SELECT url, status FROM workspaces WHERE id = "). WithArgs(testTargetID).