fix: prevent unreachable!() panic in decode when pkgs checkout is absent - #1087
Merged
twitchyliquid64 merged 1 commit intoJul 29, 2026
Merged
Conversation
The annotate_record! macro assumed a build-spec-annotated term is always a Term::RecRecord and hit unreachable!() on anything else. When --minimal-dir points at a directory with no upstream pkgs checkout, the spec field survives as an unresolved Term::Var, so `min init` and `min add` aborted with an internal-error panic at load.rs:345 on the host-side build plane. Return the original value unchanged for non-record terms, leaving them unannotated, so evaluation surfaces a real error instead of panicking. This mirrors the existing minimal-library skip branch in the same macro. The `_` arm was previously reachable only via the panic, so no working flow depends on the old behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe loader now leaves non-record build-spec annotations unchanged instead of panicking. A regression test covers annotations applied through a variable reference. ChangesBuild-spec annotation handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Suggested reviewers: Poem
✨ Finishing Touches📝 Generate docstrings
Comment |
twitchyliquid64
approved these changes
Jul 29, 2026
twitchyliquid64
marked this pull request as ready for review
July 29, 2026 22:12
twitchyliquid64
deleted the
inbox-patch/decode-var-buildspec-panic-93767d4485e1ef40
branch
July 29, 2026 22:12
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.
Fixes #1066
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABKsihnA
min init/min addpanicked withunreachable!()atload.rs:345when
--minimal-dirhad no upstreampkgscheckout:annotate_record!assumed a build-spec term is always
Term::RecRecord, but with thecheckout absent the
specfield stays an unresolvedTerm::Varand hitsthe fallthrough panic. The fix returns the term unchanged for non-record
shapes (mirroring the macro's existing minimal-library skip arm), so
evaluation reports a real error instead of aborting; that arm was only
ever reached via the panic, so no working flow regresses. Added a
regression test reproducing the exact
Var(spec)shape (informed by #81).Verification
cargo fmt --all --check — clean, no drift
cargo clippy --workspace --locked -- -D warnings — 0 warnings
cargo build --workspace --locked — Finished, exit 0
cargo test --workspace --locked — 0 failed; decode 57/57 incl. loader_annotates_buildspec_via_var
Note
Fix
unreachable!()panic inannotate_recordmacro when annotated term is not a recordWhen a build-spec annotation sits on a non-record term (e.g.,
Term::Var), theannotate_recordmacro previously hit anunreachable!()panic. The macro now returnsOk(orig_val)instead, allowing evaluation to surface the error rather than aborting. A regression test in load.rs confirms that a spec referencing a variable no longer causesLoader::newto panic.Macroscope summarized f480ef4.
Summary by CodeRabbit