Repository navigation
test(server): fix two startup races that fail internal/server tests on macOS runners - #1890
Merged
Merged
Conversation
…g the search gate test backgroundToolIndexing, spawned right after PhaseReady, begins with cleanupOrphanedIndexEntries, which deletes the index documents of every indexed server the upstream manager does not know. TestSearchTools_WithholdsApprovalLockedHits seeds hand-made servers into the index after PhaseReady, so on a loaded runner the cleanup removed orchid:read_item mid-seeding and the approved hit went missing from the 'gadget' query (about 1 in 40 runs at GOMAXPROCS=1 -race). The fixture now also waits for the pass's completion log line.
…ore asserting telemetry BundleStatus().Source flips to fetch inside the cycle's fetch leg, but the cycle reports its outcome to the telemetry observer only afterwards (recordCycle, logOutcome, notifyRefreshObserver). TestTPAFetchLifecycle read TPABundleRefreshActivations as soon as the source flipped, so on a slow runner it saw 0 instead of 1. Poll for the counter, then assert it is exactly 1.
Deploying mcpproxy-docs with
|
| Latest commit: |
f2cf81a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://25c7a8d4.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-flaky-server-tests-macos.mcpproxy-docs.pages.dev |
Dumbris
enabled auto-merge (squash)
November 11, 2026 19:18
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 43858099492 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two
internal/servertests failed on macOS runners on unrelated PRs (#1885, #1887). Both are races in the tests, not in production code. This PR fixes them. Test-only.Causes and fixes
TestSearchTools_WithholdsApprovalLockedHitsreturned onlycedar:pending_itemwhenorchid:read_itemwas also expected.PhaseReadythe runtime starts background tool indexing, whose first step deletes index entries for servers the upstream manager does not know.PhaseReady, so the cleanup could delete a seeded document mid-seeding.GOMAXPROCS=1 go test -race -count=40: failed within the first two runs.newSettledConsistencyServerfixture waits forPhaseReadyand for the cleanup's completion log line before the test seeds anything.TestSearchTools_AnnotationsSurviveToTierseeds the same way and now uses it too.TestTPAFetchLifecycle_ActivatesReprotectsAndRefusesBadReleasesfailed with "exactly one cycle reported activated: expected 1, actual 0".== 1assertion.Not fixed here
The
test timed out after 40m0sfailure on #1886 was not a hang. The wholeinternal/serverpackage ran 40 minutes on a slow runner; the same job passed in 20 minutes on retry. A healthy macOS run already uses about half the 40-minute budget. Raising the timeout or trimming the fixed 12-second waits in the upstream-add tests is a separate decision.Testing
GOMAXPROCS=1 go test -race -count=100 -run TestSearchTools_WithholdsApprovalLockedHits ./internal/server/: pass.-race -count=15: pass.GOMAXPROCS=1 -race: 15 of 15 runs passed.golangci-lintv2 on./internal/server/...: 0 issues.