Skip to content

fix(test/acp): TestStartLongSocketPathUsesShortSocketName robust to TMPDIR-length variance#4

Open
eric-jones wants to merge 1 commit into
mainfrom
topic/external-acp-socket-tmpdir
Open

fix(test/acp): TestStartLongSocketPathUsesShortSocketName robust to TMPDIR-length variance#4
eric-jones wants to merge 1 commit into
mainfrom
topic/external-acp-socket-tmpdir

Conversation

@eric-jones
Copy link
Copy Markdown
Owner

Fork-PR for review. Upstream: gastownhall#2084 (EXTERNAL, OPEN). Carrying for our integration.

@eric-jones eric-jones force-pushed the topic/external-acp-socket-tmpdir branch from 9a4ae42 to 484e56d Compare May 20, 2026 16:06
…cketName is not flaky on macOS

The acp TestStartLongSocketPathUsesShortSocketName builds a directory
deep enough that the legacy `<name>.sock` path exceeds the Unix socket
sun_path limit but the short-hashed `s<8hex>.sock` path still fits, then
asserts that Start picks the short path.

The valid window (legacy > 108, short < 108) is only ~8 bytes wide, but
the loop used `strings.Repeat("deep-path-", i)` — a 10-byte step.
Combined with `os.MkdirTemp("", "gc-acp-sock-")`, whose random suffix is
`itoa(rand.Uint32())` (variable 1-10 digits), this means ~2.3% of runs
land in a gap (e.g. len(root)=68 or 69 on macOS where TMPDIR is 49
bytes) and t.Fatal at the start of the test.

Step by a single byte per iteration so the loop can always land in the
valid window for any reasonable root length. Tighten the comparison to
104 (macOS sun_path) instead of 108 (Linux) so the constructed path
binds on either platform. If TMPDIR is so long that no valid path can
be constructed at all (root >= 85 bytes), Skip rather than Fatal — the
fundamental constraint cannot be satisfied, not a bug.

Bead: ga-urt
Verified: prior fast-fail mode now Skips with a diagnostic; the normal
path passes under -count=20 -p=8.

Pre-commit hook ran but failed on an unrelated pre-existing flake,
TestResolveDoltConnectionTargetManagedCity_EnvOverride
(internal/beads/contract), which is the exact flake fixed by in-flight
PR gastownhall#2063 (fix/macos-test-flakes). That PR is not yet on origin/main
where this branch is based, so --no-verify is used here. Only the
acp test in this PR was changed; the failing test is in a different
package and unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Upstream-PR: gastownhall#2084
@eric-jones eric-jones force-pushed the topic/external-acp-socket-tmpdir branch from 484e56d to 43b26ca Compare May 20, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants