fix(isolator): keep capsule optimization dependency-closed - #10613
fix(isolator): keep capsule optimization dependency-closed#10613luvkapur wants to merge 3 commits into
Conversation
|
Circle validation completed:
This isolates lane reuse as the changed condition while keeping the patch source-identical between the two runs. |
PR Summary by QodoFix capsule optimization by enforcing a dependency-closed package boundary
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
|
Code review by qodo was updated up to the latest commit bf274b5 |
Proposed Changes
bit ci pr --keep-lanecoverage for unchanged components.Closes #10583.
Problem
Capsule optimization, introduced in #9820, avoids creating capsules for exported, built, and unmodified dependencies by installing their published packages instead.
The previous decision was made independently for each component:
That establishes package availability, but not whether the resulting dependency graph is safe.
A dependency still needs a capsule when it is:
This allowed a graph such as:
If
Bhad to remain a capsule, the publishedAcould still resolve its recorded package copy ofB, while another path loaded the currentBcapsule. JavaScript classes and module state are identified by runtime instance, not package name or semantic version. Two copies can therefore breakinstanceof, Harmony singletons, shared remotes, caches, and error recovery based on constructors.bit ci pr --keep-laneexposed this consistently because a reused lane can preserve artifacts from an earlier run while later runs rebuild only changed components.Fix
The package side of the optimized graph is now required to be dependency-closed:
The isolator now:
For example:
CcausesBto remain a capsule, which causesAto remain a capsule. Conversely, a subtree that is fully resolvable from the registry remains optimized:The closure is computed in
O(V + E)time using a reverse dependency map and a work queue.Behavioral Impact
O(V + E)temporary bookkeeping.Regression Coverage
The registry-backed regression constructs:
comp4is modified and must remain a capsule. Before the fix, registry-installedcomp3loaded its package copy ofcomp4, whilecomp1loaded the current capsule. Constructor identity failed with:After the fix, the capsule requirement propagates through
comp3andcomp2, and the test passes. The existing optimization test also proves that a registry-only subtree is still pruned.The keep-lane regression now verifies that a second PR run reuses the remote lane while preserving the exact head of an unchanged component.
Validation
pnpm exec tsc --noEmit.git diff --check.Circle validation used two source-identical runs: