mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

test(flake): TestMaybeAutoApproveScanSettled_DegradedBundleSuspendsAutoApproval fails under -shuffle

Open Dumbris opened this issue 1 week ago • 0 comments

TestMaybeAutoApproveScanSettled_DegradedBundleSuspendsAutoApproval (internal/server/tpa_bundle_admission_test.go:64-66) failed in the advisory Unit Tests (shuffle) lane on a spec-only PR (#2033, markdown files only), so the failure depends on test order rather than on that change.

Failure (subtest degraded_bundle:_no_auto-approve,_logged_once_at_Info_with_the_reason, took 33 s):

tpa_bundle_admission_test.go:64: Should be empty, but was [srv srv]
tpa_bundle_admission_test.go:66: "[]" should have 1 item(s), but has 0
    Messages: the degraded suspension is logged once, not per settle event

So scanner.BundleCoverageDegraded() was true right after configureUnsignedDropBundle (that require passed), but by the time maybeAutoApproveScanSettled ran, the server no longer saw the bundle as degraded: both calls approved and nothing was logged. The 33 s runtime suggests something else in the package (a background refresh or reload from an earlier test's server, or the activation self-check) replaced or reset the process-global bundle runtime in between.

Run: https://github.com/smart-mcp-proxy/mcpproxy-go/actions/runs/45491966119/job/138794989597 (head d6103b3)

Reproduce:

go test -race -count=1 -shuffle=1795559139636035975 -run 'TestMaybeAutoApproveScanSettled_DegradedBundleSuspendsAutoApproval' ./internal/server/

(The seed is the one this run printed for internal/server. A plain -run filter may not reproduce it if the interference comes from an earlier test; drop -run and add the CI -skip regex if needed.)

Likely fix direction: make the test independent of process-global bundle state that other tests' servers can still touch (stop or join leftover refreshers before configureUnsignedDropBundle, or inject the coverage check into the server under test instead of reading the global).

Dumbris avatar Nov 25 '26 10:11 Dumbris