Agentic insights: intent + cross-pipeline relationships in the discover inventory - #42
Open
matthewmoorcroft wants to merge 8 commits into
Open
Agentic insights: intent + cross-pipeline relationships in the discover inventory#42matthewmoorcroft wants to merge 8 commits into
matthewmoorcroft wants to merge 8 commits into
Conversation
matthewmoorcroft
force-pushed
the
pr/discover-lineage
branch
from
September 1, 2026 10:44
efa1962 to
dc90650
Compare
matthewmoorcroft
marked this pull request as ready for review
September 1, 2026 12:17
Rewrite internal package-proxy URLs (pypi-proxy.dev.databricks.com) to pypi.org / files.pythonhosted.org so public CI resolves deps. Same pinned versions and hashes; matches main. Co-authored-by: Isaac <no-reply@databricks.com>
…he unified base Reconciles the agentic-insights work with its base (#36) via merge, no history rewrite. The insights branch was an initial port predating the engine -> sources/adf restructure and #36's lineage + reporting schema-evolution work, so the merge resolves to: - #36's canonical lineage / dataset-resolver files (the insights branch's near-identical duplicates are dropped in favour of the base), keeping only the insights payload: pipeline_insights, the insight AST models, and the MCP / adapter / reporting wiring. - execute_pipeline.py + test_pipeline_insights.py: imports repointed to the new layout (flowx.sources.adf.translators.resolve, flowx.sources.adf.loader). - test_pipeline_insights.py guarded with pytest.importorskip("mcp") so CI -- which does not install the optional mcp extra -- skips it, matching test_mcp_migrate / test_mcp_source_routing. - reporting/results.py: full _STRING_METRICS / _FLOAT_METRICS classification restored (only has_insights is new), fixing the int() crash on string / float coverage columns. - test_reporting_results.py: expects the base's CREATE -> SHOW COLUMNS -> INSERT sequence. Full unit suite: 1306 passed with the mcp extra; 1224 passed / 3 skipped without it. make fmt + mypy clean. Co-authored-by: Isaac <no-reply@databricks.com>
Airflow is now a first-class deterministic source, so the insights layer should apply to both. The engine (parser/pipeline_insights.py) and the enrich command were already source-neutral (they operate on the inventory dict); this closes the two remaining ADF couplings: - Move the insight models (Insights, PipelineInsight, PipelineRelationship, LineageEdgeRef, RecommendedPattern, SystemRecommendation) out of the ADF AST module into a source-neutral models/insights.py -- they are used only by the tests, the runtime path is dict-based. Update the test import. - flowx-discover SKILL.md Step 5: keep the neutral authoring core (schema, sparse/ranked philosophy, edge-accountability model, Databricks target vocabulary) shared, and branch the two genuinely source-specific pieces by --source: the source deep-dive (ADF ARM *.arm.json vs Airflow DAG source) and the pattern vocabulary (ADF constructs table + new Airflow operators table). Neutralise incidental ADF wording in the edge-authoring rules. Out of scope: emitting deterministic lineage from sources/airflow (tracked separately). Until then an Airflow inventory has no lineage block, so only per-pipeline insights and inferred edges validate there -- control/data annotation edges degrade gracefully, no change needed here. Full unit suite: 1306 passed with the mcp extra; 1224 passed / 3 skipped without it. make fmt + mypy clean. Co-authored-by: Isaac <no-reply@databricks.com>
Follow the discover skill's own hub-and-spoke convention (SKILL.md: "the shared
mechanics live here"; Step 2: "read the matching sources/<source>.md and follow
it"). The insights authoring step had inlined ADF/Airflow specifics into the
shared SKILL.md.
- SKILL.md Step 5 keeps the source-neutral core (schema, analysis method, pattern
framework, edge model, enrich) and now points to the source guide for the source
deep-dive and the construct->Databricks pattern vocabulary. Marked the step
explicitly source-neutral ("runs for every source").
- sources/adf.md and sources/airflow.md each gain an "Insights -- deep-dive &
pattern vocabulary" section (ARM *.arm.json / DAG-source deep-dive + the
source-construct pattern table) and a pointer back to the shared authoring step.
This also wires insights for Airflow: an Airflow run follows sources/airflow.md
(per Step 2 routing), which now carries the source deep-dive + pattern table and
routes to the shared authoring+enrich step. Previously that step lived only inside
SKILL.md's ADF-specific ## Workflow, so an Airflow run never reached it.
Docs only; unit suite unchanged (1224 passed / 3 skipped without the mcp extra).
Co-authored-by: Isaac <no-reply@databricks.com>
The branch had re-introduced a monolithic ADF-specific `## Workflow` into skills/flowx-discover/SKILL.md (518 lines), which main had already decomposed into a source-neutral hub (80 lines) + per-source guides. Merging as-is would have reverted main's decomposition of this one skill; every other flowx skill already matched main. Rebuild SKILL.md on main's clean hub (Identify source -> Follow source guide -> How to run -> Output artifacts (shared) -> Reference) and add ONE shared section, "Author and merge agentic insights (all sources)", holding the source-neutral insight core (schema, analysis method, pattern framework, edge model, enrich). An Airflow run now loads zero ADF walkthrough into context. Preserve the two pieces of new value that lived only in the monolith by moving them into the source guides: - sources/adf.md: the inventory `lineage` block + its explanation, and the insights read-back in the summary step. - sources/airflow.md: the insights read-back, plus a note that Airflow inventories carry no `lineage` block yet (so cross-DAG relationships use `inferred` edges). Docs only; unit suite unchanged (1224 passed / 3 skipped without the mcp extra). Co-authored-by: Isaac <no-reply@databricks.com>
Deterministic lineage (the inventory `lineage` block) is owned by the separate lineage PR that #42 builds on top of; it is not #42's to document. The previous commit had pulled the `lineage` block + its explanation into sources/adf.md and a lineage-state note into sources/airflow.md -- scope creep into the lineage PR. Revert both: sources/adf.md's inventory example returns to main's (no `lineage` block) and the airflow.md discovery step drops the lineage note. The discover docs on this branch are now main + insights-only additions. The shared insights authoring section still *consumes* lineage (the annotation vs inferred edge model resolves against `lineage.control_edges` / `data_edges`) -- a dependency on the lineage PR, not documentation of it. Docs only; unit suite unchanged (1224 passed / 3 skipped without the mcp extra). Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Agentic insights: intent + cross-pipeline relationships in the discover inventory
Closes #25
What this adds
An optional agentic insights layer on top of the deterministic discover inventory. After
discoverwritesmetadata/inventory.json(pipelines, summary, deterministic lineage), an agent authors aninsightsobject capturing judgment the deterministic pass can't derive, andflowx enrichvalidates it and merges it back under a singleinsightskey.recommended_patterns(≤4, each flagged as a genuine simplification or a like-for-like port), conversion notes, and risk-if-ignored.lineage_edge.New source-neutral models in
models/insights.py(Insights,PipelineInsight,PipelineRelationship,LineageEdgeRef,RecommendedPattern,SystemRecommendation), aparser/pipeline_insights.pyengine, anenrichcommand on both the adapter CLI and the MCP server, and ahas_insightscolumn in the coverage results table.How it works
The tool contains no LLM. The agent authors the JSON;
pipeline_insights.pyonly validates and merges, so the deterministic inventory stays trustworthy and every insight is accountable.enrich(CLIenrich --insights-path, or MCPenrichwith an inline dict) runsenrich_inventory, which:validate_insights):pipelineand every relationship endpoint must be a real pipeline name in the inventory.lineage_edgeis validated in two tiers:control/data— an annotation of a deterministic edge:edge_identitymust resolve to a realControlEdge.activity_name(control) orDataEdge.match_key(data) already in the inventory'slineage;evidence/confidencemust be omitted.inferred— a coupling the deterministic layer never found (e.g. data flow buried in notebook code): nothing to resolve against, so it must carry a non-emptyevidencestring and aconfidenceofhigh/medium/low.recommended_patternsis a ranked list of ≤4, each with asimplification_patternflag; simplifying patterns rank first.merge_into_inventory): appends the singleinsightskey and re-serialises the rest ofinventory.jsonbyte-identically (non-destructive enrichment).Schema added to
inventory.jsonA single top-level
insightskey:RecommendedPattern(used by bothsystem_recommendationand each pipeline insight):{ "pattern": "string", "fit": "string", "simplification_pattern": true }Relationship to the lineage epic (#24)
The cross-pipeline relationships here are the discover-side signal that #24 (ordered cross-pipeline deploy/run in the package phase) builds on: annotation edges resolve against #23's deterministic
lineage.control_edges/data_edges, while inferred edges surface couplings the deterministic layer cannot yet see.Sources (ADF & Airflow)
Insights are source-agnostic: they attach to the discover
inventory.json(which bothsources/adfandsources/airflowemit), not to any ADF internals. The engine (pipeline_insights.py), theenrichcommand, and the models are source-neutral; only the discover skill's insight step carries source specifics, and Step 5 now branches those by--source— the source deep-dive (ADF ARM*.arm.jsonvs Airflow DAG source) and the recommended-pattern vocabulary (ADF-constructs table + Airflow-operators table).Caveat:
control/dataannotation edges resolve against the inventory's deterministiclineage, which today onlysources/adfemits. On an Airflow inventory those edges have nothing to resolve against, so only per-pipeline insights andinferrededges validate — graceful degradation. Emitting deterministic lineage fromsources/airflowis a tracked follow-up.Testing
Full unit suite: 1306 passed with the
mcpextra; 1224 passed / 3 skipped without it. The MCP-dependenttest_pipeline_insights.pyis guarded withpytest.importorskip("mcp")(matching the existingtest_mcp_*convention), since CI does not install the optionalmcpextra.make fmt+ mypy clean.This pull request and its description were written by Isaac.