Skip to content

Conversation

@davidfirst
Copy link
Member

@davidfirst davidfirst commented Oct 30, 2025

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:

  1. The lane object stores component references with hash versions (lanes always use hashes, never tags)
  2. When building the dependency graph in getSavedGraphOfComponentIfExist, the component is loaded with a hash version
  3. However, the saved flattenedEdges in the Version object store dependency references with tag versions (e.g., comp2@0.0.2)
  4. Graph building fails because:
    • Node is added with hash key: comp2@abc123...
    • But edge references use tag: comp2@0.0.2
    • Error: source node comp2@0.0.2 does not exist

The 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:

  • The node keys in the graph
  • The edge references from flattenedEdges

The fix uses the existing component.tags.byHash() method to efficiently look up the tag for a given hash without additional database queries.

When building dependency graphs from saved flattenedEdges, component IDs
with hash versions were causing node lookup failures because flattenedEdges
store ComponentIDs with tag versions when available.

This fix converts the component ID from hash to tag (if a tag exists) before
adding it as a node to the graph, ensuring consistency between the node keys
and edge references.
@davidfirst davidfirst merged commit ff0e78c into master Oct 30, 2025
11 checks passed
@davidfirst davidfirst deleted the fix-lane-merge-hash-to-tag-conversion branch October 30, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants