Skip to content

refactor: move aspect-definition and policy-config types below the aspects that use them - #10773

Open
davidfirst wants to merge 5 commits into
masterfrom
refactor/phase3-core-contracts
Open

davidfirst wants to merge 5 commits into
masterfrom
refactor/phase3-core-contracts

Conversation

@davidfirst

@davidfirst davidfirst commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Phase 3 of the circular-deps cleanup. Dissolves the component / envs / dependency-resolver / aspect-loader / issues cycle group: 48 → 43 components in cycles, 168 → 156 edges. No new components.

  • AspectDefinition moves from aspect-loader to component (which already returns it from ComponentFactory.resolveAspects); @teambit/aspect-loader re-exports it.
  • The config-file policy types (EnvPolicyConfigObject & co, the env.jsonc policy shape) move from dependency-resolver to envs; @teambit/dependency-resolver re-exports them.
  • EnvPlugin and EnvJsoncDetector drop their implements PluginDefinition / implements DependencyDetector clauses, so envs no longer imports aspect-loader / dependency-resolver (the shapes are still checked where those aspects register them).
  • Component.getDependencies() / ComponentFactory.getDependencies() return a ComponentDependencyList type owned by component; Component.getDependencies() is deprecated in favor of DependencyResolverMain.getDependencies().
  • ComponentMain.dependencyResolver (set by the dependency-resolver at load) is replaced by registerPackageManifestFetcher(), the only thing bit show <package-name> needed from it.

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

Copy link
Copy Markdown

PR Summary by Qodo

Move aspect-loader and dependency-resolver contracts into leaf components

✨ Enhancement ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Move shared contracts into leaf components to break the component, envs, and resolver dependency
 cycle.
• Preserve aspect exports while narrowing Component’s dependency and package-manifest interfaces.
• Update the cycle baseline from 48 components and 168 edges to 43 and 156.
Diagram

graph TD
  Loader["Aspect Loader"] --> AC["Aspect Contracts"]
  Envs["Environments"] --> AC
  Envs --> DC["Resolver Contracts"]
  Resolver["Dependency Resolver"] --> DC
  Resolver --> Component["Component API"] --> AC
  Show["Show Command"] --> Component
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use one shared contracts component
  • ➕ Adds fewer components and centralizes contract discovery.
  • ➖ Couples unrelated harmony and dependency-policy contracts, making future dependencies less clear.

Recommendation: Keep the two domain-specific leaf components: they remove the reverse type dependencies without creating one catch-all contracts package. Retaining the existing aspect exports limits migration work for consumers.

Files changed (27) +412 / -262

Refactor (25) +381 / -239
component-dependencies.tsDefine component-owned dependency types +32/-0

Define component-owned dependency types

• Introduces structural dependency entry, manifest, and list types so Component no longer needs the dependency-resolver type.

scopes/component/component/component-dependencies.ts

component-factory.tsNarrow factory contract dependencies +4/-4

Narrow factory contract dependencies

• Uses the component-owned dependency list and the generic leaf aspect definition, bound to Component.

scopes/component/component/component-factory.ts

component.main.runtime.tsRegister a narrow package-manifest fetcher +18/-2

Register a narrow package-manifest fetcher

• Replaces the stored dependency-resolver instance with manifest-fetcher registration and access methods for Component commands.

scopes/component/component/component.main.runtime.ts

component.tsDeprecate Component dependency lookup +5/-2

Deprecate Component dependency lookup

• Returns the component-owned dependency-list type and directs callers needing the full list to DependencyResolverMain.

scopes/component/component/component.ts

index.tsExport component-owned contracts +6/-1

Export component-owned contracts

• Exposes the new dependency types and package-manifest fetcher type from the Component package.

scopes/component/component/index.ts

show.cmd.tsResolve package names through registered fetcher +1/-1

Resolve package names through registered fetcher

• Uses ComponentMain’s manifest-fetcher capability instead of accessing a dependency-resolver instance directly.

scopes/component/component/show/show.cmd.ts

dependency-resolver.main.runtime.tsRegister resolver as manifest fetcher +1/-1

Register resolver as manifest fetcher

