fix(embedded-compile): purge workspace-clone pangea/architectures so the composer reloads#12
Open
drzln wants to merge 2 commits into
Open
fix(embedded-compile): purge workspace-clone pangea/architectures so the composer reloads#12drzln wants to merge 2 commits into
drzln wants to merge 2 commits 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.
…tures The deployed legacy path (PANGEA_GEM_MANIFEST unset) prepends the fresh gitRepository clone's _repo/lib to $LOAD_PATH, but `purge_for_workspace_compile` only dropped $LOADED_FEATURES entries under /var/pangea/gems/pangea-architectures-main/ — NOT the actual workspace clone lib (req.rubylib_paths). So the clone's pangea/architectures.rb stayed cached across compiles; `restore_purged_modules`' `require 'pangea/architectures'` no-op'd (require dedups by abs path); and the just-remove_const'd Pangea::Architectures never reloaded → `uninitialized constant Pangea::Architectures` (the rio pleme-io-opensource wedge — github_org_workspace.rb exists in the fresh clone but was never reachable because the parent module never reloaded). Fix: also purge `<rubylib>/pangea/architectures` for each workspace lib, so restore re-requires the composer from the fresh clone. Scoped to the composer subtree (NOT the whole lib, NOT /nix/store) so pangea-core/dry-struct/dry-types are untouched — no re-require stack-limit cascade (2026-05-28). Builds on feat/resolver-load-path-wiring (82c9c52).
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.
Completes the 82c9c52 composer-$LOAD_PATH fix (feat/resolver-load-path-wiring)
Symptom (rio):
pleme-io-opensourcecompile failsuninitialized constant Pangea::Architectures, wedging all org repo-posture reconcile.Root cause (traced via pod exec + the embedded evaluator): In the deployed legacy path (
PANGEA_GEM_MANIFESTunset), the fresh gitRepository clone's_repo/lib(which DOES containgithub_org_workspace.rb) is unshifted onto$LOAD_PATH, butpurge_for_workspace_compileonly dropped$LOADED_FEATURESentries under/var/pangea/gems/pangea-architectures-main/— not the actual workspace clone lib (req.rubylib_paths). So across compiles the clone'spangea/architectures.rbstays cached,restore_purged_modules'require 'pangea/architectures'no-ops (require dedups by absolute path), and the just-remove_const'dPangea::Architecturesnever reloads → undefined constant.github_org_workspace.rbexists in the fresh clone but is unreachable because its parent module never reloads.Fix: also purge
<rubylib>/pangea/architecturesfor each workspace lib, sorestore_purged_modulesre-requires the composer from the fresh clone. Scoped to the composer subtree (NOT the whole lib, NOT/nix/store/) so pangea-core / dry-struct / dry-types are untouched — avoids the 2026-05-28 re-require stack-limit cascade.Branched off
feat/resolver-load-path-wiring(82c9c52); merges with that work. Once an embedded image carrying this builds + the HelmRelease bumps to it,pleme-io-opensourcecompiles and creates kanchi/remessa.