Skip to content

Emit discovery-AST lineage into inventory.json (#62) - #81

Merged
matthewmoorcroft merged 1 commit into
integration/discoveryfrom
discovery/emit-lineage
Sep 15, 2026
Merged

matthewmoorcroft merged 1 commit into
integration/discoveryfrom
discovery/emit-lineage

Conversation

@matthewmoorcroft

@matthewmoorcroft matthewmoorcroft commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary: Surface each SourceGraph lineage block in the unified inventory without changing any pre-existing inventory keys.

Depends on: #84 and the main re-lands of #79 and #80.

Blocks: #62, #82, #77, #85.

Current status

This PR is merged into integration/discovery, not main (merge commit c42e47b). Its checks passed when merged. The staging code exposes lineage, but main does not.

The concrete staging change is in src/flowx/discovery_inventory.py:build_source_inventory: when graph.lineage is present, the per-pipeline entry gains a lineage block serialized by src/flowx/ir_serde.py:lineage_to_dict. A graph with lineage=None omits the key. src/flowx/discovery_serde.py:source_graph_from_dict provides the round-trip seam.

This preserves all existing pipeline/activity/summary fields. The ADF fixture inventory on staging carries the control edges produced by #80; reporting/coverage.py continues to read only its established keys.

What needs to change

Re-land this small emitter change on main after #79/#80 are re-landed on #84. Keep it additive and reuse the single shared lineage serializer; do not introduce a second inventory-specific encoding.

How to approach

Apply the conditional lineage projection in discovery_inventory.build_source_inventory and retain the existing omission behavior for lineage=None.

Acceptance/verification:

  • make test and make fmt pass.
  • An emitted lineage block equals discovery/IR shared serialization byte-for-byte and rehydrates to the original Lineage.
  • A graph without lineage omits the key rather than emitting null.
  • The ADF fixture aggregate lineage counts match the graph-derived results from Populate ADF data lineage + Switch-aware walking on the shared source AST (#62b) #80.
  • tests/resources/golden/adf_fixture_coverage.json stays green, proving existing consumer output is unchanged.
  • No changes to conversion, ir_serde's established encoding, dab_writer.py, or Airflow.

This is an additive inventory field only.

The source-agnostic inventory emitter serialized only
{source, source_dir, pipelines, summary} and dropped each graph's
SourceGraph.lineage, so the control/data edges #62b derived never reached
inventory.json.

Add an additive per-pipeline `lineage` block, placed beside each pipeline's
`activities` to mirror the shared discovery serde (where lineage is a per-graph
field). It is produced by the one shared serialiser
(flowx.ir_serde.lineage_to_dict, the same one discovery_serde consumes), so an
emitted block is byte-identical to the serde's and round-trips through
source_graph_from_dict. A graph with no derived lineage omits the key entirely,
leaving the historical consumer keys (coverage/results/dashboard/mcp read only
source/pipelines/activities/summary) untouched.

On the ADF fixtures this surfaces the 11 control edges / 0 data edges #62b
computed. Tests: a round-trip assertion via the shared serde, a
backward-compat assertion that a lineage-less graph omits the key, and an
aggregate count over the fixtures; the existing coverage golden still passes.

Co-authored-by: Isaac <no-reply@databricks.com>
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