Skip to content

GD-436 follow-up: opt-in pipe-name suffix (GDUNIT4_PIPE_SUFFIX) for same-assembly parallel checkouts - #459

Open
jmund15 wants to merge 1 commit into
godot-gdunit-labs:masterfrom
jmund15:pp/pipe-name-salt
Open

jmund15 wants to merge 1 commit into
godot-gdunit-labs:masterfrom
jmund15:pp/pipe-name-salt

Conversation

@jmund15

@jmund15 jmund15 commented Jul 25, 2026

Copy link
Copy Markdown

Problem

#441 (shipped in 5.1.0-rc4) scoped the runtime pipe name to the test assembly's file name, fixing #436's multi-assembly collision. A gap remains: two checkouts of the same project (e.g. git worktrees used for parallel development, or two CI jobs on one runner) build identically-named assemblies, derive the identical pipe name, and still collide - the 10s ConnectAsync times out and the run silently skips or aborts.

Change

Opt-in, zero behavior change by default: if the environment variable GDUNIT4_PIPE_SUFFIX is set and non-empty, it is sanitized ([A-Za-z0-9_-], capped at 16 chars) and appended to the pipe name: gdunit4-{assemblyId}-{suffix}. Unset/empty reproduces current behavior exactly. Both endpoints already receive the final name through the single derivation site (--pipe-name pass-through), so the change is one shared helper in GodotRuntimeTestRunner (the name was previously constructed twice in the ctor - once for the client, once for the server arg - so the helper also removes that duplication hazard).

A caller isolating parallel checkouts sets the variable to a checkout-specific value (e.g. a short hash of the checkout path) before dotnet test.

Testing

  • Behavioral probe against the built assembly: unset/empty/illegal-only suffixes produce the unchanged name; legal, mixed, over-length, and non-ASCII suffixes sanitize as expected (8/8).
  • Consumed as a patched package in a 9.5k-test Godot 4.6.3 / .NET 9 project: full suite green with the suffix active (salted pipe live end-to-end).
  • Analyzers.Test green; TestAdapter.Test has 2 pre-existing failures requiring a built Example project, unrelated to this path.

Happy to rework this as a .runsettings option (in the spirit of RuntimeConnectTimeout) if you would prefer that surface - the env var was chosen so the value can vary per checkout without editing a tracked settings file.

…UFFIX

## Why
GD-436 / godot-gdunit-labs#441 scoped the testhost <-> Godot named pipe by assembly
(`gdunit4-{assemblyId}`), which fixes collisions between *different*
assemblies running in parallel. It does not cover concurrent runs of the
*same* assembly: two checkouts or git worktrees of one project produce an
identical `assemblyId`, so both runs derive the same pipe name and collide
exactly as before the fix.

## What
- `GodotRuntimeTestRunner` derives the pipe name through a new
  `BuildPipeName(assemblyId)` helper, used for both the `GodotRuntimeExecutor`
  pipe client and the `--pipe-name` argument handed to the spawned Godot
  process, so both endpoints stay in sync from the single derivation site.
- When the `GDUNIT4_PIPE_SUFFIX` environment variable is set and non-empty, its
  value is sanitized (`[A-Za-z0-9_-]` only, capped at 16 characters) and
  appended: `gdunit4-{assemblyId}-{suffix}`.
- Unset, empty, or fully-sanitized-away values yield exactly the current name,
  so default behavior is unchanged.

@MikeSchulze MikeSchulze left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd say that's one step too complicated. The pipe name is simply a key and should be unique. Therefore, we should use a UUID as a suffix instead; an additional environment variable is not necessary.

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.

2 participants