Repository navigation
#602 Zero build warnings across the engine, profiler and test projects + TreatWarningsAsErrors - #603
Merged
Merged
Conversation
…s, gated with TreatWarningsAsErrors The Typhon.Engine.Tests build closure carried 86 warnings with nothing gating them. The only guard was a hand-maintained WarningsAsErrors list of doc-comment codes (CS1570-CS1735) on two csprojs, which by construction could not catch anything outside that list — CS0419 sits in CS04xx and 47 instances accumulated unnoticed. Engine.Tests closure: 86 -> 0. Typhon.Engine (47), Typhon.Engine.Tests (35), Typhon.Profiler (3) and Typhon.Workbench.Fixtures (1) now build clean in Debug and Release and each carries TreatWarningsAsErrors, replacing the doc-comment-only allow-list. CS0419 x50 (engine + profiler): ambiguous cref, fixed by naming the overload the prose actually means, picked by reading the call site rather than guessing. Four sites needed `ref readonly` in the cref — .NET 9 changed Interlocked.Read and Volatile.Read to take ref readonly, and plain `ref` fails to resolve. Four references are to an overload *set* (ClaimSlotInCell "both overloads", CompoundSystem.Add with three overloads); C# cannot cref an overload group, so those use <c> rather than pointing at an arbitrary member. ArchetypeClusterState.cs:600 claimed SetDirty tags wake requests via DormancyReporter — neither overload does, the shared MarkEntityDirty helper does; retargeted. CS0436 x2: TraceEventGenerator synthesized its attribute surface via RegisterPostInitializationOutput, which injects into every project referencing the generator as an analyzer — all of which also reference Typhon.Engine, which exports the same types. Declared once as real source in Profiler/public/TraceEventAttributes.cs and dropped the post-init block; the generator resolves [TraceEvent] against it directly, since real source is always visible to generators. Verified it still emits all 410 producer files. Also updated the stale rationale comments in Typhon.Engine.csproj and GlobalUsings.cs that cited CS0436 as unavoidable. CA2014 x11: stackalloc inside loops of 200-10000 iterations. localloc is not released until the method returns, so SpatialPerfTests grew the stack by ~480 KB per run. Every size was loop-invariant and every element rewritten per iteration, so the buffers hoist without behaviour change; two of them also sat inside the timed region of a benchmark. CS0279 x2: ViewBase.GetEnumerator() is internal and the foreach collection pattern requires public, so a bare foreach over an EcsView<T> silently fell back to IEnumerable<long> — a boxed enumerator with interface dispatch per element. Switched to the public allocation-free GetEntityEnumerator(). CS0114: DormancyTests.TearDown hid TestBase.TearDown instead of overriding it. Checked empirically whether the base cleanup was being skipped (it was not — NUnit invokes both), then converted to the suite's override + base.TearDown() convention. CS0108: TraceRingObserver.Name re-declared what ResourceNode.Name already returns, the base ctor being passed the identical string; deleted. CS0219: vestigial ticksToRun const, that loop is bounded by attempt count. TYPHON009: narrow pragma at the one line whose own comment reads "Deliberately NO MarkSlotDirty — that's the bug pattern under test". CS0649 x17: file-scoped pragma in five fixtures whose component payload fields are written through spans, never by C# assignment, matching the engine's own precedent in InstantEvents.cs. Full suite 4076 passed / 0 failed / 51 skipped, unchanged from baseline. dotnet pack clean. Note for whoever gates more projects: TreatWarningsAsErrors also promotes NuGet advisory warnings. Typhon.CompetitiveBenchmark currently reports NU1903 for SQLitePCLRaw.lib.e_sqlite3 2.1.11 and must be bumped before it can be gated. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gcg4vW8vJ4QjNyj6NQabHs
…2cp-r559-cp3m, GHSA-v2hh-gcrm-f6hx, GHSA-r28c-9q8g-f849) All three were transitive dev-dependencies, so nothing reached a Typhon user — they run at build time in the toolchain. Alerts 23/24/25. fast-uri 3.1.3 -> 3.1.4 (host confusion via literal backslash authority delimiter) and postcss 8.5.16 -> 8.5.25 (path traversal in sourceMappingURL auto-loading) were both in-range patch bumps. js-yaml was the awkward one: the top-level copy was already 4.3.0, and the vulnerable copy was a second one nested at node_modules/orval/node_modules/js-yaml, because orval 8.20.0 pins js-yaml to exactly 4.2.0 — no npm update could move it. orval 8.23.0 has moved its pin to 4.3.0 and our range is ^8.7.0, so bumping orval collapsed the nested copy entirely. No overrides entry needed. package.json untouched, every bump was already inside an existing range. Lockfile is net smaller since the duplicate js-yaml tree is gone. Verified: typecheck, lint, vite build, and 1584 vitest tests across 176 files all pass; zero vulnerable copies of the three packages remain in the lock. npm audit still reports 11 high, unchanged by this commit. They are largely one advisory (brace-expansion DoS) surfacing through the eslint 8.x chain plus vite-plugin-checker -> vscode-languageclient, and every fix is semver-major (eslint 10, vite-plugin-checker 0.14). GitHub has auto-dismissed the brace-expansion alert. That upgrade is a separate piece of work. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gcg4vW8vJ4QjNyj6NQabHs
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #602.
The
Typhon.Engine.Testsbuild closure carried 86 warnings with nothing gating them. The only guard was a hand-maintainedWarningsAsErrorslist of doc-comment codes (CS1570–CS1735) on two csprojs — which by construction could not catch anything outside that list.CS0419lives inCS04xx, so 47 instances accumulated unnoticed.Each of the four now carries
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>, replacing the doc-comment-only allow-list.Three findings that were not just noise
CS0436 was an architectural leak.
TraceEventGeneratorsynthesized its attribute surface viaRegisterPostInitializationOutput, which injects into every project referencing the generator as an analyzer — all of which also referenceTyphon.Engine, which exports the same types. Six projects were compiling ~130 lines of injected attribute source they had no use for, on every build. Declared once as real source inProfiler/public/TraceEventAttributes.csand dropped the post-init block; the generator resolves[TraceEvent]against it directly, since real source is always visible to generators. Verified withEmitCompilerGeneratedFilesthat it still emits all 410 producer files and no longer emitsTraceEventAttributes.g.cs.CA2014 ×11 was a real latent stack risk.
stackallocinside loops of 200–10 000 iterations.locallocis not released until the method returns, soSpatialPerfTestsgrew the stack by ~480 KB per run against a 1 MB default. Every size was loop-invariant and every element rewritten per iteration, so the buffers hoist without behaviour change. Two of them also sat inside theStopwatchregion — those benchmarks were timing a per-iteration stack bump.CS0279 ×2 hid a boxed enumerator.
ViewBase.GetEnumerator()isinternal(it returns the internalHashMap<long>.Enumerator) and theforeachcollection pattern requires public, so a bareforeachover anEcsView<T>silently fell back toIEnumerable<long>— boxed enumerator, interface dispatch per element. Switched to the public allocation-freeGetEntityEnumerator(). This trap is still live inTyphon.Benchmark(ParallelDispatchBenchmark.cs:200) and is open to any consumer.The rest
ref readonlyin the cref (.NET 9 changedInterlocked.Read/Volatile.Readto takeref readonly; plainreffails to resolve). Four references are to an overload set, which C# cannot cref — those use<c>rather than pointing at an arbitrary member.ArchetypeClusterState.cs:600claimedSetDirtytags wake requests viaDormancyReporter. Neither overload does; the sharedMarkEntityDirtyhelper does. Retargeted.DormancyTests.TearDownhidTestBase.TearDown. I suspected the base cleanup was being skipped (leaked engines, undeleted database bundles), checked empirically by running the fixture and inspecting%TEMP%\Typhon.Tests\DormancyTests— it was not skipped, NUnit invokes both. Converted to the suite'soverride+base.TearDown()convention anyway; ordering unchanged.TraceRingObserver.Namere-declared whatResourceNode.Namealready returns (the base ctor is passed the identical string). Deleted.ticksToRunconst; that loop is bounded by attempt count.InstantEvents.cs.Second commit — Dependabot alerts 23 / 24 / 25
All three were transitive dev-dependencies of the Workbench SPA, so nothing reached a Typhon user.
js-yaml was the awkward one: the top-level copy was already 4.3.0, and the vulnerable copy was a second one nested at
node_modules/orval/node_modules/js-yaml, because orval 8.20.0 pins js-yaml to exactly4.2.0— nonpm updatecould move it. orval 8.23.0 has moved its pin to4.3.0and our range is^8.7.0, so bumping orval collapsed the nested copy entirely. Nooverridesentry needed.package.jsonuntouched; the lockfile is net smaller.Verification
0 Warning(s) 0 Error(s)for all four gated projectsdotnet packcleantypecheck,lint,vite build, and 1584 vitest tests / 176 files all passFollow-ups (deliberately out of scope)
Typhon.Benchmark— 30 warnings (28 CA2014 same pattern, 1 CS0279 same view trap, 1 SYSLIB0054)Typhon.CompetitiveBenchmark— NU1903,SQLitePCLRaw.lib.e_sqlite3 2.1.11has a known high-severity advisory. Must be bumped before that project can be gated, becauseTreatWarningsAsErrorsalso promotes NuGet advisory warnings.npm auditstill reports 11 high, unchanged here — largely one advisory (brace-expansion DoS) surfacing through the eslint 8.x chain plusvite-plugin-checker→vscode-languageclient. Every fix is semver-major (eslint 10, vite-plugin-checker 0.14). GitHub has auto-dismissed the brace-expansion alert.Directory.Build.propsdefault rather than per-csproj repetition.dotnet build Typhon.slnx --no-incrementalfails onTyphon.Workbenchover a missing SPA bundle inwwwroot(the "bundles only viadotnet publish" quirk). Untouched by this PR.🤖 Generated with Claude Code
https://claude.ai/code/session_01Gcg4vW8vJ4QjNyj6NQabHs