Skip to content

fix(embedded-compile): purge workspace-clone pangea/architectures so the composer reloads#12

Open
drzln wants to merge 2 commits into
mainfrom
fix/architectures-feature-purge-workspace-lib
Open

fix(embedded-compile): purge workspace-clone pangea/architectures so the composer reloads#12
drzln wants to merge 2 commits into
mainfrom
fix/architectures-feature-purge-workspace-lib

Conversation

@drzln

@drzln drzln commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Completes the 82c9c52 composer-$LOAD_PATH fix (feat/resolver-load-path-wiring)

Symptom (rio): pleme-io-opensource compile fails uninitialized 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_MANIFEST unset), the fresh gitRepository clone's _repo/lib (which DOES contain github_org_workspace.rb) is unshifted onto $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 across compiles the clone's pangea/architectures.rb stays cached, restore_purged_modules' require 'pangea/architectures' no-ops (require dedups by absolute path), and the just-remove_const'd Pangea::Architectures never reloads → undefined constant. github_org_workspace.rb exists in the fresh clone but is unreachable because its parent module never reloads.

Fix: also purge <rubylib>/pangea/architectures for each workspace lib, so restore_purged_modules 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 — 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-opensource compiles and creates kanchi/remessa.

drzln added 2 commits June 2, 2026 13:47
…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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant