Skip to content

fix: Support Lineage Tracking for Top-Level and Nested Enums#58

Open
luthfifahlevi wants to merge 1 commit into
mainfrom
fix/handle-enum-lineage
Open

fix: Support Lineage Tracking for Top-Level and Nested Enums#58
luthfifahlevi wants to merge 1 commit into
mainfrom
fix/handle-enum-lineage

Conversation

@luthfifahlevi

@luthfifahlevi luthfifahlevi commented Jun 12, 2026

Copy link
Copy Markdown

Overview
This PR fixes a bug in the Stencil Lineage API where requesting lineage for an Enum FQN (e.g., gotocompany.events.DataTypes.Enum) incorrectly returned an empty result (downstream_count: 0).

The root cause was a blind spot in the AST root lookup engine. The findRootFQNs and collectFQNs functions were exclusively iterating over Message types (fd.GetMessageType()), meaning Enum definitions were never registered as valid vertices in the lineage graph. Consequently, the traversal skipped them entirely.

Key Changes

  • Top-Level Enum Support: Updated findRootFQNs to iterate over and index fd.GetEnumType(), ensuring file-level enums are registered in the graph lookup map.
  • Nested Enum Support: Updated the recursive collectFQNs function to iterate over and index msg.GetEnumType(), allowing enums nested inside parent messages to be accurately targeted.
  • Test Coverage: Added a dedicated descriptor builder (buildEnumDescriptorSetBytes) and subtest to verify that tracing downstream lineage starting directly from an Enum successfully identifies the parent messages and schemas that consume it.

Impact
This fix unlocks accurate downstream impact analysis for Enum modifications.

@luthfifahlevi luthfifahlevi self-assigned this Jun 12, 2026
@luthfifahlevi luthfifahlevi requested a review from mabdh June 12, 2026 04:05
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.

1 participant