fix(compile): resolve workspace $LOAD_PATH via magma-rubygems (composer double-copy)#11
Open
drzln wants to merge 1 commit into
Open
fix(compile): resolve workspace $LOAD_PATH via magma-rubygems (composer double-copy)#11drzln wants to merge 1 commit into
drzln wants to merge 1 commit into
Conversation
…omposer double-copy)
Fixes `uninitialized constant Pangea::Architectures` on the
pleme-io-opensource compile. Root cause: pangea-architectures (the
composer) exists twice on disk — the gem-cache ArchitectureGem clone
(/var/pangea/gems/pangea-architectures-main/) AND the template's own
_repo clone (the source IS the pangea-architectures repo). The sentinel
put _repo/lib on $LOAD_PATH, but the per-compile purge prefix only
covers the gem-cache copy. After the Pangea::Architectures module purge,
the _repo/lib $LOADED_FEATURES entry survived, `require` no-op'd, and the
constant stayed undefined.
Fix: resolve the workspace Gemfile.lock into a deterministic,
dependency-ordered $LOAD_PATH closure via magma-rubygems
(resolve_ruby_env_for_roots), so the composer resolves to ONE canonical
copy — the gem-cache clone the purge prefix matches.
- template_controller::resolve_workspace_load_path: locate the sibling
Gemfile.lock, parse, roots = PATH-sourced gems (excludes rubygems
dev/test gems the image doesn't bundle), CompositeLocator =
ManifestLocator(baked gems) ▸ GemRootsLocator(gem cache). Gated on
PANGEA_GEM_MANIFEST: absent ⇒ legacy single-_repo/lib, zero regression.
A missing closure gem is a typed MissingGems compile failure, not a
deep LoadError.
- flake.nix: emit the baked-gem name→lib manifest (pangeaInputs path-gems
+ RubyGems-enumerated bundler gems), bake into the image, set
PANGEA_GEM_MANIFEST.
- owner.rs: widen the rubylib validation trusted roots to {workspace
base, gem cache, /nix/store} so the resolver's multi-root closure is
admitted.
- Cargo.toml: branch-pin the 14 magma git deps to feat/load-path-resolver
(revert to main after magma PR #1 merges); magma-rubygems made
non-optional (the embedded compile path uses it unconditionally).
cargo check (embedded_ruby) green; magma advance f92bacb..dd89751 compatible.
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
uninitialized constant Pangea::Architectureson the pleme-io-opensource compileRoot cause:
pangea-architectures(the composer) exists twice on disk — the gem-cacheArchitectureGemclone (/var/pangea/gems/pangea-architectures-main/) and the template's own_repoclone (the template source is the pangea-architectures repo). The sentinel put_repo/libon$LOAD_PATH, butcompile_template's per-compile purge prefix only covers the gem-cache copy. After thePangea::Architecturesmodule purge, the_repo/lib$LOADED_FEATURESentry survived →requireno-op'd → the constant stayed undefined.Fix: resolve the workspace
Gemfile.lockinto a deterministic, dependency-ordered$LOAD_PATHclosure viamagma-rubygems(resolve_ruby_env_for_roots), so the composer resolves to one canonical copy — the gem-cache clone the purge prefix matches.Changes
template_controller::resolve_workspace_load_path— locate siblingGemfile.lock, parse,roots= PATH-sourced gems (excludes rubygems dev/test gems the image doesn't bundle),CompositeLocator=ManifestLocator(baked)▸GemRootsLocator(gem cache). Gated onPANGEA_GEM_MANIFEST: absent ⇒ legacy single-_repo/lib, zero regression. A missing closure gem is a typedMissingGemscompile failure, not a deepLoadError.flake.nix— emit the baked-gemname→libmanifest (pangeaInputs path-gems + RubyGems-enumerated bundler gems), bake into image, setPANGEA_GEM_MANIFEST.owner.rs— widen rubylib validation trusted roots to {workspace base, gem cache,/nix/store}.Cargo.toml— branch-pin 14 magma deps tofeat/load-path-resolver(revert after magma#1 merges);magma-rubygemsnon-optional.Depends on
pleme-io/magma#1 — the resolver primitive (64 tests).
Verification
cargo check --features embedded_rubygreen; magma advancef92bacb..dd89751compatible;gen buildregeneratedCargo.build-spec.json.🤖 Generated with Claude Code