Skip to content

servers: deterministic probe-stall test via transport injection seam (#179)#186

Merged
SyniRon merged 2 commits into
developfrom
agent/issue-179
Jun 8, 2026
Merged

servers: deterministic probe-stall test via transport injection seam (#179)#186
SyniRon merged 2 commits into
developfrom
agent/issue-179

Conversation

@SyniRon

@SyniRon SyniRon commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Closes #179.

What

Makes TestSetupSentry_ProbeStall_WarnsAndWithholdsEnabledLine deterministic — the stalled-transport premise now holds by construction instead of winning a dial-timing race.

  • servers/sentry.go: sentryTransportOverride seam (package var, nil in production — production construction byte-identical, verified against sentry-go v0.46.2 setupTransport). Wired into setupSentry's ClientOptions.Transport.
  • servers/sentry_test.go: the probe-stall test injects the existing stubTransport{flushDrains: false} via the seam — no blocking httptest server, no shrunk probe window, no socket in the stall premise. Strengthened pin: the canary must arrive at the injected transport, proving the probe ran against the client setupSentry just configured.
  • Review follow-ups: setSentryTransportOverride helper self-registers the cleanup reset (set-without-reset unwritable); seam comment documents the SDK client-mode divergence (non-nil transport → legacy-transport mode; re-check on SDK bumps).

Validation

  • Mutation checks: deleting the sentryStartupProbe() call → red on all three assertions; unwiring the seam → red on the canary pin.
  • Load check (the protocol that closed the sibling flake): go test -count=100 ./servers/ green concurrent with a looping -race full-module suite; zero failures.
  • Full gate: build, vet, full module suite, -race -count=3 -shuffle=on ./servers/, make test-integration (MariaDB harness), gofmt — all green; re-verified post-rebase onto 03dae4b.
  • Reviewed by code-review + test-coverage agents; both follow-ups applied.

🤖 Generated with Claude Code

SyniRon added 2 commits June 7, 2026 21:02
…179)

The probe-stall test manufactured its stall by pointing the DSN at a
local HTTP server whose handler blocked, racing a shrunk probe window.
Under machine load the dial could be REFUSED instead of
connect-and-hang — a fast send outcome that drains the queue, flushes,
and prints the success line, failing both assertions.

Replace the socket with a test-only transport injection seam:
sentryTransportOverride (nil in production — the SDK builds its real
HTTP transport unchanged) feeds setupSentry's ClientOptions, and the
test injects the existing stubTransport with flushDrains=false. The
stalled-transport premise now holds by construction — no socket, no
wall-clock race. The test still pins that setupSentry invokes the
probe against the client it just configured: the canary must arrive
at the injected transport, and deleting the probe call stays red.
@SyniRon SyniRon merged commit d39f4b4 into develop Jun 8, 2026
3 checks passed
@SyniRon SyniRon deleted the agent/issue-179 branch June 8, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flaky: TestSetupSentry_ProbeStall_WarnsAndWithholdsEnabledLine fails under machine load

1 participant