Skip to content

test(stack): fix 2 flaky tests in network pinning and docker storage - #7288

Merged
avallete merged 7 commits into
developfrom
avallete/flaky-fixes-2026-10-23
Nov 2, 2026
Merged

avallete merged 7 commits into
developfrom
avallete/flaky-fixes-2026-10-23

Conversation

@avallete

@avallete avallete commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

TL;DR

Two stack integration tests failed because of runner state, not because of the code under test.

  • Network.integration.test.ts › a pinned shared listener keeps its reservation until its last route closes: on Windows, the bind failed as a foreign port conflict on 1801. The random pinned port landed on a port that a Windows runner service holds, and the static held-port list cannot anticipate every such port. pinnedPort now draws again until no listener answers the drawn loopback port and the bind's own vacancy guard (Ports.probeVacant) accepts it. This replaces the static list.
  • DockerDatabaseStorage.integration.test.ts › round-trips PostgreSQL 15 data with its catalog image: the pull failed with toomanyrequests after all pull retries. GHCR rate-limited the runner for longer than the pull backoff, and the tests had no image mirror, unlike the stack's production wiring. Three changes give the tests the same ECR fallback the stack uses:
    • The tests' container runtimes and the spawned helper-owner fixture now use slimImageMirrors.
    • The direct engine runs use the reference the runtime resolved.
    • The test that checks a custom mirror keeps its explicit mirror.

ref

spotted in:

🤖 Generated with Claude Code

https://claude.ai/code/session_01XrrxbNdkjLwsEeJJiJvGs8

Windows runners hold ports such as 1801 that a static list cannot anticipate, so a
random pinned port could land on one and fail the bind as a foreign conflict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XrrxbNdkjLwsEeJJiJvGs8
Their container runtimes had no mirror, so a GHCR rate limit that outlasts the pull
backoff failed the PostgreSQL 15 catalog-image pull where the stack itself would fall
back to the ECR mirror.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XrrxbNdkjLwsEeJJiJvGs8
@avallete
avallete requested a review from a team as a code owner October 23, 2026 07:43

Copy link
Copy Markdown
Member Author

/ai-review


Generated by Claude Code

@avallete avallete added the run-flaky-check Run the flaky-test check on this PR label Oct 23, 2026 — with Claude
@github-actions github-actions Bot removed the run-flaky-check Run the flaky-test check on this PR label Oct 23, 2026

@github-actions github-actions Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by a newer AI review

🤖 AI Review

Both independent reviews were available. Confirmed Claude’s minor test-flakiness finding: the new port-selection check can accept ports that the actual bind guard rejects. Codex reported no findings. Tests were not run.

Findings

Severity Location Category Sources Claim
🟡 MINOR packages/stack/src/Network.integration.test.ts:609 test-flakiness claude The new pinned-port helper can still select ports that the tests reject when binding on Windows and macOS. It checks only IPv4 and accepts errors or timeouts as availability, whereas the bind guard requires definite ECONNREFUSED responses on both IPv4 and IPv6. An IPv6-only listener therefore remains a concrete source of intermittent foreign-port conflicts.

Stats

Claude findings: 1 · Codex findings: 0 · Confirmed: 1 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

Confirmed one minor test-reliability finding from Claude; Codex reported no findings. The container-mirror changes match production wiring. Verification used code inspection; tests were not run because dependencies are absent.

Findings

Severity Location Category Sources Claim
🟡 MINOR packages/stack/src/Network.integration.test.ts:609 test-reliability claude The new pinned-port selector can accept ports that the subsequent bind rejects, leaving the integration tests flaky on Windows and macOS. It checks only IPv4 and treats timeouts or socket errors as vacancy, whereas binding requires explicit connection refusal on both loopback families.

Stats

Claude findings: 1 · Codex findings: 0 · Confirmed: 1 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: manual · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

@avallete avallete added the run-flaky-check Run the flaky-test check on this PR label Oct 23, 2026 — with Claude
@github-actions github-actions Bot removed the run-flaky-check Run the flaky-test check on this PR label Oct 23, 2026

Copy link
Copy Markdown
Member Author

Run stack Podman integration tests failed on 4d63574 in src/services/Mail.integration.test.ts › launches the real Mailpit recipe and serves its HTTP endpoint, which hit the 30s test timeout. This PR changes only Network.integration.test.ts and DockerDatabaseStorage.integration.test.ts, so neither the Mailpit recipe nor its test is touched. No fix for this exists yet. I'm re-running the failed job once.


