Skip to content

Stabilize console restoration assertions - #4809

Merged
Widthdom merged 2 commits into
mainfrom
fix-issue4800
Jul 24, 2026
Merged

Stabilize console restoration assertions#4809
Widthdom merged 2 commits into
mainfrom
fix-issue4800

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • Serialize the timeout test's global console writer snapshot and restoration assertions with the shared TestConsoleLock.Gate ownership gate.
  • Document the convention in the English and Japanese test guidance.
  • Add changelog.d/unreleased/4800.fixed.md.

Root cause

ConsoleCapture.CaptureAsync restored the original writers and released console ownership before the test read Console.Out and Console.Error. A parallel console-mutating test could therefore install a different writer between restoration and the assertions, causing a full-suite-only race.

Validation

  • dotnet build CodeIndex.sln -c Release --no-restore -p:UseSharedCompilation=false
  • ConsoleCaptureTests on net8.0 and net9.0: 8/8 passed on each target framework
  • The affected timeout test repeated successfully on both target frameworks
  • Full suite: net8.0 passed (10,242 passed, 7 skipped); net9.0 completed with one unrelated transient failure in CdidxConfigFileTests.RunValidate_PositionalJson_ReturnsStructuredError_Issue3892 (9,783 passed, 404 skipped), and that exact test passed when rerun on both target frameworks
  • dotnet run --project tools/CodeIndex.Changelog -- check
  • Codex adversarial review: no blocking/actionable issues found

Documentation and changelog

  • Updated both language sections of TESTING_GUIDE.md.
  • Added changelog fragment changelog.d/unreleased/4800.fixed.md.

Follow-up candidates

  • None.

Fixes #4800

@Widthdom
Widthdom marked this pull request as ready for review July 24, 2026 16:37
@Widthdom
Widthdom merged commit cc36d6f into main Jul 24, 2026
11 checks passed
@Widthdom
Widthdom deleted the fix-issue4800 branch July 24, 2026 18:27
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.

Full-suite ConsoleCapture test can race with parallel console mutation

1 participant