• Registers the dependency resolver with ComponentMain for package-manifest fetching instead of assigning it to a public property.

scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts

detector-hook.tsRe-export detector contracts from leaf +6/-50

Re-export detector contracts from leaf

• Imports and re-exports detector context and interface types from the new contracts component while retaining the hook implementation.

scopes/dependencies/dependency-resolver/detector-hook.ts

env-policy.tsConsume leaf environment-policy types +16/-47

Consume leaf environment-policy types

• Replaces local environment-policy configuration definitions with imports and re-exports from dependency-resolver-contracts.

scopes/dependencies/dependency-resolver/policy/env-policy/env-policy.ts

policy.tsMove shared policy key types to leaf +7/-14

Move shared policy key types to leaf

• Imports the semver alias and re-exports it alongside policy configuration key types from the contracts component.

scopes/dependencies/dependency-resolver/policy/policy.ts

variant-policy.tsConsume leaf variant-policy types +14/-35

Consume leaf variant-policy types

• Moves variant-policy configuration shapes to the contracts component and preserves the existing re-exports.

scopes/dependencies/dependency-resolver/policy/variant-policy/variant-policy.ts

dependency-detector.tsDefine leaf dependency-detector contracts +51/-0

Define leaf dependency-detector contracts

• Houses the detector interface and file and dependency context types without requiring the dependency-resolver aspect.

scopes/dependencies/modules/dependency-resolver-contracts/dependency-detector.ts

index.tsExpose resolver contracts entry point +19/-0

Expose resolver contracts entry point

• Exports the detector and policy-configuration types for consumers of the new leaf component.

scopes/dependencies/modules/dependency-resolver-contracts/index.ts

policy-config.tsDefine leaf policy configuration shapes +97/-0

Define leaf policy configuration shapes

• Collects variant and environment policy types used in workspace and environment configuration files.

scopes/dependencies/modules/dependency-resolver-contracts/policy-config.ts

env-jsonc.detector.tsImport detector types from leaf +1/-1

Import detector types from leaf

• Changes EnvJsoncDetector’s type dependency from the resolver aspect to dependency-resolver-contracts.

scopes/envs/envs/env-jsonc.detector.ts

env.plugin.tsImport plugin contract from leaf +1/-1

Import plugin contract from leaf

• Uses the leaf PluginDefinition type instead of importing it from the aspect-loader aspect.

scopes/envs/envs/env.plugin.ts

environments.main.runtime.tsUse leaf environment and aspect contracts +3/-3

Use leaf environment and aspect contracts

• Imports policy and aspect-definition types from their leaf components and binds the aspect definition to Component.

scopes/envs/envs/environments.main.runtime.ts

env-runtime.tsBind env aspect definition to Component +2/-2

Bind env aspect definition to Component

• Imports the leaf AspectDefinition type and specifies Component as its generic parameter.

scopes/envs/envs/runtime/env-runtime.ts

api-for-ide.tsQuery full dependencies through resolver +1/-1

Query full dependencies through resolver

• Uses DependencyResolverMain directly for the IDE dependency response instead of Component’s deprecated lookup.

scopes/harmony/api-server/api-for-ide.ts

aspect-definition.tsPreserve Component-bound aspect exports +5/-49

Preserve Component-bound aspect exports

• Aliases the leaf AspectDefinition class and exposes Component-bound definition and props types through the existing package.

scopes/harmony/aspect-loader/aspect-definition.ts

aspect-loader.main.runtime.tsSpecify aspect definition component type +1/-1

Specify aspect definition component type

• Supplies Component as the generic parameter when constructing a local aspect definition.

scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts

plugin-definition.tsRe-export leaf plugin contract +1/-24

Re-export leaf plugin contract

• Preserves the aspect-loader import path while sourcing PluginDefinition from the new leaf component.

scopes/harmony/aspect-loader/plugin-definition.ts

aspect-definition.tsDefine generic leaf aspect definition +62/-0

Define generic leaf aspect definition

• Moves AspectDefinition into a leaf component and makes its held component generic, constrained only by an ID with a string representation.

scopes/harmony/modules/aspect-loader-contracts/aspect-definition.ts

