Skip to content

fix(envs): treat empty-env as a core env so bit install skips its package - #10711

Merged
davidfirst merged 4 commits into
masterfrom
fix/empty-env-core-env
Sep 15, 2026
Merged

davidfirst merged 4 commits into
masterfrom
fix/empty-env-core-env

Conversation

@davidfirst

@davidfirst davidfirst commented Sep 15, 2026

Copy link
Copy Markdown
Member

teambit.harmony/empty-env is a core aspect, but it was not in the core-envs list. Because of this, bit install handled it as an external env. It added the @teambit/empty-env package to the env root and pulled the whole Bit core into the workspace (3187 packages instead of 2). The dependency-resolver and dev-files guards also fetched the env component from the remote on each load.

This change adds empty-env to getCoreEnvsIds().

The same line was added and then reverted in July, before #10535 was merged, with the note "it breaks env loading for the component". I reproduced what the revert saw. In the bit repo itself, bit show teambit.harmony/empty-env now reports its own env (core-aspect-env) as "not loaded". This is the existing load-groups behavior for every core env in this repo: bit show teambit.react/react, teambit.harmony/node and teambit.harmony/aspect report the same warning on master. The component still compiles and builds. The bit_pr job on this PR compiled and snapped empty-env with the other 97 dependents. The remove-core-envs branch (#10465) returns only empty-env from getCoreEnvsIds() and passes full bit ci pr --build runs with it.

A unit test in the install aspect makes sure that no env package is added to the env root for empty-env. It does not assert anything about the other core envs, so it stays valid after #10465.

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

Copy link
Copy Markdown

PR Summary by Qodo

Recognize empty-env as a core environment

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Classifies teambit.harmony/empty-env as a core environment across environment guards.
• Prevents install roots from fetching empty-env’s package and transitive Bit core.
• Adds regression coverage for package omission from core environment manifests.
Diagram

graph TD
  A["Empty Env"] --> B["Core env registry"] --> C["Core env guards"] --> D["Install manifest"]
  C --> E["Policy and dev-files"]
  T["Install regression test"] -.-> D
Loading
High-Level Assessment

The centralized core-environment list is the correct fix because every existing isCoreEnv guard receives consistent behavior. An install-only exception was considered but would leave dependency-policy and dev-file remote lookups incorrect.

Files changed (2) +42 / -3

Bug fix (1) +5 / -3
environments.main.runtime.tsRegister empty-env as a bundled core environment +5/-3

Register empty-env as a bundled core environment

• Adds 'teambit.harmony/empty-env' to the core environment ID list. This prevents install, dependency-policy, and dev-file paths from treating the bundled aspect as an external environment.

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

Tests (1) +37 / -0
install.main.runtime.spec.tsTest core environment package omission +37/-0

Test core environment package omission

• Adds an InstallMain regression suite using a mocked workspace. It verifies both node and empty-env return no package dependency for their environment root manifests without running a package installation.

scopes/workspace/install/install.main.runtime.spec.ts

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

qodo-free-for-open-source-projects Bot commented Sep 15, 2026

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 reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit e618fab ⚖️ Balanced

Results up to commit 00abf7d


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

Great, no issues found!

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

Grey Divider

Qodo Logo

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

Copy link
Copy Markdown

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

@davidfirst
davidfirst enabled auto-merge (squash) September 15, 2026 19:39
@davidfirst
davidfirst merged commit 618dd6a into master Sep 15, 2026
14 checks passed
@davidfirst
davidfirst deleted the fix/empty-env-core-env branch September 15, 2026 21:16
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