Repository navigation
fix(envs): stop false "env was not loaded" warning on partial loads - #10713
Conversation
PR Summary by QodoPrevent false env-not-loaded warnings during partial and install loads
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1. Cached environments hide load failures
|
|
Code review by qodo was updated up to the latest commit 202da92 |
|
Code review by qodo was updated up to the latest commit f68c0a2 |
the `seeders` flag marks which components are returned to the caller, not which were requested - groups built from extension ids carry it too. key the mute on the requested ids instead, and let `_installModules` own the install-context flags so every caller gets them. reuse the existing AsyncLocalStorage idiom.
|
Code review by qodo was updated up to the latest commit 767ac42 |
|
Code review by qodo was updated up to the latest commit d4b2749 |
…-> 63) Merging master brings in the workspace-root aspect (#10698), which snapping and component-writer import and which imports @teambit/workspace - so it joins the workspace cycle. Its new specs, and the envs spec from #10713, import mock-workspace, which imports e2e-helper, pulling both in as well. Against that, removing the core envs from the workspace takes aspect and node out. Net +1.
Closes #10505.
Bit showed this warning on a healthy workspace:
The workspace was correct.
bit installdid not remove the warning.Two different causes give the same message.
1. Partial loads. The workspace loads components in groups. A group with
seeders: falseholds components that the user did not request. Bit loads them only because another component uses them as an aspect or an env. Bit schedules the env of such a component only when the user requests that component. Thus the env is correctly absent from the slot during this pass, and the warning is incorrect. For example,bit show <comp>warned about the env of the env of<comp>.bit statusdid not warn, because it requests all components.2. The install flow.
_installModulesloads the components before it loads the envs as aspects.install()setsinInstallContextto mute the warning during this time. ButuninstallDependenciesandupdateDependenciescalled_installModulesdirectly, and they did not set the flag. Thusbit uninstallandbit updateshowed the warning while they did the install that the warning recommends.Changes
EnvsMain.skipNotLoadedWarnings(fn)mutes the warning for the time offn. Use a scope, not a parameter: five aspects calculate the env during the load slot (tester, docs, pkg, compositions, dev-files). If you mute one caller, the warning moves to the next caller.uninstallDependenciesandupdateDependenciessetinInstallContext, asinstall()does.Results
A healthy workspace shows no warning for
bit show <comp>,bit uninstall,bit status,bit list.A broken env keeps its report.
bit statusshows the warning and the component issues.bit show <the env>shows the warning.bit show <comp>no longer warns when the env of the env is broken. The env of<comp>loads correctly in this condition. Bit reports the broken env where the user can correct it.New unit tests in
environments.main.runtime.spec.ts.