index.tsExpose aspect-loader contracts entry point +3/-0

Expose aspect-loader contracts entry point

• Exports the generic aspect definition, its related types, and PluginDefinition.

scopes/harmony/modules/aspect-loader-contracts/index.ts

plugin-definition.tsHouse plugin definition in leaf +24/-0

House plugin definition in leaf

• Moves the PluginDefinition interface out of the aspect-loader aspect.

scopes/harmony/modules/aspect-loader-contracts/plugin-definition.ts

Other (2) +31 / -23
.bitmapRegister two leaf components +28/-0

Register two leaf components

• Adds aspect-loader-contracts and dependency-resolver-contracts to the workspace component map with their scopes and environment configuration.

.bitmap

cycles-baseline.jsonRemove dissolved cycle group from baseline +3/-23

Remove dissolved cycle group from baseline

• Drops the five-component cycle group and its edges, reducing the recorded totals from 48 to 43 components and 168 to 156 edges.

scripts/circular-deps-check/cycles-baseline.json

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

qodo-free-for-open-source-projects Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. New contracts use a different environment ✓ Resolved
Description
The .bitmap entries for both new contract modules explicitly select
teambit.node/envs/node-babel-mocha instead of the environment used by existing modules. The
harmony module siblings have no environment override and therefore use teambit.harmony/node, so
the new contracts receive a different build and test setup.
Code

.bitmap[R1028-1030]

+            "teambit.node/envs/node-babel-mocha@2.1.3": {},
+            "teambit.envs/envs": {
+                "env": "teambit.node/envs/node-babel-mocha"
Evidence
Rule 3 requires new non-aspect components to use the environment of their siblings. Both added
entries select node-babel-mocha, whereas the cited harmony sibling has no override and the
environment runtime falls back to teambit.harmony/node.

⚠️ This finding exceeds the comment size limit and was truncated; view the full findings in the Qodo portal.

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 52d337a 🧠 Deep

Results up to commit 0235ac6


🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)


Action required
1. New contracts use a different environment ✓ Resolved
Description
The .bitmap entries for both new contract modules explicitly select
teambit.node/envs/node-babel-mocha instead of the environment used by existing modules. The
harmony module siblings have no environment override and therefore use teambit.harmony/node, so
the new contracts receive a different build and test setup.
Code

.bitmap[R1028-1030]

