fix: -Wsafe-init checker hangs forever on test compilation - #16
Merged
Conversation
This was referenced Aug 10, 2026
Open
Closed
CI's "Run tests" step has been hanging indefinitely (confirmed 50+ min, not just slow) on every branch that reaches the test-compile stage. Thread-dumped the stuck Bloop/dotc process: the compiler thread was pinned at 100% CPU for 10+ minutes inside dotty.tools.dotc.transform.init.Semantic$$anon$1.traverse, recursing through TypeAccumulator.foldOver -- the -Wsafe-init object-init checker walking a type graph it never finishes. Verified: with -Wsafe-init removed, `scala-cli compile . --test` finishes in ~25s (down from a 150s timeout with no progress), and the full test suite runs to completion. This is a compiler-side static check, not a runtime guarantee, so removing it doesn't change what the code actually does -- it just stops the checker from blowing up on the inline-derivation-heavy code introduced by the recent macro-to-inline refactor. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
GoldenFixtureSuite reads fixtures/*.json via a path relative to the process working directory. CI's other steps run from the outer checkout root (mrpc/made/mcodec are sibling directories there), so the bare `scala-cli --power test mrpc` command left the fixture lookup resolving against the wrong directory, failing 5 tests with FileNotFoundException. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ntax
Root cause of the "Run tests" failures wasn't a version mismatch (made
0.3.0's real API still has everything mrpc needs) - it was that ci.yml
pinned a made commit (16bfbdb) 37 commits behind v0.3.0, missing:
- getAllAnnotations entirely (added in c5a98e5/d361b36)
- containsOnly evidence for Tuple.Tail/Reverse/Concat/Zip (ad6f7a4/713d57a),
which mrpc's recursive tuple-walking macros (RpcNames, OpPlan,
MetadataDerivation, Plans) depend on to chain containsOnly evidence
across `.tail` calls
- InputElem.ExtractLabel (24800ec)
Bumping the pin to v0.3.0 (a61445c) picks up all three, purely additive
per the made-side diff (no removed/renamed members between the two).
The one real mrpc-side fix: made's getAllAnnotations is an extension
method (`self.getAllAnnotations[A]`), not a positional function
(`getAllAnnotations(self)(using ...)[A]`) - MetadataDerivation.allTerms
was calling it the old way.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mcodec's old pinned commit predates made's getAnnotation Option[A] -> A | Null change (same root cause as the made pin bump in the previous commit). Repointing to the fix branch until halotukozak-com/mcodec#4 merges. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…T vs 0.1.3-done-SNAPSHOT) project.scala requested made:0.2.1-SNAPSHOT while ci.yml published the pinned made commit locally as 0.1.3-done-SNAPSHOT - neither resolved to the other, so CI's "Run tests" step failed on every commit regardless of content. Aligning both on 0.3.0 per the repo owner's direction. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
halotukozak
force-pushed
the
fix-wsafe-init-hang
branch
from
August 10, 2026 07:38
56a9452 to
784e926
Compare
…n project.scala is stale)
…sh entirely Both are properly released now (made v0.3.0, mcodec v0.1.0, the latter including the made-0.3.0 compat fix from mcodec#4). No more pinned commits, no more publishLocal dance.
halotukozak
added a commit
that referenced
this pull request
Aug 10, 2026
…n tests AsRawReal.scala fully-qualified mrpc.Fallback but AsRaw.scala/AsReal.scala didn't import it at all - never caught locally because the CI test hang (fixed in #16) meant this branch was never actually compiled end to end until now. Also marks the intentionally-shadowed Fallback givens in FallbackSuite/ MetadataFallbackSuite's "normal given wins" tests as @unused - their presence-but-non-resolution is exactly what's being asserted, which -Wunused:all -Werror otherwise flags as dead code. Verified: full `scala-cli test .` passes (0 failed except the pre-existing, already-documented AnnotationCaptureSuite issue from #16). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
halotukozak
added a commit
that referenced
this pull request
Aug 10, 2026
…n tests AsRawReal.scala fully-qualified mrpc.Fallback but AsRaw.scala/AsReal.scala didn't import it at all - never caught locally because the CI test hang (fixed in #16) meant this branch was never actually compiled end to end until now. Also marks the intentionally-shadowed Fallback givens in FallbackSuite/ MetadataFallbackSuite's "normal given wins" tests as @unused - their presence-but-non-resolution is exactly what's being asserted, which -Wunused:all -Werror otherwise flags as dead code. Verified: full `scala-cli test .` passes (0 failed except the pre-existing, already-documented AnnotationCaptureSuite issue from #16). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
CI's "Run tests" step has been hanging indefinitely on every branch that reaches test compilation (confirmed stuck 50+ minutes, not just slow — this is what was blocking PR #5 and would have blocked #3/#4/#6/#9/#10 too once they got past formatting).
Root-caused by thread-dumping the stuck Bloop/dotc process: the compiler thread was pinned at 100% CPU for 10+ minutes inside
dotty.tools.dotc.transform.init.Semantic$$anon$1.traverse, recursing throughTypeAccumulator.foldOver— the-Wsafe-initobject-initialization checker walking a type graph it never finishes on. Verified it's not the other debug flags (-Xprint-inline,-Ycheck:all, etc.) — stripping those alone still hung identically; only removing-Wsafe-initfixed it. (Independently cross-checked viagit bisecton the same symptom: the underlying complexity trigger is commit7a3c644"make RpcNames with no macros," which replaced a single macro-time computation with type-level match-type recursion inRpcNames.scala— that's what-Wsafe-init's checker chokes on whenever a trait has all three arities, fire+call+get, present at once, e.g.SampleApi.)-Wsafe-initis a compile-time-only static check (catches unsafe access to not-yet-initialized fields); it doesn't change runtime behavior, so disabling it doesn't remove any actual guarantee the code relies on — it just stops the checker itself from blowing up on the inline-derivation-heavy code from the recent macro→inline refactor.Also folded in three more independently-diagnosed CI-only fixes needed for tests to actually reach green after the hang is gone:
made/mcodecversion-pin mismatch:project.scalarequestedmade:0.2.1-SNAPSHOTwhile CI published the pinned commit locally as a different label (0.1.3-done-SNAPSHOT/stale SHA) — bumped both tomade:0.3.0(a61445c, the realv0.3.0tag) and fixedMetadataDerivation'sgetAllAnnotationscall site to that version's extension-method syntax.mcodec's pinned commit predatedmade'sgetAnnotation: Option[A] -> A | Nullchange — repointed tohalotukozak/mcodec#4(a one-line fix already opened there) until it merges.GoldenFixtureSuitereadsfixtures/*.jsonrelative to the process working directory; CI's other steps run from the outer checkout root (mrpc/made/mcodec are siblings there), so the barescala-cli --power test mrpcleft that resolving against the wrong directory. Addedworking-directory: mrpcto the test step.Test plan
scala-cli compile . --testfinishes in ~25s (down from indefinite hang / 150s timeout with zero progress).scala-cli test .suite runs to completion. One pre-existing failure surfaced (AnnotationCaptureSuite) — unrelated to this change: that suite is a WIP scaffold with everytest(...)commented out as//todo, and its class-body destructuring ofdone.operationsthrows at construction time. Not touched here.🤖 Generated with Claude Code