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
Enable cljfmt fixing comment alignment (#74613)
Cam Saulcc84d9347768
diff --git a/.clj-kondo/src/hooks/common.clj b/.clj-kondo/src/hooks/common.cljindex 622819a1b24..2b36c72e4ec 100644--- a/.clj-kondo/src/hooks/common.clj+++ b/.clj-kondo/src/hooks/common.clj@@ -500,8 +500,8 @@(and resolved (:ns resolved))(symbol (name (:ns resolved)) (name (:name resolved)))- ;; if it wasn't resolved but is still qualified it's probably using the full namespace name rather than an- ;; alias.+ ;; if it wasn't resolved but is still qualified it's probably using the full namespace name rather than an+ ;; alias.(qualified-symbol? sexpr)sexpr)))));; some symbols like `*count/Integer` aren't resolvable.diff --git a/.clj-kondo/src/hooks/metabase/test/util.clj b/.clj-kondo/src/hooks/metabase/test/util.cljindex 7335f9b3ad6..fbee34aac69 100644--- a/.clj-kondo/src/hooks/metabase/test/util.clj+++ b/.clj-kondo/src/hooks/metabase/test/util.clj@@ -28,8 +28,8 @@(mapcat (fn [[setting-name v]](concat[(with-meta (hooks/token-node '_) (meta setting-name)) v]- ;; if the setting name is namespace-qualified add a `_`- ;; entry for it too.+ ;; if the setting name is namespace-qualified add a `_`+ ;; entry for it too.(when (namespaced-symbol-node? setting-name)[(with-meta (hooks/token-node '_) (meta setting-name)) setting-name]))))(partition 2 (:children bindings))))diff --git a/.clj-kondo/src/hooks/metabase/util/i18n.clj b/.clj-kondo/src/hooks/metabase/util/i18n.cljindex a8bd84cf90c..802bbee8e74 100644--- a/.clj-kondo/src/hooks/metabase/util/i18n.clj+++ b/.clj-kondo/src/hooks/metabase/util/i18n.clj@@ -13,23 +13,23 @@(let [c (first chars)](if (= c \')(cond- ;; Doubled quotes: skip both+ ;; Doubled quotes: skip both(and (next chars) (= (second chars) \'))(recur (nthrest chars 2))- ;; Placeholder escape. We allow for intentional escaping, like either '{0}` or '{{`, but not 'arbitrary- ;; strings' So basically, just require the *next* character to be a `{`, find the next single-quote, and- ;; continue on from there.- ;;- ;; Technically a string like "foo bar's happy but i'm not" is totally fine, but we'll say it's invalid- ;; because... that inner string literal is probably not what we actually want. So since we've never done- ;; this intentionally as far as I can tell, let's just remove the possibility to avoid ambiguity.+ ;; Placeholder escape. We allow for intentional escaping, like either '{0}` or '{{`, but not 'arbitrary+ ;; strings' So basically, just require the *next* character to be a `{`, find the next single-quote, and+ ;; continue on from there.+ ;;+ ;; Technically a string like "foo bar's happy but i'm not" is totally fine, but we'll say it's invalid+ ;; because... that inner string literal is probably not what we actually want. So since we've never done+ ;; this intentionally as far as I can tell, let's just remove the possibility to avoid ambiguity.(= (second chars) \{)(let [at-closing (drop-while #(not= \' %) (next chars))](if (seq at-closing)(recur (next at-closing))false))- ;; Unpaired single quote: invalid+ ;; Unpaired single quote: invalid:elsefalse)(recur (rest chars)))))))diff --git a/.cljfmt.edn b/.cljfmt.ednindex 7856b7a10c8..13c573f60d9 100644--- a/.cljfmt.edn+++ b/.cljfmt.edn@@ -1,12 +1,9 @@;; Cljfmt config. See https://github.com/weavejester/cljfmt#formatting-options-{:sort-ns-references?- true-- :function-arguments-indentation- :community-- :parallel?- true+{:function-arguments-indentation :community+ :indent-line-comments? true+ :normalize-newlines-at-file-end? true+ :parallel? true+ :sort-ns-references? true:paths["src"diff --git a/bin/lint-migrations-file/src/lint_migrations_file.cljc b/bin/lint-migrations-file/src/lint_migrations_file.cljcindex 8f6fb75837f..5fc3a41c663 100644--- a/bin/lint-migrations-file/src/lint_migrations_file.cljc+++ b/bin/lint-migrations-file/src/lint_migrations_file.cljc@@ -116,14 +116,14 @@(let [match-target-types? (fn [ttype](contains? types (str/lower-case ttype)))](cond- ;; a createTable or addColumn change; see if it adds a target-type col+ ;; a createTable or addColumn change; see if it adds a target-type col(or (:createTable change) (:addColumn change))(let [op (cond (:createTable change) :createTable (:addColumn change) :addColumn)](some (fn [col-def](match-target-types? (get-in col-def [:column :type] "")))(get-in change [op :columns])))- ;; a modifyDataType change; see if it change a column to target-type+ ;; a modifyDataType change; see if it change a column to target-type(and (:modifyDataType change)(match-target-types? (get-in change [:modifyDataType :newDataType] "")))true)))diff --git a/bin/release-list/src/release_list/main.clj b/bin/release-list/src/release_list/main.cljindex 1346e6df33f..ed62f4993f9 100644--- a/bin/release-list/src/release_list/main.clj+++ b/bin/release-list/src/release_list/main.clj@@ -99,7 +99,7 @@(let [target "../../docs/releases.md"](shell (str "rm -rf " target))- ;; Publish releases+ ;; Publish releases(spit target(-> list-of-releasesprep-linksdiff --git a/deps.edn b/deps.ednindex f625e64aa75..8ab8d42c7a9 100644--- a/deps.edn+++ b/deps.edn@@ -773,10 +773,9 @@;; ./bin/mage cljfmt-all;;;; ./bin/mage cljfmt-all -h for more info- :cljfmt- {:deps {io.github.weavejester/cljfmt {:mvn/version "0.15.3"}}- :ns-default cljfmt.tool- :exec-fn cljfmt.tool/fix}+ ;;+ ;; (this doc was here because we previously had a `:cljfmt` alias here, now specified in `bb.edn`, but leaving these+ ;; dox here in case anyone comes looking for it -- Cam;;; building Uberjar, build and release scriptsdiff --git a/enterprise/backend/src/metabase_enterprise/advanced_config/file/workspace.clj b/enterprise/backend/src/metabase_enterprise/advanced_config/file/workspace.cljindex 3ce6348ff89..14abeaf919c 100644--- a/enterprise/backend/src/metabase_enterprise/advanced_config/file/workspace.clj+++ b/enterprise/backend/src/metabase_enterprise/advanced_config/file/workspace.clj@@ -99,7 +99,7 @@(cond-> {}(:db components) (assoc :db (:db positions))(:schema components) (assoc :schema schema)- ;; No-schema drivers (MySQL): the namespace name lands in the db slot.+ ;; No-schema drivers (MySQL): the namespace name lands in the db slot.(and (:db components) (not (:schema components)))(assoc :db schema))))diff --git a/enterprise/backend/src/metabase_enterprise/cache/task/refresh_cache_configs.clj b/enterprise/backend/src/metabase_enterprise/cache/task/refresh_cache_configs.cljindex f59ab07e24a..a090e4bc672 100644--- a/enterprise/backend/src/metabase_enterprise/cache/task/refresh_cache_configs.clj+++ b/enterprise/backend/src/metabase_enterprise/cache/task/refresh_cache_configs.clj@@ -122,9 +122,9 @@(if parameterized?[:and[:= :qe.parameterized true]- ;; Only rerun a parameterized query if it's had a cache hit within the last caching window+ ;; Only rerun a parameterized query if it's had a cache hit within the last caching window[:= :qe.cache_hit true]- ;; Don't factor the last cache refresh into whether we should rerun a parameterized query+ ;; Don't factor the last cache refresh into whether we should rerun a parameterized query[:not= :qe.context (name :cache-refresh)]][:= :qe.parameterized false])]:group-by [:q.query_hash :q.query :qc.query_hash :qe.card_id :qe.dashboard_id]}}))]diff --git a/enterprise/backend/src/metabase_enterprise/checker/provider.clj b/enterprise/backend/src/metabase_enterprise/checker/provider.cljindex c28a94b6a50..5bd6c5d11d5 100644--- a/enterprise/backend/src/metabase_enterprise/checker/provider.clj+++ b/enterprise/backend/src/metabase_enterprise/checker/provider.clj@@ -278,12 +278,12 @@;;; ===========================================================================(deftype SourceMetadataProvider- ;; The store knows what entities exist, loads raw YAML data, assigns integer IDs, and caches.- ;; The provider adapts the store into the MetadataProvider interface that lib/query expects,- ;; converting raw YAML maps to lib metadata format along the way.- ;;- ;; `current-db` is an atom holding the database name (string) to return from `(database)`.- ;; Must be set via `set-database!` before each entity check and unset afterward.+ ;; The store knows what entities exist, loads raw YAML data, assigns integer IDs, and caches.+ ;; The provider adapts the store into the MetadataProvider interface that lib/query expects,+ ;; converting raw YAML maps to lib metadata format along the way.+ ;;+ ;; `current-db` is an atom holding the database name (string) to return from `(database)`.+ ;; Must be set via `set-database!` before each entity check and unset afterward.[store current-db]ISettableDatabase(set-database! [_this db-name]diff --git a/enterprise/backend/src/metabase_enterprise/dependencies/api.clj b/enterprise/backend/src/metabase_enterprise/dependencies/api.cljindex 62956ba6b85..25490b859bf 100644--- a/enterprise/backend/src/metabase_enterprise/dependencies/api.clj+++ b/enterprise/backend/src/metabase_enterprise/dependencies/api.clj@@ -82,10 +82,10 @@card (-> original(assoc :dataset-query (:dataset_query body):type (:type body (:type original)))- ;; Remove the old `:result-metadata` from the card, it's likely wrong now.+ ;; Remove the old `:result-metadata` from the card, it's likely wrong now.(dissoc :result-metadata)- ;; But if the request includes `:result_metadata`, use that. It may be from a native card- ;; that's been run before saving the card.+ ;; But if the request includes `:result_metadata`, use that. It may be from a native card+ ;; that's been run before saving the card.(cond-> #_card(:result_metadata body) (assoc :result-metadata (:result_metadata body))))edits {:card [card]}diff --git a/enterprise/backend/src/metabase_enterprise/gsheets/settings.clj b/enterprise/backend/src/metabase_enterprise/gsheets/settings.cljindex a39a1b0d0cb..ba4148349fb 100644--- a/enterprise/backend/src/metabase_enterprise/gsheets/settings.clj+++ b/enterprise/backend/src/metabase_enterprise/gsheets/settings.clj@@ -124,8 +124,8 @@:type :json:getter (mu/fn :- :gsheets/setting [](or- ;; This NEEDS to be up to date between instances on a cluster, so:- ;; we are going around the settings cache:+ ;; This NEEDS to be up to date between instances on a cluster, so:+ ;; we are going around the settings cache:(some-> (t2/select-one :model/Setting :key "gsheets") :value json/decode+kw migrate-gsheet-value)(u/prog1 gsheets.constants/not-connected(setting/set-value-of-type! :json :gsheets <>)))))diff --git a/enterprise/backend/src/metabase_enterprise/harbormaster/client.clj b/enterprise/backend/src/metabase_enterprise/harbormaster/client.cljindex bab0b13f466..7f0ef974cd5 100644--- a/enterprise/backend/src/metabase_enterprise/harbormaster/client.clj+++ b/enterprise/backend/src/metabase_enterprise/harbormaster/client.clj@@ -232,4 +232,4 @@;; Call the :list-connections operation.(call :list-connections))- ;; => ()+;; => ()diff --git a/enterprise/backend/src/metabase_enterprise/metabot/task/ai_usage_trimmer.clj b/enterprise/backend/src/metabase_enterprise/metabot/task/ai_usage_trimmer.cljindex 41df1b07091..47f839d529f 100644--- a/enterprise/backend/src/metabase_enterprise/metabot/task/ai_usage_trimmer.clj+++ b/enterprise/backend/src/metabase_enterprise/metabot/task/ai_usage_trimmer.clj@@ -42,6 +42,6 @@(triggers/with-identity trimmer-trigger-key)(triggers/start-now)(triggers/with-schedule- ;; daily at 23:14:37+ ;; daily at 23:14:37(cron/cron-schedule "37 14 23 * * ?")))](task/schedule-task! job trigger)))diff --git a/enterprise/backend/src/metabase_enterprise/remote_sync/task/table_cleanup.clj b/enterprise/backend/src/metabase_enterprise/remote_sync/task/table_cleanup.cljindex 25da529cbfa..84919f09af7 100644--- a/enterprise/backend/src/metabase_enterprise/remote_sync/task/table_cleanup.clj+++ b/enterprise/backend/src/metabase_enterprise/remote_sync/task/table_cleanup.clj@@ -52,6 +52,6 @@(triggers/with-identity cleanup-trigger-key)(triggers/start-now)(triggers/with-schedule- ;; Run daily at 2:29 AM+ ;; Run daily at 2:29 AM(cron/cron-schedule "0 29 2 * * ?")))](task/schedule-task! job trigger)))diff --git a/enterprise/backend/src/metabase_enterprise/sandbox/api/table.clj b/enterprise/backend/src/metabase_enterprise/sandbox/api/table.cljindex 14c3fd5ac40..211ddd8230d 100644--- a/enterprise/backend/src/metabase_enterprise/sandbox/api/table.clj+++ b/enterprise/backend/src/metabase_enterprise/sandbox/api/table.clj@@ -62,8 +62,8 @@(if (only-sandboxed-perms? table)(filter-fields-for-sandboxingtable- ;; if the user has sandboxed perms, temporarily upgrade their perms to read perms for the Table so they can- ;; fetch the metadata+ ;; if the user has sandboxed perms, temporarily upgrade their perms to read perms for the Table so they can+ ;; fetch the metadata(perms/with-additional-table-permission :perms/view-data (:db_id table) (u/the-id table) :unrestricted(perms/with-additional-table-permission :perms/create-queries (:db_id table) (u/the-id table) :query-builder(thunk))))@@ -80,8 +80,8 @@(if (only-sandboxed-perms? table)(filter-fields-for-sandboxingtable- ;; if the user has sandboxed perms, temporarily upgrade their perms to read perms for the Table so they can- ;; fetch the metadata+ ;; if the user has sandboxed perms, temporarily upgrade their perms to read perms for the Table so they can+ ;; fetch the metadata(perms/with-additional-table-permission :perms/view-data (:db_id table) (u/the-id table) :unrestricted(perms/with-additional-table-permission :perms/create-queries (:db_id table) (u/the-id table) :query-buildertable)))diff --git a/enterprise/backend/src/metabase_enterprise/sandbox/api/util.clj b/enterprise/backend/src/metabase_enterprise/sandbox/api/util.cljindex ffa0dbbcc7a..0e92b797892 100644--- a/enterprise/backend/src/metabase_enterprise/sandbox/api/util.clj+++ b/enterprise/backend/src/metabase_enterprise/sandbox/api/util.clj@@ -87,8 +87,8 @@(let [sandboxes (t2/hydrate (seq (perms/sandboxes-for-user)) :table)](some #(= (get-in % [:table :db_id]) database-id)sandboxes))- ;; If no *current-user-id* is bound we can't check for sandboxes, so we should throw in this case to avoid- ;; returning `false` for users who should actually be sandboxes.+ ;; If no *current-user-id* is bound we can't check for sandboxes, so we should throw in this case to avoid+ ;; returning `false` for users who should actually be sandboxes.(throw (ex-info (str (tru "No current user found")){:status-code 403})))))diff --git a/enterprise/backend/src/metabase_enterprise/semantic_search/task/index_cleanup.clj b/enterprise/backend/src/metabase_enterprise/semantic_search/task/index_cleanup.cljindex ef8a8446052..a538edd3706 100644--- a/enterprise/backend/src/metabase_enterprise/semantic_search/task/index_cleanup.clj+++ b/enterprise/backend/src/metabase_enterprise/semantic_search/task/index_cleanup.clj@@ -188,7 +188,7 @@(triggers/with-identity cleanup-trigger-key)(triggers/start-now)(triggers/with-schedule- ;; Run daily at 3 AM+ ;; Run daily at 3 AM(cron/cron-schedule "0 0 3 * * ? *")))](task/schedule-task! job trigger))))diff --git a/enterprise/backend/src/metabase_enterprise/semantic_search/task/index_repair.clj b/enterprise/backend/src/metabase_enterprise/semantic_search/task/index_repair.cljindex 6adea36cf33..01f1097b05e 100644--- a/enterprise/backend/src/metabase_enterprise/semantic_search/task/index_repair.clj+++ b/enterprise/backend/src/metabase_enterprise/semantic_search/task/index_repair.clj@@ -38,6 +38,6 @@(triggers/with-identity repair-trigger-key)(triggers/start-now)(triggers/with-schedule- ;; Run hourly at minute 15+ ;; Run hourly at minute 15(cron/cron-schedule "0 15 * * * ? *")))](task/schedule-task! job trigger))))diff --git a/enterprise/backend/src/metabase_enterprise/semantic_search/task/indexer.clj b/enterprise/backend/src/metabase_enterprise/semantic_search/task/indexer.cljindex 0048807f607..50aed9377da 100644--- a/enterprise/backend/src/metabase_enterprise/semantic_search/task/indexer.clj+++ b/enterprise/backend/src/metabase_enterprise/semantic_search/task/indexer.clj@@ -42,8 +42,8 @@(vreset! execution-thread-ref nil))))))))org.quartz.InterruptableJob(interrupt [_]- ;; locking required here to avoid racing with the unset in the finally- ;; and interrupting some other unintended task/work+ ;; locking required here to avoid racing with the unset in the finally+ ;; and interrupting some other unintended task/work(locking execution-thread-ref(when-some [^Thread execution-thread @execution-thread-ref](.interrupt execution-thread)))))diff --git a/enterprise/backend/src/metabase_enterprise/semantic_search/task/usage_trimmer.clj b/enterprise/backend/src/metabase_enterprise/semantic_search/task/usage_trimmer.cljindex 049004ede02..2b04df57dae 100644--- a/enterprise/backend/src/metabase_enterprise/semantic_search/task/usage_trimmer.clj+++ b/enterprise/backend/src/metabase_enterprise/semantic_search/task/usage_trimmer.clj@@ -41,6 +41,6 @@(triggers/with-identity trimmer-trigger-key)(triggers/start-now)(triggers/with-schedule- ;; daily at 22:59:42+ ;; daily at 22:59:42(cron/cron-schedule "42 59 22 * * ?")))](task/schedule-task! job trigger))))diff --git a/enterprise/backend/src/metabase_enterprise/serialization/v2/backfill_ids.clj b/enterprise/backend/src/metabase_enterprise/serialization/v2/backfill_ids.cljindex 5cd4f393273..0d9a0476a0b 100644--- a/enterprise/backend/src/metabase_enterprise/serialization/v2/backfill_ids.clj+++ b/enterprise/backend/src/metabase_enterprise/serialization/v2/backfill_ids.clj@@ -27,9 +27,9 @@"Returns true if the model has an `:entity_id` column."[model](or- ;; toucan1 models+ ;; toucan1 models(isa? model ::mi/entity-id)- ;; toucan2 models+ ;; toucan2 models(isa? model :hook/entity-id)))(defn backfill-ids!diff --git a/enterprise/backend/src/metabase_enterprise/upload_management/api.clj b/enterprise/backend/src/metabase_enterprise/upload_management/api.cljindex 0e4d911bb11..60e7f8b9c18 100644--- a/enterprise/backend/src/metabase_enterprise/upload_management/api.clj+++ b/enterprise/backend/src/metabase_enterprise/upload_management/api.clj@@ -27,7 +27,7 @@"Get all `Tables` visible to the current user which were created by uploading a file."[](as-> (t2/select :model/Table, :active true, :is_upload true, {:order-by [[:name :asc]]}) tables- ;; See https://github.com/metabase/metabase/issues/41023+ ;; See https://github.com/metabase/metabase/issues/41023(concat tables (attached-dwh-tables))(map #(update % :schema str) tables)(filter mi/can-read? tables)diff --git a/enterprise/backend/test/metabase_enterprise/action_v2/api_test.clj b/enterprise/backend/test/metabase_enterprise/action_v2/api_test.cljindex e79dbe4d46b..bc9bff92eb6 100644--- a/enterprise/backend/test/metabase_enterprise/action_v2/api_test.clj+++ b/enterprise/backend/test/metabase_enterprise/action_v2/api_test.clj@@ -172,7 +172,7 @@(mt/with-premium-features #{actions-feature-flag}(mt/test-drivers (mt/normal-drivers-with-feature :actions/data-editing)(action-v2.tu/with-test-tables! [table-id [{:id_1 'auto-inc-type- ;; MySQL does not support multiple auto increment fields.+ ;; MySQL does not support multiple auto increment fields.:id_2 [:integer]:name [:text]:song [:text]}@@ -511,18 +511,18 @@[:text :Coercion/ISO8601->Date "2025-03-25T00:00:00Z" "2025-03-25":text :Coercion/ISO8601->Time "1999-04-05T14:34:42Z" "14:34:42"- ;; note fractional seconds in input, remains undefined for Seconds+ ;; note fractional seconds in input, remains undefined for Seconds:int :Coercion/UNIXSeconds->DateTime "2025-03-25T14:34:42Z" (quot (inst-ms #inst "2025-03-25T14:34:42Z") 1000):bigint :Coercion/UNIXMilliSeconds->DateTime "2025-03-25T14:34:42.314Z" (inst-ms #inst "2025-03-25T14:34:42.314Z")- ;; note fractional secs beyond millis are discarded (lossy)+ ;; note fractional secs beyond millis are discarded (lossy):bigint :Coercion/UNIXMicroSeconds->DateTime "2025-03-25T14:34:42.314121Z" (* (inst-ms #inst "2025-03-25T14:34:42.314Z") 1000):bigint :Coercion/UNIXNanoSeconds->DateTime "2025-03-25T14:34:42.3141212Z" (* (inst-ms #inst "2025-03-25T14:34:42.314Z") 1000000)- ;; nil safe+ ;; nil safe:text :Coercion/YYYYMMDDHHMMSSString->Temporal nil nil- ;; seconds component does not work properly here, lost by qp output, bug in existing code?+ ;; seconds component does not work properly here, lost by qp output, bug in existing code?#_#_#_#_:text :Coercion/YYYYMMDDHHMMSSString->Temporal "2025-03-25T14:34:42Z" "20250325143442"])(partition 4)(check-coercion-fn-coverage @#'coerce/unimplemented-coercion-functions)diff --git a/enterprise/backend/test/metabase_enterprise/action_v2/models/undo_test.clj b/enterprise/backend/test/metabase_enterprise/action_v2/models/undo_test.cljindex dbf94ce172d..886a620c8c4 100644--- a/enterprise/backend/test/metabase_enterprise/action_v2/models/undo_test.clj+++ b/enterprise/backend/test/metabase_enterprise/action_v2/models/undo_test.clj@@ -145,8 +145,8 @@(let [user-1 (mt/user->id :crowberto)test-scope {:table-id table-id}]- ;; NOTE: this test relies on the "conflicts even when different columns changed" semantics- ;; If we improve the semantics, we'll need to improve this test!+ ;; NOTE: this test relies on the "conflicts even when different columns changed" semantics+ ;; If we improve the semantics, we'll need to improve this test!(write-sequence! table-id {:id 2} [[user-1 {:name "Moomintroll" :power 3}][user-1 {:name "Moomintroll" :power 9001}]diff --git a/enterprise/backend/test/metabase_enterprise/action_v2/validation_test.clj b/enterprise/backend/test/metabase_enterprise/action_v2/validation_test.cljindex 7f82490db0c..cc6c52f84a8 100644--- a/enterprise/backend/test/metabase_enterprise/action_v2/validation_test.clj+++ b/enterprise/backend/test/metabase_enterprise/action_v2/validation_test.clj@@ -3,7 +3,7 @@[clojure.test :refer :all][metabase-enterprise.action-v2.validation :as validation]))- ;; Test field definitions+;; Test field definitions(def float-field{:name "price" :base_type :type/Float :database_required false})@@ -272,7 +272,7 @@[nil [{"big_count" "-9223372036854775809"}] [biginteger-field]] ; Long.MIN_VALUE - 1;; Invalid cases- ;; Invalid cases+ ;; Invalid cases[[{"big_count" "Must be an integer"}] [{"big_count" "123.45"}] [biginteger-field]][[{"big_count" "Must be an integer"}] [{"big_count" "abc"}] [biginteger-field]][[{"big_count" "Must be an integer"}] [{"big_count" 123.45}] [biginteger-field]]diff --git a/enterprise/backend/test/metabase_enterprise/advanced_config/file/databases_test.clj b/enterprise/backend/test/metabase_enterprise/advanced_config/file/databases_test.cljindex a2b5eb288f8..43ed64b095f 100644--- a/enterprise/backend/test/metabase_enterprise/advanced_config/file/databases_test.clj+++ b/enterprise/backend/test/metabase_enterprise/advanced_config/file/databases_test.clj@@ -152,7 +152,7 @@:details (:details (mt/db)):settings {:auto-cruft-columns crufted-field-setting}})](is (future? sync-future))- ;; wait for the sync to finish or crash out after 5 seconds+ ;; wait for the sync to finish or crash out after 5 seconds(deref sync-future 5000 :timeout)(sync-metadata/sync-db-metadata! (t2/select-one :model/Database :name test-db-name))(is (= 1 (t2/count :model/Database :name test-db-name)))diff --git a/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/channel_test.clj b/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/channel_test.cljindex 7140ff71cbb..30d8430aaae 100644--- a/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/channel_test.clj+++ b/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/channel_test.clj@@ -7,7 +7,7 @@[metabase.test :as mt]))(comment- ;; to register the :metabase-test channel implementation+ ;; to register the :metabase-test channel implementationnotification.tu/keepme)(deftest channel-api-testdiff --git a/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/group_manager_test.clj b/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/group_manager_test.cljindex 6004d1ad6be..67935190339 100644--- a/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/group_manager_test.clj+++ b/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/group_manager_test.clj@@ -335,7 +335,7 @@{:user_group_memberships new-user-group-membership}))))(remove-user-from-group! [req-user status group-to-remove](u/ignore-exceptions- ;; ensure `user-to-update` is in `group-to-remove`+ ;; ensure `user-to-update` is in `group-to-remove`(perms/add-user-to-group! user-to-update group-to-remove))(let [current-user-group-membership (gm/user-group-memberships user-to-update)new-user-group-membership (into [] (filter #(not= (:id group-to-remove)diff --git a/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/subscription_test.clj b/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/subscription_test.cljindex fc6bbf7c8bd..88f3010bd2a 100644--- a/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/subscription_test.clj+++ b/enterprise/backend/test/metabase_enterprise/advanced_permissions/api/subscription_test.clj@@ -89,8 +89,8 @@(mt/with-temp [:model/User {sub-creator-id :id} {:email "[email protected]"}:model/PermissionsGroup {group-id :id} {}:model/PermissionsGroupMembership _ {:user_id sub-creator-id :group_id group-id}]- ;; Subscription creator initially has full download perms on the products table.- ;; The card is authored by crowberto (admin) — never the subscription creator.+ ;; Subscription creator initially has full download perms on the products table.+ ;; The card is authored by crowberto (admin) — never the subscription creator.(perms/set-database-permission! group-id (mt/id) :perms/view-data :unrestricted)(perms/set-table-permission! group-id (mt/id :products) :perms/create-queries :query-builder)(perms/set-table-permission! group-id (mt/id :products) :perms/download-results :one-million-rows)@@ -124,8 +124,8 @@(is (seq (csv-attachments-of captured))"expected at least one CSV attachment when subscription creator has full perms")))(testing "after subscription creator's perms drift to :no → CSV attachment is dropped"- ;; Must revoke from BOTH the user's group AND the All Users group, since the user- ;; is implicitly in All Users and download-perms-level takes the max across groups.+ ;; Must revoke from BOTH the user's group AND the All Users group, since the user+ ;; is implicitly in All Users and download-perms-level takes the max across groups.(perms/set-table-permission! group-id (mt/id :products) :perms/download-results :no)(perms/set-table-permission! (perms/all-users-group) (mt/id :products) :perms/download-results :no)(let [captured (notification.tu/with-captured-channel-send!diff --git a/enterprise/backend/test/metabase_enterprise/cache/cache_test.clj b/enterprise/backend/test/metabase_enterprise/cache/cache_test.cljindex 1fc132c3fe4..faf51ea8f9e 100644--- a/enterprise/backend/test/metabase_enterprise/cache/cache_test.clj+++ b/enterprise/backend/test/metabase_enterprise/cache/cache_test.clj@@ -228,7 +228,7 @@(run-query! card1-id {:dashboard_id (:id dash)}))))(testing "but with overrides - will go through every card and mark cache invalidated"- ;; not a concrete number here since (mt/id) can have a bit more than 2 cards we've currently defined+ ;; not a concrete number here since (mt/id) can have a bit more than 2 cards we've currently defined(is (=? {:count pos-int?}(invalidate! 200 :include :overrides :database (mt/id))))(is (=? {:cached nil :data some?}diff --git a/enterprise/backend/test/metabase_enterprise/cache/config_test.clj b/enterprise/backend/test/metabase_enterprise/cache/config_test.cljindex 4ad854d19b8..f0605c6530c 100644--- a/enterprise/backend/test/metabase_enterprise/cache/config_test.clj+++ b/enterprise/backend/test/metabase_enterprise/cache/config_test.clj@@ -151,7 +151,7 @@(testing "Query finds deletable, and off persisted infos";; use superset, because orphaned PersistedInfo records from other tests might also be deletable(is (set/superset? queued-for-deletion (set (map u/the-id deletable-persisted-infos)))))- ;; we manually pass in the deletable ones to not catch others in a running instance+ ;; we manually pass in the deletable ones to not catch others in a running instance(testing "Both deletables are pruned by prune-deletables!"(#'task.persist-refresh/prune-deletables! test-refresher deletable-persisted-infos)(is (= (set (map u/the-id deletable-persisted-infos)) @called-on))@@ -176,7 +176,7 @@(testing "Query finds only state='deletable' persisted info, and not state='off'"(is (contains? queued-for-deletion (u/the-id pdeletable)))(is (not (contains? queued-for-deletion (u/the-id poff)))))- ;; we manually pass in the deletable ones to not catch others in a running instance+ ;; we manually pass in the deletable ones to not catch others in a running instance(testing "Only state='deletable' is pruned by prune-deletables!, and not state='off'"(#'task.persist-refresh/prune-deletables! test-refresher [pdeletable poff])(is (contains? @called-on (u/the-id pdeletable)))diff --git a/enterprise/backend/test/metabase_enterprise/data_studio/api/table_test.clj b/enterprise/backend/test/metabase_enterprise/data_studio/api/table_test.cljindex 7cd4cb1acb5..1801434705c 100644--- a/enterprise/backend/test/metabase_enterprise/data_studio/api/table_test.clj+++ b/enterprise/backend/test/metabase_enterprise/data_studio/api/table_test.clj@@ -311,7 +311,7 @@(mt/with-no-data-perms-for-all-users!(perms/revoke-collection-permissions! (perms-group/all-users) coll-id)(perms/revoke-collection-permissions! (perms-group/data-analyst) coll-id)- ;; Analyst has data analyst role but no data perms on the table+ ;; Analyst has data analyst role but no data perms on the table(is (= "You don't have permissions to do that."(mt/user-http-request analyst-id :post 403 "ee/data-studio/table/unpublish-tables"{:table_ids [table-id]}))))))))diff --git a/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj b/enterprise/backend/test/metabase_enterprise/dependencies/api_test.cljindex 2c42a85e106..4c829173767 100644--- a/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj+++ b/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj@@ -1225,14 +1225,14 @@products-id (mt/id :products)products (lib.metadata/table mp products-id)price (lib.metadata/field mp (mt/id :products :price))- ;; Create measure A (base measure) via API+ ;; Create measure A (base measure) via API{measure-a-id :id} (mt/user-http-request :crowberto :post 200 "measure"{:name "Measure A":table_id products-id:definition (-> (lib/query mp products)(lib/aggregate (lib/sum price)))})mp' (mt/metadata-provider)- ;; Create measure B that depends on measure A+ ;; Create measure B that depends on measure A{measure-b-id :id} (mt/user-http-request :crowberto :post 200 "measure"{:name "Measure B":table_id products-id@@ -1240,7 +1240,7 @@(lib/aggregate (lib/* (lib.metadata/measure mp' measure-a-id)2)))})mp'' (mt/metadata-provider)- ;; Create measure C that depends on measure B+ ;; Create measure C that depends on measure B{measure-c-id :id} (mt/user-http-request :crowberto :post 200 "measure"{:name "Measure C":table_id products-id@@ -1257,14 +1257,14 @@(is (contains? node-ids measure-b-id))(is (contains? node-ids measure-c-id))(is (contains? node-ids products-id))- ;; Verify the edge from B to A exists+ ;; Verify the edge from B to A exists(is (some #(and (= (:from_entity_type %) "measure")(= (:from_entity_id %) measure-b-id)(= (:to_entity_type %) "measure")(= (:to_entity_id %) measure-a-id))edges)"Edge from B to A should exist")))- ;; Archive measure B (the middle of the chain)+ ;; Archive measure B (the middle of the chain)(mt/user-http-request :crowberto :put 200 (str "measure/" measure-b-id){:archived true :revision_message "Archive middle measure"})(deps.test/synchronously-run-backfill!)@@ -1276,7 +1276,7 @@(is (contains? node-ids measure-c-id) "measure C should still appear")(is (not (contains? node-ids measure-b-id)) "archived measure B should be excluded")(is (not (contains? node-ids measure-a-id)) "measure A should be excluded (unreachable)")- ;; products table still appears because measure C has a direct dependency on it+ ;; products table still appears because measure C has a direct dependency on it(is (contains? node-ids products-id) "products table still appears (direct dep from C)")))(testing "with archived=true, the full chain is visible again"(let [response (mt/user-http-request :crowberto :get 200 "ee/dependencies/graph"diff --git a/enterprise/backend/test/metabase_enterprise/dependencies/events_test.clj b/enterprise/backend/test/metabase_enterprise/dependencies/events_test.cljindex 62c7cbe7ae4..61d411c75ad 100644--- a/enterprise/backend/test/metabase_enterprise/dependencies/events_test.clj+++ b/enterprise/backend/test/metabase_enterprise/dependencies/events_test.clj@@ -718,13 +718,13 @@:to_entity_type :card :to_entity_id parent-id}](deps.findings/upsert-analysis! parent)(deps.findings/upsert-analysis! child)- ;; Event marks entity stale in analysis_finding+ ;; Event marks entity stale in analysis_finding(events/publish-event! :event/card-update {:object parent :previous-object parent :user-id api/*current-user-id*})(testing "Parent card should be marked stale"(is (true? (t2/select-one-fn :stale :model/AnalysisFinding:analyzed_entity_type :card:analyzed_entity_id parent-id))))- ;; Run entity-check job to process stale entities+ ;; Run entity-check job to process stale entities(#'task.entity-check/check-entities!)(testing "Parent should be re-analyzed"(is (false? (t2/select-one-fn :stale :model/AnalysisFindingdiff --git a/enterprise/backend/test/metabase_enterprise/email/api_test.clj b/enterprise/backend/test/metabase_enterprise/email/api_test.cljindex ee95a52c32b..362decc3c16 100644--- a/enterprise/backend/test/metabase_enterprise/email/api_test.clj+++ b/enterprise/backend/test/metabase_enterprise/email/api_test.clj@@ -84,15 +84,15 @@settings)))](testing "If we don't change the password we don't see the password"(let [payload (-> (email-override-settings)- ;; user changes one property+ ;; user changes one property(assoc :email-smtp-port 999)- ;; the FE will have an obfuscated value+ ;; the FE will have an obfuscated value(update :email-smtp-password-override setting/obfuscate-value))response (mt/user-http-request :crowberto :put 200 "ee/email/override" payload)](is (= (setting/obfuscate-value "preexisting") (:email-smtp-password-override response)))))(testing "If we change the password we can receive the password"(let [payload (-> (email-override-settings)- ;; user types in a new password+ ;; user types in a new password(assoc :email-smtp-password-override "new-password"))response (mt/user-http-request :crowberto :put 200 "ee/email/override" payload)](is (= "new-password" (:email-smtp-password-override response))))))))))))diff --git a/enterprise/backend/test/metabase_enterprise/metabot/tools/dependencies_test.clj b/enterprise/backend/test/metabase_enterprise/metabot/tools/dependencies_test.cljindex 8f332464419..e64e016d8e2 100644--- a/enterprise/backend/test/metabase_enterprise/metabot/tools/dependencies_test.clj+++ b/enterprise/backend/test/metabase_enterprise/metabot/tools/dependencies_test.clj@@ -159,10 +159,10 @@{:id transform1-id:source modified-source})bad-cards (get-in result [:structured_output :bad_questions])]- ;; Two cards should be broken...+ ;; Two cards should be broken...(is (false? (get-in result [:structured_output :success])))(is (= 2 (get-in result [:structured_output :bad_question_count])))- ;; ...but only one should be reported due to the limit.+ ;; ...but only one should be reported due to the limit.(is (= 1 (count bad-cards))))))))))))(deftest check-transform-dependencies-permission-check-testdiff --git a/enterprise/backend/test/metabase_enterprise/metabot/tools/semantic_search_test.clj b/enterprise/backend/test/metabase_enterprise/metabot/tools/semantic_search_test.cljindex 19bf6397bab..43706aa0777 100644--- a/enterprise/backend/test/metabase_enterprise/metabot/tools/semantic_search_test.clj+++ b/enterprise/backend/test/metabase_enterprise/metabot/tools/semantic_search_test.clj@@ -72,7 +72,7 @@:semantic-queries ["sales"]:entity-types ["table" "dashboard"]}results (search/search args)]- ;; Should return both results combined via RRF+ ;; Should return both results combined via RRF(is (= 2 (count results)))(is (some #(= (:id %) 1) results))(is (some #(= (:id %) 2) results)))))@@ -83,7 +83,7 @@(let [args {:term-queries ["orders" "sales"]:entity-types ["table" "dashboard"]}results (search/search args)]- ;; Both queries return same results, RRF should boost them+ ;; Both queries return same results, RRF should boost them(is (= 2 (count results)))(is (some #(= (:id %) 1) results))(is (some #(= (:id %) 2) results)))))diff --git a/enterprise/backend/test/metabase_enterprise/premium_features/airgap_test.clj b/enterprise/backend/test/metabase_enterprise/premium_features/airgap_test.cljindex c814b3c9e3d..f5ef62d2e7d 100644--- a/enterprise/backend/test/metabase_enterprise/premium_features/airgap_test.clj+++ b/enterprise/backend/test/metabase_enterprise/premium_features/airgap_test.clj@@ -8,8 +8,8 @@(defn- test-fake-features! [& {:keys [token-fn pubk-fn]}](with-redefs- ;; due to the way premium embedding token is implemented, we need to provide a token and a public key,- ;; so we cannot set this with `mt/with-temporary-setting-values`.+ ;; due to the way premium embedding token is implemented, we need to provide a token and a public key,+ ;; so we cannot set this with `mt/with-temporary-setting-values`.[premium-features/premium-embedding-token (constantly (-> (io/resource "fake_ag_token.txt")slurpstr/trimdiff --git a/enterprise/backend/test/metabase_enterprise/sandbox/models/params/field_values_test.clj b/enterprise/backend/test/metabase_enterprise/sandbox/models/params/field_values_test.cljindex 9ae9f654fb5..b2695fe1065 100644--- a/enterprise/backend/test/metabase_enterprise/sandbox/models/params/field_values_test.clj+++ b/enterprise/backend/test/metabase_enterprise/sandbox/models/params/field_values_test.clj@@ -153,7 +153,7 @@(mt/with-temp[:model/Card {card-id :id} {}- ;; user 1 in group 1+ ;; user 1 in group 1:model/User {user-id-1 :id} {}:model/PermissionsGroup {group-id-1 :id} {}:model/PermissionsGroupMembership _ {:group_id group-id-1@@ -162,7 +162,7 @@:group_id group-id-1:table_id (mt/id :categories):attribute_remappings {"State" [:dimension [:field (mt/id :categories :name) nil]]}}- ;; user 2 in group 2 with gtap using the same card+ ;; user 2 in group 2 with gtap using the same card:model/User {user-id-2 :id} {}:model/PermissionsGroup {group-id-2 :id} {}:model/PermissionsGroupMembership _ {:group_id group-id-2@@ -190,7 +190,7 @@:group_id group-id-1:table_id (mt/id :categories):attribute_remappings {"State" [:dimension [:field (mt/id :categories :name) nil]]}}- ;; user 2 in group 2 with gtap using card 2+ ;; user 2 in group 2 with gtap using card 2:model/Card {card-id-2 :id} {}:model/User {user-id-2 :id} {}:model/PermissionsGroup {group-id-2 :id} {}diff --git a/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj b/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.cljindex fde922f4b68..042a991661a 100644--- a/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj+++ b/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj@@ -122,8 +122,8 @@(format-honeysql{:select [[(identifier :checkins :id)][(identifier :checkins :user_id)]- ;; these columns are ILLEGAL, you're NOT allowed to add columns not in the original table.- ;; We should complain loudly and then ignore them.+ ;; these columns are ILLEGAL, you're NOT allowed to add columns not in the original table.+ ;; We should complain loudly and then ignore them.[(identifier :venues :name)][(identifier :venues :category_id)]]:from [[(identifier :checkins)]]@@ -1240,8 +1240,8 @@(mt/with-temp [:model/Card model {:type :model:dataset_query (mt/mbql-queryproducts- ;; note does not include the field we have to filter on. No way- ;; to use the sandbox filter on the cached table+ ;; note does not include the field we have to filter on. No way+ ;; to use the sandbox filter on the cached table{:fields [$id $price]})}];; persist model (as admin, so sandboxing is not applied to the persisted query)(mt/with-test-user :crowberto@@ -1254,7 +1254,7 @@(is (string? (:table_name persisted-info)))(let [query (mt/mbql-query nil- ;; just generate a select count(*) from card__<id>+ ;; just generate a select count(*) from card__<id>{:aggregation [:count]:source-table (str "card__" (:id model))})regular-result (mt/with-test-user :crowberto@@ -1351,7 +1351,7 @@(met/with-gtaps! (mt/$ids orders{:attributes {"user_id" 1}:gtaps {:orders {:remappings {"user_id" [:dimension $user_id->people.id]}}- ;; Since noone's zipcode == 1, this sandboxed table will return nothing+ ;; Since noone's zipcode == 1, this sandboxed table will return nothing:people {:remappings {"user_id" [:dimension $people.zip]}}}})(data-perms/set-table-permission! &group (mt/id :people) :perms/view-data :unrestricted)(is (= 0 (count (mt/rows (qp/process-query (mt/mbql-query orders)))))))))diff --git a/enterprise/backend/test/metabase_enterprise/sandbox/upload_test.clj b/enterprise/backend/test/metabase_enterprise/sandbox/upload_test.cljindex dc0610ce818..1150b473246 100644--- a/enterprise/backend/test/metabase_enterprise/sandbox/upload_test.clj+++ b/enterprise/backend/test/metabase_enterprise/sandbox/upload_test.clj@@ -33,7 +33,7 @@(upload-test/update-csv-with-defaults! verb :user-id (mt/user->id :rasta))))))))))))(deftest based-on-upload-for-sandboxed-user-test- ;; FIXME: Redshift is flaking on `mt/dataset` and I don't know why, so I'm excluding it temporarily+ ;; FIXME: Redshift is flaking on `mt/dataset` and I don't know why, so I'm excluding it temporarily(mt/test-drivers (disj (mt/normal-drivers-with-feature :uploads) :redshift)(upload-test/with-uploads-enabled!(mt/dataset (mt/dataset-definitiondiff --git a/enterprise/backend/test/metabase_enterprise/security_center/matching_test.clj b/enterprise/backend/test/metabase_enterprise/security_center/matching_test.cljindex 300146e89c5..9bcf798372f 100644--- a/enterprise/backend/test/metabase_enterprise/security_center/matching_test.clj+++ b/enterprise/backend/test/metabase_enterprise/security_center/matching_test.clj@@ -184,9 +184,9 @@(is (=? {:match_status :error:last_evaluated_at some?}(t2/select-one :model/SecurityAdvisory :id (:id advisory))))))- ;; Out-of-range: current instance version is not covered by [0.0.1, 0.0.2).- ;; The matching_query in these tests would throw if executed — that's how we- ;; verify the short-circuit actually avoids running the query.+ ;; Out-of-range: current instance version is not covered by [0.0.1, 0.0.2).+ ;; The matching_query in these tests would throw if executed — that's how we+ ;; verify the short-circuit actually avoids running the query.(let [past #t "2020-01-01T00:00:00Z"](testing "out-of-range + already :resolved → skip entirely (query not run, timestamp preserved)"(mt/with-temp [:model/SecurityAdvisory advisory@@ -238,9 +238,9 @@(is (=? {:match_status :resolved:last_evaluated_at some?}(t2/select-one :model/SecurityAdvisory :id (:id advisory))))))- ;; vLOCAL_DEV / vUNKNOWN both parse to nil. An unparseable instance version- ;; must never produce :active — we cannot claim an instance is affected when- ;; we can't even compare its version to the affected ranges.+ ;; vLOCAL_DEV / vUNKNOWN both parse to nil. An unparseable instance version+ ;; must never produce :active — we cannot claim an instance is affected when+ ;; we can't even compare its version to the affected ranges.(doseq [tag ["vLOCAL_DEV" "vUNKNOWN"]](testing (str "unparseable instance version " (pr-str tag) " never yields :active")(is (nil? (matching/parse-version tag)))@@ -250,7 +250,7 @@:title "Test":description "Test":remediation "Upgrade"- ;; Range that would normally match any realistic version.+ ;; Range that would normally match any realistic version.:affected_versions [{:min "0.1.0" :fixed "99.99.99"}]:matching_query {:default {:select [1] :from [:core_user] :limit 1}}:match_status "unknown"diff --git a/enterprise/backend/test/metabase_enterprise/semantic_search/migration_test.clj b/enterprise/backend/test/metabase_enterprise/semantic_search/migration_test.cljindex 265625c47ec..23842200c9a 100644--- a/enterprise/backend/test/metabase_enterprise/semantic_search/migration_test.clj+++ b/enterprise/backend/test/metabase_enterprise/semantic_search/migration_test.clj@@ -231,7 +231,7 @@(semantic.tu/with-test-db-defaults!(with-redefs [semantic.pgvector-api/index-documents! (constantly nil)](semantic.core/init! (semantic.tu/mock-documents) nil)- ;; add column to index table+ ;; add column to index table(let [original-dynamic-schema semantic.db.migration.impl/dynamic-schema-version](with-redefs-fn {#'semantic.db.migration.impl/migrate-dynamic-schema!(fn [tx _opts]diff --git a/enterprise/backend/test/metabase_enterprise/semantic_search/repair_test.clj b/enterprise/backend/test/metabase_enterprise/semantic_search/repair_test.cljindex 960a1160190..203caa0e29e 100644--- a/enterprise/backend/test/metabase_enterprise/semantic_search/repair_test.clj+++ b/enterprise/backend/test/metabase_enterprise/semantic_search/repair_test.clj@@ -70,8 +70,8 @@(semantic.core/update-index! initial-docs)(semantic.tu/index-all!)- ;; Ensure repair-index! brings index into consistency with new documents et.- ;; Note: card 2 and dashboard 3 are missing - should be deleted+ ;; Ensure repair-index! brings index into consistency with new documents et.+ ;; Note: card 2 and dashboard 3 are missing - should be deleted(let [modified-docs [(create-test-document "card" 1 "Dog Training Guide") ; existing - should remain(create-test-document "card" 4 "Bird Watching Tips") ; new - should be added(create-test-document "dashboard" 5 "Wildlife Dashboard")]] ; new - should be addeddiff --git a/enterprise/backend/test/metabase_enterprise/serialization/test_util.clj b/enterprise/backend/test/metabase_enterprise/serialization/test_util.cljindex bf8bbfeee72..c9ee7c9f8b7 100644--- a/enterprise/backend/test/metabase_enterprise/serialization/test_util.clj+++ b/enterprise/backend/test/metabase_enterprise/serialization/test_util.clj@@ -199,7 +199,7 @@:aggregation [:sum [:field numeric-field-id nil]]:breakout [[:field category-field-id nil]]}}}:model/Card {card-id-root :id} {:table_id table-id- ;; https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words+ ;; https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words:name root-card-name:dataset_query {:type :query:database db-id@@ -248,7 +248,7 @@:card_id card-id}:model/DashboardCard {dashcard-top-level-click-id :id} {:dashboard_id dashboard-id:card_id card-id-nested- ;; this is how click actions on a non-table card work (ex: a chart)+ ;; this is how click actions on a non-table card work (ex: a chart):visualization_settings {:click_behavior {:targetId card-id-nested-query:linkType :question:type :link}}}diff --git a/enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.clj b/enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.cljindex 0eea49e1395..4ea3f348ead 100644--- a/enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.clj+++ b/enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.clj@@ -413,7 +413,7 @@:type "category":name "CATEGORY":values_source_type "card"- ;; card_id is in a different collection with dashboard's collection+ ;; card_id is in a different collection with dashboard's collection:values_source_config {:card_id (:id card1s):value_field [:field (:id field1s) nil]}}]}:model/Dashboard dash1s {:name (mt/random-name)@@ -422,7 +422,7 @@:type "category":name "CATEGORY":values_source_type "card"- ;; card_id is in a different collection with dashboard's collection+ ;; card_id is in a different collection with dashboard's collection:values_source_config {:card_id (:id card1s):value_field [:field (:id field1s) nil]}}]}]@@ -460,7 +460,7 @@(testing "ingest and load"(ts/with-db dest-db- ;; ingest+ ;; ingest(testing "doing ingestion"(is (serdes/with-cache (serdes.load/load-metabase! (ingest/ingest-yaml dump-dir)))"successful"))diff --git a/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj b/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.cljindex 3b128ac95a7..03ab5e8667c 100644--- a/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj+++ b/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj@@ -1383,7 +1383,7 @@:type "category":name "CATEGORY":values_source_type "card"- ;; card_id is in a different collection with dashboard's collection+ ;; card_id is in a different collection with dashboard's collection:values_source_config {:card_id c1-1-id:value_field [:field field-id nil]}}]}@@ -1395,7 +1395,7 @@:type "category":name "CATEGORY":values_source_type "card"- ;; card_id is in a different collection with dashboard's collection+ ;; card_id is in a different collection with dashboard's collection:values_source_config {:card_id c1-2-id:value_field [:field field-id nil]}}]}:model/DashboardCard _ {:card_id c4-id@@ -1410,7 +1410,7 @@:model/DashboardCard _ {:card_id c3-1-id:dashboard_id clickdash-id:visualization_settings- ;; Top-level click behavior for the card.+ ;; Top-level click behavior for the card.(let [dimension [:dimension [:field "something" {:base-type "type/Text"}]]mapping-id (json/encode dimension)]{:click_behavior {:type "link"diff --git a/enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.clj b/enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.cljindex 229c2eeb09b..756521376e4 100644--- a/enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.clj+++ b/enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.clj@@ -1462,7 +1462,7 @@(ts/with-db dest-db(serdes.load/load-metabase! (ingestion-in-memory extract1))(ts/with-db source-db- ;; delete the 1st series and update the 3rd series to have position 0, and the 2nd series to have position 1+ ;; delete the 1st series and update the 3rd series to have position 0, and the 2nd series to have position 1(t2/delete! :model/DashboardCardSeries (:id series1s))(t2/update! :model/DashboardCardSeries (:id series3s) {:position 0})(t2/update! :model/DashboardCardSeries (:id series2s) {:position 1})@@ -1470,7 +1470,7 @@(ts/with-db dest-db(let [series-card2d (t2/select-one :model/Card :entity_id (:entity_id series-card2s))series-card3d (t2/select-one :model/Card :entity_id (:entity_id series-card3s))- ;; we deleted the card that corresponds to `series1s`, so a shortcut is to get the one with position=0+ ;; we deleted the card that corresponds to `series1s`, so a shortcut is to get the one with position=0series-to-be-deleted (t2/select-one :model/DashboardCardSeries :position 0)](testing "Sense check: there are 3 series for the dashboard card initially"(is (= 3diff --git a/enterprise/backend/test/metabase_enterprise/serialization/v2/storage_test.clj b/enterprise/backend/test/metabase_enterprise/serialization/v2/storage_test.cljindex 555c160fa74..da4ec5e96ca 100644--- a/enterprise/backend/test/metabase_enterprise/serialization/v2/storage_test.clj+++ b/enterprise/backend/test/metabase_enterprise/serialization/v2/storage_test.clj@@ -173,7 +173,7 @@(is (= (not-empty (sort ks))(not-empty ks)))(do- ;; check every present key is sorted in a monotone increasing order+ ;; check every present key is sorted in a monotone increasing order(is (< idx (get order k)))(recur (rest ks)(long new-idx)))))))diff --git a/enterprise/backend/test/metabase_enterprise/sso/integrations/jwt_test.clj b/enterprise/backend/test/metabase_enterprise/sso/integrations/jwt_test.cljindex 8e4671b2876..8a8e502c126 100644--- a/enterprise/backend/test/metabase_enterprise/sso/integrations/jwt_test.clj+++ b/enterprise/backend/test/metabase_enterprise/sso/integrations/jwt_test.clj@@ -228,7 +228,7 @@:last_name "Toucan":extra "keypairs":are "also present"- ;; registered claims should not be synced as login attributes+ ;; registered claims should not be synced as login attributes:iss "issuer":exp (+ (buddy-util/now) 3600):iat (buddy-util/now)}diff --git a/enterprise/backend/test/metabase_enterprise/support_access_grants/session_integration_test.clj b/enterprise/backend/test/metabase_enterprise/support_access_grants/session_integration_test.cljindex a3be5e64732..47a5a14893c 100644--- a/enterprise/backend/test/metabase_enterprise/support_access_grants/session_integration_test.clj+++ b/enterprise/backend/test/metabase_enterprise/support_access_grants/session_integration_test.clj@@ -167,42 +167,42 @@(with-redefs [sag.settings/support-access-grant-email (constantly email)sag.settings/support-access-grant-first-name (constantly "Support")sag.settings/support-access-grant-last-name (constantly "User")]- ;; Step 1: Create the support user via an initial grant (simulates first-time setup)+ ;; Step 1: Create the support user via an initial grant (simulates first-time setup)(let [initial-grant (grants/create-grant! creator-id 60 "TICKET-INITIAL" "Initial setup")initial-token (:token initial-grant)](is (some? initial-token) "Initial token should be created")- ;; Use the initial token to set the password (simulates the first login)+ ;; Use the initial token to set the password (simulates the first login)(let [initial-response (mt/client :post 200 "session/reset_password"{:token initial-token:password "InitialPassword123!"})](is (true? (:success initial-response)) "Initial reset should succeed"))- ;; Now the support user has:- ;; - A password AuthIdentity (from the password set)- ;; - A consumed support-access-grant AuthIdentity- ;; Simulate what happens when the user also gets an emailed-secret-password-reset token- ;; (e.g., from a previous forgot-password flow or system migration)+ ;; Now the support user has:+ ;; - A password AuthIdentity (from the password set)+ ;; - A consumed support-access-grant AuthIdentity+ ;; Simulate what happens when the user also gets an emailed-secret-password-reset token+ ;; (e.g., from a previous forgot-password flow or system migration)(let [support-user (t2/select-one :model/User :email email)]- ;; Create an emailed-secret-password-reset AuthIdentity directly (simulating prior usage)+ ;; Create an emailed-secret-password-reset AuthIdentity directly (simulating prior usage)(let [fake-token (auth-identity/create-password-reset! (:id support-user))](is (some? fake-token) "Should create emailed-secret-password-reset token")- ;; Verify the pre-existing auth identity exists+ ;; Verify the pre-existing auth identity exists(is (t2/exists? :model/AuthIdentity:user_id (:id support-user):provider "emailed-secret-password-reset")"emailed-secret-password-reset AuthIdentity should exist"))- ;; Step 2: Revoke the initial grant so we can create a new one+ ;; Step 2: Revoke the initial grant so we can create a new one(let [initial-grant-record (t2/select-one :model/SupportAccessGrantLog:ticket_number "TICKET-INITIAL")](grants/revoke-grant! creator-id (:id initial-grant-record)))- ;; Step 3: Create a NEW support access grant (simulates the production scenario)+ ;; Step 3: Create a NEW support access grant (simulates the production scenario)(let [new-grant (grants/create-grant! creator-id 60 "TICKET-REPRO" "Repro grant")new-token (:token new-grant)new-password "NewSecurePassword456!"](is (some? new-token) "New token should be created")- ;; Step 4: Try to reset password with the new token- ;; This is where the production bug manifests:- ;; The pre-existing emailed-secret-password-reset AuthIdentity triggers- ;; a cascade in model hooks that may cause an exception swallowed by with-fallback+ ;; Step 4: Try to reset password with the new token+ ;; This is where the production bug manifests:+ ;; The pre-existing emailed-secret-password-reset AuthIdentity triggers+ ;; a cascade in model hooks that may cause an exception swallowed by with-fallback(testing "Password reset succeeds with pre-existing auth identities"(let [response (mt/client :post 200 "session/reset_password"{:token new-token@@ -284,20 +284,20 @@(with-redefs [sag.settings/support-access-grant-email (constantly email)sag.settings/support-access-grant-first-name (constantly "Support")sag.settings/support-access-grant-last-name (constantly "User")]- ;; Create and use a first grant so the support user exists+ ;; Create and use a first grant so the support user exists(let [first-grant (grants/create-grant! creator-id 60 "TICKET-FIRST" "First grant")](mt/client :post 200 "session/reset_password"{:token (:token first-grant) :password "FirstPassword123!"})(grants/revoke-grant! creator-id(:id (t2/select-one :model/SupportAccessGrantLog:ticket_number "TICKET-FIRST"))))- ;; Deactivate the support user (simulates admin action or cleanup)+ ;; Deactivate the support user (simulates admin action or cleanup)(let [support-user (t2/select-one [:model/User :id :is_active] :email email)](t2/update! :model/User (:id support-user) {:is_active false})(is (false? (:is_active (t2/select-one [:model/User :is_active]:id (:id support-user))))"User should be deactivated"))- ;; Create a new grant - this should reactivate the support user+ ;; Create a new grant - this should reactivate the support user(let [new-grant (grants/create-grant! creator-id 60 "TICKET-REACTIVATE""Should reactivate user")token (:token new-grant)diff --git a/enterprise/backend/test/metabase_enterprise/transforms_python/python_runner_test.clj b/enterprise/backend/test/metabase_enterprise/transforms_python/python_runner_test.cljindex 1dfc3b5027f..b08bb6d660b 100644--- a/enterprise/backend/test/metabase_enterprise/transforms_python/python_runner_test.clj+++ b/enterprise/backend/test/metabase_enterprise/transforms_python/python_runner_test.clj@@ -80,7 +80,7 @@:shared-storage @shared-storage-ref})events (python-runner/read-events @shared-storage-ref)output-manifest (python-runner/read-output-manifest @shared-storage-ref)]- ;; not sure about munging this all together but its what tests expect for now+ ;; not sure about munging this all together but its what tests expect for now(merge (:body response){:output (when-some [in (python-runner/open-output @shared-storage-ref)] (with-open [in in] (slurp in))):output-manifest output-manifest@@ -369,7 +369,7 @@"count" :type/BigInteger"price" :type/Float"is_active" :type/Boolean- ;; Our hack works+ ;; Our hack works"created_date" :type/Date"updated_at" :type/DateTime"scheduled_for" :type/DateTimeWithLocalTZ}@@ -501,7 +501,7 @@(u/for-map [{:keys [name base_type]} (:fields metadata)][name (python-runner/restricted-insert-type base_type)]))))- ;; cleanup+ ;; cleanup(driver/drop-table! driver db-id qualified-table-name)))))(deftest python-runner-timeout-testdiff --git a/enterprise/backend/test/metabase_enterprise/workspaces/e2e_test.clj b/enterprise/backend/test/metabase_enterprise/workspaces/e2e_test.cljindex edceff0cad5..f4279e861af 100644--- a/enterprise/backend/test/metabase_enterprise/workspaces/e2e_test.clj+++ b/enterprise/backend/test/metabase_enterprise/workspaces/e2e_test.clj@@ -275,60 +275,60 @@admin-details (:details admin-db)admin-spec (admin-warehouse admin-driver admin-details)run-id (random-suffix)- ;; All identifiers carry [[run-id]] — we share a single test DB across- ;; runs, so any leftover state from a failed run has to be- ;; distinguishable from this one.+ ;; All identifiers carry [[run-id]] — we share a single test DB across+ ;; runs, so any leftover state from a failed run has to be+ ;; distinguishable from this one.main-schema (canonical-schema-name admin-driver run-id admin-details)- ;; Value Metabase stores in `:model/Table.schema` for synced tables.- ;; Equals [[main-schema]] for schema-having drivers; nil for MySQL.+ ;; Value Metabase stores in `:model/Table.schema` for synced tables.+ ;; Equals [[main-schema]] for schema-having drivers; nil for MySQL.tbl-schema (table-row-schema-value admin-driver main-schema)src-name (str "x_input_table_" run-id)output-table-name (str "x_output_table_" run-id)](try- ;; --- Setup: DWH main schema + source table ---------------------------- ;; Schema-creation: most workspace-supported drivers accept `CREATE SCHEMA "<name>"`,- ;; but MySQL "schemas" are databases. See [[canonical-schema-name]] for why we- ;; reuse the bound database there instead of creating a fresh one.+ ;; --- Setup: DWH main schema + source table ---------------------------+ ;; Schema-creation: most workspace-supported drivers accept `CREATE SCHEMA "<name>"`,+ ;; but MySQL "schemas" are databases. See [[canonical-schema-name]] for why we+ ;; reuse the bound database there instead of creating a fresh one.(create-canonical-schema! admin-driver admin-spec admin-details main-schema)(create-source-table! admin-driver admin-spec admin-details main-schema src-name)- ;; Diagnostic: confirm the source table exists in the warehouse before we- ;; lean on Metabase sync to surface it. If this fails, the problem is in- ;; the test-side DDL, not workspace code.+ ;; Diagnostic: confirm the source table exists in the warehouse before we+ ;; lean on Metabase sync to surface it. If this fails, the problem is in+ ;; the test-side DDL, not workspace code.(let [warehouse-tables (case admin-driver:bigquery-cloud-sdk ((requiring-resolve 'metabase.driver.bigquery-cloud-sdk.workspace-test-util/list-tables) admin-spec((requiring-resolve 'metabase.driver.bigquery-cloud-sdk.workspace-test-util/project-id) admin-details)main-schema)- ;; No LIMIT/TOP — the source table is seeded with 3- ;; rows above ([[create-source-table!]]); the assertion- ;; below only needs >= 1 row, and avoiding `LIMIT`- ;; keeps this portable across SQL Server (`TOP`) and- ;; the LIMIT-aware drivers.+ ;; No LIMIT/TOP — the source table is seeded with 3+ ;; rows above ([[create-source-table!]]); the assertion+ ;; below only needs >= 1 row, and avoiding `LIMIT`+ ;; keeps this portable across SQL Server (`TOP`) and+ ;; the LIMIT-aware drivers.(jdbc/query admin-spec[(format "SELECT 1 FROM %s"(qualified-table-sql admin-driver admin-details main-schema src-name))]))](is (>= (count warehouse-tables) 1)(str "warehouse source table " main-schema "." src-name " is not queryable")))- ;; TODO: copy this test, but instead of pre-seeding the canonical output table, leave it uncreated and- ;; verify the workspace transform can create it from scratch. That would be a more direct test of the- ;; transform's ability to write to the warehouse, without the wrinkle of pre-existing rows. The- ;; canonical-table-protection test covers the "pre-existing rows stay intact" angle, so we have that- ;; covered either way.- ;; --- Setup: pre-existing canonical OUTPUT table with distinct rows ---------- ;; The workspace transform writes to canonical {schema main-schema, name output-table-name}.- ;; We seed that table with rows BEFORE the workspace is provisioned so we can- ;; later verify (a) the workspace's view of the canonical name returns the- ;; transform's output (via remap), and (b) the canonical warehouse table itself- ;; was never mutated by the transform - the workspace transform only wrote to- ;; iso.<derived>, leaving the canonical contents intact.+ ;; TODO: copy this test, but instead of pre-seeding the canonical output table, leave it uncreated and+ ;; verify the workspace transform can create it from scratch. That would be a more direct test of the+ ;; transform's ability to write to the warehouse, without the wrinkle of pre-existing rows. The+ ;; canonical-table-protection test covers the "pre-existing rows stay intact" angle, so we have that+ ;; covered either way.+ ;; --- Setup: pre-existing canonical OUTPUT table with distinct rows ---------+ ;; The workspace transform writes to canonical {schema main-schema, name output-table-name}.+ ;; We seed that table with rows BEFORE the workspace is provisioned so we can+ ;; later verify (a) the workspace's view of the canonical name returns the+ ;; transform's output (via remap), and (b) the canonical warehouse table itself+ ;; was never mutated by the transform - the workspace transform only wrote to+ ;; iso.<derived>, leaving the canonical contents intact.(create-output-table! admin-driver admin-spec admin-details main-schema output-table-name[[99 "pre-existing"][98 "still-pre-existing"]])- ;; --- Setup: a Metabase Database row attached to the warehouse with admin- ;; creds. The config-loader path (below) will rewrite its `:details` with- ;; workspace user creds + schema-filters when `initialize!` runs the- ;; `:databases` section, mirroring what a child instance does at boot.+ ;; --- Setup: a Metabase Database row attached to the warehouse with admin+ ;; creds. The config-loader path (below) will rewrite its `:details` with+ ;; workspace user creds + schema-filters when `initialize!` runs the+ ;; `:databases` section, mirroring what a child instance does at boot.(mt/with-temp [:model/Database ws-db {:engine admin-driver:details admin-details:name (str "ws-e2e-" run-id)}]@@ -336,15 +336,15 @@:creator_id (mt/user->id :crowberto)})](try- ;; --- Stage 1: provision via the workspace provisioning entrypoint.- ;; Drives the same `init-workspace-isolation!` + `grant-workspace-read-access!`- ;; multimethods, but through `provisioning/provision-single!`, which writes- ;; the resulting `:database_details` and `:output_namespace` back to the- ;; `WorkspaceDatabase` row — the inputs `build-workspace-config` reads.+ ;; --- Stage 1: provision via the workspace provisioning entrypoint.+ ;; Drives the same `init-workspace-isolation!` + `grant-workspace-read-access!`+ ;; multimethods, but through `provisioning/provision-single!`, which writes+ ;; the resulting `:database_details` and `:output_namespace` back to the+ ;; `WorkspaceDatabase` row — the inputs `build-workspace-config` reads.(ws/add-database! ws-id (:id ws-db)[(workspace-input-schema admin-driver admin-details main-schema)])- ;; Sanity check: provisioning must have populated :output_namespace and flipped- ;; status to :provisioned. If empty, the workspace driver impl is broken.+ ;; Sanity check: provisioning must have populated :output_namespace and flipped+ ;; status to :provisioned. If empty, the workspace driver impl is broken.(let [wsd (-> (ws/get-workspace ws-id) :databases first)](is (= :provisioned (:status wsd))"WorkspaceDatabase provisioning did not reach :provisioned status")@@ -353,51 +353,51 @@(str "provisioning wrote an empty :output_namespace (got "(pr-str (:output_namespace wsd)) ")")))- ;; --- Stage 2: build the canonical config.yml-shaped map and round-trip- ;; through YAML, the same way a child instance receives the file from disk.- ;; The round-trip is load-bearing: [[build-workspace-config]] returns- ;; `:engine :postgres` (keyword), but the `:databases` section spec requires- ;; a string. [[yaml/parse-string]] or [[yaml/generate-string]] collapses keyword- ;; values to strings, matching the on-disk wire format.+ ;; --- Stage 2: build the canonical config.yml-shaped map and round-trip+ ;; through YAML, the same way a child instance receives the file from disk.+ ;; The round-trip is load-bearing: [[build-workspace-config]] returns+ ;; `:engine :postgres` (keyword), but the `:databases` section spec requires+ ;; a string. [[yaml/parse-string]] or [[yaml/generate-string]] collapses keyword+ ;; values to strings, matching the on-disk wire format.(let [yaml-str (-> ws-idws.config/build-workspace-configws.config/config->yaml)- ;; Read the provisioned isolation schema name back from the WSD row;- ;; `provision-single!` derives it from the WSD id, not the workspace id.+ ;; Read the provisioned isolation schema name back from the WSD row;+ ;; `provision-single!` derives it from the WSD id, not the workspace id.wsd (-> (ws/get-workspace ws-id) :databases first)isolation-schema (:output_namespace wsd)]- ;;+---------------------------+- ;;| Parent above |- ;;+---------------------------++ ;;+---------------------------++ ;;| Parent above |+ ;;+---------------------------+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;- ;;+---------------------------+- ;;| Child below |- ;;+---------------------------++ ;;+---------------------------++ ;;| Child below |+ ;;+---------------------------+- ;; --- Stage 3: bind `*config*` and run the file loader. This invokes- ;; `init-from-config-file!` for the `:databases` section (updates the- ;; existing Database row with merged workspace creds + schema-filters)- ;; and `apply-workspace-section!` for the `:workspace` section (resolves- ;; db names → ids and populates `ws/workspace-instance-config`).+ ;; --- Stage 3: bind `*config*` and run the file loader. This invokes+ ;; `init-from-config-file!` for the `:databases` section (updates the+ ;; existing Database row with merged workspace creds + schema-filters)+ ;; and `apply-workspace-section!` for the `:workspace` section (resolves+ ;; db names → ids and populates `ws/workspace-instance-config`).(binding [advanced-config.file/*config* (yaml/parse-string yaml-str)](advanced-config.file/initialize!))- ;; Diagnostic: the loader should have populated the in-process workspace- ;; atom and rewritten the Database row's :details to workspace-user creds.+ ;; Diagnostic: the loader should have populated the in-process workspace+ ;; atom and rewritten the Database row's :details to workspace-user creds.(is (ws/workspace-mode?)"loader did not put the instance into workspace-mode (atom not populated)")- ;; The Database row's `:details` was just rewritten by the loader. Re-read- ;; it so `mt/with-db` and the connection pool see the workspace-user creds.+ ;; The Database row's `:details` was just rewritten by the loader. Re-read+ ;; it so `mt/with-db` and the connection pool see the workspace-user creds.(let [ws-db (t2/select-one :model/Database :id (:id ws-db))input-ns-db (when (three-slot-driver? admin-driver) (:db admin-details))](is (not= (:details admin-db) (:details ws-db))"loader did not rewrite Database :details with workspace-user creds")- ;; Regression guard: a colleague caught a pre-fix bug visually by spotting- ;; the iso DB name in the YAML's :db slot. Pin it down with an assertion so- ;; any future driver that puts :db into :database_details fails here loudly,- ;; not 100 lines downstream as "sync produced no rows".+ ;; Regression guard: a colleague caught a pre-fix bug visually by spotting+ ;; the iso DB name in the YAML's :db slot. Pin it down with an assertion so+ ;; any future driver that puts :db into :database_details fails here loudly,+ ;; not 100 lines downstream as "sync produced no rows".(is (= (:db admin-details) (:db (:details ws-db)))(str "loader must preserve canonical :db on the workspace Database. ""If you see the isolation DB here, a driver's "@@ -406,8 +406,8 @@"and breaks the connection's bound database for sync."))(mt/with-db ws-db(sync/sync-database! ws-db {:scan :schema})- ;; Diagnostic: enumerate what sync produced so a missing src-table- ;; gives us a useful error instead of `(some? nil)`.+ ;; Diagnostic: enumerate what sync produced so a missing src-table+ ;; gives us a useful error instead of `(some? nil)`.(let [synced (->> (t2/select :model/Table :db_id (:id ws-db) :active true)(map #(select-keys % [:schema :name])))](is (seq synced)@@ -417,7 +417,7 @@" (Table.schema expected " (pr-str tbl-schema) ")"". Synced tables: " (pr-str synced))))- ;; --- Action: define + run a transform ------------------+ ;; --- Action: define + run a transform ------------------(let [src-table (t2/select-one :model/Table:db_id (:id ws-db):schema tbl-schema@@ -426,7 +426,7 @@"input-schema source table is synced before the transform runs")mp (mt/metadata-provider)query (lib/query mp (lib.metadata/table mp (:id src-table)))- ;; the workspace transform-hook rewrites `:schema` to `isolation-schema`+ ;; the workspace transform-hook rewrites `:schema` to `isolation-schema`canonical-target-table {:type :table:schema main-schema:name output-table-name}]@@ -435,7 +435,7 @@:source {:type :query :query query}:target canonical-target-table}](transforms.execute/execute! transform {:run-method :manual})- ;; --- Assertion: app db tables stay in main schema ----+ ;; --- Assertion: app db tables stay in main schema ----(testing "app db Table entities are confined to the input schema"(let [tables (t2/select :model/Table :db_id (:id ws-db) :active true)iso-tbl-schema (table-row-schema-value admin-driver isolation-schema)]@@ -448,11 +448,11 @@tables)"the input-schema output table appears in the app db")(if (= :mysql admin-driver)- ;; MySQL stores `:schema nil` for every Table row regardless of- ;; which database it lives in, so we can't distinguish input-DB- ;; from isolation-DB rows via `:schema`. Instead probe the- ;; warehouse directly: any tables actually in the isolation DB- ;; should not show up as app-db Table rows under this Database.+ ;; MySQL stores `:schema nil` for every Table row regardless of+ ;; which database it lives in, so we can't distinguish input-DB+ ;; from isolation-DB rows via `:schema`. Instead probe the+ ;; warehouse directly: any tables actually in the isolation DB+ ;; should not show up as app-db Table rows under this Database.(let [iso-warehouse-tables(->> (jdbc/query admin-spec[(str/join ["SELECT table_name "@@ -469,18 +469,18 @@"no app-db Table row points at the isolation schema"))))(testing "A table remapping record exists"- ;; `:from_db` is the empty-string sentinel for 2-slot drivers (Postgres,- ;; Redshift, ClickHouse) and the connection's bound DB for drivers whose- ;; `qualified-name-components` populates `:db` (SQL Server, BigQuery,- ;; MySQL).- ;;- ;; `:to_db` equals `:from_db` for drivers whose iso namespace lives in- ;; the SAME DB as canonical (Postgres-family schema-based, SQL Server- ;; schema-based). On MySQL the iso namespace is a different- ;; DATABASE, so `:to_db` is the iso DB name (= isolation-schema).- ;;- ;; `:from_schema` is the canonical schema name on schema-having drivers,- ;; and the empty-string sentinel on MySQL (no schema layer).+ ;; `:from_db` is the empty-string sentinel for 2-slot drivers (Postgres,+ ;; Redshift, ClickHouse) and the connection's bound DB for drivers whose+ ;; `qualified-name-components` populates `:db` (SQL Server, BigQuery,+ ;; MySQL).+ ;;+ ;; `:to_db` equals `:from_db` for drivers whose iso namespace lives in+ ;; the SAME DB as canonical (Postgres-family schema-based, SQL Server+ ;; schema-based). On MySQL the iso namespace is a different+ ;; DATABASE, so `:to_db` is the iso DB name (= isolation-schema).+ ;;+ ;; `:from_schema` is the canonical schema name on schema-having drivers,+ ;; and the empty-string sentinel on MySQL (no schema layer).(let [from-schema-stored (if (= :mysql admin-driver) "" main-schema)to-db-stored (if (= :mysql admin-driver)isolation-schema@@ -495,10 +495,10 @@(for [r (t2/select :model/TableRemapping :database_id (:id ws-db))](select-keys r [:to_schema :from_schema :from_table_name :from_db :to_db :database_id]))))))- ;; --- Assertion: describe-database stays in main ------- ;; describe-database reads JDBC's TABLE_SCHEM into `:schema`. For MySQL- ;; that's always null, same as `:model/Table.schema`. Use `tbl-schema`- ;; (the per-driver translation we already do for synced rows).+ ;; --- Assertion: describe-database stays in main ------+ ;; describe-database reads JDBC's TABLE_SCHEM into `:schema`. For MySQL+ ;; that's always null, same as `:model/Table.schema`. Use `tbl-schema`+ ;; (the per-driver translation we already do for synced rows).(testing "describe-database returns only input-schema tables"(let [{described :tables} (driver/describe-database admin-driver ws-db)iso-tbl-schema (table-row-schema-value admin-driver isolation-schema)]@@ -507,11 +507,11 @@described)"the input-schema source table is described")(if (= :mysql admin-driver)- ;; On MySQL describe-database only enumerates the connection's- ;; bound DB (`test-data`), so iso-DB tables can't appear here- ;; at all. The assertion is trivially true; we still want SOMETHING- ;; to confirm describe-database isn't returning iso-DB rows- ;; (e.g., via a cross-DB enumeration bug).+ ;; On MySQL describe-database only enumerates the connection's+ ;; bound DB (`test-data`), so iso-DB tables can't appear here+ ;; at all. The assertion is trivially true; we still want SOMETHING+ ;; to confirm describe-database isn't returning iso-DB rows+ ;; (e.g., via a cross-DB enumeration bug).(let [iso-warehouse-tables (->> (jdbc/query admin-spec["SELECT table_name FROM information_schema.tables WHERE table_schema = ?"isolation-schema])@@ -522,9 +522,9 @@(is (not-any? #(= iso-tbl-schema (:schema %)) described)"no isolation-schema table is described"))))- ;; --- Assertion: a Card querying the canonical output table ----- ;; reads the remapped (isolation-schema) data, not the canonical- ;; main-schema table.+ ;; --- Assertion: a Card querying the canonical output table ----+ ;; reads the remapped (isolation-schema) data, not the canonical+ ;; main-schema table.(testing "card query returns the remapped isolation-schema table, not the canonical main-schema table"(let [out-table (t2/select-one :model/Table:db_id (:id ws-db)@@ -535,10 +535,10 @@:from_table_name output-table-name)](is (some? out-table)"canonical-named output table exists to represent the table that will exist as a result of the new transform running in production")- ;; Diagnostic: the Card MBQL query downstream needs Fields on- ;; out-table. If sync-table! after the transform run didn't- ;; populate them, the QP throws "Table X has no Fields"- ;; 100 lines into preprocess. Flag it here instead.+ ;; Diagnostic: the Card MBQL query downstream needs Fields on+ ;; out-table. If sync-table! after the transform run didn't+ ;; populate them, the QP throws "Table X has no Fields"+ ;; 100 lines into preprocess. Flag it here instead.(let [field-count (t2/count :model/Field :table_id (:id out-table) :active true)](is (pos? field-count)(str "out-table Table id=" (:id out-table)@@ -567,22 +567,22 @@(let [rows (set (mt/rows (mt/process-query (:dataset_query card))))](testing "querying the isolation table directly works like querying any other table"(is (= #{[1 "a"] [2 "b"] [3 "c"]} rows)))))- ;; INTENTIONALLY DISABLED (GHY-3580): bare-table-name SQL.- ;;- ;; The two `mt/with-temp` blocks immediately above and below this one cover- ;; the qualified-name flows:- ;; - above: `SELECT * FROM iso_schema.table` (workspace-side identifier)- ;; - below: `SELECT * FROM main_schema.table` (canonical identifier;- ;; Phase 2 rewrites it to iso)- ;; The skipped variant covers `SELECT * FROM table` -- bare, unqualified.- ;; That shape isn't supported yet because the Phase 2 SQLGlot rewriter keys- ;; on `(schema, table)` pairs, and an unqualified ref carries no schema slot- ;; for the lookup to match. Re-enabling needs the rewriter to attribute- ;; bare refs to the connection's default schema before lookup. See gist- ;; https://gist.github.com/escherize/721764240c300e995c54add2d71ff356 for the- ;; repro and proposed approach.- ;;- ;; Re-enable when GHY-3580 lands: delete the `#_`, run the test.+ ;; INTENTIONALLY DISABLED (GHY-3580): bare-table-name SQL.+ ;;+ ;; The two `mt/with-temp` blocks immediately above and below this one cover+ ;; the qualified-name flows:+ ;; - above: `SELECT * FROM iso_schema.table` (workspace-side identifier)+ ;; - below: `SELECT * FROM main_schema.table` (canonical identifier;+ ;; Phase 2 rewrites it to iso)+ ;; The skipped variant covers `SELECT * FROM table` -- bare, unqualified.+ ;; That shape isn't supported yet because the Phase 2 SQLGlot rewriter keys+ ;; on `(schema, table)` pairs, and an unqualified ref carries no schema slot+ ;; for the lookup to match. Re-enabling needs the rewriter to attribute+ ;; bare refs to the connection's default schema before lookup. See gist+ ;; https://gist.github.com/escherize/721764240c300e995c54add2d71ff356 for the+ ;; repro and proposed approach.+ ;;+ ;; Re-enable when GHY-3580 lands: delete the `#_`, run the test.#_(mt/with-temp [:model/Card card{:name (str "ws-e2e-card-native-" run-id):database_id (:id ws-db)@@ -610,17 +610,17 @@(is (= #{[1 "a"] [2 "b"] [3 "c"]} rows)"native card returns the rows the transform wrote to the isolation schema"))))))- ;; --- Assertion: canonical-table-protection invariant (GHY-3513 item 4) ----- ;; Pre-seeded canonical `main_schema.output-table-name` with rows A *before* workspace- ;; provisioning (see `create-output-table!` call at the top of the test). The- ;; transform writes its output (rows B = src's [1,a],[2,b],[3,c]) to the- ;; canonical target name, which the transform-hook redirects to iso.<derived>.- ;; The card reads above already verified workspace queries see rows B (remap- ;; engaged). What's load-bearing for *this* assertion: the workspace transform- ;; must NOT have mutated the canonical warehouse table. Probe it directly via- ;; `admin-spec` (bypasses the QP and workspace mode entirely).+ ;; --- Assertion: canonical-table-protection invariant (GHY-3513 item 4) ----+ ;; Pre-seeded canonical `main_schema.output-table-name` with rows A *before* workspace+ ;; provisioning (see `create-output-table!` call at the top of the test). The+ ;; transform writes its output (rows B = src's [1,a],[2,b],[3,c]) to the+ ;; canonical target name, which the transform-hook redirects to iso.<derived>.+ ;; The card reads above already verified workspace queries see rows B (remap+ ;; engaged). What's load-bearing for *this* assertion: the workspace transform+ ;; must NOT have mutated the canonical warehouse table. Probe it directly via+ ;; `admin-spec` (bypasses the QP and workspace mode entirely).(testing "the workspace transform does not mutate the canonical warehouse table"- ;; Probe directly via admin perms (bypasses QP + workspace mode).+ ;; Probe directly via admin perms (bypasses QP + workspace mode).(let [canonical-rows (read-canonical-rows admin-driver admin-spec admin-detailsmain-schema output-table-name)](is (= #{[99 "pre-existing"] [98 "still-pre-existing"]}@@ -647,22 +647,22 @@(is (= [] (filter #(= iso-tbl-schema (:schema %)) (map #(select-keys % [:schema :name]) tables)))"no app-db Table row points at the isolation schema")))))))))(finally- ;; Clear the in-process workspace atom (populated by `apply-workspace-section!`- ;; via `initialize!` above) and tear down the WorkspaceDatabase. The- ;; `:databases` initializer rewrote the `Database.details` to the workspace- ;; user's creds — but `destroy-workspace-isolation!` needs admin privileges- ;; (DROP DATABASE / DROP USER on MySQL, etc), so restore admin details first.- ;; `delete-workspace!` then deprovisions any `:provisioned` databases (calls- ;; `destroy-workspace-isolation!`) before deleting the row, safe whether- ;; provision succeeded fully or partially.+ ;; Clear the in-process workspace atom (populated by `apply-workspace-section!`+ ;; via `initialize!` above) and tear down the WorkspaceDatabase. The+ ;; `:databases` initializer rewrote the `Database.details` to the workspace+ ;; user's creds — but `destroy-workspace-isolation!` needs admin privileges+ ;; (DROP DATABASE / DROP USER on MySQL, etc), so restore admin details first.+ ;; `delete-workspace!` then deprovisions any `:provisioned` databases (calls+ ;; `destroy-workspace-isolation!`) before deleting the row, safe whether+ ;; provision succeeded fully or partially.(ws/clear-instance-workspace!)(t2/update! :model/Database (:id ws-db) {:details admin-details})- ;; Cleanup tries [[ws/delete-workspace!]] first. If it throws (e.g. on- ;; Redshift, [[destroy-workspace-isolation!]] rolls WSD status back to- ;; `:provisioned` if any cleanup statement fails, and [[delete-workspace!]]- ;; refuses with 409), fall back to force-clearing the WSD status so- ;; `mt/with-temp Database` cleanup can complete. Real fix for the- ;; Redshift destroy fragility is tracked separately.+ ;; Cleanup tries [[ws/delete-workspace!]] first. If it throws (e.g. on+ ;; Redshift, [[destroy-workspace-isolation!]] rolls WSD status back to+ ;; `:provisioned` if any cleanup statement fails, and [[delete-workspace!]]+ ;; refuses with 409), fall back to force-clearing the WSD status so+ ;; `mt/with-temp Database` cleanup can complete. Real fix for the+ ;; Redshift destroy fragility is tracked separately.(let [delete-result (try (ws/delete-workspace! ws-id) ::deleted-ok(catch Throwable t(log/warn t "delete-workspace! failed; force-clearing WSD")diff --git a/enterprise/backend/test/metabase_enterprise/workspaces/remapping_cleanup_test.clj b/enterprise/backend/test/metabase_enterprise/workspaces/remapping_cleanup_test.cljindex 7a4ff05d196..2eac816eac4 100644--- a/enterprise/backend/test/metabase_enterprise/workspaces/remapping_cleanup_test.clj+++ b/enterprise/backend/test/metabase_enterprise/workspaces/remapping_cleanup_test.clj@@ -134,8 +134,8 @@db-id {:schema "public" :table "products"} {:schema "ws_alice" :table "products_copy"})(is (= 2 (count (ws.table-remapping/all-mappings-for-db db-id)))"fixture: two remap rows registered before deprovision")- ;; Provisioner that fails on destroy! to simulate partial warehouse teardown- ;; (e.g. BQ dataset deleted, SA delete throws).+ ;; Provisioner that fails on destroy! to simulate partial warehouse teardown+ ;; (e.g. BQ dataset deleted, SA delete throws).(let [failing-provisioner (reify provisioning/Provisioner(init! [_ _ _ _] (throw (ex-info "not used" {})))(grant! [_ _ _ _ _] (throw (ex-info "not used" {})))diff --git a/modules/drivers/athena/test/metabase/driver/athena_test.clj b/modules/drivers/athena/test/metabase/driver/athena_test.cljindex fe8a8f917ab..7c5dcad5a5a 100644--- a/modules/drivers/athena/test/metabase/driver/athena_test.clj+++ b/modules/drivers/athena/test/metabase/driver/athena_test.clj@@ -279,7 +279,7 @@(mt/dataset airports(let [catalog "AwsDataCatalog" ; The bug only happens when :catalog is not nildetails (assoc (:details (mt/db))- ;; these credentials are for a user that doesn't have athena:GetTableMetadata permissions+ ;; these credentials are for a user that doesn't have athena:GetTableMetadata permissions:access_key (tx/db-test-env-var-or-throw :athena :without-get-table-metadata-access-key):secret_key (tx/db-test-env-var-or-throw :athena :without-get-table-metadata-secret-key):catalog catalog)]@@ -287,8 +287,8 @@(sync/sync-database! db {:scan :schema})(let [table (t2/select-one :model/Table :db_id (:id db) :name "airport")](testing "Check that .getColumns returns no results, meaning the athena JDBC driver still has a bug"- ;; If this test fails and .getColumns returns results, the athena JDBC driver has been fixed and we can- ;; undo the changes in https://github.com/metabase/metabase/pull/44032+ ;; If this test fails and .getColumns returns results, the athena JDBC driver has been fixed and we can+ ;; undo the changes in https://github.com/metabase/metabase/pull/44032(is (empty? (sql-jdbc.execute/do-with-connection-with-options:athenadbdiff --git a/modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj b/modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.cljindex 18905917d66..a49b97c999a 100644--- a/modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj+++ b/modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj@@ -553,9 +553,9 @@(transduce(comp (take table-rows-sample/max-sample-rows)(map (partial extract-fingerprint field-idxs parsers)))- ;; Instead of passing on fields, we could recalculate the- ;; metadata from the schema, but that probably makes no- ;; difference and currently the metadata is ignored anyway.+ ;; Instead of passing on fields, we could recalculate the+ ;; metadata from the schema, but that probably makes no+ ;; difference and currently the metadata is ignored anyway.(rff {:cols fields})(reducible-bigquery-results page nil (constantly nil)))))@@ -649,13 +649,13 @@(defn- build-bigquery-request [^String sql parameters](.build(doto (QueryJobConfiguration/newBuilder sql)- ;; if the query contains a `#legacySQL` directive then use legacy SQL instead of standard SQL+ ;; if the query contains a `#legacySQL` directive then use legacy SQL instead of standard SQL(.setUseLegacySql (str/includes? (u/lower-case-en sql) "#legacysql"))(bigquery.params/set-parameters! parameters)- ;; .setMaxResults is very misleading; it's actually the page size, and it only takes- ;; effect for RPC (a.k.a. "fast") calls- ;; there is no equivalent of .setMaxRows on a JDBC Statement; we rely on our middleware to stop- ;; realizing more rows as per the maximum result size+ ;; .setMaxResults is very misleading; it's actually the page size, and it only takes+ ;; effect for RPC (a.k.a. "fast") calls+ ;; there is no equivalent of .setMaxRows on a JDBC Statement; we rely on our middleware to stop+ ;; realizing more rows as per the maximum result size(.setMaxResults *page-size*))))(defn- reducible-bigquery-resultsdiff --git a/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk/query_processor_test.clj b/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk/query_processor_test.cljindex 088463db52f..5a38fe75e47 100644--- a/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk/query_processor_test.clj+++ b/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk/query_processor_test.clj@@ -192,7 +192,7 @@" `categories__via__category_id__name`""ORDER BY"" `categories__via__category_id__name` ASC"]- ;; reformat the SQL because the formatting may have changed once we change the test DB name.+ ;; reformat the SQL because the formatting may have changed once we change the test DB name.(str/join " ")(driver/prettify-native-form :bigquery-cloud-sdk)str/split-lines))diff --git a/modules/drivers/bigquery-cloud-sdk/test/metabase/test/data/bigquery_cloud_sdk.clj b/modules/drivers/bigquery-cloud-sdk/test/metabase/test/data/bigquery_cloud_sdk.cljindex 48634e4c678..6c363c0ef60 100644--- a/modules/drivers/bigquery-cloud-sdk/test/metabase/test/data/bigquery_cloud_sdk.clj+++ b/modules/drivers/bigquery-cloud-sdk/test/metabase/test/data/bigquery_cloud_sdk.clj@@ -483,7 +483,7 @@{:field-name "access_note":base-type :type/Text}])(catch BigQueryException e- ;; Already exists, ignore+ ;; Already exists, ignore(when-not (= (.getCode e) 409)(throw e))))))diff --git a/modules/drivers/clickhouse/src/metabase/driver/clickhouse_nippy.clj b/modules/drivers/clickhouse/src/metabase/driver/clickhouse_nippy.cljindex afd3756a18a..a5710194d78 100644--- a/modules/drivers/clickhouse/src/metabase/driver/clickhouse_nippy.clj+++ b/modules/drivers/clickhouse/src/metabase/driver/clickhouse_nippy.clj@@ -11,7 +11,7 @@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(nippy/extend-freeze com.clickhouse.data.value.UnsignedByte :clickhouse/UnsignedByte[^com.clickhouse.data.value.UnsignedByte x ^DataOutput data-output]- ;; can't enable *warn-on-reflection* because of this call+ ;; can't enable *warn-on-reflection* because of this call(nippy/freeze-to-out! data-output (.toString x)))(nippy/extend-thaw :clickhouse/UnsignedBytediff --git a/modules/drivers/clickhouse/src/metabase/driver/clickhouse_qp.clj b/modules/drivers/clickhouse/src/metabase/driver/clickhouse_qp.cljindex 7b0b706f928..b096c698977 100644--- a/modules/drivers/clickhouse/src/metabase/driver/clickhouse_qp.clj+++ b/modules/drivers/clickhouse/src/metabase/driver/clickhouse_qp.clj@@ -547,9 +547,9 @@(when-let [zdt (.getObject rs i ZonedDateTime)](let [db-type (remove-low-cardinality-and-nullable (.getColumnTypeName rsmeta i))](if (= db-type "datetime64(3, 'gmt0')")- ;; a hack for some MB test assertions only; GMT0 is a legacy tz+ ;; a hack for some MB test assertions only; GMT0 is a legacy tz(.toLocalDateTime ^ZonedDateTime (zdt-in-report-timezone zdt))- ;; this is the normal behavior+ ;; this is the normal behavior(.toOffsetDateTime (.withZoneSameInstant^ZonedDateTime (zdt-in-report-timezone zdt)(java.time.ZoneId/of "UTC"))))))))@@ -595,7 +595,7 @@(ipv4-column->string rs i)(= normalized-db-type "ipv6")(ipv6-column->string rs i)- ;; _+ ;; _:else (.getObject rs i)))))(defmethod sql-jdbc.execute/read-column-thunk [:clickhouse Types/VARCHAR]diff --git a/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc/nested_field_columns_test.clj b/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc/nested_field_columns_test.cljindex ab9766b0ffb..ba3dc95dcaf 100644--- a/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc/nested_field_columns_test.clj+++ b/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc/nested_field_columns_test.clj@@ -132,11 +132,11 @@json(let [database (t2/select-one :model/Database :id (mt/id))](testing "When json_unfolding is disabled at the DB level on the first sync"- ;; Create a new database with the same details as the json dataset, with json unfolding disabled+ ;; Create a new database with the same details as the json dataset, with json unfolding disabled(mt/with-temp [:model/Database database {:engine driver/*driver*:details (assoc (:details database) :json-unfolding false)}](mt/with-db database- ;; Sync the new database+ ;; Sync the new database(sync/sync-database! database)(let [get-field (fn [] (t2/select-one :model/Field :id (mt/id :json :json_bit)))get-database (fn [] (t2/select-one :model/Database :id (mt/id)))@@ -159,7 +159,7 @@(set-json-unfolding-for-field! false)(set-json-unfolding-for-db! true)(set-json-unfolding-for-field! true)- ;; Wait for the sync to finish+ ;; Wait for the sync to finish(Thread/sleep 500)(is (seq (nested-fields))))(testing "nested fields are added when json unfolding is enabled for the DB"@@ -178,12 +178,12 @@:druid-jdbc(mt/datasetjson- ;; Create a new database with the same details as the json dataset, with json unfolding enabled+ ;; Create a new database with the same details as the json dataset, with json unfolding enabled(let [database (t2/select-one :model/Database :id (mt/id))](mt/with-temp [:model/Database database {:engine driver/*driver*:details (assoc (:details database) :json-unfolding true)}](mt/with-db database- ;; Sync the new database+ ;; Sync the new database(sync/sync-database! database)(let [field (t2/select-one :model/Field :id (mt/id :json :json_bit))get-database (fn [] (t2/select-one :model/Database :id (mt/id)))diff --git a/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc_test.clj b/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc_test.cljindex ab71fa2a406..e8edd380f6a 100644--- a/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc_test.clj+++ b/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc_test.clj@@ -535,10 +535,10 @@:dbname "test":host "http://localhost":tunnel-enabled true- ;; we want to use a bogus port here on purpose -- ;; so that locally, it gets a ConnectionRefused,- ;; and in CI it does too. Apache's SSHD library- ;; doesn't wrap every exception in an SshdException+ ;; we want to use a bogus port here on purpose -+ ;; so that locally, it gets a ConnectionRefused,+ ;; and in CI it does too. Apache's SSHD library+ ;; doesn't wrap every exception in an SshdException:tunnel-port 21212:tunnel-user "bogus"}](driver.u/can-connect-with-details? engine details :throw-exceptions))diff --git a/modules/drivers/druid/src/metabase/driver/druid/query_processor.clj b/modules/drivers/druid/src/metabase/driver/druid/query_processor.cljindex b5b0d111edc..b3fbfb41ef8 100644--- a/modules/drivers/druid/src/metabase/driver/druid/query_processor.clj+++ b/modules/drivers/druid/src/metabase/driver/druid/query_processor.clj@@ -1075,7 +1075,7 @@(when fields(log/warn(u/format-color 'red- ;; TODO - this is not really true, is it+ ;; TODO - this is not really true, is it"WARNING: It only makes sense to specify :fields for a query with no aggregation. Ignoring the clause.")))druid-query)diff --git a/modules/drivers/druid/test/metabase/driver/druid/client_test.clj b/modules/drivers/druid/test/metabase/driver/druid/client_test.cljindex 4fa7f5624bc..e19f2f687cd 100644--- a/modules/drivers/druid/test/metabase/driver/druid/client_test.clj+++ b/modules/drivers/druid/test/metabase/driver/druid/client_test.clj@@ -60,10 +60,10 @@:dbname "test":host "http://localhost":tunnel-enabled true- ;; we want to use a bogus port here on purpose -- ;; so that locally, it gets a ConnectionRefused,- ;; and in CI it does too. Apache's SSHD library- ;; doesn't wrap every exception in an SshdException+ ;; we want to use a bogus port here on purpose -+ ;; so that locally, it gets a ConnectionRefused,+ ;; and in CI it does too. Apache's SSHD library+ ;; doesn't wrap every exception in an SshdException:tunnel-port 21212:tunnel-user "bogus"}](driver.u/can-connect-with-details? engine details :throw-exceptions))diff --git a/modules/drivers/druid/test/metabase/driver/druid/sync_test.clj b/modules/drivers/druid/test/metabase/driver/druid/sync_test.cljindex 4ea74c3031f..35ae5644927 100644--- a/modules/drivers/druid/test/metabase/driver/druid/sync_test.clj+++ b/modules/drivers/druid/test/metabase/driver/druid/sync_test.clj@@ -73,10 +73,10 @@:auth-enabled true:auth-username "admin":auth-token-value "password1")]- ;; Following ensures that auth parameters are passed to GET during version sync if present.+ ;; Following ensures that auth parameters are passed to GET during version sync if present.(with-redefs [secret/value-as-string (constantly "password1")druid.client/GET (fn [_url & params] (vreset! get-args (apply hash-map params)) nil)]- ;; Just fill in the params with internally modified `dbms-version`.+ ;; Just fill in the params with internally modified `dbms-version`.(druid.sync/dbms-version db-with-auth-details)(is (true? (:auth-enabled @get-args)))(is (= "admin" (:auth-username @get-args)))diff --git a/modules/drivers/mongo/src/metabase/driver/mongo.clj b/modules/drivers/mongo/src/metabase/driver/mongo.cljindex 99517aa8d48..55498f36512 100644--- a/modules/drivers/mongo/src/metabase/driver/mongo.clj+++ b/modules/drivers/mongo/src/metabase/driver/mongo.clj@@ -737,13 +737,13 @@'[monger.credentials :as mcred])(import javax.net.ssl.SSLSocketFactory)- ;; The following forms help experimenting with the behaviour of Mongo- ;; servers with different configurations. They can be used to check if- ;; the environment has been set up correctly (or at least according to- ;; the expectations), as well as the exceptions thrown in various- ;; constellations.+ ;; The following forms help experimenting with the behaviour of Mongo+ ;; servers with different configurations. They can be used to check if+ ;; the environment has been set up correctly (or at least according to+ ;; the expectations), as well as the exceptions thrown in various+ ;; constellations.- ;; Test connection to Mongo with client and server SSL authentication.+ ;; Test connection to Mongo with client and server SSL authentication.(let [ssl-socket-factory(driver.u/ssl-socket-factory:private-key (-> "ssl/mongo/metabase.key" io/resource slurp)@@ -761,7 +761,7 @@credentials)](mg/get-db-names connection)))- ;; Test what happens if the client only support server authentication.+ ;; Test what happens if the client only support server authentication.(let [server-auth-ssl-socket-factory(driver.u/ssl-socket-factory:trust-cert (-> "ssl/mongo/metaca.crt" io/resource slurp))@@ -778,8 +778,8 @@credentials)](mg/get-db-names server-auth-connection)))- ;; Test what happens if the client support only server authentication- ;; with well known (default) CAs.+ ;; Test what happens if the client support only server authentication+ ;; with well known (default) CAs.(let [unauthenticated-connection-options(mg/mongo-options {:ssl-enabled true:ssl-invalid-host-name-allowed falsediff --git a/modules/drivers/mongo/src/metabase/driver/mongo/query_processor.clj b/modules/drivers/mongo/src/metabase/driver/mongo/query_processor.cljindex 2778e47bd18..dfeac1c94fa 100644--- a/modules/drivers/mongo/src/metabase/driver/mongo/query_processor.clj+++ b/modules/drivers/mongo/src/metabase/driver/mongo/query_processor.clj@@ -812,9 +812,9 @@ function(bin) {(defmethod datetime-diff :month[x y _unit]{$add [{"$dateDiff" {:startDate x, :endDate y, :unit "month"}}- ;; dateDiff counts month boundaries not whole months, so we need to adjust- ;; if x<y but x>y in the month calendar then subtract one month- ;; if x>y but x<y in the month calendar then add one month+ ;; dateDiff counts month boundaries not whole months, so we need to adjust+ ;; if x<y but x>y in the month calendar then subtract one month+ ;; if x>y but x<y in the month calendar then add one month{:$switch {:branches [{:case {:$and [{$lt [x y]}{$gt [{$dayOfMonth x} {$dayOfMonth y}]}]}:then -1}diff --git a/modules/drivers/mongo/test/metabase/driver/mongo/connection_test.clj b/modules/drivers/mongo/test/metabase/driver/mongo/connection_test.cljindex f4bf9daca85..1ac4fd17c07 100644--- a/modules/drivers/mongo/test/metabase/driver/mongo/connection_test.clj+++ b/modules/drivers/mongo/test/metabase/driver/mongo/connection_test.clj@@ -145,10 +145,10 @@:dbname "test":host "localhost":tunnel-enabled true- ;; we want to use a bogus port here on purpose -- ;; so that locally, it gets a ConnectionRefused,- ;; and in CI it does too. Apache's SSHD library- ;; doesn't wrap every exception in an SshdException+ ;; we want to use a bogus port here on purpose -+ ;; so that locally, it gets a ConnectionRefused,+ ;; and in CI it does too. Apache's SSHD library+ ;; doesn't wrap every exception in an SshdException:tunnel-port 21212:tunnel-user "bogus"}](driver.u/can-connect-with-details? engine details :throw-exceptions))diff --git a/modules/drivers/mongo/test/metabase/driver/mongo/execute_test.clj b/modules/drivers/mongo/test/metabase/driver/mongo/execute_test.cljindex e70b4fea788..ef2e8f83a1c 100644--- a/modules/drivers/mongo/test/metabase/driver/mongo/execute_test.clj+++ b/modules/drivers/mongo/test/metabase/driver/mongo/execute_test.clj@@ -72,9 +72,9 @@:mongo(mt/datasettest-data- ;; Dummy query execution here. If the dataset was not initialized before running this test, the timing gets out of- ;; sync and test fails. I suspect dataset initialization happens after (or while) the future is executed.- ;; To overcome that next line is executed - and dataset initialization forced - before the test code runs.+ ;; Dummy query execution here. If the dataset was not initialized before running this test, the timing gets out of+ ;; sync and test fails. I suspect dataset initialization happens after (or while) the future is executed.+ ;; To overcome that next line is executed - and dataset initialization forced - before the test code runs.(mt/run-mbql-query people {:limit 10})(let [canceled-chan (a/chan)](binding [qp.pipeline/*canceled-chan* canceled-chan]@@ -119,7 +119,7 @@(throw t))))](let [model-based-query (-> (mt/mbql-query orders {:source-table (str "card__" (:id c))})(update :cache_strategy assoc- ;; Enable caching for current query+ ;; Enable caching for current query:avg-execution-time 5000:min_duration_ms 1:multiplier 100000diff --git a/modules/drivers/mongo/test/metabase/driver/mongo/query_processor_test.clj b/modules/drivers/mongo/test/metabase/driver/mongo/query_processor_test.cljindex b0b6859bfbb..4c3efec69b2 100644--- a/modules/drivers/mongo/test/metabase/driver/mongo/query_processor_test.clj+++ b/modules/drivers/mongo/test/metabase/driver/mongo/query_processor_test.clj@@ -591,9 +591,9 @@compiled (qp.compile/compile query)indices (reduce (fn [acc lookup-stage](let [let-var-name (-> (get-in lookup-stage ["$lookup" :let]) keys first)- ;; Following expression ensures index is an integer.+ ;; Following expression ensures index is an integer.index (parse-long (re-find #"\d+$" let-var-name))]- ;; Following expression tests that index is unique.+ ;; Following expression tests that index is unique.(is (not (contains? acc index)))(conj acc index)))#{}diff --git a/modules/drivers/mongo/test/metabase/driver/mongo_test.clj b/modules/drivers/mongo/test/metabase/driver/mongo_test.cljindex 3a5a6dd3652..848cbcbc6f4 100644--- a/modules/drivers/mongo/test/metabase/driver/mongo_test.clj+++ b/modules/drivers/mongo/test/metabase/driver/mongo_test.clj@@ -422,9 +422,9 @@(describe-indexes :singly-index))))(testing "compound index column index"- ;; first index column is :a+ ;; first index column is :a(mongo.util/create-index (mongo.util/collection db "compound-index") (array-map :a 1 :b 1 :c 1))- ;; first index column is :e+ ;; first index column is :e(mongo.util/create-index (mongo.util/collection db "compound-index") (array-map :e 1 :d 1 :f 1))(is (= #{{:type :normal-column-index :value "_id"}{:type :normal-column-index :value "a"}@@ -432,7 +432,7 @@(describe-indexes :compound-index))))(testing "compound index that has many keys can still determine the first key"- ;; first index column is :j+ ;; first index column is :j(mongo.util/create-index (mongo.util/collection db "compound-index-big")(array-map "j" 1 "b" 1 "c" 1 "d" 1 "e" 1 "f" 1 "g" 1 "h" 1 "a" 1))(is (= #{{:type :normal-column-index :value "_id"}diff --git a/modules/drivers/presto-jdbc/src/metabase/driver/presto_jdbc.clj b/modules/drivers/presto-jdbc/src/metabase/driver/presto_jdbc.cljindex 0cd48617ca0..39957c46e36 100644--- a/modules/drivers/presto-jdbc/src/metabase/driver/presto_jdbc.clj+++ b/modules/drivers/presto-jdbc/src/metabase/driver/presto_jdbc.clj@@ -568,7 +568,7 @@[driver conn schema table-name](try(let [sql (sql-jdbc.describe-database/simple-select-probe-query driver schema table-name)]- ;; if the query completes without throwing an Exception, we can SELECT from this table+ ;; if the query completes without throwing an Exception, we can SELECT from this table(jdbc/reducible-query {:connection conn} sql)true)(catch Throwable _@@ -826,7 +826,7 @@(or (instance? OffsetDateTime t)(instance? ZonedDateTime t))(-> (t/offset-date-time t)- ;; tests are expecting this to be in the UTC offset, so convert to that+ ;; tests are expecting this to be in the UTC offset, so convert to that(t/with-offset-same-instant (t/zone-offset 0)));; presto "helpfully" returns local results already adjusted to session time zone offset for us, e.g.diff --git a/modules/drivers/redshift/src/metabase/driver/redshift.clj b/modules/drivers/redshift/src/metabase/driver/redshift.cljindex 38db8af687e..1b30b986def 100644--- a/modules/drivers/redshift/src/metabase/driver/redshift.clj+++ b/modules/drivers/redshift/src/metabase/driver/redshift.clj@@ -632,8 +632,8 @@;; This might be helpful for getting privileges for actions in the future.#_(defmethod sql-jdbc.sync/current-user-table-privileges :redshift[_driver conn-spec & {:as _options}]- ;; KNOWN LIMITATION: this won't return privileges for external tables, calling has_table_privilege on an external table- ;; result in an operation not supported error+ ;; KNOWN LIMITATION: this won't return privileges for external tables, calling has_table_privilege on an external table+ ;; result in an operation not supported error(->> (jdbc/queryconn-spec(str/join@@ -643,7 +643,7 @@" NULL as role,"" t.schemaname as schema,"" t.objectname as table,"- ;; if `has_table_privilege` is true `has_any_column_privilege` is false and vice versa, so we have to check both.+ ;; if `has_table_privilege` is true `has_any_column_privilege` is false and vice versa, so we have to check both." pg_catalog.has_table_privilege(current_user, '\"' || t.schemaname || '\".\"' || t.objectname || '\"', 'SELECT')"" OR pg_catalog.has_any_column_privilege(current_user, '\"' || t.schemaname || '\"' || '.' || '\"' || t.objectname || '\"', 'SELECT') as select,"" pg_catalog.has_table_privilege(current_user, '\"' || t.schemaname || '\"' || '.' || '\"' || t.objectname || '\"', 'UPDATE')"diff --git a/modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj b/modules/drivers/snowflake/test/metabase/driver/snowflake_test.cljindex 3cbb53f4840..1aa2b333d86 100644--- a/modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj+++ b/modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj@@ -707,7 +707,7 @@{:user some?:password some?:private_key_file complement}- ;; Before `use-password` password took precedence over a key file+ ;; Before `use-password` password took precedence over a key file(sql-jdbc.conn/connection-details->spec :snowflake (assoc details :private-key-value pk-key))))(is (=?{:user some?@@ -870,13 +870,13 @@:snowflake(let [account (tx/db-test-env-var-or-throw :snowflake :account)warehouse (tx/db-test-env-var-or-throw :snowflake :warehouse)- ;; User with default role PULIC. To access the db custom role has to be used.+ ;; User with default role PULIC. To access the db custom role has to be used.user (tx/db-test-env-var-or-throw :snowflake :rsa-role-test-custom-user)private-key-value (mt/format-env-key (tx/db-test-env-var-or-throw :snowflake :pk-private-key))db (tx/db-test-env-var-or-throw :snowflake :rsa-role-test-db)database {:name "Snowflake RSA test DB custom":engine :snowflake- ;; Details as collected from `api handler POST / database` are used.+ ;; Details as collected from `api handler POST / database` are used.:details {:role nil:warehouse warehouse:db db@@ -888,7 +888,7 @@:private-key-value (mt/bytes->base64-data-uri (u/string-to-bytes private-key-value)):tunnel-enabled false:user user}}]- ;; TODO: We should make those message returned when role is incorrect more descriptive!+ ;; TODO: We should make those message returned when role is incorrect more descriptive!(testing "Database can not be accessed with `nil` default role"(is (= "Looks like the Database name is incorrect."(:message (mt/user-http-request :crowberto :post 400 "database"@@ -898,7 +898,7 @@(:message (mt/user-http-request :crowberto :post 400 "database"(assoc-in database [:details :role] "PUBLIC"))))))(testing "Database can be created using specified role"- ;; Map containing :details is expected to be database, hence considering request successful.+ ;; Map containing :details is expected to be database, hence considering request successful.(is (contains? (mt/user-http-request :crowberto :post 200 "database"(assoc-in database [:details :role](tx/db-test-env-var-or-throw :snowflake :rsa-role-test-role)))@@ -918,7 +918,7 @@(mt/rows (qp/process-query {:database (:id db):type :query:query {:source-table (:id table)}})))))- ;; Cleanup+ ;; Cleanup(u/ignore-exceptions (t2/delete! :model/Database (:id db)))(u/ignore-exceptions (t2/delete! :model/Table (:id table)))(u/ignore-exceptions (t2/delete! :model/Field :id [:in (map :id fields)]))@@ -929,13 +929,13 @@:snowflake(let [account (tx/db-test-env-var-or-throw :snowflake :account)warehouse (tx/db-test-env-var-or-throw :snowflake :warehouse)- ;; User with default role PULIC. To access the db custom role has to be used.+ ;; User with default role PULIC. To access the db custom role has to be used.user (tx/db-test-env-var-or-throw :snowflake :rsa-role-test-default-user)private-key-value (mt/format-env-key (tx/db-test-env-var-or-throw :snowflake :pk-private-key))db (tx/db-test-env-var-or-throw :snowflake :rsa-role-test-db)database {:name "Snowflake RSA test DB default":engine :snowflake- ;; Details as collected from `api handler POST / database` are used.+ ;; Details as collected from `api handler POST / database` are used.:details {:role nil:warehouse warehouse:db db@@ -948,7 +948,7 @@:tunnel-enabled false:user user}}](testing "Database can be created using _default_ `nil` role"- ;; Map containing :details is expected to be database, hence considering request successful.+ ;; Map containing :details is expected to be database, hence considering request successful.(is (contains? (mt/user-http-request :crowberto :post 200 "database" database):details));; As the request is asynchronous, wait for sync to complete.@@ -966,7 +966,7 @@(mt/rows (qp/process-query {:database (:id db):type :query:query {:source-table (:id table)}})))))- ;; Cleanup+ ;; Cleanup(u/ignore-exceptions (t2/delete! :model/Database (:id db)))(u/ignore-exceptions (t2/delete! :model/Table (:id table)))(u/ignore-exceptions (t2/delete! :model/Field :id [:in (map :id fields)]))diff --git a/modules/drivers/sqlite/src/metabase/driver/sqlite.clj b/modules/drivers/sqlite/src/metabase/driver/sqlite.cljindex 0912a819b64..4eec9acb901 100644--- a/modules/drivers/sqlite/src/metabase/driver/sqlite.clj+++ b/modules/drivers/sqlite/src/metabase/driver/sqlite.clj@@ -454,9 +454,9 @@month-of-year-diff (h2x/- (extract :month-of-year y) (extract :month-of-year x))total-month-diff (h2x/+ month-of-year-diff (h2x/* year-diff 12))](h2x/+ total-month-diff- ;; total-month-diff counts month boundaries not whole months, so we need to adjust- ;; if x<y but x>y in the month calendar then subtract one month- ;; if x>y but x<y in the month calendar then add one month+ ;; total-month-diff counts month boundaries not whole months, so we need to adjust+ ;; if x<y but x>y in the month calendar then subtract one month+ ;; if x>y but x<y in the month calendar then add one month[:case[:and [:< x y] [:> (extract :day-of-month x) (extract :day-of-month y)]]-1diff --git a/modules/drivers/sqlserver/src/metabase/driver/sqlserver.clj b/modules/drivers/sqlserver/src/metabase/driver/sqlserver.cljindex b6211d17234..89e2065662e 100644--- a/modules/drivers/sqlserver/src/metabase/driver/sqlserver.clj+++ b/modules/drivers/sqlserver/src/metabase/driver/sqlserver.clj@@ -1108,10 +1108,10 @@nil(fn [^Connection conn](let [^DatabaseMetaData metadata (.getMetaData conn)- ;; SQL Server doesn't have a special escape method, but we should still handle nil+ ;; SQL Server doesn't have a special escape method, but we should still handle nilschema-name (some->> schema (driver/escape-entity-name-for-metadata driver))table-name (some->> name (driver/escape-entity-name-for-metadata driver))- ;; SQL Server uses the database name from the connection, not as a parameter+ ;; SQL Server uses the database name from the connection, not as a parameterdb-name nil](with-open [rs (.getTables metadata db-name schema-name table-name (into-array String ["TABLE"]))](.next rs))))))diff --git a/modules/drivers/starburst/src/metabase/driver/starburst.clj b/modules/drivers/starburst/src/metabase/driver/starburst.cljindex 33eabbfcdad..f06179cebb6 100644--- a/modules/drivers/starburst/src/metabase/driver/starburst.clj+++ b/modules/drivers/starburst/src/metabase/driver/starburst.clj@@ -559,26 +559,26 @@options(fn [^java.sql.Connection conn](when-let [db (cond- ;; id?+ ;; id?(integer? db-or-id-or-spec)(driver-api/with-metadata-provider db-or-id-or-spec(driver-api/database (driver-api/metadata-provider)))- ;; db?+ ;; db?(u/id db-or-id-or-spec) db-or-id-or-spec- ;; otherwise it's a spec and we can't get the db+ ;; otherwise it's a spec and we can't get the db:else nil)](sql-jdbc.execute/set-role-if-supported! driver conn db))(try(sql-jdbc.execute/set-best-transaction-level! driver conn)(let [underlying-conn (pooled-conn->starburst-conn conn)](when-not (str/blank? (get options :session-timezone))- ;; set session time zone if defined+ ;; set session time zone if defined(.setTimeZoneId underlying-conn (get options :session-timezone))))(try(.setReadOnly conn true)(catch Throwable e(log/warn e "Error setting starburst connection to read-only")))- ;; as with statement and prepared-statement, cannot set holdability on the connection level+ ;; as with statement and prepared-statement, cannot set holdability on the connection levelconn(catch Throwable e(.close conn)@@ -600,7 +600,7 @@(or (instance? OffsetDateTime t)(instance? ZonedDateTime t))(-> (t/offset-date-time t)- ;; tests are expecting this to be in the UTC offset, so convert to UTC+ ;; tests are expecting this to be in the UTC offset, so convert to UTC(t/with-offset-same-instant (t/zone-offset 0)));; starburst returns local results already adjusted to session time zone offset for us, e.g.diff --git a/modules/drivers/starburst/test/metabase/driver/starburst_test.clj b/modules/drivers/starburst/test/metabase/driver/starburst_test.cljindex 02b7cad9327..430680a33fd 100644--- a/modules/drivers/starburst/test/metabase/driver/starburst_test.clj+++ b/modules/drivers/starburst/test/metabase/driver/starburst_test.clj@@ -356,8 +356,8 @@(deftest prepared-statements(mt/test-driver :starburst(testing "Make sure prepared statements work"- ;; If impersonation is set, then the starburst user should be the current Metabase user, i.e. [email protected]- ;; The role is ignored as Metabase users may not have the role defined in the database connection+ ;; If impersonation is set, then the starburst user should be the current Metabase user, i.e. [email protected]+ ;; The role is ignored as Metabase users may not have the role defined in the database connection(prepared-statements-helper true)(prepared-statements-helper false))))diff --git a/src/metabase/actions/http_action.clj b/src/metabase/actions/http_action.cljindex d359bd0992a..94d8c7df34e 100644--- a/src/metabase/actions/http_action.clj+++ b/src/metabase/actions/http_action.clj@@ -134,7 +134,7 @@:content-type :json:throw-exceptions false:headers (merge- ;; TODO maybe we want to default Agent here? Maybe Origin/Referer?+ ;; TODO maybe we want to default Agent here? Maybe Origin/Referer?{"X-Metabase-Action" (:name action)}(-> headers(parse-and-substitute params->value)diff --git a/src/metabase/actions_rest/api.clj b/src/metabase/actions_rest/api.cljindex d6569552c01..6474c6c212f 100644--- a/src/metabase/actions_rest/api.clj+++ b/src/metabase/actions_rest/api.clj@@ -39,7 +39,7 @@[:and[:= :type "model"][:= :archived false]- ;; action permission keyed off of model permission+ ;; action permission keyed off of model permission(collection/visible-collection-filter-clause)]}))](actions-for models))))diff --git a/src/metabase/analytics/prometheus.clj b/src/metabase/analytics/prometheus.cljindex 6bfa7255f13..b587c7901df 100644--- a/src/metabase/analytics/prometheus.clj+++ b/src/metabase/analytics/prometheus.clj@@ -272,7 +272,7 @@(prometheus/histogram :metabase-remote-sync/export-duration-ms{:description "Duration in milliseconds that remote-sync exports took."- ;; 1ms -> 10minutes+ ;; 1ms -> 10minutes:buckets [1 500 1000 5000 10000 30000 60000 120000 300000 600000]})(prometheus/counter :metabase-remote-sync/exports{:description "Number of remote-sync export calls"})@@ -280,7 +280,7 @@{:description "Number of failed remote-sync export calls"})(prometheus/histogram :metabase-remote-sync/import-duration-ms{:description "Duration in milliseconds that remote-sync imports took."- ;; 1ms -> 10minutes+ ;; 1ms -> 10minutes:buckets [1 500 1000 5000 10000 30000 60000 120000 300000 600000]})(prometheus/counter :metabase-remote-sync/imports{:description "Number of remote-sync import calls"})@@ -311,13 +311,13 @@{:description "Total number of ms updating the index"})(prometheus/histogram :metabase-search/index-update-duration-ms{:description "Duration in milliseconds that index update jobs took."- ;; 1ms -> 10minutes+ ;; 1ms -> 10minutes:buckets [1 500 1000 5000 10000 30000 60000 120000 300000 600000]})(prometheus/counter :metabase-search/index-reindex-ms{:description "Total number of ms reindexing the index"})(prometheus/histogram :metabase-search/index-reindex-duration-ms{:description "Duration in milliseconds that index reindex jobs took."- ;; 1ms -> 10minutes+ ;; 1ms -> 10minutes:buckets [1 500 1000 5000 10000 30000 60000 120000 300000 600000]})(prometheus/gauge :metabase-search/appdb-index-size{:description "Number of rows in the active appdb index table."})@@ -416,7 +416,7 @@:labels [:stage :catalog]:buckets [1 10 50 100 500 1000 5000 10000 30000 60000]})-;; notification metrics+ ;; notification metrics(prometheus/counter :metabase-notification/send-ok{:description "Number of successful notification sends.":labels [:payload-type]})diff --git a/src/metabase/analyze/fingerprint/fingerprinters.clj b/src/metabase/analyze/fingerprint/fingerprinters.cljindex 46eaa09d420..6a0d3fc9a64 100644--- a/src/metabase/analyze/fingerprint/fingerprinters.clj+++ b/src/metabase/analyze/fingerprint/fingerprinters.clj@@ -130,8 +130,8 @@(u.date/extract-units unit):type/Integer- ;; for historical reasons the Temporal fingerprinter is still called `:type/DateTime` so anything that derives- ;; from `Temporal` (such as DATEs and TIMEs) should still use the `:type/DateTime` fingerprinter+ ;; for historical reasons the Temporal fingerprinter is still called `:type/DateTime` so anything that derives+ ;; from `Temporal` (such as DATEs and TIMEs) should still use the `:type/DateTime` fingerprinter(isa? (or effective-type base-type) :type/Temporal):type/DateTimediff --git a/src/metabase/api_keys/models/api_key.clj b/src/metabase/api_keys/models/api_key.cljindex b6be3996993..a364fafce19 100644--- a/src/metabase/api_keys/models/api_key.clj+++ b/src/metabase/api_keys/models/api_key.clj@@ -195,8 +195,8 @@(u/auto-retry 5(let [api-key (generate-key)prefix (prefix (u.secret/expose api-key))]- ;; we could make this more efficient by generating 5 API keys up front and doing one select to remove any- ;; duplicates. But a duplicate should be rare enough to just do multiple queries for now.+ ;; we could make this more efficient by generating 5 API keys up front and doing one select to remove any+ ;; duplicates. But a duplicate should be rare enough to just do multiple queries for now.(if-not (t2/exists? :model/ApiKey :key_prefix prefix)api-key(throw (ex-info (tru "could not generate key with unique prefix") {}))))))diff --git a/src/metabase/app_db/custom_migrations.clj b/src/metabase/app_db/custom_migrations.cljindex 5f8b2c235be..c2439501e5c 100644--- a/src/metabase/app_db/custom_migrations.clj+++ b/src/metabase/app_db/custom_migrations.clj@@ -389,7 +389,7 @@:where [:= :report_dashboardcard.dashboard_id dashboard-id]:left-join [:dashboard_tab [:= :dashboard_tab.id :report_dashboardcard.dashboard_tab_id]]})(group-by :tab_position)- ;; sort by tab position+ ;; sort by tab position(sort-by first))cards->max-height (fn [cards] (apply max (map #(+ (:row %) (:size_y %)) cards)))](loop [position+cards tab+cards@@ -541,11 +541,11 @@(run! update-one! (t2/reducible-query {:select [:*]:from [:revision]:where [:and- ;; only include cards with field refs in column_settings+ ;; only include cards with field refs in column_settings[:or[:like :object "%ref\\\\\",[\\\\\"field%"][:like :object "%ref\\\\\\\",[\\\\\\\"field%"]]- ;; only include cards with joins+ ;; only include cards with joins[:like :object "%joins%"][:= :model "Card"]]})));; Reverse migration@@ -778,13 +778,13 @@(m/map-vals#(select-keys % ["click_behavior"])column_settings)))- ;; select click behavior top level and in column settings+ ;; select click behavior top level and in column settings(select-keys ["column_settings" "click_behavior"])(remove-nil-keys)))fix-top-level (fn [toplevel](if (= (get toplevel "click") "link")(assoc toplevel- ;; add new shape top level+ ;; add new shape top level"click_behavior"{"type" (get toplevel "click")"linkType" "url"@@ -794,11 +794,11 @@(reduce-kv(fn [m col field-settings](assoc m col- ;; add the click stuff under the new click_behavior entry or keep the- ;; field settings as is+ ;; add the click stuff under the new click_behavior entry or keep the+ ;; field settings as is(if (and (= (get field-settings "view_as") "link")(contains? field-settings "link_template"))- ;; remove old shape and add new shape under click_behavior+ ;; remove old shape and add new shape under click_behavior(assoc field-settings"click_behavior"{"type" (get field-settings "view_as")@@ -810,23 +810,23 @@column-settings))fixed-card (-> (if (contains? dashcard "click")(dissoc card "click_behavior") ;; throw away click behavior if dashcard has click- ;; behavior added+ ;; behavior added(fix-top-level card))(update "column_settings" fix-cols) ;; fix columns and then select only the new shape from- ;; the settings tree+ ;; the settings treeexisting-fixed)fixed-dashcard (update (fix-top-level dashcard) "column_settings" fix-cols)final-settings (->> (m/deep-merge fixed-card fixed-dashcard (existing-fixed dashcard))- ;; remove nils and empty maps _AFTER_ deep merging so that the shapes are- ;; uniform. otherwise risk not fully clobbering an underlying form if the one going on top- ;; doesn't have link text+ ;; remove nils and empty maps _AFTER_ deep merging so that the shapes are+ ;; uniform. otherwise risk not fully clobbering an underlying form if the one going on top+ ;; doesn't have link text(walk/postwalk (fn [form](if (map? form)(into {} (for [[k v] form:when (if (seqable? v)- ;; remove keys with empty maps. must be postwalk+ ;; remove keys with empty maps. must be postwalk(seq v)- ;; remove nils+ ;; remove nils(some? v))][k v]))form))))]@@ -1183,7 +1183,7 @@true)(define-migration CreateSampleContent)- ;; Does nothing. This is left in so we do not alter the liquibase migration history. See: [[CreateSampleContentV2]].+;; Does nothing. This is left in so we do not alter the liquibase migration history. See: [[CreateSampleContentV2]].(defn- replace-temporals [v](if (isa? (type v) java.time.temporal.Temporal)@@ -1486,7 +1486,7 @@(defn- json-column-key-like-clause[key column][:or [:like column (str "%\\\\\"" key "\\\\\"%")]- ;; MySQL with NO_BACKSLASH_ESCAPES disabled:+ ;; MySQL with NO_BACKSLASH_ESCAPES disabled:[:like column (str "%\\\\\\\"" key "\\\\\\\"%")]])(defn- update-legacy-column-keys-in-card-viz-settingsdiff --git a/src/metabase/app_db/jdbc_protocols.clj b/src/metabase/app_db/jdbc_protocols.cljindex f2594ec6d3d..c34a9b4973a 100644--- a/src/metabase/app_db/jdbc_protocols.clj+++ b/src/metabase/app_db/jdbc_protocols.clj@@ -178,7 +178,7 @@;;;; [[next.jdbc]] and Toucan 2 mappings(extend-protocol next.jdbc.prepare/SettableParameter- ;; DB's don't seem to handle Instant correctly so convert it to an OffsetDateTime with zone offset = 0+ ;; DB's don't seem to handle Instant correctly so convert it to an OffsetDateTime with zone offset = 0Instant(set-parameter [t stmt i](jdbc/set-parameter (t/offset-date-time t (t/zone-offset 0)) stmt i))diff --git a/src/metabase/app_db/liquibase.clj b/src/metabase/app_db/liquibase.cljindex ed655796226..57621cef837 100644--- a/src/metabase/app_db/liquibase.clj+++ b/src/metabase/app_db/liquibase.clj@@ -368,8 +368,8 @@(do(log/info "Database has unrun migrations. Checking if migration lock is taken...")(with-scope-locked liquibase- ;; while we were waiting for the lock, it was possible that another instance finished the migration(s), so make- ;; sure something still needs to be done...+ ;; while we were waiting for the lock, it was possible that another instance finished the migration(s), so make+ ;; sure something still needs to be done...(let [to-run-migrations (unrun-migrations data-source)unrun-migrations-count (count to-run-migrations)](if (pos? unrun-migrations-count)diff --git a/src/metabase/app_db/setup.clj b/src/metabase/app_db/setup.cljindex 0df21374ce2..78c638655b6 100644--- a/src/metabase/app_db/setup.clj+++ b/src/metabase/app_db/setup.clj@@ -95,21 +95,21 @@:down-force (apply liquibase/rollback-major-version! conn liquibase true args):print (print-migrations-and-quit-if-needed! liquibase data-source):release-locks (liquibase/force-release-locks! liquibase))- ;; Migrations were successful; commit everything and re-enable auto-commit+ ;; Migrations were successful; commit everything and re-enable auto-commit(.commit conn)(.setAutoCommit conn true):done- ;; In the Throwable block, we're releasing the lock assuming we have the lock and we failed while in the- ;; middle of a migration. It's possible that we failed because we couldn't get the lock. We don't want to- ;; clear the lock in that case, so handle that case separately+ ;; In the Throwable block, we're releasing the lock assuming we have the lock and we failed while in the+ ;; middle of a migration. It's possible that we failed because we couldn't get the lock. We don't want to+ ;; clear the lock in that case, so handle that case separately(catch LockException e(.rollback conn)(throw e))- ;; If for any reason any part of the migrations fail then rollback all changes+ ;; If for any reason any part of the migrations fail then rollback all changes(catch Throwable e(.rollback conn)- ;; With some failures, it's possible that the lock won't be released. To make this worse, if we retry the- ;; operation without releasing the lock first, the real error will get hidden behind a lock error+ ;; With some failures, it's possible that the lock won't be released. To make this worse, if we retry the+ ;; operation without releasing the lock first, the real error will get hidden behind a lock error(liquibase/release-lock-if-needed! liquibase)(throw e))))))diff --git a/src/metabase/audit_app/models/audit_log.clj b/src/metabase/audit_app/models/audit_log.cljindex f5a665394ce..d417daad083 100644--- a/src/metabase/audit_app/models/audit_log.clj+++ b/src/metabase/audit_app/models/audit_log.clj@@ -45,7 +45,7 @@(defmethod model-details :model/Card[{card-type :type, :as card} _event-type](merge (select-keys card [:name :description :database_id :table_id])- ;; Use `model` instead of `dataset` to mirror product terminology+ ;; Use `model` instead of `dataset` to mirror product terminology{:model? (= (keyword card-type) :model)}))(defmethod model-details :model/Channeldiff --git a/src/metabase/bookmarks/models/bookmark.clj b/src/metabase/bookmarks/models/bookmark.cljindex 3db63aaec20..4e05bea124f 100644--- a/src/metabase/bookmarks/models/bookmark.clj+++ b/src/metabase/bookmarks/models/bookmark.clj@@ -128,7 +128,7 @@[:document.archived (mdb/qualify :model/Document :archived)]]left-joins [[:report_card :card] [:= :bookmark.card_id :card.id][:report_dashboard :dashboard] [:= :bookmark.dashboard_id :dashboard.id]- ;; use of [[h2x/identifier]] here is a workaround for https://github.com/seancorfield/honeysql/issues/450+ ;; use of [[h2x/identifier]] here is a workaround for https://github.com/seancorfield/honeysql/issues/450[:collection :collection] [:in :collection.id [(h2x/identifier :field :bookmark :collection_id)(h2x/identifier :field :dashboard :collection_id)]][:bookmark_ordering :bookmark_ordering] [:and@@ -146,8 +146,8 @@:left-join left-joins:where where-conditions:order-by [[:bookmark_ordering.ordering (case (mdb/db-type)- ;; NULLS LAST is not supported by MySQL, but this is default- ;; behavior for MySQL anyway+ ;; NULLS LAST is not supported by MySQL, but this is default+ ;; behavior for MySQL anyway(:postgres :h2) :asc-nulls-last:mysql :asc)][:created_at :desc]]})diff --git a/src/metabase/channel/task/refresh_slack_channel_user_cache.clj b/src/metabase/channel/task/refresh_slack_channel_user_cache.cljindex 953f1ed0d64..22daa9b372a 100644--- a/src/metabase/channel/task/refresh_slack_channel_user_cache.clj+++ b/src/metabase/channel/task/refresh_slack_channel_user_cache.clj@@ -45,7 +45,7 @@(triggers/with-schedule(cron/schedule(cron/cron-schedule- ;; run every 4 hours at a random minute:+ ;; run every 4 hours at a random minute:(format "0 %d 0/4 1/1 * ? *" (rand-int 60)))(cron/with-misfire-handling-instruction-do-nothing)))diff --git a/src/metabase/cmd/env_var_dox.clj b/src/metabase/cmd/env_var_dox.cljindex f43c175113a..08da4e9c270 100644--- a/src/metabase/cmd/env_var_dox.clj+++ b/src/metabase/cmd/env_var_dox.clj@@ -170,16 +170,16 @@[env-var](or (false? (:doc env-var))(false? (:can-read-from-env? env-var))- ;; Ideally, we'd move off of this list completely,- ;; but not all environment variables are defsettings.+ ;; Ideally, we'd move off of this list completely,+ ;; but not all environment variables are defsettings.(contains? env-vars-not-to-mess-with (format-prefix env-var))))(defn- setter-none?"Used to remove settings that lack a setter (`:setter :none`).For example, settings that are derived from other settings."[env-var]- ;; If the `defsetting` has a `:doc` key with a string, we should document it.- ;; Checking that the `:doc` value is truthy because `:doc false` is a valid value.+ ;; If the `defsetting` has a `:doc` key with a string, we should document it.+ ;; Checking that the `:doc` value is truthy because `:doc false` is a valid value.(when-not (boolean (:doc env-var))(= :none (:setter env-var))))diff --git a/src/metabase/content_verification/models/moderation_review.clj b/src/metabase/content_verification/models/moderation_review.cljindex 0bb929d8c60..a07a2695195 100644--- a/src/metabase/content_verification/models/moderation_review.clj+++ b/src/metabase/content_verification/models/moderation_review.clj@@ -55,10 +55,10 @@:where [:and[:= :moderated_item_id item-id][:= :moderated_item_type item-type]]- ;; cannot put the offset in this query as mysql doesn't play nice. It requires a limit- ;; as well which we do not want to give. The offset is only 10 though so its not a huge- ;; savings and we run this on every entry so the max number is 10, delete the extra,- ;; and insert a new one to arrive at 10 again, our invariant.+ ;; cannot put the offset in this query as mysql doesn't play nice. It requires a limit+ ;; as well which we do not want to give. The offset is only 10 though so its not a huge+ ;; savings and we run this on every entry so the max number is 10, delete the extra,+ ;; and insert a new one to arrive at 10 again, our invariant.:order-by [[:id :desc]]}))](when (seq ids)(t2/delete! :model/ModerationReview :id [:in ids]))))diff --git a/src/metabase/dashboards/models/dashboard.clj b/src/metabase/dashboards/models/dashboard.cljindex 00144306b9a..ac2caabb66a 100644--- a/src/metabase/dashboards/models/dashboard.clj+++ b/src/metabase/dashboards/models/dashboard.clj@@ -50,10 +50,10 @@([instance];; Dashboards in audit collection should be read only(and (not (and- ;; We want to make sure there's an existing audit collection before doing the equality check below.- ;; If there is no audit collection, this will be nil:+ ;; We want to make sure there's an existing audit collection before doing the equality check below.+ ;; If there is no audit collection, this will be nil:(some? (:id (audit/default-audit-collection)))- ;; Is a direct descendant of audit collection+ ;; Is a direct descendant of audit collection(= (:collection_id instance) (:id (audit/default-audit-collection)))))(mi/current-user-has-full-permissions? (mi/perms-objects-set instance :write))))([_ pk]@@ -120,9 +120,9 @@;; have linked filters. (metabase#33892)(some? (:values_source_type p))(= (:values_query_type p) :none))- ;; linked filters don't do anything when parameters have values_query_type="none" (aka "Input box"),- ;; but it was previously possible to set :values_query_type to "none" and still have linked filters.- ;; (metabase#34657)+ ;; linked filters don't do anything when parameters have values_query_type="none" (aka "Input box"),+ ;; but it was previously possible to set :values_query_type to "none" and still have linked filters.+ ;; (metabase#34657)(dissoc :filteringParameters)))(defn- migrate-parameters-list@@ -304,7 +304,7 @@(update :result_metadata #(or % (-> card:dataset_querylegacy-result-metadata-for-query)))- ;; Xrays populate this in their transient cards+ ;; Xrays populate this in their transient cards(dissoc :id :can_run_adhoc_query))))](events/publish-event! :event/card-create {:object card :user-id (:creator_id card)})(t2/hydrate card :creator :dashboard_count :can_write :can_run_adhoc_query :collection))))diff --git a/src/metabase/dashboards/models/dashboard_tab.clj b/src/metabase/dashboards/models/dashboard_tab.cljindex fd9164eb734..e8ddb306c0c 100644--- a/src/metabase/dashboards/models/dashboard_tab.clj+++ b/src/metabase/dashboards/models/dashboard_tab.clj@@ -85,7 +85,7 @@(let [update-ks [:name :position]id->current-tab (m/index-by :id current-tabs)to-update-tabs (filter- ;; filter out tabs that haven't changed+ ;; filter out tabs that haven't changed(fn [new-tab](let [current-tab (get id->current-tab (:id new-tab))](not= (select-keys current-tab update-ks)diff --git a/src/metabase/dashboards_rest/api.clj b/src/metabase/dashboards_rest/api.cljindex c9d7bc529da..3ce11cfb7c3 100644--- a/src/metabase/dashboards_rest/api.clj+++ b/src/metabase/dashboards_rest/api.clj@@ -103,7 +103,7 @@:attributes {:dashboard/id dashboard-id}}(binding [params/*field-id-context* (atom params/empty-field-id-context)](cond->> [[:dashcards- ;; disabled :can_run_adhoc_query for performance reasons in 50 release+ ;; disabled :can_run_adhoc_query for performance reasons in 50 release[:card :can_write #_:can_run_adhoc_query [:moderation_reviews :moderator_details]][:series :can_write #_:can_run_adhoc_query]:dashcard/action@@ -554,10 +554,10 @@:width (:width existing-dashboard)}new-cards (atom nil)dashboard (t2/with-transaction [_conn]- ;; Adding a new dashboard at `collection_position` could cause other dashboards in this- ;; collection to change position, check that and fix up if needed+ ;; Adding a new dashboard at `collection_position` could cause other dashboards in this+ ;; collection to change position, check that and fix up if needed(api/maybe-reconcile-collection-position! dashboard-data)- ;; Ok, now save the Dashboard+ ;; Ok, now save the Dashboard(let [dash (first (t2/insert-returning-instances! :model/Dashboard dashboard-data)){id->new-card :copiedid->referenced-card :referenced@@ -988,8 +988,8 @@(api/check-500(do(t2/with-transaction [_conn]- ;; If the dashboard has an updated position, or if the dashboard is moving to a new collection, we might need to- ;; adjust the collection position of other dashboards in the collection+ ;; If the dashboard has an updated position, or if the dashboard is moving to a new collection, we might need to+ ;; adjust the collection position of other dashboards in the collection(api/maybe-reconcile-collection-position! current-dash dash-updates)(when-let [updates (not-empty(u/select-keys-when@@ -1013,7 +1013,7 @@(t2/update! :model/Dashboard id updates)(when (contains? updates :collection_id)(events/publish-event! :event/collection-touch {:collection-id id :user-id api/*current-user-id*}))- ;; Handle broken subscriptions, if any, when parameters changed+ ;; Handle broken subscriptions, if any, when parameters changed(when parameters(handle-broken-subscriptions id original-params)))(when update-dashcards-and-tabs?@@ -1042,7 +1042,7 @@(contains? deleted-tab-ids (:dashboard_tab_id dashcard)))current-dashcards)new-dashcards (cond->> dashcards- ;; fixup the temporary tab ids with the real ones+ ;; fixup the temporary tab ids with the real ones(seq old->new-tab-id)(map (fn [card](if-let [real-tab-id (get old->new-tab-id (:dashboard_tab_id card))]diff --git a/src/metabase/driver.clj b/src/metabase/driver.cljindex 0a25cd325dc..6d1155a6d1a 100644--- a/src/metabase/driver.clj+++ b/src/metabase/driver.clj@@ -189,12 +189,12 @@that for you."{:added "0.32.0" :arglists '([driver])}dispatch-on-uninitialized-driver)- ;; VERY IMPORTANT: Unlike all other driver multimethods, we DO NOT use the driver hierarchy for dispatch here. Why?- ;; We do not want a driver to inherit parent drivers' implementations and have those implementations end up getting- ;; called multiple times. If a driver does not implement `initialize!`, *always* fall back to the default no-op- ;; implementation.- ;;- ;; `initialize-if-needed!` takes care to make sure a driver's parent(s) are initialized before initializing a driver.+;; VERY IMPORTANT: Unlike all other driver multimethods, we DO NOT use the driver hierarchy for dispatch here. Why?+;; We do not want a driver to inherit parent drivers' implementations and have those implementations end up getting+;; called multiple times. If a driver does not implement `initialize!`, *always* fall back to the default no-op+;; implementation.+;;+;; `initialize-if-needed!` takes care to make sure a driver's parent(s) are initialized before initializing a driver.(defmethod initialize! :default [_]) ; no-opdiff --git a/src/metabase/driver/common.clj b/src/metabase/driver/common.cljindex 44fe14854cb..9f4f1819b22 100644--- a/src/metabase/driver/common.clj+++ b/src/metabase/driver/common.clj@@ -306,7 +306,7 @@:type :checked-section:check (fn [](and- ;; Managed Identities only make sense if Metabase is in the same cloud as the DW+ ;; Managed Identities only make sense if Metabase is in the same cloud as the DW(not (premium-features/is-hosted?))(premium-features/enable-database-auth-providers?))):default false}diff --git a/src/metabase/driver/postgres.clj b/src/metabase/driver/postgres.cljindex 71ab0334480..fc4bcecff99 100644--- a/src/metabase/driver/postgres.clj+++ b/src/metabase/driver/postgres.clj@@ -354,7 +354,7 @@[[:and[:or [:= :column_default nil] [:= [:lower :column_default] [:inline "null"]]][:= :is_nullable [:inline "NO"]]- ;;_ IS_AUTOINCREMENT from: https://github.com/pgjdbc/pgjdbc/blob/fcc13e70e6b6bb64b848df4b4ba6b3566b5e95a3/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L1852-L1856+ ;;_ IS_AUTOINCREMENT from: https://github.com/pgjdbc/pgjdbc/blob/fcc13e70e6b6bb64b848df4b4ba6b3566b5e95a3/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L1852-L1856[:not [:or[:and [:!= :column_default nil] [:like :column_default [:inline "%nextval(%"]]][:!= :is_identity [:inline "NO"]]]]]diff --git a/src/metabase/driver/sql/query_processor.clj b/src/metabase/driver/sql/query_processor.cljindex e4a4c477f03..fe39ba51cb9 100644--- a/src/metabase/driver/sql/query_processor.clj+++ b/src/metabase/driver/sql/query_processor.clj@@ -45,7 +45,7 @@(str/replace #";([\s;]*(--.*\n?)*)*$" "")str/trimr(as-> trimmed- ;; Query could potentially end with a comment.+ ;; Query could potentially end with a comment.(if (re-find #"--.*$" trimmed)(str trimmed "\n")trimmed))))@@ -2204,8 +2204,8 @@(mergehoneysql-form(if (needs-cte-for-duplicate-cols? source-metadata)- ;; HoneySQL cannot expand [::h2x/identifier :table "__mb_source"] in the with alias.- ;; This is ok since we control the alias.+ ;; HoneySQL cannot expand [::h2x/identifier :table "__mb_source"] in the with alias.+ ;; This is ok since we control the alias.{:with [[[source-query-alias {:columns (mapv #(h2x/identifier :field %) desired-aliases)}]source-clause]]:from [[table-alias]]}diff --git a/src/metabase/driver/sql_jdbc/actions.clj b/src/metabase/driver/sql_jdbc/actions.cljindex cc92c7ccd1d..a7504608307 100644--- a/src/metabase/driver/sql_jdbc/actions.clj+++ b/src/metabase/driver/sql_jdbc/actions.clj@@ -57,8 +57,8 @@(dissoc (methods maybe-parse-sql-error) :default))](try(some #(% database action-type (ex-message e)) parsers-for-driver)- ;; Catch errors in parse-sql-error and log them so more errors in the future don't break the entire action.- ;; We'll still get the original unparsed error message.+ ;; Catch errors in parse-sql-error and log them so more errors in the future don't break the entire action.+ ;; We'll still get the original unparsed error message.(catch Throwable new-e(log/errorf new-e "Error parsing SQL error message %s: %s" (pr-str (ex-message e)) (ex-message new-e))nil))))@@ -70,9 +70,9 @@(catch SQLException e(throw (ex-info (or (ex-message e) "Error executing action.")(merge (or (some-> (parse-sql-error driver database action e)- ;; the columns in error message should match with columns- ;; in the parameter. It's usually got from calling- ;; GET /api/action/:id/execute, and in there all column names are slugified+ ;; the columns in error message should match with columns+ ;; in the parameter. It's usually got from calling+ ;; GET /api/action/:id/execute, and in there all column names are slugified(m/update-existing :errors perf/update-keys u/slugify))(assoc (ex-data e) :message (ex-message e))){:status-code 400}))))))@@ -603,14 +603,14 @@:row row})))(into [:and] (for [[field-name value] row:let [field-id (get field-name->id field-name)- ;; if the field isn't in `field-name->id` then it's an error in our code. Not- ;; i18n'ed because this is not something that should be User facing unless our- ;; backend code is broken.- ;;- ;; Unknown column names in user input WILL NOT trigger this error.- ;; [[row->mbql-filter-clause]] is only used for *known* PK columns that are- ;; used for the MBQL `:filter` clause. Unknown columns will trigger an error in- ;; the DW but not here.+ ;; if the field isn't in `field-name->id` then it's an error in our code. Not+ ;; i18n'ed because this is not something that should be User facing unless our+ ;; backend code is broken.+ ;;+ ;; Unknown column names in user input WILL NOT trigger this error.+ ;; [[row->mbql-filter-clause]] is only used for *known* PK columns that are+ ;; used for the MBQL `:filter` clause. Unknown columns will trigger an error in+ ;; the DW but not here._ (assert field-id(format "Field %s is not present in field-name->id map"(pr-str field-name)))]]diff --git a/src/metabase/driver/sql_jdbc/execute.clj b/src/metabase/driver/sql_jdbc/execute.cljindex 1234d5d1d21..62a1f73d257 100644--- a/src/metabase/driver/sql_jdbc/execute.clj+++ b/src/metabase/driver/sql_jdbc/execute.clj@@ -834,14 +834,14 @@(let [rsmeta (.getMetaData rs)results-metadata {:cols (column-metadata driver rsmeta)}](try (respond results-metadata (reducible-rows driver rs rsmeta (driver-api/canceled-chan)))- ;; Following cancels the statement on the dbms side.- ;; It avoids blocking `.close` call, in case we reduced the results subset eg. by means of- ;; [[metabase.query-processor.middleware.limit/limit-xform]] middleware, while statement is still- ;; in progress. This problem was encountered on Redshift. For details see the issue #39018.- ;; It also handles situation where query is canceled through [[driver-api/canceled-chan]] (#41448).+ ;; Following cancels the statement on the dbms side.+ ;; It avoids blocking `.close` call, in case we reduced the results subset eg. by means of+ ;; [[metabase.query-processor.middleware.limit/limit-xform]] middleware, while statement is still+ ;; in progress. This problem was encountered on Redshift. For details see the issue #39018.+ ;; It also handles situation where query is canceled through [[driver-api/canceled-chan]] (#41448).(finally- ;; TODO: Following `when` is in place just to find out if vertica is flaking because of cancelations.- ;; It should be removed afterwards!+ ;; TODO: Following `when` is in place just to find out if vertica is flaking because of cancelations.+ ;; It should be removed afterwards!(when-not (= :vertica driver)(try (when-not (.isClosed stmt)(.cancel stmt))diff --git a/src/metabase/driver/sql_jdbc/sync/describe_table.clj b/src/metabase/driver/sql_jdbc/sync/describe_table.cljindex 3e36fa58d2f..3ab6c3de645 100644--- a/src/metabase/driver/sql_jdbc/sync/describe_table.clj+++ b/src/metabase/driver/sql_jdbc/sync/describe_table.clj@@ -131,7 +131,7 @@(some->> table-name (driver/escape-entity-name-for-metadata driver))nil)(fn [^ResultSet rs]- ;; https://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)+ ;; https://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)#(let [default (.getString rs "COLUMN_DEF")no-default? (contains? #{nil "NULL" "null"} default);; leave room for "", or other strings to be nil (unknown)@@ -528,10 +528,10 @@(nil? token)(persistent! res)- ;; we could be more precise here and issue warning about nested fields (the one in `describe-json-fields`),- ;; but this limit could be hit by multiple json fields (fetched in `describe-json-fields`) rather than only- ;; by this one. So for the sake of issuing only a single warning in logs we'll spill over limit by a single- ;; entry (instead of doing `<=`).+ ;; we could be more precise here and issue warning about nested fields (the one in `describe-json-fields`),+ ;; but this limit could be hit by multiple json fields (fetched in `describe-json-fields`) rather than only+ ;; by this one. So for the sake of issuing only a single warning in logs we'll spill over limit by a single+ ;; entry (instead of doing `<=`).(< max-nested-field-columns (count res))(persistent! res)@@ -547,7 +547,7 @@JsonToken/FIELD_NAME (recur path (.getText p) res)JsonToken/START_OBJECT (recur (cond-> path field (conj field)) field res)JsonToken/END_OBJECT (recur (cond-> path (seq path) pop) field res)- ;; We put top-level array row type semantics on JSON roadmap but skip for now+ ;; We put top-level array row type semantics on JSON roadmap but skip for nowJsonToken/START_ARRAY (do (.skipChildren p)(if field(recur path field (assoc! res (conj path field) clojure.lang.PersistentVector))@@ -761,10 +761,10 @@nil(fn [^Connection conn](let [unfold-json-fields (table->unfold-json-fields driver conn table)- ;; Just pass in `nil` here, that's what we do in the normal sync process and it seems to work correctly.- ;; We don't currently have a driver-agnostic way to get the physical database name. `(:name database)` is- ;; wrong, because it's a human-friendly name rather than a physical name. `(get-in- ;; database [:details :db])` works for most drivers but not H2.+ ;; Just pass in `nil` here, that's what we do in the normal sync process and it seems to work correctly.+ ;; We don't currently have a driver-agnostic way to get the physical database name. `(:name database)` is+ ;; wrong, because it's a human-friendly name rather than a physical name. `(get-in+ ;; database [:details :db])` works for most drivers but not H2.pks (get-table-pks driver conn nil table)][unfold-json-fields pks])))](if (empty? unfold-json-fields)diff --git a/src/metabase/events/schema.clj b/src/metabase/events/schema.cljindex 43782ac09c9..f23ef37c40b 100644--- a/src/metabase/events/schema.clj+++ b/src/metabase/events/schema.clj@@ -44,7 +44,7 @@[:user-id pos-int?][:object [:fn #(t2/instance-of? :model/Collection %)]]])- ;; collection write events+;; collection write events(mr/def ::collection[:map {:closed true}diff --git a/src/metabase/internal_stats/questions.clj b/src/metabase/internal_stats/questions.cljindex 983ceff675e..455f1d6d671 100644--- a/src/metabase/internal_stats/questions.clj+++ b/src/metabase/internal_stats/questions.clj@@ -53,9 +53,9 @@:total_embedded][(u/count-case (and-not-nil :public_uuid)):total_public]]- ;; json_exists/contains which we use to query json encoded data stored in text- ;; columns is not supported on h2 databases, so we exclude these stats when- ;; the app db is h2.+ ;; json_exists/contains which we use to query json encoded data stored in text+ ;; columns is not supported on h2 databases, so we exclude these stats when+ ;; the app db is h2.json-supported? (conj[(u/count-case (card-has-params)):with_params]diff --git a/src/metabase/legacy_mbql/schema.cljc b/src/metabase/legacy_mbql/schema.cljcindex 41726e0415f..50a95951d0c 100644--- a/src/metabase/legacy_mbql/schema.cljc+++ b/src/metabase/legacy_mbql/schema.cljc@@ -1160,7 +1160,7 @@(one-of;; filters drivers must implementand or not = != < > <= >= between starts-with ends-with contains- ;; SUGAR filters drivers do not need to implement+ ;; SUGAR filters drivers do not need to implementin not-in does-not-contain inside is-empty not-empty is-null not-null relative-time-interval time-interval during))(mr/def ::Filterdiff --git a/src/metabase/lib/display_name.cljc b/src/metabase/lib/display_name.cljcindex aacc972a6fa..eeedc2b0dc2 100644--- a/src/metabase/lib/display_name.cljc+++ b/src/metabase/lib/display_name.cljc@@ -174,7 +174,7 @@(parse-column-display-name-parts display-name aggregation-patterns filter-patterns nil))([display-name aggregation-patterns filter-patterns conjunctions](letfn [(parse-inner [string]- ;; Recursively parse the inner part which may have more patterns+ ;; Recursively parse the inner part which may have more patterns(parse-column-display-name-parts string aggregation-patterns filter-patterns conjunctions))(parse-join-alias [join-alias]diff --git a/src/metabase/lib/equality.cljc b/src/metabase/lib/equality.cljcindex 67c66999bd7..d88dc9b17e3 100644--- a/src/metabase/lib/equality.cljc+++ b/src/metabase/lib/equality.cljc@@ -137,37 +137,37 @@ are known to be the same.""Returns a keyword representing the reason why two columns fail an [[=]] check (for debugging purposes)."[col-1 col-2](or- ;; two column metadatas with different IDs are NEVER equal.+ ;; two column metadatas with different IDs are NEVER equal.(columns-not-equal-by-fn-when-non-nil-in-both :id col-1 col-2)- ;; from the same source.+ ;; from the same source.(columns-not-equal-by-fn-when-non-nil-in-both :lib/source col-1 col-2)- ;; same join alias+ ;; same join alias(columns-not-equal-by-fn :lib/join-alias col-1 col-2)- ;; same FK Field (for implicitly joined columns)+ ;; same FK Field (for implicitly joined columns)(columns-not-equal-by-fn-when-non-nil-in-both :fk-field-id col-1 col-2)(columns-not-equal-by-fn :fk-join-alias col-1 col-2)- ;; TODO (Cam 9/4/25) -- not super clear that this ought to be a reason for columns to be considered different since- ;; `:fk-field-name` doesn't really seem to be super important... but this check seems to be needed, otherwise when- ;; a there are multiple remappings from Col A => Col B (e.g. in a self-join) we'll potentially accidentally match- ;; the wrong one. Maybe we can figure out a better way to make sure that doesn't happen.+ ;; TODO (Cam 9/4/25) -- not super clear that this ought to be a reason for columns to be considered different since+ ;; `:fk-field-name` doesn't really seem to be super important... but this check seems to be needed, otherwise when+ ;; a there are multiple remappings from Col A => Col B (e.g. in a self-join) we'll potentially accidentally match+ ;; the wrong one. Maybe we can figure out a better way to make sure that doesn't happen.(columns-not-equal-by-fn-when-non-nil-in-both :fk-field-name col-1 col-2)- ;;- ;; columns that don't have the same binning or temporal bucketing are never the same.- ;;- ;; same binning+ ;;+ ;; columns that don't have the same binning or temporal bucketing are never the same.+ ;;+ ;; same binning(columns-not-equal-by-fn :lib/binning col-1 col-2)- ;; same bucketing+ ;; same bucketing(when (columns-not-equal-by-fn (comp ignore-default-temporal-bucket lib.temporal-bucket/raw-temporal-bucket) col-1 col-2)'temporal-bucket)- ;; check `:inherited-temporal-unit` as well if both columns have it, but only when neither column has an explicit- ;; temporal bucket. When both columns have the same explicit bucket (checked above), the inherited temporal unit is- ;; just historical metadata and shouldn't affect identity. See #70231.+ ;; check `:inherited-temporal-unit` as well if both columns have it, but only when neither column has an explicit+ ;; temporal bucket. When both columns have the same explicit bucket (checked above), the inherited temporal unit is+ ;; just historical metadata and shouldn't affect identity. See #70231.(when (and (nil? (ignore-default-temporal-bucket (lib.temporal-bucket/raw-temporal-bucket col-1)))(nil? (ignore-default-temporal-bucket (lib.temporal-bucket/raw-temporal-bucket col-2)))(columns-not-equal-by-fn-when-non-nil-in-both (comp ignore-default-temporal-bucket :inherited-temporal-unit) col-1 col-2)):inherited-temporal-unit)- ;; finally make sure they have the same `:lib/source-column-alias` (if both columns have it) or `:name` (if for- ;; some reason they do not)+ ;; finally make sure they have the same `:lib/source-column-alias` (if both columns have it) or `:name` (if for+ ;; some reason they do not)(let [k (m/find-first (fn [k](and (k col-1)(k col-2)))diff --git a/src/metabase/lib/field/resolution.cljc b/src/metabase/lib/field/resolution.cljcindex bf5f33b6833..9d13b0e38f5 100644--- a/src/metabase/lib/field/resolution.cljc+++ b/src/metabase/lib/field/resolution.cljc@@ -663,23 +663,23 @@id-or-name :- ::id-or-name](log/debugf "Resolving %s from previous stage, source table, or source card" (pr-str id-or-name))(let [col (or ;; Allow nested dedup resolution for other columns encountered through card resolution,- ;; join resolution, etc. Only the direct dedup call below should be blocked by the guard.+ ;; join resolution, etc. Only the direct dedup call below should be blocked by the guard.(binding [*in-deduplicated-column-resolution?* false](or (resolve-from-previous-stage-or-source* query stage-number id-or-name)(do(log/debugf "Failed to resolve Field %s in stage %s. Trying other methods..." (pr-str id-or-name) (pr-str stage-number))(resolve-ref-missing-join-alias query stage-number id-or-name))- ;; if we haven't found a match yet try getting metadata from the metadata provider if this is a- ;; Field ID ref. It's likely a ref that makes little or no sense (e.g. wrong table) but we can- ;; let QP code worry about that.+ ;; if we haven't found a match yet try getting metadata from the metadata provider if this is a+ ;; Field ID ref. It's likely a ref that makes little or no sense (e.g. wrong table) but we can+ ;; let QP code worry about that.(fallback-metadata-for-field query stage-number id-or-name)- ;; try looking in the expressions in this stage to see if someone incorrectly used a field ref for an- ;; expression.+ ;; try looking in the expressions in this stage to see if someone incorrectly used a field ref for an+ ;; expression.(maybe-resolve-expression-in-current-stage query stage-number id-or-name)))- ;; if that fails and this is a deduplicated name like `CATEGORY_2` then try looking for `CATEGORY` and- ;; so forth. The *in-deduplicated-column-resolution?* guard prevents re-entry here.+ ;; if that fails and this is a deduplicated name like `CATEGORY_2` then try looking for `CATEGORY` and+ ;; so forth. The *in-deduplicated-column-resolution?* guard prevents re-entry here.(resolve-nonexistent-deduplicated-column-name query stage-number id-or-name)- ;; if we STILL can't find a match, return made-up fallback metadata.+ ;; if we STILL can't find a match, return made-up fallback metadata.(fallback-metadata id-or-name))](when col(merge-metadata [col (additional-metadata-from-source-card query stage-number col)]))))diff --git a/src/metabase/lib/join.cljc b/src/metabase/lib/join.cljcindex ff6bbebd622..45489c9d61c 100644--- a/src/metabase/lib/join.cljc+++ b/src/metabase/lib/join.cljc@@ -519,7 +519,7 @@[home-cols cond-fields](when (seq cond-fields)(let [cond-home-cols (keep #(lib.equality/find-matching-column % home-cols) cond-fields)]- ;; first choice: the leftmost FK or PK in the condition referring to a home column+ ;; first choice: the leftmost FK or PK in the condition referring to a home column(or (m/find-first (some-fn lib.types.isa/foreign-key? lib.types.isa/primary-key?) cond-home-cols);; otherwise the leftmost home column in the condition(first cond-home-cols)@@ -1113,8 +1113,8 @@(when-let [table (and (zero? (lib.util/canonical-stage-index query stage-number)) ; first stage?(first-join? query stage-number join-or-joinable) ; first join?(lib.metadata.calculation/primary-source-table query))] ; query ultimately uses source Table?- ;; I think `:default` display name style is okay here, there shouldn't be a difference between `:default` and- ;; `:long` for a Table anyway+ ;; I think `:default` display name style is okay here, there shouldn't be a difference between `:default` and+ ;; `:long` for a Table anyway(lib.metadata.calculation/display-name query stage-number table)))(mu/defn join-lhs-display-name :- ::lib.schema.common/non-blank-stringdiff --git a/src/metabase/lib/js.cljs b/src/metabase/lib/js.cljsindex 686acf9c1c7..504e654001e 100644--- a/src/metabase/lib/js.cljs+++ b/src/metabase/lib/js.cljs@@ -240,16 +240,16 @@(if (and(empty? (lib.core/aggregations a-query stage-number))(empty? (lib.core/breakouts a-query stage-number)))- ;; No extra stage needed with no aggregations.+ ;; No extra stage needed with no aggregations.#js {:query a-query:stageIndex stage-number}- ;; An extra stage is needed, so see if one already exists.+ ;; An extra stage is needed, so see if one already exists.(if-let [next-stage (->> (lib.util/canonical-stage-index a-query stage-number)(lib.util/next-stage-number a-query))]- ;; Already an extra stage, so use it.+ ;; Already an extra stage, so use it.#js {:query a-query:stageIndex next-stage}- ;; No new stage, so append one.+ ;; No new stage, so append one.#js {:query (lib.core/append-stage a-query):stageIndex -1}))))@@ -1789,10 +1789,10 @@> **Code health:** Healthy"[a-query stage-number expression-position](lib.cache/side-channel-cache- ;; Caching is based on both the stage and expression position, since they can return different sets.- ;; TODO: Since these caches are mainly here to avoid expensively recomputing things in rapid succession, it would- ;; probably suffice to cache only the last position, and evict if it's different. But the lib.cache system doesn't- ;; support that currently.+ ;; Caching is based on both the stage and expression position, since they can return different sets.+ ;; TODO: Since these caches are mainly here to avoid expensively recomputing things in rapid succession, it would+ ;; probably suffice to cache only the last position, and evict if it's different. But the lib.cache system doesn't+ ;; support that currently.(keyword "expressionable-columns" (str "stage-" stage-number "-" expression-position)) a-query(fn [_](to-array (lib.core/expressionable-columns a-query stage-number expression-position)))))@@ -1810,10 +1810,10 @@> **Code health:** Healthy"[a-query stage-number expression-position](lib.cache/side-channel-cache- ;; Caching is based on both the stage and expression position, since they can return different sets.- ;; TODO: Since these caches are mainly here to avoid expensively recomputing things in rapid succession, it would- ;; probably suffice to cache only the last position, and evict if it's different. But the lib.cache system doesn't- ;; support that currently.+ ;; Caching is based on both the stage and expression position, since they can return different sets.+ ;; TODO: Since these caches are mainly here to avoid expensively recomputing things in rapid succession, it would+ ;; probably suffice to cache only the last position, and evict if it's different. But the lib.cache system doesn't+ ;; support that currently.(keyword "aggregable-columns" (str "stage-" stage-number "-" expression-position)) a-query(fn [_](to-array (lib.core/aggregable-columns a-query stage-number expression-position)))))diff --git a/src/metabase/lib/js/metadata.cljc b/src/metabase/lib/js/metadata.cljcindex d8de1f3f1d9..84aac114e1c 100644--- a/src/metabase/lib/js/metadata.cljc+++ b/src/metabase/lib/js/metadata.cljc@@ -58,7 +58,7 @@(remove (set skip-keys))(map (fn [k][k (object-get obj k)]))- ;; ignore values that are functions+ ;; ignore values that are functions(remove (fn [[_k v]](js-fn? v)))xform)@@ -617,8 +617,8 @@setting-key(setting unparsed-metadata setting-key)))- ;; for debugging: call [[clojure.datafy/datafy]] on one of these to parse all of our metadata and see the whole- ;; thing at once.+ ;; for debugging: call [[clojure.datafy/datafy]] on one of these to parse all of our metadata and see the whole+ ;; thing at once.clojure.core.protocols/Datafiable(datafy [_this](perf/postwalkdiff --git a/src/metabase/lib/parse.cljc b/src/metabase/lib/parse.cljcindex 156bd2f5d95..682043765ef 100644--- a/src/metabase/lib/parse.cljc+++ b/src/metabase/lib/parse.cljc@@ -41,8 +41,8 @@(def ^:private param-token-patterns[["[[" :optional-begin]["]]" :optional-end]- ;; param-begin should only match the last two opening brackets in a sequence of > 2, e.g.- ;; [{$match: {{{x}}, field: 1}}] should parse to ["[$match: {" (param "x") ", field: 1}}]"]+ ;; param-begin should only match the last two opening brackets in a sequence of > 2, e.g.+ ;; [{$match: {{{x}}, field: 1}}] should parse to ["[$match: {" (param "x") ", field: 1}}]"][#"(?s)\{\{(?!\{)" :param-begin]["}}" :param-end]["'" :single-quote]])diff --git a/src/metabase/lib/query.cljc b/src/metabase/lib/query.cljcindex 9d3be56b51b..6b03090566b 100644--- a/src/metabase/lib/query.cljc+++ b/src/metabase/lib/query.cljc@@ -142,14 +142,14 @@(if (some #{:mbql/stage-metadata} &parents)&match(update &match 1 merge- ;; TODO: For brush filters, query with different base type as in metadata is sent from FE. In that- ;; case no change is performed. Find a way how to handle this properly!+ ;; TODO: For brush filters, query with different base type as in metadata is sent from FE. In that+ ;; case no change is performed. Find a way how to handle this properly!(when-not (and (some? (:base-type options))(not= (:base-type options)(:base-type (lib.metadata/field metadata-provider id))))- ;; Following key is used to track which base-types we added during `query` call. It is used in- ;; [[metabase.lib.convert/options->legacy-MBQL]] to remove those, so query after conversion- ;; as legacy -> MBQL 5 -> legacy looks closer to the original.+ ;; Following key is used to track which base-types we added during `query` call. It is used in+ ;; [[metabase.lib.convert/options->legacy-MBQL]] to remove those, so query after conversion+ ;; as legacy -> MBQL 5 -> legacy looks closer to the original.(merge (when-not (contains? options :base-type){:lib/transformation-added-base-type true})(-> (lib.metadata/field metadata-provider id)diff --git a/src/metabase/lib/schema.cljc b/src/metabase/lib/schema.cljcindex 8f987fc4ea5..a04a81b5b7d 100644--- a/src/metabase/lib/schema.cljc+++ b/src/metabase/lib/schema.cljc@@ -203,7 +203,7 @@(into #{} (map (comp :lib/expression-name second)) expressions)))pred #(bad-ref-clause? :expression expression-names %)form (-> (stage-with-joins-and-namespaced-keys-removed stage)- ;; also ignore expression refs inside `:parameters` since they still use legacy syntax these days.+ ;; also ignore expression refs inside `:parameters` since they still use legacy syntax these days.(dissoc :parameters))](when (lib.schema.util/pred-matches-form? form pred)(lib.schema.util/matching-locations form pred)))))diff --git a/src/metabase/lib/schema/test_spec.cljc b/src/metabase/lib/schema/test_spec.cljcindex f63b62fd371..33064255dc2 100644--- a/src/metabase/lib/schema/test_spec.cljc+++ b/src/metabase/lib/schema/test_spec.cljc@@ -178,7 +178,7 @@[:dimension [:ref ::test-field-filter-spec]][:snippet [:ref ::test-snippet-spec]][:card [:ref ::test-source-query-spec]]- ;; :number, :text, :date, :boolean+ ;; :number, :text, :date, :boolean[::mc/default [:ref ::test-raw-value-spec]]])(mr/def ::test-template-tags-specdiff --git a/src/metabase/lib/util/unique_name_generator.cljc b/src/metabase/lib/util/unique_name_generator.cljcindex e3c950b258f..448f8d907ae 100644--- a/src/metabase/lib/util/unique_name_generator.cljc+++ b/src/metabase/lib/util/unique_name_generator.cljc@@ -248,9 +248,9 @@to get a new, fresh unique name generator for recursive usage without 'poisoning the well'.";; unique by lower-case name, e.g. `NAME` and `name` => `NAME` and `name_2`- ;;- ;; some databases treat aliases as case-insensitive so make sure the generated aliases are unique regardless of- ;; case+ ;;+ ;; some databases treat aliases as case-insensitive so make sure the generated aliases are unique regardless of+ ;; case(unique-name-generator-factory{:truncate-fn truncate-alias:name-key-fn u/lower-case-endiff --git a/src/metabase/lib/walk.cljc b/src/metabase/lib/walk.cljcindex 0d40d9414b6..5c2b8def37f 100644--- a/src/metabase/lib/walk.cljc+++ b/src/metabase/lib/walk.cljc@@ -23,7 +23,7 @@(let [path-to-item (conj (vec path-to-items) absolute-item-number)](walk-item-fn query path-to-item f)))query- ;; With 3 items, we want (2 1 0), so (range 2 -1 -1).+ ;; With 3 items, we want (2 1 0), so (range 2 -1 -1).(range (dec (count (get-in query path-to-items []))) -1 -1)))(defn- walk-items-forward* [query path-to-items walk-item-fn f]diff --git a/src/metabase/lib_be/metadata/jvm.clj b/src/metabase/lib_be/metadata/jvm.cljindex cb908d86137..75d9595ed11 100644--- a/src/metabase/lib_be/metadata/jvm.clj+++ b/src/metabase/lib_be/metadata/jvm.clj@@ -472,7 +472,7 @@:metadata/measure :measure/table_id))(defn- card-id-key [metadata-type]- ;; types not in the case statement do not support Card ID+ ;; types not in the case statement do not support Card ID(case metadata-type:metadata/metric :source_card_id))diff --git a/src/metabase/lib_metric/filter.cljc b/src/metabase/lib_metric/filter.cljcindex 1fa9873a144..c07e097b0d9 100644--- a/src/metabase/lib_metric/filter.cljc+++ b/src/metabase/lib_metric/filter.cljc@@ -594,7 +594,7 @@(case operator(:is-null :not-null) [operator {} (dimension-ref dimension)]:between [:between {} (dimension-ref dimension) (first values) (second values)]- ;; Standard operators: >, <+ ;; Standard operators: >, <[operator {} (dimension-ref dimension) (first values)]))))(defn time-filter-partsdiff --git a/src/metabase/mcp/settings.clj b/src/metabase/mcp/settings.cljindex 9e4941b3f35..e82381687f6 100644--- a/src/metabase/mcp/settings.clj+++ b/src/metabase/mcp/settings.clj@@ -41,7 +41,7 @@{"claude" ["https://*.claudemcpcontent.com"]"chatgpt" ["https://*.web-sandbox.oaiusercontent.com"]- ;; vscode-webview:// handled by mcp-sandbox-origin? in security middleware+ ;; vscode-webview:// handled by mcp-sandbox-origin? in security middleware"cursor-vscode" []});;; ------------------------------------------------ Settings ------------------------------------------------diff --git a/src/metabase/metabot/self/claude.clj b/src/metabase/metabot/self/claude.cljindex 4137c61fa83..8ee0ca0e8c9 100644--- a/src/metabase/metabot/self/claude.clj+++ b/src/metabase/metabot/self/claude.clj@@ -214,7 +214,7 @@(let [[_:=> [_:cat params] _out] schemaparams (schema/filter-schema-by-features params)doc (if (str/starts-with? (or doc "") "Inputs: ")- ;; strip that stuff we're appending in mu/defn+ ;; strip that stuff we're appending in mu/defn(second (str/split doc #"\n\n " 2))doc)]{:name (or tool-name "unknown")diff --git a/src/metabase/metabot/task/metabot_conversation_trimmer.clj b/src/metabase/metabot/task/metabot_conversation_trimmer.cljindex f72618a77af..6199c4ce5c7 100644--- a/src/metabase/metabot/task/metabot_conversation_trimmer.clj+++ b/src/metabase/metabot/task/metabot_conversation_trimmer.clj@@ -47,6 +47,6 @@(triggers/with-identity trimmer-trigger-key)(triggers/start-now)(triggers/with-schedule- ;; daily at 23:16:37 — 2 minutes after ai-usage-trimmer+ ;; daily at 23:16:37 — 2 minutes after ai-usage-trimmer(cron/cron-schedule "37 16 23 * * ?")))](task/schedule-task! job trigger)))diff --git a/src/metabase/metabot/task/suggested_prompts_generator.clj b/src/metabase/metabot/task/suggested_prompts_generator.cljindex 9a78914d76d..db7944c0fe2 100644--- a/src/metabase/metabot/task/suggested_prompts_generator.clj+++ b/src/metabase/metabot/task/suggested_prompts_generator.clj@@ -51,6 +51,6 @@(jobs/with-identity generator-job-key))trigger (triggers/build(triggers/with-identity generator-trigger-key)- ;; Start the job a moment after startup.+ ;; Start the job a moment after startup.(triggers/start-at (Date/from (.plusSeconds (Instant/now) 10))))](task/schedule-task! job trigger)))diff --git a/src/metabase/model_persistence/task/persist_refresh.clj b/src/metabase/model_persistence/task/persist_refresh.cljindex b4dfba39197..04a193d045e 100644--- a/src/metabase/model_persistence/task/persist_refresh.clj+++ b/src/metabase/model_persistence/task/persist_refresh.clj@@ -134,7 +134,7 @@(let [db-id->db (m/index-by :id (t2/select :model/Database :id [:in (map :database_id deletables)]))unpersist-fn (fn [](reduce (fn [stats persisted-info]- ;; Since this could be long running, double check state just before deleting+ ;; Since this could be long running, double check state just before deleting(let [current-state (t2/select-one-fn :state :model/PersistedInfo :id (:id persisted-info))card-info (t2/select-one [:model/Card :archived :type :card_schema]:id (:card_id persisted-info))]@@ -384,7 +384,7 @@(u/format-color :green "Persistence already present for model %d %s"(:card_id persisted-info)(.. trigger getKey getName)))))))- ;; other errors?+;; other errors?(defn job-info-by-db-id"Fetch all database-ids that have a refresh job scheduled."diff --git a/src/metabase/models/serialization.clj b/src/metabase/models/serialization.cljindex ab2c8b82e72..334e22dbc51 100644--- a/src/metabase/models/serialization.clj+++ b/src/metabase/models/serialization.clj@@ -1776,11 +1776,11 @@(into {}(for [[k cols] mapping](let [updated-cols (cond- ;; e.g. [{:sourceId "card:..."} ...]+ ;; e.g. [{:sourceId "card:..."} ...](and (coll? cols) (map? (first cols)))(mapv #(update % :sourceId import-visualizer-source-id) cols)- ;; e.g. ["$_card:<id>_name"] for funnel dimensions+ ;; e.g. ["$_card:<id>_name"] for funnel dimensions(and (coll? cols) (string? (first cols)))(mapv import-card-dimension-ref cols)diff --git a/src/metabase/models/visualization_settings.cljc b/src/metabase/models/visualization_settings.cljcindex d60d256776b..e744c40887d 100644--- a/src/metabase/models/visualization_settings.cljc+++ b/src/metabase/models/visualization_settings.cljc@@ -512,12 +512,12 @@{:added "0.40.0"}[vs](cond-> vs- ;; column_settings at top level; ex: table card+ ;; column_settings at top level; ex: table card(:column_settings vs)(assoc ::column-settings (->> (:column_settings vs)db->norm-column-settings))- ;; click behavior key at top level; ex: non-table card+ ;; click behavior key at top level; ex: non-table card(:click_behavior vs)(assoc ::click-behavior (db->norm-click-behavior (:click_behavior vs)))diff --git a/src/metabase/notification/payload/execute.clj b/src/metabase/notification/payload/execute.cljindex 0cabff41f4b..5e05f54837f 100644--- a/src/metabase/notification/payload/execute.clj+++ b/src/metabase/notification/payload/execute.clj@@ -190,7 +190,7 @@(^:once fn* [query info](qp(qp/userland-query query info)- ;; Pass streaming rff with 2000 row threshold+ ;; Pass streaming rff with 2000 row threshold(notification.temp-storage/notification-rffcells-to-disk-threshold{:dashboard_id dashboard_id@@ -311,7 +311,7 @@(^:once fn* [query info](qp(qp/userland-query query info)- ;; Pass streaming rff with 2000 row threshold+ ;; Pass streaming rff with 2000 row threshold(notification.temp-storage/notification-rffcells-to-disk-threshold{:card-id card-id})))))diff --git a/src/metabase/notification/send.clj b/src/metabase/notification/send.cljindex 568a0bf8668..2ed684ed656 100644--- a/src/metabase/notification/send.clj+++ b/src/metabase/notification/send.clj@@ -427,7 +427,7 @@(let [{:keys [dispatch-fn]} (case (:payload_type notification):notification/system-event@simple-blocking-dispatcher- ;; notification/card, notification/dashboard+ ;; notification/card, notification/dashboard@dedup-priority-dispatcher)](dispatch-fn notification)))diff --git a/src/metabase/notification/task/send.clj b/src/metabase/notification/task/send.cljindex 9a9103847c2..1e25abf9387 100644--- a/src/metabase/notification/task/send.clj+++ b/src/metabase/notification/task/send.clj@@ -50,7 +50,7 @@(cron/schedule(cron/cron-schedule cron-schedule)(cron/in-time-zone (TimeZone/getTimeZone ^String (send-notification-timezone)))- ;; We want to fire the trigger once even if the previous triggers missed+ ;; We want to fire the trigger once even if the previous triggers missed(cron/with-misfire-handling-instruction-fire-and-proceed)));; higher than sync(triggers/with-priority 6)))@@ -64,7 +64,7 @@[{:keys [id type cron_schedule] :as notification-subscription}](let [existing-trigger (first (task/existing-triggers send-notification-job-key (send-notification-trigger-key id)))](cond- ;; delete trigger if type changes+ ;; delete trigger if type changes(and(not= type :notification-subscription/cron)existing-trigger)@@ -72,11 +72,11 @@(log/infof "Deleting trigger for subscription %d because of type changes" id)(task/delete-trigger! (-> existing-trigger :key triggers/key)))- ;; do nothing if type is not cron+ ;; do nothing if type is not cron(not= type :notification-subscription/cron)nil- ;; create new if there is no existing trigger+ ;; create new if there is no existing trigger(not existing-trigger)(do(log/infof "Creating new trigger for subscription %d with schedule %s" id cron_schedule)diff --git a/src/metabase/oauth_server/store.clj b/src/metabase/oauth_server/store.cljindex 3dbbaa3c34c..7c87b1e23be 100644--- a/src/metabase/oauth_server/store.clj+++ b/src/metabase/oauth_server/store.clj@@ -115,8 +115,8 @@config (-> client-config(assoc :client-id client-id)(cond->- ;; The library pre-hashes the registration-access-token before calling- ;; register-client; map it to the DB column name.+ ;; The library pre-hashes the registration-access-token before calling+ ;; register-client; map it to the DB column name.(:registration-access-token client-config)(-> (assoc :registration-access-token-hash (:registration-access-token client-config))(dissoc :registration-access-token))diff --git a/src/metabase/parameters/chain_filter.clj b/src/metabase/parameters/chain_filter.cljindex d453e9dbb9c..d887b4d9646 100644--- a/src/metabase/parameters/chain_filter.clj+++ b/src/metabase/parameters/chain_filter.clj@@ -407,7 +407,7 @@;; if original-field-id is specified, we'll include this in the results. For Field->Field remapping.[:map {:closed true}[:original-field-id {:optional true} [:maybe ::lib.schema.id/field]]- ;; return at most the lesser of `limit` (if specified) and `max-results`.+ ;; return at most the lesser of `limit` (if specified) and `max-results`.[:limit {:optional true} [:maybe ms/PositiveInt]]])(def ^:private max-results 1000)@@ -658,9 +658,9 @@(some? remapping-field)(unremapped-chain-filter remapping-field constraints (assoc options :original-field-id field-id))- ;; This is for fields that have human-readable values defined (e.g. you've went in and specified that enum- ;; value `1` should be displayed as `BIRD_TYPE_TOUCAN`). `v->human-readable` is a map of actual values in the- ;; database (e.g. `1`) to the human-readable version (`BIRD_TYPE_TOUCAN`).+ ;; This is for fields that have human-readable values defined (e.g. you've went in and specified that enum+ ;; value `1` should be displayed as `BIRD_TYPE_TOUCAN`). `v->human-readable` is a map of actual values in the+ ;; database (e.g. `1`) to the human-readable version (`BIRD_TYPE_TOUCAN`).(some? v->human-readable)(-> (unremapped-chain-filter field-id constraints options)(update :values add-human-readable-values v->human-readable))@@ -670,8 +670,8 @@(check-field-value-query-permissions field-id constraints options)(cached-field-values field-id constraints options))- ;; This is Field->Field remapping e.g. `venue.category_id `-> `category.name `;- ;; search by `category.name` but return tuples of `[venue.category_id category.name]`.+ ;; This is Field->Field remapping e.g. `venue.category_id `-> `category.name `;+ ;; search by `category.name` but return tuples of `[venue.category_id category.name]`.(some? @remapping)(let [{the-remapped-field-id :id, :keys [mapping-type]} @remapping](if-let [pk-field-id (when (and (= mapping-type :fk->pk->name)diff --git a/src/metabase/permissions/user.clj b/src/metabase/permissions/user.cljindex 0a5ca6ac1fc..6f399248c86 100644--- a/src/metabase/permissions/user.clj+++ b/src/metabase/permissions/user.clj@@ -22,23 +22,23 @@(let [s(set (when-let [user-id (u/the-id user-or-id)](concat- ;; Current User always gets readwrite perms for their Personal Collection and for its descendants! (1 DB- ;; Call)+ ;; Current User always gets readwrite perms for their Personal Collection and for its descendants! (1 DB+ ;; Call)(map permissions.path/collection-readwrite-path((requiring-resolve 'metabase.collections.models.collection/user->personal-collection-and-descendant-ids)user-or-id))- ;; Current User always gets readwrite perms for their Tenant Collection and for its descendants! (3 DB Calls)+ ;; Current User always gets readwrite perms for their Tenant Collection and for its descendants! (3 DB Calls)(map permissions.path/collection-readwrite-path(user->tenant-collection-and-descendant-ids user-or-id))- ;; Current User always gets read perms for Transforms if they are an analyst (1 DB Call)+ ;; Current User always gets read perms for Transforms if they are an analyst (1 DB Call)(when (or (data-perms/is-data-analyst? user-id) (data-perms/is-superuser? user-id))(concat ["/collection/namespace/transforms/root/"](map permissions.path/collection-readwrite-path ((requiring-resolve 'metabase.collections.models.collection/collections-in-namespace):transforms))))- ;; include the other Perms entries for any Group this User is in (1 DB Call)+ ;; include the other Perms entries for any Group this User is in (1 DB Call)(map :object (app-db/query {:select [:p.object]:from [[:permissions_group_membership :pgm]]:join [[:permissions_group :pg] [:= :pgm.group_id :pg.id]diff --git a/src/metabase/pivot/core.cljc b/src/metabase/pivot/core.cljcindex d80a3827a8f..a928ab36428 100644--- a/src/metabase/pivot/core.cljc+++ b/src/metabase/pivot/core.cljc@@ -616,7 +616,7 @@path-with-value (if (or isValueColumn isGrandTotal) nil (conj path rawValue))item-index (count @result)_ (vswap! result conj! nil) ;; Placeholder for parent item to be filled in- ;; once children are processed.+ ;; once children are processed.result-value (process-tree children (inc depth) current-offset path-with-value)item (->ResultItem (:value node) rawValue (:clicked node) isCollapsed(:hasSubtotal node) isGrandTotal isSubtotal isValueColumndiff --git a/src/metabase/premium_features/core.clj b/src/metabase/premium_features/core.cljindex d35fb150419..ac7658be8fe 100644--- a/src/metabase/premium_features/core.clj+++ b/src/metabase/premium_features/core.clj@@ -18,7 +18,7 @@defenterprise-schema][metabase.premium-features.token-check- ;; TODO: move airgap code to a dedicated namespace?+ ;; TODO: move airgap code to a dedicated namespace?assert-valid-airgap-user-count!assert-airgap-allows-user-creation!assert-has-featurediff --git a/src/metabase/product_feedback/task/creator_sentiment_emails.clj b/src/metabase/product_feedback/task/creator_sentiment_emails.cljindex 71f58443a76..afce3373e41 100644--- a/src/metabase/product_feedback/task/creator_sentiment_emails.clj+++ b/src/metabase/product_feedback/task/creator_sentiment_emails.clj@@ -116,6 +116,6 @@(triggers/with-identity (triggers/key creator-sentiment-emails-trigger-key))(triggers/start-now)(triggers/with-schedule- ;; Fire at 2am every saturday+ ;; Fire at 2am every saturday(cron/cron-schedule "0 0 2 ? * 7")))](task/schedule-task! job trigger)))diff --git a/src/metabase/product_feedback/task/follow_up_emails.clj b/src/metabase/product_feedback/task/follow_up_emails.cljindex 01d73d9d768..63266ffda4c 100644--- a/src/metabase/product_feedback/task/follow_up_emails.clj+++ b/src/metabase/product_feedback/task/follow_up_emails.clj@@ -60,6 +60,6 @@(triggers/with-identity (triggers/key follow-up-emails-trigger-key))(triggers/start-now)(triggers/with-schedule- ;; run once a day+ ;; run once a day(cron/cron-schedule "0 0 12 * * ? *")))](task/schedule-task! job trigger)))diff --git a/src/metabase/pulse/task/send_pulses.clj b/src/metabase/pulse/task/send_pulses.cljindex 0f236d6411c..9b963926f52 100644--- a/src/metabase/pulse/task/send_pulses.clj+++ b/src/metabase/pulse/task/send_pulses.clj@@ -235,17 +235,17 @@(some? remove-pc-ids) (set/difference (set remove-pc-ids)))(set add-pc-ids))](cond- ;; no op when new-pc-ids doesn't change+ ;; no op when new-pc-ids doesn't change(= new-pc-ids existing-pc-ids) nil- ;; delete if no new pc-ids and there is an existing trigger+ ;; delete if no new pc-ids and there is an existing trigger(and (empty? new-pc-ids)(some? existing-pc-ids))(do(log/infof "Deleting trigger %s for pulse %d" trigger-key pulse-id)(task/delete-trigger! trigger-key))- ;; delete then create if pc ids changes+ ;; delete then create if pc ids changes(and (seq new-pc-ids)(not= new-pc-ids existing-pc-ids))(dodiff --git a/src/metabase/queries/core.clj b/src/metabase/queries/core.cljindex 32d16d71f90..5b2a6d480e7 100644--- a/src/metabase/queries/core.clj+++ b/src/metabase/queries/core.clj@@ -33,7 +33,7 @@sole-dashboard-idstarting-card-schema-versionupdate-card!- ;; TODO -- not convinced whether this belongs here or in `permissions`+ ;; TODO -- not convinced whether this belongs here or in `permissions`with-can-run-adhoc-query][metabase.queries.models.card.metadatainfer-metadatadiff --git a/src/metabase/queries/models/card.clj b/src/metabase/queries/models/card.cljindex 1d11ca46b38..5e04e293b98 100644--- a/src/metabase/queries/models/card.clj+++ b/src/metabase/queries/models/card.clj@@ -135,10 +135,10 @@;; Cards in audit collection should not be writable.(and(not (and- ;; We want to make sure there's an existing audit collection before doing the equality check below.- ;; If there is no audit collection, this will be nil:+ ;; We want to make sure there's an existing audit collection before doing the equality check below.+ ;; If there is no audit collection, this will be nil:(some? (:id (audit/default-audit-collection)))- ;; Is a direct descendant of audit collection+ ;; Is a direct descendant of audit collection(= (:collection_id instance) (:id (audit/default-audit-collection)))))(mi/current-user-has-full-permissions? (mi/perms-objects-set instance :write))))([_ pk]@@ -390,8 +390,8 @@:text :string/=:number :number/=:boolean :boolean/=- ;; fallback; should be unreachable since :when filters- ;; to raw-value-template-tag-types+ ;; fallback; should be unreachable since :when filters+ ;; to raw-value-template-tag-types:string/=)):target (if (= tag-type :dimension)[:dimension [:template-tag (:name tag)]]@@ -789,8 +789,8 @@(assoc :metabase_version config/mb-version-string:card_schema current-schema-version)queries.schema/normalize-card- ;; Must have an entity_id before populating the metadata. TODO (Cam 7/11/25) -- actually, this is no longer true,- ;; since we're removing `:ident`s; we can probably remove this now.+ ;; Must have an entity_id before populating the metadata. TODO (Cam 7/11/25) -- actually, this is no longer true,+ ;; since we're removing `:ident`s; we can probably remove this now.(u/assoc-default :entity_id (u/generate-nano-id))card.metadata/populate-result-metadatapre-insertdiff --git a/src/metabase/queries_rest/api/card.clj b/src/metabase/queries_rest/api/card.cljindex a245cf7cb90..f4e06301ae5 100644--- a/src/metabase/queries_rest/api/card.clj+++ b/src/metabase/queries_rest/api/card.clj@@ -229,7 +229,7 @@(update :dashboard #(some-> % (select-keys [:name :id :moderation_status])))(cond->(queries/model? card) (t2/hydrate :persisted- ;; can_manage_db determines whether we should enable model persistence settings+ ;; can_manage_db determines whether we should enable model persistence settings:can_manage_db)))))(defn- get-card@@ -408,9 +408,9 @@compatible-cards (->> matching-cards(filter mi/can-read?)(filter #(or- ;; columns name on native query are not match with the column name in viz-settings. why??- ;; so we can't use series-are-compatible? to filter out incompatible native cards.- ;; => we assume all native queries are compatible and FE will figure it out later+ ;; columns name on native query are not match with the column name in viz-settings. why??+ ;; so we can't use series-are-compatible? to filter out incompatible native cards.+ ;; => we assume all native queries are compatible and FE will figure it out later(= (:query_type %) :native)(series-are-compatible? card %))))](if page-size@@ -530,7 +530,7 @@[:name ms/NonBlankString][:type {:optional true} [:maybe ::queries.schema/card-type]][:dataset_query ms/Map]- ;; TODO: Make entity_id a NanoID regex schema?+ ;; TODO: Make entity_id a NanoID regex schema?[:entity_id {:optional true} [:maybe ms/NonBlankString]][:parameters {:optional true} [:maybe ::parameters.schema/parameters]][:parameter_mappings {:optional true} [:maybe ::parameters.schema/parameter-mappings]]diff --git a/src/metabase/query_processor/middleware/add_implicit_joins.clj b/src/metabase/query_processor/middleware/add_implicit_joins.cljindex 682410c5229..2af0f495f6c 100644--- a/src/metabase/query_processor/middleware/add_implicit_joins.clj+++ b/src/metabase/query_processor/middleware/add_implicit_joins.clj@@ -401,7 +401,7 @@[query :- ::lib.schema/query](-> query(lib.walk/walk-stages first-pass)- ;; The second pass must go backwards, pushing implicitly joined fields downward until they are resolved.- ;; See #63245 and- ;; [[metabase.query-processor.middleware.add-implicit-joins-test/implicit-join-from-much-earlier-stage-test]].+ ;; The second pass must go backwards, pushing implicitly joined fields downward until they are resolved.+ ;; See #63245 and+ ;; [[metabase.query-processor.middleware.add-implicit-joins-test/implicit-join-from-much-earlier-stage-test]].(lib.walk/walk-stages second-pass {:reversed? true})))diff --git a/src/metabase/query_processor/middleware/metrics.clj b/src/metabase/query_processor/middleware/metrics.cljindex 79221db6fad..6b69a6ccfa6 100644--- a/src/metabase/query_processor/middleware/metrics.clj+++ b/src/metabase/query_processor/middleware/metrics.clj@@ -183,8 +183,8 @@(if-let [aggregation (first (lib/aggregations metric-query))][(:id card-metadata){:query metric-query- ;; Aggregation inherits `:name` of original aggregation used in a metric query. The original- ;; name is added in `preprocess` above if metric is defined using unnamed aggregation.+ ;; Aggregation inherits `:name` of original aggregation used in a metric query. The original+ ;; name is added in `preprocess` above if metric is defined using unnamed aggregation.:aggregation aggregation:name metric-name}](throw (ex-info "Source metric missing aggregation" {:source metric-query})))))))@@ -291,9 +291,9 @@stage-a-source(not= stage-a-source (:qp/stage-is-from-source-card stage-b))(= (:type metric-metadata) :metric)- ;; This indicates this stage has not been processed- ;; because metrics must have aggregations- ;; if it is missing, then it has been removed in this process+ ;; This indicates this stage has not been processed+ ;; because metrics must have aggregations+ ;; if it is missing, then it has been removed in this process(:aggregation stage-a))[idx-a metric-metadata])))(partition-all 2 1 (m/indexed expanded-stages))))diff --git a/src/metabase/query_processor/schema.clj b/src/metabase/query_processor/schema.cljindex de6440454dd..fd4aac38a84 100644--- a/src/metabase/query_processor/schema.clj+++ b/src/metabase/query_processor/schema.clj@@ -69,7 +69,7 @@(mr/def ::export-format"Schema for valid export formats for downloading query results."(into [:enum {:decode/json keyword- ;; :api/regex export-formats-regex+ ;; :api/regex export-formats-regex}]export-formats))diff --git a/src/metabase/query_processor/streaming/xlsx.clj b/src/metabase/query_processor/streaming/xlsx.cljindex 1178ece4b4c..17c62411183 100644--- a/src/metabase/query_processor/streaming/xlsx.clj+++ b/src/metabase/query_processor/streaming/xlsx.clj@@ -168,8 +168,8 @@"milliseconds""h:mm:ss.000"- ;; {::mb.viz/time-enabled nil} indicates that time is explicitly disabled, rather than- ;; defaulting to "minutes"+ ;; {::mb.viz/time-enabled nil} indicates that time is explicitly disabled, rather than+ ;; defaulting to "minutes"nilnil)](when base-time-formatdiff --git a/src/metabase/search/appdb/index.clj b/src/metabase/search/appdb/index.cljindex 6bf7e40cdec..399c8951cce 100644--- a/src/metabase/search/appdb/index.clj+++ b/src/metabase/search/appdb/index.clj@@ -211,7 +211,7 @@(or pending(let [table-name (gen-table-name)](log/infof "Creating pending index %s for lang %s" table-name (i18n/site-locale-string))- ;; We may fail to insert a new metadata row if we lose a race with another instance.+ ;; We may fail to insert a new metadata row if we lose a race with another instance.(when (search-index-metadata/create-pending! :appdb (search.spec/index-version-hash) table-name)(try(create-table! table-name)@@ -429,7 +429,7 @@(log/infof "Resetting appdb index for version %s, active table: %s" (search.spec/index-version-hash)(pr-str (active-table)))(letfn [(reset-logic []- ;; stop tracking any pending table+ ;; stop tracking any pending table(when-let [table-name (pending-table)](when-not *mocking-tables*(let [deleted (search-index-metadata/delete-index! :appdb (search.spec/index-version-hash) table-name)]diff --git a/src/metabase/search/impl.clj b/src/metabase/search/impl.cljindex b2da6d81d79..6c1c523ad43 100644--- a/src/metabase/search/impl.clj+++ b/src/metabase/search/impl.clj@@ -129,9 +129,9 @@{:location (:collection_location result)}):effective_ancestors):effective_ancestors- ;; two pieces for backwards compatibility:- ;; - remove the root collection- ;; - remove the `personal_owner_id`+ ;; two pieces for backwards compatibility:+ ;; - remove the root collection+ ;; - remove the `personal_owner_id`(remove collection.root/is-root-collection?)(map #(dissoc % :personal_owner_id))))))](map annotate search-results)))diff --git a/src/metabase/search/in_place/filter.clj b/src/metabase/search/in_place/filter.cljindex 037ecdc678b..7127c43fb60 100644--- a/src/metabase/search/in_place/filter.clj+++ b/src/metabase/search/in_place/filter.clj@@ -314,8 +314,8 @@This is function instead of a def so that optional-filter-clause can be defined anywhere in the codebase."[](-> (merge- ;; models support search-native-query if there are additional columns to search when the `search-native-query`- ;; argument is true+ ;; models support search-native-query if there are additional columns to search when the `search-native-query`+ ;; argument is true{:search-native-query (->> (dissoc (methods @(requiring-resolve 'metabase.search.in-place.legacy/searchable-columns)) :default)(filter (fn [[model f]](seq (set/difference (set (f model true)) (set (f model false))))))diff --git a/src/metabase/search/in_place/legacy.clj b/src/metabase/search/in_place/legacy.cljindex 38d720a15d5..e2555b24b41 100644--- a/src/metabase/search/in_place/legacy.clj+++ b/src/metabase/search/in_place/legacy.clj@@ -198,16 +198,16 @@"search-index" :search_index.collection_id:collection_id)permitted-clause (if (= model "table")- ;; Tables have their own permission filter (add-table-where-clauses).- ;; Skip collection filtering to avoid blocking tables where the user- ;; has data permissions but no collection access.+ ;; Tables have their own permission filter (add-table-where-clauses).+ ;; Skip collection filtering to avoid blocking tables where the user+ ;; has data permissions but no collection access.[:= [:inline 1] [:inline 1]](search.permissions/permitted-collections-clause search-ctx collection-id-col))personal-clause (search.filter/personal-collections-where-clause search-ctx collection-id-col)](-> honeysql-query(sql.helpers/where permitted-clause)(cond->- ;; add a JOIN against Collection *unless* the source table is already Collection+ ;; add a JOIN against Collection *unless* the source table is already Collection(not= model "collection") (sql.helpers/left-join [:collection :collection] [:= collection-id-col :collection.id])personal-clause (sql.helpers/where personal-clause)))))diff --git a/src/metabase/server/core.clj b/src/metabase/server/core.cljindex 7020be9500c..4db8c05b66b 100644--- a/src/metabase/server/core.clj+++ b/src/metabase/server/core.clj@@ -26,7 +26,7 @@server-portstart-web-server!stop-web-server!]- ;; TODO -- I think all of this stuff probably belongs in [[metabase.request.*]]+ ;; TODO -- I think all of this stuff probably belongs in [[metabase.request.*]][metabase.server.protocolsRespond][metabase.server.routesdiff --git a/src/metabase/session/task/session_cleanup.clj b/src/metabase/session/task/session_cleanup.cljindex 4238228efe0..6e89be89fd4 100644--- a/src/metabase/session/task/session_cleanup.clj+++ b/src/metabase/session/task/session_cleanup.clj@@ -55,6 +55,6 @@(triggers/with-identity session-cleanup-trigger-key)(triggers/start-now)(triggers/with-schedule- ;; run once a day+ ;; run once a day(cron/cron-schedule "0 0 2 * * ? *")))](task/schedule-task! job trigger)))diff --git a/src/metabase/slackbot/api.clj b/src/metabase/slackbot/api.cljindex 993698ca5f9..e318014eb2a 100644--- a/src/metabase/slackbot/api.clj+++ b/src/metabase/slackbot/api.clj@@ -682,7 +682,7 @@(do(require '[clojure.java.shell :refer [sh]])(sh "pbcopy" :in (json/encode (get-slack-manifest) {:pretty true}))))- ;; 5. there will be a notification at the top of the manifest page to verify your new site url, click verify+;; 5. there will be a notification at the top of the manifest page to verify your new site url, click verify;; ----------------- DEV -----------------------diff --git a/src/metabase/sso/api/ldap.clj b/src/metabase/sso/api/ldap.cljindex 00b383d7661..ba2c44dad11 100644--- a/src/metabase/sso/api/ldap.clj+++ b/src/metabase/sso/api/ldap.clj@@ -45,8 +45,8 @@results (ldap/test-ldap-connection ldap-details)](if (= :SUCCESS (:status results))(t2/with-transaction [_conn]- ;; We need to update the ldap settings before we update ldap-enabled, as the ldap-enabled setter tests the ldap- ;; settings+ ;; We need to update the ldap settings before we update ldap-enabled, as the ldap-enabled setter tests the ldap+ ;; settings(setting/set-many! ldap-settings)(setting/set-value-of-type! :boolean :ldap-enabled (boolean (:ldap-enabled settings))));; test failed, return result messagediff --git a/src/metabase/sso/settings.clj b/src/metabase/sso/settings.cljindex c0a2c9cf614..4855863bcb2 100644--- a/src/metabase/sso/settings.clj+++ b/src/metabase/sso/settings.clj@@ -323,7 +323,7 @@:getter (fn [] (setting/get-value-of-type :string :google-auth-auto-create-accounts-domain)):setter (fn [domain](when (and domain (str/includes? domain ","))- ;; Multiple comma-separated domains requires the `:sso-google` premium feature flag+ ;; Multiple comma-separated domains requires the `:sso-google` premium feature flag(throw (ex-info (tru "Invalid domain") {:status-code 400})))(setting/set-value-of-type! :string :google-auth-auto-create-accounts-domain domain)))diff --git a/src/metabase/sync/fetch_metadata.clj b/src/metabase/sync/fetch_metadata.cljindex 4cca3d55b4d..ecd5c0c44b0 100644--- a/src/metabase/sync/fetch_metadata.clj+++ b/src/metabase/sync/fetch_metadata.clj@@ -102,8 +102,8 @@(try(let [table (t2/select-one :model/Table table-id)table-fields (table-fields-metadata database table)]- ;; Realize the fields from this table (from `table-fields-metadata`) immediately to ensure the- ;; connection is closed before moving to the next table.+ ;; Realize the fields from this table (from `table-fields-metadata`) immediately to ensure the+ ;; connection is closed before moving to the next table.(mapv #(assoc % :table-schema (:schema table) :table-name (:name table))table-fields))(catch Throwable ediff --git a/src/metabase/sync/schedules.clj b/src/metabase/sync/schedules.cljindex 72169f4c349..2f4622bbfdc 100644--- a/src/metabase/sync/schedules.clj+++ b/src/metabase/sync/schedules.clj@@ -39,7 +39,7 @@(defn randomly-once-an-hour"Schedule map for once an hour at a random minute of the hour."[excluded-minute]- ;; avoid around near the hour because it's usually when notifications are scheduled.+ ;; avoid around near the hour because it's usually when notifications are scheduled.(let [choices (remove #{excluded-minute} (range 5 55))]{:schedule_minute (rand-nth choices):schedule_type "hourly"}))diff --git a/src/metabase/sync/sync_metadata/fields/sync_instances.clj b/src/metabase/sync/sync_metadata/fields/sync_instances.cljindex f8a5d0dbad0..9985b583105 100644--- a/src/metabase/sync/sync_metadata/fields/sync_instances.clj+++ b/src/metabase/sync/sync_metadata/fields/sync_instances.clj@@ -69,7 +69,7 @@:display_name (humanization/name->human-readable-name field-name):database_type (or database-type "NULL") ; placeholder for Fields w/ no type info (e.g. Mongo) & all NULL:base_type base-type- ;; todo test this?+ ;; todo test this?:effective_type (if (and effective-type coercion-strategy) effective-type base-type):coercion_strategy (when effective-type coercion-strategy):semantic_type semantic-typediff --git a/src/metabase/sync/sync_metadata/fields/sync_metadata.clj b/src/metabase/sync/sync_metadata/fields/sync_metadata.cljindex 560eba2c4ab..4e05ed30933 100644--- a/src/metabase/sync/sync_metadata/fields/sync_metadata.clj+++ b/src/metabase/sync/sync_metadata/fields/sync_metadata.clj@@ -132,10 +132,10 @@{:base_type new-base-type:effective_type new-base-type:coercion_strategy nil- ;; reset fingerprint version so this field will get re-fingerprinted and analyzed+ ;; reset fingerprint version so this field will get re-fingerprinted and analyzed:fingerprint_version 0:fingerprint nil- ;; semantic type needs to be set to nil so that the fingerprinter can re-infer it during analysis+ ;; semantic type needs to be set to nil so that the fingerprinter can re-infer it during analysis:semantic_type nil};; we must override user-set values(->> (schema.field-user-settings/upsert-user-settings metabase-field))))diff --git a/src/metabase/sync/task/sync_databases.clj b/src/metabase/sync/task/sync_databases.cljindex 0cf6ff5bf26..37e5e8e58db 100644--- a/src/metabase/sync/task/sync_databases.clj+++ b/src/metabase/sync/task/sync_databases.clj@@ -270,10 +270,10 @@(triggers/with-schedule(cron/schedule(cron/cron-schedule task-schedule)- ;; if we miss a sync for one reason or another (such as system being down) do not try to run the sync again.- ;; Just wait until the next sync cycle.- ;;- ;; See https://www.nurkiewicz.com/2012/04/quartz-scheduler-misfire-instructions.html for more info+ ;; if we miss a sync for one reason or another (such as system being down) do not try to run the sync again.+ ;; Just wait until the next sync cycle.+ ;;+ ;; See https://www.nurkiewicz.com/2012/04/quartz-scheduler-misfire-instructions.html for more info(cron/with-misfire-handling-instruction-do-nothing))))))(defn- update-db-trigger-if-needed!@@ -290,8 +290,8 @@%)(:triggers job))))](cond- ;; no new schedule- ;; delete the existing trigger+ ;; no new schedule+ ;; delete the existing trigger(nil? new-trigger)(do(log/infof "Trigger for \"%s\" of Database \"%s\" has been removed. It will no longer run on a schedule."@@ -299,7 +299,7 @@(:name database))(delete-trigger! database task-info))- ;; need to recreate the new trigger+ ;; need to recreate the new trigger(and (some? new-trigger)(nil? existing-trigger-with-same-schedule))(do@@ -314,7 +314,7 @@(cron-schedule database task-info)))(task/add-trigger! new-trigger))- ;; don't need to do anything as the existing trigger matches the new schedule+ ;; don't need to do anything as the existing trigger matches the new schedule:elsenil)))diff --git a/src/metabase/sync/util.clj b/src/metabase/sync/util.cljindex 1e72a6134ea..730010c3b53 100644--- a/src/metabase/sync/util.clj+++ b/src/metabase/sync/util.clj@@ -728,8 +728,8 @@(or (isa? base-type :type/Temporal)(isa? base-type :type/Collection)(isa? base-type :type/Float)- ;; Don't let IDs become list Fields (they already can't become categories, because they already have a semantic- ;; type). It just doesn't make sense to cache a sequence of numbers since they aren't inherently meaningful+ ;; Don't let IDs become list Fields (they already can't become categories, because they already have a semantic+ ;; type). It just doesn't make sense to cache a sequence of numbers since they aren't inherently meaningful(isa? semantic-type :type/PK)(isa? semantic-type :type/FK))))diff --git a/src/metabase/task/impl.clj b/src/metabase/task/impl.cljindex 606f461a764..018f9afd631 100644--- a/src/metabase/task/impl.clj+++ b/src/metabase/task/impl.clj@@ -177,9 +177,9 @@(.getName replaced-key)(.getName new-trigger-key)(when (> (count triggers) 1)- ;; We probably want more intuitive rescheduling semantics for multi-trigger jobs...- ;; Ideally we would pass *all* the new triggers at once, so we can match them up atomically.- ;; The current behavior is especially confounding if replacing N triggers with M ones.+ ;; We probably want more intuitive rescheduling semantics for multi-trigger jobs...+ ;; Ideally we would pass *all* the new triggers at once, so we can match them up atomically.+ ;; The current behavior is especially confounding if replacing N triggers with M ones.(str " (chosen randomly from " (count triggers) " existing ones)"))))(.rescheduleJob scheduler replaced-key new-trigger))))(catch Throwable ediff --git a/src/metabase/task_history/task/task_history_cleanup.clj b/src/metabase/task_history/task/task_history_cleanup.cljindex 6b5b3c78a08..1a8d68714e3 100644--- a/src/metabase/task_history/task/task_history_cleanup.clj+++ b/src/metabase/task_history/task/task_history_cleanup.clj@@ -42,6 +42,6 @@(triggers/with-identity (triggers/key trigger-key))(triggers/start-now)(triggers/with-schedule- ;; run every day at midnight+ ;; run every day at midnight(cron/cron-schedule "0 0 0 * * ? *")))](task/schedule-task! job trigger)))diff --git a/src/metabase/task_history/task/task_run_heartbeat.clj b/src/metabase/task_history/task/task_run_heartbeat.cljindex 7489be7aa44..ad0c4c3e8dc 100644--- a/src/metabase/task_history/task/task_run_heartbeat.clj+++ b/src/metabase/task_history/task/task_run_heartbeat.clj@@ -99,6 +99,6 @@(triggers/with-identity (triggers/key trigger-key))(triggers/start-now)(triggers/with-schedule- ;; run every 10 minutes+ ;; run every 10 minutes(cron/cron-schedule "0 */10 * * * ? *")))](task/schedule-task! job trigger)))diff --git a/src/metabase/tiles/api.clj b/src/metabase/tiles/api.cljindex c34cdae103a..bee7eec088b 100644--- a/src/metabase/tiles/api.clj+++ b/src/metabase/tiles/api.clj@@ -208,7 +208,7 @@:headers {"Content-Type" "image/png"}:body (tile->byte-array (create-tile zoom points))}(throw (ex-info (tru "Query failed")- ;; `result` might be a `core.async` channel or something we're not expecting+ ;; `result` might be a `core.async` channel or something we're not expecting(assoc (when (map? result) result) :status-code 400)))))(mr/def ::querydiff --git a/src/metabase/transforms/schedule.clj b/src/metabase/transforms/schedule.cljindex a2ff00a6eae..881ab1d7f28 100644--- a/src/metabase/transforms/schedule.clj+++ b/src/metabase/transforms/schedule.clj@@ -48,10 +48,10 @@(cron/schedule(cron/cron-schedule schedule)(cron/in-time-zone (TimeZone/getTimeZone ^String (timezone)))- ;; We want to fire the trigger once even if the previous triggers missed- ;; (potentially several times)+ ;; We want to fire the trigger once even if the previous triggers missed+ ;; (potentially several times)(cron/with-misfire-handling-instruction-fire-and-proceed)))- ;; higher than sync+ ;; higher than sync(triggers/with-priority 6)))(defn- create-trigger!diff --git a/src/metabase/upload/impl.clj b/src/metabase/upload/impl.cljindex 3a7f2b51734..1bb4f7e73cd 100644--- a/src/metabase/upload/impl.clj+++ b/src/metabase/upload/impl.clj@@ -530,7 +530,7 @@table-name (some->> table-name (ddl.i/format-name driver))schema+table-name (table-identifier {:schema schema :name table-name}){:keys [columns stats]} (create-from-csv! driver db schema+table-name filename file)- ;; Sync immediately to create the Table and its Fields; the scan is settings-dependent and can be async+ ;; Sync immediately to create the Table and its Fields; the scan is settings-dependent and can be asynctable (sync/create-table! db {:name table-name:schema (not-empty schema):display_name display-name})@@ -540,8 +540,8 @@:is_writable true})_sync (scan-and-sync-table! db table)_set_names (set-display-names! (:id table) columns)- ;; Set the display_name of the auto-generated primary key column to the same as its name, so that if users- ;; download results from the table as a CSV and reupload, we'll recognize it as the same column+ ;; Set the display_name of the auto-generated primary key column to the same as its name, so that if users+ ;; download results from the table as a CSV and reupload, we'll recognize it as the same column_ (when (auto-pk-column? driver db)(let [auto-pk-field (table-id->auto-pk-column driver (:id table))](t2/update! :model/Field (:id auto-pk-field) {:display_name (:name auto-pk-field)})))]diff --git a/src/metabase/util/formatting/internal/numbers.cljs b/src/metabase/util/formatting/internal/numbers.cljsindex 75a24c477ad..ba85be10d68 100644--- a/src/metabase/util/formatting/internal/numbers.cljs+++ b/src/metabase/util/formatting/internal/numbers.cljs@@ -59,7 +59,7 @@"scientific"):currency (:currency options):currencyDisplay (:currency-style options)- ;; Always use grouping separators, but we may remove them per number_separators.+ ;; Always use grouping separators, but we may remove them per number_separators.:useGrouping true:minimumIntegerDigits (:minimum-integer-digits options):minimumFractionDigits (:minimum-fraction-digits options default-fraction-digits)diff --git a/src/metabase/util/memoize/impl/js.cljs b/src/metabase/util/memoize/impl/js.cljsindex 5aac1894ea5..cdf2813a9c9 100644--- a/src/metabase/util/memoize/impl/js.cljs+++ b/src/metabase/util/memoize/impl/js.cljs@@ -88,12 +88,12 @@(let [ckey (or (ckey-fn args) [])cs (swap! cache-atom through* f args ckey)val (cache/lookup cs ckey ::not-found)]- ;; If `lookup` returns `(delay ::not-found)`, it's likely that- ;; we ran into a timing issue where eviction and access- ;; are happening at about the same time. Therefore, we retry- ;; the `swap!` (potentially several times).- ;;- ;; metabase.util.memoize currently wraps all of its values in a `delay`.+ ;; If `lookup` returns `(delay ::not-found)`, it's likely that+ ;; we ran into a timing issue where eviction and access+ ;; are happening at about the same time. Therefore, we retry+ ;; the `swap!` (potentially several times).+ ;;+ ;; metabase.util.memoize currently wraps all of its values in a `delay`.(when val(loop [n 0 v @val](if (= ::not-found v)diff --git a/src/metabase/version/task/upgrade_checks.clj b/src/metabase/version/task/upgrade_checks.cljindex 329b3b1cc4a..7c8f7c67e68 100644--- a/src/metabase/version/task/upgrade_checks.clj+++ b/src/metabase/version/task/upgrade_checks.clj@@ -62,6 +62,6 @@(triggers/with-identity (triggers/key trigger-key))(triggers/start-now)(triggers/with-schedule- ;; run twice a day+ ;; run twice a day(cron/cron-schedule (format "0 %d %d,%d * * ? *" rand-minute rand-hour-1 rand-hour-2))))](task/schedule-task! job trigger)))diff --git a/src/metabase/warehouse_schema_rest/api/table.clj b/src/metabase/warehouse_schema_rest/api/table.cljindex 1016bf8dc1e..eef94deec30 100644--- a/src/metabase/warehouse_schema_rest/api/table.clj+++ b/src/metabase/warehouse_schema_rest/api/table.clj@@ -176,9 +176,9 @@{:name "query-table-async"}(qp.streaming/streaming-response [rff :api](qp/process-query query- ;; For now, doing this transformation here makes it easy to iterate on our payload shape.- ;; In the future, we might want to implement a new export-type, say `:api/table`, instead.- ;; Then we can avoid building non-relevant fields, only to throw them away again.+ ;; For now, doing this transformation here makes it easy to iterate on our payload shape.+ ;; In the future, we might want to implement a new export-type, say `:api/table`, instead.+ ;; Then we can avoid building non-relevant fields, only to throw them away again.(qp.streaming/transforming-query-responserff(fn [response]diff --git a/src/metabase/warehouses/models/database.clj b/src/metabase/warehouses/models/database.cljindex a9afc538bfa..4950d177100 100644--- a/src/metabase/warehouses/models/database.clj+++ b/src/metabase/warehouses/models/database.clj@@ -45,8 +45,8 @@[query-type model](comp(next-method query-type model)- ;; This is for safety - if a secret ever gets stored in details we don't want it to leak.- ;; This will also help to secure properties that we set to secret in the future.+ ;; This is for safety - if a secret ever gets stored in details we don't want it to leak.+ ;; This will also help to secure properties that we set to secret in the future.(map secret/clean-secret-properties-from-database)))(t2/deftransforms :model/Database@@ -619,13 +619,13 @@(setting/can-read-setting? setting-name(setting/current-user-readable-visibilities))(catch Throwable e- ;; there is an known issue with exception is ignored when render API response (#32822)- ;; If you see this error, you probably need to define a setting for `setting-name`.- ;; But ideally, we should resolve the above issue, and remove this try/catch+ ;; there is an known issue with exception is ignored when render API response (#32822)+ ;; If you see this error, you probably need to define a setting for `setting-name`.+ ;; But ideally, we should resolve the above issue, and remove this try/catch(log/errorf e "Error checking the readability of %s setting. The setting will be hidden in API response."setting-name)- ;; let's be conservative and hide it by defaults, if you want to see it,- ;; you need to define it :)+ ;; let's be conservative and hide it by defaults, if you want to see it,+ ;; you need to define it :)false)))settings)(when (not= <> settings)diff --git a/src/metabase/warehouses/util.clj b/src/metabase/warehouses/util.cljindex 76678060f3b..bf7ec7484da 100644--- a/src/metabase/warehouses/util.clj+++ b/src/metabase/warehouses/util.clj@@ -91,9 +91,9 @@(nil? (test-database-connection engine details-with-ssl :log-exception false)))details-with-ssl)](or- ;; Opportunistic SSL+ ;; Opportunistic SSLdetails-with-ssl- ;; Try with original parameters+ ;; Try with original parameters(some-> (test-database-connection engine details)(assoc :valid false))details)))diff --git a/src/metabase/warehouses_rest/api.clj b/src/metabase/warehouses_rest/api.cljindex 160d8d43cc1..77906014ebe 100644--- a/src/metabase/warehouses_rest/api.clj+++ b/src/metabase/warehouses_rest/api.clj@@ -1115,10 +1115,10 @@;; We skip validation for: unchanged values and nil values (resetting to default is always allowed).(doseq [[setting-kw new-value] settings:when (and (some? new-value)- ;; Allow explicit default value as well (typically this is what FE will actually do)- ;; Should we translate this into setting it to NULL? That seems too opinionated.+ ;; Allow explicit default value as well (typically this is what FE will actually do)+ ;; Should we translate this into setting it to NULL? That seems too opinionated.(not= new-value (try (setting/default-value setting-kw)- ;; fallback to a redundant nil check+ ;; fallback to a redundant nil check(catch Exception _)))(not= new-value (get existing-settings setting-kw)))](trydiff --git a/src/metabase/xrays/api/automagic_dashboards.clj b/src/metabase/xrays/api/automagic_dashboards.cljindex fb0ada064d8..6d58eb96d4c 100644--- a/src/metabase/xrays/api/automagic_dashboards.clj+++ b/src/metabase/xrays/api/automagic_dashboards.clj@@ -349,7 +349,7 @@model-index-value (t2/select-one :model/ModelIndexValue:model_index_id model-index-id:model_pk pk-id)]- ;; `->entity` does a read check on the model but this is here as well to be extra sure.+ ;; `->entity` does a read check on the model but this is here as well to be extra sure.(api/read-check :model/Card (:model_id model-index))(let [linked (linked-entities {:model model:model-index model-indexdiff --git a/src/metabase/xrays/automagic_dashboards/interesting.clj b/src/metabase/xrays/automagic_dashboards/interesting.cljindex 26a971e4759..6f359eb04c5 100644--- a/src/metabase/xrays/automagic_dashboards/interesting.clj+++ b/src/metabase/xrays/automagic_dashboards/interesting.clj@@ -80,7 +80,7 @@(let [duration (u.date/period-duration earliest latest)less-than? #(u.date/greater-than-period-duration? % duration)](cond- ;; e.g. if [duration between earliest and latest] < 3 hours then use `:minute` resolution+ ;; e.g. if [duration between earliest and latest] < 3 hours then use `:minute` resolution(and (less-than? (t/hours 3)) (can-use? :minute)) :minute(and (less-than? (t/days 7)) (can-use? :hour)) :hour(and (less-than? (t/months 6)) (can-use? :day)) :daydiff --git a/test/metabase/actions_rest/api_test.clj b/test/metabase/actions_rest/api_test.cljindex 36c85156d1e..941c473200d 100644--- a/test/metabase/actions_rest/api_test.clj+++ b/test/metabase/actions_rest/api_test.clj@@ -206,7 +206,7 @@(mt/user-http-request :rasta:post 400(format "action/%s/execute" action-on-other-id)- ;; Twitter is the current value so effectively a no-op+ ;; Twitter is the current value so effectively a no-op{:parameters {:id 1 :source "Twitter"}})))))))(testing "When actions are enabled on the other database"(mt/dataset test-datadiff --git a/test/metabase/app_db/custom_migrations_test.clj b/test/metabase/app_db/custom_migrations_test.cljindex ccf6e05f51f..4880a119ade 100644--- a/test/metabase/app_db/custom_migrations_test.clj+++ b/test/metabase/app_db/custom_migrations_test.clj@@ -444,13 +444,13 @@{:id tab1-card2-id:row 2}- ;; tab 2+ ;; tab 2{:id tab2-card1-id:row 8}{:id tab2-card2-id:row 12}- ;; tab 3+ ;; tab 3{:id tab4-card1-id:row 14}{:id tab4-card2-id@@ -595,10 +595,10 @@acc-row []](let [size-x (inc (math/round (* 9 (math/random))))new-col (+ col size-x)]- ;; we want to ensure we have a card at the end of the row+ ;; we want to ensure we have a card at the end of the row(if (>= new-col 18)(cons [col row (- 18 col) size-y] acc-row)- ;; probability of skipping is 5%+ ;; probability of skipping is 5%(if (> (math/random) 0.95)(recur (+ col size-x) acc-row)(recur (+ col size-x) (cons [col row size-x size-y] acc-row)))))))))))]@@ -1641,7 +1641,7 @@(set (#'custom-migrations/db-type->to-unified-columns db-type))(table-and-column-of-type datetime-type)))))- ;; this is a weird behavior on mariadb that I can only find on CI, but it's nice to have this test anw+ ;; this is a weird behavior on mariadb that I can only find on CI, but it's nice to have this test anw(testing "not nullable timestamp column should not have extra on update"(let [user-id (t2/insert-returning-pk! :core_user {:first_name "Howard":last_name "Hughes"diff --git a/test/metabase/app_db/schema_migrations_test.clj b/test/metabase/app_db/schema_migrations_test.cljindex d415e5d6436..98268b0de8c 100644--- a/test/metabase/app_db/schema_migrations_test.clj+++ b/test/metabase/app_db/schema_migrations_test.clj@@ -356,7 +356,7 @@pg-field-3-id :type/Textmysql-field-1-id :type/JSONmysql-field-2-id :type/Text)- ;; TODO: this is commented out temporarily because it flakes for MySQL (metabase#37884)+ ;; TODO: this is commented out temporarily because it flakes for MySQL (metabase#37884)#_(testing "Rollback restores the original state"(migrate! :down 46)(let [new-base-types (t2/select-pk->fn :base_type Field)]@@ -532,11 +532,11 @@(testing "Migration v48.00-019"(impl/test-migrations ["v48.00-019"] [migrate!](mt/with-dynamic-fn-redefs [;; Urgh. `collection/is-trash?` will select the Trash collection (cached) based on its `type`. But as of this- ;; migration, this `type` does not exist yet. Neither does the Trash collection though, so let's just ... make- ;; that so.+ ;; migration, this `type` does not exist yet. Neither does the Trash collection though, so let's just ... make+ ;; that so.collection/is-trash? (constantly false)- ;; Also avoid loading sample content, because this test breaks the assumption that only the trash- ;; collection exists at the time of the migration+ ;; Also avoid loading sample content, because this test breaks the assumption that only the trash+ ;; collection exists at the time of the migrationconfig/load-sample-content? (constantly false)](let [collection-id (first (t2/insert-returning-pks! (t2/table-name :model/Collection) {:name "Amazing collection":slug "amazing_collection"@@ -584,7 +584,7 @@(when (#{:postgres :mysql} (mdb/db-type))(impl/test-migrations "v48.00-049" [migrate!](create-raw-user! (mt/random-email))- ;; Use raw :activity keyword as table name since the model has since been removed+ ;; Use raw :activity keyword as table name since the model has since been removed(let [_activity-1 (t2/insert-returning-pks! :activity{:topic "card-create":user_id 1@@ -786,7 +786,7 @@:postgres "SELECT COUNT(*) as count FROM pg_indexes WHEREtablename = 'databasechangelog' AND indexname = 'idx_databasechangelog_id_author_filename';":mysql "SELECT COUNT(*) as count FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'DATABASECHANGELOG' AND INDEX_NAME = 'idx_databasechangelog_id_author_filename';"- ;; h2 has a strange way of naming constraint+ ;; h2 has a strange way of naming constraint:h2 "SELECT COUNT(*) as count FROM information_schema.indexesWHERE TABLE_NAME = 'DATABASECHANGELOG' AND INDEX_NAME = 'IDX_DATABASECHANGELOG_ID_AUTHOR_FILENAME_INDEX_1';"))))))))@@ -900,9 +900,9 @@(testing "Migration v49.2024-06-27T00:00:02 populates is_defective_duplicate correctly"(impl/test-migrations ["v49.2024-06-27T00:00:00" "v49.2024-06-27T00:00:08"] [migrate!](when (= (mdb/db-type) :postgres)- ;; This is to test what happens when Postgres is rolled back to 48 from 49, and- ;; then rolled back to 49 again. The rollback to 48 will cause the- ;; idx_uniq_field_table_id_parent_id_name_2col index to be dropped+ ;; This is to test what happens when Postgres is rolled back to 48 from 49, and+ ;; then rolled back to 49 again. The rollback to 48 will cause the+ ;; idx_uniq_field_table_id_parent_id_name_2col index to be dropped(t2/query "DROP INDEX IF EXISTS idx_uniq_field_table_id_parent_id_name_2col;"))(let [db-id (t2/insert-returning-pk! :metabase_database{:details "{}"diff --git a/test/metabase/app_db/schema_migrations_test/impl.clj b/test/metabase/app_db/schema_migrations_test/impl.cljindex a168971ac55..51accb56609 100644--- a/test/metabase/app_db/schema_migrations_test/impl.clj+++ b/test/metabase/app_db/schema_migrations_test/impl.clj@@ -73,8 +73,8 @@(do-with-temp-empty-app-db*driver(fn [^javax.sql.DataSource data-source]- ;; it should be ok to open multiple connections to this `data-source`; it should stay open as long as `conn` is- ;; open+ ;; it should be ok to open multiple connections to this `data-source`; it should stay open as long as `conn` is+ ;; open(with-open [conn (.getConnection data-source)](binding [mdb.connection/*application-db* (mdb.connection/application-db driver data-source)custom-migrations.util/*allow-temp-scheduling* false]@@ -143,8 +143,8 @@(ChangeSetFilterResult. accept? "decision according to range" (class this)))))]change-log-service (.getChangeLogService (ChangeLogHistoryServiceFactory/getInstance) database)](liquibase/with-scope-locked liquibase- ;; Calling .listUnrunChangeSets has the side effect of creating the Liquibase tables- ;; and initializing checksums so that they match the ones generated in production.+ ;; Calling .listUnrunChangeSets has the side effect of creating the Liquibase tables+ ;; and initializing checksums so that they match the ones generated in production.(.listUnrunChangeSets liquibase nil (LabelExpression.))(.generateDeploymentId change-log-service)(liquibase/update-with-change-log liquibase {:change-set-filters change-set-filters})))))diff --git a/test/metabase/app_db/setup_test.clj b/test/metabase/app_db/setup_test.cljindex 3e69310e83d..9b93a2ceb85 100644--- a/test/metabase/app_db/setup_test.clj+++ b/test/metabase/app_db/setup_test.clj@@ -139,7 +139,7 @@(mt/test-drivers #{:h2 :mysql :postgres}(mt/with-temp-empty-app-db [conn driver/*driver*](mt/with-dynamic-fn-redefs [liquibase/decide-liquibase-file (fn [& _args] @#'liquibase/changelog-legacy-file)]- ;; set up a db in a way we have a MB instance running metabase 45+ ;; set up a db in a way we have a MB instance running metabase 45(update-to-changelog-id "v45.00-001" conn))(is (= :done(mdb.setup/setup-db! driver/*driver* (mdb.connection/data-source) true false))))))diff --git a/test/metabase/app_db/test_util.clj b/test/metabase/app_db/test_util.cljindex 3e332a6a232..6496b6f9f7b 100644--- a/test/metabase/app_db/test_util.clj+++ b/test/metabase/app_db/test_util.clj@@ -53,7 +53,7 @@(driver.tu/wrap-notify-all-databases-updated!(if (= (mdb/db-type) :h2)(test.tz/do-with-system-timezone-id! tz thunk)- ;; otherwise if db-type is postgres or mysql+ ;; otherwise if db-type is postgres or mysql(let [initial-tz (val (first (t2/query-one (case (mdb/db-type):postgres "SELECT current_setting('TIMEZONE')":mysql "SELECT @@global.time_zone"))))@@ -80,10 +80,10 @@:mariadbdb-type)](->> (:databaseChangeLog content)- ;; if the changelog has filter by dbms, remove the ones that doens't apply for the current lb-type+ ;; if the changelog has filter by dbms, remove the ones that doens't apply for the current lb-type(remove (fn [{{:keys [dbms]} :changeSet}] (and (not (str/blank? dbms))(not (str/includes? dbms (name lb-type))))))- ;; remove ignored changeSets+ ;; remove ignored changeSets(remove #(get-in % [:changeSet :ignore]))(map #(str (get-in % [:changeSet :id])))(remove str/blank?))))diff --git a/test/metabase/channel/email/result_attachment_test.clj b/test/metabase/channel/email/result_attachment_test.cljindex 531019e5bd8..a79cb2b82df 100644--- a/test/metabase/channel/email/result_attachment_test.clj+++ b/test/metabase/channel/email/result_attachment_test.clj@@ -44,8 +44,8 @@1 :no2 :one-million-rows:one-million-rows))- ;; Sentinel: if execution reaches the streaming path, the perm check passed.- ;; We avoid exercising real CSV streaming machinery in a unit test.+ ;; Sentinel: if execution reaches the streaming path, the perm check passed.+ ;; We avoid exercising real CSV streaming machinery in a unit test.email.result-attachment/create-temp-file! (fn [_](throw (ex-info "PERM-CHECK-PASSED" {})))](testing "passes perm check when subscription creator has download perms (even if card author does not)"diff --git a/test/metabase/cloud_migration/models/cloud_migration_test.clj b/test/metabase/cloud_migration/models/cloud_migration_test.cljindex f1ad6213f07..bb2605b2a34 100644--- a/test/metabase/cloud_migration/models/cloud_migration_test.clj+++ b/test/metabase/cloud_migration/models/cloud_migration_test.clj@@ -24,7 +24,7 @@[migration]{(:upload_url migration)(fn [{:keys [body request-method]}]- ;; slurp it to progress the upload+ ;; slurp it to progress the upload(slurp body)(is (= :putrequest-method))diff --git a/test/metabase/cmd/rotate_encryption_key_test.clj b/test/metabase/cmd/rotate_encryption_key_test.cljindex 29bc5f3f9f7..3e88d26b372 100644--- a/test/metabase/cmd/rotate_encryption_key_test.clj+++ b/test/metabase/cmd/rotate_encryption_key_test.clj@@ -160,8 +160,8 @@(encryption-test/with-secret-key k2 ; with the last key that we rotated to in the test(rotate-encryption-key! nil))(is (= "unencrypted value" (raw-value "nocrypt")))- ;; at this point, both the originally encrypted, and the originally unencrypted secret instances- ;; should be decrypted+ ;; at this point, both the originally encrypted, and the originally unencrypted secret instances+ ;; should be decrypted(is (mt/secret-value-equals? secret-val (t2/select-one-fn :value :model/Secret :id @secret-id-unenc)))(is (mt/secret-value-equals? secret-val (t2/select-one-fn :value :model/Secret :id @secret-id-enc))))diff --git a/test/metabase/collections/models/collection_test.clj b/test/metabase/collections/models/collection_test.cljindex 48e5117b495..4f9dc55bee3 100644--- a/test/metabase/collections/models/collection_test.clj+++ b/test/metabase/collections/models/collection_test.clj@@ -1844,7 +1844,7 @@(testing "when model has no dependencies"(mt/with-temp [:model/Collection {remote-synced-coll-id :id} {:name "Remote-Synced Collection" :is_remote_synced true}:model/Card {card-id :id} {:name "Test Card" :collection_id remote-synced-coll-id}]- ;; Card with no actual dependencies will return empty+ ;; Card with no actual dependencies will return empty(let [result (collection/non-remote-synced-dependencies (t2/instance :model/Card {:id card-id}))](is (empty? result)"Should return empty when card has no dependencies")))))@@ -2142,15 +2142,15 @@:model/Collection {grandchild-id :id} {:name "Grandchild Collection":location (format "/%d/%d/" coll-id child-id):type nil}]- ;; Move collection to parent with into-remote-synced? true+ ;; Move collection to parent with into-remote-synced? true(collection/move-collection! coll (format "/%d/" parent-id) true)- ;; Check that the moved collection became remote-synced type+ ;; Check that the moved collection became remote-synced type(let [moved-coll (t2/select-one :model/Collection :id coll-id)](is (true? (:is_remote_synced moved-coll))"Moved collection should have remote-synced type"))- ;; Check that child collections also became remote-synced type+ ;; Check that child collections also became remote-synced type(let [moved-child (t2/select-one :model/Collection :id child-id)](is (true? (:is_remote_synced moved-child))"Child collection should have remote-synced type"))@@ -2168,10 +2168,10 @@:model/Collection {child-id :id} {:name "Child Collection":location (format "/%d/" coll-id):type nil}]- ;; Move collection to parent with into-remote-synced? false+ ;; Move collection to parent with into-remote-synced? false(collection/move-collection! coll (format "/%d/" parent-id) false)- ;; Check that collection types remain nil+ ;; Check that collection types remain nil(let [moved-coll (t2/select-one :model/Collection :id coll-id)](is (false? (:is_remote_synced moved-coll))"Moved collection should not have remote-synced type"))@@ -2189,10 +2189,10 @@:model/Collection {child-id :id} {:name "Child Collection":location (format "/%d/" coll-id):is_remote_synced true}]- ;; Move remote-synced collection with into-remote-synced? true+ ;; Move remote-synced collection with into-remote-synced? true(collection/move-collection! coll (format "/%d/" parent-id))- ;; Check that collections remain remote-synced type+ ;; Check that collections remain remote-synced type(let [moved-coll (t2/select-one :model/Collection :id coll-id)](is (false? (:is_remote_synced moved-coll))"Library collection should lose remote-synced type"))@@ -2237,7 +2237,7 @@:model/Card _ {:name "Dependent Card":collection_id coll-id:dataset_query (mt/mbql-query nil {:source-table (str "card__" non-remote-synced-card-id)})}]- ;; This should throw an exception because the dependency (non-remote-synced-card) is not in a remote-synced collection+ ;; This should throw an exception because the dependency (non-remote-synced-card) is not in a remote-synced collection(let [ex (is (thrown-with-msg? Exception#"Uses content that is not remote synced."(collection/move-collection! coll (format "/%d/" parent-id) true))@@ -2248,7 +2248,7 @@(is (contains? ex-data :non-remote-synced-models)"Exception should contain non-remote-synced models"))- ;; Verify the transaction was rolled back - collection should not be moved or changed+ ;; Verify the transaction was rolled back - collection should not be moved or changed(let [unchanged-coll (t2/select-one :model/Collection :id coll-id)](is (false? (:is_remote_synced unchanged-coll))"Collection type should remain unchanged after failed move")@@ -2271,12 +2271,12 @@:model/Card _ {:name "Dependent Card":collection_id coll-id:dataset_query (mt/mbql-query nil {:source-table (str "card__" non-remote-synced-card-id)})}]- ;; This should throw an exception after updates are made but before transaction commits+ ;; This should throw an exception after updates are made but before transaction commits(is (thrown? Exception(collection/move-collection! coll (format "/%d/" parent-id) true))"Should throw exception for non-remote-synced dependencies")- ;; Verify the transaction was completely rolled back+ ;; Verify the transaction was completely rolled back(let [unchanged-coll (t2/select-one :model/Collection :id coll-id)](is (false? (:is_remote_synced unchanged-coll))"Collection type should remain unchanged after transaction rollback")@@ -2302,10 +2302,10 @@:model/Card _ {:name "Dependent Card":collection_id coll-id:dataset_query (mt/mbql-query nil {:source-table (str "card__" non-remote-synced-card-id)})}]- ;; This should succeed because we're not converting to remote-synced+ ;; This should succeed because we're not converting to remote-synced(collection/move-collection! coll (format "/%d/" parent-id))- ;; Verify the collection was moved but did not become remote-synced type+ ;; Verify the collection was moved but did not become remote-synced type(let [moved-coll (t2/select-one :model/Collection :id coll-id)](is (false? (:is_remote_synced moved-coll))"Collection should not have remote-synced type")diff --git a/test/metabase/collections_rest/api_test.clj b/test/metabase/collections_rest/api_test.cljindex b6841d1daf4..c6cc9102039 100644--- a/test/metabase/collections_rest/api_test.clj+++ b/test/metabase/collections_rest/api_test.clj@@ -2816,7 +2816,7 @@(let [;; Create a parent collection with snippets namespacelib-root (t2/select-one :model/Collection :entity_id entity-id)child-collection (mt/user-http-request :crowberto :post 200 "collection"- ;; Deliberately not setting `:type` here - it's automatic.+ ;; Deliberately not setting `:type` here - it's automatic.{:name "Child Collection":parent_id (u/the-id lib-root)})child-id (:id child-collection)]@@ -2826,7 +2826,7 @@:name "Grandchild Collection":type collection-type}(mt/user-http-request :crowberto :post 200 "collection"- ;; Likewise, deliberately no `:type`.+ ;; Likewise, deliberately no `:type`.{:name "Grandchild Collection":parent_id child-id}))"Grandchild collection should also inherit the :type of their non-magic parent"))))))))diff --git a/test/metabase/dashboards_rest/api_test.clj b/test/metabase/dashboards_rest/api_test.cljindex d48a35f1d66..8779e4d095e 100644--- a/test/metabase/dashboards_rest/api_test.clj+++ b/test/metabase/dashboards_rest/api_test.clj@@ -1898,7 +1898,7 @@:size_y 4:col 1:row 1- ;; initialy was in tab1, now in tab 2+ ;; initialy was in tab1, now in tab 2:dashboard_tab_id dashtab-id-2:card_id card-id-1}{:id dashcard-id-2@@ -3559,11 +3559,11 @@;; This test should either (1) be rehabilitated to use Lib to get the set of columns for filtering a dashcard (like;; the FE); or (2) just be dropped if it's not providing value.#_(testing "field selection should compatible with field-id from /api/table/:card__id/query_metadata"- ;; FE use the id returned by /api/table/:card__id/query_metadata- ;; for the `values_source_config.value_field`, so we need to test to make sure- ;; the id is a valid field that we could use to retrieve values.+ ;; FE use the id returned by /api/table/:card__id/query_metadata+ ;; for the `values_source_config.value_field`, so we need to test to make sure+ ;; the id is a valid field that we could use to retrieve values.(mt/with-temp- ;; card with agggregation and binning columns+ ;; card with agggregation and binning columns[Card {mbql-card-id :id} (merge (mt/card-with-source-metadata-for-query(mt/mbql-query venues{:limit 5@@ -3659,7 +3659,7 @@(mt/user-http-request :rasta :get 200 (format "/dashboard/%d/params/%s/search/%s"(:id dashboard)"_text_"- ;; a0 is part of first 2 rows of queried table+ ;; a0 is part of first 2 rows of queried table"a0")))))))))(deftest field-filter-uuid-operator-dashboard-testdiff --git a/test/metabase/documents/api/document_test.clj b/test/metabase/documents/api/document_test.cljindex 40d142a41fd..e91193383b3 100644--- a/test/metabase/documents/api/document_test.clj+++ b/test/metabase/documents/api/document_test.clj@@ -303,7 +303,7 @@:put 403 (format "document/%s" document-id){:collection_id collection2-id})- ;; Verify nothing changed+ ;; Verify nothing changed(is (= collection1-id (:collection_id (t2/select-one :model/Document :id document-id))))(is (= collection1-id (:collection_id (t2/select-one :model/Card :id card-id)))))))@@ -898,7 +898,7 @@:dataset_query (mt/mbql-query users):display :bar:visualization_settings {}}]- ;; Update the document with both cards+ ;; Update the document with both cards(let [result (mt/user-http-request :crowberto:put 200 (format "document/%s" document-id){:document {:type "doc"@@ -1192,7 +1192,7 @@:dataset_query (mt/mbql-query venues):display :table:visualization_settings {}}]- ;; First update - should clone the card+ ;; First update - should clone the card(mt/user-http-request :crowberto:put 200 (format "document/%s" document-id){:document {:type "doc"@@ -1205,7 +1205,7 @@(testing "first update creates one clone"(is (= 1 (count first-cloned-cards))))- ;; Second update with the already-cloned card ID - should NOT create another clone+ ;; Second update with the already-cloned card ID - should NOT create another clone(let [second-result (mt/user-http-request :crowberto:put 200 (format "document/%s" document-id){:document {:type "doc"@@ -1229,13 +1229,13 @@:model/Collection {write-col :id} {:name "Write Collection"}:model/Collection {no-access-col :id} {:name "No Access Collection"}]- ;; Set up permissions for :rasta user+ ;; Set up permissions for :rasta user(mt/with-group-for-user [group :rasta {:name "Rasta Group"}]- ;; Grant read-only access to read-only-col+ ;; Grant read-only access to read-only-col(perms/grant-collection-read-permissions! group read-only-col)- ;; Grant write access to write-col+ ;; Grant write access to write-col(perms/grant-collection-readwrite-permissions! group write-col)- ;; No permissions for no-access-col (implicitly)+ ;; No permissions for no-access-col (implicitly)(testing "POST /api/document/ - :rasta can create documents in collections with write access"(mt/with-model-cleanup [:model/Document]@@ -1269,13 +1269,13 @@:model/Collection {write-col :id} {:name "Write Collection"}:model/Collection {no-access-col :id} {:name "No Access Collection"}]- ;; Set up permissions for :rasta user+ ;; Set up permissions for :rasta user(mt/with-group-for-user [group :rasta {:name "Rasta Group"}]- ;; Grant read-only access to read-only-col+ ;; Grant read-only access to read-only-col(perms/grant-collection-read-permissions! group read-only-col)- ;; Grant write access to write-col+ ;; Grant write access to write-col(perms/grant-collection-readwrite-permissions! group write-col)- ;; No permissions for no-access-col (implicitly)+ ;; No permissions for no-access-col (implicitly)(testing "PUT /api/document/:id - :rasta can update documents in collections with write access"(mt/with-temp [:model/Document {doc-id :id} {:name "Original Document"@@ -1312,13 +1312,13 @@:model/Collection {write-col :id} {:name "Write Collection"}:model/Collection {destination-col :id} {:name "Destination Collection"}]- ;; Set up permissions for :rasta user+ ;; Set up permissions for :rasta user(mt/with-group-for-user [group :rasta {:name "Rasta Group"}]- ;; Grant read-only access to read-only-col+ ;; Grant read-only access to read-only-col(perms/grant-collection-read-permissions! group read-only-col)- ;; Grant write access to write-col+ ;; Grant write access to write-col(perms/grant-collection-readwrite-permissions! group write-col)- ;; Grant write access to destination-col+ ;; Grant write access to destination-col(perms/grant-collection-readwrite-permissions! group destination-col)(testing "PUT /api/document/:id - :rasta can move documents between collections with write access to both"@@ -1330,7 +1330,7 @@{:collection_id destination-col})](is (= doc-id (:id result)))(is (= destination-col (:collection_id result)))- ;; Verify document was actually moved+ ;; Verify document was actually moved(is (= destination-col (:collection_id (t2/select-one :model/Document :id doc-id)))))))(testing "PUT /api/document/:id - :rasta cannot move documents from collections without write access"@@ -1340,7 +1340,7 @@(mt/user-http-request :rasta:put 403 (format "document/%s" doc-id){:collection_id destination-col})- ;; Verify document wasn't moved+ ;; Verify document wasn't moved(is (= read-only-col (:collection_id (t2/select-one :model/Document :id doc-id))))))(testing "PUT /api/document/:id - :rasta cannot move documents to collections without write access"@@ -1350,7 +1350,7 @@(mt/user-http-request :rasta:put 403 (format "document/%s" doc-id){:collection_id read-only-col})- ;; Verify document wasn't moved+ ;; Verify document wasn't moved(is (= write-col (:collection_id (t2/select-one :model/Document :id doc-id)))))))))))(deftest rasta-document-read-permissions-test@@ -1360,13 +1360,13 @@:model/Collection {write-col :id} {:name "Write Collection"}:model/Collection {no-access-col :id} {:name "No Access Collection"}]- ;; Set up permissions for :rasta user+ ;; Set up permissions for :rasta user(mt/with-group-for-user [group :rasta {:name "Rasta Group"}]- ;; Grant read-only access to read-only-col+ ;; Grant read-only access to read-only-col(perms/grant-collection-read-permissions! group read-only-col)- ;; Grant write access to write-col+ ;; Grant write access to write-col(perms/grant-collection-readwrite-permissions! group write-col)- ;; No permissions for no-access-col (implicitly)+ ;; No permissions for no-access-col (implicitly)(testing "GET /api/document/:id - :rasta can read documents from collections with write access"(mt/with-temp [:model/Document {doc-id :id} {:name "Write Access Document"@@ -1404,13 +1404,13 @@:model/Collection {write-col :id} {:name "Write Collection"}:model/Collection {no-access-col :id} {:name "No Access Collection"}]- ;; Set up permissions for :rasta user+ ;; Set up permissions for :rasta user(mt/with-group-for-user [group :rasta {:name "Rasta Group"}]- ;; Grant read-only access to read-only-col+ ;; Grant read-only access to read-only-col(perms/grant-collection-read-permissions! group read-only-col)- ;; Grant write access to write-col+ ;; Grant write access to write-col(perms/grant-collection-readwrite-permissions! group write-col)- ;; No permissions for no-access-col (implicitly)+ ;; No permissions for no-access-col (implicitly)(testing "GET /api/document - :rasta only sees documents from accessible collections"(mt/with-temp [:model/Document _ {:name "Doc in Write Collection"@@ -1449,7 +1449,7 @@{:archived true})](is (true? (:archived result)))- ;; Verify document is actually archived in database+ ;; Verify document is actually archived in database(is (true? (:archived (t2/select-one :model/Document :id doc-id))))))(testing "archived document doesn't appear in normal listings"@@ -1462,7 +1462,7 @@{:archived false})](is (false? (:archived result)))- ;; Verify document is actually unarchived in database+ ;; Verify document is actually unarchived in database(is (false? (:archived (t2/select-one :model/Document :id doc-id)))))))))(deftest document-archive-with-cards-test@@ -1488,14 +1488,14 @@:put 200 (format "document/%s" doc-id){:archived true})- ;; Verify document is archived+ ;; Verify document is archived(is (true? (:archived (t2/select-one :model/Document :id doc-id))))- ;; Verify associated cards are archived+ ;; Verify associated cards are archived(is (true? (:archived (t2/select-one :model/Card :id card1-id))))(is (true? (:archived (t2/select-one :model/Card :id card2-id))))- ;; Verify non-associated card is NOT archived+ ;; Verify non-associated card is NOT archived(is (false? (:archived (t2/select-one :model/Card :id other-card-id)))))(testing "unarchiving document unarchives associated cards"@@ -1503,14 +1503,14 @@:put 200 (format "document/%s" doc-id){:archived false})- ;; Verify document is unarchived+ ;; Verify document is unarchived(is (false? (:archived (t2/select-one :model/Document :id doc-id))))- ;; Verify associated cards are unarchived+ ;; Verify associated cards are unarchived(is (false? (:archived (t2/select-one :model/Card :id card1-id))))(is (false? (:archived (t2/select-one :model/Card :id card2-id))))- ;; Verify other card remains unchanged+ ;; Verify other card remains unchanged(is (false? (:archived (t2/select-one :model/Card :id other-card-id))))))))(deftest document-archive-permissions-test@@ -1526,9 +1526,9 @@:collection_id write-col}](mt/with-group-for-user [group :rasta]- ;; Grant read-only access to read-only collection+ ;; Grant read-only access to read-only collection(perms/grant-collection-read-permissions! group read-only-col)- ;; Grant write access to write collection+ ;; Grant write access to write collection(perms/grant-collection-readwrite-permissions! group write-col)(testing "user with write permissions can archive document"@@ -1542,7 +1542,7 @@:put 403 (format "document/%s" read-only-doc-id){:archived true})- ;; Verify document wasn't archived+ ;; Verify document wasn't archived(is (false? (:archived (t2/select-one :model/Document :id read-only-doc-id)))))(testing "user with write permissions can unarchive document"@@ -1577,16 +1577,16 @@:put 200 (format "collection/%s" coll-id){:archived true})- ;; Verify collection is archived+ ;; Verify collection is archived(is (true? (:archived (t2/select-one :model/Collection :id coll-id))))- ;; Verify documents are archived (not directly)+ ;; Verify documents are archived (not directly)(is (true? (:archived (t2/select-one :model/Document :id doc1-id))))(is (false? (:archived_directly (t2/select-one :model/Document :id doc1-id))))(is (true? (:archived (t2/select-one :model/Document :id doc2-id))))(is (false? (:archived_directly (t2/select-one :model/Document :id doc2-id))))- ;; Verify all cards are archived (not directly)+ ;; Verify all cards are archived (not directly)(is (true? (:archived (t2/select-one :model/Card :id card1-id))))(is (false? (:archived_directly (t2/select-one :model/Card :id card1-id))))(is (true? (:archived (t2/select-one :model/Card :id card2-id))))@@ -1599,14 +1599,14 @@:put 200 (format "collection/%s" coll-id){:archived false})- ;; Verify collection is unarchived+ ;; Verify collection is unarchived(is (false? (:archived (t2/select-one :model/Collection :id coll-id))))- ;; Verify documents are unarchived+ ;; Verify documents are unarchived(is (false? (:archived (t2/select-one :model/Document :id doc1-id))))(is (false? (:archived (t2/select-one :model/Document :id doc2-id))))- ;; Verify cards are unarchived+ ;; Verify cards are unarchived(is (false? (:archived (t2/select-one :model/Card :id card1-id))))(is (false? (:archived (t2/select-one :model/Card :id card2-id))))(is (false? (:archived (t2/select-one :model/Card :id standalone-card-id))))))))@@ -1646,7 +1646,7 @@(is (false? (:archived card)))(is (false? (:archived_directly card)))))- ;; Archive via collection to test indirect archiving+ ;; Archive via collection to test indirect archiving(testing "indirectly archiving via collection sets archived_directly=false"(mt/user-http-request :crowberto:put 200 (format "collection/%s" coll-id)@@ -1660,7 +1660,7 @@(is (false? (:archived_directly card)))))(testing "directly archived documents stay archived when collection is unarchived"- ;; First, directly archive the document+ ;; First, directly archive the document(mt/user-http-request :crowberto:put 200 (format "document/%s" doc-id){:archived false})@@ -1668,12 +1668,12 @@:put 200 (format "document/%s" doc-id){:archived true})- ;; Then unarchive the collection+ ;; Then unarchive the collection(mt/user-http-request :crowberto:put 200 (format "collection/%s" coll-id){:archived false})- ;; Document should remain archived because it was archived directly+ ;; Document should remain archived because it was archived directly(let [doc (t2/select-one :model/Document :id doc-id)card (t2/select-one :model/Card :id card-id)](is (true? (:archived doc)))@@ -1699,10 +1699,10 @@(is (not (contains? document-names "Archived Document")))))(testing "GET /api/document/:id returns 200 for archived documents"- ;; Active document should be accessible+ ;; Active document should be accessible(mt/user-http-request :crowberto :get 200 (format "document/%s" active-doc-id))- ;; Archived document should return 404+ ;; Archived document should return 404(mt/user-http-request :crowberto :get 200 (format "document/%s" archived-doc-id)))(testing "Collection items endpoint excludes archived documents"@@ -1725,7 +1725,7 @@:put 200 (format "document/%s" doc-id){:archived true})- ;; Should have published document-archive event+ ;; Should have published document-archive event(is (some #(= :event/document-delete (:topic %)) @events))))))(testing "unarchiving document publishes update event"@@ -1737,7 +1737,7 @@:put 200 (format "document/%s" doc-id){:archived false})- ;; Should have published document-update event (not archive event)+ ;; Should have published document-update event (not archive event)(is (some #(= :event/document-update (:topic %)) @events))(is (not (some #(= :event/document-delete (:topic %)) @events))))))))))@@ -1749,7 +1749,7 @@:document_id doc-id:dataset_query (mt/mbql-query venues)}]- ;; Simulate a failure during card archiving+ ;; Simulate a failure during card archiving(testing "failure during card archiving rolls back document archiving"(let [orig-update! (mt/original-fn #'t2/update!)](mt/with-dynamic-fn-redefs [t2/update! (fn [model id updates]@@ -1789,15 +1789,15 @@:put 200 (format "collection/%s" coll-id){:archived false})- ;; Directly archived document should remain archived+ ;; Directly archived document should remain archived(is (true? (:archived (t2/select-one :model/Document :id directly-archived-doc))))(is (true? (:archived_directly (t2/select-one :model/Document :id directly-archived-doc))))- ;; Collection archived document should be unarchived+ ;; Collection archived document should be unarchived(is (false? (:archived (t2/select-one :model/Document :id collection-archived-doc))))(is (false? (:archived_directly (t2/select-one :model/Document :id collection-archived-doc))))- ;; Active document should remain active+ ;; Active document should remain active(is (false? (:archived (t2/select-one :model/Document :id active-doc))))))))(deftest document-archive-edge-cases-test@@ -1827,7 +1827,7 @@(mt/with-temp [:model/Document {doc-id :id} {:name "Document in Trash":document (documents.test-util/text->prose-mirror-ast "In trash"):collection_id trash-collection-id}]- ;; Should be able to archive document in trash+ ;; Should be able to archive document in trash(let [result (mt/user-http-request :crowberto:put 200 (format "document/%s" doc-id){:archived true})]@@ -1840,7 +1840,7 @@:put 200 (format "document/%s" doc-id){:archived true})](is (true? (:archived result)))- ;; Should not fail even with no associated cards+ ;; Should not fail even with no associated cards(is (zero? (t2/count :model/Card :document_id doc-id))))))(testing "archiving and updating other fields simultaneously"@@ -1863,7 +1863,7 @@(testing "can delete archived document"(mt/user-http-request :crowberto :delete (format "document/%s" doc-id))- ;; Verify document is actually deleted from database+ ;; Verify document is actually deleted from database(is (nil? (t2/select-one :model/Document :id doc-id))))(testing "cannot delete same document twice"@@ -1877,7 +1877,7 @@(testing "returns 400 error when trying to delete non-archived document"(mt/user-http-request :crowberto :delete 400 (format "document/%s" doc-id))- ;; Verify document still exists+ ;; Verify document still exists(is (some? (t2/select-one :model/Document :id doc-id)))))))(deftest delete-document-permissions-test@@ -1895,21 +1895,21 @@:archived true}](mt/with-group-for-user [group :rasta]- ;; Grant read-only access to read-only collection+ ;; Grant read-only access to read-only collection(perms/grant-collection-read-permissions! group read-only-col)- ;; Grant write access to write collection+ ;; Grant write access to write collection(perms/grant-collection-readwrite-permissions! group write-col)(testing "user with write permissions can delete archived document"(mt/user-http-request :rasta :delete (format "document/%s" write-doc-id))- ;; Verify document is deleted+ ;; Verify document is deleted(is (nil? (t2/select-one :model/Document :id write-doc-id))))(testing "user without write permissions cannot delete archived document"(mt/user-http-request :rasta :delete 403 (format "document/%s" read-only-doc-id))- ;; Verify document still exists+ ;; Verify document still exists(is (some? (t2/select-one :model/Document :id read-only-doc-id)))))))))(deftest delete-document-with-cards-test@@ -1936,14 +1936,14 @@(testing "deleting document also deletes associated cards via cascade"(mt/user-http-request :crowberto :delete (format "document/%s" doc-id))- ;; Verify document is deleted+ ;; Verify document is deleted(is (nil? (t2/select-one :model/Document :id doc-id)))- ;; Verify associated cards are deleted (assuming CASCADE DELETE in schema)+ ;; Verify associated cards are deleted (assuming CASCADE DELETE in schema)(is (nil? (t2/select-one :model/Card :id card1-id)))(is (nil? (t2/select-one :model/Card :id card2-id)))- ;; Verify non-associated card still exists+ ;; Verify non-associated card still exists(is (some? (t2/select-one :model/Card :id other-card-id)))))))(deftest delete-document-nonexistent-test@@ -1960,7 +1960,7 @@(swap! events conj {:topic topic :event event}))](mt/user-http-request :crowberto :delete 204 (format "document/%s" doc-id))- ;; Should have published document-delete event+ ;; Should have published document-delete event(is (some #(= :event/document-delete (:topic %)) @events))(let [delete-event (first (filter #(= :event/document-delete (:topic %)) @events))](is (= "Event Test Document" (get-in delete-event [:event :object :name])))@@ -2346,11 +2346,11 @@(t2/update! :model/Card card-id {:document_id doc-id})(let [all-users-group (perms/all-users-group)]- ;; Grant collection read permissions so user can access the document+ ;; Grant collection read permissions so user can access the document(perms/grant-collection-read-permissions! all-users-group coll-id)(testing "User without download permissions yields permissions error"- ;; Set download permissions to :no (no downloads allowed) for All Users group+ ;; Set download permissions to :no (no downloads allowed) for All Users group(data-perms/set-database-permission! all-users-group (mt/id) :perms/download-results :no)(is (malli= [:map@@ -2612,7 +2612,7 @@{:collection_id remote-synced-id})](is (= "Uses content that is not remote synced." (:message response)))- ;; Verify document was NOT moved+ ;; Verify document was NOT moved(is (= regular-id (:collection_id (t2/select-one :model/Document :id doc-id)))"Document should remain in regular collection"))))))))diff --git a/test/metabase/documents/recent_views_test.clj b/test/metabase/documents/recent_views_test.cljindex b218f86a50e..21b32b29aa2 100644--- a/test/metabase/documents/recent_views_test.clj+++ b/test/metabase/documents/recent_views_test.clj@@ -159,10 +159,10 @@:model/Document {doc-id :id} {:name "Test Document":collection_id coll-id:archived false}]- ;; Add document to recent views+ ;; Add document to recent views(activity-feed/update-users-recent-views! (mt/user->id :rasta) :model/Document doc-id :view)- ;; Call the API+ ;; Call the API(let [response (mt/user-http-request :rasta :get 200 "activity/recents" :context [:views])](is (some #(and (= (:model %) "document")(= (:id %) doc-id)diff --git a/test/metabase/driver/mysql_test.clj b/test/metabase/driver/mysql_test.cljindex bc930d617ce..0d47d89be59 100644--- a/test/metabase/driver/mysql_test.clj+++ b/test/metabase/driver/mysql_test.clj@@ -403,9 +403,9 @@(jdbc/execute! spec [sql]))true(catch java.sql.SQLSyntaxErrorException se- ;; if an error is received with SYSTEM VERSIONING mentioned, the version- ;; of mysql or mariadb being tested against does not support system versioning,- ;; so do not continue+ ;; if an error is received with SYSTEM VERSIONING mentioned, the version+ ;; of mysql or mariadb being tested against does not support system versioning,+ ;; so do not continue(if (re-matches #".*VERSIONING'.*" (.getMessage se))false(throw se))))]diff --git a/test/metabase/driver/sql_jdbc/connection_test.clj b/test/metabase/driver/sql_jdbc/connection_test.cljindex 92c777e5187..442206863cd 100644--- a/test/metabase/driver/sql_jdbc/connection_test.clj+++ b/test/metabase/driver/sql_jdbc/connection_test.clj@@ -85,7 +85,7 @@(mt/with-temp [:model/Database database {:engine :h2, :details connection-details}](let [cache-key (pool-cache-key database)](testing "database id is not in our connection map initially"- ;; deref'ing a var to get the atom. looks weird+ ;; deref'ing a var to get the atom. looks weird(is (not (contains? @@#'sql-jdbc.conn/pool-cache-key->connection-pool cache-key))))(testing "when getting a pooled connection it is now in our connection map"(let [stored-spec (sql-jdbc.conn/db->pooled-connection-spec database)@@ -106,21 +106,21 @@(let [read-details {:db "mem:read_pool_test"}write-details {:db "mem:write_pool_test"}spec (mdb/spec :h2 read-details)]- ;; Create an in-memory H2 db we can use for the test+ ;; Create an in-memory H2 db we can use for the test(sql-jdbc.execute/do-with-connection-with-options:h2spec{:write? true}(fn [conn](next.jdbc/execute! conn ["CREATE TABLE IF NOT EXISTS test_tbl (id int)"])- ;; Use snake_case for column name since deftransforms uses snake_case keys+ ;; Use snake_case for column name since deftransforms uses snake_case keys(mt/with-temp [:model/Database database {:engine :h2:details read-details:write_data_details write-details}](let [db-id (u/the-id database)default-cache-key [db-id :default]write-cache-key [db-id :write-data]]- ;; Ensure pools are cleared+ ;; Ensure pools are cleared(sql-jdbc.conn/invalidate-pool-for-db! database)(testing "initially no pools exist"@@ -145,7 +145,7 @@(is (some? write-pool))(is (not (identical? default-pool write-pool)))))- ;; Cleanup+ ;; Cleanup(sql-jdbc.conn/invalidate-pool-for-db! database)))))))))))(deftest write-connection-reuses-default-pool-when-unconfigured-test@@ -177,12 +177,12 @@(testing "Write connection pool uses :write-data-details when available"(let [read-details {:db "mem:read_details_db"}write-details {:db "mem:write_details_db"}]- ;; Use snake_case for column name since deftransforms uses snake_case keys+ ;; Use snake_case for column name since deftransforms uses snake_case keys(mt/with-temp [:model/Database database {:engine :h2:details read-details:write_data_details write-details}](let [db-id (u/the-id database)]- ;; Ensure pools are cleared+ ;; Ensure pools are cleared(sql-jdbc.conn/invalidate-pool-for-db! database)(testing "jdbc-spec-hash differs between default and write connection types"@@ -195,7 +195,7 @@"Hash should differ because effective-details returns different details")))(testing "hash cache uses composite keys"- ;; Get both pools+ ;; Get both pools(sql-jdbc.conn/db->pooled-connection-spec database)(driver.conn/with-write-connection(sql-jdbc.conn/db->pooled-connection-spec database))@@ -206,7 +206,7 @@(is (some? write-cached-hash))(is (not= default-cached-hash write-cached-hash))))- ;; Cleanup+ ;; Cleanup(sql-jdbc.conn/invalidate-pool-for-db! database)))))))))(deftest invalidate-pool-clears-all-connection-types-test@@ -487,8 +487,8 @@(assoc :use-auth-provider true:auth-provider :azure-managed-identity:azure-managed-identity-client-id "client ID"))- ;; we return an expired token which forces a renewal when a second connection is requested- ;; (the first time it is used without checking for expiry)+ ;; we return an expired token which forces a renewal when a second connection is requested+ ;; (the first time it is used without checking for expiry)expires-in (atom "0")connection-creations (atom 0)](binding [u.http/*fetch-as-json* (fn [url _headers]@@ -499,16 +499,16 @@(mt/with-temp [:model/Database oauth-db {:engine (tx/driver), :details oauth-db-details}](mt/with-db oauth-db(try- ;; since Metabase is running and using the pool of this DB, the sync might fail- ;; if the connection pool is shut down during the sync+ ;; since Metabase is running and using the pool of this DB, the sync might fail+ ;; if the connection pool is shut down during the sync(sync/sync-database! (mt/db))(catch Exception _))- ;; after "fixing" the expiry, we should get a connection from a pool that doesn't get shut down+ ;; after "fixing" the expiry, we should get a connection from a pool that doesn't get shut down(reset! expires-in "10000")(sync/sync-database! (mt/db))(is (= [["Polo Lounge"]](mt/rows (mt/run-mbql-query venues {:filter [:= $id 60] :fields [$name]}))))- ;; we must have created more than one connection+ ;; we must have created more than one connection(is (> @connection-creations 1))))))))))#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}diff --git a/test/metabase/driver/sql_jdbc/execute_test.clj b/test/metabase/driver/sql_jdbc/execute_test.cljindex 5f4dd552e63..16d73f5681b 100644--- a/test/metabase/driver/sql_jdbc/execute_test.clj+++ b/test/metabase/driver/sql_jdbc/execute_test.clj@@ -33,15 +33,15 @@orig-do-with-resolved-connection-data-source (mt/original-fn #'sql-jdbc.execute/do-with-resolved-connection-data-source)](mt/with-dynamic-fn-redefs [sql-jdbc.execute/do-with-resolved-connection-data-source(fn [driver db opts]- ;; Only count connections for our test database because on startup the audit-db will be- ;; synced, which causes this to fail intermittently because it creates connections (to db- ;; 13371337)+ ;; Only count connections for our test database because on startup the audit-db will be+ ;; synced, which causes this to fail intermittently because it creates connections (to db+ ;; 13371337)(if (= db test-db-id)(reify javax.sql.DataSource(getConnection [_](vswap! connection-count inc)(.getConnection ^DataSource (orig-do-with-resolved-connection-data-source driver db opts))))- ;; For other databases (like audit DB), just pass through+ ;; For other databases (like audit DB), just pass through(orig-do-with-resolved-connection-data-source driver db opts)))](let [closed-conn (doto (.getConnection ^DataSource(orig-do-with-resolved-connection-data-source driver/*driver* test-db-id {}))diff --git a/test/metabase/driver/sql_jdbc/sync/describe_table_test.clj b/test/metabase/driver/sql_jdbc/sync/describe_table_test.cljindex 30a2c6fc778..e7b3b2cdb1f 100644--- a/test/metabase/driver/sql_jdbc/sync/describe_table_test.clj+++ b/test/metabase/driver/sql_jdbc/sync/describe_table_test.clj@@ -479,9 +479,9 @@(mt/defdataset long-json[["long_json_table"- ;; `short_json` and `long_json` have the same schema,- ;; in the first row, both have an "a" key.- ;; in the second row, both have a "b" key, except `long_json` has a longer value.+ ;; `short_json` and `long_json` have the same schema,+ ;; in the first row, both have an "a" key.+ ;; in the second row, both have a "b" key, except `long_json` has a longer value.[{:field-name "short_json", :base-type :type/JSON}{:field-name "long_json", :base-type :type/JSON}][[(json/encode {:a "x"}) (json/encode {:a "x"})]diff --git a/test/metabase/driver_test.clj b/test/metabase/driver_test.cljindex c561eb94f4a..df36216a1f2 100644--- a/test/metabase/driver_test.clj+++ b/test/metabase/driver_test.clj@@ -249,15 +249,15 @@(testing "The formatted JSON-like string is equivalent to the query"(is (= query (json/decode formatted-query))))- ;; TODO(qnkhuat): do we really need to handle case where wrong driver is passed?+ ;; TODO(qnkhuat): do we really need to handle case where wrong driver is passed?(let [;; This is a mongodb query, but if you pass in the wrong driver it will attempt the format- ;; This is a corner case since the system should always be using the right driver+ ;; This is a corner case since the system should always be using the right driverweird-formatted-query (driver/prettify-native-form :postgres (json/encode query))](testing "The wrong formatter will change the format..."(is (not= query weird-formatted-query)))(testing "...but the resulting data is still the same"- ;; Bottom line - Use the right driver, but if you use the wrong- ;; one it should be harmless but annoying+ ;; Bottom line - Use the right driver, but if you use the wrong+ ;; one it should be harmless but annoying(is (= query(json/decode weird-formatted-query))))))))diff --git a/test/metabase/embedding_rest/api/embed_test.clj b/test/metabase/embedding_rest/api/embed_test.cljindex 13128787693..87bab145b03 100644--- a/test/metabase/embedding_rest/api/embed_test.clj+++ b/test/metabase/embedding_rest/api/embed_test.clj@@ -233,10 +233,10 @@(deftest parameters-should-include-legacy-template-tags(testing "parameters should get from both template-tags and card.parameters"- ;; in 44 we added card.parameters but we didn't migrate template-tags to parameters- ;; because doing such migration is costly.- ;; so there are cards where some parameters in template-tags does not exist in card.parameters- ;; that why we need to keep concat both of them then dedupe by id+ ;; in 44 we added card.parameters but we didn't migrate template-tags to parameters+ ;; because doing such migration is costly.+ ;; so there are cards where some parameters in template-tags does not exist in card.parameters+ ;; that why we need to keep concat both of them then dedupe by id(with-embedding-enabled-and-new-secret-key!(with-temp-card [card (public-test/card-with-embedded-params)](is (= [;; the parameter with id = "c" exists in both card.parameters and tempalte-tags should have info@@ -247,13 +247,13 @@:target ["variable" ["template-tag" "c"]],:name "c",:slug "c",- ;; order importance: the default from template-tag is in the final result+ ;; order importance: the default from template-tag is in the final result:default "C TAG":required false:values_source_type "static-list":values_source_config {:values ["BBQ" "Bakery" "Bar"]}}- ;; the parameter id = "d" is in template-tags, but not card.parameters,- ;; when fetching card we should get it returned+ ;; the parameter id = "d" is in template-tags, but not card.parameters,+ ;; when fetching card we should get it returned{:id "d",:type "date/single",:target ["variable" ["template-tag" "d"]],diff --git a/test/metabase/lib/card_test.cljc b/test/metabase/lib/card_test.cljcindex f556ef8cdc9..208ff443584 100644--- a/test/metabase/lib/card_test.cljc+++ b/test/metabase/lib/card_test.cljc@@ -688,7 +688,7 @@model-query (lib/query meta/metadata-provider (meta/table-metadata :orders))mp (lib.tu/mock-metadata-providermeta/metadata-provider- ;; intentionally omitting `:dataset-query`+ ;; intentionally omitting `:dataset-query`{:cards [{:id model-id:type :model:database-id (meta/id)diff --git a/test/metabase/lib/drill_thru/automatic_insights_test.cljc b/test/metabase/lib/drill_thru/automatic_insights_test.cljcindex 4245df72986..3dbc8cb61c2 100644--- a/test/metabase/lib/drill_thru/automatic_insights_test.cljc+++ b/test/metabase/lib/drill_thru/automatic_insights_test.cljc@@ -57,7 +57,7 @@(and (not (:native? test-case))(or ;; Any pivot or legend click is good.(#{:pivot :legend} click)- ;; As are cell clicks with at least 1 breakout.+ ;; As are cell clicks with at least 1 breakout.(and (= click :cell)(seq (:dimensions context))))))))(testing "not available at all with xrays disabled"diff --git a/test/metabase/lib/drill_thru/column_extract_test.cljc b/test/metabase/lib/drill_thru/column_extract_test.cljcindex 698a9c3e03e..56c81db5a02 100644--- a/test/metabase/lib/drill_thru/column_extract_test.cljc+++ b/test/metabase/lib/drill_thru/column_extract_test.cljc@@ -59,7 +59,7 @@:drill-type :drill-thru/column-extract:expected {:type :drill-thru/column-extract:extractions datetime-extraction-units- ;; Query unchanged+ ;; Query unchanged:query (get-in lib.drill-thru.tu/test-queries ["ORDERS" :unaggregated :query]):stage-number -1}:drill-args ["month-of-year"]@@ -167,11 +167,11 @@:expected-query {:stages [{:expressions [;; The original[:get-day {:lib/expression-name "Day of month"}exp-created-at]- ;; The newly added one+ ;; The newly added one[:get-day {:lib/expression-name "Day of month_2"}exp-created-at]]}]}- ;; With a native base, the name gets disambiguated, but there's only one expression rather than 2,- ;; because the original is part of the native query.+ ;; With a native base, the name gets disambiguated, but there's only one expression rather than 2,+ ;; because the original is part of the native query.:expected-native {:stages [{:expressions [;; The newly added one[:get-day {:lib/expression-name "Day of month_2"}exp-created-at]]}]}}))))@@ -196,10 +196,10 @@:stage-number -1}:drill-query-native native:drill-args ["day-of-month"]- ;; Aggregated MBQL queries need a new stage appended.+ ;; Aggregated MBQL queries need a new stage appended.:expected-query {:stages [(get-in query [:stages 0])exprs]}- ;; Wrapped native queries have the expression on their only stage.+ ;; Wrapped native queries have the expression on their only stage.:expected-native {:stages [(merge (get-in native [:stages 0])exprs)]}}))))diff --git a/test/metabase/lib/drill_thru/fk_details_test.cljc b/test/metabase/lib/drill_thru/fk_details_test.cljcindex 533992f6779..6ef84d69a09 100644--- a/test/metabase/lib/drill_thru/fk_details_test.cljc+++ b/test/metabase/lib/drill_thru/fk_details_test.cljc@@ -152,7 +152,7 @@(let [provider (merged-mock/merged-mock-metadata-providermeta/metadata-provider{:fields [;; Make Checkins.VENUE_ID + Checkins.USER_ID into a two-part primary key.- ;; Turn Checkins.ID into a basic numeric field.+ ;; Turn Checkins.ID into a basic numeric field.{:id (meta/id :checkins :id):semantic-type :type/Quantity}{:id (meta/id :checkins :venue-id)@@ -162,7 +162,7 @@:semantic-type :type/PK:fk-target-field-id nil}- ;; Then turn Orders.USER_ID and Orders.PRODUCT_ID into FKs pointing at Checkins.+ ;; Then turn Orders.USER_ID and Orders.PRODUCT_ID into FKs pointing at Checkins.{:id (meta/id :orders :user-id):semantic-type :type/FK:fk-target-field-id (meta/id :checkins :user-id)}@@ -187,8 +187,8 @@:expected {:type :drill-thru/fk-details:column {:name "PRODUCT_ID"}:object-id venue-id- ;; TODO: This field actually refers to the source table, not the target one. Is that right?- ;; Tech Debt Issue: #39409+ ;; TODO: This field actually refers to the source table, not the target one. Is that right?+ ;; Tech Debt Issue: #39409:many-pks? false}:expected-query {:stages [{:filters [[:= {} exp-venue-id venue-id]]}]}}))diff --git a/test/metabase/lib/drill_thru/pivot_test.cljc b/test/metabase/lib/drill_thru/pivot_test.cljcindex d9518ed7b2f..a1d0d583505 100644--- a/test/metabase/lib/drill_thru/pivot_test.cljc+++ b/test/metabase/lib/drill_thru/pivot_test.cljc@@ -26,10 +26,10 @@:drill-thru/pivot(fn [_test-case _context {:keys [click]}](if (= click :cell)- ;; The pivot conditions are too complex to capture here; other tests check them.- ;; Just skip the canned cases for cell clicks.+ ;; The pivot conditions are too complex to capture here; other tests check them.+ ;; Just skip the canned cases for cell clicks.::canned/skip- ;; Non-cell clicks are false though.+ ;; Non-cell clicks are false though.false)))))(def ^:private orders-date-only-test-casediff --git a/test/metabase/lib/drill_thru/pk_test.cljc b/test/metabase/lib/drill_thru/pk_test.cljcindex 4d495fcc282..9d6f5b1d72b 100644--- a/test/metabase/lib/drill_thru/pk_test.cljc+++ b/test/metabase/lib/drill_thru/pk_test.cljc@@ -25,8 +25,8 @@(canned/canned-test:drill-thru/pk(fn [_test-case _context {:keys [click]}]- ;; Tricky logic, so other tests check the cell clicks.- ;; Non-cell clicks are not available.+ ;; Tricky logic, so other tests check the cell clicks.+ ;; Non-cell clicks are not available.(if (= click :cell)::canned/skipfalse))))diff --git a/test/metabase/lib/drill_thru/underlying_records_test.cljc b/test/metabase/lib/drill_thru/underlying_records_test.cljcindex d97815e3a01..a3cdcd7ba8d 100644--- a/test/metabase/lib/drill_thru/underlying_records_test.cljc+++ b/test/metabase/lib/drill_thru/underlying_records_test.cljc@@ -28,15 +28,15 @@(canned/canned-test:drill-thru/underlying-records(fn [test-case context {:keys [click column-kind]}]- ;; TODO: The docs claim that underlying-records works on pivot cells, and so it does, but the so-called pivot case- ;; never occurs in actual pivot tables!- ;; - Clicks on row/column "headers", (that is, breakout values like a month or product category) look like regular- ;; cell clicks (column and value set per the breakout, no :dimensions).- ;; - Clicks on cells (that is, aggregation values) have column, column-ref and value all nil, and :dimensions- ;; contains all the breakouts (not exactly 2 as claimed in the spec).- ;; That all makes sense to me (Braden) and I think this is a bug in the docs, but it also might be a bug in the FE- ;; code that should be setting the aggregation :value for cell clicks?- ;; Tech debt issue: #39380+ ;; TODO: The docs claim that underlying-records works on pivot cells, and so it does, but the so-called pivot case+ ;; never occurs in actual pivot tables!+ ;; - Clicks on row/column "headers", (that is, breakout values like a month or product category) look like regular+ ;; cell clicks (column and value set per the breakout, no :dimensions).+ ;; - Clicks on cells (that is, aggregation values) have column, column-ref and value all nil, and :dimensions+ ;; contains all the breakouts (not exactly 2 as claimed in the spec).+ ;; That all makes sense to me (Braden) and I think this is a bug in the docs, but it also might be a bug in the FE+ ;; code that should be setting the aggregation :value for cell clicks?+ ;; Tech debt issue: #39380(and (#{:cell #_:pivot :legend} click)(not (:native? test-case))(or (seq (:dimensions context))diff --git a/test/metabase/lib/drill_thru/zoom_in_bins_test.cljc b/test/metabase/lib/drill_thru/zoom_in_bins_test.cljcindex 43f219f4579..8608215284c 100644--- a/test/metabase/lib/drill_thru/zoom_in_bins_test.cljc+++ b/test/metabase/lib/drill_thru/zoom_in_bins_test.cljc@@ -170,7 +170,7 @@:custom-row {"count" 100"QUANTITY" 10"CREATED_AT" "2024-09-08T22:03:20.239+03:00"}- ;; TODO: Clicking on breakout columns in table views doesn't work properly.+ ;; TODO: Clicking on breakout columns in table views doesn't work properly.:column-name "count":drill-type :drill-thru/zoom-in.binning:expected {:type :drill-thru/zoom-in.binningdiff --git a/test/metabase/lib/drill_thru/zoom_in_geographic_test.cljc b/test/metabase/lib/drill_thru/zoom_in_geographic_test.cljcindex 0bffa0ea3d6..064baed31da 100644--- a/test/metabase/lib/drill_thru/zoom_in_geographic_test.cljc+++ b/test/metabase/lib/drill_thru/zoom_in_geographic_test.cljc@@ -144,7 +144,7 @@(testing "If there are already breakouts on lat/lon, we should update them rather than append new ones (#34874)"(let [query (-> (lib/query meta/metadata-provider (meta/table-metadata :people))(lib/aggregate (lib/count))- ;; make sure we don't remove other, irrelevant breakouts.+ ;; make sure we don't remove other, irrelevant breakouts.(lib/breakout (meta/field-metadata :people :name))(lib/breakout (meta/field-metadata :people :state))(lib/breakout (-> (meta/field-metadata :people :latitude)diff --git a/test/metabase/lib/drill_thru/zoom_test.cljc b/test/metabase/lib/drill_thru/zoom_test.cljcindex 87fbbe5afe4..9e828283d9a 100644--- a/test/metabase/lib/drill_thru/zoom_test.cljc+++ b/test/metabase/lib/drill_thru/zoom_test.cljc@@ -16,14 +16,14 @@(fn [test-case {:keys [value]} {:keys [click column-type]}](and (= click :cell)(not (:native? test-case))- ;; With an FK column and a non-NULL value, this will be an fk-filter drill instead.- ;; So we don't expect a zoom drill in that case.+ ;; With an FK column and a non-NULL value, this will be an fk-filter drill instead.+ ;; So we don't expect a zoom drill in that case.(not (and (= column-type :fk)(some? value)(not= value :null)))- ;; PK must be in the result set; if not, no zoom drill. This happens for eg. aggregations.+ ;; PK must be in the result set; if not, no zoom drill. This happens for eg. aggregations.((set (keys (:row test-case))) "ID")- ;; Special case: clicking a NULL PK does not return the zoom drill.+ ;; Special case: clicking a NULL PK does not return the zoom drill.(not (and (= value :null)(= column-type :pk))))))))diff --git a/test/metabase/lib/filter/desugar/jvm_test.clj b/test/metabase/lib/filter/desugar/jvm_test.cljindex a331432f954..f9b93951e68 100644--- a/test/metabase/lib/filter/desugar/jvm_test.clj+++ b/test/metabase/lib/filter/desugar/jvm_test.clj@@ -56,14 +56,14 @@(deftest ^:parallel subdomain-regex-on-urls-test(are [subdomain url] (= subdomain (re-find @#'lib.filter.desugar.jvm/subdomain-regex url))- ;; Blanks. "www" doesn't count.+ ;; Blanks. "www" doesn't count.nil "cdbaby.com"nil "https://fema.gov"nil "http://www.geocities.jp"nil "usa.gov/some/page.cgi.htm"nil "va.gov"- ;; Basics - taking the first segment that isn't "www", IF it isn't the domain.+ ;; Basics - taking the first segment that isn't "www", IF it isn't the domain."sub" "sub.jalbum.net""subdomains" "subdomains.go.here.jalbum.net""log" "log.stuff.gmpg.org"@@ -71,22 +71,22 @@"log" "log.stuff.gmpg.org/some/path""log" "log.stuff.gmpg.org?search=yes"- ;; Oops, we miss these! This is the reverse of the problem when picking the domain.- ;; We can't tell without maintaining a huge list that va and ne are the real domains, and not the trailing- ;; fragments like .co.uk - see below.+ ;; Oops, we miss these! This is the reverse of the problem when picking the domain.+ ;; We can't tell without maintaining a huge list that va and ne are the real domains, and not the trailing+ ;; fragments like .co.uk - see below.nil "taxes.va.gov" ; True domain is va, subdomain is taxes.nil "hatena.ne.jp" ; True domain is ne, subdomain is hatena.- ;; Sometimes the second-last part is a short suffix.- ;; Mozilla maintains a huge list of these, but since this has to go into a regex and get passed to the database,- ;; we use a best-effort matcher that gets the domain right most of the time.+ ;; Sometimes the second-last part is a short suffix.+ ;; Mozilla maintains a huge list of these, but since this has to go into a regex and get passed to the database,+ ;; we use a best-effort matcher that gets the domain right most of the time.nil "telegraph.co.uk"nil "https://telegraph.co.uk"nil "telegraph.co.uk/some/article.php""local" "local.news.telegraph.co.uk"nil "bbc.co.uk#fragment""video" "video.bbc.co.uk"- ;; "www" is disregarded as a possible subdomain.+ ;; "www" is disregarded as a possible subdomain.nil "www.usa.gov"nil "www.dot.va.gov""licensing" "www.licensing.dot.va.gov"))diff --git a/test/metabase/lib/js_test.cljs b/test/metabase/lib/js_test.cljsindex 31141e3fe41..fcccff8cd6b 100644--- a/test/metabase/lib/js_test.cljs+++ b/test/metabase/lib/js_test.cljs@@ -36,8 +36,8 @@#js ["field" 5 nil]#js ["field" 6 nil]#js ["field" 7 nil]]}}- ;; Note that the order is not relevant; they get grouped.- ;; Duplicates are okay, and are tracked.+ ;; Note that the order is not relevant; they get grouped.+ ;; Duplicates are okay, and are tracked.field-ids #js [1 2 6 7 3 5 4 4 4]](is (not (lib.js/query= q1 q2))"the field-ids must be provided to populate q1")@@ -400,15 +400,15 @@true truefalse false- ;; Objects+ ;; Objects#js {:foo "bar"}#js {:foo "bar"}#js {:foo "bar", :baz "quux"}#js {:foo "bar", :baz "quux"}- ;; Arrays+ ;; Arrays#js ["foo" #js [1 2 3]]#js ["foo" #js [1 2 3]]- ;; Nesting+ ;; Nesting#js [#js {:foo "bar", :baz #js [4 5]}, #js [1 2 3]]#js [#js {:foo "bar", :baz #js [4 5]}, #js [1 2 3]]))@@ -422,19 +422,19 @@true falsefalse 7- ;; Objects+ ;; Objects#js {:foo "bar"} #js {:foo "baz"} ; Different value#js {:foo "bar"} #js {} ; Missing an a key in b#js {} #js {:foo "bar"} ; Missing a b key in a#js {:foo nil} #js {} ; Missing is not the same as present-but-nil#js {} #js {:foo nil} ; And likewise in reverse- ;; Arrays+ ;; Arrays#js ["foo" "bar"] #js ["foo" "baz"] ; Different values#js ["foo" "bar"] #js ["foo"] ; Different lengths#js ["foo"] #js ["foo" "bar"]- ;; Nesting+ ;; Nesting#js [#js {:foo "bar", :baz #js [4 5 6]}, #js [1 2 3]]#js [#js {:foo "bar", :baz #js [4 5]}, #js [1 2 3]]))))diff --git a/test/metabase/lib/metadata/result_metadata_test.cljc b/test/metabase/lib/metadata/result_metadata_test.cljcindex c38eae5e822..4eb5084f2bc 100644--- a/test/metabase/lib/metadata/result_metadata_test.cljc+++ b/test/metabase/lib/metadata/result_metadata_test.cljc@@ -857,9 +857,9 @@{:name "a", :base-type :type/*, :effective-type :type/*}{:name "a", :base-type :type/Integer}]:let [expected-base-type (if (= (:base-type initial-metadata) :type/Integer)- ;; if the initial driver type comes back as something other than `:type/*`, we- ;; should use that. Otherwise if it comes back as `:type/*` use the type- ;; calculated by Lib.+ ;; if the initial driver type comes back as something other than `:type/*`, we+ ;; should use that. Otherwise if it comes back as `:type/*` use the type+ ;; calculated by Lib.:type/Integer:type/BigInteger)]];; should work with and without rowsdiff --git a/test/metabase/lib/swap_test.cljc b/test/metabase/lib/swap_test.cljcindex e35e8a7fe6b..e224d0db9e3 100644--- a/test/metabase/lib/swap_test.cljc+++ b/test/metabase/lib/swap_test.cljc@@ -26,7 +26,7 @@(= target-clause clause) source-clause:else clause))(clause-fn swapped))- ;; And didn't change anything else.+ ;; And didn't change anything else.(= (m/dissoc-in query [:stages 0 clause-key])(m/dissoc-in swapped [:stages 0 clause-key]))))))))@@ -46,7 +46,7 @@(as-> (lib/query meta/metadata-provider (meta/table-metadata :orders)) $q(lib/breakout $q (meta/field-metadata :products :category))(lib/breakout $q (meta/field-metadata :people :source))- ;; Deliberately including the same field three times: without binning, and with two different binning settings.+ ;; Deliberately including the same field three times: without binning, and with two different binning settings.(lib/breakout $q (meta/field-metadata :orders :subtotal))(lib/breakout $q (lib/with-binning(meta/field-metadata :orders :subtotal)@@ -55,7 +55,7 @@(meta/field-metadata :orders :subtotal)(nth (lib/available-binning-strategies $q (meta/field-metadata :orders :subtotal))2)))- ;; Likewise including multiple temporal buckets.+ ;; Likewise including multiple temporal buckets.(lib/breakout $q (lib/with-temporal-bucket (meta/field-metadata :orders :created-at) :month))(lib/breakout $q (lib/with-temporal-bucket (meta/field-metadata :orders :created-at) :year)))))diff --git a/test/metabase/lib/test_util/huge_query_metadata_providers.cljc b/test/metabase/lib/test_util/huge_query_metadata_providers.cljcindex af07009d423..0c7ad09b5f3 100644--- a/test/metabase/lib/test_util/huge_query_metadata_providers.cljc+++ b/test/metabase/lib/test_util/huge_query_metadata_providers.cljc@@ -743,7 +743,7 @@:table-id table-id:fk-target-field-id fk-target-field-id:has-field-values has-field-values- ;; And now the fixed parts+ ;; And now the fixed parts:lib/type :metadata/column:description nil:database-partitioned nildiff --git a/test/metabase/lib_be/hash_test.clj b/test/metabase/lib_be/hash_test.cljindex 3d46a31046e..045ff8acbc0 100644--- a/test/metabase/lib_be/hash_test.clj+++ b/test/metabase/lib_be/hash_test.clj@@ -242,7 +242,7 @@(lib/aggregate (lib/count))(lib/aggregate (lib/sum (meta/field-metadata :venues :price)))(as-> $q- ;; Add an aggregation expression that references the first two aggregations+ ;; Add an aggregation expression that references the first two aggregations(lib/aggregate $q (lib/+ (lib/aggregation-ref $q 0)(lib/aggregation-ref $q 1))))))diff --git a/test/metabase/login_history/api_test.clj b/test/metabase/login_history/api_test.cljindex e6f703f82d9..69bc4f47866 100644--- a/test/metabase/login_history/api_test.clj+++ b/test/metabase/login_history/api_test.clj@@ -44,7 +44,7 @@:device_id device-id:device_description windows-user-agent:ip_address "52.206.149.9"}- ;; this one shouldn't show up because it's from a different User+ ;; this one shouldn't show up because it's from a different User:model/LoginHistory _ {:timestamp #t "2021-03-17T19:00Z":user_id (mt/user->id :rasta):device_id device-iddiff --git a/test/metabase/measures/models/measure_test.clj b/test/metabase/measures/models/measure_test.cljindex 8841dea5049..2d7760e4309 100644--- a/test/metabase/measures/models/measure_test.clj+++ b/test/metabase/measures/models/measure_test.clj@@ -122,7 +122,7 @@{:name "Bad Measure":table_id (mt/id :venues):creator_id (mt/user->id :rasta)- ;; Metric nested in an arithmetic expression: metric + 1+ ;; Metric nested in an arithmetic expression: metric + 1:definition (measure-definition(lib/+ (lib.metadata/metric mp metric-id)1))})))))))diff --git a/test/metabase/metabot/agent/core_test.clj b/test/metabase/metabot/agent/core_test.cljindex 9bd4fe7a126..438cfe4b225 100644--- a/test/metabase/metabot/agent/core_test.clj+++ b/test/metabase/metabot/agent/core_test.clj@@ -88,7 +88,7 @@(testing "runs agent loop with tool execution"(let [call-count (atom 0)](mt/with-dynamic-fn-redefs [openrouter/openrouter (fn [_]- ;; First call returns tool-input, second returns text+ ;; First call returns tool-input, second returns text(let [n (swap! call-count inc)](if (= 1 n)(mut/mock-llm-response@@ -256,18 +256,18 @@(mt/as-admin(mt/with-temporary-setting-values [llm-metabot-provider test-provider](testing "Scenario 1: Search → Query → Chart (multi-turn happy path)"- ;; User asks: "Show me the first 10 orders"- ;; - Iteration 1: LLM calls search tool to find orders table- ;; - Iteration 2: LLM calls construct_notebook_query to create a raw query- ;; - Iteration 3: LLM returns text with chart link- ;;- ;; We use real tools with only the search backend and LLM mocked.- ;; The construct_notebook_query tool runs real query construction against test DB.- ;; We use a simple "raw" query type that doesn't require field IDs.+ ;; User asks: "Show me the first 10 orders"+ ;; - Iteration 1: LLM calls search tool to find orders table+ ;; - Iteration 2: LLM calls construct_notebook_query to create a raw query+ ;; - Iteration 3: LLM returns text with chart link+ ;;+ ;; We use real tools with only the search backend and LLM mocked.+ ;; The construct_notebook_query tool runs real query construction against test DB.+ ;; We use a simple "raw" query type that doesn't require field IDs.(mt/with-current-user (mt/user->id :crowberto)(let [orders-table-id (mt/id :orders)- ;; Look up database + schema + table name so we can write the portable FK- ;; that the representations-format construct_notebook_query expects.+ ;; Look up database + schema + table name so we can write the portable FK+ ;; that the representations-format construct_notebook_query expects.orders-table (t2/select-one :model/Table :id orders-table-id)db-name (t2/select-one-fn :name :model/Database :id (mt/id))orders-fk [db-name (:schema orders-table) (:name orders-table)]@@ -276,9 +276,9 @@:stages [{:lib/type "mbql.stage/mbql":source-table orders-fk:limit 10}]}- ;; Track LLM calls+ ;; Track LLM callsllm-call-count (atom 0)- ;; Scripted LLM responses - uses real table ID from test DB+ ;; Scripted LLM responses - uses real table ID from test DBllm-responses[;; Iteration 1: Search for orders table[{:type :start :id "msg-1"}@@ -289,7 +289,7 @@:keyword_queries ["orders"]:entity_types ["table"]}}{:type :usage :usage {:promptTokens 100 :completionTokens 20} :model "test" :id "msg-1"}]- ;; Iteration 2: Construct a simple query via the representations YAML format+ ;; Iteration 2: Construct a simple query via the representations YAML format[{:type :start :id "msg-2"}{:type :tool-input:id "call-construct-1"@@ -298,13 +298,13 @@:query external-query:visualization {:chart_type "table"}}}{:type :usage :usage {:promptTokens 200 :completionTokens 30} :model "test" :id "msg-2"}]- ;; Iteration 3: Final text response+ ;; Iteration 3: Final text response[{:type :start :id "msg-3"}{:type :text:text "Here are the first 10 orders from the orders table."}{:type :usage :usage {:promptTokens 300 :completionTokens 10} :model "test" :id "msg-3"}]]]- ;; Mock only openrouter/openrouter (LLM) and metabot-search/search (search backend)- ;; Everything else runs real code+ ;; Mock only openrouter/openrouter (LLM) and metabot-search/search (search backend)+ ;; Everything else runs real code(mt/with-dynamic-fn-redefs [openrouter/openrouter (fn [_opts](let [n (swap! llm-call-count inc)](mut/mock-llm-response (get llm-responses (dec n) []))))@@ -318,24 +318,24 @@(testing "Should successfully go through 3 iterations"(is (=? [{:type :start}{:type :tool-input :function "search"}- ;; Cumulative usage after iteration 1: 100 prompt, 20 completion+ ;; Cumulative usage after iteration 1: 100 prompt, 20 completion{:type :usage :usage {:promptTokens 100 :completionTokens 20}}{:type :tool-output:function "search":result {:structured-output {:total_count 1}}}{:type :start}{:type :tool-input :function "construct_notebook_query"}- ;; Cumulative usage after iteration 2: 100+200=300 prompt, 20+30=50 completion+ ;; Cumulative usage after iteration 2: 100+200=300 prompt, 20+30=50 completion{:type :usage :usage {:promptTokens 300 :completionTokens 50}}- ;; references real db id+ ;; references real db id{:type :tool-output:function "construct_notebook_query":result {:structured-output {:query {:database (mt/id)}}}}{:type :data :data-type "navigate_to"}{:type :start}- ;; has final text part+ ;; has final text part{:type :text}- ;; Cumulative usage after iteration 3: 300+300=600 prompt, 50+10=60 completion+ ;; Cumulative usage after iteration 3: 300+300=600 prompt, 50+10=60 completion{:type :usage :usage {:promptTokens 600 :completionTokens 60}}{:type :data:data-type "state"@@ -362,7 +362,7 @@(fn [_](let [n (swap! call-count inc)](case (int n)- ;; Iteration 1: tool call with usage+ ;; Iteration 1: tool call with usage1 (mut/mock-llm-response[{:type :start :id "msg-1"}{:type :tool-input@@ -371,7 +371,7 @@:arguments {:query "test"}}{:type :usage :usage {:promptTokens 100 :completionTokens 20}:model "gpt-4" :id "msg-1"}])- ;; Iteration 2: text response with usage+ ;; Iteration 2: text response with usage(mut/mock-llm-response[{:type :start :id "msg-2"}{:type :text :text "Done"}@@ -490,7 +490,7 @@(is (pos? (:sum (mt/metric-value system :metabase-metabot/agent-duration-ms{:profile-id "internal"})))))- ;; clear! is much faster than a new mt/with-prometheus-system!+ ;; clear! is much faster than a new mt/with-prometheus-system!(analytics/clear! :metabase-metabot/agent-requests)(analytics/clear! :metabase-metabot/agent-iterations)(analytics/clear! :metabase-metabot/agent-errors)@@ -554,7 +554,7 @@:context {}:profile-id :internal:tracking-opts {:session-id "00000000-0000-0000-0000-000000000001"}})- ;; The collector also contains token_usage events; filter for just ai_service_events.+ ;; The collector also contains token_usage events; filter for just ai_service_events.(let [events (snowplow-test/pop-event-data-and-user-id!)tool-events (filter #(= "agent_used_tool" (get-in % [:data "event"])) events)](is (=? [{:user-id (str rasta-id)@@ -634,7 +634,7 @@:context {}:profile-id :internal:tracking-opts {:session-id "00000000-0000-0000-0000-000000000001"}})- ;; Filter for just token_usage events (other events may also be present)+ ;; Filter for just token_usage events (other events may also be present)(let [events (snowplow-test/pop-event-data-and-user-id!)token-events (filter #(contains? (:data %) "total_tokens") events)](is (=? [{:user-id (str rasta-id)diff --git a/test/metabase/metabot/agent/profiles_test.clj b/test/metabase/metabot/agent/profiles_test.cljindex 3873c0158e7..f9cf68fd6f8 100644--- a/test/metabase/metabot/agent/profiles_test.clj+++ b/test/metabase/metabot/agent/profiles_test.clj@@ -32,7 +32,7 @@(is (= 10 (:max-iterations profile)))(is (= 0.3 (:temperature profile)))(is (vector? (:tools profile)))- ;; Should have more tools than embedding_next profile+ ;; Should have more tools than embedding_next profile(is (> (count (:tools profile)) 5))(is (contains? (tool-names profile) "search"))(is (contains? (tool-names profile) "create_sql_query"))diff --git a/test/metabase/metabot/agent/user_context_test.clj b/test/metabase/metabot/agent/user_context_test.cljindex 7dfd58fdf69..735b60d80e9 100644--- a/test/metabase/metabot/agent/user_context_test.clj+++ b/test/metabase/metabot/agent/user_context_test.clj@@ -331,7 +331,7 @@(testing "table viewing context includes measures and segments when present"(mt/with-dynamic-fn-redefs [entity-details/get-table-details(fn [{:keys [table-id with-measures? with-segments?]}]- ;; Verify that with-measures? and with-segments? are requested+ ;; Verify that with-measures? and with-segments? are requested(is (true? with-measures?) "should request measures")(is (true? with-segments?) "should request segments"){:structured-outputdiff --git a/test/metabase/metabot/api/metabot_test.clj b/test/metabase/metabot/api/metabot_test.cljindex e3300788f96..850a1915910 100644--- a/test/metabase/metabot/api/metabot_test.clj+++ b/test/metabase/metabot/api/metabot_test.clj@@ -65,21 +65,21 @@(update :tables generate-prompt)(set/rename-keys {:metrics :metric_questions:tables :table_questions})))]- ;; --------------------------- Generating sample prompts ---------------------------+ ;; --------------------------- Generating sample prompts ---------------------------(testing "should generate prompt suggestions for metabot"(with-redefs [metabot.example-question-generator/generate-example-questions prompt-generator]- ;; Trigger prompt generation by calling the regenerate endpoint+ ;; Trigger prompt generation by calling the regenerate endpoint(mt/user-http-request :crowberto :post 204(format "metabot/metabot/%d/prompt-suggestions/regenerate" metabot-id)))(let [added-prompts (t2/select [:model/MetabotPrompt [:card.name :model_name] :prompt]:metabot_id metabot-id{:join [[:report_card :card] [:= :card.id :card_id]]:order-by [:metabot_prompt.id]})]- ;; Verify prompts were added to the database+ ;; Verify prompts were added to the database(is (= prompts(-> (group-by :model_name added-prompts)(update-vals #(map :prompt %)))))))- ;; --------------------------- Querying sample prompts ---------------------------+ ;; --------------------------- Querying sample prompts ---------------------------(let [expected-prompts (into #{} (mapcat val) prompts)all-prompts (mt/user-http-request :rasta :get 200(format "metabot/metabot/%d/prompt-suggestions" metabot-id))]@@ -123,7 +123,7 @@(is (=? {:prompts expected-prompts?:limit limit, :offset nil, :total (:total all-prompts)}sample-prompts))))- ;; --------------------------- Deleting & regenerating sample prompts ---------------------------+ ;; --------------------------- Deleting & regenerating sample prompts ---------------------------(let [all-prompt-ids (into #{} (map :id) (:prompts all-prompts))current-prompt-ids #(t2/select-pks-set :model/MetabotPrompt :metabot_id metabot-id)selected-prompt (rand-nth (:prompts all-prompts))@@ -382,7 +382,7 @@(format "metabot/metabot/%d" metabot-id){:use_verified_content true})- ;; Verify old prompts were deleted and new ones created+ ;; Verify old prompts were deleted and new ones created(let [current-prompts (t2/select :model/MetabotPrompt :metabot_id metabot-id)current-prompt-ids (set (map :id current-prompts))](is (= 1 (count current-prompts)))@@ -400,13 +400,13 @@(format "metabot/metabot/%d" metabot-id){:collection_id collection-id-2})- ;; Verify prompts were regenerated again+ ;; Verify prompts were regenerated again(let [current-prompts (t2/select :model/MetabotPrompt :metabot_id metabot-id)](is (= 1 (count current-prompts)))(is (= "new prompt after collection change" (:prompt (first current-prompts)))))))(testing "should NOT regenerate prompts when no relevant fields change"- ;; First, establish a baseline+ ;; First, establish a baseline(t2/delete! :model/MetabotPrompt :metabot_id metabot-id)(t2/insert! :model/MetabotPrompt {:metabot_id metabot-id:prompt "baseline prompt"@@ -415,8 +415,8 @@(let [baseline-prompts (t2/select :model/MetabotPrompt :metabot_id metabot-id)baseline-ids (set (map :id baseline-prompts))]- ;; Make a PUT request that doesn't change verified content or collection_id- ;; (This would be if we add other fields to update in the future)+ ;; Make a PUT request that doesn't change verified content or collection_id+ ;; (This would be if we add other fields to update in the future)(mt/with-dynamic-fn-redefs [metabot.suggested-prompts/generate-sample-prompts(fn [_] (throw (Exception. "Should not be called")))](mt/user-http-request :crowberto :put 200@@ -424,7 +424,7 @@{:use_verified_content true ; Same as current value:collection_id collection-id-2})) ; Same as current value- ;; Verify prompts were NOT changed+ ;; Verify prompts were NOT changed(let [current-prompts (t2/select :model/MetabotPrompt :metabot_id metabot-id)current-ids (set (map :id current-prompts))](is (= baseline-ids current-ids))diff --git a/test/metabase/metabot/api_test.clj b/test/metabase/metabot/api_test.cljindex 3c4b9e02c19..31d98c84937 100644--- a/test/metabase/metabot/api_test.clj+++ b/test/metabase/metabot/api_test.clj@@ -61,23 +61,23 @@lines (str/split-lines response)conv (t2/select-one :model/MetabotConversation :id conversation-id)messages (t2/select :model/MetabotMessage :conversation_id conversation-id)]- ;; Native agent emits AI SDK v4 line protocol directly+ ;; Native agent emits AI SDK v4 line protocol directly(testing "response contains expected line types"- ;; f:{start}, 0:"text" chunks, 2:{state data}, d:{finish with usage}+ ;; f:{start}, 0:"text" chunks, 2:{state data}, d:{finish with usage}(is (=? [#"f:.*"#"0:.*"#"2:.*"#"d:.*"](m/distinct-by #(subs % 0 2) lines)))- ;; Text chunks reassemble to full message+ ;; Text chunks reassemble to full message(let [text-lines (filter #(str/starts-with? % "0:") lines)](is (= "Hello from native agent!"(apply str (map #(json/decode (subs % 2)) text-lines)))))- ;; Finish line includes usage+ ;; Finish line includes usage(is (str/includes? (last lines) "promptTokens")))(is (=? {:user_id (mt/user->id :rasta)}conv))- ;; Native agent stores parts in raw format+ ;; Native agent stores parts in raw format(is (=? [{:total_tokens 0:role :user:data [{:role "user" :content (:content question)}]}diff --git a/test/metabase/metabot/table_utils_test.clj b/test/metabase/metabot/table_utils_test.cljindex aab95a78f31..eae81ccdee3 100644--- a/test/metabase/metabot/table_utils_test.clj+++ b/test/metabase/metabot/table_utils_test.clj@@ -547,7 +547,7 @@(mt/with-current-user (mt/user->id :crowberto)(mt/with-dynamic-fn-redefs [query-analyzer/tables-for-native(fn [_query & _opts]- ;; Return "order" which will fuzzy match multiple tables+ ;; Return "order" which will fuzzy match multiple tables{:tables [{:table "order" :schema "public"}]})](let [query (mt/with-db db(lib/native-query (mt/metadata-provider) "SELECT * FROM order"))diff --git a/test/metabase/metabot/task/suggested_prompts_generator_test.clj b/test/metabase/metabot/task/suggested_prompts_generator_test.cljindex 7b6ae8b79cf..1cb2e97bd64 100644--- a/test/metabase/metabot/task/suggested_prompts_generator_test.clj+++ b/test/metabase/metabot/task/suggested_prompts_generator_test.clj@@ -30,7 +30,7 @@:dataset_query query}](mt/with-dynamic-fn-redefs [metabot.example-question-generator/generate-example-questions(fn [input]- ;; Return fake prompts if we have cards, empty otherwise+ ;; Return fake prompts if we have cards, empty otherwise(if (or (seq (:metrics input)) (seq (:tables input))){:table_questions [{:questions ["What is the total for this model?""How many items are in this model?"]}]@@ -76,7 +76,7 @@(let [prompts (t2/select :model/MetabotPrompt :card_id card-id)](is (seq prompts))))))- ;; Reset metabot state+ ;; Reset metabot state(t2/update! :model/Metabot (:id original-metabot) {:use_verified_content false}))))))))(deftest suggested-prompts-generator-skips-generation-when-managed-provider-is-locked-testdiff --git a/test/metabase/metabot/tools/util_test.clj b/test/metabase/metabot/tools/util_test.cljindex a5ac74aa3ac..2a907adb30f 100644--- a/test/metabase/metabot/tools/util_test.clj+++ b/test/metabase/metabot/tools/util_test.clj@@ -196,7 +196,7 @@:model/Metabot unverified-metabot {:name "unverified metabot":collection_id (:id metabot-coll):use_verified_content false}]- ;; Mark some content as verified+ ;; Mark some content as verified(moderation/create-review! {:moderated_item_id (:id verified-model):moderated_item_type "card":moderator_id (mt/user->id :crowberto)diff --git a/test/metabase/model_persistence/task/persist_refresh_test.clj b/test/metabase/model_persistence/task/persist_refresh_test.cljindex 189417d0d9d..b596788cef8 100644--- a/test/metabase/model_persistence/task/persist_refresh_test.clj+++ b/test/metabase/model_persistence/task/persist_refresh_test.clj@@ -195,7 +195,7 @@:model/PersistedInfo punmodeled {:card_id (u/the-id unmodeled) :database_id (u/the-id db)}:model/PersistedInfo deletable {:card_id (u/the-id model3) :database_id (u/the-id db):state "deletable"- ;; need an "old enough" state change+ ;; need an "old enough" state change:state_change_at (t/minus (t/local-date-time) (t/hours 2))};; Record not in "deletable" state, but with nil card_id:model/PersistedInfo deletable2 {:card_id nil :database_id (u/the-id db)}]@@ -209,7 +209,7 @@(let [queued-for-deletion (into #{} (map :id) (#'task.persist-refresh/deletable-models))](doseq [deletable-persisted [deletable punmodeled parchived]](is (contains? queued-for-deletion (u/the-id deletable-persisted))))))- ;; we manually pass in the deleteable ones to not catch others in a running instance+ ;; we manually pass in the deleteable ones to not catch others in a running instance(#'task.persist-refresh/prune-deletables! test-refresher [deletable parchived punmodeled])(testing "We delete persisted_info records for all of the pruned"(let [persisted-records (t2/select :model/PersistedInfo :id [:in (map :id [parchived punmodeled deletable])])@@ -222,7 +222,7 @@:id)persisted-records)](is (= [] existing))))- ;; don't assert equality if there are any deletable in the app db+ ;; don't assert equality if there are any deletable in the app db(doseq [deletable-persisted [deletable punmodeled parchived]](is (contains? @called-on (u/the-id deletable-persisted))))(is (partial= {:task "unpersist-tables"diff --git a/test/metabase/notification/payload/impl/card_test.clj b/test/metabase/notification/payload/impl/card_test.cljindex e59fb84a10f..8e193851f03 100644--- a/test/metabase/notification/payload/impl/card_test.clj+++ b/test/metabase/notification/payload/impl/card_test.clj@@ -161,7 +161,7 @@(is (= (construct-email{:message [{notification.tu/default-card-name true"Manage your subscriptions" true}- ;; icon+ ;; iconnotification.tu/png-attachmentnotification.tu/csv-attachment]})(mt/summarize-multipart-single-emaildiff --git a/test/metabase/notification/payload/impl/system_event_test.clj b/test/metabase/notification/payload/impl/system_event_test.cljindex f3268be99f9..340fa920054 100644--- a/test/metabase/notification/payload/impl/system_event_test.clj+++ b/test/metabase/notification/payload/impl/system_event_test.clj@@ -187,9 +187,9 @@{:first_name "Ngoc" :email "[email protected]"}false)):channel/email first))]- ;; The logo should be embedded as an attachment with a cid: reference+ ;; The logo should be embedded as an attachment with a cid: reference(is (re-find #"<img[^>]*src=\"cid:[^\"]+@metabase\"[^>]*>" (-> email :message first :content)))- ;; There should be an attachment for the logo+ ;; There should be an attachment for the logo(is (some #(and (= (:type %) :inline)(= (:content-type %) "image/png"))(rest (:message email)))))))))diff --git a/test/metabase/notification/send_test.clj b/test/metabase/notification/send_test.cljindex eb7865051e6..b0997800c78 100644--- a/test/metabase/notification/send_test.clj+++ b/test/metabase/notification/send_test.clj@@ -61,7 +61,7 @@:notification-payload notification-payload:template template:recipients recipients})- ;; rendered messages are recipients+ ;; rendered messages are recipientsrecipients)](testing "channel/send! are called on rendered messages"(is (=? {:channel/metabase-test [{:type :notification-recipient/user :user_id (mt/user->id :crowberto)}diff --git a/test/metabase/parameters/dashboard_test.clj b/test/metabase/parameters/dashboard_test.cljindex 69bcbe2a28e..3f061d9cffd 100644--- a/test/metabase/parameters/dashboard_test.clj+++ b/test/metabase/parameters/dashboard_test.clj@@ -221,10 +221,10 @@(binding [api/*current-user-id* (mt/user->id :rasta)](let [dashboard (t2/select-one :model/Dashboard :id dashboard-id)parameter (first (:parameters dashboard))]- ;; Mimicks the API endpoint (required):+ ;; Mimicks the API endpoint (required):(binding [qp.perms/*param-values-query* true]- ;; Important to check all the mappings here because sometimes they match up by coincidence- ;; and pass even when the bug is still present.+ ;; Important to check all the mappings here because sometimes they match up by coincidence+ ;; and pass even when the bug is still present.(let [expected (into {} (mt/rows (mt/process-query (mt/mbql-query users))))actual (into {} (map (fn [id](parameters.dashboard/dashboard-param-remapped-value@@ -285,7 +285,7 @@"Should return common FK remapping when FKs agree")))))(testing "Scenario 3: FK1→∅, FK2→A should return raw value (no consensus among FKs)"- ;; Set up FK2 with remapping, but leave FK1 without remapping, PK with different remapping+ ;; Set up FK2 with remapping, but leave FK1 without remapping, PK with different remapping(mt/with-column-remappings [reviews.product_id products.titleproducts.id products.category](binding [api/*current-user-id* (mt/user->id :rasta)]@@ -296,7 +296,7 @@"Should return raw value when only some FKs have remapping")))))(testing "Scenario 4: No remappings at all should return raw value"- ;; No remappings set up+ ;; No remappings set up(binding [api/*current-user-id* (mt/user->id :rasta)](let [dashboard (t2/select-one :model/Dashboard :id dashboard-id)parameter (first (:parameters dashboard))diff --git a/test/metabase/parameters/shared_test.cljc b/test/metabase/parameters/shared_test.cljcindex d73195beaf1..516e6990ca6 100644--- a/test/metabase/parameters/shared_test.cljc+++ b/test/metabase/parameters/shared_test.cljc@@ -148,7 +148,7 @@{"foo" {:type :string/= :value "<script>alert(1)</script>"}}"<script>alert(1)</script>"- ;; Characters in the original text are not escaped+ ;; Characters in the original text are not escaped"_*{{foo}}*_"{"foo" {:type :string/= :value "*bar*"}}"_**bar**_")))@@ -401,7 +401,7 @@:default "Q1-2021":type "date/quarter-year",:sectionId "date"}- ;; Filter without default, should not be included in subscription+ ;; Filter without default, should not be included in subscription{:name "Product title contains",:slug "product_title_contains",:id "acd0dfab",diff --git a/test/metabase/premium_features/test_util.clj b/test/metabase/premium_features/test_util.cljindex 06ed3274958..fcd01c4b164 100644--- a/test/metabase/premium_features/test_util.clj+++ b/test/metabase/premium_features/test_util.clj@@ -13,9 +13,9 @@[features thunk](let [features (set (map name features))](testing (format "\nWith premium token features = %s" (pr-str features))- ;; non-thread-local usages need to do both [[binding]] AND [[with-redefs]], because if a thread-local usage- ;; happened already then the binding it establishes will shadow the value set by [[with-redefs]].- ;; See [[with-premium-features-test]] below.+ ;; non-thread-local usages need to do both [[binding]] AND [[with-redefs]], because if a thread-local usage+ ;; happened already then the binding it establishes will shadow the value set by [[with-redefs]].+ ;; See [[with-premium-features-test]] below.(let [thunk (^:once fn* [](binding [token-check/*token-features* (constantly features)](thunk)))]diff --git a/test/metabase/product_feedback/task/creator_sentiment_emails_test.clj b/test/metabase/product_feedback/task/creator_sentiment_emails_test.cljindex 579ffea1356..3fe11328230 100644--- a/test/metabase/product_feedback/task/creator_sentiment_emails_test.clj+++ b/test/metabase/product_feedback/task/creator_sentiment_emails_test.clj@@ -76,7 +76,7 @@(doseq [hosted? [true false]](mt/reset-inbox!)(mt/with-dynamic-fn-redefs [creator-sentiment-emails/fetch-creators (fn [_] [{:email "[email protected]"}])- ;; can't use mt/with-temporary-setting-values because of a custom :getter+ ;; can't use mt/with-temporary-setting-values because of a custom :getterpremium-features/is-hosted? (constantly hosted?)](mt/with-temporary-setting-values [site-url "http://metabase.com"](#'creator-sentiment-emails/send-creator-sentiment-emails! 45)diff --git a/test/metabase/public_sharing_rest/api_test.clj b/test/metabase/public_sharing_rest/api_test.cljindex b676c757098..6af2b6d9269 100644--- a/test/metabase/public_sharing_rest/api_test.clj+++ b/test/metabase/public_sharing_rest/api_test.clj@@ -1482,7 +1482,7 @@(let [result (results)](is (=? {:status "completed"}result))- ;; [[metabase.public-sharing-rest.api/transform-results]] should remove `row_count`+ ;; [[metabase.public-sharing-rest.api/transform-results]] should remove `row_count`(testing "row_count isn't included in public endpoints"(is (nil? (:row_count result))))(is (= 6 (count (get-in result [:data :cols]))))diff --git a/test/metabase/queries_rest/api/card_test.clj b/test/metabase/queries_rest/api/card_test.cljindex 45d5ce237d7..4db9d22704b 100644--- a/test/metabase/queries_rest/api/card_test.clj+++ b/test/metabase/queries_rest/api/card_test.clj@@ -924,7 +924,7 @@(deftest create-card-disallow-setting-embedding-type-test(testing "POST /api/card"(testing "Ignore values of `embedding_type` while creating a Card (this must be done via `PUT /api/card/:id` instead)"- ;; should be ignored regardless of the value of the `embedding-type` Setting.+ ;; should be ignored regardless of the value of the `embedding-type` Setting.(doseq [embedding-type [true false]](mt/with-temporary-setting-values [enable-embedding-static embedding-type](mt/with-model-cleanup [:model/Card]@@ -2879,7 +2879,7 @@(update-card card {:description "a new description"})(is (empty? (reviews card)))))(testing "Does not add nil moderation reviews when there are reviews but not verified"- ;; testing that we aren't just adding a nil moderation each time we update a card+ ;; testing that we aren't just adding a nil moderation each time we update a card(with-card :verified(is (verified? card))(moderation-review/create-review! {:moderated_item_id (u/the-id card)@@ -3659,8 +3659,8 @@{:source-table (str "card__" (u/the-id model)):breakout [[:field "USER_ID" {:base-type :type/Integer}]]:aggregation [[:sum [:field "TOTAL" {:base-type :type/Float}]]]})- ;; The FE sometimes used a field id instead of field by name - we need- ;; to handle this+ ;; The FE sometimes used a field id instead of field by name - we need+ ;; to handle this:visualization_settings {:pivot_table.column_split {:rows ["USER_ID"],:columns [],:values ["sum"]},@@ -4384,7 +4384,7 @@(perms/revoke-collection-permissions! (perms-group/all-users) forbidden-coll-id)(testing "We get a 403 back, because we don't have permissions"(is (= "You don't have permissions to do that."- ;; regardless of the `delete_old_dashcards` value, same response+ ;; regardless of the `delete_old_dashcards` value, same response(mt/user-http-request :rasta :put 403 (str "card/" card-id "?delete_old_dashcards=true") {:dashboard_id dash-id})(mt/user-http-request :rasta :put 403 (str "card/" card-id) {:dashboard_id dash-id}))))(testing "The card is still in the old dashboard and not the new one"@@ -4403,7 +4403,7 @@(perms/revoke-collection-permissions! (perms-group/all-users) forbidden-coll-id)(testing "We get a 403 back, because we don't have permissions"(is (= "You don't have permissions to do that."- ;; regardless of the `delete_old_dashcards` value, same response+ ;; regardless of the `delete_old_dashcards` value, same response(mt/user-http-request :rasta :put 403 (str "card/" card-id "?delete_old_dashcards=true") {:dashboard_id dash-id})(mt/user-http-request :rasta :put 403 (str "card/" card-id) {:dashboard_id dash-id}))))(testing "The card is still in the old dashboard and not the new one"diff --git a/test/metabase/query_processor/date_bucketing_test.clj b/test/metabase/query_processor/date_bucketing_test.cljindex b365afd31cc..3674de61acd 100644--- a/test/metabase/query_processor/date_bucketing_test.clj+++ b/test/metabase/query_processor/date_bucketing_test.clj@@ -1374,7 +1374,7 @@(deftest ^:parallel relative-time-interval-test(mt/test-drivers(mt/normal-drivers-with-feature :date-arithmetics :test/dynamic-dataset-loading)- ;; Following verifies #45942 is solved. Changing the offset ensures that intervals do not overlap.+ ;; Following verifies #45942 is solved. Changing the offset ensures that intervals do not overlap.(testing "Syntactic sugar (`:relative-time-interval` clause) (#45942)"(mt/dataset checkins:1-per-day:60(is (= 7diff --git a/test/metabase/query_processor/middleware/cache_test.clj b/test/metabase/query_processor/middleware/cache_test.cljindex 7d15160e640..6d61d945b7a 100644--- a/test/metabase/query_processor/middleware/cache_test.clj+++ b/test/metabase/query_processor/middleware/cache_test.clj@@ -110,9 +110,9 @@*purge-chan* purge-chan](let [orig (mt/original-fn #'cache/serialized-bytes)](mt/with-dynamic-fn-redefs [cache/serialized-bytes (fn []- ;; if `save-results!` isn't going to get called because `*result-fn*`- ;; throws an Exception, catch it and send it to `save-chan` so it still- ;; gets a result and tests can finish+ ;; if `save-results!` isn't going to get called because `*result-fn*`+ ;; throws an Exception, catch it and send it to `save-chan` so it still+ ;; gets a result and tests can finish(try(orig)(catch Throwable e@@ -323,7 +323,7 @@(let [query (mt/native-query {:query (tx/native-array-query driver/*driver*)})query (assoc query :cache-strategy (ttl-strategy))original-result (qp/process-query query)- ;; clear any existing values in the `save-chan`+ ;; clear any existing values in the `save-chan`_ (while (a/poll! save-chan))_ (mt/wait-for-result save-chan)cached-result (qp/process-query query)]@@ -360,7 +360,7 @@(let [query (mt/native-query {:query (format "SELECT 'foo'::%s;" dom-name)})query (assoc query :cache-strategy (ttl-strategy))original-result (qp/process-query query)- ;; clear any existing values in the `save-chan`+ ;; clear any existing values in the `save-chan`_ (while (a/poll! save-chan))_ (mt/wait-for-result save-chan)cached-result (qp/process-query query)]diff --git a/test/metabase/query_processor/middleware/fetch_source_query_test.clj b/test/metabase/query_processor/middleware/fetch_source_query_test.cljindex ae8703c5158..2e033a40a9a 100644--- a/test/metabase/query_processor/middleware/fetch_source_query_test.clj+++ b/test/metabase/query_processor/middleware/fetch_source_query_test.clj@@ -130,7 +130,7 @@(is (false? (lib-be/enable-nested-queries))))(qp.store/with-metadata-provider (mock-metadata-provider)-;; resolve-source-cards doesn't respect [[mt/with-temp-env-var-value!]], so set it inside the thunk:+ ;; resolve-source-cards doesn't respect [[mt/with-temp-env-var-value!]], so set it inside the thunk:(is (thrown-with-msg? Exception#"Nested queries are disabled"(resolve-source-cardsdiff --git a/test/metabase/query_processor/middleware/limit_test.clj b/test/metabase/query_processor/middleware/limit_test.cljindex 1584aaa7f1d..547e32e1b8c 100644--- a/test/metabase/query_processor/middleware/limit_test.clj+++ b/test/metabase/query_processor/middleware/limit_test.clj@@ -137,8 +137,8 @@(get-in (add-default-limit{:type :query:query {:source-table (meta/id :venues)}- ;; setting a constraint here will result in `(mbql.u/query->max-rows-limit query)` returning that limit- ;; so we can use this to check the behaviour of `add-default-limit` when download-row-limit is unset+ ;; setting a constraint here will result in `(mbql.u/query->max-rows-limit query)` returning that limit+ ;; so we can use this to check the behaviour of `add-default-limit` when download-row-limit is unset:constraints (when limit {:max-results-bare-rows limit}):info {:context context}})[:query :limit])))))))diff --git a/test/metabase/query_processor/middleware/permissions_test.clj b/test/metabase/query_processor/middleware/permissions_test.cljindex e3cf521d6a2..297f8e3407e 100644--- a/test/metabase/query_processor/middleware/permissions_test.clj+++ b/test/metabase/query_processor/middleware/permissions_test.clj@@ -843,7 +843,7 @@:alias "v":source-query {:native "SELECT * from orders"}:condition [:= true true]- ;; Make sure we can't just pass in this key and join to arbitrary SQL!+ ;; Make sure we can't just pass in this key and join to arbitrary SQL!:qp/stage-is-from-source-card card-id}]:order-by [[:asc $id]]:limit 2})]diff --git a/test/metabase/query_processor/pivot_test.clj b/test/metabase/query_processor/pivot_test.cljindex 329aa67c45c..770fb80e3fe 100644--- a/test/metabase/query_processor/pivot_test.clj+++ b/test/metabase/query_processor/pivot_test.clj@@ -111,9 +111,9 @@clojure.lang.ExceptionInfo#"Invalid pivot-cols: specified breakout at index 3, but we only have 3 breakouts"(#'qp.pivot/breakout-combinations 3 [] [0 1 2 3] true true)))))- ;; TODO -- we should require these columns to be distinct as well (I think?)- ;; TODO -- require all numbers to be positive- ;; TODO -- can you specify something in both pivot-rows and pivot-cols?+;; TODO -- we should require these columns to be distinct as well (I think?)+;; TODO -- require all numbers to be positive+;; TODO -- can you specify something in both pivot-rows and pivot-cols?(defn- test-query [](mt/dataset test-datadiff --git a/test/metabase/query_processor/remapping_test.clj b/test/metabase/query_processor/remapping_test.cljindex 6522a371f20..6d7288454ba 100644--- a/test/metabase/query_processor/remapping_test.clj+++ b/test/metabase/query_processor/remapping_test.clj@@ -264,7 +264,7 @@(is (= [[1 1 14 37.65 2.07 39.72 nil "2019-02-11T21:40:27.892Z" 2 "Awesome Concrete Shoes"][2 1 123 110.93 6.1 117.03 nil "2018-05-15T08:04:04.58Z" 3 "Mediocre Wooden Bench"]](remappings-with-metadata metadata))))))))- ;; doesn't currently work with any other metadata.+;; doesn't currently work with any other metadata.(deftest remappings-with-implicit-joins-test(mt/with-temporary-setting-values [report-timezone "UTC"]diff --git a/test/metabase/query_processor/streaming_test.clj b/test/metabase/query_processor/streaming_test.cljindex 7efa708a032..c8e8a299daf 100644--- a/test/metabase/query_processor/streaming_test.clj+++ b/test/metabase/query_processor/streaming_test.clj@@ -404,7 +404,7 @@:limit 2}}:assertions {:csv (fn [results](is (string? results))- ;; CSVs round decimals to 2 digits without viz-settings+ ;; CSVs round decimals to 2 digits without viz-settings(is (= [["ID" "Name" "Category ID" "Latitude" "Longitude" "Price"]["1" "Red Medicine" "4" "10.06460000° N" "165.37400000° W" "3"]["2" "Stout Burgers & Beers" "11" "34.09960000° N" "118.32900000° W" "2"]]@@ -765,7 +765,7 @@(deftest streaming-response-handles-cancellation-test(testing "Streaming response handles cancellation gracefully without assertion errors"(let [mock-qp-fn (fn [rff]- ;; Simulate immediate cancellation+ ;; Simulate immediate cancellation(mt/with-dynamic-fn-redefs [qp.pipeline/canceled? (constantly true)](qp.pipeline/*run* (mt/mbql-query venues {:limit 1}) rff)))]diff --git a/test/metabase/query_processor/timeseries_test.clj b/test/metabase/query_processor/timeseries_test.cljindex 50ec08ab947..4918695a38d 100644--- a/test/metabase/query_processor/timeseries_test.clj+++ b/test/metabase/query_processor/timeseries_test.clj@@ -693,7 +693,7 @@["2014-01-01" 498]["2015-01-01" 267]][iso8601-date-part int]]]- ;; TODO: Find a way how to make those work with Druid JDBC.+ ;; TODO: Find a way how to make those work with Druid JDBC.:when (not (#{:week-of-year :day-of-week :week} unit))](testing unit(testing "topN query"@@ -707,8 +707,8 @@columns))(is (= expected-rowsrows))))- ;; This test is similar to the above query but doesn't use a limit clause which causes the query to be a- ;; grouped timeseries query rather than a topN query. The dates below are formatted incorrectly due to+ ;; This test is similar to the above query but doesn't use a limit clause which causes the query to be a+ ;; grouped timeseries query rather than a topN query. The dates below are formatted incorrectly due to(testing "group timeseries query"(let [{:keys [columns rows]} (mt/formatted-rows+column-namesformat-fns@@ -854,7 +854,7 @@(mt/first-row(run-mbql-query checkins{:aggregation [[:count]]- ;; test data is all in the past so nothing happened today <3+ ;; test data is all in the past so nothing happened today <3:filter [:not [:time-interval $timestamp :current :day]]}))))))))(deftest ^:parallel min-testdiff --git a/test/metabase/request/session_test.clj b/test/metabase/request/session_test.cljindex 4cdb7736a0f..b03d60b99d0 100644--- a/test/metabase/request/session_test.clj+++ b/test/metabase/request/session_test.clj@@ -28,9 +28,9 @@(testing "as-admin overrides *is-superuser?* and *current-user-permissions-set*"(request/with-current-user (mt/user->id :rasta)(request/as-admin- ;; Current user ID remains the same+ ;; Current user ID remains the same(is (= (mt/user->id :rasta) *current-user-id*))- ;; *is-superuser?* and permissions set are overrided+ ;; *is-superuser?* and permissions set are overrided(is (true? api/*is-superuser?*))(is (= #{"/"} @api/*current-user-permissions-set*)))))(testing "as-admin preserves any locale settings"diff --git a/test/metabase/revisions/api_test.clj b/test/metabase/revisions/api_test.cljindex 60df9f6a0fb..031724d8530 100644--- a/test/metabase/revisions/api_test.clj+++ b/test/metabase/revisions/api_test.clj@@ -355,7 +355,7 @@(t2/update! :model/Card :id card-id {:description "meaningful number"})(create-card-revision! card-id false :crowberto)-;; 5. change collection+ ;; 5. change collection(t2/update! :model/Card :id card-id {:collection_id coll-id})(create-card-revision! card-id false :crowberto)@@ -405,7 +405,7 @@(t2/update! :model/Card :id card-id {:description "meaningful number"})(create-card-revision! card-id false :crowberto)-;; 4. change collection+ ;; 4. change collection(t2/update! :model/Card :id card-id {:collection_id coll-id})(create-card-revision! card-id false :crowberto)@@ -452,7 +452,7 @@:name "New name"})(create-card-revision! card-id false :crowberto)-;; 2. revert to an earlier revision+ ;; 2. revert to an earlier revision(let [earlier-revision-id (t2/select-one-pk :model/Revision :model "Card" :model_id card-id {:order-by [[:timestamp :desc]]})](revision/revert! {:entity :model/Card :id card-id :user-id (mt/user->id :crowberto) :revision-id earlier-revision-id}))diff --git a/test/metabase/revisions/events_test.clj b/test/metabase/revisions/events_test.cljindex ab98e4cab6f..10f5bc8721f 100644--- a/test/metabase/revisions/events_test.clj+++ b/test/metabase/revisions/events_test.clj@@ -133,8 +133,8 @@(mt/with-temp [:model/Dashboard {dashboard-id :id, :as dashboard}](events/publish-event! :event/dashboard-update {:object dashboard :user-id (mt/user->id :rasta)})- ;; we don't want the public_uuid and made_public_by_id to be recorded in a revision- ;; otherwise revert a card to earlier revision might toggle the public sharing settings+ ;; we don't want the public_uuid and made_public_by_id to be recorded in a revision+ ;; otherwise revert a card to earlier revision might toggle the public sharing settings(is (empty? (set/intersection #{:public_uuid :made_public_by_id}(->> (t2/select-one-fn :object :model/Revision:model "Dashboard"diff --git a/test/metabase/revisions/impl/dashboard_test.clj b/test/metabase/revisions/impl/dashboard_test.cljindex 75d1aab770d..d32f9168fea 100644--- a/test/metabase/revisions/impl/dashboard_test.clj+++ b/test/metabase/revisions/impl/dashboard_test.clj@@ -306,7 +306,7 @@(string? value) (str value "_changed")))](doseq [col columns](clean-revisions-for-dashboard (:id dashboard))- ;; do the update+ ;; do the update(t2/update! :model/DashboardCard (:id dashcard) {col (update-col col (get dashcard col))})(create-dashboard-revision! (:id dashboard) false)@@ -332,7 +332,7 @@(string? value) (str value "_changed")))](doseq [col columns](clean-revisions-for-dashboard (:id dashboard))- ;; do the update+ ;; do the update(t2/update! :model/DashboardTab (:id dashtab) {col (update-col col (get dashtab col))})(create-dashboard-revision! (:id dashboard) false)@@ -472,7 +472,7 @@;; 0. create a dashboard(create-dashboard-revision! dashboard-id true)-;; 1. add 2 tabs+ ;; 1. add 2 tabs(let [[tab-1-id tab-2-id] (t2/insert-returning-pks! :model/DashboardTab [{:name "Tab 1":position 0:dashboard_id dashboard-id}@@ -503,7 +503,7 @@;; 0. create a dashboard(create-dashboard-revision! dashboard-id true)-;; 1. add 2 tabs+ ;; 1. add 2 tabs(let [[tab-1-id tab-2-id] (t2/insert-returning-pks! :model/DashboardTab [{:name "Tab 1":position 0:dashboard_id dashboard-id}@@ -528,10 +528,10 @@(testing "revert deleting tabs"(mt/with-temp [:model/Dashboard {dashboard-id :id} {:name "A dashboard"}]- ;; 0. create a dashboard+ ;; 0. create a dashboard(create-dashboard-revision! dashboard-id true)-;; 1. add 2 tabs+ ;; 1. add 2 tabs(let [[tab-1-id tab-2-id] (t2/insert-returning-pks! :model/DashboardTab [{:name "Tab 1":position 0:dashboard_id dashboard-id}@@ -540,15 +540,15 @@:dashboard_id dashboard-id}])](create-dashboard-revision! dashboard-id false)- ;; 2. delete the 1st tab and re-position the second tab+ ;; 2. delete the 1st tab and re-position the second tab(t2/delete! :model/DashboardTab tab-1-id)(t2/update! :model/DashboardTab tab-2-id {:position 0})(create-dashboard-revision! dashboard-id false)- ;; check to make sure we have everything setup before testing+ ;; check to make sure we have everything setup before testing(is (=? [{:id tab-2-id :name "Tab 2" :position 0}](t2/select :model/DashboardTab :dashboard_id dashboard-id {:order-by [[:position :asc]]})))- ;; revert+ ;; revert(revert-to-previous-revision! :model/Dashboard dashboard-id 2)(is (=? [{:id (mt/malli=? [:fn pos-int?]) :name "Tab 1" :position 0}{:id tab-2-id :name "Tab 2" :position 1}]@@ -624,7 +624,7 @@:size_y 4}))(create-dashboard-revision! dashboard-id false)- ;; revert+ ;; revert(revert-to-previous-revision! :model/Dashboard dashboard-id 2)(testing "tab 1 should have 2 cards"(is (= 2 (t2/count :model/DashboardCard :dashboard_tab_id tab-1-id)))diff --git a/test/metabase/search/api_test.clj b/test/metabase/search/api_test.cljindex f4708e1a596..9ff4af2e2da 100644--- a/test/metabase/search/api_test.clj+++ b/test/metabase/search/api_test.clj@@ -1450,7 +1450,7 @@[_ {:type :model :dataset_query (mt/mbql-query venues)}{http-action :action-id} {:type :http :name search-term}{query-action :action-id} {:type :query :dataset_query (mt/native-query {:query (format "delete from %s" search-term)})}]- ;; TODO investigate why the actions don't get indexed automatically+ ;; TODO investigate why the actions don't get indexed automatically(search/reindex! {:async? false :in-place? true})(testing "by default do not search for native content"(is (= #{["card" mbql-card]diff --git a/test/metabase/search/appdb/index_test.clj b/test/metabase/search/appdb/index_test.cljindex 9e5af3ba007..2fb7c7e3d29 100644--- a/test/metabase/search/appdb/index_test.clj+++ b/test/metabase/search/appdb/index_test.clj@@ -77,14 +77,14 @@(let [fulltext? (= :postgres (mdb/db-type))](with-index(testing "The index is updated when models change"- ;; Has a second entry is "Revenue Project(ions)", when using English dictionary+ ;; Has a second entry is "Revenue Project(ions)", when using English dictionary(is (= (if fulltext? 2 1) (count (search.index/search "Projected Revenue"))))(is (= 0 (count (search.index/search "Protected Avenue"))))(t2/update! :model/Card {:name "Projected Revenue"} {:name "Protected Avenue"})(is (= (if fulltext? 1 0) (count (search.index/search "Projected Revenue"))))(is (= 1 (count (search.index/search "Protected Avenue"))))- ;; Delete hooks are remove for now, over performance concerns.+ ;; Delete hooks are remove for now, over performance concerns.;(t2/delete! :model/Card :name "Protected Avenue")#_(is (= 0 #_1 (count (search.index/search "Projected Revenue"))))#_(is (= 0 (count (search.index/search "Protected Avenue"))))))))@@ -108,10 +108,10 @@(with-index(with-fulltext-filtering(testing "It does not match partial words"- ;; does not include revenue+ ;; does not include revenue(is (= #{"venues"} (into #{} (comp (map second) (map u/lower-case-en)) (search.index/search "venue")))))- ;; no longer works without using the english dictionary+ ;; no longer works without using the english dictionary(testing "Unless their lexemes are matching"(doseq [[a b] [["revenue" "revenues"]["collect" "collection"]]]@@ -134,7 +134,7 @@(is (<= 1 (index-hits "user"))))(testing "But stop words are skipped"(is (= 0 (index-hits "or")))- ;; stop words depend on a dictionary+ ;; stop words depend on a dictionary(is (= #_0 3 (index-hits "its the satisfaction of it"))))(testing "We can combine the individual results"(is (= (+ (index-hits "satisfaction")diff --git a/test/metabase/search/appdb/scoring_test.clj b/test/metabase/search/appdb/scoring_test.cljindex 483e405b7a5..d312c1b2ad2 100644--- a/test/metabase/search/appdb/scoring_test.clj+++ b/test/metabase/search/appdb/scoring_test.clj@@ -96,10 +96,10 @@{:model "card" :id 6 :name "ordering"}](case (mdb/db-type):postgres- ;; WARNING: this is likely to diverge between appdb types as we support more.+ ;; WARNING: this is likely to diverge between appdb types as we support more.(testing "Preferences according to textual matches"- ;; Note that, ceteris paribus, the ordering in the database is currently stable - this might change!- ;; Due to stemming, we do not distinguish between exact matches and those that differ slightly.+ ;; Note that, ceteris paribus, the ordering in the database is currently stable - this might change!+ ;; Due to stemming, we do not distinguish between exact matches and those that differ slightly.(is (= [["card" 1 "orders"]["card" 4 "order"];; We do not currently normalize the score based on the number of words in the vector / the coverage.@@ -200,7 +200,7 @@card-with-view #(merge (mt/with-temp-defaults :model/Card){:name search-term:view_count %})- ;; Flake alert - we need to insert the outlier so that it is not chosen over the card it ties with.+ ;; Flake alert - we need to insert the outlier so that it is not chosen over the card it ties with.;; NOTE: we have brought in the outlier *a lot* to compensate for h2 not calculating a real percentile.outlier-card-id (t2/insert-returning-pk! :model/Card (card-with-view 88 #_100000))_ (t2/insert! :model/Card (concat (repeatedly 20 #(card-with-view 0))@@ -212,8 +212,8 @@[])first-result-id (-> (search-results* search-term) first second)](is (some? first-result-id))- ;; Ideally we would make the outlier slightly less attractive in another way, with a weak weight,- ;; but we can solve this later if it actually becomes a flake+ ;; Ideally we would make the outlier slightly less attractive in another way, with a weak weight,+ ;; but we can solve this later if it actually becomes a flake(is (not= outlier-card-id first-result-id))))))))(deftest ^:parallel dashboard-count-testdiff --git a/test/metabase/search/in_place/filter_test.clj b/test/metabase/search/in_place/filter_test.cljindex adbaedc47b2..8196407ea6c 100644--- a/test/metabase/search/in_place/filter_test.clj+++ b/test/metabase/search/in_place/filter_test.clj@@ -198,7 +198,7 @@(mt/with-clock #t "2023-05-04T10:02:05Z[UTC]"(are [created-at expected-where](= expected-where (#'search.filter/date-range-filter-clause :card.created_at created-at))- ;; absolute datetime+ ;; absolute datetime"Q1-2023" [:and [:>= [:cast :card.created_at :date] #t "2023-01-01"][:< [:cast :card.created_at :date] #t "2023-04-01"]]"2016-04-18~2016-04-23" [:and [:>= [:cast :card.created_at :date] #t "2016-04-18"]@@ -213,7 +213,7 @@[:< :card.created_at #t "2016-04-23T10:01"]]"2016-04-18T10:30:00~" [:> :card.created_at #t "2016-04-18T10:30"]"~2016-04-18T10:30:00" [:< :card.created_at #t "2016-04-18T10:31"]- ;; relative datetime+ ;; relative datetime"past3days" [:and [:>= [:cast :card.created_at :date] #t "2023-05-01"][:< [:cast :card.created_at :date] #t "2023-05-04"]]"past3days~" [:and [:>= [:cast :card.created_at :date] #t "2023-05-01"]diff --git a/test/metabase/search/task/search_index_test.clj b/test/metabase/search/task/search_index_test.cljindex 4841c276183..3d19f74a059 100644--- a/test/metabase/search/task/search_index_test.clj+++ b/test/metabase/search/task/search_index_test.clj@@ -16,10 +16,10 @@(deftest index!-test(search.tu/with-temp-index-table- ;; TODO this is coupled to appdb engines at the moment+ ;; TODO this is coupled to appdb engines at the moment(t2/query (sql.helpers/drop-table (search.index/active-table)))(testing "It can recreate the index from scratch"- ;; May return falsey if there is nothing to index.+ ;; May return falsey if there is nothing to index.(is (task/init!))(is (pos? (index-size))))(testing "It will reuse an existing index"@@ -27,7 +27,7 @@(deftest reindex!-test(search.tu/with-temp-index-table- ;; TODO this is coupled to appdb engines at the moment+ ;; TODO this is coupled to appdb engines at the moment(t2/query (sql.helpers/drop-table (search.index/active-table)))(testing "It can recreate the index from scratch"(is (search/reindex! {:async? false}))diff --git a/test/metabase/search/test_util.clj b/test/metabase/search/test_util.cljindex 6afa5d83150..1fbff5d6b2e 100644--- a/test/metabase/search/test_util.clj+++ b/test/metabase/search/test_util.clj@@ -26,7 +26,7 @@[& body]`(when (search/supports-index?)(search.index/with-temp-index-table- ;; We need ingestion to happen on the same thread so that it uses the right search index.+ ;; We need ingestion to happen on the same thread so that it uses the right search index.(with-sync-search-indexing~@body))))diff --git a/test/metabase/server/middleware/sdk_test.clj b/test/metabase/server/middleware/sdk_test.cljindex a5e62c42324..53106d4f2a5 100644--- a/test/metabase/server/middleware/sdk_test.clj+++ b/test/metabase/server/middleware/sdk_test.clj@@ -144,7 +144,7 @@(deftest embeding-mw-does-not-bump-metrics-with-random-sdk-header(let [prometheus-standin (atom {})](mt/with-dynamic-fn-redefs [analytics/inc! (fn [k _] (swap! prometheus-standin update k (fnil inc 0)))]- ;; has X-Metabase-Client header, but it's not the SDK, so we don't track it+ ;; has X-Metabase-Client header, but it's not the SDK, so we don't track it(let [request (mock-request {:client "my-client"})good (analytics.core/embedding-mw (fn [_ respond _] (respond {:status 200})))bad (analytics.core/embedding-mw (fn [_ respond _] (respond {:status 400})))diff --git a/test/metabase/session/models/session_test.clj b/test/metabase/session/models/session_test.cljindex 6833faabde3..1cbe3ee8639 100644--- a/test/metabase/session/models/session_test.clj+++ b/test/metabase/session/models/session_test.clj@@ -64,7 +64,7 @@metabase.login-history.record/maybe-send-login-from-new-device-email(fn [login-history](when-let [futur (original-maybe-send login-history)]- ;; block in tests+ ;; block in tests(u/deref-with-timeout futur 10000)))](mt/with-temp [:model/LoginHistory _ {:user_id user-id:device_id (str (random-uuid))}@@ -129,7 +129,7 @@metabase.login-history.record/maybe-send-login-from-new-device-email(fn [login-history](when-let [futur (original-maybe-send login-history)]- ;; block in tests+ ;; block in tests(u/deref-with-timeout futur 10000)))](let [device (str (random-uuid))](mt/with-temp [:model/LoginHistory _ {:user_id user-iddiff --git a/test/metabase/settings/models/setting_test.clj b/test/metabase/settings/models/setting_test.cljindex 262fe058b59..b469c13cb69 100644--- a/test/metabase/settings/models/setting_test.clj+++ b/test/metabase/settings/models/setting_test.clj@@ -1623,7 +1623,7 @@(let [ex (get-parse-exception :json "[1, 2,")](assert-parser-exception!:json ex- ;; TODO it would be safe to expose the raw Jackson exception here, we could improve redaction logic+ ;; TODO it would be safe to expose the raw Jackson exception here, we could improve redaction logic#_(str "Unexpected end-of-input within/between Array entries\n"" at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 7]")"Error of type class com.fasterxml.jackson.core.JsonParseException thrown while parsing a setting"))))@@ -1664,7 +1664,7 @@(let [ex (get-parse-exception :csv "\"1\"$ekr3t")](assert-parser-exception!:csv ex- ;; we don't expose the raw exception here, as it would give away the first character of the secret+ ;; we don't expose the raw exception here, as it would give away the first character of the secret#_"CSV error (unexpected character: $)""Error of type class java.lang.Exception thrown while parsing a setting"))))diff --git a/test/metabase/slackbot/streaming_test.clj b/test/metabase/slackbot/streaming_test.cljindex da2660e89f3..91a2dca0fac 100644--- a/test/metabase/slackbot/streaming_test.clj+++ b/test/metabase/slackbot/streaming_test.clj@@ -218,7 +218,7 @@(fn [_conv-id _profile-id _user-message & {:as opts}](deliver stored opts){:assistant-msg-id 1 :assistant-external-id "ext"})- ;; Force setup to throw *after* start-turn! has run.+ ;; Force setup to throw *after* start-turn! has run.slackbot.persistence/message-history(fn [& _] (throw (ex-info "boom" {})))](mt/client :post 200 "metabot/slack/events"diff --git a/test/metabase/sso/integrations/slack_connect_test.clj b/test/metabase/sso/integrations/slack_connect_test.cljindex 396a42e5578..4bbb5ab7cba 100644--- a/test/metabase/sso/integrations/slack_connect_test.clj+++ b/test/metabase/sso/integrations/slack_connect_test.clj@@ -153,7 +153,7 @@{:request-options {:redirect-strategy :none}}:code "test-code":state "some-state")]- ;; Without a state cookie, the callback fails with invalid/expired state error+ ;; Without a state cookie, the callback fails with invalid/expired state error(is (str/includes? (:body response) "OIDC state cookie is invalid, expired, or missing")))))))(deftest callback-state-validation-csrf-test@@ -161,11 +161,11 @@(with-test-encryption!(sso.test-helpers/with-slack-default-setup!(with-successful-oidc!- ;; First, initiate auth to set state cookie+ ;; First, initiate auth to set state cookie(let [init-response (mt/client-full-response :get 302 "/auth/sso/slack-connect"{:request-options {:redirect-strategy :none}}:redirect default-redirect-uri)- ;; Convert Set-Cookie headers to Cookie header format (extract name=value parts)+ ;; Convert Set-Cookie headers to Cookie header format (extract name=value parts)set-cookies (get-in init-response [:headers "Set-Cookie"])cookie-header (->> set-cookies(map #(first (str/split % #";"))) ; Extract name=value before first ;@@ -175,7 +175,7 @@:headers {"Cookie" cookie-header}}}:code "test-code":state "wrong-state")]- ;; State mismatch should indicate possible CSRF attack+ ;; State mismatch should indicate possible CSRF attack(is (str/includes? (str (:body response)) "CSRF"))))))))(deftest happy-path-callback-test@@ -183,11 +183,11 @@(with-test-encryption!(sso.test-helpers/with-slack-default-setup!(with-successful-oidc!- ;; First, initiate auth to set state cookie+ ;; First, initiate auth to set state cookie(let [init-response (mt/client-full-response :get 302 "/auth/sso/slack-connect"{:request-options {:redirect-strategy :none}}:redirect default-redirect-uri)- ;; Convert Set-Cookie headers to Cookie header format+ ;; Convert Set-Cookie headers to Cookie header formatset-cookies (get-in init-response [:headers "Set-Cookie"])cookie-header (->> set-cookies(map #(first (str/split % #";")))@@ -251,11 +251,11 @@(letfn [(new-user-exists? [](boolean (seq (t2/select :model/User :%lower.email "[email protected]"))))](is (false? (new-user-exists?)))- ;; Initiate auth+ ;; Initiate auth(let [init-response (mt/client-full-response :get 302 "/auth/sso/slack-connect"{:request-options {:redirect-strategy :none}}:redirect default-redirect-uri)- ;; Convert Set-Cookie headers to Cookie header format+ ;; Convert Set-Cookie headers to Cookie header formatset-cookies (get-in init-response [:headers "Set-Cookie"])cookie-header (->> set-cookies(map #(first (str/split % #";")))@@ -265,7 +265,7 @@:headers {"Cookie" cookie-header}}}:code "test-code":state "test-state")]- ;; Complete callback+ ;; Complete callback(is (sso.test-helpers/successful-login? response))(let [new-user (t2/select-one :model/User :email "[email protected]")](testing "new user"@@ -304,7 +304,7 @@{:success? false:error :user-provisioning-disabled:message "Sorry, but you'll need a test account to view this page. Please contact your administrator."})]- ;; Initiate auth+ ;; Initiate auth(let [init-response (mt/client-full-response :get 302 "/auth/sso/slack-connect"{:request-options {:redirect-strategy :none}}:redirect default-redirect-uri)@@ -312,7 +312,7 @@cookie-header (->> set-cookies(map #(first (str/split % #";")))(str/join "; "))]- ;; Try callback - should fail+ ;; Try callback - should fail(mt/client-real-response :get 401 "/auth/sso/slack-connect/callback"{:request-options {:redirect-strategy :none:headers {"Cookie" cookie-header}}}diff --git a/test/metabase/sso/oidc/http_test.clj b/test/metabase/sso/oidc/http_test.cljindex 5533e33577b..59d9865f6f4 100644--- a/test/metabase/sso/oidc/http_test.clj+++ b/test/metabase/sso/oidc/http_test.clj@@ -61,7 +61,7 @@(testing "Custom options are merged with defaults"(mt/with-temporary-setting-values [oidc-allowed-networks :allow-all](mt/with-dynamic-fn-redefs [http/get (fn [_url opts]- ;; Verify custom opts are present alongside defaults+ ;; Verify custom opts are present alongside defaults(is (= :json (:as opts)))(is (= :json (:accept opts)))(is (= 5000 (:conn-timeout opts)))diff --git a/test/metabase/sync/field_values_test.clj b/test/metabase/sync/field_values_test.cljindex 31e68117892..8cec0fca015 100644--- a/test/metabase/sync/field_values_test.clj+++ b/test/metabase/sync/field_values_test.clj@@ -129,30 +129,30 @@:hash_key "random-hash":created_at expired-created-at:updated_at expired-created-at}- ;; expired linked-filter fieldvalues+ ;; expired linked-filter fieldvalues{:field_id field-id:type "advanced":hash_key "random-hash":created_at expired-created-at:updated_at expired-created-at}- ;; valid sandbox fieldvalues+ ;; valid sandbox fieldvalues{:field_id field-id:type "advanced":hash_key "random-hash":created_at now:updated_at now}- ;; valid linked-filter fieldvalues+ ;; valid linked-filter fieldvalues{:field_id field-id:type "advanced":hash_key "random-hash":created_at now:updated_at now}- ;; old full fieldvalues+ ;; old full fieldvalues{:field_id field-id:type "full":created_at expired-created-at:updated_at expired-created-at}- ;; new full fieldvalues+ ;; new full fieldvalues{:field_id field-id:type "full":created_at nowdiff --git a/test/metabase/sync/sync_metadata/comments_test.clj b/test/metabase/sync/sync_metadata/comments_test.cljindex e658553f9d5..b4704692817 100644--- a/test/metabase/sync/sync_metadata/comments_test.clj+++ b/test/metabase/sync/sync_metadata/comments_test.clj@@ -117,7 +117,7 @@added-comment (mt/random-name)dbdef (basic-table table-name nil)](mt/dataset dbdef- ;; create the comment+ ;; create the comment(jdbc/execute! (sql-jdbc.conn/db->pooled-connection-spec (mt/db))[(sql.tx/standalone-table-comment-sqldriver/*driver*diff --git a/test/metabase/sync/sync_metadata/fields/sync_metadata_test.clj b/test/metabase/sync/sync_metadata/fields/sync_metadata_test.cljindex afc468aab04..e739da5533b 100644--- a/test/metabase/sync/sync_metadata/fields/sync_metadata_test.clj+++ b/test/metabase/sync/sync_metadata/fields/sync_metadata_test.clj@@ -343,7 +343,7 @@:base_type :type/Text:effective_type :type/Text}original-field)))- ;; drop the column and create a new one with the same name+ ;; drop the column and create a new one with the same name(sql-jdbc.execute/do-with-connection-with-options:h2(mt/db)diff --git a/test/metabase/sync/sync_metadata/indexes_test.clj b/test/metabase/sync/sync_metadata/indexes_test.cljindex 68863526f7d..dc666a84b83 100644--- a/test/metabase/sync/sync_metadata/indexes_test.clj+++ b/test/metabase/sync/sync_metadata/indexes_test.clj@@ -39,7 +39,7 @@(is (true? (t2/select-one-fn :database_indexed :model/Field (mt/id :table :first))))(is (not= true (t2/select-one-fn :database_indexed :model/Field (mt/id :table :second))))(finally- ;; clean the db so this test is repeatable+ ;; clean the db so this test is repeatable(t2/delete! :model/Database (mt/id))(u/ignore-exceptions(tx/destroy-db! driver/*driver* ds))))))))diff --git a/test/metabase/task_history/api_test.clj b/test/metabase/task_history/api_test.cljindex 1dd0bbd5f9b..e21c3cd072d 100644--- a/test/metabase/task_history/api_test.clj+++ b/test/metabase/task_history/api_test.clj@@ -293,7 +293,7 @@:started_at (t/minus now (t/hours 1)):ended_at (t/plus (t/minus now (t/hours 1)) (t/seconds 30))}- ;; task b+ ;; task b:model/TaskHistory_{:status :failed@@ -306,7 +306,7 @@:task "b":started_at (t/zoned-date-time)}- ;; task c+ ;; task c:model/TaskHistory_{:status :started@@ -370,7 +370,7 @@:started_at (t/minus now (t/hours 1)):ended_at (t/plus (t/minus now (t/hours 1)) (t/seconds 30))}- ;; task b+ ;; task b:model/TaskHistory_{:status :faileddiff --git a/test/metabase/task_history/models/task_run_test.clj b/test/metabase/task_history/models/task_run_test.cljindex ac47bcc5ee5..b82d09451fa 100644--- a/test/metabase/task_history/models/task_run_test.clj+++ b/test/metabase/task_history/models/task_run_test.clj@@ -255,7 +255,7 @@inner-step (mt/random-name)outer-steps [(sync-util/create-sync-step outer-step(fn [_]- ;; Nested sync operation+ ;; Nested sync operation(sync-util/sync-operation :sync mock-db "Inner sync"(sync-util/run-sync-operation "inner"mock-dbdiff --git a/test/metabase/task_test.clj b/test/metabase/task_test.cljindex d5c99e34942..bf95667b3a8 100644--- a/test/metabase/task_test.clj+++ b/test/metabase/task_test.clj@@ -149,16 +149,16 @@(testing "make sure the job is in the database before we start the scheduler"(is (t2/exists? (capitalize-if-mysql :qrtz_job_details) (capitalize-if-mysql :job_name) "metabase.task-test.job")))- ;; update the job class to a non-existent class+ ;; update the job class to a non-existent class(t2/update! (capitalize-if-mysql :qrtz_job_details) (capitalize-if-mysql :job_name) "metabase.task-test.job"{(capitalize-if-mysql :job_class_name) "NOT_A_REAL_CLASS"})- ;; stop the scheduler then restart so [[task/delete-jobs-with-no-class!]] is triggered+ ;; stop the scheduler then restart so [[task/delete-jobs-with-no-class!]] is triggered(task/stop-scheduler!)(task/start-scheduler!)(testing "the job should be removed from the database when the scheduler starts"(is (not (t2/exists? (capitalize-if-mysql :qrtz_job_details) (capitalize-if-mysql :job_name) "metabase.task-test.job"))))(finally- ;; restore the state of scheduler before we start the test+ ;; restore the state of scheduler before we start the test(if scheduler-initialized?(task/start-scheduler!)(task/stop-scheduler!))))))diff --git a/test/metabase/test/data/dataset_definitions.clj b/test/metabase/test/data/dataset_definitions.cljindex a74d9372d57..7d0a9ee3ad4 100644--- a/test/metabase/test/data/dataset_definitions.clj+++ b/test/metabase/test/data/dataset_definitions.clj@@ -160,7 +160,7 @@(fn [tabledef](update tabledef :field-definitions concat [(tx/map->FieldDefinition{:field-name "created_by", :base-type :type/Integer, :fk :users})]))- ;; created_by = user.id - 1, except for User 1, who was created by himself (?)+ ;; created_by = user.id - 1, except for User 1, who was created by himself (?):rows(fn [rows](for [[idx [username last-login password-text]] (m/indexed rows)]diff --git a/test/metabase/test/data/impl.clj b/test/metabase/test/data/impl.cljindex ee83c3c456a..c081262d8ff 100644--- a/test/metabase/test/data/impl.clj+++ b/test/metabase/test/data/impl.clj@@ -268,9 +268,9 @@(-> field-values(dissoc :id)(assoc :field_id (get new-field-name->id field-name))- ;; Toucan after-select for FieldValues returns NULL human_readable_values as [] for FE-friendliness..- ;; preserve NULL in the app DB copy so we don't end up changing things that rely on checking whether its- ;; NULL like [[metabase.parameters.chain-filter/search-cached-field-values?]]+ ;; Toucan after-select for FieldValues returns NULL human_readable_values as [] for FE-friendliness..+ ;; preserve NULL in the app DB copy so we don't end up changing things that rely on checking whether its+ ;; NULL like [[metabase.parameters.chain-filter/search-cached-field-values?]](update :human_readable_values not-empty))))))(defn- copy-db-tables! [old-db-id new-db-id]diff --git a/test/metabase/test/data/impl/get_or_create.clj b/test/metabase/test/data/impl/get_or_create.cljindex f45584fb600..b69845fcd69 100644--- a/test/metabase/test/data/impl/get_or_create.clj+++ b/test/metabase/test/data/impl/get_or_create.clj@@ -296,15 +296,15 @@full-sync? (= scan :full)](u/profile (format "%s %s Database %s (reference H2 duration: %s)"(if full-sync? "Sync" "QUICK sync") driver database-name reference-duration)- ;; only do "quick sync" for non `test-data` datasets, because it can take literally MINUTES on CI.- ;;- ;; MEGA SUPER HACK !!! I'm experimenting with this so Redshift tests stop being so flaky on CI! It seems like- ;; if we ever delete a table sometimes Redshift still thinks it's there for a bit and sync can fail because it- ;; tries to sync a Table that is gone! So enable normal resilient sync behavior for Redshift tests to fix the- ;; flakes. If this fixes things I'll try to come up with a more robust solution. -- Cam 2024-07-19. See #45874+ ;; only do "quick sync" for non `test-data` datasets, because it can take literally MINUTES on CI.+ ;;+ ;; MEGA SUPER HACK !!! I'm experimenting with this so Redshift tests stop being so flaky on CI! It seems like+ ;; if we ever delete a table sometimes Redshift still thinks it's there for a bit and sync can fail because it+ ;; tries to sync a Table that is gone! So enable normal resilient sync behavior for Redshift tests to fix the+ ;; flakes. If this fixes things I'll try to come up with a more robust solution. -- Cam 2024-07-19. See #45874(binding [sync-util/*log-exceptions-and-continue?* (= driver :redshift)](sync/sync-database! db {:scan scan}))- ;; add extra metadata for fields+ ;; add extra metadata for fields(try(add-extra-metadata! database-definition db)(catch Throwable e@@ -415,7 +415,7 @@(do(log/info "Data has not been loaded yet. Loading...")(u/with-timeout create-database-timeout-ms- ;; ALWAYS CREATE DATABASE AND LOAD DATA AS UTC! Unless you like broken tests.+ ;; ALWAYS CREATE DATABASE AND LOAD DATA AS UTC! Unless you like broken tests.(test.tz/with-system-timezone-id! "UTC"(tx/create-db! driver dbdef)))))(tx/track-dataset driver dbdef))diff --git a/test/metabase/test/data/interface.clj b/test/metabase/test/data/interface.cljindex 5ffccf83c4b..c543d8dfaf5 100644--- a/test/metabase/test/data/interface.clj+++ b/test/metabase/test/data/interface.clj@@ -72,11 +72,11 @@[:map {:closed true}[:native ms/NonBlankString]]ms/FieldType]]- ;; this was added pretty recently (in the 44 cycle) so it might not be supported everywhere. It should work for- ;; drivers using `:sql/test-extensions` and [[metabase.test.data.sql/field-definition-sql]] but you might need to add- ;; support for it elsewhere if you want to use it. It only really matters for testing things that modify test- ;; datasets e.g. [[mt/with-actions-test-data]]- ;; default is nullable+ ;; this was added pretty recently (in the 44 cycle) so it might not be supported everywhere. It should work for+ ;; drivers using `:sql/test-extensions` and [[metabase.test.data.sql/field-definition-sql]] but you might need to add+ ;; support for it elsewhere if you want to use it. It only really matters for testing things that modify test+ ;; datasets e.g. [[mt/with-actions-test-data]]+ ;; default is nullable[:not-null? {:optional true} [:maybe :boolean]][:unique? {:optional true} [:maybe :boolean]][:pk? {:optional true} [:maybe :boolean]]diff --git a/test/metabase/test/data/sql_jdbc/load_data.clj b/test/metabase/test/data/sql_jdbc/load_data.cljindex 001b96bfa1e..f5e56ef3fd0 100644--- a/test/metabase/test/data/sql_jdbc/load_data.clj+++ b/test/metabase/test/data/sql_jdbc/load_data.clj@@ -146,9 +146,9 @@(if chunk-size(transduce(partition-all chunk-size)- ;; we are very deliberately not passing `rf` directly here, because calling the completing arity with it- ;; breaks things since we're not supposed to be doing that inside `reduce`. We have to use `transduce` here- ;; to get the `partition-all` transducer to work correctly tho which is why we're not just using reduce+ ;; we are very deliberately not passing `rf` directly here, because calling the completing arity with it+ ;; breaks things since we're not supposed to be doing that inside `reduce`. We have to use `transduce` here+ ;; to get the `partition-all` transducer to work correctly tho which is why we're not just using reduce(fn([acc]acc)diff --git a/test/metabase/test/data/sql_jdbc_test.clj b/test/metabase/test/data/sql_jdbc_test.cljindex 21d7d89443f..ad62ac6873e 100644--- a/test/metabase/test/data/sql_jdbc_test.clj+++ b/test/metabase/test/data/sql_jdbc_test.clj@@ -16,7 +16,7 @@(mt/normal-drivers))(let [dbdef (tx/get-dataset-definition defs/test-data)](testing `tx/dataset-already-loaded?- ;; force loading of test-data+ ;; force loading of test-data(mt/db)(testing "should return true for test-data"(is (tx/dataset-already-loaded? driver/*driver* dbdef)))diff --git a/test/metabase/test/generate.clj b/test/metabase/test/generate.cljindex c0f9ab1aea7..bc88290cbbd 100644--- a/test/metabase/test/generate.clj+++ b/test/metabase/test/generate.clj@@ -306,8 +306,8 @@:insert! {:model :model/Measure}:relations {:creator_id [:core-user :id]:table_id [:table :id]}}})- ;; :revision {}- ;; :task-history {}+;; :revision {}+;; :task-history {};; * inserters(defn- spec-gen@@ -374,8 +374,8 @@(catch clojure.lang.ExceptionInfo e(if (and (pos? num-retries)(str/includes? (ex-message e) "Couldn't satisfy such-that predicate"))- ;; We can't recur from here, and I don't think it's worth using a more complex trampoline.- ;; We are not going to overflow the stack, so this should be fine.+ ;; We can't recur from here, and I don't think it's worth using a more complex trampoline.+ ;; We are not going to overflow the stack, so this should be fine.(spec-gen-with-retries query (dec num-retries))(throw e)))))diff --git a/test/metabase/test/initialize/row_lock.clj b/test/metabase/test/initialize/row_lock.cljindex 17a67785629..487d27704e0 100644--- a/test/metabase/test/initialize/row_lock.clj+++ b/test/metabase/test/initialize/row_lock.clj@@ -11,6 +11,6 @@[](let [lock-name-str (str (namespace app-db.cluster-lock/card-statistics-lock)"/" (name app-db.cluster-lock/card-statistics-lock))]- ;; Create cluster lock row before running tests+ ;; Create cluster lock row before running tests(when-not (t2/exists? :metabase_cluster_lock :lock_name lock-name-str)(t2/query-one {:insert-into [:metabase_cluster_lock] :columns [:lock_name] :values [[lock-name-str]]}))))diff --git a/test/metabase/test/util.clj b/test/metabase/test/util.cljindex cc241d70c7a..12dfe6bf2f2 100644--- a/test/metabase/test/util.clj+++ b/test/metabase/test/util.clj@@ -1589,7 +1589,7 @@actual)(map? expected)- ;; recursive case (ex: to turn value that might be a flatland.ordered.map into a regular Clojure map)+ ;; recursive case (ex: to turn value that might be a flatland.ordered.map into a regular Clojure map)(select-keys actual (keys expected)):elsediff --git a/test/metabase/transforms/jobs_test.clj b/test/metabase/transforms/jobs_test.cljindex 7b31a0d25d7..f297572207e 100644--- a/test/metabase/transforms/jobs_test.clj+++ b/test/metabase/transforms/jobs_test.clj@@ -288,7 +288,7 @@(is (=? {:status :failed:message string?}(t2/select-one :model/TransformJobRun :id @run-id-atom)))- ;; crowberto is a superuser/admin, so they receive the notification+ ;; crowberto is a superuser/admin, so they receive the notification(is (mt/received-email-subject? :crowberto #"The job .* had failures"))(is (mt/received-email-body? :crowberto #"Uncaught error")))))))))))))@@ -493,7 +493,7 @@(notification.seed/seed-notification!)(let [mp (mt/metadata-provider)table (t2/select-one :model/Table (mt/id :transforms_products))- ;; generate sql for different dbs+ ;; generate sql for different dbssql (-> (lib/query mp (lib.metadata/table mp (mt/id :transforms_products)))(lib/with-fields [(lib.metadata/field mp (mt/id :transforms_products :name))])(lib/limit 10)@@ -513,7 +513,7 @@:model/TransformJobTransformTag _ {:job_id (:id job):tag_id (:id tag):position 0}- ;; independent transform+ ;; independent transform:model/Transform t0 {:name "transform0":source {:type :query:query (lib/native-query mp sql)}@@ -522,9 +522,9 @@:model/TransformTransformTag _tag0 {:transform_id (:id t0):tag_id (:id tag):position 0}]- ;; NOTE: No `with-current-user` wrapper - this simulates running the transform- ;; without a user context (e.g., from a cron job or background task).- ;; previously this could produce the wrong error message from the QP routing middleware.+ ;; NOTE: No `with-current-user` wrapper - this simulates running the transform+ ;; without a user context (e.g., from a cron job or background task).+ ;; previously this could produce the wrong error message from the QP routing middleware.(try(jobs/run-job! (:id job) {:run-method :cron})(catch Exception _))@@ -534,11 +534,11 @@(deftest get-plan-ignores-unrelated-routing-enabled-transforms-test(when config/ee-available?(testing "get-plan must not scan unrelated transforms on routing-enabled databases"- ;; Regression: a transform on a routing-enabled database is unrunnable (by design), but historically- ;; `get-plan` would fetch *every* transform in the system and call `table-dependencies` on each to- ;; build a global dependency graph. The routing-enabled transform would throw during that scan,- ;; taking down the whole scheduler and sending a misleading failure email naming the zombie- ;; transform — even when no job was asking to run it.+ ;; Regression: a transform on a routing-enabled database is unrunnable (by design), but historically+ ;; `get-plan` would fetch *every* transform in the system and call `table-dependencies` on each to+ ;; build a global dependency graph. The routing-enabled transform would throw during that scan,+ ;; taking down the whole scheduler and sending a misleading failure email naming the zombie+ ;; transform — even when no job was asking to run it.(mt/with-premium-features #{:database-routing :transforms-basic}(let [mp (mt/metadata-provider)](mt/with-temp [:model/Database _destination {:engine :h2@@ -546,7 +546,7 @@:details {:destination_database true}}:model/DatabaseRouter _ {:database_id (mt/id):user_attribute "db_name"}- ;; Zombie transform on a routing-enabled database, NOT tagged to any job.+ ;; Zombie transform on a routing-enabled database, NOT tagged to any job.:model/Transform _zombie {:name "zombie-transform":source {:type :query:query (lib/native-query mp "SELECT 1")}diff --git a/test/metabase/upload/impl_test.clj b/test/metabase/upload/impl_test.cljindex 238aa8dc43c..b17f175532d 100644--- a/test/metabase/upload/impl_test.clj+++ b/test/metabase/upload/impl_test.clj@@ -458,7 +458,7 @@(is (= (ddl.i/format-name driver/*driver* "chu_se_de_20240628000000")(:name table)))))))))(testing "The names should be truncated to the right size"- ;; we can assume app DBs use UTF-8 encoding (metabase#11753)+ ;; we can assume app DBs use UTF-8 encoding (metabase#11753)(let [max-bytes 15](with-redefs [; redef this because the UNIX filename limit is 255 bytes, so we can't test it in CIupload/max-bytes (constantly max-bytes)]@@ -1483,7 +1483,7 @@(t2/update! :model/Table table-id {:is_upload is-upload})(try (update-csv! action {:table-id table-id, :file file})(finally- ;; Drop the table in the testdb if a new one was created.+ ;; Drop the table in the testdb if a new one was created.(when (and new-table (not= driver/*driver* :redshift)) ; redshift tests flake when tables are dropped(driver/drop-table! driver/*driver*(mt/id)@@ -2036,7 +2036,7 @@(with-uploads-enabled!(testing "Append should handle new columns being added in the latest CSV"(with-upload-table! [table (create-upload-table!)]- ;; Reorder as well for good measure+ ;; Reorder as well for good measure(let [csv-rows ["game,name" "Witticisms,Fluke Skytalker"]file (csv-file-with csv-rows)](testing "The new row is inserted with the values correctly reordered"@@ -2056,7 +2056,7 @@(with-upload-table! [table (create-upload-table!)](is (= (header-with-auto-pk ["Name"])(column-display-names-for-table table)))- ;; Reorder as well for good measure+ ;; Reorder as well for good measure(let [csv-rows ["α,name""omega,Everything"]file (csv-file-with csv-rows)]@@ -2078,10 +2078,10 @@(testing "Append should handle new non-ascii columns being added in the latest CSV"(with-upload-table! [table (create-upload-table!:col->upload-type (columns-with-auto-pk {"α" ::upload-types/varchar-255}))]- ;; We can't type a literal uppercase Alpha, as our whitespace linter will complain.+ ;; We can't type a literal uppercase Alpha, as our whitespace linter will complain.(is (= (header-with-auto-pk [(u/upper-case-en "α")])(column-display-names-for-table table)))- ;; Reorder as well for good measure+ ;; Reorder as well for good measure(let [csv-rows ["α,ϐ""omega,Everything"]file (csv-file-with csv-rows)]diff --git a/test/metabase/warehouse_schema_rest/api/table_test.clj b/test/metabase/warehouse_schema_rest/api/table_test.cljindex bc0e4757f0d..ecce8f0ffa3 100644--- a/test/metabase/warehouse_schema_rest/api/table_test.clj+++ b/test/metabase/warehouse_schema_rest/api/table_test.clj@@ -266,7 +266,7 @@:visibility_type "normal":has_field_values "none":database_required false- ;; Index sync is turned off across the application as it is not used ATM.+ ;; Index sync is turned off across the application as it is not used ATM.#_#_:database_indexed true:database_is_auto_increment true:name_field {:base_type "type/Text",@@ -347,7 +347,7 @@:base_type "type/BigInteger":effective_type "type/BigInteger":has_field_values "none"- ;; Index sync is turned off across the application as it is not used ATM.+ ;; Index sync is turned off across the application as it is not used ATM.#_#_:database_indexed true:database_required false:database_is_auto_increment true@@ -669,7 +669,7 @@:effective_type "type/BigInteger":has_field_values "none":database_required false- ;; Index sync is turned off across the application as it is not used ATM.+ ;; Index sync is turned off across the application as it is not used ATM.#_#_:database_indexed true:database_is_auto_increment true:name_field {:base_type "type/Text",diff --git a/test/metabase/warehouses_rest/api_test.clj b/test/metabase/warehouses_rest/api_test.cljindex 44101798a84..5374b9fb215 100644--- a/test/metabase/warehouses_rest/api_test.clj+++ b/test/metabase/warehouses_rest/api_test.clj@@ -217,7 +217,7 @@:model/Table {table-id-1 :id} {:db_id db-id}:model/Table {table-id-2 :id} {:db_id db-id}](mt/with-no-data-perms-for-all-users!- ;; Query permissions for a single table is enough to fetch the DB+ ;; Query permissions for a single table is enough to fetch the DB(data-perms/set-table-permission! group table-id-1 :perms/view-data :legacy-no-self-service)(data-perms/set-table-permission! group table-id-1 :perms/create-queries :no)(data-perms/set-table-permission! group table-id-2 :perms/view-data :unrestricted)@@ -1453,7 +1453,7 @@(is (= (task.sync-databases-test/all-db-sync-triggers-name db)(task.sync-databases-test/query-all-db-sync-triggers-name db)))(let [db (t2/select-one :model/Database (:id db))]- ;; make sure the new schedule is randomized, not from the payload+ ;; make sure the new schedule is randomized, not from the payload(is (not= (-> schedule-map-for-weekly u.cron/schedule-map->cron-string)(:metadata_sync_schedule db)))(is (not= (-> schedule-map-for-last-friday-at-11pm u.cron/schedule-map->cron-string)@@ -1851,7 +1851,7 @@;; table is not visible. Any non-nil value of `visibility_type` means Table shouldn't be visible:model/Table _ {:db_id db-id :schema "schema_2" :name "table_2a" :visibility_type "hidden"}:model/Table _ {:db_id db-id :schema "schema_2" :name "table_2b" :visibility_type "cruft"}- ;; table is not active+ ;; table is not active:model/Table _ {:db_id db-id :schema "schema_3" :name "table_3" :active false}](testing "GET /api/database/:id/schemas should not return schemas with no VISIBLE TABLES"(is (= ["schema_1a" "schema_1b" "schema_1c"]@@ -2025,7 +2025,7 @@:model/Card card-2 (assoc (card-with-native-query "Card 2"):type :model):model/Card _card-3 (assoc (card-with-native-query "error")- ;; regular saved question should not be in the results+ ;; regular saved question should not be in the results:type :question)];; run the cards to populate their result_metadata columns(doseq [card [card-1 card-2]]diff --git a/test/metabase/xrays/automagic_dashboards/core_test.clj b/test/metabase/xrays/automagic_dashboards/core_test.cljindex 431e04be55f..868e39eed0a 100644--- a/test/metabase/xrays/automagic_dashboards/core_test.clj+++ b/test/metabase/xrays/automagic_dashboards/core_test.clj@@ -1319,7 +1319,7 @@{"Lat" {:field_type [:type/Latitude], :score 90}}{"Lat" {:field_type [:entity/GenericTable :type/Latitude], :score 100}}{"Lat" {:field_type [:entity/UserTable :type/Latitude], :score 100}}]- ;; These will be matched in our tests since this is a generic table entity.+ ;; These will be matched in our tests since this is a generic table entity.bindable-dimensions (remove#(-> % vals first :field_type first #{:entity/UserTable})dimensions)