fix: convert component ID from hash to tag in graph building #10058
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
Fixes a bug where component IDs with snap/hash versions caused graph node lookup failures during lane merge operations from a bare scope.
The Issue
When merging main to a lane from a bare scope, some components are merged+snapped (diverged) while others are simply updated from main (not diverged, main is ahead). For the components that are only updated from main:
getSavedGraphOfComponentIfExist, the component is loaded with a hash versionflattenedEdgesin the Version object store dependency references with tag versions (e.g.,comp2@0.0.2)comp2@abc123...comp2@0.0.2source node comp2@0.0.2 does not existThe Fix
Converts the component ID from hash to tag (when a tag exists) before adding it as a graph node in
getSavedGraphOfComponentIfExist. This ensures consistency between:flattenedEdgesThe fix uses the existing
component.tags.byHash()method to efficiently look up the tag for a given hash without additional database queries.