Skip to content

fix(compiler): guard the aspect-load-fail cascade and the env grouping - #10687

Open
davidfirst wants to merge 4 commits into
masterfrom
fix/compiler-aspect-load-fail-guards
Open

fix(compiler): guard the aspect-load-fail cascade and the env grouping#10687
davidfirst wants to merge 4 commits into
masterfrom
fix/compiler-aspect-load-fail-guards

Conversation

@davidfirst

Copy link
Copy Markdown
Member

Three independent robustness fixes to the workspace compiler, extracted from #10465 so they can land on their own, with unit tests.

  • onAspectLoadFail: skip the recompile cascade when the failing aspect is not a workspace component. Compiling cannot materialize a package that is not installed, but the cascade first imports the aspect's whole dependency closure from the remote and recompiles a large part of the workspace into every injected node_modules copy - minutes of work for nothing. The regular missing-aspect handling reports it with a bit install remediation instead.
  • onAspectLoadFail: treat ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING like the other module-load failures. Node refuses to load a .ts file from node_modules, which happens when the loaded copy has only sources (e.g. re-created by the package manager mid-install) - compiling the component fixes it.
  • buildGroupsToCompile: filter out env ids that are not nodes on the given graph. Envs installed as packages are not part of the workspace graph, and successorsSubgraph throws on an unknown node.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Guard compiler recovery and environment graph grouping

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Prevent futile aspect recompilation for components absent from the workspace.
• Recover Node type-stripping load failures by compiling workspace aspects.
• Exclude package-only environments from graph traversal, with focused regression tests.
Diagram

graph TD
  A["Aspect load error"] --> B["Workspace compiler"] --> C{"Recoverable error?"} --> D{"Workspace member?"} --> E["Compile and retry"]
  D -->|No| F["Skip cascade"]
  B --> G["Environment grouping"] --> H["Graph-safe groups"]
Loading
High-Level Assessment

The localized boundary guards are the best approach: they validate workspace and graph membership immediately before expensive recovery or traversal while preserving existing compiler behavior. Broader installer or graph-layer changes would increase coupling and alter semantics outside these failure paths.

Files changed (2) +148 / -3

Bug fix (1) +25 / -3
workspace-compiler.tsGuard aspect recovery and environment graph traversal +25/-3

Guard aspect recovery and environment graph traversal

• Recognizes Node's unsupported node_modules type-stripping error as recoverable through compilation and skips recovery cascades for non-workspace aspects. Filters environment identifiers through graph membership checks before requesting successor subgraphs.

scopes/compilation/compiler/workspace-compiler.ts

Tests (1) +123 / -0
workspace-compiler.spec.tsAdd regression tests for compiler recovery and graph guards +123/-0

Add regression tests for compiler recovery and graph guards

• Adds unit coverage confirming recoverable workspace aspect failures trigger compilation while non-workspace and unrelated failures do not. Also verifies package-installed environment IDs are excluded from graph traversal and compilation grouping remains correct.

scopes/compilation/compiler/workspace-compiler.spec.ts

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can route each action level your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@davidfirst
davidfirst enabled auto-merge (squash) September 4, 2026 19:43
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.

2 participants