Generated by Claude Code

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Flaky test check: ✅ no flaky tests

Commit 791d6a04f570 · focused ×10 (5 executions each), 42 tests · integration ×10, 6682 tests · unit ×10, 9346 tests · workflow run

Each execution is a separate Vitest process; Where lists failing runs, as run.iteration for suites executed more than once per run. The full data is in the flaky-check-report artifact.

jgoux
jgoux previously requested changes Oct 23, 2026

@jgoux jgoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The port-pinning change looks right: the redraw now goes through the same vacancy guard that rejected 1801. The mirror change leaves the reported PostgreSQL 15 flake reachable; details inline.

…rored image

The storage tests passed the GHCR reference to their own engine runs, and the spawned
owner fixture built a runtime without mirrors, so both pulled GHCR again after the
runtime had already fallen back to the ECR mirror.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XrrxbNdkjLwsEeJJiJvGs8
@avallete avallete added the run-flaky-check Run the flaky-test check on this PR label Oct 23, 2026 — with Claude
@avallete
avallete requested a review from jgoux October 23, 2026 08:38
@github-actions github-actions Bot removed the run-flaky-check Run the flaky-test check on this PR label Oct 23, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit 812f942 against develop at c3f3ef2 · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 303 ms 307 ms no real change
supabase --help help 268 ms 286 ms no real change (+7%, within normal variation)
supabase init init 293 ms 349 ms no real change (+19%, within normal variation)
supabase migration new bench migration-new 359 ms 364 ms no real change
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 441 ms 385 ms no real change (-13%, within normal variation)
supabase projects list projects-list 411 ms 378 ms no real change (-8%, within normal variation)
supabase functions list --project-ref replayfixtureprojref functions-list 544 ms 536 ms no real change

API calls: unchanged for all 7 commands.

Binary size: 134.0 MB, unchanged.

Details: timing ranges, API calls per command, slowest phases

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 233-405 ms 227-402 ms +4 ms (+1%) within noise
supabase --help help 249-356 ms 256-380 ms +18 ms (+7%) within noise
supabase init init 259-329 ms 247-522 ms +57 ms (+19%) within noise
supabase migration new bench migration-new 294-510 ms 285-538 ms +5 ms (+2%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 397-527 ms 322-516 ms -57 ms (-13%) within noise
supabase projects list projects-list 325-640 ms 328-513 ms -33 ms (-8%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 447-727 ms 398-726 ms -8 ms (-1%) within noise

API calls per command

Command Workload Before After Endpoint changes
supabase --version version 0 0
supabase --help help 0 0
supabase init init 0 0
supabase migration new bench migration-new 0 0
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 2 2
supabase projects list projects-list 1 1
supabase functions list --project-ref replayfixtureprojref functions-list 2 2

Slowest phases

No command moved beyond noise, so there are no phase deltas.

Workflow run

Comment /bench to run the lightweight benchmark (this comment) again on the latest commit, or /bench full to also run the integration-heavy benchmark, which posts in its own comment.

@Coly010 Coly010 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jgoux's two points look fixed to me. one more of the same kind: tests/docker-storage-publish-loop-fixture.ts:40 builds its runtime without imageMirrors, and the crash test spawns it. when GHCR 429s and the parent has fallen back to ECR, the writer's prepareImage asks GHCR again with no fallback and misses its 10s publish-boundary timeout. adding imageMirrors: slimImageMirrors like helper-owner-fixture.ts should cover it

approving so you're unblocked

avallete commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

@Coly010 fixed in ab76c71: tests/docker-storage-publish-loop-fixture.ts now builds its runtime with imageMirrors: slimImageMirrors. It was the last makeContainerRuntime call under packages/stack/tests without mirrors.


Generated by Claude Code

@avallete avallete added the run-flaky-check Run the flaky-test check on this PR label Nov 2, 2026 — with Claude
@github-actions github-actions Bot removed the run-flaky-check Run the flaky-test check on this PR label Nov 2, 2026
@avallete
avallete enabled auto-merge November 2, 2026 16:52
@avallete
avallete dismissed jgoux’s stale review November 2, 2026 16:52

approved by colum

@avallete
avallete added this pull request to the merge queue Nov 2, 2026
Merged via the queue into develop with commit cf193a1 Nov 2, 2026
49 checks passed
@avallete
avallete deleted the avallete/flaky-fixes-2026-10-23 branch November 2, 2026 16:56
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.

4 participants