Repository navigation
test: make Windows server E2E cleanup portable - #1841
dajiaohuang wants to merge 3 commits into
Conversation
Dumbris
left a comment
There was a problem hiding this comment.
Thank you, @dajiaohuang — this is careful work, and most of it reads as a straight improvement: the request-sequence watermark in preflight_telemetry.go / mcp.go is a real fix (the counter is only touched under filterDiagMu, and "seq > startedThrough" no longer depends on clock resolution), moving the SSE subscribe ahead of the first flush closes a genuine 100 ms gap, and the scoped cleanup in run-all-tests.sh is the right direction.
Two things I would like to settle before merging, both small:
-
legacyInstanceIDMuininternal/upstream/core/instance.go. In productionadoptLegacyInstanceIDruns once per process (insideinstanceIDOnce.Do), so the mutex never contends. Its only effect is onTestAdoptLegacyInstanceIDConcurrentClaimIsExclusive, which races eight goroutines to prove thatos.Renamelets exactly one claimant win; with the mutex the goroutines run one after another, so the test now exercises the mutex rather than rename exclusivity, while the function's comment still promises safety across processes. What did the test actually do on Windows — did two renames of the same file both succeed? If so, that is a real two-core race worth fixing in the claim protocol (or making the test spawn subprocesses); if it was something else, a comment explaining why the lock is needed would be enough. Happy to help dig into it. -
Caller-supplied directories are removed on cleanup in
scripts/test-api-e2e.sh: withMCPPROXY_E2E_AUDIT_JSONL_DIR(likewiseMCPPROXY_E2E_TEST_DATA_DIR/MCPPROXY_E2E_AUDIT_DATA_DIR) set,cleanup()laterrm -rfs a directory the script did not create —MCPPROXY_E2E_AUDIT_JSONL_DIR=$TMPDIRwould wipe$TMPDIR. Only deleting directories the script made itself would match the "owned artifacts" intent.
Two notes, no change needed: on Windows the default tray pipe now comes from socket.GetDefaultSocketPath(DataDir), so a non-default data_dir yields a hashed pipe name (the CLI already expects that; the tray falls back to TCP as it does on Unix) — worth one line in the PR description since it is a production behaviour change under a test: title; and COVER=true in run-e2e-tests.sh now exits 1 when coverage.out already exists, which trips a developer's second local run.
I have approved the CI workflow runs so the hosted checks can report on this head.
| "enabled": false | ||
| } | ||
| }`, port, dataDir, TestAPIKey) | ||
| }`, port, encodedDataDir, TestAPIKey) |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Validation
scripts/run-all-tests.shat head947ee449: build, full unit/race tests, unit coverage, mocked E2E, API E2E, Binary E2E, MCP Protocol E2E, and performance stages passed.golangci-lintis not installed.gofmtandgit diff --checkpassed. The full run used isolated UCRT64 compiler, Go caches, and task-local temporary directories.Hosted CI has not been queried.