Skip to content

test(connscale): dynamic contiguous ports, and the flaky marker dropped (BACKLOG #1014) - #250

Open
wshallwshall wants to merge 2 commits into
mainfrom
fix-1014-connscale-ports
Open

test(connscale): dynamic contiguous ports, and the flaky marker dropped (BACKLOG #1014)#250
wshallwshall wants to merge 2 commits into
mainfrom
fix-1014-connscale-ports

Conversation

@wshallwshall

Copy link
Copy Markdown
Collaborator

Fixes BACKLOG #1014. Test-only.

The connscale smoke test used fixed ports and was marked flaky. It now allocates a dynamic
contiguous port range, and the flaky marker is dropped -- the flakiness was a fixed-port collision,
not timing, so the marker was concealing a deterministic cause.

Verified in-lane: plan -> build -> 3-lens adversarial verify -> remediate. Banner gate OK.

… flaky marker (BACKLOG #1014)

The connscale SQLite smoke test hard-coded base_port=41000 and needs 24
contiguous inbound ports, so two worktrees running the suite at once
contended for the same fixed block; a @pytest.mark.flaky(reruns=2) marker
retried past the collision, relabelling a determinate resource conflict as
CI noise. On the first parallel run it would keep masking exactly this class.

Replace the fixed block with _free_contiguous_ports(), which anchors an
n-wide block at a RANDOM base inside a bounded window, probes each port with
a no-REUSEADDR bind, and returns the range only when all n bind. The random
anchor over a wide window de-correlates concurrent worktrees; a genuine
future collision now surfaces as a red, not a masked retry. Contiguity is
asserted at the acquisition site and the allocator fails loudly -- never a
silent fixed fallback -- via two branches: an up-front width guard when the
block cannot fit the window, and a post-loop raise when no free block is
found after `tries` attempts.

The window is [20000,30000): the lower bound sits ABOVE the sibling MLLP
fixed-port band (other tests bind fixed inbound ports in the 11xxx-19xxx
range, e.g. 15099/19601), and the upper bound stays BELOW the OS ephemeral
floors (Linux 32768+, Windows/macOS 49152+) so a kernel-assigned ephemeral
port -- the sink/API ports, or any unrelated connection -- can never land in
the block after it is probed.

Drop the @pytest.mark.flaky marker: the collision was the cause, so keeping
it would re-hide the class this removes. Add three helper tests -- contiguity
and in-window, post-loop exhaustion (tries=0), and the width guard -- each
pinned to its branch (match=) and falsified by mutation.

Test-only change; no product code is touched.
…y marker dropped

Flip #1014's status banner from open (filed) to shipped: the dynamic
contiguous inbound-port allocation and the flaky-marker removal land in the
same branch (commit 3450c3f).

This edits the #1014 banner line ONLY. The ranked table and the four census
distribution lines are untouched, and the census was NOT recomputed.
@wshallwshall
wshallwshall enabled auto-merge (squash) August 6, 2026 14:16
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.

1 participant