Repository navigation
test: failed stand-in compiles name the shared-emit canary verdict (#5212 / #890) - #6200
Conversation
…5212 / #890) Memex.Portal.Shared.Test compiles small stand-in assemblies in memory. On Linux x64 CI those compiles have died in the #890 emit NRE, lost references (CS0246/CS0234) or emitted a DLL missing its own type, and each red read as a defect of whichever test compiled next. All six stand-in Emit helpers (ModuleLinkVersionTest, LinkVerdictPerPlatformTest, ModuleUpdatesGoLiveTest, ModulePlatformSurfaceJsonTest, ModulePlatformLinkTest, ModulePlatformMemberLinkTest) now go through one helper, StandInCompile.Emit. When the emit fails (diagnostics or a throw) it runs EmitPipeline.ProbeSharedEmitState and appends its canary= verdict to the failure message and the test output. Diagnostic only: still fails, no retry, no fallback compiler. MeshWeaver.Compiler grants InternalsVisibleTo to Memex.Portal.Shared.Test for the probe. StandInCompileFailureNamesTheEmitCanaryTest pins the verdict line; NodeTypeCompilation.md documents it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Test Results 13 files - 9 13 suites - 9 36m 39s ⏱️ - 8m 7s Results for commit fb6b6b1. ± Comparison against base commit 3a0c2e9. This pull request removes 1497 and adds 38 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Test Results (shard 3)2 518 tests +42 2 518 ✅ +42 7m 22s ⏱️ -7s Results for commit fb6b6b1. ± Comparison against base commit 3a0c2e9. This pull request removes 81 and adds 123 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Test Results (shard 4) 2 files - 2 2 suites - 2 5m 46s ⏱️ - 9m 38s Results for commit fb6b6b1. ± Comparison against base commit 3a0c2e9. This pull request removes 3198 and adds 911 tests. Note that renamed tests count towards both. |
Why
#5212 (originally #890): on Linux x64 CI the shared Roslyn of a test process sometimes goes bad part-way through a run. After that,
Emitthrows the NRE inMetadataWriter.PopulateNestedClassTableRows, references passed to the compile become invisible (CS0246/CS0234), or a "successful" compile emits a DLL that is missing its own type. The latest occurrences were in the stand-in compiles ofMemex.Portal.Shared.Test: see this comment on #5212. Each red looked like a defect in whichever test compiled next.Production already has a canary for this,
EmitPipeline.ProbeSharedEmitState. The test helpers never ran it.What
test/Memex.Portal.Shared.Test/StandInCompile.cs.StandInCompile.Emit(CSharpCompilation)is the one emit for in-memory stand-ins. When the emit fails, whether through error diagnostics or a throw, it runsEmitPipeline.ProbeSharedEmitState(compilation). It then throwsStandInCompileFailedException, whose message is the compile errors (or the Emit fault, kept as the inner exception) plus a lineEmitPipeline.ProbeSharedEmitState (#5212 / #890): canary=…. The same text also goes to the test output.Emithelpers now call the shared helper instead of their ownEmit+Assert.True(result.Success…):ModuleLinkVersionTest,LinkVerdictPerPlatformTest,ModuleUpdatesGoLiveTest,ModulePlatformSurfaceJsonTest,ModulePlatformLinkTestandModulePlatformMemberLinkTest.ReleaseLinkGateTestalready reaches it throughModulePlatformSurfaceJsonTest.Emit.ModulesUpdateIndependentlyOfThePlatformTest, named in the comment, is not onmain(it came from PR feat(modules): module endpoints and view packs go live; modules update independently of the platform (slice 6) #6128). When it lands, itsEmitshould callStandInCompile.Emittoo.src/MeshWeaver.Compiler/MeshWeaver.Compiler.csproj: addedInternalsVisibleTo Memex.Portal.Shared.Test, because the probe isinternal.NodeTypeCompilation.md→ Reading it in CI has a new paragraph, "Test stand-in compiles carry the canary too".Verification
dotnet build -c Release -warnaserroron MeshWeaver.Compiler, Memex.Portal.Shared.Test and MeshWeaver.Documentation, one project per invocation: each reported0 Warning(s),0 Error(s).StandInCompileFailureNamesTheEmitCanaryTest.AFailedStandInCompile_CarriesTheCanaryVerdict_AndStillFails. It compiles a stand-in with a type error and asserts that the failure carries bothCS0029andEmitPipeline.ProbeSharedEmitState (#5212 / #890): canary=OK. That is the real reading in a healthy process, so it proves the probe ran and did not just print a constant.Assert.Contains() Failure: Sub-string not found … Not found: "EmitPipeline.ProbeSharedEmitState (#5212 / #890): ". I then restored the call, rebuilt, and it passed.ModuleLinkVersionTest,LinkVerdictPerPlatformTest,ModuleUpdatesGoLiveTest,ModulePlatformSurfaceJsonTest,ModulePlatformLinkTest,ModulePlatformMemberLinkTestandReleaseLinkGateTeston macOS arm64. Result: Total 109, Failed 0, and the trx lists the new test asPassed.Pairs-with: none — test-only diagnostic; one InternalsVisibleTo
🤖 Generated with Claude Code