The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Deps breaking broken (#68866)
metambenc056b03d894c
diff --git a/e2e/support/helpers/e2e-dependency-helpers.ts b/e2e/support/helpers/e2e-dependency-helpers.tsindex 3a34092b021..425a0f2f528 100644--- a/e2e/support/helpers/e2e-dependency-helpers.ts+++ b/e2e/support/helpers/e2e-dependency-helpers.ts@@ -1,6 +1,6 @@import type {DependencyNode,- ListBrokenGraphNodesResponse,+ ListBreakingGraphNodesResponse,} from "metabase-types/api";export const DependencyGraph = {@@ -12,8 +12,8 @@ export const DependencyGraph = {};export const DependencyDiagnostics = {- visitBrokenDependencies: () =>- cy.visit("/data-studio/dependency-diagnostics/broken"),+ visitBreakingDependencies: () =>+ cy.visit("/data-studio/dependency-diagnostics/breaking"),visitUnreferencedEntities: () =>cy.visit("/data-studio/dependency-diagnostics/unreferenced"),list: () => cy.findByTestId("dependency-list"),@@ -38,21 +38,21 @@ export const DependencyDiagnostics = {const WAIT_TIMEOUT = 10000;const WAIT_INTERVAL = 100;-export function waitForBrokenDependencies(+export function waitForBreakingDependencies(filter: (nodes: DependencyNode[]) => boolean,timeout = WAIT_TIMEOUT,): Cypress.Chainable {return cy- .request<ListBrokenGraphNodesResponse>(+ .request<ListBreakingGraphNodesResponse>("GET",- "/api/ee/dependencies/graph/broken",+ "/api/ee/dependencies/graph/breaking",).then((response) => {if (filter(response.body.data)) {return cy.wrap(response);} else if (timeout > 0) {cy.wait(WAIT_INTERVAL);- return waitForBrokenDependencies(filter, timeout - WAIT_INTERVAL);+ return waitForBreakingDependencies(filter, timeout - WAIT_INTERVAL);} else {throw new Error("Dependency analysis retry timeout");}diff --git a/e2e/test/scenarios/dependencies/dependency-broken-list.cy.spec.ts b/e2e/test/scenarios/dependencies/dependency-broken-list.cy.spec.tsindex 14afa71fb07..10e4d899d33 100644--- a/e2e/test/scenarios/dependencies/dependency-broken-list.cy.spec.ts+++ b/e2e/test/scenarios/dependencies/dependency-broken-list.cy.spec.ts@@ -90,7 +90,7 @@ describe("scenarios > dependencies > broken list", () => {describe("analysis", () => {it("should show broken dependencies", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();checkList({visibleEntities: BROKEN_DEPENDENCIES,hiddenEntities: BROKEN_DEPENDENTS,@@ -100,7 +100,7 @@ describe("scenarios > dependencies > broken list", () => {describe("sidebar", () => {it("should show broken dependents", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();cy.log("table dependents");H.DependencyDiagnostics.list().findByText(TABLE_DISPLAY_NAME).click();@@ -131,7 +131,7 @@ describe("scenarios > dependencies > broken list", () => {describe("search", () => {it("should search for entities", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();H.DependencyDiagnostics.searchInput().type(TABLE_DISPLAY_NAME);checkList({visibleEntities: [TABLE_DISPLAY_NAME],@@ -142,7 +142,7 @@ describe("scenarios > dependencies > broken list", () => {describe("filtering", () => {it("should filter entities by type", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();H.DependencyDiagnostics.filterButton().click();H.popover().within(() => {cy.findByText("Table").click();@@ -188,7 +188,7 @@ describe("scenarios > dependencies > broken list", () => {});it("should filter entities by location", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();H.DependencyDiagnostics.filterButton().click();H.popover().within(() => {cy.findByText("Include items in personal collections").click();@@ -205,7 +205,7 @@ describe("scenarios > dependencies > broken list", () => {describe("sorting", () => {it("should sort by name", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();H.DependencyDiagnostics.searchInput().type("test");cy.log("sorted by name by default");@@ -227,7 +227,7 @@ describe("scenarios > dependencies > broken list", () => {});it("should sort by location", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();H.DependencyDiagnostics.searchInput().type("test");cy.log("sorted by location ascending");@@ -244,7 +244,7 @@ describe("scenarios > dependencies > broken list", () => {});it("should sort by dependents errors", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();H.DependencyDiagnostics.searchInput().type("test");cy.log("sorted by dependents errors ascending");@@ -263,7 +263,7 @@ describe("scenarios > dependencies > broken list", () => {});it("should sort by dependents with errors", () => {- H.DependencyDiagnostics.visitBrokenDependencies();+ H.DependencyDiagnostics.visitBreakingDependencies();H.DependencyDiagnostics.searchInput().type("test");cy.log("sorted by dependents with errors ascending");@@ -289,7 +289,7 @@ function createContent() {createQuestionContent();createModelContent();breakTransform();- waitForBrokenDependencies();+ waitForBreakingDependencies();}function dropTransformTable() {@@ -486,8 +486,8 @@ function createModelContent() {});}-function waitForBrokenDependencies() {- H.waitForBrokenDependencies(+function waitForBreakingDependencies() {+ H.waitForBreakingDependencies((nodes) => nodes.length >= BROKEN_DEPENDENCIES.length,);}diff --git a/enterprise/backend/src/metabase_enterprise/dependencies/api.clj b/enterprise/backend/src/metabase_enterprise/dependencies/api.cljindex cd8125a9608..1ec98803208 100644--- a/enterprise/backend/src/metabase_enterprise/dependencies/api.clj+++ b/enterprise/backend/src/metabase_enterprise/dependencies/api.clj@@ -2,7 +2,6 @@(:require[clojure.set :as set][clojure.string :as str]- [medley.core :as m][metabase-enterprise.dependencies.core :as dependencies][metabase-enterprise.dependencies.dependency-types :as deps.dependency-types][metabase-enterprise.dependencies.models.analysis-finding-error :as analysis-finding-error]@@ -274,8 +273,8 @@[entity-type {:keys [id] :as entity} usages errors](cond-> {:id id:type entity-type- :data (->> (select-keys entity (entity-keys entity-type))- (m/map-vals format-subentity))+ :data (-> (select-keys entity (entity-keys entity-type))+ (update-vals format-subentity)):dependents_count (usages [entity-type id])}errors (assoc :dependents_errors (get errors [entity-type id]))))@@ -486,15 +485,15 @@(second %))))card->type (when (seq all-cards)(t2/select-fn->fn :id :type [:model/Card :id :type :card_schema] :id [:in all-cards]))]- (m/map-vals (fn [children]- (->> children- (map (fn [[entity-type entity-id]]- (let [dependency-type (if (= entity-type :card)- (card->type entity-id)- entity-type)]- {dependency-type 1})))- (apply merge-with +)))- children-map)))+ (update-vals children-map+ (fn [children]+ (->> children+ (map (fn [[entity-type entity-id]]+ (let [dependency-type (if (= entity-type :card)+ (card->type entity-id)+ entity-type)]+ {dependency-type 1})))+ (apply merge-with +))))))(defn- node-downstream-errors"Fetches errors caused by the given source entities (what downstream entities they're breaking).@@ -564,23 +563,33 @@(->> (map #(collection.root/hydrate-root-collection % (collection.root/hydrated-root-collection :snippets)))))(:segment :measure) (t2/hydrate entities :creator [:table :db])))+(defn- fetch-and-hydrate-nodes+ "Fetches and hydrates entities for the given nodes.+ Returns a map from [entity-type entity-id] -> hydrated entity."+ [nodes-by-type]+ (into {}+ (mapcat (fn [[entity-type entity-ids]]+ (when (seq entity-ids)+ (let [model (deps.dependency-types/dependency-type->model entity-type)+ fields (entity-select-fields entity-type)]+ (->> (t2/select (into [model] fields) :id [:in entity-ids])+ (hydrate-entities entity-type)+ (map (fn [entity]+ [[entity-type (:id entity)] entity])))))))+ nodes-by-type))+(defn- expanded-nodes [downstream-graph nodes {:keys [include-errors?]}](let [usages (node-usages downstream-graph nodes)- nodes-by-type (->> (group-by first nodes)- (m/map-vals #(map second %)))+ nodes-by-type (-> (group-by first nodes)+ (update-vals #(map second %)))errors (when include-errors?(node-errors nodes-by-type))+ hydrated-entities (fetch-and-hydrate-nodes nodes-by-type)nodes-by-type-and-id(into {}- (mapcat (fn [[entity-type entity-ids]]- (let [model (deps.dependency-types/dependency-type->model entity-type)- fields (entity-select-fields entity-type)]- (->> (t2/select (into [model] fields) :id [:in entity-ids])- (hydrate-entities entity-type)- (map (fn [entity]- [[entity-type (:id entity)]- (entity-value entity-type entity usages errors)]))))))- nodes-by-type)]+ (map (fn [[node-key entity]]+ [node-key (entity-value (first node-key) entity usages errors)]))+ hydrated-entities)](keep nodes-by-type-and-id nodes)))(mr/def ::graph-response@@ -1008,8 +1017,8 @@:offset offset:total total}))-(api.macros/defendpoint :get "/graph/broken" :- dependency-items-response- "Returns a list of entities that are causing errors in downstream dependents+(api.macros/defendpoint :get "/graph/breaking" :- dependency-items-response+ "Returns a list of entities that are breaking other entities (sources of errors).These are tables or cards that other entities depend on, where those dependentshave validation errors traced back to this source entity.@@ -1082,6 +1091,96 @@:limit limit:total total}))+(def ^:private broken-dependents-args+ [:map+ [:id ms/PositiveInt]+ [:type ::deps.dependency-types/dependency-types]+ [:dependent_types {:optional true}+ [:or+ ::deps.dependency-types/dependency-types+ [:sequential ::deps.dependency-types/dependency-types]]]+ [:dependent_card_types {:optional true}+ [:or+ (ms/enum-decode-keyword lib.schema.metadata/card-types)+ [:sequential (ms/enum-decode-keyword lib.schema.metadata/card-types)]]]+ [:include_personal_collections {:optional true} :boolean]+ [:sort_column {:optional true} (ms/enum-decode-keyword dependents-sort-columns)]+ [:sort_direction {:optional true} (ms/enum-decode-keyword sort-directions)]])++(mr/def ::broken-dependent-entity+ "Entity returned by /graph/broken endpoint - includes errors but no dependents_count."+ [:map+ [:id pos-int?]+ [:type :keyword]+ [:data [:map]]])++(api.macros/defendpoint :get "/graph/broken" :- [:sequential ::broken-dependent-entity]+ "Returns the broken dependents for a specific source entity.+ These are entities that have validation errors traced back to the specified source.++ Required parameters:+ - `id`: The ID of the source entity+ - `type`: The type of the source entity (card, table)++ Optional parameters:+ - `dependent_types`: Dependency types to filter by. Can be single value or array.+ - `dependent_card_types`: Card types to filter by when dependent_types includes :card.+ - `include_personal_collections`: Include items in personal collections (default: false)+ - `sort_column`: Column to sort by - name, location, or view-count (default: name)+ - `sort_direction`: Sort direction - asc or desc (default: asc)"+ [_route-params+ {:keys [id dependent_types dependent_card_types include_personal_collections sort_column sort_direction]+ entity-type :type+ :or {include_personal_collections false+ sort_column :name+ sort_direction :asc}} :- broken-dependents-args]+ (api/read-check (deps.dependency-types/dependency-type->model entity-type) id)+ (lib-be/with-metadata-provider-cache+ (let [normalize-types (fn normalize-types [types]+ (if (keyword? types)+ [(name types)]+ (not-empty (map name types))))+ dep-types (normalize-types dependent_types)+ card-types (normalize-types dependent_card_types)+ where-clause (cond-> [:and+ [:= :afe.source_entity_type (name entity-type)]+ [:= :afe.source_entity_id id]+ [:= :af.result false]+ (visible-entities-filter-clause+ :afe.analyzed_entity_type+ :afe.analyzed_entity_id+ {:include-archived-items :exclude})]+ dep-types (conj [:in :afe.analyzed_entity_type dep-types])+ card-types (conj [:or+ [:!= :afe.analyzed_entity_type [:inline "card"]]+ [:in :rc.type card-types]]))+ broken-entity-pairs+ (t2/query (cond-> {:select-distinct [[:afe.analyzed_entity_type :entity_type]+ [:afe.analyzed_entity_id :entity_id]]+ :from [[:analysis_finding_error :afe]]+ :join [[:analysis_finding :af]+ [:and+ [:= :af.analyzed_entity_type :afe.analyzed_entity_type]+ [:= :af.analyzed_entity_id :afe.analyzed_entity_id]]]+ :where where-clause}+ card-types (assoc :left-join [[:report_card :rc]+ [:and+ [:= :afe.analyzed_entity_type [:inline "card"]]+ [:= :rc.id :afe.analyzed_entity_id]]])))+ nodes (map (fn [{:keys [entity_type entity_id]}]+ [(keyword entity_type) entity_id])+ broken-entity-pairs)+ nodes-by-type (-> (group-by first nodes)+ (update-vals #(map second %)))]+ (-> (into [] (cond-> (map (fn [[[entity-type entity-id] entity]]+ {:id entity-id+ :type entity-type+ :data (-> (select-keys entity (entity-keys entity-type))+ (update-vals format-subentity))}))+ (not include_personal_collections) (comp (remove in-personal-collection?)))+ (fetch-and-hydrate-nodes nodes-by-type))+ (sort-dependents sort_column sort_direction)))))+(def ^{:arglists '([request respond raise])} routes"`/api/ee/dependencies` routes."(handlers/routesdiff --git a/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj b/enterprise/backend/test/metabase_enterprise/dependencies/api_test.cljindex 2565e4af048..9306bdef067 100644--- a/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj+++ b/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj@@ -1814,8 +1814,8 @@(= sort-direction :desc) reverse)names))))))))-(deftest ^:sequential broken-entities-returns-source-of-errors-test- (testing "GET /api/ee/dependencies/graph/broken - returns entities that are SOURCE of downstream errors"+(deftest ^:sequential breaking-entities-returns-source-of-errors-test+ (testing "GET /api/ee/dependencies/graph/breaking - returns entities that are SOURCE of downstream errors"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -1831,12 +1831,12 @@(lib-be/with-metadata-provider-cache(while (#'dependencies.backfill/backfill-dependencies!))(run-analysis-for-card! (:id dependent-card)))- (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=brokentest")]+ (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=brokentest")](is (= [(:id model-card)] (mapv :id (:data response)))"Model card should appear as a breaking entity"))))))))-(deftest ^:sequential broken-entities-types-filtering-test- (testing "GET /api/ee/dependencies/graph/broken - types parameter filters results"+(deftest ^:sequential breaking-entities-types-filtering-test+ (testing "GET /api/ee/dependencies/graph/breaking - types parameter filters results"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -1858,17 +1858,17 @@(run-analysis-for-card! (:id dependent-card-1))(run-analysis-for-card! (:id dependent-card-2)))(testing "filtering by card returns only card sources"- (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=typesfiltertest")+ (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=typesfiltertest")ids (set (map :id (:data response)))](is (contains? ids (:id model-card-1)) "Model card 1 should be in results")(is (contains? ids (:id model-card-2)) "Model card 2 should be in results")))(testing "filtering by table returns empty (no table sources in this test)"- (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=table&query=typesfiltertest")+ (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=table&query=typesfiltertest")ids (set (map :id (:data response)))](is (empty? ids) "No tables should be in results")))))))))-(deftest ^:sequential broken-entities-archived-card-test- (testing "GET /api/ee/dependencies/graph/broken with archived parameter for source cards"+(deftest ^:sequential breaking-entities-archived-card-test+ (testing "GET /api/ee/dependencies/graph/breaking with archived parameter for source cards"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -1893,18 +1893,18 @@(run-analysis-for-card! (:id dependent-card-1))(run-analysis-for-card! (:id dependent-card-2)))(testing "archived=false (default) excludes archived source card"- (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=archivedbrokentestcard")+ (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=archivedbrokentestcard")card-ids (set (map :id (:data response)))](is (contains? card-ids (:id active-model)))(is (not (contains? card-ids (:id archived-model))))))(testing "archived=true includes archived source card"- (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=archivedbrokentestcard&archived=true")+ (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=archivedbrokentestcard&archived=true")card-ids (set (map :id (:data response)))](is (contains? card-ids (:id active-model)))(is (contains? card-ids (:id archived-model)))))))))))-(deftest ^:sequential broken-entities-multiple-dependents-test- (testing "GET /api/ee/dependencies/graph/broken - model breaking multiple dependents appears once"+(deftest ^:sequential breaking-entities-multiple-dependents-test+ (testing "GET /api/ee/dependencies/graph/breaking - model breaking multiple dependents appears once"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -1923,12 +1923,12 @@(while (#'dependencies.backfill/backfill-dependencies!))(run-analysis-for-card! (:id dependent-card-1))(run-analysis-for-card! (:id dependent-card-2)))- (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=multipledependents")+ (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=multipledependents")model-ids (filter #(= (:id %) (:id model-card)) (:data response))](is (= 1 (count model-ids)) "Model should appear exactly once even with multiple broken dependents"))))))))-(deftest ^:sequential broken-entities-personal-collection-card-test- (testing "GET /api/ee/dependencies/graph/broken with include_personal_collections parameter"+(deftest ^:sequential breaking-entities-personal-collection-card-test+ (testing "GET /api/ee/dependencies/graph/breaking with include_personal_collections parameter"(mt/with-premium-features #{:dependencies}(binding [collection/*allow-deleting-personal-collections* true](mt/with-temp [:model/User {user-id :id} {}@@ -1955,18 +1955,18 @@(run-analysis-for-card! (:id dependent-card-1))(run-analysis-for-card! (:id dependent-card-2)))(testing "include_personal_collections=false (default) excludes source cards in personal collections"- (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=personalcollbrokentest")+ (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=personalcollbrokentest")card-ids (set (map :id (:data response)))](is (not (contains? card-ids (:id model-in-personal))))(is (contains? card-ids (:id model-regular)))))(testing "include_personal_collections=true includes source cards in personal collections"- (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=personalcollbrokentest&include_personal_collections=true")+ (let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=personalcollbrokentest&include_personal_collections=true")card-ids (set (map :id (:data response)))](is (contains? card-ids (:id model-in-personal)))(is (contains? card-ids (:id model-regular))))))))))))-(deftest ^:sequential broken-entities-pagination-test- (testing "GET /api/ee/dependencies/graph/broken - should paginate results"+(deftest ^:sequential breaking-entities-pagination-test+ (testing "GET /api/ee/dependencies/graph/breaking - should paginate results"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -1991,15 +1991,15 @@:total 2:offset 0:limit 1}- (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=paginationtest&offset=0&limit=1")))+ (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=paginationtest&offset=0&limit=1")))(is (=? {:data [{:id (:id model-card-2)}]:total 2:offset 1:limit 1}- (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/broken?types=card&query=paginationtest&offset=1&limit=1")))))))))+ (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph/breaking?types=card&query=paginationtest&offset=1&limit=1")))))))))-(deftest ^:sequential broken-entities-sort-by-name-test- (testing "GET /api/ee/dependencies/graph/broken - sorting by name"+(deftest ^:sequential breaking-entities-sort-by-name-test+ (testing "GET /api/ee/dependencies/graph/breaking - sorting by name"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -2022,7 +2022,7 @@(run-analysis-for-card! (:id dependent-card-b)))(doseq [sort-direction [:asc :desc]](let [response (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "sortnametest":sort_column :name@@ -2033,8 +2033,8 @@(= sort-direction :desc) reverse)names))))))))))-(deftest ^:sequential broken-entities-sort-by-location-test- (testing "GET /api/ee/dependencies/graph/broken - sorting by location"+(deftest ^:sequential breaking-entities-sort-by-location-test+ (testing "GET /api/ee/dependencies/graph/breaking - sorting by location"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}:model/Collection {collection1-id :id} {:name "B Collection"}@@ -2059,7 +2059,7 @@(run-analysis-for-card! (:id dependent-card-2)))(doseq [sort-direction [:asc :desc]](let [response (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "sortloctest":sort_column :location@@ -2070,8 +2070,8 @@(= sort-direction :desc) reverse)names))))))))))-(deftest ^:sequential broken-entities-sort-by-dependents-with-errors-count-test- (testing "GET /api/ee/dependencies/graph/broken - sorting by dependents with errors count"+(deftest ^:sequential breaking-entities-sort-by-dependents-with-errors-count-test+ (testing "GET /api/ee/dependencies/graph/breaking - sorting by dependents with errors count"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -2097,7 +2097,7 @@(run-analysis-for-card! (:id dependent-card-2a)))(doseq [sort-direction [:asc :desc]](let [response (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "sortdepstest":sort_column :dependents-with-errors@@ -2108,8 +2108,8 @@(= sort-direction :desc) reverse)names))))))))))-(deftest ^:sequential broken-entities-sort-by-dependents-with-errors-test- (testing "GET /api/ee/dependencies/graph/broken - sorting by dependents with errors count"+(deftest ^:sequential breaking-entities-sort-by-dependents-with-errors-test+ (testing "GET /api/ee/dependencies/graph/breaking - sorting by dependents with errors count"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -2136,7 +2136,7 @@(run-analysis-for-card! (:id dependent-card-2a)))(doseq [sort-direction [:asc :desc]](let [response (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "sorterrorstest":sort_column :dependents-with-errors@@ -2336,7 +2336,7 @@(is (= visible-card (:analyzed_entity_id (first card-errors))))))))))(deftest ^:sequential broken-endpoint-error-visibility-filtering-test- (testing "GET /api/ee/dependencies/graph/broken - pagination and sorting work with error visibility filtering"+ (testing "GET /api/ee/dependencies/graph/breaking - pagination and sorting work with error visibility filtering"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -2369,7 +2369,7 @@(testing "pagination works correctly with error filtering";; Both model cards should appear in results with only visible errors(let [page-1 (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "errvistest":offset 0@@ -2377,7 +2377,7 @@:sort_column "name":sort_direction "asc")page-2 (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "errvistest":offset 1@@ -2392,7 +2392,7 @@(is (= (:id model-card-b) (-> page-2 :data first :id))))))(testing "dependents_errors contains only errors for visible entities"(let [response (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "errvistest")model-a-result (first (filter #(= (:id %) (:id model-card-a)) (:data response)))@@ -2415,13 +2415,13 @@:error_type "missing-column":error_detail "extra_col"})(let [asc-response (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "errvistest":sort_column "dependents-errors":sort_direction "asc")desc-response (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "errvistest":sort_column "dependents-errors"@@ -2432,7 +2432,7 @@(is (= (:id model-card-b) (-> desc-response :data first :id))))))))))))(deftest ^:sequential broken-endpoint-sort-by-visible-errors-only-test- (testing "GET /api/ee/dependencies/graph/broken - sorting counts only visible errors, not archived"+ (testing "GET /api/ee/dependencies/graph/breaking - sorting counts only visible errors, not archived"(mt/with-premium-features #{:dependencies}(mt/with-temp [:model/User user {:email "[email protected]"}](mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]@@ -2487,7 +2487,7 @@:error_type "missing-column":error_detail "col5"}])(let [asc-response (mt/user-http-request :crowberto :get 200- "ee/dependencies/graph/broken"+ "ee/dependencies/graph/breaking":types "card":query "sortviserr":sort_column "dependents-errors"@@ -2580,3 +2580,217 @@(filter #(= (:db_id %) db-id))(map :id)set))))))))))++;;; --------------------------------------------- /graph/broken tests ---------------------------------------------+;;; Tests for the /graph/broken endpoint that returns broken dependents for a specific source entity.++(deftest ^:synchronized broken-dependents-source-filtering-test+ (testing "GET /api/ee/dependencies/graph/broken - returns broken dependents filtered by source"+ (mt/with-premium-features #{:dependencies}+ (mt/with-temp [:model/User user {:email "[email protected]"}]+ (mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]+ ;; Setup: two models, each with one dependent+ (let [[model-card-1 model-card-2 dependent-card-1 dependent-card-2]+ (lib-be/with-metadata-provider-cache+ (let [model-card-1 (create-model-card! user "Model Card 1 - sourcefiltertest")+ model-card-2 (create-model-card! user "Model Card 2 - sourcefiltertest")+ dependent-card-1 (create-dependent-card-on-model! user model-card-1+ "Dependent 1 - sourcefiltertest")+ dependent-card-2 (create-dependent-card-on-model! user model-card-2+ "Dependent 2 - sourcefiltertest")]+ [model-card-1 model-card-2 dependent-card-1 dependent-card-2]))]+ (lib-be/with-metadata-provider-cache+ (break-model-card! model-card-1)+ (break-model-card! model-card-2))+ (lib-be/with-metadata-provider-cache+ (while (#'dependencies.backfill/backfill-dependencies!))+ (run-analysis-for-card! (:id dependent-card-1))+ (run-analysis-for-card! (:id dependent-card-2)))+ (testing "returns only broken dependents for the specified source (not other sources)"+ (let [response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card-1)+ "&type=card"))]+ (is (= [(:id dependent-card-1)] (mapv :id response))+ "Should return only dependent-card-1, not dependent-card-2 with errors from model-2")))))))))++(deftest ^:synchronized broken-count-and-sorting-test+ (testing "GET /api/ee/dependencies/graph/broken - count matches and sorting works"+ (mt/with-premium-features #{:dependencies}+ (mt/with-temp [:model/User user {:email "[email protected]"}]+ (mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]+ ;; Setup: one model with two dependents (named for sorting)+ (let [[model-card dependent-card-a dependent-card-b]+ (lib-be/with-metadata-provider-cache+ (let [model-card (create-model-card! user "Model Card - countsorttest")+ dependent-card-a (create-dependent-card-on-model! user model-card+ "A Dependent - countsorttest")+ dependent-card-b (create-dependent-card-on-model! user model-card+ "B Dependent - countsorttest")]+ [model-card dependent-card-a dependent-card-b]))]+ (lib-be/with-metadata-provider-cache+ (break-model-card! model-card))+ (lib-be/with-metadata-provider-cache+ (while (#'dependencies.backfill/backfill-dependencies!))+ (run-analysis-for-card! (:id dependent-card-a))+ (run-analysis-for-card! (:id dependent-card-b)))+ (testing "count matches dependents-with-errors from /graph/breaking"+ (let [breaking-response (mt/user-http-request+ :crowberto :get 200+ "ee/dependencies/graph/breaking?types=card&query=countsorttest")+ model-entry (first (filter #(= (:id %) (:id model-card)) (:data breaking-response)))+ dependents-with-errors-count (count (:dependents_errors model-entry))+ ;; Get actual broken dependents from new /graph/broken endpoint+ broken-response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card)+ "&type=card"))]+ (is (= dependents-with-errors-count (count broken-response))+ "Count from /graph/broken should match dependents_errors count from /graph/breaking")))+ (testing "sort by name ascending"+ (let [response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card)+ "&type=card&sort_column=name&sort_direction=asc"))+ names (mapv #(get-in % [:data :name]) response)]+ (is (= ["A Dependent - countsorttest" "B Dependent - countsorttest"] names))))+ (testing "sort by name descending"+ (let [response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card)+ "&type=card&sort_column=name&sort_direction=desc"))+ names (mapv #(get-in % [:data :name]) response)]+ (is (= ["B Dependent - countsorttest" "A Dependent - countsorttest"] names))))))))))++(deftest ^:parallel broken-requires-id-and-type-test+ (testing "GET /api/ee/dependencies/graph/broken - requires id and type parameters"+ (mt/with-premium-features #{:dependencies}+ (testing "missing both id and type returns 400"+ (mt/user-http-request :crowberto :get 400 "ee/dependencies/graph/broken"))+ (testing "missing type returns 400"+ (mt/user-http-request :crowberto :get 400 "ee/dependencies/graph/broken?id=1"))+ (testing "missing id returns 400"+ (mt/user-http-request :crowberto :get 400 "ee/dependencies/graph/broken?type=card")))))++(deftest ^:synchronized broken-requires-read-permission-test+ (testing "GET /api/ee/dependencies/graph/broken - requires read permission on source entity"+ (mt/with-premium-features #{:dependencies}+ (mt/with-non-admin-groups-no-root-collection-perms+ (mt/with-temp [:model/User user {:email "[email protected]"}+ :model/Collection {coll-id :id} {:name "Private Collection"}]+ (mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]+ (let [[model-card dependent-card]+ (lib-be/with-metadata-provider-cache+ (let [model-card (create-model-card! user "Model Card - permtest" :collection-id coll-id)+ dependent-card (create-dependent-card-on-model! user model-card "Dependent Card - permtest"+ :collection-id coll-id)]+ [model-card dependent-card]))]+ (lib-be/with-metadata-provider-cache+ (break-model-card! model-card))+ (lib-be/with-metadata-provider-cache+ (while (#'dependencies.backfill/backfill-dependencies!))+ (run-analysis-for-card! (:id dependent-card)))+ ;; Admin can access+ (is (sequential? (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card)+ "&type=card"))))+ ;; Regular user without collection access gets 403+ (mt/user-http-request :rasta :get 403+ (str "ee/dependencies/graph/broken?id=" (:id model-card) "&type=card")))))))))++(deftest ^:synchronized broken-no-transitive-breakage-test+ (testing "GET /api/ee/dependencies/graph/broken - does not report transitive breakage"+ (mt/with-premium-features #{:dependencies}+ (mt/with-temp [:model/User user {:email "[email protected]"}]+ (mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]+ ;; Create chain: model-1 -> model-2 -> card+ ;; When model-1 breaks:+ ;; - model-2 gets error with source_entity_id=model-1+ ;; - card gets error with source_entity_id=model-2 (NOT model-1)+ (let [[model-card-1 model-card-2 dependent-card]+ (lib-be/with-metadata-provider-cache+ (let [model-card-1 (create-model-card! user "Model 1 - transitivetest")+ ;; Create model-2 as a model that depends on model-1+ model-card-2-question (create-dependent-card-on-model! user model-card-1+ "Model 2 - transitivetest")+ model-card-2 (card/update-card! {:card-before-update model-card-2-question+ :card-updates {:type :model}})+ ;; Create card that depends on model-2+ dependent-card (create-dependent-card-on-model! user model-card-2 "Card - transitivetest")]+ [model-card-1 model-card-2 dependent-card]))]+ ;; Break model-1+ (lib-be/with-metadata-provider-cache+ (break-model-card! model-card-1))+ ;; Run analysis for both model-2 and dependent-card+ (lib-be/with-metadata-provider-cache+ (while (#'dependencies.backfill/backfill-dependencies!))+ (run-analysis-for-card! (:id model-card-2))+ (run-analysis-for-card! (:id dependent-card)))+ ;; Query /graph/broken for model-1 - should only return model-2, not dependent-card+ ;; because dependent-card's error source is model-2, not model-1+ (let [response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card-1)+ "&type=card"))]+ (is (= [(:id model-card-2)] (mapv :id response))+ "Should return only model-2 (direct dependent), not card (transitive)"))))))))++(deftest ^:synchronized broken-filter-by-dependent-types-test+ (testing "GET /api/ee/dependencies/graph/broken - filters by dependent_types"+ (mt/with-premium-features #{:dependencies}+ (mt/with-temp [:model/User user {:email "[email protected]"}]+ (mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]+ (let [[model-card dependent-card]+ (lib-be/with-metadata-provider-cache+ (let [model-card (create-model-card! user "Model Card - deptypestest")+ dependent-card (create-dependent-card-on-model! user model-card "Dependent Card - deptypestest")]+ [model-card dependent-card]))]+ (lib-be/with-metadata-provider-cache+ (break-model-card! model-card))+ (lib-be/with-metadata-provider-cache+ (while (#'dependencies.backfill/backfill-dependencies!))+ (run-analysis-for-card! (:id dependent-card)))+ (testing "filtering by card type returns the dependent card"+ (let [response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card)+ "&type=card&dependent_types=card&dependent_card_types=question"))]+ (is (= [(:id dependent-card)] (mapv :id response)))))+ (testing "filtering by dashboard returns empty (no dashboards in this test)"+ (let [response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card)+ "&type=card&dependent_types=dashboard"))]+ (is (empty? response))))))))))++(deftest ^:synchronized broken-personal-collections-test+ (testing "GET /api/ee/dependencies/graph/broken with include_personal_collections parameter"+ (mt/with-premium-features #{:dependencies}+ (binding [collection/*allow-deleting-personal-collections* true]+ (mt/with-temp [:model/User {user-id :id} {}+ :model/User creator {:email "[email protected]"}+ :model/Collection {personal-coll-id :id} {:personal_owner_id user-id+ :name "Test Personal Collection"}]+ (mt/with-model-cleanup [:model/Card :model/Dependency :model/AnalysisFinding :model/AnalysisFindingError]+ ;; one model, two dependents: one in personal collection, one in regular collection+ (let [[model-card dependent-in-personal dependent-regular]+ (lib-be/with-metadata-provider-cache+ (let [model-card (create-model-card! creator "Model - personalcollbrokentest2")+ dependent-in-personal (create-dependent-card-on-model! creator model-card+ "Dependent in Personal - personalcollbrokentest2"+ :collection-id personal-coll-id)+ dependent-regular (create-dependent-card-on-model! creator model-card+ "Dependent Regular - personalcollbrokentest2")]+ [model-card dependent-in-personal dependent-regular]))]+ (lib-be/with-metadata-provider-cache+ (break-model-card! model-card))+ (lib-be/with-metadata-provider-cache+ (while (#'dependencies.backfill/backfill-dependencies!))+ (run-analysis-for-card! (:id dependent-in-personal))+ (run-analysis-for-card! (:id dependent-regular)))+ (testing "include_personal_collections=false (default) excludes broken dependents in personal collections"+ (let [response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card) "&type=card"))+ card-ids (set (map :id response))]+ (is (not (contains? card-ids (:id dependent-in-personal))))+ (is (contains? card-ids (:id dependent-regular)))))+ (testing "include_personal_collections=true includes broken dependents in personal collections"+ (let [response (mt/user-http-request :crowberto :get 200+ (str "ee/dependencies/graph/broken?id=" (:id model-card)+ "&type=card&include_personal_collections=true"))+ card-ids (set (map :id response))]+ (is (contains? card-ids (:id dependent-in-personal)))+ (is (contains? card-ids (:id dependent-regular))))))))))))diff --git a/enterprise/frontend/src/metabase-enterprise/api/dependencies.ts b/enterprise/frontend/src/metabase-enterprise/api/dependencies.tsindex fb2e4fb0a67..63b413822eb 100644--- a/enterprise/frontend/src/metabase-enterprise/api/dependencies.ts+++ b/enterprise/frontend/src/metabase-enterprise/api/dependencies.ts@@ -6,8 +6,9 @@ import type {DependencyGraph,DependencyNode,GetDependencyGraphRequest,+ ListBreakingGraphNodesRequest,+ ListBreakingGraphNodesResponse,ListBrokenGraphNodesRequest,- ListBrokenGraphNodesResponse,ListNodeDependentsRequest,ListUnreferencedGraphNodesRequest,ListUnreferencedGraphNodesResponse,@@ -44,8 +45,20 @@ export const dependencyApi = EnterpriseApi.injectEndpoints({providesTags: (nodes) =>nodes ? provideDependencyNodeListTags(nodes) : [],}),+ listBreakingGraphNodes: builder.query<+ ListBreakingGraphNodesResponse,+ ListBreakingGraphNodesRequest+ >({+ query: (params) => ({+ method: "GET",+ url: "/api/ee/dependencies/graph/breaking",+ params,+ }),+ providesTags: (response) =>+ response ? provideDependencyNodeListTags(response.data) : [],+ }),listBrokenGraphNodes: builder.query<- ListBrokenGraphNodesResponse,+ DependencyNode[],ListBrokenGraphNodesRequest>({query: (params) => ({@@ -53,8 +66,8 @@ export const dependencyApi = EnterpriseApi.injectEndpoints({url: "/api/ee/dependencies/graph/broken",params,}),- providesTags: (response) =>- response ? provideDependencyNodeListTags(response.data) : [],+ providesTags: (nodes) =>+ nodes ? provideDependencyNodeListTags(nodes) : [],}),listUnreferencedGraphNodes: builder.query<ListUnreferencedGraphNodesResponse,@@ -104,6 +117,7 @@ export const dependencyApi = EnterpriseApi.injectEndpoints({export const {useGetDependencyGraphQuery,useListNodeDependentsQuery,+ useListBreakingGraphNodesQuery,useListBrokenGraphNodesQuery,useListUnreferencedGraphNodesQuery,useLazyCheckCardDependenciesQuery,diff --git a/enterprise/frontend/src/metabase-enterprise/data-studio/app/pages/DataStudioLayout/utils.unit.spec.ts b/enterprise/frontend/src/metabase-enterprise/data-studio/app/pages/DataStudioLayout/utils.unit.spec.tsindex 7d95447601e..57a893469bb 100644--- a/enterprise/frontend/src/metabase-enterprise/data-studio/app/pages/DataStudioLayout/utils.unit.spec.ts+++ b/enterprise/frontend/src/metabase-enterprise/data-studio/app/pages/DataStudioLayout/utils.unit.spec.ts@@ -11,7 +11,7 @@ describe("getCurrentTab", () => {${"/data-studio/dependencies"} | ${"dependencies"}${"/data-studio/dependencies?id=1&type=card"} | ${"dependencies"}${"/data-studio/dependency-diagnostics"} | ${"dependency-diagnostics"}- ${"/data-studio/dependency-diagnostics/broken"} | ${"dependency-diagnostics"}+ ${"/data-studio/dependency-diagnostics/breaking"} | ${"dependency-diagnostics"}${"/data-studio/dependency-diagnostics/unreferenced"} | ${"dependency-diagnostics"}${"/data-studio/library"} | ${"library"}${"/data-studio/library/collections/123"} | ${"library"}diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/DependencyList.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/DependencyList.tsxindex 7d1a2494cd0..032936d04b7 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/DependencyList.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/DependencyList.tsx@@ -6,7 +6,7 @@ import { DelayedLoadingAndErrorWrapper } from "metabase/common/components/Loadinimport type * as Urls from "metabase/lib/urls";import { Center, Flex, Stack } from "metabase/ui";import {- useListBrokenGraphNodesQuery,+ useListBreakingGraphNodesQuery,useListUnreferencedGraphNodesQuery,} from "metabase-enterprise/api";import type { DependencyEntry } from "metabase-types/api";@@ -55,8 +55,8 @@ export function DependencyList({const [selectedEntry, setSelectedEntry] = useState<DependencyEntry>();const useListGraphNodesQuery =- mode === "broken"- ? useListBrokenGraphNodesQuery+ mode === "breaking"+ ? useListBreakingGraphNodesQuery: useListUnreferencedGraphNodesQuery;const {diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListBody/utils.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListBody/utils.tsxindex 0224d5d1117..54f6396fa16 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListBody/utils.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListBody/utils.tsx@@ -25,7 +25,7 @@ function getNameColumn(): TreeTableColumnDef<DependencyNode> {return {id: "name" satisfies DependencySortColumn,- header: mode === "broken" ? t`Dependency` : t`Name`,+ header: mode === "breaking" ? t`Dependency` : t`Name`,minWidth: 100,enableSorting: true,accessorFn: (node) => getNodeLabel(node),@@ -93,13 +93,13 @@ export function getColumns(return [getNameColumn(mode),getLocationColumn(),- ...(mode === "broken" ? [getDependentsErrorsColumn()] : []),- ...(mode === "broken" ? [getDependentsWithErrorsColumn()] : []),+ ...(mode === "breaking" ? [getDependentsErrorsColumn()] : []),+ ...(mode === "breaking" ? [getDependentsWithErrorsColumn()] : []),];}export function getColumnWidths(mode: DependencyListMode): number[] {- if (mode === "broken") {+ if (mode === "breaking") {return [0.3, 0.3, 0.3, 0.1];} else {return [0.5, 0.5];@@ -134,7 +134,7 @@ export function getSortingOptions(}export function getNotFoundMessage(mode: DependencyListMode) {- return mode === "broken"+ return mode === "breaking"? t`No broken dependencies found`: t`No unreferenced entities found`;}diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListHeader/ListHeader.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListHeader/ListHeader.tsxindex dfe042dedaa..30628b9bac6 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListHeader/ListHeader.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListHeader/ListHeader.tsx@@ -13,7 +13,7 @@ export const ListHeader = memo(function ListHeader() {const tabs: PaneHeaderTab[] = [{label: t`Broken dependencies`,- to: Urls.brokenDependencies(),+ to: Urls.breakingDependencies(),icon: "broken_link",},{diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListSidebar/SidebarDependentsSection/SidebarDependentsSection.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListSidebar/SidebarDependentsSection/SidebarDependentsSection.tsxindex 18cfafd00df..351e2b49206 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListSidebar/SidebarDependentsSection/SidebarDependentsSection.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListSidebar/SidebarDependentsSection/SidebarDependentsSection.tsx@@ -17,7 +17,7 @@ import {Stack,Title,} from "metabase/ui";-import { useListNodeDependentsQuery } from "metabase-enterprise/api";+import { useListBrokenGraphNodesQuery } from "metabase-enterprise/api";import type { DependencyNode } from "metabase-types/api";import { DEPENDENTS_SEARCH_THRESHOLD } from "../../../../constants";@@ -69,7 +69,7 @@ export function SidebarDependentsSection({getDefaultFilterOptions(),);- const { data: dependents = [], isFetching } = useListNodeDependentsQuery(+ const { data: dependents = [], isFetching } = useListBrokenGraphNodesQuery(getListRequest(node, filterOptions, sortOptions),{skip: count === 0,diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListSidebar/SidebarDependentsSection/utils.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListSidebar/SidebarDependentsSection/utils.tsindex 7b9faf01f74..d5ef7bc0de8 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListSidebar/SidebarDependentsSection/utils.ts+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/ListSidebar/SidebarDependentsSection/utils.ts@@ -1,6 +1,6 @@import type {DependencyNode,- ListNodeDependentsRequest,+ ListBrokenGraphNodesRequest,} from "metabase-types/api";import { DEFAULT_INCLUDE_PERSONAL_COLLECTIONS } from "../../../../constants";@@ -15,13 +15,12 @@ export function getListRequest(node: DependencyNode,filterOptions: DependencyFilterOptions,sortOptions: DependencySortOptions,-): ListNodeDependentsRequest {+): ListBrokenGraphNodesRequest {return {id: node.id,type: node.type,dependent_types: getDependencyTypes(filterOptions.groupTypes),dependent_card_types: getCardTypes(filterOptions.groupTypes),- broken: true,include_personal_collections: filterOptions.includePersonalCollections,sort_column: sortOptions.column,sort_direction: sortOptions.direction,diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/types.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/types.tsindex e661edc4817..3b8d8071e19 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/types.ts+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/types.ts@@ -1,4 +1,4 @@-export type DependencyListMode = "broken" | "unreferenced";+export type DependencyListMode = "breaking" | "unreferenced";export type DependencyListParamsOptions = {withSetLastUsedParams?: boolean;diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/utils.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/utils.tsindex 836a35470ef..26c28144fd0 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/utils.ts+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyList/utils.ts@@ -10,7 +10,7 @@ import { BROKEN_GROUP_TYPES, UNREFERENCED_GROUP_TYPES } from "./constants";import type { DependencyListMode } from "./types";export function getAvailableGroupTypes(mode: DependencyListMode) {- return mode === "broken" ? BROKEN_GROUP_TYPES : UNREFERENCED_GROUP_TYPES;+ return mode === "breaking" ? BROKEN_GROUP_TYPES : UNREFERENCED_GROUP_TYPES;}export function getFilterOptions(diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/DependencyListPage.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/DependencyListPage.tsxindex dabfb29d48e..b60d76917d1 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/DependencyListPage.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/DependencyListPage.tsx@@ -81,7 +81,7 @@ export function DependencyListPage({export function BrokenDependencyListPage({location,}: DependencyListPageProps) {- return <DependencyListPage mode="broken" location={location} />;+ return <DependencyListPage mode="breaking" location={location} />;}export function UnreferencedDependencyListPage({diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/DependencyListPage.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/DependencyListPage.unit.spec.tsxindex 54dd1689c1e..0cc0d1a6254 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/DependencyListPage.unit.spec.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/DependencyListPage.unit.spec.tsx@@ -3,7 +3,7 @@ import type { Location } from "history";import { Route } from "react-router";import {- setupListBrokenGraphNodesEndpoint,+ setupListBreakingGraphNodesEndpoint,setupListUnreferencedGraphNodesEndpoint,setupUserKeyValueEndpoints,} from "__support__/server-mocks";@@ -51,7 +51,7 @@ type SetupOpts = {};function setup({- mode = "broken",+ mode = "breaking",location = { query: {} },nodes = [],total,@@ -59,8 +59,8 @@ function setup({}: SetupOpts) {const path = getPageUrl(mode, {});- if (mode === "broken") {- setupListBrokenGraphNodesEndpoint(+ if (mode === "breaking") {+ setupListBreakingGraphNodesEndpoint(createMockListBrokenGraphNodesResponse({data: nodes,total: total ?? nodes.length,@@ -129,7 +129,7 @@ describe("DependencyListPage", () => {describe("URL parameters", () => {it("should set the group_types parameter when not all types are selected", async () => {const { history } = setup({- mode: "broken",+ mode: "breaking",nodes: CARD_NODES,location: { query: { group_types: ["table", "question", "model"] } },});@@ -146,7 +146,7 @@ describe("DependencyListPage", () => {it("should not set the group_types parameter when all types are selected", async () => {const { history } = setup({- mode: "broken",+ mode: "breaking",nodes: CARD_NODES,location: { query: { group_types: ["table", "question"] } },});@@ -161,7 +161,7 @@ describe("DependencyListPage", () => {it("should set the include_personal_collections parameter when it is unchecked", async () => {const { history } = setup({- mode: "broken",+ mode: "breaking",nodes: CARD_NODES,location: { query: { include_personal_collections: "true" } },});@@ -181,7 +181,7 @@ describe("DependencyListPage", () => {it("should not set the include_personal_collections parameter when it is checked", async () => {const { history } = setup({- mode: "broken",+ mode: "breaking",nodes: CARD_NODES,location: { query: { include_personal_collections: "false" } },});@@ -199,7 +199,7 @@ describe("DependencyListPage", () => {it("should set the page parameter when navigating to the next page and it is not the first page", async () => {const { history } = setup({- mode: "broken",+ mode: "breaking",nodes: CARD_NODES,total: 50,location: { query: {} },@@ -213,7 +213,7 @@ describe("DependencyListPage", () => {it("should set the page parameter when navigating to the previous page and it is not the first page", async () => {const { history } = setup({- mode: "broken",+ mode: "breaking",nodes: CARD_NODES,total: 50,location: { query: { page: "2" } },@@ -227,7 +227,7 @@ describe("DependencyListPage", () => {it("should not set the page parameter when it is the first page", async () => {const { history } = setup({- mode: "broken",+ mode: "breaking",nodes: CARD_NODES,location: { query: { page: "1" } },total: 50,@@ -305,7 +305,7 @@ describe("DependencyListPage", () => {it("should update URL with last used parameters when there is no query string", async () => {const { history } = setup({- mode: "broken",+ mode: "breaking",nodes: CARD_NODES,location: { query: {} },lastUsedParams: { group_types: ["table", "question"] },diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/utils.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/utils.tsindex bec88515036..6d3c4dcd5bc 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/utils.ts+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyListPage/utils.ts@@ -21,8 +21,8 @@ export function getPageUrl(mode: DependencyListMode,params: Urls.DependencyListParams,): string {- return mode === "broken"- ? Urls.brokenDependencies(params)+ return mode === "breaking"+ ? Urls.breakingDependencies(params): Urls.unreferencedDependencies(params);}diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/routes.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/routes.tsxindex b5d948a27ca..4c90ec0a65d 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/routes.tsx@@ -13,8 +13,8 @@ export function getDataStudioDependencyRoutes() {export function getDataStudioDependencyDiagnosticsRoutes() {return (<>- <IndexRedirect to="broken" />- <Route path="broken" component={BrokenDependencyListPage} />+ <IndexRedirect to="breaking" />+ <Route path="breaking" component={BrokenDependencyListPage} /><Route path="unreferenced" component={UnreferencedDependencyListPage} /></>);diff --git a/frontend/src/metabase-types/api/dependencies.ts b/frontend/src/metabase-types/api/dependencies.tsindex 879c955c8e0..7a0e91bf629 100644--- a/frontend/src/metabase-types/api/dependencies.ts+++ b/frontend/src/metabase-types/api/dependencies.ts@@ -251,7 +251,6 @@ export type ListNodeDependentsRequest = {dependent_types?: DependencyType[];dependent_card_types?: CardType[];query?: string;- broken?: boolean;include_personal_collections?: boolean;archived?: boolean;sort_column?: DependencySortColumn;@@ -286,7 +285,7 @@ export const DEPENDENCY_SORT_DIRECTIONS = ["asc", "desc"] as const;export type DependencySortDirection =(typeof DEPENDENCY_SORT_DIRECTIONS)[number];-export type ListBrokenGraphNodesRequest = PaginationRequest & {+export type ListBreakingGraphNodesRequest = PaginationRequest & {types?: DependencyType[];card_types?: CardType[];query?: string;@@ -295,10 +294,20 @@ export type ListBrokenGraphNodesRequest = PaginationRequest & {sort_direction?: DependencySortDirection;};-export type ListBrokenGraphNodesResponse = PaginationResponse & {+export type ListBreakingGraphNodesResponse = PaginationResponse & {data: DependencyNode[];};+export type ListBrokenGraphNodesRequest = {+ id: DependencyId;+ type: DependencyType;+ dependent_types?: DependencyType[];+ dependent_card_types?: CardType[];+ include_personal_collections?: boolean;+ sort_column?: DependencySortColumn;+ sort_direction?: DependencySortDirection;+};+export type ListUnreferencedGraphNodesRequest = PaginationRequest & {types?: DependencyType[];card_types?: CardType[];diff --git a/frontend/src/metabase-types/api/mocks/dependencies.ts b/frontend/src/metabase-types/api/mocks/dependencies.tsindex 9b21a72ef5f..f41b32a8704 100644--- a/frontend/src/metabase-types/api/mocks/dependencies.ts+++ b/frontend/src/metabase-types/api/mocks/dependencies.ts@@ -13,8 +13,8 @@ import type {DependencyGraph,DocumentDependencyNode,DocumentDependencyNodeData,- ListBrokenGraphNodesRequest,- ListBrokenGraphNodesResponse,+ ListBreakingGraphNodesRequest,+ ListBreakingGraphNodesResponse,ListUnreferencedGraphNodesRequest,ListUnreferencedGraphNodesResponse,MeasureDependencyNode,@@ -334,16 +334,16 @@ export function createMockMeasureDependencyNode(}export function createMockListBrokenGraphNodesRequest(- opts?: Partial<ListBrokenGraphNodesRequest>,-): ListBrokenGraphNodesRequest {+ opts?: Partial<ListBreakingGraphNodesRequest>,+): ListBreakingGraphNodesRequest {return {...opts,};}export function createMockListBrokenGraphNodesResponse(- opts?: Partial<ListBrokenGraphNodesResponse>,-): ListBrokenGraphNodesResponse {+ opts?: Partial<ListBreakingGraphNodesResponse>,+): ListBreakingGraphNodesResponse {return {data: [],total: 0,diff --git a/frontend/src/metabase/lib/urls/dependencies.ts b/frontend/src/metabase/lib/urls/dependencies.tsindex a5955b6e477..5b232e3b8cd 100644--- a/frontend/src/metabase/lib/urls/dependencies.ts+++ b/frontend/src/metabase/lib/urls/dependencies.ts@@ -78,8 +78,8 @@ function dependencyListQueryString({return queryString.length > 0 ? `?${queryString}` : "";}-export function brokenDependencies(params?: DependencyListParams) {- return `${dependencyDiagnostics()}/broken${dependencyListQueryString(params)}`;+export function breakingDependencies(params?: DependencyListParams) {+ return `${dependencyDiagnostics()}/breaking${dependencyListQueryString(params)}`;}export function unreferencedDependencies(params?: DependencyListParams) {diff --git a/frontend/test/__support__/server-mocks/dependencies.ts b/frontend/test/__support__/server-mocks/dependencies.tsindex 1244fd6ee4c..78c04e07c06 100644--- a/frontend/test/__support__/server-mocks/dependencies.ts+++ b/frontend/test/__support__/server-mocks/dependencies.ts@@ -2,7 +2,8 @@ import fetchMock from "fetch-mock";import type {CheckDependenciesResponse,- ListBrokenGraphNodesResponse,+ DependencyNode,+ ListBreakingGraphNodesResponse,ListUnreferencedGraphNodesResponse,} from "metabase-types/api";@@ -28,10 +29,18 @@ export function setupCheckTransformDependenciesEndpoint(fetchMock.post("path:/api/ee/dependencies/check_transform", response);}-export function setupListBrokenGraphNodesEndpoint(- response: ListBrokenGraphNodesResponse,+export function setupListGraphNodeDependentsEndpoint(nodes: DependencyNode[]) {+ fetchMock.get("path:/api/ee/dependencies/graph/dependents", nodes);+}++export function setupListBreakingGraphNodesEndpoint(+ response: ListBreakingGraphNodesResponse,) {- fetchMock.get("path:/api/ee/dependencies/graph/broken", response);+ fetchMock.get("path:/api/ee/dependencies/graph/breaking", response);+}++export function setupListBrokenGraphNodesEndpoint(nodes: DependencyNode[]) {+ fetchMock.get("path:/api/ee/dependencies/graph/broken", nodes);}export function setupListUnreferencedGraphNodesEndpoint(