Skip to content

test(runner): strip GUILD_* from the child environment - #465

Merged
nao-amj merged 1 commit into
mainfrom
fix/test-env-isolation
Sep 11, 2026
Merged

nao-amj merged 1 commit into
mainfrom
fix/test-env-isolation

Conversation

@nao-amj

@nao-amj nao-amj commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

What

tests/run.mjs spawned node --test without an env, so the whole
parent environment reached every child — including a GUILD_ACTOR
exported in the developer's shell. Nearly every test asserts against
a bare invocation (no actor, no room) and reads the verdict back
from the child's exit code, so paths that must fail with a
missing-actor error succeeded quietly instead.

This strips the GUILD_ prefix from the child environment.

Measured

On 6c04c48, clean worktree + npm ci:

environment runner result
GUILD_ACTOR=eris before 26 fail / 1962
unset before 0 fail / 1962
GUILD_ACTOR=eris after 0 fail / 1962

The middle row is what makes stripping the whole prefix safe: no
test in the suite depends on the variable being set. Tests that do
need an actor pass one explicitly in their own env.

Why CI stayed green

GitHub runners carry no GUILD_ACTOR, so this never reproduced in
CI. The 26 failures were local-only and read as a broken main.

Scope

Test-infrastructure only — no changelog fragment (.changelog/README.md
excludes test-only changes).

🤖 Generated with Claude Code

https://claude.ai/code/session_01VvZueYYe3yXAkpBhbcKYqe

Nearly every test asserts against a bare invocation — no actor, no
room — and reads the verdict back from the child's exit code. The
runner spawned `node --test` without an `env`, so a `GUILD_ACTOR`
exported in the developer's shell was inherited all the way down
into each `spawnSync(gate.mjs)`. Paths that must fail with a
missing-actor error succeeded quietly instead.

Measured on 6c04c48, clean worktree + `npm ci`:

  GUILD_ACTOR=eris, before    26 fail / 1962
  unset,            before     0 fail / 1962
  GUILD_ACTOR=eris, after      0 fail / 1962

The middle row is what makes the whole `GUILD_` prefix safe to
strip: no test in the suite depends on the variable being set.
Tests that do need an actor pass one explicitly in their own `env`.

CI never saw this — GitHub runners carry no GUILD_ACTOR — so the
failure was local-only and read as a broken main.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VvZueYYe3yXAkpBhbcKYqe
@nao-amj
nao-amj merged commit 3ed773f into main Sep 11, 2026
5 checks passed
@nao-amj
nao-amj deleted the fix/test-env-isolation branch September 11, 2026 06:46
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