fix(install): clear error when a component depends on an unpublished update-dependent#10427
fix(install): clear error when a component depends on an unpublished update-dependent#10427davidfirst wants to merge 9 commits into
Conversation
…update-dependent A visible workspace component can depend on a hidden lane update-dependent whose Ripple build failed (or never completed), so no package was published. bit install then failed with a cryptic pnpm 'No matching version found' for the unpublished 0.0.0-<hash>. Detect this up-front: for each checked-out component's snap dependency that is a lane update-dependent, not checked out, and whose local Version.buildStatus is not 'succeed', throw an actionable error suggesting 'bit import <id>' (which links it from source instead of fetching from the registry).
Code Review by Qodo
1. Hardcoded — in message
|
PR Summary by Qodofix(install): fail early on unpublished lane update-dependent dependencies WalkthroughsDescription• Detect hidden lane update-dependent snap deps that were never successfully built/published. • Fail bit install early with actionable error and bit import remediation. • Add e2e coverage for install failure on unpublished update-dependent cascade snaps. Diagramgraph TD
A["InstallMain._installModules"] --> B["Build manifests"] --> C["Check lane updateDependents"] --> D{"Unpublished update-dependent?"}
D -->|"yes"| E["Throw UpdateDependentBuildFailed"] --> F["User runs: bit import <id>"]
D -->|"no"| G["Run pnpm install"]
High-Level AssessmentThe following are alternative approaches to this PR: 1. Probe registry for package existence
2. Auto-import hidden update-dependents when needed
Recommendation: Current approach (local lane/updateDependents + local buildStatus gate with an explicit File ChangesEnhancement (1)
Bug fix (2)
Tests (1)
|
…hared CLI formatter Address review feedback: - A locally-stale pending/failed buildStatus could wrongly fail install when the remote already built/published the snap. Refresh the suspect versions from the remote (reFetchUnBuiltVersion) before deciding they're unpublished. - Use errorSymbol/formatItem from @teambit/cli instead of hardcoding the Unicode symbol, per the CLI output style guide.
|
Code review by qodo was updated up to the latest commit 16b5328 |
…t guard BuildStatus.Skipped is treated as 'built enough' elsewhere (onlyIfBuilt in scope-components-importer, sources.get), so the install guard now treats both Succeed and Skipped as built and won't report a Skipped update-dependent as unpublished.
|
Code review by qodo was updated up to the latest commit 7a54a97 |
…-manager failure Replace the pre-emptive per-install scan (which ran a dependency walk + remote refetch on every install) with a catch around the package-manager step: only when it fails with 'No matching version found' do we check whether the failing package is a component-dependency snap that isn't checked out, and if so surface the actionable 'bit import' message. Match against the package-manager error rather than lane.updateDependents, since the install's import phase may have already dropped the entry from the local lane object. This also removes the buildStatus/Skipped/refetch logic (the failure itself proves the package is unpublished), so there is zero overhead on successful installs. The e2e now uses the npm CI registry so the unpublished snap genuinely 404s.
|
Code review by qodo was updated up to the latest commit 8b4c264 |
…ager error bit import does not remove entries from lane.updateDependents (only snap/merge/reset and the explicit removeUpdateDependents command do, via addVersion). Fix the comment that wrongly attributed a missing entry to the import phase; the real reason to match the package-manager error is that it pinpoints the failing version and a consumer can keep pinning a never-published snap after the entry was promoted out of updateDependents.
|
Code review by qodo was updated up to the latest commit 704078f |
… error The matcher keys off the package-manager 'No matching version found' error, not lane.updateDependents membership, so it can legitimately fire for any snap dependency that isn't checked out and was never published (e.g. after a reset that rewound a component to a never-published snap). Reword the message to name that as the likely cause rather than asserting the component is an update-dependent. Rename the payload type FailedUpdateDependent -> UnpublishedSnapDependency accordingly.
|
Code review by qodo was updated up to the latest commit dff5520 |
|
Code review by qodo was updated up to the latest commit b85689b |
…M_NO_MATCHING_VERSION Previously enrichUnpublishedSnapDepError rewrote any install failure whose message mentioned the package+snap-hash, which could mask auth/network/FETCH_404/outage failures. Gate on the pnpm error code (carried on err.cause by pnpmErrorToBitError) — only ERR_PNPM_NO_MATCHING_VERSION is the unpublished-snap signal, matching the repo convention in lockfile-deps-graph-converter. Also drop the hardcoded em dash from the error message.
|
Code review by qodo was updated up to the latest commit 8949353 |
Problem
A visible workspace component can depend on a hidden lane
updateDependentsentry (created by "snap updates" / Ripple). Those entries aren't checked out, so a dependent must fetch them from the registry as a package — but a package only exists once Ripple built the entry successfully. When the build failed (or never completed),bit installdied with a cryptic pnpm error:Fix
After manifests are built and before pnpm runs, check each checked-out component's snap dependencies: if a dep is in
lane.updateDependents, isn't checked out, and its localVersion.buildStatusisn'tsucceed, throw an actionable error instead:Checked-out components are skipped (they're linked from source, not fetched), so the suggested
bit importremediation makes the next install succeed.Adds e2e scenario 21 to
update-dependents-cascade.e2e.ts.