Repository navigation
test(mecatequi): observe telemetry shutdown cancellation - #2634
Merged
Merged
Conversation
Replace the whole-command timing ceiling with blocked-export cancellation and verify the exact flush deadline with a fake clock. Co-authored-by: Mecatl <[email protected]>
jbeda
enabled auto-merge (squash)
October 31, 2026 21:02
This was referenced Oct 31, 2026
Merged
2 tasks
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
Harden the telemetry shutdown regression test tracked in #2327 without changing production behavior.
realMainwith explicit observations: the exit flush reaches a blocked OTLP collector, cancels that request, reports the deadline failure on stderr, and returns successfully before cleanup releases the collector.testing/synctest, avoiding wall-clock scheduling assumptions.The old assertion charged startup, Git operations, and shutdown against the same 600 ms budget. This change preserves coverage through the actual exit defer without treating command execution speed as the shutdown contract.
Verification
Passed locally:
go test -race -count=20 -cpu=1,2 -run 'TestTelemetry|TestFlushTelemetry' ./cmd/mecatequi— 40 repetitions of each selected test.task linttask test:race— complete offline suite.go run ./cmd/mecademo— tool call, permission ask/approval, and result observed.Negative controls (temporary production mutations, both reverted):
TestFlushTelemetryShutdownDeadlinefail immediately.realMain's exit defer madeTestTelemetryShutdownTimeoutBoundedfail on missing cancellation; cleanup released the collector and joined the command.task testdid not pass: the telemetry package passed, but two unchanged tests failed and were independently reproduced:internal/app.TestBuiltSchedulerBorrowsNativeOriginAndPublishesEachFire: immediate manual fire can precede asynchronous scheduler leadership acquisition (ErrScheduleNotLeader); 14 failures in 100 focused repetitions.mcp/oauthlogin.TestUnauthenticatedProbeFloodDoesNotAbortValidCallback:/probeconnection reset in the suite, EOF in focused repetitions. Sequential fresh connections can race server-side connection-slot release. A bounded focused run reproduced the same failure location after approximately seven seconds; the proposed limiter-slot schedule is code-supported, not an instrumented execution trace.Those follow-ups are deliberately excluded from this test-only PR. This addresses the telemetry watch-list entry, not the entire #2327 tracker.
API compatibility
No API, wire behavior, stored-data, dependency, or production-code changes. No major or feature identifier changes; no upgrade implications.