-
Notifications
You must be signed in to change notification settings - Fork 946
refactor: component loading mechanism rewrite (V2) #10086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
davidfirst
wants to merge
15
commits into
master
Choose a base branch
from
refactor/component-loading-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+4,321
−689
Conversation
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
…DER_V2 feature flag
- Create WorkspaceComponentLoaderV2 class that wires all 6 phases together - Implements getMany() interface matching V1 loader for compatibility - Executes pipeline: Discovery → Resolution → Hydration → Enrichment → Assembly → Execution - Feature flag support: BIT_FEATURES=component-loader-v2 - Unified caching with explicit cache key computation - Detailed logging and profiling support - Export orchestrator from loader-v2/index.ts
- Wire V2 loader into Workspace class with BIT_FEATURES=component-loader-v2 - V2 currently delegates to V1 while full pipeline is developed - Feature flag mechanism working: logs '[V2] Using WorkspaceComponentLoaderV2' when enabled - Fix import paths and TypeScript errors in phases - Stub WorkspaceSource and update ScopeSource - All existing commands work with V2 enabled This establishes the foundation for V2 loader development. The architecture is in place (phases, sources, orchestrator) and the feature flag works. Next steps will be to implement the actual V2 pipeline logic.
Implements the complete V2 component loading pipeline with 6 phases: - Discovery: Find components in workspace/scope - Resolution: Build dependency-ordered load plan - Hydration: Load raw data from sources - Enrichment: Add env and dependency metadata - Assembly: Build Component objects - Execution: Run onComponentLoad slots Key improvements: - WorkspaceSource: Loads components from workspace filesystem - ScopeSource: Extracts extensions from Version object (component.head.extensions) - Graceful degradation: Components proceed even if enrichment fails - Feature flag: BIT_FEATURES=component-loader-v2 The V2 loader successfully loads both workspace and scope components. Enrichment failures for scope components result in warnings but don't prevent command completion.
- Fix ExtensionResolver to use workspace.componentExtensions with loadExtensions: false to avoid recursion when discovering env IDs - Add skipDependencyResolution option to prevent recursive workspace.get() calls through dependency resolution path - Restore proper load groups in Resolution phase (core-envs → envs → components) - Process LoadPlan phases sequentially through full pipeline to ensure envs are registered before dependent components - Add loadComponentsExtensions call to load external envs as aspects - Change default loadExtensions and executeLoadSlot to true (matching V1) - Add recursion prevention in EnvsMain.getEnvComponentByEnvId
The V2 loader was incorrectly marking all components as modified because the status check was using components with empty dependencies. Root cause: When status check called consumer.loadComponents(), an onComponentLoad subscriber called workspace.get() which triggered V2's skipDependencyResolution path, stripping dependencies from components. Fix: Pass originatedFromHarmony: true to status check's loadComponents() to bypass the subscriber and preserve full dependencies for accurate hash comparison.
V2 is now enabled by default. To use V1, set BIT_FEATURES=component-loader-v1
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.
Summary
RFC and implementation for rewriting the component loading mechanism. The current
WorkspaceComponentLoaderis ~1,000 lines of complex code that's hard to understand, modify, and debug.Key Problems Being Addressed
Approach: Strangler Fig Pattern
See
docs/rfcs/component-loading-rewrite/for full RFC, task tracking, and architecture decisions.