Skip to content

[ogar-adapter-csharp] isolate dotnet CLI home per test — fix flaky NuGet-migration shm race#181

Open
AdaWorldAPI wants to merge 1 commit into
mainfrom
claude/csharp-parity-dotnet-home-isolation
Open

[ogar-adapter-csharp] isolate dotnet CLI home per test — fix flaky NuGet-migration shm race#181
AdaWorldAPI wants to merge 1 commit into
mainfrom
claude/csharp-parity-dotnet-home-isolation

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Was

Die C#-Parity-Tests (ogar-adapter-csharp, aus #177) rufen dotnet build/dotnet run auf, teilten aber das Default-dotnet-Home (~/.dotnet, bzw. /tmp/.dotnet wenn HOME ungesetzt). Dessen First-Run-NuGet-Migration öffnet einen Named-Session-Mutex unter .../shm/session<N>; zwei nebenläufige dotnet-Prozesse (parallele Test-Binaries oder parallele CI-Jobs auf einem Runner) rennen auf denselben Pfad und einer failt mit mkdir(...) == -1; errno == EEXIST in NuGet.Common.Migrations.MigrationRunner.

Das ist ein intermittierender Infra-Flake, kein Code-Defekt — beobachtet als rot auf OGAR #179, während main auf demselben Commit + demselben Test grün war (der Mint in #179 berührt ogar-adapter-csharp nicht).

Fix

HOME + DOTNET_CLI_HOME + NUGET_PACKAGES zeigen jetzt auf ein per-Test eindeutiges Temp-Verzeichnis (Sibling des bereits vorhandenen per-Test-Projekt-Dirs), sodass die shm/session-Dirs nie kollidieren. dotnet() nimmt einen home-Pfad; beide Tests legen ihr eigenes home an und räumen es auf; die Availability-Probe nutzt ein Wegwerf-home.

Scope

Nur Test-Infra (tests/parity.rs), keine Produkt-/Emitter-Änderung. Kompiliert clean (cargo test -p ogar-adapter-csharp --no-run → Finished). Die eigentliche Build+Run-Parität kann ich im Sandbox nicht ausführen (kein net8.0-SDK), aber die Isolations-Logik ist die Standard-Lösung für genau diesen dotnet-shm-Race; CI mit SDK verifiziert.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Cg8DSUz1U4AvKqXiy9Xx2f

…Get-migration shm race

The C# parity tests shell out to `dotnet build`/`dotnet run` but shared the
default dotnet home (`~/.dotnet`, or `/tmp/.dotnet` when HOME is unset). Its
first-run NuGet-migration step opens a named session mutex under
`.../shm/session<N>`; two concurrent `dotnet` processes (parallel test
binaries, or parallel CI jobs on one runner) race on the same path and one
fails with `mkdir(...) == -1; errno == EEXIST` in
NuGet.Common.Migrations.MigrationRunner — an intermittent hard failure with
nothing to do with the code under test (observed red on OGAR #179 while main
was green on the same commit + same test).

Fix: point HOME + DOTNET_CLI_HOME + NUGET_PACKAGES at a per-test unique temp
dir (sibling of the existing per-test project dir), so the shm/session dirs
never collide. `dotnet()` now takes a home path; both tests create and clean
their own home; the availability probe uses a throwaway home. Test-only, no
product change; compiles clean (`cargo test -p ogar-adapter-csharp --no-run`).
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7f8d2532-12ba-4a82-8bab-b2c018c10bf4)

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