+            "teambit.node/envs/node-babel-mocha@2.1.3": {},
+            "teambit.envs/envs": {
+                "env": "teambit.node/envs/node-babel-mocha"
Evidence
Rule 3 requires new non-aspect components to use the environment of their siblings. Both added
entries select node-babel-mocha, whereas the cited harmony sibling has no override and the
environment runtime falls back to teambit.harmony/node.

CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components: CLAUDE.md: Assign Appropriate Environments to New Components
.bitmap[1027-1032]
.bitmap[1090-1095]
.bitmap[1252-1258]
scopes/envs/envs/environments.main.runtime.ts[108-108]
scopes/envs/envs/environments.main.runtime.ts[696-698]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Both new contract modules explicitly use an environment that differs from existing harmony modules.
## Fix Focus Areas
- .bitmap[1027-1032]
- .bitmap[1090-1095]
## Recommended Fix
Remove the explicit node-babel-mocha environment configuration from both new contract entries so they use the same default environment as sibling modules.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. Module imports lose aspect definitions 🐞 Bug ≡ Correctness ⭐ New
Description
@teambit/component exports AspectDefinition from its TypeScript barrel but does not add it to
esm.mjs’s explicit named exports. When a consumer uses `import { AspectDefinition } from
'@teambit/component'`, the package’s Node import entry selects that wrapper and the import fails
because the named export is absent.
Code

scopes/component/component/index.ts[61]

+export { AspectDefinition } from './aspect-definition';
Evidence
The PR adds the runtime class to the component barrel, but the ES module wrapper enumerates exports
without it. The aspect environment routes Node imports to that wrapper, and package generation
applies those export settings.

scopes/component/component/index.ts[59-62]
scopes/component/component/esm.mjs[4-32]
scopes/harmony/aspect/aspect.env.ts[152-162]
scopes/pkg/pkg/pkg.main.runtime.ts[332-359]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new `AspectDefinition` export is available through the component barrel but missing from the package's ES module entry, so named ES module imports fail.
## Fix Focus Areas
- scopes/component/component/index.ts[61-62]
- scopes/component/component/esm.mjs[4-32]
## Recommended Fix
Add `export const AspectDefinition = cjsModule.AspectDefinition;` to the component's `esm.mjs` alongside its other runtime exports.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Optional peer metadata fails type-checking 🐞 Bug ≡ Correctness
Description
ComponentDependenciesManifest omits peerDependenciesMeta even though
ComponentDependencyList.toDependenciesManifest() describes the existing resolver method. When a
component has an optional peer dependency, callers of component.getDependencies() cannot access
that metadata without a type error, although the returned object contains it.
Code

scopes/component/component/component-dependencies.ts[R16-20]

+export type ComponentDependenciesManifest = {
+  dependencies: Record<string, string>;
+  optionalDependencies: Record<string, string>;
+  devDependencies: Record<string, string>;
+  peerDependencies: Record<string, string>;
Evidence
The new public manifest type lists four dependency maps but not peerDependenciesMeta. The
resolver's toDependenciesManifest() return type requires that field and populates it for optional
peers; both component factories return that resolver list through Component.getDependencies().

scopes/component/component/component-dependencies.ts[16-32]
scopes/dependencies/dependency-resolver/dependencies/dependency-list.ts[12-18]
scopes/dependencies/dependency-resolver/dependencies/dependency-list.ts[148-168]
scopes/component/component/component.ts[153-158]
scopes/workspace/workspace/workspace.ts[675-677]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The component-owned manifest type omits metadata returned for optional peer dependencies, preventing typed callers from accessing it.
## Fix Focus Areas
- scopes/component/component/component-dependencies.ts[16-21]
- scopes/dependencies/dependency-resolver/dependencies/dependency-list.ts[12-18]
## Recommended Fix
Add `peerDependenciesMeta` to `ComponentDependenciesManifest` with a shape matching the resolver's returned metadata.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational
4. Component main class gets a stray doc comment 🐞 Bug ⚙ Maintainability ⭐ New
Description
A JSDoc block reading "fetches the manifest of a package from the registry (implemented by the
dependency-resolver)" was left in front of class ComponentMain. Nothing sits between the comment
and the class except a blank line, so TypeScript attaches it to ComponentMain, and IDE hovers and
generated API docs describe the whole component aspect as a package-manifest fetcher.
Code

scopes/component/component/component.main.runtime.ts[R40-43]

+/**
+ * fetches the manifest of a package from the registry (implemented by the dependency-resolver).
+ */
+
Evidence
Lines 40-42 contain the JSDoc, line 43 is blank and line 44 declares export class ComponentMain.
No type alias follows the comment, so the comment either belonged to a type that was later moved to
PackageManifestFetcher in component-package-name, or it was never finished.

scopes/component/component/component.main.runtime.ts[40-45]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An orphaned JSDoc comment describing a package-manifest fetcher sits directly above `class ComponentMain`, so TypeScript and IDEs treat it as the class's documentation.

## Fix Focus Areas
- scopes/component/component/component.main.runtime.ts[40-43]

## Recommended Fix
Delete lines 40-43: the JSDoc block and the blank line after it. The `PackageManifestFetcher` type is already defined and documented in `components/modules/component-package-name/package-name-to-component-id.ts`, so if the comment is still wanted, move it to that type.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Plugins using richer dependency-list methods stop compiling ✓ Resolved
Description
Component.getDependencies() and ComponentFactory.getDependencies() now return the narrow
ComponentDependencyList type, which declares only dependencies, forEach, map and
toDependenciesManifest. At runtime they still return the dependency-resolver's full
DependencyList, so nothing changes in behaviour, but any aspect or env built outside this repo
that calls filter, findDependency, toTypeArray or another DependencyList method on the
result will fail type-checking once it upgrades @teambit/component.
Code

scopes/component/component/component.ts[R153-156]

+  /**
+   * @deprecated use `DependencyResolverMain.getDependencies(component)`, which returns the full `DependencyList`.
+   */
+  getDependencies(): ComponentDependencyList {
Evidence
The workspace and scope factories still return this.dependencyResolver.getDependencies(component),
which is a full DependencyList. That means only the declared public type got narrower. The new
interface leaves out every other DependencyList method, so code that passed type-checking against
the old public signature will no longer compile, even with the method marked deprecated.

scopes/component/component/component-dependencies.ts[27-32]
scopes/workspace/workspace/workspace.ts[675-677]
scopes/scope/scope/scope.main.runtime.ts[378-380]
scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts[440-449]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`Component.getDependencies()` changed its public return type from `DependencyList` to the smaller `ComponentDependencyList`. External aspects that call other `DependencyList` methods on the result will no longer compile.
## Fix Focus Areas
- scopes/component/component/component.ts[153-158]
- scopes/component/component/component-dependencies.ts[27-32]
## Recommended Fix
Either add the `DependencyList` methods that consumers commonly use (for example `filter`, `findDependency`, `toTypeArray`) to `ComponentDependencyList`, or call out the narrowing in the release notes and expand the `@deprecated` JSDoc so it states that callers who need other methods must switch to `DependencyResolverMain.getDependencies(component)`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Show-fragment doc comment now sits on the wrong method ✓ Resolved
Description
The new registerPackageManifestFetcher and getPackageManifestFetcher methods were inserted
between the existing register a show fragment... JSDoc and registerShowFragments. That leaves
two JSDoc blocks stacked on top of registerPackageManifestFetcher, and registerShowFragments no
longer has a doc comment, so IDE hovers and generated API docs describe the wrong method.
Code

scopes/component/component/component.main.runtime.ts[R159-162]

+  /**
+   * lets the commands of this aspect fetch package manifests, e.g. `bit show <package-name>`.
+   */
+  registerPackageManifestFetcher(packageManifestFetcher: PackageManifestFetcher) {
Evidence
Lines 156-158 hold the original show-fragment JSDoc. The PR adds a second JSDoc at 159-161 and the
new methods at 162-169, and registerShowFragments at line 171 is now undocumented.

scopes/component/component/component.main.runtime.ts[156-174]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new package-manifest-fetcher methods were inserted between the `registerShowFragments` JSDoc and the method itself. The doc comment now sits on the wrong method, and `registerShowFragments` has none.
## Fix Focus Areas
- scopes/component/component/component.main.runtime.ts[156-174]
## Recommended Fix
Put `registerPackageManifestFetcher`/`getPackageManifestFetcher` (and their JSDoc) above the `/** register a show fragment ... */` block, so that block sits directly above `registerShowFragments` again.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Context sources
Review mode: Auto: 🧠 Deep: Cross-cutting contract refactor spans multiple runtime paths and public APIs.

Grey Divider

Comment thread scopes/component/component/component.main.runtime.ts
@davidfirst
davidfirst force-pushed the refactor/phase3-core-contracts branch from a9f0228 to 4234181 Compare October 7, 2026 13:07
Comment thread .bitmap Outdated
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 4234181

@davidfirst
davidfirst force-pushed the refactor/phase3-core-contracts branch from 4234181 to 237b3ab Compare October 7, 2026 13:36
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 237b3ab

Base automatically changed from refactor/phase3-ui-runtime-decouple to master October 9, 2026 16:42
@davidfirst
davidfirst force-pushed the refactor/phase3-core-contracts branch from 237b3ab to 6fa4cbf Compare October 9, 2026 17:11
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 778ff9a

Comment thread scopes/component/component/component-dependencies.ts
Comment thread scopes/component/component/component.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 6fa4cbf

@davidfirst davidfirst changed the title refactor: move aspect-loader and dependency-resolver contracts to leaf components refactor: move aspect-definition and policy-config types below the aspects that use them Oct 9, 2026
Comment thread scopes/component/component/index.ts
Comment thread scopes/component/component/component.main.runtime.ts Outdated
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 0235ac6

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 52d337a

This branch has not been deployed

No deployments
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