Compare commits

..

392 Commits

Author SHA1 Message Date
Chris Truter
8c6ce9681f Revert "Revert e2e test changes - keep tracking legacy search" 2025-01-23 16:11:51 +02:00
Chris Truter
149a9b1666 Make appdb the default, for e2e tests.
I tried setting the env var in the e2e YAML, but didn't seem to work for CI.
2025-01-23 12:16:33 +02:00
github-automation-metabase
fd887f23f8 Fixes ellipsis button hidden when dash card title is empty string (#52305) (#52501)
* fix unknown attribute error

* fix another error message about unknow HTML attribute

* fix invisible ellipsis when title is empty string

* added e2e test

Co-authored-by: Sébastien <sebastien@metabase.com>
2025-01-22 10:09:34 +00:00
github-automation-metabase
5aeb9b6f83 Fix - Default names for date and number filters are off (#52369) (#52497)
* Update labels

* Revert "Update labels"

This reverts commit be632aec2e.

* Simplify the fix

* Update unit tests

* Update test

* Revert "Simplify the fix"

This reverts commit a9c267c4c0.

* Update labels

* Update test

* Make it work in native editor

* Revert "Update unit tests"

This reverts commit 3614a8ff2f.

* Update test

* Update test

* Update test

* Update test

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2025-01-22 08:38:20 +00:00
github-automation-metabase
955fa8ad27 Add a repro for #7108 (#52429) (#52498)
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2025-01-22 08:07:59 +00:00
github-automation-metabase
1c3df30d86 perf: Optimize metabase.formatter/strip-trailing-zeroes (#51774) (#51855)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2025-01-22 07:50:52 +00:00
github-automation-metabase
13a2547fab docs: Update mysql.md (#52107) (#52228)
* Update mysql.md

Add a note about vitess and planetscale

* Update docs/databases/connections/mysql.md



---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2025-01-22 07:20:14 +00:00
github-automation-metabase
5a8b6c6c5d Upgrade postgres app db version (#50310) (#52328)
* Upgrade postgres app db version

The more the marrier

* Update docs/installation-and-operation/configuring-application-database.md



---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2025-01-22 07:19:19 +00:00
github-automation-metabase
ddbc480176 🤖 backported "Static Viz Start of Week in Subscription Emails" (#52168)
* fix conflicts

* Fixing formatting

---------

Co-authored-by: Tyler Plude <tsplude@gmail.com>
2025-01-21 13:23:19 -08:00
github-automation-metabase
536ace8b9c enterprise only (#52151) (#52459)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-21 20:53:42 +00:00
github-automation-metabase
f7f277fa3a merge conflicts (#52344)
Co-authored-by: Tyler Plude <tsplude@gmail.com>
2025-01-21 12:12:29 -08:00
github-automation-metabase
754cf8ed12 fix(sdk): add theme change transition to the root element (#52427) (#52449)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-21 21:16:52 +04:00
github-automation-metabase
986d532280 [db-pool] Retry acquiring the connection one in tests to reduce flakiness (#52360) (#52454)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2025-01-21 16:47:42 +00:00
github-automation-metabase
d1a5765613 Add an order by to the batched truncation (#52417) (#52444)
This is a strange one. But in practice, this was still doing a seq scan
on postgres.

```sql
clean=# explain DELETE FROM query_execution WHERE id IN (SELECT id FROM query_execution WHERE started_at <= '2025-01-02 01:10:15.651839+00' LIMIT 50000);
                                                           QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------
 Delete on query_execution  (cost=526084.17..1066675.96 rows=0 width=0)
   ->  Nested Loop  (cost=526084.17..1066675.96 rows=50000 width=34)
         ->  Unique  (cost=526076.73..526326.73 rows=50000 width=32)
               ->  Sort  (cost=526076.73..526201.73 rows=50000 width=32)
                     Sort Key: "ANY_subquery".id
                     ->  Subquery Scan on "ANY_subquery"  (cost=0.00..522174.32 rows=50000 width=32)
                           ->  Limit  (cost=0.00..521674.32 rows=50000 width=4)
table scan >>>>>              ->  Seq Scan on query_execution query_execution_1  (cost=0.00..1704153.49 rows=163335 width=4)
                                       Filter: (started_at <= '2025-01-01 19:10:15.651839-06'::timestamp with time zone)
         ->  Bitmap Heap Scan on query_execution  (cost=7.44..11.46 rows=1 width=10)
               Recheck Cond: (id = "ANY_subquery".id)
               ->  Bitmap Index Scan on query_execution_pkey  (cost=0.00..7.44 rows=1 width=0)
                     Index Cond: (id = "ANY_subquery".id)
(13 rows)

```

The odd thing is that it is sensitive to what timestamp you use. Here's
the same query but with a timestamp in 2024:

```sql
clean=# explain DELETE FROM query_execution WHERE id IN (SELECT id FROM query_execution WHERE started_at <= '2024-12-19 01:10:15.651839+00' LIMIT 50000);
                                                             QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------
 Delete on query_execution  (cost=225736.06..641819.90 rows=0 width=0)
   ->  Nested Loop  (cost=225736.06..641819.90 rows=28490 width=34)
         ->  HashAggregate  (cost=225724.95..226009.85 rows=28490 width=32)
               Group Key: "ANY_subquery".id
               ->  Subquery Scan on "ANY_subquery"  (cost=122917.34..225653.72 rows=28490 width=32)
                     ->  Limit  (cost=122917.34..225368.82 rows=28490 width=4)
                           ->  Bitmap Heap Scan on query_execution query_execution_1  (cost=122917.34..225368.82 rows=28490 width=4)
                                 Recheck Cond: (started_at <= '2024-12-18 19:10:15.651839-06'::timestamp with time zone)
                                 ->  Bitmap Index Scan on idx_query_execution_started_at  (cost=0.00..122910.22 rows=28490 width=0)
                                       Index Cond: (started_at <= '2024-12-18 19:10:15.651839-06'::timestamp with time zone)
         ->  Bitmap Heap Scan on query_execution  (cost=11.11..15.12 rows=1 width=10)
               Recheck Cond: (id = "ANY_subquery".id)
               ->  Bitmap Index Scan on query_execution_pkey  (cost=0.00..11.11 rows=1 width=0)
                     Index Cond: (id = "ANY_subquery".id)
(14 rows)
```

And this is because the db engine knows that most of my data is around
2025 and will just hit the whole table rather than hit an index and then
go return most of the table.

The logic we want here is basically, "work up the index on created_at
until we get to a notion of recent".

If we add an order by, we're close to that and things go much faster
again

```sql
clean=# explain DELETE FROM query_execution WHERE id IN (SELECT id FROM query_execution WHERE started_at <= '2025-01-02 01:10:15.651839+00' order by id asc LIMIT 50000);
                                                                         QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------
 Delete on query_execution  (cost=851615.84..1392207.62 rows=0 width=0)
   ->  Nested Loop  (cost=851615.84..1392207.62 rows=50000 width=34)
         ->  Unique  (cost=851608.39..851858.39 rows=50000 width=32)
               ->  Sort  (cost=851608.39..851733.39 rows=50000 width=32)
                     Sort Key: "ANY_subquery".id
                     ->  Subquery Scan on "ANY_subquery"  (cost=0.55..847705.98 rows=50000 width=32)
                           ->  Limit  (cost=0.55..847205.98 rows=50000 width=4)
                                 ->  Index Scan using query_execution_pkey on query_execution query_execution_1  (cost=0.55..2767566.54 rows=163335 width=4)
                                       Filter: (started_at <= '2025-01-01 19:10:15.651839-06'::timestamp with time zone)
         ->  Bitmap Heap Scan on query_execution  (cost=7.44..11.46 rows=1 width=10)
               Recheck Cond: (id = "ANY_subquery".id)
               ->  Bitmap Index Scan on query_execution_pkey  (cost=0.00..7.44 rows=1 width=0)
                     Index Cond: (id = "ANY_subquery".id)
(13 rows)
```

Co-authored-by: dpsutton <dan@dpsutton.com>
2025-01-21 15:56:22 +00:00
github-automation-metabase
84c3067d71 Add overflow auto for dropdown (#52409) (#52437)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-21 15:17:01 +00:00
github-automation-metabase
3c764ab2f4 bump tolerance (#52408) (#52435)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2025-01-21 14:21:45 +00:00
github-automation-metabase
b19cec43b0 🤖 backported "fix(sdk): fix data picker crash by using mantine popover" (#52203)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Phoomparin Mano <phoomparin@gmail.com>
fix(sdk): fix data picker crash by using mantine popover (#52096)
2025-01-21 18:33:40 +07:00
github-automation-metabase
2de7e5c735 Improve theme transitions (#52259)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-21 14:39:33 +04:00
github-automation-metabase
c496b8f926 Add wotbrew to team files (#52383) (#52426)
Co-authored-by: Dan Stone <wotbrew@gmail.com>
2025-01-21 09:47:28 +00:00
github-automation-metabase
d127102df9 Sync extra fields to order-by when replacing breakouts (#52338) (#52412)
When we replace a breakout, we also update any related order-by.  However, we weren't updating all fields.  This
meant that the order-by and breakout weren't identical.  This was fine-ish on postgres, because they compiled to the
same thing.  However, on google bigquery, it expects that group bys and order bys will refer to the AS alias instead
of just duplicating the code for the aliased thing.  The differences between order-by and breakout meant that we
didn't realize that the one was supposed to match the other, and so we duplicated the code and bigquery barfed.
Syncing more fields fixes that.

Co-authored-by: William <william@metabase.com>
2025-01-20 22:58:18 +00:00
github-automation-metabase
014f535a11 Fix flex-grow property on ChartSegmentedControl buttons (#52356) (#52410)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-20 22:16:17 +00:00
github-automation-metabase
1a50f174fa Add new strings for v52.7 (#52315) (#52402)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
2025-01-20 21:03:05 +00:00
github-automation-metabase
b795acf008 🤖 backported "perf: faster snowflake sync with describe-fields" (#52350)
* perf: faster snowflake sync with describe-fields

Fixes: #49624

* Fix formatting

* Update modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj



* Fix up datetime types

* Ensure describe-fields is sorted

* Fix types for venues

* Check for integer with numeric_scale

* Consistency with getColumnMetadata

* Add pks

---------

Co-authored-by: Case Nelson <case@metabase.com>
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2025-01-20 13:59:16 -07:00
github-automation-metabase
ec748bae87 🤖 backported "Secret handling in details" (#52214)
* Secret handling in details

Secret handling in details was very confusing. This PR consolidates most
of the logic into models.secret around toucan2 lifecycles of
model/Database.

Some of the problems fixed here:
 - path and value confusion. It was possible to swap between uploaded
   files and file-paths and end up with the uploaded file being treated
   as a file-path and leaking to users in logs, APIs, and UIs.
 - Unclear management of secret properties in details. The
   responsibility for taking in secrets in details, saving to a Secret,
   and then ensuring those incoming secrets do not get saved in details
   was spread out all over the place. This made it possible to save a
   secret-value in details.
 - Unclear hydration of secret values for connection testing. How a
   driver was supposed to get a secret and which properties might be in
   details was unclear and inconsistent. Often mangling strings and
   files returned by Secret api was necessary.
 - Encoding problems. Uploaded files were being mangled by taking bytes
   into a string and back to bytes to save. Ensure that the bytes given
   are the bytes saved.

* Fix merge

* Fix tests

* Fix db creation

* Fix db creation in other tests

* Manually add updated_at to database

* Fix tests

* Fix tests

* Fix after-select input

* Wrap in data-uri

* Fallback for -value if base64 encoding failed

* If not data-uri, then just turn string to utf8 bytes

* Poking at oracle failures

* Oracle wrap bytes in data-uri

* Don't clean secret properties from oracle

* Fix base64 typo and add test util for data-uri wrap

* Fix snowflake test

* Another snowflake test

* Update src/metabase/models/secret.clj



* Update src/metabase/models/secret.clj



* Update src/metabase/models/secret.clj



* Update test/metabase/test/util.clj



* Update src/metabase/util/jvm.clj



* Update src/metabase/util/jvm.clj



---------

Co-authored-by: Case Nelson <case@metabase.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2025-01-20 13:28:36 -07:00
github-automation-metabase
13b3f47296 Disable pivot drill thru for multi-stage queries (#52239) (#52335)
This drill thru was recently enabled for multi-stage queries in #51950, but there is a bug which causes the
QueryColumnPicker to fail if a join is present. Disable the drill thru for now while we work on a fix.

Closes #52221
Related to  #52236

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2025-01-20 18:14:31 +00:00
github-automation-metabase
b5356cc97b proper team for seb (#52326) (#52396)
Co-authored-by: Sébastien <sebastien@metabase.com>
2025-01-20 17:32:43 +00:00
github-automation-metabase
198be6360e fix: correct layout of viz settings on dashboard with reduced motion (#51960) (#52100)
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2025-01-20 16:43:09 +00:00
github-automation-metabase
7f821ff352 fix(sdk): disable dashboard card click behavior and prevent url formatting (#51290) (#52390)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Nicolò Pretto <info@npretto.com>
2025-01-20 16:08:52 +00:00
github-automation-metabase
524c8f817c feat(sdk): granular documentation links in usage problem banner (#52257) (#52386)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2025-01-20 15:21:29 +00:00
github-automation-metabase
85bc61ff3e Fix error button hover color (#52373) (#52376)
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2025-01-20 13:05:16 +00:00
github-automation-metabase
4085da97da 🤖 backported "Partial rollback of FieldValuesWidget to v50" (#51631)
* Partial rollback of FieldValuesWidget to v50 (#51183)

* Reset FieldValuesWidget to v50 state

* Revert some changes in SingleSelectListField to v50

* Make onSearchChange optional

* Use RowValue instead of string

* Add test-ids to FieldValuesWidget inputs

* Add testing matrix for all parameter combinations

* Add filter matrix test to github workflow

* Fix unit test

* Render custom option value when it exists

* Fix e2e test

* Fix remove value helper

* Fix e2e test

* Render custom label on TokenField

* Update Loki Snapshots

* Use css colors for TokenFieldItem

* Make TokenField dark-mode aware

* Make TokenFieldItem dark-mode aware

* Update Loki Snapshots

* Fix e2e test after merge

* Add listbox role to tokenfield values

* Fix more e2e tests

* Fix e2e test for listbox

* Remove commented out code

* Fix e2e test

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>

* Remove only in e2e test

* Apply H.restore to flaky test

* Update Loki Snapshots

---------

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2025-01-20 14:03:37 +01:00
github-automation-metabase
8c3f31813b Remove stray file that got checked in (#52336) (#52379)
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2025-01-20 12:32:52 +00:00
github-automation-metabase
125e856a9e Update static embedding code template for nodejs (#52366) (#52372)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-20 11:18:35 +00:00
github-automation-metabase
9c08bb5b5b Fix empty state color for accordion list (#52308) (#52367)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-20 10:17:49 +00:00
github-automation-metabase
ca8c811fa5 🤖 backported "Repro #46832 - Aggregation picker does not show all columns" (#52362)
* Add repro for #46832 (#52311)

* Remove unwanted code

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2025-01-20 16:46:49 +07:00
github-automation-metabase
2904410d6f 🤖 backported "Repro #48358 - Incorrect Breakouts Generated for Multi Series Viz When Question is Edited" (#52363)
* Add repro for #48358 (#52313)

* Adjust code to v52

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2025-01-20 09:38:21 +00:00
github-automation-metabase
84e46f8b52 Fix - Custom Expression error can sometimes be slightly misleading (#52274) (#52364)
* Support multiple operators in expectOp

* Refactor

* Show errors from parser

* Revert recursive-parser changes

* Pass human-friendly operator name to expectOp

* Fix typo

* Require comma if next token is not closing parenthesis

* Add a repro for #15892

* Update existing test

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2025-01-20 08:26:03 +00:00
github-automation-metabase
eca95f9f88 Fix png image paths when rendered inside Embedding SDK (#52201) (#52361)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-20 07:44:22 +00:00
github-automation-metabase
6d8e4da60e [Databricks] Make dataset loading chunk-size dynamic (#52097) (#52340)
* Make dataset loading chunk-size dynamic

* Update comment

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
2025-01-18 11:14:57 +00:00
github-automation-metabase
d817b1d6b5 Update Readme version references and published npm version to 0.52.7 (#52358) 2025-01-18 02:26:57 +00:00
github-automation-metabase
87bbdc199e 🤖 backported "Replace FormFooter default export with named export" (#52355)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-18 02:08:28 +00:00
github-automation-metabase
44457ce71d 🤖 backported "Convert CreateDashboardModal to new components" (#52348)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-17 16:20:02 -08:00
github-automation-metabase
0c28c43481 Change order of input wrapper elements (#52235) (#52330)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-17 16:19:50 -08:00
github-automation-metabase
073f6ed20b no need to reset PR comments on non-PRs (#52352) (#52353)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-18 00:10:35 +00:00
github-automation-metabase
32bbf25f25 feat: Add csv_upload_failed metric to Prometheus (#52219) (#52332)
Co-authored-by: Case Nelson <case@metabase.com>
2025-01-17 23:44:25 +00:00
github-automation-metabase
70f581e84c fix(sdk): Add segmented button for chart settings (#52076) (#52233)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-17 15:19:07 -08:00
github-automation-metabase
f5d42c0ed9 Fix bad overflow on ColumnItem preventing showing and hiding columns (#52290) (#52347)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-17 22:39:50 +00:00
github-automation-metabase
7540f257e2 Instant e2e test updates (#51605) (#52346)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-17 22:38:45 +00:00
github-automation-metabase
044927fdea docs: linked filters (#52182) (#52343)
* linked filters draft

* linked filters draft

* probably should actually insert the link eh?

* Apply suggestions from code review



* review feedback

---------

Co-authored-by: Alex Yarosh <alexandra@metabase.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-17 21:23:54 +00:00
github-automation-metabase
8c1a0ce978 docs: sharing icon (#52281) (#52342)
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2025-01-17 21:20:02 +00:00
github-automation-metabase
dd6c1b383c Don't pass locale codes to localeCompare (#52284) (#52337)
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2025-01-17 20:44:03 +00:00
github-automation-metabase
8af929eac5 docs - azure sql (#52287) (#52329)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-17 19:06:52 +00:00
github-automation-metabase
5cb2f31949 Return is-null filter in underlying-records drill thru if value is nil (#52295) (#52323)
Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2025-01-17 17:38:20 +00:00
github-automation-metabase
8104261230 docs - env var updates (#51986) (#52283)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-17 14:56:05 +00:00
github-automation-metabase
751091a69c Fixed resetting the embedded preview to the default font (#52306) (#52309)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-17 13:32:38 +00:00
github-automation-metabase
b6b0b59a6e Fix - Custom column formula autocomplete overwrites part of existing formula (#52198) (#52303)
* Add repro for #50925

* Add a test

* Fix the case with whitespace following an incomplete token

* Add test case with bracket identifier following an incomplete token

* Add comments

* Thanks vscode

* Fix the case with bracket identifier following an incomplete token

* Simplify unit tests

* Fix the logic

* Update comment

* Fix it

* Refactor

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2025-01-17 08:32:33 +00:00
github-automation-metabase
94678090d6 Fix - Confusing error message when trying to add a custom expression aggregation (#52267) (#52301)
* Throw different error when using a known name that is not a metric

* Drop checking for segments as they cannot be used in aggregation expressions anyway

* Add tests

* Remove redundant withName: true

* Wrap with describe

* Make naming consistent

* Improve copy

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2025-01-17 08:12:28 +00:00
github-automation-metabase
6ff2ac92d0 Add popover props for interactive question dropdowns (#52225) (#52297)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-17 03:07:52 +00:00
github-automation-metabase
e18ec8c425 49809 Fix sorting by unbinned date expression (#52277) (#52292)
Co-authored-by: Eric Normand <ericwnormand@gmail.com>
2025-01-17 00:13:26 +00:00
github-automation-metabase
dcb19b094b Cards use default values when required (#52144) (#52291)
If a card with a default value doesn't actually require a value, letting people clear the default value can be useful.
However, if the card does require a value, letting people clear the default just throws an error.  This is a
completely useless result, so we should use the default value in that case.  See [here](https://metaboat.slack.com/archives/C0645JP1W81/p1719233020129649) for more info.

Co-authored-by: William <william@metabase.com>
2025-01-16 23:35:33 +00:00
github-automation-metabase
ea4d7edd59 Fix SCIM test faliure (#52063) (#52279)
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2025-01-16 19:06:09 +00:00
github-automation-metabase
9c291cec8c Fix byte to timestamp coercion for redshift (#52242) (#52278)
use from_varbyte for redshift

Co-authored-by: Riley Thompson <riley@metabase.com>
2025-01-16 18:42:05 +00:00
github-automation-metabase
2128c42178 Dont escape chars of header dashcards (#51880) (#51949)
Co-authored-by: Tyler Plude <tsplude@gmail.com>
2025-01-16 18:10:37 +00:00
github-automation-metabase
2935c824b2 revert to using selector instead of helper (#52266) (#52276)
Co-authored-by: Filip Hric <filip@filiphric.sk>
2025-01-16 16:26:44 +00:00
github-automation-metabase
5ddf601f2b Remove unused REPL connection string from Cypress backend (#52272) (#52275)
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2025-01-16 16:04:27 +00:00
github-automation-metabase
fead0b0da8 Added Sébastien to team files (#52215) (#52264)
Co-authored-by: Sébastien <sebastien@metabase.com>
2025-01-16 12:34:59 +00:00
github-automation-metabase
e2a6a972d2 🤖 backported "Handle stale search index tracking gracefully for h2" (#52204)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2025-01-16 10:22:53 +00:00
github-automation-metabase
b561470e24 fix(sdk): Standardize SDK components errors with different ID formats (#49714) (#52187)
* [debug] add storybook helper

* Make error on InteractiveQuestion consistent

* Make error on StaticQuestion consistent

* [debug] static question stories

* [debug] InteractiveDashboard Stories

* Make error on InteractiveDashboard consistent

* [debug] StaticDashboard stories

* Make error on StaticDashboard consistent

* [debug] EditableDashboard stories

* Make error on EditableDashboard consistent

* Fix CreateQuestion not working after fixing entity ID states

* Add tests for InteractiveQuestion

* Add StaticQuestion tests

* Add InteractiveDashboard tests

* Add StaticDashboard tests

* Add EditableDashboard tests

* Make variable names consistent

* Extract resource not found error to a component

* Fix missing return

* Make storybook usable and reduce duplications

* Don't roll my own util

* Update error colors following the new design

* Update loki snapshots

* Fix unit test expectation to hex

* Make colors easier to understand with comments

* Update SDK error style

* Update error components copy

* Use Code from metabase/ui

* Remove change accidentally commited

* Fix InteractiveQuestion renders question not found briefly

metabase#51969

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2025-01-16 09:45:52 +00:00
github-automation-metabase
5e12f48c85 Fix bad wrapping on long names for ColumnItem (#52245) (#52252)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-16 01:46:43 +00:00
github-automation-metabase
3376cedf29 🤖 backported "feat(sdk): Interactive Question Chart Settings Dropdown" (#51971)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-16 01:46:28 +00:00
github-automation-metabase
ded92218fc remove ocean color scheme (#52231) (#52247)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-16 00:02:07 +00:00
github-automation-metabase
42545547ba Update setting table name reference to :model/setting (#51783) (#51806)
Update setting table name reference to :model/Setting

Co-authored-by: Nathan Voxland <nathan@metabase.com>
2025-01-15 23:44:13 +00:00
github-automation-metabase
e8ebe5eb96 fix(sdk): Ensure that styles within the custom expression editor still work (#51878) (#51982)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-15 14:33:49 -08:00
github-automation-metabase
3a54f9ac5d update troubleshooting (#52031) (#52229)
* Update running.md

Some little details about running Java apps on prod

* Apply suggestions from code review



---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2025-01-15 20:56:17 +00:00
github-automation-metabase
7387d4aedd Apply theme change transition styles to the ParameterFieldSet component (#52049) (#52220)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-15 19:29:13 +00:00
github-automation-metabase
c6c59b6148 🤖 backported "Filter after summarize drill-thru cleanups" (#52212)
* Filter after summarize drill-thru cleanups (#52175)

* Update comment in automatic-insights drill to point to new github issue

* Move helpers from lib.drill-thru.common to lib.underlying

These funcs deal with "underlying" columns, so move them into lib.underlying.

    aggregation-sourced?
    breakout-sourced?
    strictly-underlying-aggregation?

* Consistent naming for drill-thru multi-stage query tests

* Update multi-stage query drills tests to use new test helpers

* Homogenize apis for drill thru test helpers

Rename prepend-filter-to-stage to prepend-filter-to-test-expectation-stage and make the calling interface match
that of append-filter-stage-to-test-expectation.

* cljfmt

* Update compare-aggregations drill for relocated aggregation-sourced?

* Use drill-thru tests helpers in compare-aggregation tests

---------

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2025-01-15 18:37:13 +00:00
github-automation-metabase
612fce943f quarantine flaky e2e tests (#52213) (#52216)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-15 18:11:40 +00:00
github-automation-metabase
ea1383d476 Backport to 52 (#52206)
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
2025-01-15 17:32:25 +00:00
Alexander Solovyov
ce274b7e3f [search] fix postgres search index schema (#52192) 2025-01-15 19:03:48 +03:00
github-automation-metabase
eeb6b23040 Add ericnormand to team files (#52143) (#52208)
* Add ericnormand to query team and slack map

* Fix whitespace

* Remove trailing whitespace

Co-authored-by: Eric Normand <ericwnormand@gmail.com>
2025-01-15 15:04:31 +00:00
github-automation-metabase
78dcdb7048 refactor sdk imports (#52020) (#52119)
* move sdk config

* extracts mode: "sdk" to renderWithSDKProviders

* move MetabasePluginsConfig

* move theme types

* move theming stuff

* moved plugins, added eslint rule

* remove duplicated file

* clean up ui.tsx

* move defineMetabaseTheme

* fix lint issue

Co-authored-by: Nicolò Pretto <info@npretto.com>
2025-01-15 10:28:18 +01:00
github-automation-metabase
74b8afc77d Exclude embedding-sdk/dist for babel-loader for Embedding SDK cypress tests (#52127) (#52190)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-15 08:07:15 +00:00
github-automation-metabase
53cd787f14 optimize matrix builder (#52101) (#52191)
Co-authored-by: Filip Hric <filip@filiphric.sk>
2025-01-15 07:52:06 +00:00
github-automation-metabase
23aad0b023 [search] update/delete indexed entities on change (#51222) (#52112) 2025-01-15 10:20:34 +03:00
github-automation-metabase
1a9cb727b9 Update static-embedding.md (#52036) (#52037)
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2025-01-15 06:44:32 +00:00
github-automation-metabase
c705839d54 Fix clickhouse uploads (#52181) (#52185)
This change happened in peer
https://github.com/metabase/metabase/pull/51023 and is manifesting now
it seems.

The removal of the call to `(classloader/the-classloader)` is what is
hurting us.

Only clickhouse cloud instances can be set as a suitable upload spot so
i'm doing the following changes in the local jar repro to fix it up:

```clojure
(in-ns 'metabase.driver.clickhouse)

(defmethod driver/database-supports? [:clickhouse :uploads] [_driver _feature db]
  true)

(in-ns 'metabase.public-settings)
(let [db_id 2, schema_name "default", table_prefix "upload_"]
  (t2/update! :model/Database db_id {:uploads_enabled      true
                                     :uploads_schema_name  schema_name
                                     :uploads_table_prefix table_prefix}))
```

Co-authored-by: dpsutton <dan@dpsutton.com>
2025-01-15 05:11:05 +00:00
github-automation-metabase
ee9d83e1b2 Removing error boundaries when log scale y axis contains both negative and positive values (#51941) (#52160)
Co-authored-by: Tyler Plude <tsplude@gmail.com>
2025-01-14 23:53:11 +00:00
github-automation-metabase
d8160ceee4 Enabling mouse wheel scroll zooming for leaflet maps (#51888) (#52158)
* Enabling mouse wheel scroll zooming for leaflet maps

* Reducing wheelPxPerZoomLevel so scroll zooming works faster in leaflet maps

Co-authored-by: Tyler Plude <tsplude@gmail.com>
2025-01-14 23:37:28 +00:00
github-automation-metabase
49b41aeebd perf: Fix performance of CSV pivot table export (#51985) (#52147)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2025-01-14 22:26:12 +00:00
github-automation-metabase
61e6392889 Update mysql.md (#52139) (#52150)
* Update mysql.md

Add an additional flag as a note, since I've hit this one today with a customer

* Update docs/databases/connections/mysql.md



---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-14 22:06:39 +00:00
github-automation-metabase
8da74f2a2c Update activating-the-enterprise-edition.md (#52133) (#52135)
* Update activating-the-enterprise-edition.md

another little nitpick, since people tend to get creative with these things and then we end up debugging endless hours

* edit

---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: jeff bruemmer <jeff.bruemmer@gmail.com>
2025-01-14 19:49:28 +00:00
github-automation-metabase
103e4ea17f Update activating-the-enterprise-edition.md (#52113) (#52128)
* Update activating-the-enterprise-edition.md

Add details about Zscaler

* Update docs/paid-features/activating-the-enterprise-edition.md



---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-14 18:38:27 +00:00
github-automation-metabase
15ffab7ce1 docs - preference for docker when self-hosting (#52122) (#52125)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-14 18:17:30 +00:00
github-automation-metabase
e5b2155be7 update eslint rules to restrict importing from react-redux directly (#52114) (#52117)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2025-01-14 16:12:26 +00:00
github-automation-metabase
f991a31f78 Run search index worker on every instance (#52108) (#52115)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2025-01-14 16:05:38 +00:00
github-automation-metabase
900854cda9 fix mobile text cards height (#52062) (#52105)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2025-01-14 14:58:08 +00:00
github-automation-metabase
43ca74b739 Fix module errors when Embedding SDK Cypress tests running in development mode (#52093) (#52104)
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
2025-01-14 14:41:59 +00:00
github-automation-metabase
bb6db86f3d Update error colors following the new design (#52029) (#52091)
* Update error colors following the new design

* Update loki snapshots

* Fix unit test expectation to hex

* Make colors easier to understand with comments

* Fix E2E tests

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2025-01-14 11:35:31 +00:00
github-automation-metabase
47c849e928 Fix - Removing the source filter from a linked filter will leave the latter broken (#52034) (#52086)
* Add repro for #49556

* Format code

* Fix #49556

* Format code

* Rename const

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2025-01-14 08:48:21 +00:00
github-automation-metabase
ef5fbaa64a single frontend required check (#52066) (#52073)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-13 23:36:41 +00:00
github-automation-metabase
e85b71b889 cherry-pick conflict resolution (#52061)
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
2025-01-13 22:27:43 +00:00
lbrdnk
c1bb251b98 Backport Databricks M2M auth to 52 (#51900)
* Add M2M Oauth to Databricks Driver (#51476)

* Add M2M Oauth to Databricks Driver

* Add toggle for PAT/M2M Oauth

Introduces a 'Use Personal Access Token' toggle button which shows different UI components when setting up the connection. The implementation was inspired by @snoe in #51249

* Address feedback from @ibrdnk

Addresses the feedback related to #pullrequestreview-2515818008

* Default M2M, Add conditional Merge, Reduce whitespace

* Update docs/databases/connections/databricks.md

Co-authored-by: Jeff Bruemmer <jeffbruemmer@gmail.com>

* Add test for external contribution (#51693)

* Prefer the external PRs docs change (conflict resolution)

* Upgrade databricks jdbc driver

---------

Co-authored-by: Alexander Viala Bellander <42417723+AlexVialaBellander@users.noreply.github.com>
Co-authored-by: Jeff Bruemmer <jeffbruemmer@gmail.com>
2025-01-13 21:58:38 +01:00
github-automation-metabase
c025d14dd8 docs - update links (#52047) (#52055)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-13 19:41:51 +00:00
github-automation-metabase
51ee326c80 Fix 53rd week formatting (#52038) (#52044)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2025-01-13 22:52:19 +04:00
github-automation-metabase
913bccff53 Fix pivot drill thru for multi-stage queries (#51950) (#52048)
* Fix pivot drill thru for multi-stage queries

* Add tests for multi-stage queries in pivot drill tests

* Fix e2e test

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2025-01-13 18:50:48 +00:00
github-automation-metabase
846f59d7a1 Typo (#52023) (#52039)
Co-authored-by: Abed Habli <154609371+abdhabli@users.noreply.github.com>
2025-01-13 16:08:21 +00:00
github-automation-metabase
bcfe824f21 Add Code component from Mantine (#51962) (#52024)
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2025-01-13 15:24:49 +00:00
github-automation-metabase
07cbbb19a9 Enable realtime search indexing without experimental flag (#52018) (#52025)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2025-01-13 13:17:26 +00:00
github-automation-metabase
abfc819d6f Fix SDK release process failure (#52015) (#52022)
* debug

* [debug] upgrade gh version

* Fix the gh cli by using the latest version

* Fix gh not using the latest version

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2025-01-13 12:04:11 +00:00
github-automation-metabase
593a73ad49 Add trace logging for search index queue, and fix timer (#52017) (#52021)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2025-01-13 11:46:29 +00:00
github-automation-metabase
f5a6fe5bd7 🤖 backported "[Notification] reduce memory footprint" (#52011)
* [Notification] reduce memory footprint (#51708)

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2025-01-13 05:49:50 +00:00
github-automation-metabase
16faa91c76 Fix parameter mappings reset logic (#52009)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2025-01-11 04:42:10 +00:00
github-automation-metabase
db85e4751c allow changing x-axis column settings (#51953) (#52005)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2025-01-11 03:10:14 +00:00
github-automation-metabase
66ceea21fb Convert ChartsettingOrderedItems to match ChartSettingSelect (#51332) (#51978)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-11 02:27:13 +00:00
github-automation-metabase
ff6a641345 Fix ChartSettingsPopover style/z-index issues (#51154) (#51977)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-10 17:49:13 -08:00
github-automation-metabase
5b9361a321 Fix zoom-in.geographic drill thru for multi-stage queries (#51891) (#51993)
* Update docstring in zoom-in.timeseries

The comment is stale. Construction of dimensions from row data is now done in available-drill-thrus.

* Fix zoom-in.geographic drill thru for mutli-stage queries

* Fix return type schema for lib.underlying/top-level-column

* Add append-filter-stage-to-test-expectation to drill-thru test-utils

* Add tests for multi-stage queries to zoom-in.geographic tests

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2025-01-10 21:30:56 +00:00
github-automation-metabase
e6329a6c62 fix pivot table is not rendered until resized (#51951) (#51990)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2025-01-10 20:59:57 +00:00
github-automation-metabase
3b32e844b5 allow disabling table pivot when new columns were added (#51893) (#51981)
* allow disabling table pivot when new columns were added

* specs

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2025-01-10 19:20:37 +00:00
github-automation-metabase
7a8c415e2b Fix quick-filter drill thru for multi-stage queries (#51807) (#51980)
* Fix quick-filter drill thru for multi-staged queries

* Add column-by-name and append-filter-stage to drill-thru test utils

* Add quick-filter tests for multi-stage queries

* Allow drill-thru tests to pass an update fn for :custom-{query,native,row}

The update fn will get passed the default value for the test case based on query-table and query-type. This allows
callers to easily modify or extend the default, rather than having to look it up or recreate it from scratch.

    ;; same as the standard test query, but with an extra filter stage
    :custom-query #(lib.drill-thru.tu/append-filter-stage % "count")

* Use mu/defmethod and mu/defn for column-by-name and append-filter-stage

* Add lib.drill-thru.test-util/prepend-filter-to-stage

* Add lib.drill-thru.tu/test-drill-variants-with-merged-args

A helper function to make it easy to call test-returns-drill or test-drill-application with minor variations of some
base case (for example, drill behavior should remain unchanged when called with a query with filter stage after
aggregations).

* Use test-drill-variants-with-merged-args for quick-filter multi-stage tests

* Add multi-stage quick-filter tests for a couple of unaggregated queries

* Use lib.drill-thru.tu/column-by-name in metabase.lib.drill-thru-test

* Use lib.drill-thru.tu/column-by-name in lib.drill-thru.test-util.canned

* Support skipping tests in test-drill-variants-with-merged-args

* Allow variant-case to be a fn in test-drill-variants-with-merged-args

* Clean up test formatting

* Reduce diff

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2025-01-10 18:45:06 +00:00
github-automation-metabase
e7741933ad 🤖 backported "feat(sdk): Modify Interactive Question Layout" (#51103)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-10 09:55:07 -08:00
github-automation-metabase
37a5031744 🤖 backported "docs: H1 edits" (#51975)
* Add backport resolution script

* docs: H1 edits (#51940)

* H1 edits

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* review suggestions

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* im stupid

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-10 12:33:41 -05:00
github-automation-metabase
ae2c0b9064 🤖 backported "Convert aggregation order-bys to reference by index instead of uuid before hashing" (#51841)
When you order by an aggregation, mbql v2 references the aggregation by uuid.  However, that makes the query hash to a different value each time, because you get a different uuid each time you hash it.  Converting the query to reference by index during the hashing process fixes this.


Co-authored-by: William <william@metabase.com>
2025-01-10 16:29:26 +00:00
github-automation-metabase
db5213ebf2 fix(sdk): Fix alignment of ColorSelector in SDK Chart Settings (#51000) (#51325)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-10 16:28:49 +00:00
github-automation-metabase
f6039a8b27 🤖 backported "Show errors from backend in Create API key modal" (#51580)
* Show errors from backend in Create API key modal (#51395)

* Add selectDropdown to helpers

* Revert change to yarn.lock

---------

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2025-01-10 15:31:00 +00:00
github-automation-metabase
0a5091e9b7 Correct docstring for series (#51840) (#51939)
Minor nitpicks on some endpoint docstrings

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
2025-01-09 22:51:12 +00:00
github-automation-metabase
57a2704ecc Setting alignment to top for icons in subscription and alert emails (#51886) (#51935)
Co-authored-by: Tyler Plude <tsplude@gmail.com>
2025-01-09 20:39:06 +00:00
github-automation-metabase
abdb35cd46 Fix formatting of month-of-year when there are 53 weeks in the year (#51892) (#51933)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2025-01-09 19:36:23 +00:00
github-automation-metabase
4749f6127b merge (#51871)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-09 14:26:53 -05:00
github-automation-metabase
9e5c80a02c upload title (#51931) (#51932)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-09 19:23:03 +00:00
github-automation-metabase
31445dbf36 reset cache when starting cypress locally (#51921) (#51927)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-09 17:45:50 +00:00
github-automation-metabase
1c1c5c73c6 Actions preprocess queries before compiling (#51724) (#51887)
We need to preprocess queries (and use the results) to ensure that we properly cast arguments in where clauses

Co-authored-by: William <william@metabase.com>
2025-01-09 00:45:05 +00:00
github-automation-metabase
ad08889c49 🤖 backported "chore(e2e): create helpers for viz settings and viz type buttons"
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2025-01-08 21:58:59 +03:00
github-automation-metabase
7746127c36 fix: Change pool acquireRetryAttemps to 0 (#51296) (#51866)
* fix: Change pool acquireRetryAttemps to 1

Fixes: #51176

* Address PR review and only test dbs with username auth

* Fix model ref

* Exclude hive-like connections

* Ensure user and password

Co-authored-by: Case Nelson <case@metabase.com>
2025-01-08 18:03:45 +00:00
github-automation-metabase
8945237d64 Set key auth as the default auth method, put warning password (#51249) (#51867)
* Set key auth as the default auth method, put warning on username and password

* Fix password / keyfile existing at once

* Address review

Co-authored-by: Case Nelson <case@metabase.com>
2025-01-08 18:02:56 +00:00
github-automation-metabase
db62b93d77 fix merge conflict (#51860)
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
2025-01-08 17:15:46 +00:00
github-automation-metabase
e6cdbbc9ed docs - add enterprise-only key to SDK blockquote (#51815) (#51819)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-08 14:01:00 +00:00
github-automation-metabase
cc77eeb655 Make JWT provider URI optional (#51832) (#51834)
* make jwt provider URI optional

* prettier

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-07 23:11:30 +00:00
github-automation-metabase
e03d60b58d Convert ChartSettingFieldsPartition to mantine (#51223) (#51827)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2025-01-07 22:50:11 +00:00
github-automation-metabase
425b0d57aa Cache logins in e2e tests (#51715) (#51835)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-07 22:04:02 +00:00
github-automation-metabase
f300cad7a7 docs - relocate contributing file (#51764) (#51831)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-07 20:13:07 +00:00
github-automation-metabase
0ab4227609 Small a11y improvements (#51577) (#51825)
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2025-01-07 19:49:13 +00:00
github-automation-metabase
0368036c27 docs - note on bigquery structs (#51822) (#51824)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-07 18:52:41 +00:00
github-automation-metabase
d70c78f321 docs - mb-disable-scheduler (#51812) (#51820)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-07 18:13:28 +00:00
github-automation-metabase
2c21568f06 Enable N-parallelism for e2e tests (#51433) (#51740)
# Conflicts:
#	.github/actions/build-e2e-matrix/action.yml

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2025-01-07 09:43:26 -07:00
github-automation-metabase
6d36ae40ab Handle exception in rollback better (#51675) (#51814)
Handle exception in rollback better

Co-authored-by: Nathan Voxland <nathan@metabase.com>
2025-01-07 16:01:40 +00:00
github-automation-metabase
2d4e621699 put field usage behind a feature flag and turn it off by default (#51677) (#51781)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2025-01-07 04:25:49 +00:00
github-automation-metabase
d8ef748f8b 🤖 backported "docs - links" (#51785)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-06 12:15:13 -05:00
github-automation-metabase
c9794736c5 Fix the zoom-in.binning drill thru for multi-stage queries (#51489) (#51753)
* Make renaming options optional in lib.underlying/top-level-column

* Construct dimensions from row data in available-drill-thrus

Construct dimensions from row data once in available-drill-thrus, rather than doing it in each drill that needs it
separately. The dimensions must be constructed in available-drill-thrus since some drills are expected to
return-drills-for-dimensions?, but this also has the side benefit of reducing code duplication by lifting the
rows->dimensions conversion up into a single place.

* Fix the zoom-in.binning drill thru for multi-stage queries

* Add tests for zoom-in.binning with multi-stage queries

* cljfmt

* Explicitly disable the automatic-insights drill for multi-stage queries

Previously, this drill will was implicitly disabled for multi-stage queries because the FE would not pass dimensions
for queries with underlying breakouts / aggregations. Now that dimensions are reconstructed in available-drill-thrus,
automatic-insights drill is available again, but if you try to actually run the drill you get a big scary "Something
went wrong" error, so just explicitly disable the drill until we fix it.

* Update test/metabase/lib/drill_thru/zoom_in_bins_test.cljc



* Review feedback: not-empty -> seq

* Reivew feeback: shadow rather than using a single-quote suffix

* Review feedback: underyling -> underlying

---------

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
Co-authored-by: Braden Shepherdson <braden@metabase.com>
2025-01-06 16:51:29 +00:00
appleby
865d4c2efe Update Loki snapshots for 2025 (#51768) 2025-01-06 08:07:49 -08:00
github-automation-metabase
35495470d6 🤖 backported "docs - separate google sign-in and ldap docs" (#51750) 2025-01-06 09:52:24 -05:00
github-automation-metabase
c9da3ba457 adjusting webhook test response ui (#51043) (#51387)
* adjusting webhook test response ui

* missed i18n, updating test to check for test response

* show response on error, not success

* parse the request as json response

---------

Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2025-01-06 13:38:53 +00:00
github-automation-metabase
17a4842e9e [svg] Limit the lifetime of a cached Truffle JS engine to sidestep apparent memory leaks (#51685) (#51773)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2025-01-06 10:04:46 -03:00
github-automation-metabase
70889998f8 Fix compare-aggregations drill for multi-stage queries (#51608) (#51754)
Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2025-01-03 21:48:14 +00:00
github-automation-metabase
115319e957 🤖 backported "split up query stage e2e test file" (#51705)
* split up query stage e2e test file (#51583)

* split up query stage tests

# Conflicts:
#	e2e/test/scenarios/dashboard-filters-2/dashboard-filters-query-stages.cy.spec.ts

* update for merge to master

* fix
# Conflicts:
#	e2e/support/helpers/e2e-misc-helpers.js
#	e2e/test/scenarios/dashboard-filters-2/dashboard-filters-query-stages.cy.spec.ts

* fix test to account for not saving in dashboard

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2025-01-03 10:26:33 -07:00
github-automation-metabase
8ec7f12861 Add link to support matrix (#51737) (#51739)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-03 15:08:30 +00:00
github-automation-metabase
047e7bc43d 🤖 backported "🍾 🎆 Happy new year e2e test fixes 🎆 🍾 " (#51723)
* Happy new year e2e test fixes (#51720)

* kick ci

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2025-01-02 22:57:13 +00:00
Alex Yarosh
e51badb8d1 fix links (#51718) 2025-01-02 15:09:23 -05:00
github-automation-metabase
722e7cbcf5 docs - env vars in config files (#51642) (#51643)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-01-02 14:21:40 +00:00
Alex Yarosh
10295f4d0f alerts 52 (#51697) 2024-12-31 11:26:13 -05:00
github-automation-metabase
d99dca5857 🤖 backported "Ensure collections' effective_location is batch hydrated when hydrating effective_parent" (#51682)
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-12-27 15:55:20 +00:00
github-automation-metabase
3efebabbd4 perf: Make registered? and initialized? checks faster for already initialized drivers (#51023) (#51668)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-26 15:45:32 +00:00
github-automation-metabase
aed2acff36 Fix glitching series on hover in Safari (#51611) (#51646)
* nasty hack but works

* apply to safari only

* Update Loki Snapshots

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-23 20:14:17 -05:00
github-automation-metabase
ed4a7bf795 Fix method definitions (#51473) (#51623)
Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
2024-12-23 21:10:11 +00:00
github-automation-metabase
b5e537b56b feat(sdk): make editable dashboard grid border color themeable (#51060) (#51635)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-23 17:48:51 +00:00
github-automation-metabase
5086e9d547 docs(sdk): fix initial parameter props name in dashboards (#51625) (#51633)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-23 17:07:52 +00:00
github-automation-metabase
3e0a25dbd5 Fix instance stats cypress test + ensure it runs in CI (#51531) (#51541)
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-12-23 15:07:48 +00:00
github-automation-metabase
2f8c560ddd [serdes] extract tabId in click_behavior (#51588) (#51613)
also, somewhat relatedly, create `elide-fk` function to skip pieces of data holding FKs to deleted targets

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-12-21 15:10:49 +03:00
github-automation-metabase
97e8cae76b Bump Toucan2 version (#51547) (#51555)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-21 09:57:19 +02:00
github-automation-metabase
355ba93c08 Fix summarize-column and summarize-column-by-time drills for multi-stage queries (#51553) (#51609)
* Fix summarize-column drill for multi-stage queries

* Fix the summarize-column-by-time drill for multi-stage queries

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2024-12-21 02:23:41 +00:00
github-automation-metabase
2f6f878b43 Batch query_execution, audit_log and view_log truncations (#51490) (#51602)
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-12-20 22:38:00 +00:00
github-automation-metabase
68b2f66dca ci: Fix be-tests stub (#51545) (#51597)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-20 20:51:55 +00:00
github-automation-metabase
38f63e4ab7 Add description to metric API responses (#51448) (#51593)
* Generate suggested_name on card read

* Add test

* Comment

* Naming and comment

* Use m/assoc-some

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
2024-12-20 20:34:54 +00:00
github-automation-metabase
4dcb015dc9 Add debug logging for chain filter query (#51481) (#51594)
* Add debug logging for chain filter query

* Comment

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
2024-12-20 20:32:56 +00:00
github-automation-metabase
8ad2516b8e [Cmd Palette] Do not show admin and settings links to users who do not have access (#50887) (#51592)
* fixes showing admin links to not admins in the command palette

* updates calculation to take into account EE advanced permissions allowing certain users permissions to change settings who are not admins

* admin routes for non-admins

* fix unit tests

* actually fix unit tests

* adding checks for other permissions

---------

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-12-20 20:28:01 +00:00
github-automation-metabase
1e8a62de75 Minor refactoring of cancellation-related code (#49815) (#51586)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-20 18:32:02 +00:00
github-automation-metabase
22b0535c3c ci: Only run driver tests when testing Databricks driver (#51543) (#51584)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-20 16:56:52 +00:00
github-automation-metabase
cbcbc23740 Pass uuids as strings to SQL Server (#51484) (#51582)
Azure Synapse doesn't like it when you give it a uuid parameter, even though synapse does support uuids in general.
Converting those uuids to strings beforehand fixes this error, and regular SQL Server is also fine with that.

Co-authored-by: William <william@metabase.com>
2024-12-20 16:29:59 +00:00
github-automation-metabase
7481fbd341 fix broken radio buttons in viz settings (#51558) (#51581)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-20 16:24:38 +00:00
github-automation-metabase
f4e04450ed add tests for support of xx-YY locales in embed/public-links (#51456) (#51579)
* fix: add supports for xx-YY locales in embed/public-links

* Generate locales.json

* [WIP] Read locales.json

* wip FE implementation

* refactor + unit and sdk component tests

* fixes after the merge, plus tests and cleand up logic

* fix file name in string

* change FE logic to use locales from the instance settings

* revert json generation

* remove leftover comment

* add comment about the code to keep in sync

* migrate e2e tests for static/public to use #locale=de-CH so we test that
it's using the fallback logic

* fix kondo error


* fix unit test

* fix more jest tests

* cy.request -> cy.intercept

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-12-20 16:07:55 +00:00
github-automation-metabase
e3f81d8275 fix(sdk): add supports for xx-YY locales in embed/public-links and sdk (#51002) (#51571)
* fix: add supports for xx-YY locales in embed/public-links

* Generate locales.json

* [WIP] Read locales.json

* wip FE implementation

* refactor + unit and sdk component tests

* fixes after the merge, plus tests and cleand up logic

* fix file name in string

* change FE logic to use locales from the instance settings

* revert json generation

* remove leftover comment

* add comment about the code to keep in sync

* fix kondo error


* fix unit test

* fix more jest tests

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-12-20 14:53:20 +00:00
github-automation-metabase
a153392382 Update SDK version to 0.52.6 (#51573)
* Update Readme version references and published npm version to 0.52.6

* Update CHANGELOG.md

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-20 14:37:19 +00:00
github-automation-metabase
4005c0a734 [openapi] reduce amount of oneOf/allOf we generate in documentation (#51495) (#51569)
Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-12-20 14:12:51 +00:00
github-automation-metabase
de9424e1c9 ci(sdk): make 52 the latest in release workflow (#51552) (#51567)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-20 12:10:24 +00:00
Phoomparin Mano
23696368f3 ci(sdk): remove the nightly tag from version 52 (#51551) 2024-12-20 19:05:24 +07:00
github-automation-metabase
0cb7dbf187 Fix non-legible text and icon colors in fullscreen dark mode (#51538) (#51563)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-20 11:48:14 +00:00
github-automation-metabase
0d358d4fa3 docs - remove release page (#51410) (#51418) 2024-12-19 16:47:56 -05:00
github-automation-metabase
c05667343f show all columns in scatter tooltip by default (#51480) (#51544)
* show all columns in scatter tooltip by default

* update e2e spec

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-19 16:14:16 -05:00
github-automation-metabase
9e89e4a16f perf: Add fastpaths to url? and email? predicates (#51522) (#51529)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-19 21:14:13 +00:00
github-automation-metabase
c1d70d364f Fix pdf exports issues (#51491) (#51540)
* fix horizontally trimmed content on short pages

* include filters

* update specs

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-19 21:02:00 +00:00
github-automation-metabase
c2f9e583c5 [Clean-up] Allow collection clean up banner to be dismissible (#51434) (#51539)
* allow collection clean up banner to be dismissable

* small change

* dismiss the banner if the user uses the clean up modal

* add test coverage

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
2024-12-19 20:44:12 +00:00
github-automation-metabase
d0e4983bf1 Try a band-aid fix for native editor e2e flakes (#51528) (#51535)
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-12-19 19:30:14 +00:00
github-automation-metabase
a0c22c1da3 Convert ChartSettingSelect to Mantine (#50977) (#51533)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-19 18:57:17 +00:00
github-automation-metabase
8b34ce545f quarantine flakes caused by problems with typing in the native editor (#51520) (#51530)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-19 18:50:30 +00:00
github-automation-metabase
7c859a25bf docs: Updating "Export dashboard as PDF" (#51506) (#51527)
* Updating "Export dashboard as PDF"

* Typo

* updating the screenshot

Co-authored-by: Abed Habli <154609371+abdhabli@users.noreply.github.com>
2024-12-19 17:17:55 +00:00
github-automation-metabase
80581e5b3f Don't crash for ignored status codes in embedding responses (#51408) (#51485)
* short circuit tracking for ignored requests

- add fall-through for ignored embedding requests

* add test for ignored status codes

* remove cruft

* add logging for unknown clients or statuses

* Fix some e2e tests in custom-column and view-data (#51431)

* warn on reflection!

---------

Co-authored-by: bryan <bryan.maass@gmail.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-19 15:46:13 +00:00
github-automation-metabase
e7154f61ec add sdk theme selector to storybook + split the storybook sdk config into its own folder (#51122) (#51497)
* add sdk theme selector to storybook

* let's try to split the storybook

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-19 13:29:48 +00:00
github-automation-metabase
79f23e5374 fix(types): fix type error on textCard in static-dashboard.cy.spec.tsx (#51450) (#51500)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-19 13:15:42 +00:00
github-automation-metabase
c32541004c remove translation for slack error (#51375) (#51378)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-12-19 08:25:43 +00:00
github-automation-metabase
2149fabcec Add field values e2e test (#51424) (#51465)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-12-18 14:47:30 -05:00
github-automation-metabase
0db4403866 add percentages to sankey tooltip (#51193) (#51464)
* add percentages to sankey tooltip

* another tooltip variant

* specs

* lint

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-18 17:51:56 +00:00
github-automation-metabase
b926fa2e65 ci: trim stacktrace of intentional exceptions thrown during testing (#51443) (#51455)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-18 15:28:43 +00:00
github-automation-metabase
ab954c5a47 feat(sdk): use metabase type prefix and re-export types (#51072)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Phoomparin Mano <phoomparin@gmail.com>
2024-12-18 21:55:11 +07:00
github-automation-metabase
d0220ff31b fix(sdk): update define function names in Next.js compat (#51071) (#51453)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-18 14:03:26 +00:00
github-automation-metabase
3bb077b92e Convert ChartSettingInputNumeric to Mantine (#51165) (#51444)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-18 12:52:34 +00:00
github-automation-metabase
13d29702d5 Typo (#51440) (#51451)
Co-authored-by: Abed Habli <154609371+abdhabli@users.noreply.github.com>
2024-12-18 12:39:47 +00:00
github-automation-metabase
f229c492e0 🤖 backported "fix(sdk): migrate to custom redux context to allow using the sdk on host apps that use redux" (#51414)
* step1: add MetabaseReduxProvider and make our hooks + connect fn use it

step1: add MetabaseReduxProvider and make our hooks + connect fn use it

* step 2: codemod

* step 3: manual fixes

* step 4: e2e test for sdk

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-18 12:48:16 +01:00
github-automation-metabase
aa73307807 🤖 backported "lychee to lint doc links" (#51429)
* lychee to lint doc links (#51422)

Co-authored-by: Ryan Laurie <iethree@gmail.com>

* tests(jest): add ES module is-absolute-url to the transform ignore (#51438)

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-12-18 09:54:03 +00:00
github-automation-metabase
c7330a1245 Send pulse asynchronously with a small pool size (#51380) (#51392)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-12-18 04:01:16 +00:00
github-automation-metabase
a3da18604a 🤖 backported "Replace Search Index setting with a table" (#51407)
Co-authored-by: Chris Truter <chris@metabase.com>
2024-12-17 20:16:14 +02:00
Phoomparin Mano
df5ab529bf ci(sdk): re-enable sdk e2e cross version tests for 52 branch (#51402)
* revert me - run this workflow against the release-x.52.x branch

* Revert "revert me - run this workflow against the release-x.52.x branch"

This reverts commit 09026adc45.

* re-enable cross-version tests
2024-12-18 01:03:07 +07:00
github-automation-metabase
ef5c82a27c 🤖 backported "Add prometheus metric for search errors" (#51381)
Co-authored-by: Chris Truter <chris@metabase.com>
2024-12-17 20:08:38 +03:00
github-automation-metabase
49fa2feada Avoid frequent setState calls in the add parameter popover in dashboards (#51373) (#51403)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-12-17 16:33:42 +00:00
github-automation-metabase
79b2b15885 ci(sdk): skip flaky mantine styles test for sdk (#51404) (#51405)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-17 15:44:31 +00:00
github-automation-metabase
ed5fe91bf0 Update Readme version references and published npm version to 0.52.5-nightly (#51396) 2024-12-17 14:48:57 +00:00
Phoomparin Mano
36cc34b02d ci(sdk): reconcile sdk version number in 52 branch (#51391) 2024-12-17 21:28:33 +07:00
github-automation-metabase
6af3f9e5c3 Add basic auth on druid JDBC driver (#50905) (#51331)
Co-authored-by: Demetrio <53023423+ddowbnac@users.noreply.github.com>
2024-12-17 15:06:54 +01:00
Phoomparin Mano
b858a42c22 Disable failing sdk e2e cross-version tests in 52 branch (#51389)
* temporarily disable e2e cross-version tests

* Revert "temporarily disable e2e cross-version tests"

This reverts commit b5c6094635.

* skip until workflow is fixed
2024-12-17 21:03:13 +07:00
Phoomparin Mano
77e4a6dcb6 ci(sdk): embedding e2e workflow fixes for 52 branch (#51268)
* Fix Embedding SDK cross-version e2e tests for release 51 branch (#51171)

* bogus change to trick the ci - to revert

* add the stub back

* fix the stub name

* fixme - hard code sdk_version for testing the workflow

* fixme - hard code build requirements for testing the workflow

* check resolved package path

* fixme - check why require.resolve is erroring

* fixme - add console log to get resolved package path

* fixme - additional ci debugging logs

* fixme - try limiting module search path to node_modules

* fixme - try multiple strategies for resolving modules

* fixme - throw a script error if resolution fails

* remove unused event.json

* fix webpack component script

* fixme - comment out pull_request event block

* return empty alias path if resolution failed

* temporarily skip create question tests

* fixme - debug create question tests failing

* fixme - debug create question tests failing

* fixme - revert sparse checkout version pinning

* fixme - change hard-coded sdk version

* revert fixme debugging changes

* cleanup workflow changes

* cleanup fixme changes to trigger ci

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-12-17 19:08:11 +07:00
github-automation-metabase
52b2b0fdfb Make formatter integral? dependent on scale (#50609) (#51376)
* Fix unexpected rounding in csv & json exports when column multiplier is non integral

* Fixing table unit test

* Adding WIP test

* Adding test case for validating new scaling logic is applied appropriately in exports

* Reverting id-or-name change and adjusting new scaling unit test

* Updating formatting to fix cljfmt in CI

* removing debug def

* Preserving integral behavior if scale is nil

Co-authored-by: Tyler Plude <tsplude@gmail.com>
2024-12-17 05:50:37 +00:00
github-automation-metabase
d3756e7e2f simplify font config by not providing sans-serif fallback (#51343) (#51355)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-16 18:45:06 +00:00
github-automation-metabase
1d398435a5 ci(sdk): add package.json to sdk exports block (#51328) (#51347)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-16 17:00:09 +00:00
github-automation-metabase
94aa8fde52 fix(View Details): calculate row after vertical and horizontal scroll (#51302) (#51340)
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-12-16 15:56:44 +00:00
github-automation-metabase
1540d83e19 Implement cumulative aggregators in mongo (#51135) (#51293)
Previously, cumulative aggregators were being done in clojure after the mongo query was finished.  However, this
didn't work on multi-step queries where the cumulative aggregator wasn't the last step (for example, do a cumulative
sum and then filter the result).  Implementing cumulative operators directly in mongo fixes this issue.

Co-authored-by: William <william@metabase.com>
2024-12-16 14:56:54 +00:00
github-automation-metabase
a82db08236 docs(sdk): document the compatibility layer for nextjs (#51173) (#51335)
* wip nextjs compat docs

* explain how to do manual wrapping

* doocs

* better explanation of the index file

* Apply suggestions from code review



* Update docs/embedding/sdk/next-js.md



---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-16 14:09:01 +00:00
github-automation-metabase
cf33d59a6b fix(sdk): wrap InteractiveDashboard with renderOnlyInSdkProvider (#51224) (#51329)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-16 13:53:37 +00:00
github-automation-metabase
9c0c5ad32d Remove unnecessary transaction around query analysis (#51321) (#51322)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-16 11:11:33 +00:00
github-automation-metabase
594e80a5c8 🤖 backported "feat(sdk): move non-auth config options to provider" (#51063)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Phoomparin Mano <phoomparin@gmail.com>
2024-12-16 17:21:09 +07:00
github-automation-metabase
135bbbc166 Convert ChartSettingsRadio to mantine (#51210) (#51287)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-16 09:53:59 +00:00
github-automation-metabase
34f019e07c Add story for QuestionSettings (#50998) (#51032)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-16 08:47:04 +00:00
github-automation-metabase
4476971f5a Convert ChartSettingToggle to Mantine (#51161) (#51286)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-16 08:44:05 +00:00
github-automation-metabase
a1525c7348 Convert ChartSettingInput to Mantine (#51162) (#51288)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-16 08:43:29 +00:00
github-automation-metabase
6f76bb6288 [ci] Actually test against different JDK versions (#51313) (#51314)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-14 21:05:14 +00:00
github-automation-metabase
155b7f92ba Bump c3p0 version (#51188) (#51310)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-14 17:26:21 +02:00
github-automation-metabase
44d0439f37 Fix distribution drill thru for multi-stage queries (#51247) (#51311)
* Add missing -test suffix to zoom-in-timeseries test name

* Add missing -test suffix to underlying-records test name

* Fix distribution drill thru for multi-stage queries

Ensure the distribution drill thru is not returned by available-drill-thrus when a user clicks on an aggregation or
breakout column, even if there are additional query stages after the last aggregation / breakout stage.

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2024-12-14 08:14:43 +00:00
github-automation-metabase
aa77297ea2 fix pie chart incorrect settings memoization (#51305) (#51309)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-14 00:29:53 +00:00
github-automation-metabase
0ec00d015b Don't compute a different hash key if they only differ on the order of values in a parameter (#51186) (#51306)
Don't compute a different hash key if they only differ on the order of values in a parameter

Co-authored-by: Nathan Voxland <nathan@metabase.com>
2024-12-13 22:49:54 +00:00
github-automation-metabase
7d7978c274 Update underlying-records drill to use code in lib.drill-thru.common (#51254) (#51298)
Some funcs were added to lib.drill-thru.common for the recent fix to the zoom-in.timeseries drill. Update the
underlying-records drill to use the common lib code rather than duplicating it.

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2024-12-13 22:38:06 +00:00
github-automation-metabase
fcbcab8ccc pin to master (#51294) (#51300)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-12-13 20:43:18 +00:00
github-automation-metabase
af0256d44f Quiet snowflake logging (#51138) (#51170)
It looks like snowflake introduced some very noisy logging in their
code.

9b7c9eb3e0 (diff-7859cac7243b3b9668df0770c96e264a1be2be06eefbbf7bba63904104028495L743)

This should reduce the noise and allow our code to handle and log the
exceptions.

Co-authored-by: Case Nelson <case@metabase.com>
2024-12-13 19:54:43 +00:00
github-automation-metabase
19065579d9 Update test to use revert icon (#50956) (#51292)
We changed the time_history icon in this context to a revert icon in #46050 but never updated this test. This PR fixes that.

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-13 18:40:38 +00:00
github-automation-metabase
6c05340d04 Split dashboard PDF exports into pages (#49917) (#51266)
* save only grid on fixed width dashboards

* split export pdf into pages

* trim dashboard export pdf into pages

* specs

* add padding to pdf pages

* dark mode

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-13 16:10:44 +00:00
github-automation-metabase
ff3a249260 Use pr-str so log data is parseable (#51275) (#51278)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-13 12:54:34 +00:00
github-automation-metabase
871cabb15a Convert ChartSettingSegmentedControl to Mantine (#50994) (#51272)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-13 10:38:38 +00:00
github-automation-metabase
9b768f1d44 Fix - Updating a filter via click behavior will not populate the field on actions (#51108) (#51270)
* Fix #51020

* Add a repro for #51020

* Improve test name

* Update comment and naming

* Improve diff

* Add repro for when primary key is not called 'id'

* Update repro

* Drop prefetchesInitialValues & getValuesForUpdate

It's unclear what the real intention behind these two was, but it's clear that it made two differences:
(1) It decreased the probability of overwriting someone else's changes (if someone else saved them after we opened the form)
(2) It decreases the payload sent over the wire

(1) We can ignore this, as this problem is prevalent everywhere in our app
(2) This is negligible

Dropping these is simpler than enhancing getValuesForUpdate with extra logic for primary keys (and who knows what else)

* Break beforeEach into 2

* Remove no longer valid test

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-12-13 09:21:10 +00:00
dpsutton
4e625d8a4b tests are failing the 52 branch (#51265)
should be reverted but we want a 52 release

context:
https://github.com/metabase/metabase/actions/runs/12307551790/job/34351648561
2024-12-12 22:05:08 -05:00
dpsutton
00874044a3 guard against a stage number in matching (#51263)
* guard against a stage number in matching

old:

`{"category":["dimension",["field",5,{"base-type":"type/Integer"}]]}`

new:

`{"state":["dimension",["field",48,{"base-type":"type/Text"}],{"stage-number":0}]}`

(comment
  (let [login-attributes {"state" "CA"}
        field-ids #{55 46 54 48 50 56 51 47 57 45 53 52 49}
        attribute_remappings {"state" [:dimension
                                       [:field
                                        48
                                        {:base-type :type/Text}]
                                        ;; this stage-number is optional. Newer versions have it since https://github.com/metabase/metabase/issues/46914
                                       {:stage-number 0}]}]
    (into {} (for [[k v] attribute_remappings
                   ;; get attribute that map to fields of the same table
                   :when (contains? field-ids
                                    (lib.util.match/match-one v [:dimension [:field field-id _]] field-id))]
               {k (get login-attributes k)})))
  )

* formatting fix
2024-12-12 20:55:37 -05:00
github-automation-metabase
7d88901955 Use the time_history icon to display when a question was last updated (#50952) (#51259)
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-13 00:57:48 +00:00
metabase-bot[bot]
bac63b6e77 fix-release-log (#51238) (#51255)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-12-12 22:59:27 +00:00
github-automation-metabase
2db7312aaa update tracking for embedding-sdk-react and embedding-iframe x-metabase-clients (#51179) (#51250)
* skip tracking non react-sdk x-metabase-clients

- Do not do promethus tracking for sdk.
- tracking ignores x-metabase-client headers when they're not == "embedding-sdk-react"

* cleanup indentation

* add prometheus tracking counters for iframe

* remedy 24h query execution inaccuracy

Co-authored-by: bryan <bryan.maass@gmail.com>
2024-12-12 22:49:07 +00:00
github-automation-metabase
8dca3ea88c Allow config files to have literal values enclosed in {{{ ... }}} (#51129) (#51243)
Allow config files to have literal values enclosed in {{{ ... }}}

Co-authored-by: Nathan Voxland <nathan@metabase.com>
2024-12-12 21:50:16 +00:00
github-automation-metabase
109ba1a8b5 Backport the webpack config from 51171 to master (#51212) (#51231)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-12-12 18:41:15 +00:00
github-automation-metabase
219e591555 Update data.md (#51234) (#51236)
Tiny typo

Co-authored-by: Hervé Labas <431257+thebiglabasky@users.noreply.github.com>
2024-12-12 18:37:31 +00:00
github-automation-metabase
b7860f0011 note on static embeds (#51181) (#51227)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-12 16:34:53 +00:00
github-automation-metabase
dd5ad8410a Enable bug reporting (#50856) (#51218)
* add bug report to command palette and profile menu

add bug report to command palette and profile menu

* refactor and update diagnostic window modal

* add analytics to track bug reporter modal activity

* add file id to to the upload-file method

* add the ability to collect browser information for diagnostic window

* implement feedback from PR comments

* Update frontend/src/metabase/components/ErrorPages/ErrorDiagnosticModal.tsx



* implement feedback from PR comments #2

* rename "file a bug" to "report an issue"

* resolve conflict

* fix lint issues

* fix bad merge conflict resolution

* fix failing onboarding tests

---------

Co-authored-by: Filip Hric <filip@filiphric.sk>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-12 15:04:27 +00:00
github-automation-metabase
178164d942 Fix the "invite" screenshot (#51098) (#51105)
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-12-12 15:11:36 +01:00
github-automation-metabase
b65981a8fa More logging around search index maintenance (#51206) (#51214)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-12 13:54:44 +00:00
github-automation-metabase
125f512df8 🤖 backported "Better diagnostic info when Search Index is not ready" (#51207)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-12 13:37:34 +00:00
github-automation-metabase
98c93fdb12 🤖 backported "Ignore interpolated expressions in query analysis" (#51164)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-12 15:25:56 +02:00
github-automation-metabase
37bb29eb78 logo link (#51177) (#51211)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-12 12:57:20 +00:00
github-automation-metabase
bd09c2ab5b Prevent newly opened items from expanding outside viewport (#51008) (#51204)
* Prevent newly opened items from expanding outside viewport

* Expand the unti test coverage

* Use the existing helper

* Change scroll view to center

This works better because it ensures that the top bar doesn't cover the element.

* Update frontend/src/metabase/home/components/Onboarding/Onboarding.tsx



* Extract the `stopVideo` function

* Fix the type name

* Set the top scroll margin on the `main` element

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-12-12 11:42:55 +00:00
github-automation-metabase
5f37af834f docs(sdk): simpler documentation for building the sdk locally (#51064) (#51205)
* wip: better documentation for developers that need to run the sdk
locally

* morning fixes

* remove developers-guide/sdk in favor of dev.md in the sdk folder

* add note about using the sdk with link to the docs

* fix mising word

* addressed feedback

* added notes about the envs for sdk e2e test

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-12 11:42:07 +00:00
github-automation-metabase
11ccfdb191 Update nanoid and path-to-regexp (#51198) (#51200)
* Force nanoid onto 3.3.8

* Force path-to-regexp to 0.1.12

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-12-12 10:57:16 +00:00
github-automation-metabase
095d521010 Migrate favicon logic to mantine hook (#50878) (#50932)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-12 10:01:23 +00:00
github-automation-metabase
46ad314535 Manual backport workflow fixes from 51171 (#51196) (#51199)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-12 08:58:56 +00:00
github-automation-metabase
f18b63e49b Make release log updates smarter (#49340) (#51190)
* make release log updates smarter

* fix a bunch of stuff after testing

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-12-12 00:21:00 +00:00
github-automation-metabase
186fcd9d17 Add v0.51.8 to the list of releases (#51153) (#51163)
* Add v0.51.8 to the list of releases

* ordering

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: jeff bruemmer <jeff.bruemmer@gmail.com>
2024-12-11 15:08:34 +00:00
github-automation-metabase
c15a51f210 Fix alert condition text (#51117) (#51156)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-12-11 13:46:55 +00:00
github-automation-metabase
8ea66a3867 🤖 backported "feat(sdk): use public-facing question type in event handlers" (#51037)
* feat(sdk): use public-facing question type in event handlers (#50867)

* introduce public metabase question type

* revise internal question type

* update stories

* use public question type in dashboard card plugins

* add tests for transforming question properties

* add tests for question description

* re-export the MetabaseQuestion type

* fix lint imports

* change publicQuestion to sdkQuestion

* name cannot be null if the card is present

* reduce collection browser flake

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Phoomparin Mano <phoomparin@gmail.com>
2024-12-11 12:37:39 +00:00
github-automation-metabase
34657a48c8 [search] track total search indexing time as prometheus metric (#51095) (#51152)
Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-12-11 12:21:03 +00:00
github-automation-metabase
1e275b9e49 feat(sdk): support sql parameters in interactive questions (#50728) (#51061)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Phoomparin Mano <phoomparin@gmail.com>
2024-12-11 10:36:16 +00:00
github-automation-metabase
1563e743fe Dismissible "How to use Metabase" sidebar link (#50536) (#51132)
* Add new user-level setting

* Add selector

* Make link dismissible from the sidebar

* Transfer the onboarding link to the main "gear" menu

* Add E2E test to cover the link dismissal behavior

* Add tests for the settings menu link

* Fix tests

* Provide useful comment in the e2e test

* Provide contextual explanations to translators

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-12-10 23:48:39 +01:00
github-automation-metabase
8cd877ec83 Avoid logging stacktrace in streaming (#51053) (#51094)
* Avoid logging trace

* Demote log to warning

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
2024-12-10 20:53:52 +00:00
github-automation-metabase
3837ed899d Add binning to display name (#50531) (#50946)
Add binning to display name similarly as done with bucketing.
---------

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-12-10 21:52:12 +01:00
Jeff Bruemmer
a852d1600b docs - api updates (#51115) 2024-12-10 19:53:32 +00:00
github-automation-metabase
68a464e477 🤖 backported "test: syncing views against all drivers" (#50897)
* test: see which drivers pass these tests

* Fix build

* Change test to use standard dataset, add initial implementation for bigquery

* Use fully qualified names for views

* Don't use transactions for databricks

* Make drop table only if exists, fix describe-index in mongo for views

* don't sync system.views

* Fix oracle drop-views, disable non-syncing views

* Use metabase-instance to find the table, this is important because redshift and oracle munge table name

* Fix oracle tests

* Fix oracle views

* Fix formatting

* Fix snowflake qualified components

* Change tests to opt out

* Fix sqlsserver

* Fix postgres test

* Disable h2 describe views test

* Address review

Co-authored-by: Case Nelson <case@metabase.com>
2024-12-10 20:52:17 +01:00
github-automation-metabase
21f5cb7bdd Resolved conflict (#51070)
Co-authored-by: Nathan Voxland <nathan@metabase.com>
2024-12-10 13:19:52 -06:00
github-automation-metabase
4114de8eba Count and Categorize Public Views in query executions table (#51079) (#51125)
* We need to look at the context field to categorize public views

* pull poll-unil into util ns

* fix comment typo

* add test

* update docstring

* remove true? call, it will return `true` on pass

* improve poll-until

Co-authored-by: bryan <bryan.maass@gmail.com>
2024-12-10 19:07:19 +00:00
github-automation-metabase
c84aaa0100 Fix the zoom-in.timeseries drill for multi-stage queries (#50970) (#51118)
* Fix the zoom-in.timeseries drill for multi-stage queries

If no dimensions are provided to the zoom-in.timeseries drill, then attempt to find the matching dimension from the FE-provided row data instead, if present.

Related to https://github.com/metabase/metabase/issues/46932

* Only return zoom-in.timeseries drills for clicks on aggregated columns

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2024-12-10 17:19:28 +00:00
github-automation-metabase
8c17699aa6 docs - locale params (#51001) (#51116)
* locale params

* formatting

* note on UI vs content

* interactive embedding

* language update

* plans blockquote

* asterisk

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-10 16:02:05 +00:00
github-automation-metabase
63833f46c1 🤖 backported "feat(sdk): combine title props in interactive question" (#51066)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-10 16:27:50 +02:00
github-automation-metabase
9b0b0cff8b 🤖 backported "Properly handle other users personal collections in collection picker" (#50834)
* Properly handle other users personal collections in collection picker (#50605)

* Properly handle other users personal collections in collection picker

* fixing types and unit test

* e2e adjustments

---------

Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-12-10 13:32:53 +00:00
github-automation-metabase
9930ed8a4f feat(sdk): detect if session.id is not a string (#50890) (#51055)
* feat(sdk): detect if session.id is not a string

* use yup, also validate exp as we use it

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-10 10:56:27 +00:00
github-automation-metabase
489986cfa9 feat(sdk): next sdk compatibility layer (#50230) (#51059)
* wip next sdk compat

* better code generation, dts works

* Last line of file should end in a newline character

* feat(sdk): make MetabaseProvider not break ssr

* aUpdate enterprise/frontend/src/embedding-sdk/package.template.json



* address pr comments

* refactor(sdk): use relative paths when fixing d.ts files

* make types work on moduleResolution: node

* add loading text

* fix(sdk): #50736 make sure we don't break the host app if a sdk
component is rendered outside of the provider for a render

* fix: this should make types work for real?

* self review fixes

* update test for PublicComponentWrapper

* Update enterprise/frontend/src/embedding-sdk/components/private/PublicComponentWrapper/PublicComponentWrapper.tsx



* remove unused component

* eslint-disable-next-line for MetabaseProvider

* list tsx as dependency

* /next -> /nextjs

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-10 10:54:12 +00:00
github-automation-metabase
78d155bcda Fix embed loader not translated with #locale (#50841) (#51030)
* Fix embed loader not translated with #locale

* Fix unit tests

* Add E2E tests

* Fix a case where the lcoale is failed to load

* Simplify conditions in `LocaleProvider`



* Make E2E tests faster



---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-10 10:53:55 +00:00
github-automation-metabase
909441411b Make Loki's embedding scroll stories more resilient (#50991) (#51029)
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-10 10:53:41 +00:00
github-automation-metabase
629b7939a2 Encapsulate default models to search (#50938) (#50995)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-10 08:21:50 +00:00
github-automation-metabase
f5f7d4d1df 🤖 backported "Fix race between jobs accessing the search index" (#50996)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-10 10:19:52 +02:00
github-automation-metabase
3cc3235615 Nested joins ignore temporal units (#50962) (#51065)
The underlying issue is that nest-query/nest-expression included temporal units when copying over joined fields into the nested query. This caused both the nested query and the parent query to include the "extract the unit from the date" code. In cases where the extraction didn't change the type, this duplication wasn't a big deal. However, for temporal units like hour-of-day, the first extraction changed the type of the field from date to string, and then the second extraction broke.  This change ensures that the inner query doesn't try to extract temporal units, which should avoid the duplicate extractions.

Co-authored-by: William <william@metabase.com>
2024-12-10 02:38:32 +00:00
github-automation-metabase
eac6e3b646 Add v0.52.2 to the list of releases (#51085) (#51087)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-12-10 00:35:36 +00:00
github-automation-metabase
3a985c3114 Fix missing tooltip on waterfall total bar (#50917) (#51005)
* fix scatter chart tooltip shows irrelevant info

* remove outdated spec as we always show the tooltip_column setting

* fix missing tooltip on the total bar on waterfall charts

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-09 19:13:35 -05:00
github-automation-metabase
35a4c284f9 feat: Introduce describe-indexes (#49982) (#51013)
* feat: Introduce describe-indexes

Fixes: #49981

Introduce a faster sync with describe-indexes that follows describe-fields
and describe-fks to allow for a database wide sync step rather per table
describe-table-indexes.

Implement for psotgres

* Fix formatting

* Add tests

* Update src/metabase/driver.clj



* Update src/metabase/driver.clj



* Address PR review

* Fix null schema check

---------

Co-authored-by: Case Nelson <case@metabase.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-12-09 23:49:01 +00:00
github-automation-metabase
b1bcbda7f7 docs - generate config file (#44444) (#51076)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-09 22:50:51 +00:00
github-automation-metabase
3d69c2bcbc note on public links (#51081) (#51083)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-09 22:17:25 +00:00
Raphael Krut-Landau
32effb1fde Fix browse models e2e tests (#51046) 2024-12-09 15:17:28 -06:00
github-automation-metabase
d3a75e4ef0 pin webhook tester to v1 (#51007) (#51009)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-12-09 08:00:12 -06:00
github-automation-metabase
20c3e508a2 Fix rollback to version 50 with null query_field values (#50982) (#50993)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-09 16:48:14 +03:00
metabase-bot[bot]
93a8ab510c rename team, acquire Denis :) (#50682) (#51033)
Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-12-09 09:12:19 +00:00
github-automation-metabase
4bff8d42d8 Show /api/search errors in Browse models and Browse metrics (#50713) (#50840)
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-06 16:40:00 +00:00
github-automation-metabase
394e424bf9 Render negative values on PieChart (#50837) (#50989)
* fix pie chart ignores negative values

* fix incorrect handling of zero only values

* fix rebase

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-06 14:29:18 +00:00
github-automation-metabase
c086571821 Improve queue test and add more buffering (#50980) (#50981)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-06 13:10:55 +00:00
github-automation-metabase
1f1c61f55f Streamline embed flow when embedding is off (#50842) (#50979)
* Always show embed sharing option for admins (#50513)

* Always render the public link option

This is possible because metabase#50504

* Always render the embed option

* Fix unit tests

* Fix E2E tests

* Correct test semantic

* Hide Embed option for non-admins

* New Embed modal (#50580)

* Open "Compare options" in a new tab

* Add an external link icon to interactive embed option when it should

* Add disabled state to SDK

* Add a disable state to static and interactive embedding

* Add interactive embedding disabled state

* Implement disabled link

* Prepare folder for testing

* Fix tests and add SDK tests

* Add interactive embedding tests

* Correct test desribe block levels

* Add static embedding tests

* Add premium interactive embedding tests

* Add enterprise tests (EE without tokens)

* Fix the rest of the failed unit tests

* Update E2E tests

* Fix a case where OSS see disabled interactive embedding

This should be impossible as interactive embedding isn't available on
OSS, so we should not display the disabled state.

* Address review



* Address review

Co-Authored-by: Poom poom@poom.dev

---------



* Update Interactive Embedding Admin Settings page (#50693)

* Add a quick start link to interactive embedding settings page

* Update UTM tags for interactive embedding card

* Don't show interactive embedding option as enabled on OSS

* Fix unit tests

* Add a new test

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-06 11:30:19 +00:00
github-automation-metabase
ed4abaad6f fix scatter chart tooltip (#50889) (#50969)
* fix scatter chart tooltip shows irrelevant info

* remove outdated spec as we always show the tooltip_column setting

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-06 02:51:43 +00:00
github-automation-metabase
bcb8c01eda Add v0.50.35 to the list of releases (#50835) (#50966) 2024-12-06 01:38:18 +00:00
github-automation-metabase
5fd36b241d New and improved Examples collection (#50829) (#50968)
* fix the script, and add the new edn

* make the migrations run in the proper order

* it works (needs cleanup)

* remove broken binning

- These bins rely on fingerprinting for the custom Age column

- The fingerprinting for that custom column are not properly exported in
serialization, hence do not get loaded into metabase, causing binning by
Age to fail.

* cleanup / linting

* cleanup

* update migration test ids to test

* realign test name to check for to see if sample content was created

* remove Product collection + move Examples into root

* update collection_ids for the content too

* remove click behavior for 'Revenue goal for this quarter'

* Apply suggestions from code review



* for the sample collection is_sample should be true

* Drop CreateInternalUserNoOp

* typo

* update migration comments

* 2 small fixes

* fix data perms for example coll

* add a comment so we don't have 2 blank lines in a row

---------

Co-authored-by: bryan <bryan.maass@gmail.com>
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-05 23:49:04 +00:00
github-automation-metabase
1cc98bca6c Make postgres enums not error when using :is-empty/:not-empty (#50914) (#50967)
Co-authored-by: William <william@metabase.com>
2024-12-05 23:22:37 +00:00
github-automation-metabase
278e0822ae sankey static viz integration test (#50793) (#50950)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-05 19:22:38 +00:00
github-automation-metabase
f387892cbc 🤖 backported "Use global e2e helper" to 52 (#50892)
* use global e2e helpers

* fix dashboard tests

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-12-05 12:01:24 -07:00
Jeff Bruemmer
6aad0b854f update env var docs (#50947) 2024-12-05 18:43:57 +00:00
github-automation-metabase
4bbc92122c fix(sdk): remove Error.captureStackTrace as it errors on firefox (#50773) (#50934)
firefox

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-05 17:43:24 +00:00
github-automation-metabase
fbea05994a [xlsx-export] Refactor postprocess namespace with perf/concat (#50170) (#50944)
Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-12-05 17:36:03 +00:00
github-automation-metabase
c12c23d9df Fix edge cases in New Search around model filtering (#50937) (#50939)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-05 16:36:37 +00:00
github-automation-metabase
dd36c4db4b Ensure user count is fetched within token status memoization (#50813) (#50819)
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-12-05 15:11:46 +00:00
github-automation-metabase
109479dad5 Keep support for the old search engine name (#50876) (#50922)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-05 08:29:12 +00:00
github-automation-metabase
40c08c31bb Introduce the non-admin Onboarding Checklist (#50516) (#50794)
* Add new selectors

* Adjust the onboarding checklist for non-admins

* Add unit tests for non-admins

* Rename the control knob

* Fix the forgotten test

* Stop guarding the route for admins only

* Translate `alt` tags



* Translate `alt` tags



* Add e2e coverage for non-admins

* Refine selectors

* Improve the route guard

* Increase E2E coverage for route guards

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-05 08:10:53 +00:00
github-automation-metabase
1d9a3d049d Deprecate alert and pulse apis (#50453) (#50725)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-05 03:47:14 +00:00
github-automation-metabase
028a836e82 Loki flake: make delays configurable independently (#50806) (#50918)
* Add delay helper

* Remove delays in storybook

* Use skippable delay in ListField and SingleSelectListField

* Use skippable delay in ExplicitSize

* Remove waitTimeContext in storybook

* Remove waitTimeContext altogether

* Add documentation to delay

* Remove all context references in ExplicitSize

* Update flaky snapshots

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-12-05 01:38:59 +00:00
github-automation-metabase
80ccaeb237 fix: Qualify postgres enums outside public schema (#50900) (#50910)
Fixes: #50771

The new sync process failed to qualify enums outside public and
therefore failed to properly type them in database_type. This could
either result in matching the wrong type if there was a conflict or not
being typed as an enum.

Co-authored-by: Case Nelson <case@metabase.com>
2024-12-04 22:45:59 +00:00
github-automation-metabase
9787d0f088 Add v0.52.1 to the list of releases (#50906) (#50908) 2024-12-04 21:14:18 +00:00
github-automation-metabase
dfbda37934 Deserialize metrics as cards (#50807) (#50896)
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-12-04 20:52:05 +00:00
github-automation-metabase
28b4824e47 Add v0.51.7 to the list of releases (#50899) (#50904) 2024-12-04 20:51:52 +00:00
github-automation-metabase
d3cd56608a Trial Banner (#49344) (#50870)
* Add trial banner

* Use the semantic "warning" color for background

* Simplify the "reappearance" logic

* Refine the banner logic

- Pass the bare minimum information (expiry timestamp) to the `TrialBanner`
- Take timezones into account
- Introduce utilities
- Add unit tests

* Update the remaining tests

* Clean up

* Unbreak my `defsetting` 🎶

* Add comments

* Defer var assignment

* Fix failing tests 🤦

* Adjust the types in order to match `master`

* Move the logic up to the parent component

* Convert the `index` component to TS

* Fix typo in the JSDoc

* Fix another typo

* Make the return statement more readable

* Remove redundant test

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-12-04 20:15:08 +00:00
github-automation-metabase
ba9f08dd5b docs - verified content (#50885) (#50895)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-04 19:34:02 +00:00
github-automation-metabase
5bc320bbe7 Applying the underlying records filter to a query with a join display… (#50802) (#50886)
Applying the underlying records filter to a query with a join displays fields from the join

Co-authored-by: William <william@metabase.com>
2024-12-04 17:52:53 +00:00
github-automation-metabase
30c04a1dcc feat(sdk): add style and className to static dashboards (#50860) (#50884)
* add style and className to static dashboards

* unify props for static and interactive

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-04 17:43:31 +00:00
github-automation-metabase
ec681fc0bc Finish deprecating old search module namespace (#50852) (#50880)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-04 16:15:14 +00:00
github-automation-metabase
3e0978ad62 [search] replace experimental flag with engine choice (#50850) (#50872)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-04 14:04:46 +00:00
github-automation-metabase
af09c0199d [serdes] do not require prefix when passing entity ids to export (#50786) (#50865)
Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-12-04 12:48:19 +00:00
github-automation-metabase
73afba4194 fix persist model error email (#50843) (#50851)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-12-04 12:00:30 +00:00
github-automation-metabase
24c55f8a40 Add more logs for sending notification (#50836) (#50849)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-12-04 09:38:47 +00:00
github-automation-metabase
e48212bc34 feat(sdk): rename prop names to be clear and explicit (#50656) (#50817)
* rename onClose to onCancel

* rename questionHeight to drillThroughQuestionHeight

* rename showVisualizationSelector to withVisualizationSelector

* rename parameter value props

* doc updates for parameter values

* rename the chart type selector prop

* document the withChartTypeSelector prop

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-03 23:18:16 +00:00
github-automation-metabase
0f55159339 [Clean up] Hide clean up UI in sample collections (#50760) (#50810)
* hides clean up ui on sample collections

* commit unsaved changes

* pr feedback

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
2024-12-03 23:04:46 +00:00
github-automation-metabase
22373dcd51 Onboarding checklist - misc. follow ups (#50579) (#50812)
* Fix the help link

* Update data stack image

* Fix the link appearance

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-12-03 22:37:54 +00:00
github-automation-metabase
c2a70fa7c4 docs - commands (#50784) (#50814)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-03 22:09:35 +00:00
Jeff Bruemmer
dc9440faad docs - 52 api and env var (#50750) 2024-12-03 16:58:46 -05:00
github-automation-metabase
46304b1b05 removing the 'can_write' requirement for selecting things via the question picker (#50783) (#50804)
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
2024-12-03 21:24:10 +00:00
github-automation-metabase
9a7119d5af Update Translations for v52.1 (#50534) (#50799)
* Add new strings for v52.0

* Update translations

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-12-03 20:01:40 +00:00
github-automation-metabase
e8a06bc519 Introduce the non-admin Onboarding Checklist (#50516) (#50794)
* Add new selectors

* Adjust the onboarding checklist for non-admins

* Add unit tests for non-admins

* Rename the control knob

* Fix the forgotten test

* Stop guarding the route for admins only

* Translate `alt` tags



* Translate `alt` tags



* Add e2e coverage for non-admins

* Refine selectors

* Improve the route guard

* Increase E2E coverage for route guards

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-03 19:36:39 +00:00
github-automation-metabase
005ee61971 Introduce the non-admin Onboarding Checklist (#50516) (#50794)
* Add new selectors

* Adjust the onboarding checklist for non-admins

* Add unit tests for non-admins

* Rename the control knob

* Fix the forgotten test

* Stop guarding the route for admins only

* Translate `alt` tags



* Translate `alt` tags



* Add e2e coverage for non-admins

* Refine selectors

* Improve the route guard

* Increase E2E coverage for route guards

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-03 19:36:21 +00:00
github-automation-metabase
401c471eb6 Partially fix flaky native e2e tests (#50710) (#50747)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-12-03 14:00:32 -05:00
github-automation-metabase
7a44bedfe6 Fix a (native-ace-editor) flake 30039 (#50774) (#50775)
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-12-03 20:00:04 +01:00
github-automation-metabase
d8adb55990 fix(sdk): introduce .mb-wrapper to scope down our css (#50466) (#50791)
* add tests for css rules not scoped to the sdk

* fix(sdk): adds mb-wrapper class and scope css to it

* fix typo

* add .mb-wrapper to the body on storybook
diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx
index 52a0d45125d..a4b3a86f4a5 100644
--- a/.storybook/preview.tsx
+++ b/.storybook/preview.tsx
@@ -42,15 +42,20 @@ const globalStyles = css`
 export const decorators = isEmbeddingSDK
   ? [] // No decorators for Embedding SDK stories, as we want to simulate real use cases
   : [
-      renderStory => (
-        <EmotionCacheProvider>
-          <ThemeProvider>
-            <Global styles={globalStyles} />
-            <CssVariables />
-            {renderStory()}
-          </ThemeProvider>
-        </EmotionCacheProvider>
-      ),
+      renderStory => {
+        if (!document.body.classList.contains("mb-wrapper")) {
+          document.body.classList.add("mb-wrapper");
+        }
+        return (
+          <EmotionCacheProvider>
+            <ThemeProvider>
+              <Global styles={globalStyles} />
+              <CssVariables />
+              {renderStory()}
+            </ThemeProvider>
+          </EmotionCacheProvider>
+        );
+      },
     ];

 function CssVariables() {

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-03 18:31:01 +00:00
github-automation-metabase
bffe2cb02f fix narrow ordinal line charts have no tooltip (#50715) (#50789)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-03 18:02:20 +00:00
github-automation-metabase
ad202c8bf3 Remove memoization of active user counts setting (#50779) (#50788)
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-12-03 17:32:26 +00:00
github-automation-metabase
bd4b9c63fa Address feedback on Sankey (#50611) (#50787)
* do not show column selection error on empty datasets

* add more specs to chart-definition logic

* fix entry nodes tooltip and click behavior values

* fix nodes formatting

* do not show sankey data settings on dashboards

* do not initiallt open sankey data columns selects

* hide sankey tooltip on scroll

* drop incorrect types

* set sankey node limit

* prevent clicks on edges close tooltips on native sankey questions

* tweak copy

* update sankey spec according to fixes

* revert changed settings behavior

* fix unit specs

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-12-03 16:41:36 +00:00
github-automation-metabase
e8c63c322c Pivot Exports Can Handle nil in Breakout Col, and Multiple Cols of the Same Aggregation Type (#50672) (#50780)
* Pivot Exports Can Handle `nil` in Breakout Col, and Multiple Cols of the Same Aggregation Type

Fixes #50551

If a pivot table has several measures configured, they might both use the same kind of
aggregation (eg. 'sum'). Previously, this would lead to columns with the same name preventing the pivot-measures from
properly making it through the export post processing. Now, the correct aliased/deduped name is used and all columns
can be properly included in the pivot export.

Also fixes the case where a breakout column (pivot-row) contains `nil` values, which caused the pivot export to
fail. Now, all nil values are grouped and handled appropriately.

* when pivot is disabled, header should still be included

* min and max don't default to 0, add a test for the aggregations

Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
2024-12-03 15:31:30 +00:00
github-automation-metabase
1d19852bab Fix Quartz rescheduling with multiple triggers (#50707) (#50729)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-03 10:48:29 +00:00
github-automation-metabase
132bb1a268 feat(sdk): add withChartTypeSelector prop to InteractiveQuestion (#50664) (#50705)
* add withVisualizationSelector prop

* add tests

* add to docs

* use default layout in tests

* only use custom layout when needed

* make withChartTypeSelector false by default

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-03 10:16:36 +00:00
github-automation-metabase
5fcad73c9f fix(sdk): entity picker theming fixes (#50449) (#50590)
* use css variables for skeleton background color

* apply theme to folder color

* replace theme.white with themeColor

* use name of folder chevron color

* add background-inverse color mapping

* Revert "add background-inverse color mapping"

This reverts commit d0b546c583.

* avoid overriding folder chevron color in emotion

* use Mantine style overrides for NavLink

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-03 10:05:26 +00:00
github-automation-metabase
568aa2bcc7 Cache static assets without hash length restriction (#50703) (#50709)
* match against any hexadecimal bundle name

* add e2e tests skeleton

* Support display-name for ISO get-day-of-week exclusion expressions (#50606)

* Support display-name for ISO get-day-of-week exclusion expressions

Fixes #50574

* Fix light theme embeddings has different text colors (#50678)

* add cache-control tests

* support local runs

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-12-03 09:53:18 +00:00
github-automation-metabase
9759a153a0 Make e2e tests of embedding and sql filters date-invariant (#50737) (#50767)
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-03 05:21:26 +00:00
github-automation-metabase
768788653f update chart list (#50743) (#50755)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-02 22:28:32 +00:00
github-automation-metabase
e3f75b124e Add wzimrin to teams and github-slack-map (#50756) (#50757)
Co-authored-by: William <william@metabase.com>
2024-12-02 20:40:54 +00:00
github-automation-metabase
0e033e4ab7 docs: serialization clarification (#50601) (#50754)
* serialization clarification

* Apply suggestions from code review



---------

Co-authored-by: Alex Yarosh <alexandra@metabase.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-02 20:06:10 +00:00
github-automation-metabase
99a90504da Fix NPE on search model calculation, and improve testing story (#50717) (#50719)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-30 20:31:51 +00:00
github-automation-metabase
2ead76eda9 fix loki-update label is not removed after the job (#50607) (#50716)
* fix loki-update label is not removed after the job

* Update Loki Snapshots

* Update Loki Snapshots

* Update Loki Snapshots

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-11-30 04:27:47 +00:00
github-automation-metabase
1cc75c84f0 Include in-page-promo in embedding docs pages (#50359) (#50714)
Co-authored-by: Gustavo Saiani <gus@metabase.com>
2024-11-30 01:42:36 +00:00
github-automation-metabase
e9dc7f4d48 Migrate Slack channel picker field to use mantine autocomplete (#50661) (#50711)
* Migrate Slack channel picker field to use mantine autocomplete

* Fix limit size

* Fix limit size

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-11-29 22:03:27 +00:00
github-automation-metabase
bba6486a13 Fix custom expressions with multiple arguments - contains, does-not-contain, starts-with, ends-with (#50480) (#50708)
* adjustMultiArgOptions

* adjustMultiArgOptions

* Fix options

* Fix options

* Add a comment

* Fix tests

* Fix tests

* Add tests

* Tests

* Add tests

* Add tests

* Add tests

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-11-29 21:14:16 +00:00
github-automation-metabase
63414a34a1 feat(sdk): use string types for specifying entity ids instead of internal nanoid type (#50663) (#50704)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-11-29 20:51:48 +00:00
github-automation-metabase
308e1e6e22 🤖 backported "Improve Search Index clean-up and re-enable some tests" (#50701)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-29 22:33:50 +02:00
github-automation-metabase
83eb6cb980 Add v0.51.6 to the list of releases (#50640) (#50699)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-11-29 17:52:09 +00:00
github-automation-metabase
017fbe9a2f Extra Search Rankers for exact matches and things you own (#50684) (#50695)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-29 16:51:08 +00:00
github-automation-metabase
a784851a82 Old data picker in notebook for embedding (#50535) (#50697)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-11-29 16:33:33 +00:00
github-automation-metabase
1d917bc519 Fix light theme embeddings has different text colors (#50678) (#50688)
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-29 15:37:29 +00:00
github-automation-metabase
ba244567a7 ci(sdk): remove unreliable loading indicator e2e for create question (#50555) (#50654)
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-11-29 13:11:17 +00:00
github-automation-metabase
5db31666e2 Use separate indexes for different versions (#50620) (#50681)
This protects against us trying to read or write from an incompatible search index. In particular it prevents existing instances from being switched over to an incompatible table during an HA upgrade or downgrade.

~~It doesn't yet get rid of the needless re-initialization, but that will be a fast follow.~~ It breaks up the jobs so that we won't reindex on startup unless necessary.

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-29 11:03:39 +00:00
github-automation-metabase
65559cbc68 Take default Search weights from Stats (#50674) (#50680)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-29 09:57:32 +00:00
github-automation-metabase
51b66b3e2e Keep Search Index metadata sync'd via setting (#50581) (#50679)
See https://www.notion.so/metabase/Search-Index-Maintenance-14b69354c9018047b670cbba1c3be50d

This ensures that when one instance starts or finishes reindexing, the other instances pick up and switch to the same tables.

Note: this does not stop blowing away the currently active table on deployment yet, we need to have a notion of version for that first.

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-29 09:44:31 +00:00
github-automation-metabase
f581fe5645 Avoid renaming Search Index tables (#50573) (#50675)
This also avoids a brittle song and dance with non-authoritative atoms in the background. Now we juggle authoritative atoms all the time 😄

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-29 08:28:16 +00:00
github-automation-metabase
08fc48e9ea Enable underlying-records drill in table viz for multi-stage queries (#50556) (#50667)
* Enable underlying-records drill in table viz for multi-stage queries

* Fix e2e test

* Add tests for underyling-records drill for multi-stage queries

* Review feedback: filterv not-empty etc

* Review feedback: add a breakout-only query to drill-thru canned-queries

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2024-11-28 23:10:05 +00:00
github-automation-metabase
ebea9a221d Fix slack post recurrence field label (#50666) (#50671)
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-11-28 23:06:11 +00:00
github-automation-metabase
331a887c87 Sankey polish (#50550) (#50637)
* do not show column selection error on empty datasets

* persist default sankey column settings when saving

* add more specs to chart-definition logic

* more specs

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-11-28 14:05:35 +00:00
github-automation-metabase
a4a2a0017c update bigquery and netty (#50588) (#50617)
Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-11-28 08:06:23 +00:00
github-automation-metabase
21de14c27b Fix CSV upload when materialized views are present (#50557) (#50587)
Fixes https://github.com/metabase/metabase/issues/50501

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-28 07:50:03 +00:00
github-automation-metabase
c8296d4779 Table Column Ordering Should Not Prevent Pivot Exports (#50599) (#50610)
* Table Column Ordering Should Not Prevent Pivot Exports

Prior, when viz-settings existed for table column ordering, or if some columns were hidden in a regular table viz, the
pivot export could fail.

Now, if a pivot table is being exported, the table column sorting is properly ignored and the pivot export should work.

* address feedback

Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
2024-11-28 03:32:36 +00:00
github-automation-metabase
803732fe18 Fix issue with cypress config for e2e cross version tests (#50592) (#50597)
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-11-27 20:18:42 +00:00
github-automation-metabase
9af0d46dda feat(sdk): make tooltips themeable (#50457) (#50596)
* add background-inverse color mapping

* add tooltip themes

* tooltip theming

* apply to echarts tooltip

* update tooltip default color

* update tooltip defaults

* add sdk color mapping

* add additional theme colors

* add echarts tooltip story

* add loki tests

* remove background-inverse theme color option

* add to docs

* use ChartTooltipRoot for story and update loki snapshot

* update secondaryTextColor docstring

* fix unit tests

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-11-27 19:20:59 +00:00
github-automation-metabase
8ae59fc04b fix: snowflake allow setting schema to use (#50528) (#50544)
Fixes: #50422

Although we passed additional-options through subname in url parameters
to DriverManager, we were also passing `:schema nil` as connection property.

Co-authored-by: Case Nelson <case@metabase.com>
2024-11-27 18:28:05 +00:00
github-automation-metabase
793f81809d docs - notes on transparent embeds (#50377) (#50578)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-27 15:00:48 +00:00
github-automation-metabase
3bce97fb01 fix(sdk): make modals use the correct portal (#50565) (#50570)
---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-27 13:42:47 +00:00
github-automation-metabase
ce1db0bab6 feat(sdk): Add cross-version e2e tests using a published SDK package (#50423) (#50572)
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-11-27 12:48:12 +00:00
github-automation-metabase
0aa4246b90 Basic test for search reindexing (#50560) (#50568)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-27 12:24:42 +00:00
github-automation-metabase
0617f36829 [Databricks] Add catalog validation into can-connect? implementation (#50468) (#50561)
* Add catalog validation in can-connect? implementation

* Remove redundant let

* Adjust description

* Update modules/drivers/databricks/src/metabase/driver/databricks.clj



---------

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-11-27 10:49:42 +00:00
github-automation-metabase
125ce1acbf Enable New Search by default (#50520) (#50554)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-27 07:44:39 +00:00
github-automation-metabase
0adadc9ad1 Send separate events for CSV appending and replacing (#50525) (#50553)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-11-27 06:49:29 +00:00
github-automation-metabase
77b70d05a2 🤖 backported "temporarily hiding group into other" (#50549)
* temporarily hiding group into other (#50511)

* temporarily hiding group into other

* hide group into other

* remove assertions related to group into other

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>

* Update Loki Snapshots

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-11-27 04:28:47 +00:00
github-automation-metabase
0341bf3e33 docs - add expressions to list (#50473) (#50540)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-27 03:20:32 +00:00
github-automation-metabase
df24b09171 Adding .png version of no_results.svg to fix #49012 (#50426) (#50547)
* Adding .png version of no_results.svg to fix #49012

* Adjusting text color to  to match existing color scheme

* Removing old unused no results assets; adding new png version of no_results.svg at matching resolution to pulse_no_results@2x.png

* Fixing namespace import cycle

Co-authored-by: Tyler Plude <tsplude@gmail.com>
2024-11-26 23:46:03 +00:00
github-automation-metabase
885905ebe5 🤖 backported "remove pivot-grouping row and columns in tandem" (#50530)
* remove pivot-grouping row and columns in tandem (#50476)

* remove pivot-grouping row and columns in tandem

* add pivot card scalar test for csvs and xlsx.

* improve test feedback

* add a 'todo' for pivoted json exports

* indent

* tap tap tap

---------

Co-authored-by: bryan <bryan.maass@gmail.com>
Co-authored-by: Adam James <adam.vermeer2@gmail.com>
2024-11-26 22:57:09 +00:00
github-automation-metabase
e56676bdd8 🤖 backported "Pivot Export Aggregations Improved and Won't Error" (#50532)
* Pivot Export Aggregations Improved and Won't Error (#50380)

* Pivot Export Aggregations Improved and Won't Error

Fixes #50207

WIP

- Totals now have appropriate aggregation implementation
- Totals for different row and column partial paths could collide before (eg. if a pivot-col value was equal to the
- measure idx), now the paths are unique and will not collide, causing errors

* add a test

* multiple measures need to have the correct order in each row

* clean up, add some comments explaining totals paths

* fix tests

* add test to show add-rows working correctly after :rows-part :cols-part added

* tap tap tap

---------

Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
Co-authored-by: Adam James <adam.vermeer2@gmail.com>
2024-11-26 22:17:51 +00:00
github-automation-metabase
127ab0be5d docs - Sankey (#50524) (#50539)
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-26 22:10:48 +00:00
github-automation-metabase
6a1de543ac 🤖 backported "Fix embedding test build" (#50543)
* Fix embedding test build (#50542)

* kick ci

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-11-26 14:58:59 -07:00
14493 changed files with 1705211 additions and 1906453 deletions

View File

@@ -1 +0,0 @@
Fix flakey test $ARGUMENTS

View File

@@ -1 +0,0 @@
Fix issue $ARGUMENTS

View File

@@ -1 +0,0 @@
Fetch unresolved comments for this branch's PR, then fix them

View File

@@ -1 +0,0 @@
Repro issue $ARGUMENTS in a failing test

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,147 +0,0 @@
{:linters
{:metabase/test-helpers-use-non-thread-safe-functions
;; TODO -- seems silly to maintain different blacklists and whitelists here than we use for the deftest `^:parallel`
;; checker...
{:explicitly-safe
#{ ;; these toucan methods might actually set global values if it's used outside of a transaction,
;; but since mt/with-temp runs in a transaction, so we'll ignore them in this case.
toucan2.core/delete!
toucan2.core/update!
toucan2.core/insert!
toucan2.core/insert-returning-instance!
toucan2.core/insert-returning-instances!
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
clojure.core.async/<!
clojure.core.async/>!!
clojure.core.async/>!
clojure.core.async/alts!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
clojure.core.memoize/memo-clear!
clojure.core/conj!
clojure.core/persistent!
clojure.core/reset!
clojure.core/swap!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.java.jdbc/execute!
methodical.core/add-aux-method-with-unique-key!
methodical.core/remove-aux-method-with-unique-key!
next.jdbc/execute!
;; Definitely thread safe
metabase.test.util.dynamic-redefs/patch-vars!
;; TODO: most of these symbols shouldn't be here, we should go through them and
;; find the functions/macros that use them and make sure their names end with !
;; best way to do this is try remove each of these and rely on kondo output to find places where it's used
clojure.test/grant-collection-perms!
clojure.test/grant-collection-perms-fn!
clojure.test/grant-perms-fn!
clojure.test/purge-old-entries!
clojure.test/revoke-collection-perms!
clojure.test/save-results!
metabase-enterprise.advanced-permissions.models.permissions/update-db-download-permissions!
metabase-enterprise.internal-user/install-internal-user!
metabase-enterprise.sso.integrations.saml-test/call-with-login-attributes-cleared!
metabase.actions.actions/perform-action!
metabase.actions.models/insert!
metabase.analytics.snowplow-test/fake-track-event-impl!
metabase.analytics.snowplow/track-event-impl!
metabase.app-db.core/finish-db-setup!
metabase.app-db.core/migrate!
metabase.app-db.core/setup-db!
metabase.app-db.schema-migrations-test.impl/run-migrations-in-range!
metabase.app-db.setup/migrate!
metabase.app-db.setup/setup-db!
metabase.channel.email-test/reset-inbox!
metabase.channel.email/send-email!
metabase.cmd.dump-to-h2/dump-to-h2!
metabase.cmd.load-from-h2/load-from-h2!
metabase.content-verification.models.moderation-review/create-review!
metabase.core.core/ensure-audit-db-installed!
metabase.driver.mongo-test/create-database-from-row-maps!
metabase.driver.postgres-test/create-enums-db!
metabase.driver.postgres-test/drop-if-exists-and-create-db!
metabase.driver.sql-jdbc.execute/execute-statement!
metabase.indexed-entities.models.model-index/add-values!
metabase.driver.sql-jdbc.connection.ssh-tunnel-test/start-mock-servers!
metabase.driver.sql-jdbc.connection.ssh-tunnel-test/stop-mock-servers!
metabase.indexed-entities.task.index-values/job-init!
metabase.model-persistence.models.persisted-info/ready-database!
metabase.model-persistence.task.persist-refresh/job-init!
metabase.model-persistence.task.persist-refresh/refresh-tables!
metabase.model-persistence.task.persist-refresh/schedule-persistence-for-database!
metabase.models.on-demand-test/add-dashcard-with-parameter-mapping!
metabase.permissions.core/grant-application-permissions!
metabase.permissions.core/grant-collection-read-permissions!
metabase.permissions.core/grant-collection-readwrite-permissions!
metabase.permissions.core/grant-full-data-permissions!
metabase.permissions.core/grant-native-readwrite-permissions!
metabase.permissions.core/grant-permissions!
metabase.permissions.core/revoke-application-permissions!
metabase.permissions.core/revoke-data-perms!
metabase.permissions.core/update-data-perms-graph!
metabase.permissions.core/update-group-permissions!
metabase.permissions.models.collection.graph-test/clear-graph-revisions!
metabase.permissions.models.collection.graph-test/do-with-n-temp-users-with-personal-collections!
metabase.permissions.models.permissions/grant-application-permissions!
metabase.permissions.models.permissions/grant-collection-read-permissions!
metabase.permissions.models.permissions/grant-collection-readwrite-permissions!
metabase.permissions.models.permissions/grant-full-data-permissions!
metabase.permissions.models.permissions/grant-native-readwrite-permissions!
metabase.permissions.models.permissions/grant-permissions!
metabase.permissions.models.permissions/revoke-application-permissions!
metabase.permissions.models.permissions/revoke-data-perms!
metabase.permissions.models.permissions/update-data-perms-graph!
metabase.permissions.models.permissions/update-group-permissions!
metabase.permissions.test-util/with-restored-perms!
metabase.public-sharing.api-test/add-card-to-dashboard!
metabase.pulse.send/send-notifications!
metabase.pulse.send/send-pulse!
metabase.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
metabase.sample-data.impl/try-to-extract-sample-database!
metabase.settings.models.setting-test/test-user-local-allowed-setting!
metabase.settings.models.setting-test/test-user-local-only-setting!
metabase.settings.models.setting.cache/restore-cache!
metabase.settings.models.setting/set!
metabase.settings.models.setting/validate-settings-formatting!
metabase.setup.core/create-token!
metabase.sso.ldap-test-util/start-ldap-server!
metabase.sync.core/sync-database!
metabase.sync.sync-metadata.fields.sync-metadata/update-field-metadata-if-needed!
metabase.sync.sync-metadata/sync-db-metadata!
metabase.sync.util-test/sync-database!
metabase.sync.util/store-sync-summary!
metabase.task.core/delete-task!
metabase.task.impl/delete-task!
metabase.test.data.bigquery-cloud-sdk/execute!
metabase.test.data.impl.get-or-create/set-test-db-permissions!
metabase.test.data.impl/copy-db-tables-and-fields!
metabase.test.data.impl/get-or-create-database!
metabase.test.data.impl/get-or-create-default-dataset!
metabase.test.data.interface/create-db!
metabase.test.data.interface/destroy-db!
metabase.test.data.oracle/create-user!
metabase.test.data.oracle/drop-user!
metabase.test.data.sql-jdbc.load-data/make-insert!
metabase.test.data.users/clear-cached-session-tokens!
metabase.test.initialize/do-initialization!
metabase.test.initialize/initialize-if-needed!
metabase.test.util.log/ensure-unique-logger!
metabase.test.util.log/set-ns-log-level!
metabase.test.util/do-with-temp-env-var-value!
metabase.test.util/restore-raw-setting!
metabase.test.util/upsert-raw-setting!
metabase.test/initialize-if-needed!
metabase.test/test-helpers-set-global-values!
metabase.test/with-temp-env-var-value!
metabase.upload.impl-test/set-local-infile!
metabase.util.files/create-dir-if-not-exists!
metabase.warehouse-schema.models.field-values/create-or-update-full-field-values!}}}}

View File

@@ -0,0 +1,5 @@
(ns macros.common
"Helpers for common Metabase macro shapes so we don't have to define the same macroexpansions over and over.")
(defn ignore-unused [symb]
(vary-meta symb assoc :clj-kondo/ignore [:unused-binding]))

View File

@@ -0,0 +1,12 @@
(ns macros.metabase.api.card-test
(:require [macros.common]))
(defmacro with-ordered-items
[collection model-and-name-syms & body]
`(let ~(into []
(comp (partition-all 2)
(mapcat (fn [[model binding]]
[(macros.common/ignore-unused binding) model])))
model-and-name-syms)
~collection
~@body))

View File

@@ -0,0 +1,17 @@
(ns macros.metabase.api.collection-test
(:require [macros.common]))
(defmacro with-collection-hierarchy! [bindings & body]
`(let [~(macros.common/ignore-unused 'a) nil
~(macros.common/ignore-unused 'b) nil
~(macros.common/ignore-unused 'c) nil
~(macros.common/ignore-unused 'd) nil
~(macros.common/ignore-unused 'e) nil
~(macros.common/ignore-unused 'f) nil
~(macros.common/ignore-unused 'g) nil]
~bindings
~@body))
(defmacro with-some-children-of-collection! [collection-or-id-or-nil & body]
`(let [~(macros.common/ignore-unused '&ids) ~collection-or-id-or-nil]
~@body))

View File

@@ -0,0 +1,7 @@
(ns macros.metabase.api.common)
(defmacro define-routes
"Macro for api.common/define-routes"
[& args]
`(do (def ~'routes "docstring" nil)
~@args))

View File

@@ -0,0 +1,13 @@
(ns macros.metabase.api.embed-test)
(defmacro with-embedding-enabled-and-temp-card-referencing!
[table-kw field-kw [card-binding] & body]
`(let [~card-binding [~table-kw ~field-kw]]
~@body))
(defmacro with-embedding-enabled-and-temp-dashcard-referencing!
[table-kw field-kw [dash-binding card-binding dashcard-binding] & body]
`(let [~dash-binding [~table-kw ~field-kw]
~(or card-binding '_) nil
~(or dashcard-binding '_) nil]
~@body))

View File

@@ -0,0 +1,13 @@
(ns macros.metabase.api.public-test)
(defmacro with-sharing-enabled-and-temp-card-referencing!
[table-kw field-kw [card-binding] & body]
`(let [~card-binding [~table-kw ~field-kw]]
~@body))
(defmacro with-sharing-enabled-and-temp-dashcard-referencing!
[table-kw field-kw [dash-binding card-binding dashcard-binding] & body]
`(let [~dash-binding [~table-kw ~field-kw]
~(or card-binding '_) nil
~(or dashcard-binding '_) nil]
~@body))

View File

@@ -1,24 +0,0 @@
(ns macros.metabase.collections.api-test)
(defmacro with-collection-hierarchy! [bindings & body]
`(let [~'a nil
~'b nil
~'c nil
~'d nil
~'e nil
~'f nil
~'g nil]
~'a
~'b
~'c
~'d
~'e
~'f
~'g
~bindings
~@body))
(defmacro with-some-children-of-collection! [collection-or-id-or-nil & body]
`(let [~'&ids ~collection-or-id-or-nil]
~'&ids
~@body))

View File

@@ -1,13 +0,0 @@
(ns macros.metabase.embedding.api.embed-test)
(defmacro with-embedding-enabled-and-temp-card-referencing!
[table-kw field-kw [card-binding] & body]
`(let [~card-binding [~table-kw ~field-kw]]
~@body))
(defmacro with-embedding-enabled-and-temp-dashcard-referencing!
[table-kw field-kw [dash-binding card-binding dashcard-binding] & body]
`(let [~dash-binding [~table-kw ~field-kw]
~(or card-binding '_) nil
~(or dashcard-binding '_) nil]
~@body))

View File

@@ -0,0 +1,4 @@
(ns macros.metabase.models.params.chain-filter-test)
(defmacro chain-filter [& _]
`(metabase.models.params.chain-filter/chain-filter nil nil))

View File

@@ -0,0 +1,9 @@
(ns macros.metabase.models.query-analysis-test
(:require [macros.common]))
(defmacro with-test-setup [& body]
`(let [~(macros.common/ignore-unused 'card-id) 1
~(macros.common/ignore-unused 'table-id) 2
~(macros.common/ignore-unused 'tax-id) 3
~(macros.common/ignore-unused 'total-id) 4]
~@body))

View File

@@ -0,0 +1,9 @@
(ns macros.metabase.models.user-test)
(defmacro with-groups [bindings & body]
`(let ~(into []
(comp (partition-all 3)
(mapcat (fn [[group-binding properties members]]
[group-binding [properties members]])))
bindings)
~@body))

View File

@@ -1,4 +0,0 @@
(ns macros.metabase.parameters.chain-filter-test)
(defmacro chain-filter [& _]
`(metabase.parameters.chain-filter/chain-filter nil nil))

View File

@@ -1,13 +0,0 @@
(ns macros.metabase.public-sharing.api-test)
(defmacro with-sharing-enabled-and-temp-card-referencing!
[table-kw field-kw [card-binding] & body]
`(let [~card-binding [~table-kw ~field-kw]]
~@body))
(defmacro with-sharing-enabled-and-temp-dashcard-referencing!
[table-kw field-kw [dash-binding card-binding dashcard-binding] & body]
`(let [~dash-binding [~table-kw ~field-kw]
~(or card-binding '_) nil
~(or dashcard-binding '_) nil]
~@body))

View File

@@ -1,13 +0,0 @@
(ns macros.metabase.queries.api.card-test)
(defmacro with-ordered-items
[collection model-and-name-syms & body]
`(let ~(into []
(comp (partition-all 2)
(mapcat (fn [[model binding]]
[binding model])))
model-and-name-syms)
~collection
~@(->> (partition-all 2 model-and-name-syms)
(map second))
~@body))

View File

@@ -1,12 +0,0 @@
(ns macros.metabase.query-analysis.models.query-analysis-test)
(defmacro with-test-setup [& body]
`(let [~'card-id 1
~'table-id 2
~'tax-id 3
~'total-id 4]
~'card-id
~'table-id
~'tax-id
~'total-id
~@body))

View File

@@ -1,18 +0,0 @@
(ns macros.metabase.query-analysis.task.test-setup)
(defmacro with-test-setup!
"Set up the data required to test the Query Analysis related tasks"
[& body]
`(let [~'c1 1
~'c2 2
~'c3 3
~'c4 4
~'archived 5
~'invalid 6]
~'c1
~'c2
~'c3
~'c4
~'archived
~'invalid
~@body))

View File

@@ -0,0 +1,13 @@
(ns macros.metabase.related-test
(:require [macros.common]))
(defmacro with-world [& body]
`(let [~(macros.common/ignore-unused 'collection-id) nil
~(macros.common/ignore-unused 'metric-id-a) nil
~(macros.common/ignore-unused 'metric-id-b) nil
~(macros.common/ignore-unused 'segment-id-a) nil
~(macros.common/ignore-unused 'segment-id-b) nil
~(macros.common/ignore-unused 'card-id-a) nil
~(macros.common/ignore-unused 'card-id-b) nil
~(macros.common/ignore-unused 'card-id-c) nil]
~@body))

View File

@@ -1,9 +0,0 @@
(ns macros.metabase.server.statistics-handler-test)
(defmacro with-server
[_ _ [connector chan-start-handle chan-finish-handle chan-done-request] & body]
`(let [~connector nil
~chan-start-handle nil
~chan-finish-handle nil
~chan-done-request nil]
~@body))

View File

@@ -0,0 +1,13 @@
(ns macros.metabase.task.setup.query-analysis-setup
(:require [macros.common]))
(defmacro with-test-setup!
"Set up the data required to test the Query Analysis related tasks"
[& body]
`(let [~(macros.common/ignore-unused 'c1) 1
~(macros.common/ignore-unused 'c2) 2
~(macros.common/ignore-unused 'c3) 3
~(macros.common/ignore-unused 'c4) 4
~(macros.common/ignore-unused 'archived) 5
~(macros.common/ignore-unused 'invalid) 6]
~@body))

View File

@@ -0,0 +1,5 @@
(ns macros.metabase.test.persistence)
(defmacro with-persistence-enabled! [[persist-fn-sym] & body]
`(clojure.core/let [~persist-fn-sym (fn [])]
~@body))

View File

@@ -1,9 +0,0 @@
(ns macros.metabase.users.models.user-test)
(defmacro with-groups! [bindings & body]
`(let ~(into []
(comp (partition-all 3)
(mapcat (fn [[group-binding properties members]]
[group-binding [properties members]])))
bindings)
~@body))

View File

@@ -1,20 +0,0 @@
(ns macros.metabase.xrays.related-test)
(defmacro with-world [& body]
`(let [~'collection-id nil
~'metric-id-a nil
~'metric-id-b nil
~'segment-id-a nil
~'segment-id-b nil
~'card-id-a nil
~'card-id-b nil
~'card-id-c nil]
~'collection-id
~'metric-id-a
~'metric-id-b
~'segment-id-a
~'segment-id-b
~'card-id-a
~'card-id-b
~'card-id-c
~@body))

View File

@@ -0,0 +1,6 @@
(ns macros.metabase-enterprise.advanced-permissions.api.util-test
(:require [macros.common]))
(defmacro with-impersonations! [impersonations-and-attributes-map & body]
`(let [~(macros.common/ignore-unused '&group) ~impersonations-and-attributes-map]
~@body))

View File

@@ -1,5 +0,0 @@
(ns macros.metabase-enterprise.database-routing.e2e-test)
(defmacro with-temp-dbs! [bindings & body]
`(let [~@(interleave bindings (repeat nil))]
~@body))

View File

@@ -1,6 +0,0 @@
(ns macros.metabase-enterprise.impersonation.util-test)
(defmacro with-impersonations! [impersonations-and-attributes-map & body]
`(let [~'&group ~impersonations-and-attributes-map]
~'&group
~@body))

View File

@@ -1,18 +1,12 @@
(ns macros.metabase-enterprise.query-reference-validation.api-test)
(ns macros.metabase-enterprise.query-reference-validation.api-test
(:require [macros.common]))
(defmacro with-test-setup! [& body]
`(let [~'card-1 1
~'card-2 2
~'card-3 3
~'card-4 4
~'card-5 5
~'coll-2 100
~'coll-3 200]
~'card-1
~'card-2
~'card-3
~'card-4
~'card-5
~'coll-2
~'coll-3
`(let [~(macros.common/ignore-unused 'card-1) 1
~(macros.common/ignore-unused 'card-2) 2
~(macros.common/ignore-unused 'card-3) 3
~(macros.common/ignore-unused 'card-4) 4
~(macros.common/ignore-unused 'card-5) 5
~(macros.common/ignore-unused 'coll-2) 100
~(macros.common/ignore-unused 'coll-3) 200]
~@body))

View File

@@ -1,6 +1,6 @@
(ns macros.metabase-enterprise.sandbox.test-util)
(ns macros.metabase-enterprise.sandbox.test-util
(:require [macros.common]))
(defmacro with-gtaps! [gtaps-definition & body]
`(let [~'&group ~gtaps-definition]
~'&group
`(let [~(macros.common/ignore-unused '&group) ~gtaps-definition]
~@body))

View File

@@ -1,112 +1,59 @@
(ns macros.metabase-enterprise.serialization.test-util)
(ns macros.metabase-enterprise.serialization.test-util
(:require [macros.common]))
(defmacro with-world [& body]
`(let [~'db-id nil
~'table-id nil
~'table nil
~'table-id-categories nil
~'table-id-users nil
~'table-id-checkins nil
~'venues-pk-field-id nil
~'numeric-field-id nil
~'name-field-id nil
~'latitude-field-id nil
~'longitude-field-id nil
~'category-field-id nil
~'category-pk-field-id nil
~'date-field-id nil
~'users-pk-field-id nil
~'user-id-field-id nil
~'checkins->venues-field-id nil
~'last-login-field-id nil
~'collection-id nil
~'collection-id-nested nil
~'user-id-temp nil
~'personal-collection-id nil
~'pc-felicia-nested-id nil
~'pc-nested-id nil
~'pc-deeply-nested-id nil
~'metric-id nil
~'segment-id nil
~'dashboard-id nil
~'root-dashboard-id nil
~'card-id nil
~'card-arch-id nil
~'card-id-root nil
~'card-id-nested nil
~'card-id-nested-query nil
~'card-id-native-query nil
~'card-id-pivot-table nil
~'dashcard-id nil
~'dashcard-top-level-click-id nil
~'dashcard-with-click-actions nil
~'dashcard-with-textbox-id nil
~'card-id-root-to-collection nil
~'card-id-collection-to-root nil
~'pulse-id nil
~'pulsecard-root-id nil
~'pulsecard-collection-id nil
~'card-id-template-tags nil
~'card-id-filter-agg nil
~'card-id-temporal-unit nil
~'snippet-id nil
~'snippet-collection-id nil
~'snippet-nested-collection-id nil
~'nested-snippet-id nil
~'card-id-with-native-snippet nil
~'card-join-card-id nil]
~'db-id
~'table-id
~'table
~'table-id-categories
~'table-id-users
~'table-id-checkins
~'venues-pk-field-id
~'numeric-field-id
~'name-field-id
~'latitude-field-id
~'longitude-field-id
~'category-field-id
~'category-pk-field-id
~'date-field-id
~'users-pk-field-id
~'user-id-field-id
~'checkins->venues-field-id
~'last-login-field-id
~'collection-id
~'collection-id-nested
~'user-id-temp
~'personal-collection-id
~'pc-felicia-nested-id
~'pc-nested-id
~'pc-deeply-nested-id
~'metric-id
~'segment-id
~'dashboard-id
~'root-dashboard-id
~'card-id
~'card-arch-id
~'card-id-root
~'card-id-nested
~'card-id-nested-query
~'card-id-native-query
~'card-id-pivot-table
~'dashcard-id
~'dashcard-top-level-click-id
~'dashcard-with-click-actions
~'dashcard-with-textbox-id
~'card-id-root-to-collection
~'card-id-collection-to-root
~'pulse-id
~'pulsecard-root-id
~'pulsecard-collection-id
~'card-id-template-tags
~'card-id-filter-agg
~'card-id-temporal-unit
~'snippet-id
~'snippet-collection-id
~'snippet-nested-collection-id
~'nested-snippet-id
~'card-id-with-native-snippet
~'card-join-card-id
`(let [~(macros.common/ignore-unused 'db-id) nil
~(macros.common/ignore-unused 'table-id) nil
~(macros.common/ignore-unused 'table) nil
~(macros.common/ignore-unused 'table-id-categories) nil
~(macros.common/ignore-unused 'table-id-users) nil
~(macros.common/ignore-unused 'table-id-checkins) nil
~(macros.common/ignore-unused 'venues-pk-field-id) nil
~(macros.common/ignore-unused 'numeric-field-id) nil
~(macros.common/ignore-unused 'name-field-id) nil
~(macros.common/ignore-unused 'latitude-field-id) nil
~(macros.common/ignore-unused 'longitude-field-id) nil
~(macros.common/ignore-unused 'category-field-id) nil
~(macros.common/ignore-unused 'category-pk-field-id) nil
~(macros.common/ignore-unused 'date-field-id) nil
~(macros.common/ignore-unused 'users-pk-field-id) nil
~(macros.common/ignore-unused 'user-id-field-id) nil
~(macros.common/ignore-unused 'checkins->venues-field-id) nil
~(macros.common/ignore-unused 'last-login-field-id) nil
~(macros.common/ignore-unused 'collection-id) nil
~(macros.common/ignore-unused 'collection-id-nested) nil
~(macros.common/ignore-unused 'user-id-temp) nil
~(macros.common/ignore-unused 'personal-collection-id) nil
~(macros.common/ignore-unused 'pc-felicia-nested-id) nil
~(macros.common/ignore-unused 'pc-nested-id) nil
~(macros.common/ignore-unused 'pc-deeply-nested-id) nil
~(macros.common/ignore-unused 'metric-id) nil
~(macros.common/ignore-unused 'segment-id) nil
~(macros.common/ignore-unused 'dashboard-id) nil
~(macros.common/ignore-unused 'root-dashboard-id) nil
~(macros.common/ignore-unused 'card-id) nil
~(macros.common/ignore-unused 'card-arch-id) nil
~(macros.common/ignore-unused 'card-id-root) nil
~(macros.common/ignore-unused 'card-id-nested) nil
~(macros.common/ignore-unused 'card-id-nested-query) nil
~(macros.common/ignore-unused 'card-id-native-query) nil
~(macros.common/ignore-unused 'card-id-pivot-table) nil
~(macros.common/ignore-unused 'dashcard-id) nil
~(macros.common/ignore-unused 'dashcard-top-level-click-id) nil
~(macros.common/ignore-unused 'dashcard-with-click-actions) nil
~(macros.common/ignore-unused 'dashcard-with-textbox-id) nil
~(macros.common/ignore-unused 'card-id-root-to-collection) nil
~(macros.common/ignore-unused 'card-id-collection-to-root) nil
~(macros.common/ignore-unused 'pulse-id) nil
~(macros.common/ignore-unused 'pulsecard-root-id) nil
~(macros.common/ignore-unused 'pulsecard-collection-id) nil
~(macros.common/ignore-unused 'card-id-template-tags) nil
~(macros.common/ignore-unused 'card-id-filter-agg) nil
~(macros.common/ignore-unused 'card-id-temporal-unit) nil
~(macros.common/ignore-unused 'snippet-id) nil
~(macros.common/ignore-unused 'snippet-collection-id) nil
~(macros.common/ignore-unused 'snippet-nested-collection-id) nil
~(macros.common/ignore-unused 'nested-snippet-id) nil
~(macros.common/ignore-unused 'card-id-with-native-snippet) nil
~(macros.common/ignore-unused 'card-join-card-id) nil]
~@body))

View File

@@ -0,0 +1,329 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]))
;;; TODO -- seems silly to maintain different blacklists and whitelists here than we use for the deftest `^:parallel`
;;; checker... those lists live in the Clj Kondo config file
(def ^:private symbols-allowed-in-fns-not-ending-in-an-exclamation-point
'#{;; these toucan methods might actually set global values if it's used outside of a transaction,
;; but since mt/with-temp runs in a transaction, so we'll ignore them in this case.
toucan2.core/delete!
toucan2.core/update!
toucan2.core/insert!
toucan2.core/insert-returning-instance!
toucan2.core/insert-returning-instances!
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
clojure.core.async/>!!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
clojure.core.memoize/memo-clear!
clojure.core/conj!
clojure.core/persistent!
clojure.core/reset!
clojure.core/swap!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.java.jdbc/execute!
methodical.core/add-aux-method-with-unique-key!
methodical.core/remove-aux-method-with-unique-key!
next.jdbc/execute!
;; Definitely thread safe
metabase.test.util.dynamic-redefs/patch-vars!
;; TODO: most of these symbols shouldn't be here, we should go through them and
;; find the functions/macros that use them and make sure their names end with !
;; best way to do this is try remove each of these and rely on kondo output to find places where it's used
clojure.test/grant-collection-perms!
clojure.test/grant-collection-perms-fn!
clojure.test/grant-perms-fn!
clojure.test/purge-old-entries!
clojure.test/revoke-collection-perms!
clojure.test/save-results!
metabase-enterprise.advanced-permissions.models.permissions/update-db-download-permissions!
metabase-enterprise.internal-user/install-internal-user!
metabase-enterprise.sso.integrations.saml-test/call-with-login-attributes-cleared!
metabase.actions/perform-action!
metabase.analytics.snowplow-test/fake-track-event-impl!
metabase.analytics.snowplow/track-event-impl!
metabase.api.public-test/add-card-to-dashboard!
metabase.cmd.dump-to-h2/dump-to-h2!
metabase.cmd.load-from-h2/load-from-h2!
metabase.core/ensure-audit-db-installed!
metabase.db.schema-migrations-test.impl/run-migrations-in-range!
metabase.db.setup/migrate!
metabase.db.setup/setup-db!
metabase.db/migrate!
metabase.db/setup-db!
metabase.driver.mongo-test/create-database-from-row-maps!
metabase.driver.postgres-test/create-enums-db!
metabase.driver.postgres-test/drop-if-exists-and-create-db!
metabase.driver.sql-jdbc.execute/execute-statement!
metabase.email-test/reset-inbox!
metabase.email/send-email!
metabase.models.action/insert!
metabase.models.collection.graph-test/clear-graph-revisions!
metabase.models.collection.graph-test/do-with-n-temp-users-with-personal-collections!
metabase.models.field-values/create-or-update-full-field-values!
metabase.models.model-index/add-values!
metabase.models.moderation-review/create-review!
metabase.models.on-demand-test/add-dashcard-with-parameter-mapping!
metabase.models.permissions/grant-application-permissions!
metabase.models.permissions/grant-collection-read-permissions!
metabase.models.permissions/grant-collection-readwrite-permissions!
metabase.models.permissions/grant-full-data-permissions!
metabase.models.permissions/grant-native-readwrite-permissions!
metabase.models.permissions/grant-permissions!
metabase.models.permissions/revoke-application-permissions!
metabase.models.permissions/revoke-data-perms!
metabase.models.permissions/update-data-perms-graph!
metabase.models.permissions/update-group-permissions!
metabase.models.persisted-info/ready-database!
metabase.models.setting-test/test-user-local-allowed-setting!
metabase.models.setting-test/test-user-local-only-setting!
metabase.models.setting.cache/restore-cache!
metabase.models.setting/set!
metabase.models.setting/validate-settings-formatting!
metabase.permissions.test-util/with-restored-perms!
metabase.pulse.send/send-notifications!
metabase.pulse.send/send-pulse!
metabase.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
metabase.sample-data/try-to-extract-sample-database!
metabase.setup/create-token!
metabase.sync.sync-metadata.fields.sync-metadata/update-field-metadata-if-needed!
metabase.sync.sync-metadata/sync-db-metadata!
metabase.sync.util-test/sync-database!
metabase.sync.util/store-sync-summary!
metabase.sync/sync-database!
metabase.task.index-values/job-init!
metabase.task.persist-refresh/job-init!
metabase.task.persist-refresh/refresh-tables!
metabase.task.persist-refresh/schedule-persistence-for-database!
metabase.task/delete-task!
metabase.test.data.bigquery-cloud-sdk/execute!
metabase.test.data.impl/copy-db-tables-and-fields!
metabase.test.data.impl/get-or-create-database!
metabase.test.data.impl/get-or-create-default-dataset!
metabase.test.data.impl.get-or-create/set-test-db-permissions!
metabase.test.data.interface/create-db!
metabase.test.data.interface/destroy-db!
metabase.test.data.oracle/create-user!
metabase.test.data.oracle/drop-user!
metabase.test.data.sql-jdbc.load-data/make-insert!
metabase.test.data.users/clear-cached-session-tokens!
metabase.test.initialize/do-initialization!
metabase.test.initialize/initialize-if-needed!
metabase.test.integrations.ldap/start-ldap-server!
metabase.test.util.log/ensure-unique-logger!
metabase.test.util.log/set-ns-log-level!
metabase.test.util/do-with-temp-env-var-value!
metabase.test.util/restore-raw-setting!
metabase.test.util/upsert-raw-setting!
metabase.test/initialize-if-needed!
metabase.test/test-helpers-set-global-values!
metabase.test/with-temp-env-var-value!
metabase.upload-test/set-local-infile!
metabase.util.files/create-dir-if-not-exists!
metabase.util.ssh-test/start-mock-servers!
metabase.util.ssh-test/stop-mock-servers!})
(defn- end-with-exclamation?
[s]
(str/ends-with? s "!"))
(defn- explicitly-safe? [qualified-symbol]
(contains? symbols-allowed-in-fns-not-ending-in-an-exclamation-point qualified-symbol))
(defn- explicitly-unsafe? [config qualified-symbol]
(contains? (get-in config [:linters :metabase/validate-deftest :parallel/unsafe]) qualified-symbol))
(defn- unsafe? [config qualified-symbol]
(and (or (end-with-exclamation? qualified-symbol)
(explicitly-unsafe? config qualified-symbol))
(not (explicitly-safe? qualified-symbol))))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node} config]
(when-not (and (:string-value form-name)
(end-with-exclamation? (:string-value form-name)))
(letfn [(walk [f form]
(f form)
(doseq [child (:children form)]
(walk f child)))
(check-node [form]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(when (unsafe? config qualified-symbol)
(hooks/reg-finding!
(assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`. [:metabase/test-helpers-use-non-thread-safe-functions]"
(:string-value defn-or-defmacro) qualified-symbol)
:type :metabase/test-helpers-use-non-thread-safe-functions)))))]
(walk check-node node))
node))
(defn non-thread-safe-form-should-end-with-exclamation
"Used to ensure defn and defmacro in test namespace to have name ending with `!` if it's non-thread-safe.
A function or a macro can be defined as 'not thread safe' when their funciton name ends with a `!`.
Only used in tests to identify thread-safe/non-thread-safe test helpers. See #37126"
[{:keys [node cljc lang config]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node config))
{:node node})
(comment
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(binding [hooks/*reload* true]
(-> form
(with-in-str (clj-kondo/run! {:lint ["-"]}))
:findings))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))
(defn- ns-form-node->require-node [ns-form-node]
(some (fn [node]
(when (and (hooks/list-node? node)
(let [first-child (first (:children node))]
(and (hooks/keyword-node? first-child)
(= (hooks/sexpr first-child) :require))))
node))
(:children ns-form-node)))
(defn- lint-require-shapes [ns-form-node]
(doseq [node (-> ns-form-node
ns-form-node->require-node
:children
rest)]
(cond
(not (hooks/vector-node? node))
(hooks/reg-finding! (assoc (meta node)
:message "All :required namespaces should be wrapped in vectors [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker))
(hooks/vector-node? (second (:children node)))
(hooks/reg-finding! (assoc (meta node)
:message "Don't use prefix forms inside :require [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker)))))
(defn- require-node->namespace-symb-nodes [require-node]
(let [[_ns & args] (:children require-node)]
(into []
;; prefixed namespace forms are NOT SUPPORTED!!!!!!!!1
(keep (fn [node]
(cond
(hooks/vector-node? node)
;; propagate the metadata attached to this vector in case there's a `:clj-kondo/ignore` form.
(vary-meta (first (:children node)) (partial merge (meta require-node) (meta node)))
;; this should also be dead code since we require requires to be vectors
(hooks/token-node? node)
(vary-meta node (partial merge (meta require-node)))
:else
(printf "Don't know how to figure out what namespace is being required in %s\n" (pr-str node)))))
args)))
(defn- ns-form-node->ns-symb [ns-form-node]
(some-> (some (fn [node]
(when (and (hooks/token-node? node)
(not= (hooks/sexpr node) 'ns))
node))
(:children ns-form-node))
hooks/sexpr))
(defn- module
"E.g.
(module 'metabase.qp.middleware.wow) => 'metabase.qp"
[ns-symb]
(some-> (re-find #"^metabase\.[^.]+" (str ns-symb)) symbol))
(defn- ignored-namespace? [ns-symb config]
(some
(fn [pattern-str]
(re-find (re-pattern pattern-str) (str ns-symb)))
(:ignored-namespace-patterns config)))
(defn- module-api-namespaces
"Set API namespaces for a given module. `:any` means you can use anything, there are no API namespaces for this
module (yet). If unspecified, the default is just the namespace with the same name as the module e.g.
`metabase.db`."
[module config]
(let [module-config (get-in config [:api-namespaces module])]
(cond
(= module-config :any)
nil
(set? module-config)
module-config
:else
#{module})))
(defn- lint-modules [ns-form-node config]
(let [ns-symb (ns-form-node->ns-symb ns-form-node)]
(when-not (ignored-namespace? ns-symb config)
(when-let [current-module (module ns-symb)]
(let [allowed-modules (get-in config [:allowed-modules current-module])
required-namespace-symb-nodes (-> ns-form-node
ns-form-node->require-node
require-node->namespace-symb-nodes)]
(doseq [node required-namespace-symb-nodes
:let [clj-kondo-ignore (some-> (meta node) :clj-kondo/ignore hooks/sexpr set)]
:when (not (contains? clj-kondo-ignore :metabase/ns-module-checker))
:let [required-namespace (hooks/sexpr node)
required-module (module required-namespace)]
;; ignore stuff not in a module i.e. non-Metabase stuff.
:when required-module
:let [in-current-module? (= required-module current-module)]
:when (not in-current-module?)
:let [allowed-module? (or (= allowed-modules :any)
(contains? (set allowed-modules) required-module))
module-api-namespaces (module-api-namespaces required-module config)
allowed-module-namespace? (or (empty? module-api-namespaces)
(contains? module-api-namespaces required-namespace))]]
(when-let [error (cond
(not allowed-module?)
(format "Module %s should not be used in the %s module. [:metabase/ns-module-checker :allowed-modules %s]"
required-module
current-module
current-module)
(not allowed-module-namespace?)
(format "Namespace %s is not an allowed external API namespace for the %s module. [:metabase/ns-module-checker :api-namespaces %s]"
required-namespace
required-module
required-module))]
(hooks/reg-finding! (assoc (meta node)
:message error
:type :metabase/ns-module-checker)))))))))
(defn lint-ns [x]
(lint-require-shapes (:node x))
(lint-modules (:node x) (get-in x [:config :linters :metabase/ns-module-checker]))
x)

View File

@@ -1,52 +0,0 @@
(ns hooks.clojure.core.defmulti
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]))
(defn- check-arglists [report-node arglists]
(letfn [(reg-bad-arglists! []
(hooks/reg-finding!
(assoc (meta report-node)
:message ":arglists should be a quoted list of vectors [:metabase/check-defmulti-arglists]"
:type :metabase/check-defmulti-arglists)))
(reg-bad-arg! []
(hooks/reg-finding!
(assoc (meta report-node)
:message ":arglists should contain actual arg names, not underscore (unused) symbols [:metabase/check-defmulti-arglists]"
:type :metabase/check-defmulti-arglists)))
(underscore-arg? [arg]
(and (symbol? arg)
(str/starts-with? arg "_")))
(check-arglist [arglist]
(cond
(not (vector? arglist)) (reg-bad-arglists!)
(some underscore-arg? arglist) (reg-bad-arg!)))]
(if-not (and (seq? arglists)
(= (first arglists) 'quote)
(seq (second arglists)))
(reg-bad-arglists!)
(let [[_quote arglists] arglists]
(doseq [arglist arglists]
(check-arglist arglist))))))
(defn- defmulti-check-for-arglists-metadata
"Make sure a [[defmulti]] has an attribute map with `:arglists` metadata."
[node]
(let [[_defmulti _symb & args] (:children node)
[_docstring & args] (if (hooks/string-node? (first args))
args
(cons nil args))
attr-map (when (hooks/map-node? (first args))
(first args))
arglists (some-> attr-map hooks/sexpr :arglists seq)]
(if-not (seq? arglists) ; should be a list or at least list-like
(hooks/reg-finding!
(assoc (meta node)
:message "All defmultis should have an attribute map with :arglists metadata. [:metabase/check-defmulti-arglists]"
:type :metabase/check-defmulti-arglists))
(check-arglists attr-map arglists))))
(defn lint-defmulti [x]
(defmulti-check-for-arglists-metadata (:node x))
x)

View File

@@ -1,76 +0,0 @@
(ns hooks.clojure.core.defn
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]))
(defn- end-with-exclamation?
[s]
(str/ends-with? s "!"))
(defn- explicitly-safe? [config qualified-symbol]
(contains? (get-in config [:linters :metabase/test-helpers-use-non-thread-safe-functions :explicitly-safe])
qualified-symbol))
(defn- explicitly-unsafe? [config qualified-symbol]
(contains? (get-in config [:linters :metabase/validate-deftest :parallel/unsafe]) qualified-symbol))
(defn- unsafe? [config qualified-symbol]
(and (or (end-with-exclamation? qualified-symbol)
(explicitly-unsafe? config qualified-symbol))
(not (explicitly-safe? config qualified-symbol))))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node} config]
(when-not (and (:string-value form-name)
(end-with-exclamation? (:string-value form-name)))
(letfn [(walk [f form]
(f form)
(doseq [child (:children form)]
(walk f child)))
(check-node [form]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(when (unsafe? config qualified-symbol)
(hooks/reg-finding!
(assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`. [:metabase/test-helpers-use-non-thread-safe-functions]"
(:string-value defn-or-defmacro) qualified-symbol)
:type :metabase/test-helpers-use-non-thread-safe-functions)))))]
(walk check-node node))
node))
(defn non-thread-safe-form-should-end-with-exclamation
"Used to ensure defn and defmacro in test namespace to have name ending with `!` if it's non-thread-safe.
A function or a macro can be defined as 'not thread safe' when their funciton name ends with a `!`.
Only used in tests to identify thread-safe/non-thread-safe test helpers. See #37126"
[{:keys [node cljc lang config]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node config))
{:node node})
(comment
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(binding [hooks/*reload* true]
(-> form
(with-in-str (clj-kondo/run! {:lint ["-"]}))
:findings))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))

View File

@@ -1,119 +0,0 @@
(ns hooks.clojure.core.ns
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]
[hooks.common.modules :as modules]))
(defn- ns-form-node->require-node [ns-form-node]
(some (fn [node]
(when (and (hooks/list-node? node)
(let [first-child (first (:children node))]
(and (hooks/keyword-node? first-child)
(= (hooks/sexpr first-child) :require))))
node))
(:children ns-form-node)))
(defn- lint-require-shapes [ns-form-node]
(doseq [node (-> ns-form-node
ns-form-node->require-node
:children
rest)]
(cond
(not (hooks/vector-node? node))
(hooks/reg-finding! (assoc (meta node)
:message "All :required namespaces should be wrapped in vectors [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker))
(hooks/vector-node? (second (:children node)))
(hooks/reg-finding! (assoc (meta node)
:message "Don't use prefix forms inside :require [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker)))))
(defn- lint-requires-on-new-lines [ns-form-node]
(let [[require-keyword first-require] (-> ns-form-node
ns-form-node->require-node
:children)]
(when-let [require-keyword-line (:row (meta require-keyword))]
(when-let [first-require-line (:row (meta first-require))]
(when (= require-keyword-line first-require-line)
(hooks/reg-finding! (assoc (meta first-require)
:message "Put your requires on a newline from the :require keyword [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker)))))))
(defn- require-node->namespace-symb-nodes [require-node]
(let [[_ns & args] (:children require-node)]
(into []
;; prefixed namespace forms are NOT SUPPORTED!!!!!!!!1
(keep (fn [node]
(cond
(hooks/vector-node? node)
;; propagate the metadata attached to this vector in case there's a `:clj-kondo/ignore` form.
(let [symbol-node (first (:children node))]
(hooks.common/merge-ignored-linters symbol-node require-node node))
;; this should also be dead code since we require requires to be vectors
(hooks/token-node? node)
(hooks.common/merge-ignored-linters node require-node)
:else
(printf "Don't know how to figure out what namespace is being required in %s\n" (pr-str node)))))
args)))
(defn- ns-form-node->ns-symb-node [ns-form-node]
(some (fn [node]
(when (and (hooks/token-node? node)
(not= (hooks/sexpr node) 'ns))
node))
(:children ns-form-node)))
(defn- ns-form-node->ns-symb [ns-form-node]
(some-> (ns-form-node->ns-symb-node ns-form-node)
hooks/sexpr))
(defn- lint-modules [ns-form-node config]
(let [ns-symb (ns-form-node->ns-symb ns-form-node)]
(when-not (modules/ignored-namespace? config ns-symb)
(when-let [current-module (modules/module ns-symb)]
(let [required-namespace-symb-nodes (-> ns-form-node
ns-form-node->require-node
require-node->namespace-symb-nodes)]
(doseq [node required-namespace-symb-nodes
:when (not (contains? (hooks.common/ignored-linters node) :metabase/modules))
:let [required-namespace (hooks/sexpr node)
error (modules/usage-error config current-module required-namespace)]
:when error]
(hooks/reg-finding! (assoc (meta node)
:message error
:type :metabase/modules))))))))
(defn- lint-namespace-name [ns-form-node]
(when-let [ns-symb-node (ns-form-node->ns-symb-node ns-form-node)]
(when-not (contains? (hooks.common/ignored-linters ns-symb-node) :metabase/namespace-name)
(let [parts (str/split (str (hooks/sexpr ns-symb-node)) #"\.")]
(when (and (<= (count parts) 2)
(#{"metabase" "metabase-enterprise"} (first parts))
;; exclude test namespaces for now
(not (str/ends-with? (last parts) "test")))
(hooks/reg-finding! (assoc (meta ns-symb-node)
:message "Metabase namespaces should have the form metabase[-enterprise].<module>.* [:metabase/namespace-name]"
:type :metabase/namespace-name)))))))
(defn lint-ns [x]
(doto (:node x)
lint-require-shapes
lint-requires-on-new-lines
(lint-modules (modules/config x))
lint-namespace-name)
x)
(comment
(lint-ns
{:node (hooks/parse-string
(pr-str
'(ns hooks.clojure.core.ns
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]
[hooks.common.modules :as modules]))))}))

View File

@@ -1,75 +0,0 @@
(ns hooks.clojure.core.require
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common.modules :as modules]))
(defn- lint* [node current-ns config required-namespaces]
{:pre [(map? node)
(simple-symbol? current-ns)
(map? config)
(sequential? required-namespaces)
(every? simple-symbol? required-namespaces)]}
(when-not (modules/ignored-namespace? config current-ns)
;; ignore namespaces outside of the module system
(when-let [current-module (modules/module current-ns)]
(doseq [required-namespace required-namespaces]
;; ignore namespaces outside of the module system.
(when (modules/module required-namespace)
(when-let [error (modules/usage-error config current-module required-namespace)]
(hooks/reg-finding! (assoc (meta node)
:message error
:type :metabase/modules))))))))
(defn- unwrap-require [node]
(case (hooks/tag node)
;; some.namespace of some.namespace/some-var
:token
(let [sexpr (hooks/sexpr node)]
(if (qualified-symbol? sexpr)
(symbol (namespace sexpr))
sexpr))
;; (quote some.namespace)
:list
(let [[x y] (:children node)]
(when (and (hooks/token-node? x)
(= (hooks/sexpr x) 'quote))
(recur y)))
;; 'some.namespace
:quote
(recur (first (:children node)))
;; something like [some.namespace :as whatever]
:vector
(recur (first (:children node)))))
(comment
(unwrap-require (-> "(requiring-resolve 'metabase.notification.payload.execute/execute-dashboard)"
hooks/parse-string
:children
second)))
(defn- lint-require* [node current-ns config]
(let [[_require & args] (:children node)
required-namespaces (->> (keep unwrap-require args)
;; `require` runs through `cc/load-libs` which allows
;; #{:as :reload :reload-all :require :use :verbose :refer :as-alias}
;; as args. If you use a REPL tool that applies clj-kondo linting (e.g., Clojure MCP)
;; you may wish to `:reload` or `:reload-all` a namespace. So we shouldn't assume all
;; args are keywords:
(remove keyword?))]
(lint* node current-ns config required-namespaces)))
(defn- lint-requiring-resolve* [node current-ns config]
(let [[_requiring-resolve symb-node] (:children node)
required-namespace (unwrap-require symb-node)]
(lint* node current-ns config [required-namespace])))
(defn lint-require [x]
(lint-require* (:node x) (:ns x) (modules/config x))
x)
(defn lint-requiring-resolve [x]
(lint-requiring-resolve* (:node x) (:ns x) (modules/config x))
x)

View File

@@ -71,7 +71,11 @@
:type :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests)))))))
(defn- ignore? [node error-type]
(contains? (hooks.common/ignored-linters node) error-type))
(when-let [ignores (some-> node meta :clj-kondo/ignore hooks/sexpr)]
(when-let [ignores (cond
(coll? ignores) (set ignores)
(keyword? ignores) #{ignores})]
(contains? ignores error-type))))
(defn deftest-check-no-driver-keywords [node {:keys [drivers], :as _config}]
;; fail fast after we see the first error, where we see one hardcoded driver name there are likely several more and we

View File

@@ -1,8 +1,7 @@
(ns hooks.common
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.pprint]
[clojure.set :as set]))
[clojure.pprint]))
(defn with-macro-meta
"When introducing internal nodes (let, defn, etc) it is important to provide a meta of an existing token
@@ -10,78 +9,6 @@
[new-node hook-node]
(with-meta new-node (meta (first (:children hook-node)))))
;;; Kondo stores information about ignored linters as rewrite-clj forms matching how they are specified in the code, so
;;; either
;;;
;;; <vector-node [<token-node :discouraged-namespace>]>
;;;
;;; or
;;;
;;; <token-node :discouraged-namespace>
;;;
;;; these are stored in
;;;
;;; (-> node meta :clj-kondo/ignore :linters).
;;;
;;; These are not a convenient shape(s) to work with, so the next few functions abstract that shape out and work with a
;;; set of keywords like
;;;
;;; #{:discouraged-namespace}
;;;
;;; instead.
(defn- unwrap-ignored-linters [linters]
(cond
(or (hooks/vector-node? linters)
(hooks/list-node? linters))
(into #{}
(map hooks/sexpr)
(:children linters))
(hooks/keyword-node? linters)
#{(hooks/sexpr linters)}
(and (set? linters)
(every? keyword? linters))
linters
(and (sequential? linters)
(every? keyword? linters))
(into #{} linters)
(keyword? linters)
#{linters}))
(defn- wrap-ignored-linters [linters]
(hooks/vector-node (mapv hooks/keyword-node linters)))
(defn ignored-linters
"Return a set of keywords all ignored linters associated with a node by looking at its metadata."
[node]
(or (some-> node meta :clj-kondo/ignore :linters unwrap-ignored-linters)
;; deal with the old pre-2024.09 shape mentioned in https://github.com/clj-kondo/clj-kondo/issues/2414
(some-> node :meta first hooks/sexpr :clj-kondo/ignore unwrap-ignored-linters)))
(defn update-ignored-linters
"Update the `:clj-kondo/ignore` linters in `node`'s metadata. `linters` should be a set of keywords."
[node f & args]
(letfn [(apply-f [linters]
(apply f linters args))
(update-linters [linters]
(-> (or (unwrap-ignored-linters linters)
#{})
apply-f
wrap-ignored-linters))]
(vary-meta node update-in [:clj-kondo/ignore :linters] update-linters)))
(defn merge-ignored-linters
"Merge the ignored linters from `source-nodes` into `node`. You can use this to propagate
ignored linters from parent nodes to child nodes."
[node & source-nodes]
(if-let [linters (not-empty (transduce (map ignored-linters) set/union #{} source-nodes))]
(update-ignored-linters node set/union linters)
node))
;;; This stuff is to help debug hooks. Trace a function and it will pretty-print the before & after sexprs.
;;;
;;; (hooks.common/trace #'calculate-bird-scarcity)
@@ -121,9 +48,9 @@
[{{[_ & args] :children, :as node} :node}]
(let [node* (-> (hooks/list-node
(list*
(update-ignored-linters (hooks/token-node 'do) conj :redundant-do)
(with-meta (hooks/token-node 'do) {:clj-kondo/ignore [:redundant-do]})
(for [arg args]
(update-ignored-linters arg conj :unused-value))))
(vary-meta arg update :clj-kondo/ignore #(conj (vec %) :unused-value)))))
(with-meta (meta node)))]
{:node node*}))
@@ -446,28 +373,6 @@
body))]
{:node node*}))
(defn with-used-first-two-args
"For macros like
(with-limit-and-offset limit offset
...)
=>
(let [_123 limit
[_456 offset]
...)
where the first arg should be linted and appear to be used."
[{{[_ x y & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_")) x
(hooks/token-node (gensym "_")) y])
body))]
{:node node*}))
(defn with-vec-first-binding
"For macros like
@@ -534,4 +439,9 @@
metadata to a node to suppress LSP warnings."
[node]
(update-ignored-linters node conj :clojure-lsp/unused-public-var))
(letfn [(update-ignores [existing-ignores]
(hooks/vector-node
(cons
(hooks/keyword-node :clojure-lsp/unused-public-var)
(:children existing-ignores))))]
(vary-meta node update :clj-kondo/ignore update-ignores)))

View File

@@ -1,81 +0,0 @@
(ns hooks.common.modules)
(defn ignored-namespace? [config ns-symb]
(some
(fn [pattern-str]
(re-find (re-pattern pattern-str) (str ns-symb)))
(:ignored-namespace-patterns config)))
(defn config [{:keys [config], :as _hook-input}]
(merge (get-in config [:linters :metabase/modules])
(select-keys config [:metabase/modules])))
(defn module
"E.g.
(module 'metabase.qp.middleware.wow) => 'qp
(module 'metabase-enterprise.whatever.core) => enterprise/whatever"
[ns-symb]
{:pre [(simple-symbol? ns-symb)]}
(or (some->> (re-find #"^metabase-enterprise\.([^.]+)" (str ns-symb))
second
(symbol "enterprise"))
(some-> (re-find #"^metabase\.([^.]+)" (str ns-symb))
second
symbol)))
(defn module-api-namespaces
"Set of API namespace symbols for a given module. `:any` means you can use anything, there are no API namespaces for
this module (yet). If unspecified, the default is just the `<module>.core` namespace."
[config module]
(let [module-config (get-in config [:metabase/modules module :api])]
(cond
(= module-config :any)
nil
(set? module-config)
module-config
:else
(let [ns-prefix (if (= (namespace module) "enterprise")
(str "metabase-enterprise." (name module))
(name module))]
#{(symbol (str ns-prefix ".api"))
(symbol (str ns-prefix ".core"))
(symbol (str ns-prefix ".init"))}))))
(defn allowed-modules
"Set of namespace symbols that `module` is allowed to use. `:any` means it's allowed to use anything."
[config module]
(get-in config [:metabase/modules module :uses]))
(defn allowed-module? [config module required-module]
(let [allowed-modules (allowed-modules config module)]
(or (= allowed-modules :any)
(contains? (set allowed-modules) required-module))))
(defn allowed-module-namespace? [config ns-symb]
(let [module (module ns-symb)
module-api-namespaces (module-api-namespaces config module)]
(or (empty? module-api-namespaces)
(contains? module-api-namespaces ns-symb))))
(defn usage-error
"Find usage errors when a `required-namespace` is required in the `current-module`. Returns a string describing the
error type if there is one, otherwise `nil` if there are no errors."
[config current-module required-namespace]
;; ignore stuff not in a module i.e. non-Metabase stuff.
(when-let [required-module (module required-namespace)]
(when-not (= current-module required-module)
(cond
(not (allowed-module? config current-module required-module))
(format "Module %s should not be used in the %s module. [:metabase/modules %s :uses]"
required-module
current-module
current-module)
(not (allowed-module-namespace? config required-namespace))
(format "Namespace %s is not an allowed external API namespace for the %s module. [:metabase/modules %s :api]"
required-namespace
required-module
required-module)))))

View File

@@ -1,26 +0,0 @@
(ns hooks.malli.error
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common]))
(defn humanize [x]
(letfn [(check-node [node]
(when (hooks/list-node? node)
(let [[_ child] (:children node)]
(when (hooks/list-node? child)
(let [[symb] (:children child)]
(when-let [qualified-symb (hooks.common/node->qualified-symbol symb)]
(when ('#{malli.core/validate metabase.util.malli.registry/validate}
qualified-symb)
(hooks/reg-finding! (assoc (meta symb)
:message "Use malli.error/humanize with explain, NOT with validate. [:metabase/check-me-humanize]"
:type :metabase/check-me-humanize)))))))))]
(check-node (:node x))
x))
(comment
(humanize {:node (hooks/parse-string
(pr-str '(malli.error/humanize
(malli.core/validate
metabase.sync.sync-metadata.dbms-version/DBMSVersion
metabase.driver.druid.sync-test/dbms-version))))}))

View File

@@ -0,0 +1,28 @@
(ns hooks.metabase.api.automagic-dashboards-test
(:require [clj-kondo.hooks-api :as hooks]))
(comment
(def input (hooks/parse-string
"(with-indexed-model! [{:keys [model model-index model-index-value]}
{:query :some-query}]
:foo :bar :body)"))
(println (hooks/sexpr input))
(let [f (load-file ".clj-kondo/hooks/metabase/api/automagic_dashboards_test.clj")]
(f {:node input})))
(defn with-indexed-model!
[{node :node}]
(let [[_macro-call binding-and-query-info & body] (:children node)
[binding query-info] (:children binding-and-query-info)
node* (hooks/list-node
[(hooks/token-node 'do-with-indexed-model!)
query-info
(hooks/list-node
(list* (hooks/token-node 'fn)
(hooks/vector-node [binding])
body))])]
#_(println (hooks/sexpr node*))
{:node node*}))

View File

@@ -0,0 +1,32 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]
[hooks.common]))
(defn route-fn-name
"route fn hook"
[method route]
(let [route (if (vector? route) (first route) route)]
(-> (str (name method) route)
(str/replace #"/" "_")
symbol)))
(defn defendpoint
[arg]
(letfn [(update-defendpoint [node]
(let [[_defendpoint method route & body] (:children node)]
(-> (api/list-node
(list
(api/token-node 'do)
(-> (api/token-node (symbol "compojure.core" (str (api/sexpr method))))
(with-meta (meta method)))
(api/list-node
(list*
(api/token-node 'clojure.core/defn)
(-> (api/token-node (route-fn-name (api/sexpr method) (api/sexpr route)))
(with-meta (meta route)))
body))))
(with-meta (meta node))
hooks.common/add-lsp-ignore-unused-public-var-metadata)))]
(update arg :node update-defendpoint)))

View File

@@ -1,56 +0,0 @@
(ns hooks.metabase.api.macros
(:require
[clj-kondo.hooks-api :as api]
[hooks.common]))
(defn defendpoint
[arg]
(letfn [(update-defendpoint [node]
(let [[defendpoint method route & more] (:children node)
[result-schema & more] (if (= (api/sexpr (first more)) :-)
(drop 1 more)
(cons nil more))
[_docstring & more] (if (api/string-node? (first more))
more
(cons nil more))
[metadata & more] (if (api/map-node? (first more))
more
(cons nil more))
[params & body] more
[bindings schemas] (when (api/vector-node? params)
(loop [bindings [], schemas [], [x y & more] (:children params)]
(cond
(not x)
[bindings schemas]
(= (api/sexpr x) :-)
(recur bindings (conj schemas y) more)
:else
(recur (conj bindings x) schemas (cons y more)))))]
(-> (api/list-node
(list
(api/token-node 'do)
defendpoint
method
route
(api/list-node
(list*
(api/token-node 'do)
(filter some? (list* metadata result-schema schemas))))
(api/list-node
(list*
(api/token-node `let)
(api/vector-node (into []
cat
[(mapcat (fn [a-binding]
[a-binding (api/map-node {})])
(take 4 bindings))
(mapcat (fn [a-binding]
[a-binding (api/list-node (list
(api/token-node 'clojure.core/constantly)
(api/token-node 'nil)))])
(drop 4 bindings))]))
body))))
(with-meta (meta node)))))]
(update arg :node update-defendpoint)))

View File

@@ -0,0 +1,17 @@
(ns hooks.metabase.api.search-test
(:require [clj-kondo.hooks-api :as hooks]))
(defn with-search-items-in-collection [{{[_ & args] :children, :as node} :node}]
;; (println \newline)
;; (clojure.pprint/pprint (hooks/sexpr node))
(let [[created-items-sym search-string & body] args
node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[created-items-sym (hooks/token-node 'nil)])
search-string
body))]
;; (println '=>)
;; (clojure.pprint/pprint (hooks/sexpr node*))
{:node node*}))

View File

@@ -1,14 +0,0 @@
(ns hooks.metabase.app-db.schema-migrations-test.impl
(:require [clj-kondo.hooks-api :as hooks]))
(defn test-migrations
[{{[_ migration-range {[binding] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node `let)
(hooks/vector-node
[binding (hooks/list-node (list (hooks/token-node `fn)
(hooks/vector-node [(hooks/token-node '&) (hooks/token-node '_args)])))])
migration-range
body))]
{:node node*}))

View File

@@ -8,18 +8,19 @@
[{:keys [node]}]
(let [[_ helper-name description argvec & body] (:children node)
helper-fn-name (symbol (str (hooks/sexpr helper-name) "*"))]
{:node (-> (hooks/list-node
(list (hooks/token-node 'do)
(hooks/list-node
(list (hooks/token-node 'defn)
(hooks/token-node helper-fn-name)
description
argvec
(hooks/list-node body)))
(hooks/list-node
(list (hooks/token-node 'defn)
helper-name
description
argvec
(hooks/list-node body)))))
(with-meta (meta node)))}))
{:node (hooks/list-node
(list (hooks/token-node 'do)
(hooks/list-node
(list (hooks/token-node 'defn)
(hooks/token-node helper-fn-name)
description
argvec
(hooks/list-node body)))
(hooks/list-node
(list (hooks/token-node 'def)
helper-name
description
(hooks/list-node
(into [(hooks/token-node 'fn)
argvec]
body))))))}))

View File

@@ -0,0 +1,14 @@
(ns hooks.metabase.db.schema-migrations-test.impl
(:require [clj-kondo.hooks-api :as hooks]))
(defn test-migrations
[{{[_ migration-range {[binding] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node `let)
(hooks/vector-node
[binding (hooks/list-node (list (hooks/token-node `fn)
(hooks/vector-node [(hooks/token-node '&) (hooks/token-node '_args)])))])
migration-range
body))]
{:node node*}))

View File

@@ -1,18 +0,0 @@
(ns hooks.metabase.driver.mongo-test
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common]))
(defn with-describe-table-for-sample
"Forward bindings for results of functions used in mongo's describe-table implementation."
[{{[_ _ & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(hooks/token-node 'dbfields) (hooks/token-node '(delay nil))
(hooks/token-node 'ftree) (hooks/token-node '(delay nil))
(hooks/token-node 'nested-fields) (hooks/token-node '(delay nil))])
body))]
;; Avoid warnings when not all from the dbfields, ftree and nested-fields are used.
{:node (hooks.common/update-ignored-linters node* conj :unused-binding)}))

View File

@@ -1,19 +0,0 @@
(ns hooks.metabase.model-persistence.test-util
(:require
[clj-kondo.hooks-api :as hooks]))
(defn with-persistence-enabled! [x]
(letfn [(update-node [node]
(let [[_symb bindings & body] (:children node)
[fn-binding] (:children bindings)]
(-> (hooks/list-node
(list*
(hooks/token-node `let)
(hooks/vector-node
[fn-binding (hooks/list-node
(list
(hooks/token-node `fn)
(hooks/vector-node [])))])
body))
(with-meta (meta node)))))]
(update x :node update-node)))

View File

@@ -0,0 +1,267 @@
(ns hooks.metabase.models.setting
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common :as common]))
(def ^:private ignored-implicit-export?
'#{active-users-count
admin-email
analytics-uuid
anon-tracking-enabled
api-key
attachment-table-row-limit
audit-max-retention-days
bcc-enabled?
breakout-bin-width
check-for-updates
cloud-gateway-ips
config-from-file-sync-databases
custom-homepage
custom-homepage-dashboard
database-enable-actions
deprecation-notice-version
dismissed-custom-dashboard-toast
dismissed-onboarding-sidebar-link
email-configured?
email-from-address
email-from-name
email-reply-to
email-smtp-host
email-smtp-password
email-smtp-port
email-smtp-security
email-smtp-username
embedding-app-origin
embedding-secret-key
enable-password-login
enable-public-sharing
enable-query-caching
engines
enum-cardinality-threshold
follow-up-email-sent
google-auth-auto-create-accounts-domain
google-auth-client-id
google-auth-configured
google-auth-enabled
has-sample-database?
has-user-setup
help-link
help-link-custom-destination
instance-creation
is-hosted?
is-metabot-enabled
jdbc-data-warehouse-max-connection-pool-size
jdbc-data-warehouse-unreturned-connection-timeout-seconds
jwt-attribute-email
jwt-attribute-firstname
jwt-attribute-groups
jwt-attribute-lastname
jwt-configured
jwt-enabled
jwt-group-mappings
jwt-group-sync
jwt-identity-provider-uri
jwt-user-provisioning-enabled?
jwt-shared-secret
last-acknowledged-version
last-used-native-database-id
ldap-attribute-email
ldap-attribute-firstname
ldap-attribute-lastname
ldap-bind-dn
ldap-configured?
ldap-enabled
ldap-group-base
ldap-group-mappings
ldap-group-membership-filter
ldap-group-sync
ldap-host
ldap-password
ldap-port
ldap-user-provisioning-enabled?
ldap-security
ldap-sync-user-attributes
ldap-sync-user-attributes-blacklist
ldap-user-base
ldap-user-filter
load-analytics-content
map-tile-server-url
metabot-default-embedding-model
metabot-feedback-url
metabot-get-prompt-templates-url
metabot-prompt-generator-token-limit
multi-setting-read-only
notebook-native-preview-shown
notebook-native-preview-sidebar-width
notification-link-base-url
num-metabot-choices
openai-api-key
openai-available-models
openai-model
openai-organization
other-sso-enabled?
password-complexity
persist-models-enabled
persisted-model-refresh-cron-schedule
premium-embedding-token
prometheus-server-port
query-caching-max-kb
query-caching-max-ttl
query-caching-min-ttl
query-caching-ttl-ratio
redirect-all-requests-to-https
reset-token-ttl-hours
retired-setting
retry-initial-interval
retry-max-attempts
retry-max-interval-millis
retry-multiplier
retry-randomization-factor
saml-application-name
saml-attribute-email
saml-attribute-firstname
saml-attribute-group
saml-attribute-lastname
saml-configured
saml-enabled
saml-group-mappings
saml-group-sync
saml-identity-provider-certificate
saml-identity-provider-issuer
saml-identity-provider-uri
saml-keystore-alias
saml-keystore-password
saml-keystore-path
saml-user-provisioning-enabled?
send-email-on-first-login-from-new-device
send-new-sso-user-admin-email?
session-cookie-samesite
session-cookies
session-timeout
setup-token
show-database-syncing-modal
show-metabase-links
site-url
site-uuid
site-uuid-for-premium-features-token-checks
site-uuid-for-unsubscribing-url
site-uuid-for-version-info-fetching
slack-app-token
slack-cached-channels-and-usernames
slack-channels-and-usernames-last-updated
slack-files-channel
slack-token
slack-token-valid?
snowplow-available
snowplow-enabled
snowplow-url
sql-jdbc-fetch-size
ssh-heartbeat-interval-sec
ssl-certificate-public-key
startup-time-millis
token-features
token-status
toucan-name
trial-banner-dismissal-timestamp
uncached-setting
user-visibility
version
version-info
version-info-last-checked})
(defn- defsetting-lint [node setting-name docstring options-list]
(let [anon-binding (common/with-macro-meta (hooks/token-node '_) node)
;; (defn my-setting [] ...)
getter-node (-> (list
(hooks/token-node 'defn)
setting-name
(hooks/string-node "Docstring.")
(hooks/vector-node []))
hooks/list-node
(with-meta (meta node)))
;; (defn my-setting! [_x] ...)
setter-node (-> (list
(hooks/token-node 'defn)
(with-meta
(hooks/token-node (symbol (str (hooks/sexpr setting-name) \!)))
(meta setting-name))
(hooks/string-node "Docstring.")
(hooks/vector-node [(hooks/token-node '_value-or-nil)]))
hooks/list-node
(with-meta (meta node))
common/add-lsp-ignore-unused-public-var-metadata)]
(when (nil? (second (drop-while (comp not #{[:k :export?]} first) options-list)))
(when-not (contains? ignored-implicit-export? (:value setting-name))
(hooks/reg-finding! (assoc (meta node)
:message "Setting definition must provide an explicit value for :export? indicating whether the setting should be exported or not with serialization."
:type :metabase/defsetting-must-specify-export))))
{:node (-> (list
(hooks/token-node 'let)
;; include description and the options map so they can get validated as well.
(hooks/vector-node
[anon-binding docstring
anon-binding (hooks/map-node options-list)])
getter-node
setter-node)
hooks/list-node
(with-meta (meta node)))}))
(defn defsetting
"Rewrite a [[metabase.models.defsetting]] form like
(defsetting my-setting \"Description\" :type :boolean)
as
(let [_ \"Description\"
_ {:type :boolean}]
(defn my-setting \"Docstring.\" [])
(defn my-setting! \"Docstring.\" [_value-or-nil]))
for linting purposes."
[{:keys [node]}]
(let [[setting-name docstring & options] (rest (:children node))]
(defsetting-lint node setting-name docstring options)))
(defn define-multi-setting
"Rewrite a [[metabase.models.define-multi-setting]] form like
(defsetting my-setting \"Description\" :key :type :boolean)
as
(let [_ \"Description\"
_ {:type :boolean, :multi-thunk :key}]
(defn my-setting \"Docstring.\" [])
(defn my-setting! \"Docstring.\" [_value-or-nil]))
for linting purposes."
[{:keys [node]}]
(let [[setting-name docstring thunk & options] (rest (:children node))]
(defsetting-lint node setting-name docstring (concat options [(hooks/token-node :multi-thunk) thunk]))))
(comment
(defn- defsetting* [form]
(hooks/sexpr
(:node
(defsetting
{:node
(hooks/parse-string
(with-out-str
#_{:clj-kondo/ignore [:unresolved-namespace]}
(clojure.pprint/pprint
form)))}))))
(defn x []
(defsetting*
'(defsetting active-users-count
(deferred-tru "Cached number of active users. Refresh every 5 minutes.")
:visibility :admin
:type :integer
:default 0
:getter (fn []
(if-not ((requiring-resolve 'metabase.db/db-is-set-up?))
0
(cached-active-users-count)))))))

View File

@@ -1,65 +0,0 @@
(ns hooks.metabase.premium-features.defenterprise
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common]))
(defn defenterprise [{node :node}]
(let [[_defenterprise fn-name & args] (:children node)
[docstring & args] (if (hooks/string-node? (first args))
args
(cons nil args))
[_enterprise-namespace & args] (if (hooks/token-node? (first args))
args
(cons nil args))
[options fn-tail] (loop [options (hooks/map-node []), [x y & more :as args] args]
(if (hooks/keyword-node? x)
(recur (update options :children concat [x y]) more)
[options args]))]
{:node (hooks/list-node
(list
(hooks/token-node 'let)
(hooks/vector-node
[(hooks/token-node '_options) options])
(-> (hooks/list-node
(concat
(filter some?
(list (hooks/token-node 'defn)
fn-name
docstring))
fn-tail))
(with-meta (meta node))
hooks.common/add-lsp-ignore-unused-public-var-metadata)))}))
(comment
(defn- defenterprise* [form]
(hooks/sexpr
(:node
(defenterprise
{:node
(hooks/parse-string
(with-out-str
(clojure.pprint/pprint
form)))}))))
(defn- x []
(defenterprise*
'(defenterprise score-result
"Scoring implementation that adds score for items in official collections."
:feature :any
:fallback score-result-fallback
[result]
(conj (scoring/weights-and-scores result)
{:weight 2
:score (official-collection-score result)
:name "official collection score"}
{:weight 2
:score (verified-score result)
:name "verified"}))))
(defn- y []
(defenterprise*
'(defenterprise score-result
"Score a result, returning a collection of maps with score and weight."
metabase-enterprise.search.scoring
[result]
(weights-and-scores result)))))

View File

@@ -0,0 +1,65 @@
(ns hooks.metabase.public-settings.premium-features
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common]))
(defn defenterprise [{node :node}]
(let [[_defenterprise fn-name & args] (:children node)
[docstring & args] (if (hooks/string-node? (first args))
args
(cons nil args))
[_enterprise-namespace & args] (if (hooks/token-node? (first args))
args
(cons nil args))
[options fn-tail] (loop [options (hooks/map-node []), [x y & more :as args] args]
(if (hooks/keyword-node? x)
(recur (update options :children concat [x y]) more)
[options args]))]
{:node (hooks/list-node
(list
(hooks/token-node 'let)
(hooks/vector-node
[(hooks/token-node '_options) options])
(-> (hooks/list-node
(concat
(filter some?
(list (hooks/token-node 'defn)
fn-name
docstring))
fn-tail))
(with-meta (meta node))
hooks.common/add-lsp-ignore-unused-public-var-metadata)))}))
(comment
(defn- defenterprise* [form]
(hooks/sexpr
(:node
(defenterprise
{:node
(hooks/parse-string
(with-out-str
(clojure.pprint/pprint
form)))}))))
(defn- x []
(defenterprise*
'(defenterprise score-result
"Scoring implementation that adds score for items in official collections."
:feature :any
:fallback score-result-fallback
[result]
(conj (scoring/weights-and-scores result)
{:weight 2
:score (official-collection-score result)
:name "official collection score"}
{:weight 2
:score (verified-score result)
:name "verified"}))))
(defn- y []
(defenterprise*
'(defenterprise score-result
"Score a result, returning a collection of maps with score and weight."
metabase-enterprise.search.scoring
[result]
(weights-and-scores result)))))

View File

@@ -1,17 +0,0 @@
(ns hooks.metabase.search.api-test
(:require [clj-kondo.hooks-api :as hooks]))
(defn with-search-items-in-collection [{{[_ & args] :children, :as node} :node}]
;; (println \newline)
;; (clojure.pprint/pprint (hooks/sexpr node))
(let [[created-items-sym search-string & body] args
node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[created-items-sym (hooks/token-node 'nil)])
search-string
body))]
;; (println '=>)
;; (clojure.pprint/pprint (hooks/sexpr node*))
{:node node*}))

View File

@@ -1,310 +0,0 @@
(ns hooks.metabase.settings.models.setting
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common :as common]))
(defn lint-defsetting-namespace [node context]
(when-not (re-matches #"^metabase(?:-enterprise)?\.[^\.]+\.settings$" (name (:ns context)))
(hooks/reg-finding! (assoc (meta node)
:message "All defsettings should live in metabase[-enterprise].<module>.settings namespaces"
:type :metabase/defsetting-namespace))))
;;; TODO -- move this into a Kondo config file in `.clj-kondo/config/`
(def ^:private ignored-implicit-export?
'#{active-users-count
admin-email
analytics-uuid
anon-tracking-enabled
api-key
attachment-table-row-limit
audit-max-retention-days
bcc-enabled?
breakout-bin-width
check-for-updates
cloud-gateway-ips
config-from-file-sync-databases
custom-homepage
custom-homepage-dashboard
database-enable-actions
deprecation-notice-version
dismissed-custom-dashboard-toast
email-configured?
email-from-address
email-from-name
email-reply-to
email-smtp-host
email-smtp-password
email-smtp-port
email-smtp-security
email-smtp-username
embedding-app-origin
embedding-secret-key
enable-password-login
enable-public-sharing
enable-query-caching
engines
enum-cardinality-threshold
follow-up-email-sent
google-auth-auto-create-accounts-domain
google-auth-client-id
google-auth-configured
google-auth-enabled
has-sample-database?
has-user-setup
help-link
help-link-custom-destination
instance-creation
is-hosted?
is-metabot-enabled
jdbc-data-warehouse-max-connection-pool-size
jdbc-data-warehouse-unreturned-connection-timeout-seconds
jwt-attribute-email
jwt-attribute-firstname
jwt-attribute-groups
jwt-attribute-lastname
jwt-configured
jwt-enabled
jwt-group-mappings
jwt-group-sync
jwt-identity-provider-uri
jwt-user-provisioning-enabled?
jwt-shared-secret
last-acknowledged-version
last-used-native-database-id
ldap-attribute-email
ldap-attribute-firstname
ldap-attribute-lastname
ldap-bind-dn
ldap-configured?
ldap-enabled
ldap-group-base
ldap-group-mappings
ldap-group-membership-filter
ldap-group-sync
ldap-host
ldap-password
ldap-port
ldap-user-provisioning-enabled?
ldap-security
ldap-sync-user-attributes
ldap-sync-user-attributes-blacklist
ldap-user-base
ldap-user-filter
load-analytics-content
map-tile-server-url
metabot-default-embedding-model
metabot-feedback-url
metabot-get-prompt-templates-url
metabot-prompt-generator-token-limit
multi-setting-read-only
notebook-native-preview-shown
notebook-native-preview-sidebar-width
notification-link-base-url
num-metabot-choices
openai-api-key
openai-available-models
openai-model
openai-organization
other-sso-enabled?
password-complexity
persist-models-enabled
persisted-model-refresh-cron-schedule
premium-embedding-token
prometheus-server-port
query-caching-max-kb
query-caching-max-ttl
query-caching-min-ttl
query-caching-ttl-ratio
redirect-all-requests-to-https
reset-token-ttl-hours
retired-setting
retry-initial-interval
retry-max-attempts
retry-max-interval-millis
retry-multiplier
retry-randomization-factor
saml-application-name
saml-attribute-email
saml-attribute-firstname
saml-attribute-group
saml-attribute-lastname
saml-configured
saml-enabled
saml-group-mappings
saml-group-sync
saml-identity-provider-certificate
saml-identity-provider-issuer
saml-identity-provider-uri
saml-keystore-alias
saml-keystore-password
saml-keystore-path
saml-user-provisioning-enabled?
sdk-iframe-embed-setup-settings
send-email-on-first-login-from-new-device
send-new-sso-user-admin-email?
session-cookie-samesite
session-cookies
session-timeout
setup-token
show-database-syncing-modal
show-metabase-links
site-url
site-uuid
site-uuid-for-premium-features-token-checks
site-uuid-for-unsubscribing-url
site-uuid-for-version-info-fetching
slack-app-token
slack-cached-channels-and-usernames
slack-channels-and-usernames-last-updated
slack-files-channel
slack-token
slack-token-valid?
snowplow-available
snowplow-enabled
snowplow-url
sql-jdbc-fetch-size
ssh-heartbeat-interval-sec
ssl-certificate-public-key
startup-time-millis
token-features
token-status
toucan-name
trial-banner-dismissal-timestamp
uncached-setting
user-visibility
version
version-info
version-info-last-checked})
(defn- lint-defsetting-export [node]
(let [[_defsetting setting-name _docstring & options] (:children node)]
(when (nil? (second (drop-while (comp not #{[:k :export?]} first) options)))
(when-not (contains? ignored-implicit-export? (:value setting-name))
(hooks/reg-finding! (assoc (meta node)
:message "Setting definition must provide an explicit value for :export? indicating whether the setting should be exported or not with serialization."
:type :metabase/defsetting-must-specify-export))))))
(defn- defsetting-replacement-node [node]
(let [[_defsetting setting-name docstring & options-list] (:children node)
anon-binding (common/with-macro-meta (hooks/token-node '_) node)
;; (defn my-setting [] ...)
getter-node (-> (list
(hooks/token-node 'defn)
setting-name
(hooks/string-node "Docstring.")
(hooks/vector-node []))
hooks/list-node
(with-meta (meta node)))
;; (defn my-setting! [_x] ...)
setter-node (-> (list
(hooks/token-node 'defn)
(with-meta
(hooks/token-node (symbol (str (hooks/sexpr setting-name) \!)))
(meta setting-name))
(hooks/string-node "Docstring.")
(hooks/vector-node [(hooks/token-node '_value-or-nil)]))
hooks/list-node
(with-meta (meta node))
common/add-lsp-ignore-unused-public-var-metadata)]
(-> (hooks/list-node
(list
(hooks/token-node 'let)
;; include description and the options map so they can get validated as well.
(hooks/vector-node
[anon-binding docstring
anon-binding (hooks/map-node options-list)])
(hooks/reg-keyword! (-> (hooks/keyword-node (keyword (hooks/sexpr setting-name)))
(with-meta (meta setting-name)))
'metabase.settings.models.setting/defsetting)
getter-node
setter-node))
(with-meta (meta node)))))
(defn defsetting
"Rewrite a [[metabase.models.defsetting]] form like
(defsetting my-setting \"Description\" :type :boolean)
as
(let [_ \"Description\"
_ {:type :boolean}]
(defn my-setting \"Docstring.\" [])
(defn my-setting! \"Docstring.\" [_value-or-nil]))
for linting purposes."
[{:keys [node], :as context}]
(lint-defsetting-namespace node context)
(lint-defsetting-export node)
(update context :node defsetting-replacement-node))
(defn define-multi-setting-replacement-node [node]
(let [[defsetting setting-name docstring thunk & options] (:children node)]
(-> (hooks/list-node
(list*
defsetting
setting-name
docstring
(hooks/token-node :multi-thunk) thunk
options))
(with-meta (meta node))
defsetting-replacement-node)))
(defn define-multi-setting
"Rewrite a [[metabase.models.define-multi-setting]] form like
(defsetting my-setting \"Description\" :key :type :boolean)
as
(let [_ \"Description\"
_ {:type :boolean, :multi-thunk :key}]
(defn my-setting \"Docstring.\" [])
(defn my-setting! \"Docstring.\" [_value-or-nil]))
for linting purposes."
[{:keys [node], :as context}]
(update context :node define-multi-setting-replacement-node))
(defn define-multi-setting-impl
[context]
(letfn [(update-node [node]
(let [[_define-multi-setting-impl setting-name & more] (:children node)]
(-> (hooks/list-node
(list*
(hooks/token-node 'do)
;; For a qualified setting name like `oss-namespace/setting`, then leave the symbol as is, so the
;; usage of that namespace/var gets recorded. Otherwise for an unqualified name convert it to a
;; keyword so we don't get unresolved var errors.
(if (and (hooks/token-node? setting-name)
(qualified-symbol? (hooks/sexpr setting-name)))
setting-name
(-> (hooks/keyword-node (keyword (hooks/sexpr setting-name)))
(with-meta (meta setting-name))))
more))
(with-meta (meta node)))))]
(update context :node update-node)))
(comment
(defn- defsetting* [form]
(hooks/sexpr
(:node
(defsetting
{:node
(hooks/parse-string
(with-out-str
#_{:clj-kondo/ignore [:unresolved-namespace]}
(clojure.pprint/pprint
form)))}))))
(defn x []
(defsetting*
'(defsetting active-users-count
(deferred-tru "Cached number of active users. Refresh every 5 minutes.")
:visibility :admin
:type :integer
:default 0
:getter (fn []
(if-not ((requiring-resolve 'metabase.app-db.core/db-is-set-up?))
0
(cached-active-users-count)))))))

View File

@@ -45,35 +45,37 @@
:unqualified/unknown)))
(defn dataset
[{{[_ dataset & body] :children, :as node} :node this-ns :ns}]
(let [node' (case (dataset-type this-ns dataset)
;; non-symbol, qualified symbols, and unqualified symbols from the current namespace/let-bound can all
;; get converted from something like
;;
;; (dataset whatever
;; ...)
;;
;; to
;;
;; (let [_ whatever]
;; ...)
(:non-symbol :qualified :unqualified/local-def)
(hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node '_) dataset])
body))
[{{[_ dataset & body] :children} :node this-ns :ns}]
(let [noop (constantly nil)
body (case (dataset-type this-ns dataset)
;; non-symbol, qualified symbols, and unqualified symbols from the current namespace/let-bound can all
;; get converted from something like
;;
;; (dataset whatever
;; ...)
;;
;; to
;;
;; (let [_ whatever]
;; ...)
(:non-symbol :qualified :unqualified/local-def)
(list* (hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node '_) dataset])
body)
;; for ones that came from the dataset defs namespace or ones whose origin is unknown, just ignore them
;; and generate a form like
;;
;; (do ...)
(:unqualified/from-dataset-defs-namespace :unqualified/unknown)
(hooks/list-node
(list*
(hooks/token-node `do)
body)))]
{:node (with-meta node' (meta node))}))
;; for ones that came from the dataset defs namespace or ones whose origin is unknown, just ignore them
;; and generate a `print` form:
;;
;; (print ...)
;;
;; (this used to be a `do` form (which makes a lot more semantic sense), but that resulted in warnings
;; about unused values
(:unqualified/from-dataset-defs-namespace :unqualified/unknown)
(list* (hooks/token-node noop)
body))]
{:node (with-meta (hooks/list-node (with-meta body
(meta dataset)))
(meta dataset))}))
(defn- special-token-node?
"Whether this node is one of the special symbols like `$field`."

View File

@@ -1,13 +1,11 @@
(ns hooks.metabase.test.data.datasets
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.set :as set]
[hooks.common]))
(:require [clj-kondo.hooks-api :as hooks]
[clojure.set :as set]))
(defn- only-core-drivers?
"Whether we're for sure only testing against the 'core' drivers that are also app DB types: `:postgres`, `:mysql`, or
`:h2`. Tests like these are ok to mark `:mb/driver-tests` since we always run the full test suite against app DB
drivers anyway."
`:h2`. Tests like these are ok to mark `:mb/once` or `:mb/driver-tests` since we always run the full test suite
against app DB drivers anyway."
[node]
(let [drivers (hooks/sexpr (second (:children node)))
drivers (cond
@@ -17,6 +15,14 @@
(when drivers
(empty? (set/difference drivers #{:h2 :mysql :postgres})))))
(defn- validate-mb-once [x]
(when (:mb/once (meta (:ns x)))
(hooks/reg-finding!
(assoc (meta (:ns x))
:message (str "You should not use test-driver or test-drivers in a namespace marked ^:mb/once"
" [:metabase/validate-mb-once]")
:type :metabase/validate-mb-once))))
(defn- validate-mb-driver-tests [x]
(when-not (:mb/driver-tests (meta (:ns x)))
(hooks/reg-finding!
@@ -27,6 +33,7 @@
(defn- validate-ns-tags [x]
(when-not (only-core-drivers? (:node x))
(validate-mb-once x)
(validate-mb-driver-tests x)))
(defn test-drivers [x]
@@ -38,7 +45,7 @@
(hooks/token-node 'do)
test-drivers
(-> drivers-expr
(hooks.common/update-ignored-linters conj :unused-value))
(vary-meta update :clj-kondo/ignore #(conj (vec %) :unused-value)))
body))
(with-meta (meta node)))))]
(update x :node update-node)))

View File

@@ -1,14 +0,0 @@
(ns hooks.metabase.test.gentest
(:require
[clj-kondo.hooks-api :as hooks]))
(defn iterate*
"(iterate {:as limit-spec} [s1 val1 & more] body-form body-form...)"
[{{:keys [children] :as node} :node :as orig}]
(let [[token limit-spec bindings & body-nodes] children
node* (-> (hooks/list-node
(list token limit-spec
(hooks/list-node (list* (hooks/token-node 'let) bindings
body-nodes))))
(with-meta (meta node)))]
(assoc orig :node node*)))

View File

@@ -1,15 +0,0 @@
(ns hooks.metabase.test.util.generators.jvm
(:require
[clj-kondo.hooks-api :as hooks]))
(defn with-random-cards
"(with-random-cards <metadata-provider> <integer-count-value> & body-forms)"
[{{:keys [children] :as node} :node :as orig}]
(let [[token num-cards & body-nodes] children
node* (-> (hooks/list-node
(list token num-cards
(hooks/list-node (list* (hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node '&cards) (hooks/list-node ())])
body-nodes))))
(with-meta (meta node)))]
(assoc orig :node node*)))

View File

@@ -15,17 +15,3 @@
actual-arg-count)
:type :format))))))
x)
(defn case-enum
"Lint `(case-enum ...)` like `(condp = ...)`."
[x]
(letfn [(update-node [node]
(let [[_case-enum x & more] (:children node)]
(-> (api/list-node
(list*
(api/token-node 'clojure.core/condp)
(api/token-node 'clojure.core/=)
x
more))
(with-meta (meta node)))))]
(update x :node update-node)))

View File

@@ -1,74 +0,0 @@
(ns hooks.metabase.util.i18n
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]
[hooks.common]))
(defn- valid-apostrophes?
"Returns true if `s` contains only doubled quotes (''') or complete placeholder-escaping quotes ('{...}'), false otherwise."
[s]
(loop [chars (seq s)]
(if (empty? chars)
true
(let [c (first chars)]
(if (= c \')
(cond
;; 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.
(= (second chars) \{)
(let [at-closing (drop-while #(not= \' %) (next chars))]
(if (seq at-closing)
(recur (next at-closing))
false))
;; Unpaired single quote: invalid
:else
false)
(recur (rest chars)))))))
(defn format-str-arg-node->str
[node]
(cond
;; it's just a string literal
(api/string-node? node) (api/sexpr node)
;; it's `(str "some" "strings")`
(and (api/list-node? node)
(= 'str (api/sexpr (first (:children node))))
(every? api/string-node? (rest (:children node))))
(apply str (map api/sexpr (rest (:children node))))
;; it's something else, no good
:else
(do
(api/reg-finding!
(assoc (meta node)
:message "Must be a string literal or a call to `str` with string literal arguments."
:type :metabase/validate-string-or-str-args-to-i18n))
nil)))
(defn strict-apostrophes
"Checks the node to make sure it's not a i18n call that will result in dropped apostrophes."
[{:keys [node]}]
(let [format-str-arg (second (:children node))
;; `format-str-arg` must be either a `"string"` or `(str "a call " "to" "str")` (to allow for splitting long
;; strings into shorter lines)
format-str (format-str-arg-node->str format-str-arg)]
(when-not (valid-apostrophes? format-str)
(api/reg-finding!
(assoc (meta node)
:message "Format string contains invalid single quote usage. Use '' for literals or '{...}' for escaping."
:type :metabase/validate-escaped-single-quotes-in-i18n))))
{:node node})
(def tru strict-apostrophes)
(def trs strict-apostrophes)
(def deferred-tru strict-apostrophes)
(def deferred-trs strict-apostrophes)

View File

@@ -1,16 +0,0 @@
(ns hooks.metabase.util.timing
"Custom CLJ Kondo hooks for timing-related linting rules."
(:require [clj-kondo.hooks-api :as api]))
(defn discourage-millis-duration
"Discourage slow and unreliable duration calculations using System/currentTimeMillis "
[{:keys [node]}]
(let [sexpr (api/sexpr node)]
(when (and (list? sexpr) (= (first sexpr) '-) (>= (count sexpr) 2))
(let [first-arg (second sexpr)]
(when (= first-arg (list 'System/currentTimeMillis))
(api/reg-finding!
(assoc (meta node)
:message "Avoid System/currentTimeMillis for calculating durations. Use u/start-timer and u/since-ms for more reliability."
:type :metabase/discourage-millis-duration
:level :warning)))))))

View File

@@ -1,29 +0,0 @@
(ns hooks.metabase.xrays.api.automagic-dashboards-test
(:require
[clj-kondo.hooks-api :as hooks]))
(comment
(def input (hooks/parse-string
"(with-indexed-model! [{:keys [model model-index model-index-value]}
{:query :some-query}]
:foo :bar :body)"))
(println (hooks/sexpr input))
(let [f (load-file ".clj-kondo/hooks/metabase/xrays/api/automagic_dashboards_test.clj")]
(f {:node input})))
(defn with-indexed-model!
[{node :node}]
(let [[_macro-call binding-and-query-info & body] (:children node)
[binding query-info] (:children binding-and-query-info)
node* (hooks/list-node
[(hooks/token-node 'do-with-indexed-model!)
query-info
(hooks/list-node
(list* (hooks/token-node 'fn)
(hooks/vector-node [binding])
body))])]
#_(println (hooks/sexpr node*))
{:node node*}))

View File

@@ -1,63 +0,0 @@
(ns hooks.clojure.core.defmulti-test
(:require
[clj-kondo.hooks-api :as hooks]
[clj-kondo.impl.utils]
[clojure.test :refer :all]
[hooks.clojure.core.defmulti]))
(defn- lint-defmulti [form]
(binding [clj-kondo.impl.utils/*ctx* {:config {:linters {:metabase/check-defmulti-arglists {:level :warning}}}
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(hooks.clojure.core.defmulti/lint-defmulti {:node (hooks/parse-string (pr-str form))})
@(:findings clj-kondo.impl.utils/*ctx*)))
(deftest ^:parallel defmulti-missing-arglists-test
(testing "missing arglists"
(is (=? [{:message "All defmultis should have an attribute map with :arglists metadata. [:metabase/check-defmulti-arglists]"}]
(lint-defmulti '(defmulti expand-visualization
(fn [card _ _]
(-> card :visualization first))))))))
(deftest ^:parallel defmulti-invalid-arglists-test
(testing "invalid arglists"
(are [form] (=? [{:message ":arglists should be a quoted list of vectors [:metabase/check-defmulti-arglists]"}]
(lint-defmulti form))
'(defmulti expand-visualization
{:arglists '()}
(fn [card _ _]
(-> card :visualization first)))
'(defmulti expand-visualization
{:arglists ([a])} ; unquoted
(fn [card _ _]
(-> card :visualization first)))
'(defmulti expand-visualization
{:arglists '[(a)]}
(fn [card _ _]
(-> card :visualization first)))
'(defmulti expand-visualization
{:arglists '((a))}
(fn [card _ _]
(-> card :visualization first))))))
(deftest ^:parallel defmulti-arglists-with-underscore-args-test
(testing "arglists, but some symbols are _"
(are [form] (=? [{:message ":arglists should contain actual arg names, not underscore (unused) symbols [:metabase/check-defmulti-arglists]"}]
(lint-defmulti form))
'(defmulti expand-visualization
{:arglists '([card _ _])}
(fn [card _ _]
(-> card :visualization first)))
'(defmulti expand-visualization
{:arglists '([card _bad _arg])}
(fn [card _ _]
(-> card :visualization first))))))
(deftest ^:parallel defmulti-arglists-ok-test
(testing "good"
(is (= []
(lint-defmulti '(defmulti expand-visualization
{:arglists '([card x y])}
(fn [card _ _]
(-> card :visualization first))))))))

View File

@@ -1,76 +0,0 @@
(ns hooks.clojure.core.ns-test
(:require
[clj-kondo.hooks-api :as hooks]
[clj-kondo.impl.utils]
[clojure.test :refer :all]
[hooks.clojure.core.ns]))
(defn- lint-ns [form config]
(binding [clj-kondo.impl.utils/*ctx* {:config config
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(hooks.clojure.core.ns/lint-ns {:node (hooks/parse-string
(binding [*print-meta* true]
(pr-str form)))
:config config})
@(:findings clj-kondo.impl.utils/*ctx*)))
(defn- lint-modules [form config]
(lint-ns form (assoc-in config [:linters :metabase/modules :level] :warning)))
(deftest ^:parallel module-checker-allowed-modules-test
(are [task-namespace] (=? [{:message "Module task should not be used in the api module. [:metabase/modules api :uses]"
:type :metabase/modules}]
(lint-modules
'(ns metabase.api.search
(:require
[metabase.request.core :as request]
[task-namespace :as task]))
'{:metabase/modules {api {:uses #{request}}
request {:api #{metabase.request.core}}}}))
metabase.task
metabase.task.core))
(deftest ^:parallel module-checker-api-namespaces-test
(is (=? [{:message "Namespace metabase.search.config is not an allowed external API namespace for the search module. [:metabase/modules search :api]"
:type :metabase/modules}]
(lint-modules
'(ns metabase.api.search
(:require
[metabase.search.config :as search.config]
[metabase.search.core :as search]))
'{:metabase/modules {api {:uses #{search}}
search {:api #{metabase.search.core}}}}))))
(deftest ^:parallel module-checker-api-namespaces-ignore-test
(is (empty? (lint-modules
'(ns metabase.api.search
(:require
^{:clj-kondo/ignore [:metabase/modules]}
[metabase.search.config :as search.config]
[metabase.search.core :as search]))
'{:metabase/modules {api {:uses #{search}}
search {:api #{metabase.search.core}}}}))))
(deftest ^:parallel module-checker-enterprise-test
(is (=? [{:message "Module search should not be used in the enterprise/search module. [:metabase/modules enterprise/search :uses]"
:type :metabase/modules}]
(lint-modules
'(ns metabase-enterprise.search.core
(:require
[metabase.search.core :as search]))
'{:metabase/modules {search {:api #{metabase.search.core}}}}))))
(deftest ^:parallel require-newlines-test
(binding [clj-kondo.impl.utils/*ctx* {:config {:linters {:metabase/require-shape-checker {:level :warnings}}}
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(hooks.clojure.core.ns/lint-ns {:node (hooks/parse-string "
(ns metabase.task.cache
(:require [metabase.task.bunny]
[metabase.task.rabbit]))")})
(is (=? [{:message "Put your requires on a newline from the :require keyword [:metabase/require-shape-checker]",
:type :metabase/require-shape-checker}]
@(:findings clj-kondo.impl.utils/*ctx*)))))

View File

@@ -1,10 +0,0 @@
(ns hooks.common.modules-test
(:require
[clojure.test :refer :all]
[hooks.common.modules]))
(deftest ^:parallel module-test
(are [symb expected] (= expected
(hooks.common.modules/module symb))
'metabase.qp.middleware.wow 'qp
'metabase-enterprise.whatever.core 'enterprise/whatever))

View File

@@ -1,39 +1,10 @@
(ns hooks.common-test
(ns ^:mb/once hooks.common-test
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.test :refer :all]
[hooks.common]))
(deftest ^:parallel ignored-linters-test
(doseq [ignored [":metabase/modules"
"[:metabase/modules]"
"(:metabase/modules)"]
prefix ["#_"
"^"]
:let [s (format "%s{:clj-kondo/ignore %s} [metabase.search.config :as search.config]"
prefix
ignored)]]
(testing (pr-str s)
(is (= #{:metabase/modules}
(hooks.common/ignored-linters (api/parse-string s)))))))
(deftest ^:parallel merge-ignored-linters-test
(let [node-1 (api/parse-string "#_{:clj-kondo/ignore [:a]} [:a]")
node-2 (api/parse-string "#_{:clj-kondo/ignore [:b]} [:b]")
node-3 (api/parse-string "#_{:clj-kondo/ignore [:c]} [:c]")
node-1' (hooks.common/merge-ignored-linters node-1 node-2 node-3)]
(is (= #{:a :b :c}
(hooks.common/ignored-linters node-1')))
(testing "Updated metadata should match the shape Kondo expects"
(is (=? {:clj-kondo/ignore {:linters api/vector-node?}}
(meta node-1')))
(let [children (-> node-1' meta :clj-kondo/ignore :linters :children)]
(is (= (count children) 3))
(is (every? api/keyword-node? children))
(is (= [:a :b :c]
(sort (map api/sexpr children))))))))
(deftest ^:parallel node->qualified-symbol-test
(binding [clj-kondo.impl.utils/*ctx* {:namespaces (atom nil)}]
(is (= 'metabase.util.i18n/tru

View File

@@ -0,0 +1,35 @@
(ns hooks.metabase.api.common-test
(:require
[clj-kondo.hooks-api :as api]
[clojure.test :refer :all]
[hooks.metabase.api.common]))
(deftest ^:parallel defendpoint-test
(is (= '(do
compojure.core/POST
(clojure.core/defn
POST_:id_copy
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*))))))
(-> {:node (-> '(api/defendpoint POST "/:id/copy"
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*)))))
pr-str
api/parse-string)}
hooks.metabase.api.common/defendpoint
:node
api/sexpr))))

View File

@@ -1,71 +0,0 @@
(ns hooks.metabase.api.macros-test
(:require
[clj-kondo.hooks-api :as api]
[clojure.test :refer :all]
[hooks.metabase.api.macros]))
(defn- is-valid-node [x]
(is (api/node? x))
(doseq [child (:children x)]
(is-valid-node child)))
(deftest ^:parallel defendpoint-test
(letfn [(defendpoint [form]
(let [node (-> form pr-str api/parse-string)]
(is-valid-node node)
(-> {:node node}
hooks.metabase.api.macros/defendpoint
:node
api/sexpr)))]
(are [form expected] (= expected
(defendpoint form))
'(api.macros/defendpoint :post "/" :- [:map [:collection_id :int]]
"Create a new [[Timeline]]."
[_route-params
_query-params
{:keys [icon], collection-id :collection_id, :as body} :- [:map
[:name ms/NonBlankString]
[:default {:optional true} [:maybe :boolean]]]]
(body icon)
(body collection-id))
'(do
api.macros/defendpoint
:post
"/"
(do
[:map [:collection_id :int]]
[:map
[:name ms/NonBlankString]
[:default {:optional true} [:maybe :boolean]]])
(clojure.core/let [_route-params {}
_query-params {}
{:keys [icon], collection-id :collection_id, :as body} {}]
(body icon)
(body collection-id)))
'(api.macros/defendpoint :post "/"
[_route-params
_query-params
body
request
respond
raise]
(try
(respond :x)
(catch Throwable e
(raise e))))
'(do
api.macros/defendpoint
:post
"/"
(do)
(clojure.core/let [_route-params {}
_query-params {}
body {}
request {}
respond (clojure.core/constantly nil)
raise (clojure.core/constantly nil)]
(try
(respond :x)
(catch Throwable e
(raise e))))))))

View File

@@ -1,19 +0,0 @@
(ns hooks.metabase.model-persistence.test-util-test
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.test :refer :all]
[hooks.metabase.model-persistence.test-util]))
(deftest ^:parallel with-persistence-enabled-test
(is (= '(clojure.core/let [persist-models! (clojure.core/fn [])]
(persist-models!)
:wow)
(as-> '(mt/with-persistence-enabled! [persist-models!]
(persist-models!)
:wow) <>
(pr-str <>)
(hooks/parse-string <>)
{:node <>}
(hooks.metabase.model-persistence.test-util/with-persistence-enabled! <>)
(:node <>)
(hooks/sexpr <>)))))

View File

@@ -1,34 +0,0 @@
(ns hooks.metabase.settings.models.setting-test
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.test :refer :all]
[hooks.metabase.settings.models.setting]))
#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(deftest ^:parallel defsetting-test
(let [node (-> '(defsetting active-users-count
(deferred-tru "Cached number of active users. Refreshed every 5 minutes.")
:visibility :admin
:type :integer
:default 0
:getter (fn []
(if-not ((requiring-resolve 'metabase.app-db.core/db-is-set-up?))
0
(cached-active-users-count))))
pr-str
hooks/parse-string)]
(is (= '(let [_ (deferred-tru "Cached number of active users. Refreshed every 5 minutes.")
_ {:default 0
:type :integer
:getter (fn []
(if-not ((requiring-resolve 'metabase.app-db.core/db-is-set-up?))
0
(cached-active-users-count)))
:visibility :admin}]
:active-users-count
(defn active-users-count "Docstring." [])
(defn active-users-count! "Docstring." [_value-or-nil]))
(-> {:node node, :ns 'hooks.metabase.settings.models.setting-test}
hooks.metabase.settings.models.setting/defsetting
:node
hooks/sexpr)))))

View File

@@ -1,33 +0,0 @@
(ns hooks.metabase.util.i18n-test
(:require [clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.string :as str]
[clojure.test :refer [deftest testing is are]]
[hooks.metabase.util.i18n]))
(defn- warnings
[form]
(binding [clj-kondo.impl.utils/*ctx* {:config {:linters {:metabase/validate-string-or-str-args-to-i18n {:level :warning}
:metabase/validate-escaped-single-quotes-in-i18n {:level :warning}}}
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(hooks.metabase.util.i18n/strict-apostrophes {:node (api/parse-string (pr-str form))})
(mapv :message @(:findings clj-kondo.impl.utils/*ctx*))))
(deftest ^:parallel strict-apostrophes-warns
(are [form] (= ["Format string contains invalid single quote usage. Use '' for literals or '{...}' for escaping."]
(warnings (quote form)))
(metabase.util.i18n/tru "this isn't good bob")
(metabase.util.i18n/tru "'this is not good either'")
(metabase.util.i18n/tru "''this isn't''")
(metabase.util.i18n/tru "nope you can not escape 'like {{0}} so {{1}}'")
(metabase.util.i18n/tru (str "it works" "when strings" "are concatenated'"))))
(deftest ^:parallel strict-apostrophes-doesnt-warn-on-good-ones
(are [form] (= []
(warnings (quote form)))
(metabase.util.i18n/tru "this isn''t bad")
(metabase.util.i18n/tru (str "not sure why you'" "'d do this" "... but ok"))
(metabase.util.i18n/tru "you can '{{0}}' do things like that")
(metabase.util.i18n/tru "or '{{ this or }}}}}}}}}}' that")))

View File

@@ -1,4 +1,4 @@
(ns hooks.metabase.util.log-test
(ns ^:mb/once hooks.metabase.util.log-test
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]

View File

@@ -13,8 +13,6 @@
"test"
"enterprise/backend"
"bin/build"
"bin/lint-migrations-file"
"bin/release-list"
"modules/drivers"
".clj-kondo/src"
".clj-kondo/test"
@@ -81,278 +79,261 @@
throttle.core/with-throttling [[:block 1]]
;; the rest of the stuff in this list is generated automatically based on `:style/indent` specs
;; by running [[dev.generate-cljfmt-config/specs]]... use that code to update this list
metabase-enterprise.cache.config-test/with-temp-persist-models [[:block 1]]
metabase-enterprise.impersonation.util-test/with-impersonations! [[:inner 0]]
metabase-enterprise.sandbox.test-util/with-gtaps! [[:inner 0]]
metabase-enterprise.sandbox.test-util/with-gtaps-for-user! [[:inner 0]]
metabase-enterprise.sandbox.test-util/with-user-attributes [[:block 2]]
metabase-enterprise.serialization.test-util/with-dbs [[:inner 0]]
metabase-enterprise.serialization.test-util/with-random-dump-dir [[:block 1]]
metabase-enterprise.serialization.test-util/with-world [[:block 0]]
metabase-enterprise.sso.integrations.jwt-test/with-users-with-email-deleted [[:block 1]]
metabase-enterprise.test/with-gtaps! [[:inner 0]]
metabase-enterprise.test/with-gtaps-for-user! [[:inner 0]]
metabase-enterprise.test/with-user-attributes [[:block 2]]
metabase.actions.actions-test/with-actions-test-data-and-actions-permissively-enabled [[:block 0]]
metabase.actions.test-util/with-actions [[:block 1]]
metabase.actions.test-util/with-actions-disabled [[:block 0]]
metabase.actions.test-util/with-actions-enabled [[:block 0]]
metabase.actions.test-util/with-actions-test-data [[:inner 0]]
metabase.actions.test-util/with-actions-test-data-and-actions-enabled [[:block 0]]
metabase.actions.test-util/with-actions-test-data-tables [[:block 1]]
metabase.actions.test-util/with-empty-db [[:inner 0]]
metabase.actions.test-util/with-temp-test-data [[:inner 0]]
metabase.api.common/check [[:default]]
metabase.api.common/define-routes [[:block 0]]
metabase.api.common/let-404 [[:block 1]]
metabase.app-db.core/with-application-db [[:inner 0]]
metabase.app-db.liquibase/with-liquibase [[:block 1]]
metabase.app-db.liquibase/with-scope-locked [[:block 1]]
metabase.app-db.schema-migrations-test.impl/test-migrations [[:block 2]]
metabase.cmd.copy/step [[:block 1]]
metabase.cmd.copy/with-connection-rollback-only [[:block 1]]
metabase.cmd.copy/with-disabled-db-constraints [[:block 2]]
metabase.collections.api-test/with-collection-hierarchy [[:block 1]]
metabase.collections.api-test/with-french-user-and-personal-collection [[:block 2]]
metabase.collections.api-test/with-some-children-of-collection [[:block 1]]
metabase.collections.models.collection-test/with-collection-hierarchy [[:block 1]]
metabase.collections.models.collection-test/with-current-user-perms-for-collections [[:block 1]]
metabase.collections.models.collection-test/with-personal-and-impersonal-collections [[:block 1]]
metabase.config/build-type-case [[:block 0]]
metabase.dashboards.models.dashboard-test/with-dash-in-collection [[:inner 0]]
metabase.driver-api.core/match [[:inner 0]]
metabase.driver-api.core/match-one [[:inner 0]]
metabase.driver-api.core/replace [[:inner 0]]
metabase.driver-api.core/replace-in [[:inner 0]]
metabase.driver.bigquery-cloud-sdk.query-processor/with-temporal-type [[:default]]
metabase.driver.druid.client/DELETE [[:default]]
metabase.driver.druid.client/GET [[:default]]
metabase.driver.druid.client/POST [[:default]]
metabase.driver.druid.query-processor-test/druid-query [[:block 0]]
metabase.driver.druid.query-processor-test/druid-query-returning-rows [[:block 0]]
metabase.driver.mongo.query-processor/mongo-let [[:block 1]]
metabase.driver.sql-jdbc.actions/with-jdbc-transaction [[:block 1]]
metabase.driver.sql-jdbc.connection/with-connection-spec-for-testing-connection [[:block 1]]
metabase.driver.sql-jdbc.execute.diagnostic/capturing-diagnostic-info [[:block 1]]
metabase.driver.sql.query-processor/apply-top-level-clause [[:default]]
metabase.driver/with-driver [[:block 1]]
metabase.embedding.api.embed-test/do-response-formats [[:block 1]]
metabase.embedding.api.embed-test/with-embedding-enabled-and-new-secret-key [[:block 0]]
metabase.embedding.api.embed-test/with-embedding-enabled-and-temp-card-referencing [[:block 3]]
metabase.embedding.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing [[:block 3]]
metabase.embedding.api.embed-test/with-new-secret-key [[:block 0]]
metabase.embedding.api.embed-test/with-temp-card [[:block 1]]
metabase.embedding.api.embed-test/with-temp-dashcard [[:block 1]]
metabase.embedding.api.preview-embed-test/with-embedding-enabled-and-new-secret-key [[:block 0]]
metabase.embedding.api.preview-embed-test/with-new-secret-key [[:block 0]]
metabase.lib.binning/with-binning [[:default]]
metabase.lib.core/with-binning [[:default]]
metabase.lib.core/with-join-alias [[:default]]
metabase.lib.core/with-join-conditions [[:default]]
metabase.lib.join/with-join-alias [[:default]]
metabase.lib.join/with-join-conditions [[:default]]
metabase.lib.test-util.macros/$ids [[:inner 0]]
metabase.lib.test-util.macros/mbql-5-query [[:inner 0]]
metabase.lib.test-util.macros/mbql-query [[:inner 0]]
metabase.lib.util.match/match [[:inner 0]]
metabase.lib.util.match/match-one [[:inner 0]]
metabase.lib.util.match/match-lite [[:inner 0]]
metabase.lib.util.match/match-lite-recursive [[:inner 0]]
metabase.lib.util.match/replace [[:inner 0]]
metabase.lib.util.match/replace-in [[:inner 0]]
metabase.models.interface/define-batched-hydration-method [[:inner 0]]
metabase.models.interface/define-simple-hydration-method [[:inner 0]]
metabase.parameters.chain-filter-test/with-clean-field-values-for-field [[:block 1]]
metabase.parameters.chain-filter-test/with-fk-field-to-field-remapping [[:block 0]]
metabase.parameters.chain-filter-test/with-human-readable-values-remapping [[:block 0]]
metabase.permissions.core/allow-changing-all-users-group-members [[:block 0]]
metabase.permissions.core/disable-perms-cache [[:block 0]]
metabase.public-sharing.api-test/with-sharing-enabled-and-temp-card-referencing [[:block 3]]
metabase.public-sharing.api-test/with-sharing-enabled-and-temp-dashcard-referencing [[:block 3]]
metabase.public-sharing.api-test/with-temp-public-card [[:block 1]]
metabase.public-sharing.api-test/with-temp-public-dashboard [[:block 1]]
metabase.public-sharing.api-test/with-temp-public-dashboard-and-card [[:block 1]]
metabase.pulse.api.alert-test/with-alert-in-collection [[:block 1]]
metabase.pulse.dashboard-subscription-test/with-link-card-fixture-for-dashboard [[:block 2]]
metabase.pulse.models.pulse-test/with-dashboard-subscription-in-collection [[:block 1]]
metabase.pulse.models.pulse-test/with-pulse-in-collection [[:inner 0]]
metabase.queries.api.card-test/with-cards-in-readable-collection [[:block 1]]
metabase.queries.api.card-test/with-cards-in-writeable-collection [[:block 1]]
metabase.queries.api.card-test/with-ordered-items [[:inner 0]]
metabase.queries.api.card-test/with-temp-native-card! [[:block 1]]
metabase.queries.api.card-test/with-temp-native-card-with-params! [[:block 1]]
metabase.query-processor-test.pipeline-queries-test/pmbql-query [[:block 1]]
metabase.query-processor-test.pipeline-queries-test/run-pmbql-query [[:block 1]]
metabase.query-processor.debug/debug> [[:block 0]]
metabase.query-processor.error-type/deferror [[:block 1]]
metabase.query-processor.middleware.cache-backend.interface/with-cached-results [[:block 4]]
metabase.query-processor.middleware.process-userland-query-test/with-query-execution [[:block 1]]
metabase.query-processor.store/cached [[:block 1]]
metabase.query-processor.store/with-metadata-provider [[:inner 0]]
metabase.query-processor.streaming/streaming-response [[:block 1]]
metabase.query-processor.test-util/format-rows-by [[:default]]
metabase.request.core/as-admin [[:block 0]]
metabase.request.core/with-current-request [[:inner 0]]
metabase.request.core/with-current-user [[:inner 0]]
metabase.request.core/with-limit-and-offset [[:inner 0]]
metabase.request.session/as-admin [[:block 0]]
metabase.request.session/with-current-user [[:inner 0]]
metabase.sample-data.impl-test/with-temp-sample-database-db [[:block 1]]
metabase.search.api-test/do-test-users [[:block 1]]
metabase.server.middleware.session/as-admin [[:block 0]]
metabase.server.middleware.session/with-current-user [[:inner 0]]
metabase.server.streaming-response-test/with-streaming-response-thread-pool [[:block 0]]
metabase.server.streaming-response-test/with-test-driver-db! [[:block 0]]
metabase.server.streaming-response/streaming-response [[:block 2]]
metabase.session.api/http-401-on-error [[:block 0]]
metabase.settings.core/define-multi-setting [[:inner 0]]
metabase.settings.core/defsetting [[:block 1]]
metabase.settings.models.setting.multi-setting/define-multi-setting [[:inner 0]]
metabase.settings.models.setting/defsetting [[:block 1]]
metabase.sync.fetch-metadata/log-if-error [[:block 1]]
metabase.sync.sync-metadata.fields-test/with-test-db [[:block 0]]
metabase.sync.util/do-with-start-and-finish-debug-logging [[:default]]
metabase.sync.util/sum-for [[:block 1]]
metabase.sync.util/sync-operation [[:block 3]]
metabase.sync.util/with-db-logging-disabled [[:default]]
metabase.sync.util/with-duplicate-ops-prevented [[:default]]
metabase.sync.util/with-emoji-progress-bar [[:block 1]]
metabase.sync.util/with-error-handling [[:block 1]]
metabase.sync.util/with-start-and-finish-logging [[:default]]
metabase.sync.util/with-start-and-finish-logging* [[:default]]
metabase.sync.util/with-sync-events [[:default]]
metabase.task-history.models.task-history/with-task-history [[:block 1]]
metabase.task.core/rerun-on-error [[:block 1]]
metabase.task.impl/rerun-on-error [[:block 1]]
metabase.test.data.datasets/test-driver [[:inner 0]]
metabase.test.data.datasets/test-drivers [[:inner 0]]
metabase.test.data.one-off-dbs/with-blank-db [[:block 0]]
metabase.test.data.one-off-dbs/with-blueberries-db [[:block 0]]
metabase.test.data.users/with-test-user [[:inner 0]]
metabase.test.data/$ids [[:inner 0]]
metabase.test.data/dataset [[:inner 0]]
metabase.test.data/mbql-query [[:inner 0]]
metabase.test.data/query [[:block 1]]
metabase.test.data/run-mbql-query [[:inner 0]]
metabase.test.data/with-empty-h2-app-db! [[:block 0]]
metabase.test.data/with-temp-copy-of-db [[:block 0]]
metabase.test.util.public-settings/with-additional-premium-features [[:block 1]]
metabase.test.util.public-settings/with-premium-features [[:block 1]]
metabase.test.util.thread-local/test-helpers-set-global-values! [[:block 0]]
metabase.test.util/discard-setting-changes [[:block 1]]
metabase.test.util/let-url [[:block 1]]
metabase.test.util/throw-if-called! [[:block 1]]
metabase.test.util/with-temp-scheduler [[:block 0]]
metabase.test.util/with-temp-vals-in-db [[:block 3]]
metabase.test.util/with-user-in-groups [[:inner 0]]
metabase.test/$ids [[:inner 0]]
metabase.test/as-admin [[:inner 0]]
metabase.test/dataset [[:inner 0]]
metabase.test/discard-setting-changes [[:block 1]]
metabase.test/format-rows-by [[:default]]
metabase.test/let-url [[:block 1]]
metabase.test/mbql-query [[:inner 0]]
metabase.test/query [[:block 1]]
metabase.test/run-mbql-query [[:inner 0]]
metabase.test/test-driver [[:inner 0]]
metabase.test/test-drivers [[:inner 0]]
metabase.test/test-helpers-set-global-values! [[:block 0]]
metabase.test/throw-if-called! [[:block 1]]
metabase.test/with-actions [[:block 1]]
metabase.test/with-actions-disabled [[:block 0]]
metabase.test/with-actions-enabled [[:block 0]]
metabase.test/with-actions-test-data [[:inner 0]]
metabase.test/with-actions-test-data-and-actions-enabled [[:block 0]]
metabase.test/with-actions-test-data-tables [[:block 1]]
metabase.test/with-additional-premium-features [[:block 1]]
metabase.test/with-current-user [[:inner 0]]
metabase.test/with-driver [[:block 1]]
metabase.test/with-empty-db [[:inner 0]]
metabase.test/with-empty-h2-app-db! [[:block 0]]
metabase.test/with-metadata-provider [[:inner 0]]
metabase.test/with-premium-features [[:block 1]]
metabase.test/with-temp [[:inner 0]]
metabase.test/with-temp-copy-of-db [[:block 0]]
metabase.test/with-temp-scheduler [[:block 0]]
metabase.test/with-temp-test-data [[:inner 0]]
metabase.test/with-temp-vals-in-db [[:block 3]]
metabase.test/with-test-user [[:inner 0]]
metabase.test/with-user-in-groups [[:inner 0]]
metabase.timeseries-query-processor-test.util/test-timeseries-drivers [[:block 0]]
metabase.timeseries-query-processor-test/run-mbql-query [[:inner 0]]
metabase.upload.impl-test/with-upload-table! [[:inner 0]]
metabase.upload.types/with-currency [[:default]]
metabase.upload.types/with-parens [[:default]]
metabase.util/for-map [[:block 1]]
metabase.util.async/cancelable-thread [[:block 0]]
metabase.util.date-2/with-time-zone-same-instant [[:default]]
metabase.util.encryption-test/with-secret-key [[:block 1]]
metabase.util.honey-sql-2/with-database-type-info [[:default]]
metabase.util.i18n/deferred-trs [[:default]]
metabase.util.i18n/deferred-tru [[:default]]
metabase.util.i18n/trs [[:default]]
metabase.util.i18n/trsn [[:default]]
metabase.util.i18n/tru [[:default]]
metabase.util.i18n/trun [[:default]]
metabase.util.jvm/auto-retry [[:block 1]]
metabase.util.jvm/varargs [[:block 1]]
metabase.util.jvm/with-us-locale [[:block 0]]
metabase.util.malli/disable-enforcement [[:block 0]]
metabase.util.malli/with [[:default]]
metabase.util.malli/with-api-error-message [[:default]]
metabase.util.namespaces/import-fns [[:default]]
metabase.util.queue-test/await-test-while [[:block 1]]
metabase.util/auto-retry [[:block 1]]
metabase.util/case-enum [[:block 1]]
metabase.util/ignore-exceptions [[:block 0]]
metabase.util/or-with [[:block 1]]
metabase.util/profile [[:block 1]]
metabase.util/prog1 [[:inner 0]]
metabase.util/varargs [[:inner 0]]
metabase.util/with-us-locale [[:block 0]]
metabuild-common.core/exit-when-finished-nonzero-on-exception [[:block 0]]
metabuild-common.core/step [[:block 1]]
metabuild-common.entrypoint/exit-when-finished-nonzero-on-exception [[:block 0]]
metabuild-common.steps/step [[:block 1]]
methodical.core/defmethod [[:inner 0]]
methodical.core/defmulti [[:inner 0]]
methodical.core/with-dispatcher [[:default]]
methodical.core/with-method-table [[:default]]
methodical.core/with-prefers [[:default]]
methodical.interface/with-dispatcher [[:default]]
methodical.interface/with-method-table [[:default]]
methodical.interface/with-prefers [[:default]]
methodical.macros/defmethod [[:inner 0]]
methodical.macros/defmulti [[:inner 0]]
saml20-clj.sp.response/validate-confirmation-datas [[:block 1]]
toucan2.connection/with-transaction [[:block 1]]
toucan2.core/build [[:block 0]]
toucan2.core/compile [[:block 0]]
toucan2.core/debug [[:block 0]]
toucan2.core/define-after-insert [[:inner 0]]
toucan2.core/define-after-select [[:inner 0]]
toucan2.core/define-after-update [[:inner 0]]
toucan2.core/define-before-delete [[:inner 0]]
toucan2.core/define-before-insert [[:inner 0]]
toucan2.core/define-before-select [[:inner 0]]
toucan2.core/define-default-fields [[:inner 0]]
toucan2.core/define-named-query [[:block 1]]
toucan2.core/deftransforms [[:block 1]]
toucan2.core/with-transaction [[:block 1]]
toucan2.tools.after-insert/define-after-insert [[:inner 0]]
toucan2.tools.after-select/define-after-select [[:inner 0]]
toucan2.tools.after-update/define-after-update [[:inner 0]]
toucan2.tools.after/define-after-impl [[:default]]
toucan2.tools.before-delete/define-before-delete [[:inner 0]]
toucan2.tools.before-insert/define-before-insert [[:inner 0]]
toucan2.tools.before-select/define-before-select [[:inner 0]]
toucan2.tools.compile/build [[:block 0]]
toucan2.tools.compile/compile [[:block 0]]
toucan2.tools.compile/resolved [[:block 0]]
toucan2.tools.debug/debug [[:block 0]]
toucan2.tools.default-fields/define-default-fields [[:inner 0]]
toucan2.tools.named-query/define-named-query [[:block 1]]
toucan2.tools.simple-out-transform/define-out-transform [[:inner 0]]
toucan2.tools.transformed/deftransforms [[:block 1]]
toucan2.tools.with-temp/with-temp [[:inner 0]]
toucan2.util/try-with-error-context [[:inner 0]]}}
metabase-enterprise.advanced-permissions.api.util-test/with-impersonations! [[:inner 0]]
metabase-enterprise.cache.config-test/with-temp-persist-models [[:block 1]]
metabase-enterprise.sandbox.test-util/with-gtaps! [[:inner 0]]
metabase-enterprise.sandbox.test-util/with-gtaps-for-user! [[:inner 0]]
metabase-enterprise.sandbox.test-util/with-user-attributes [[:block 2]]
metabase-enterprise.serialization.test-util/with-dbs [[:inner 0]]
metabase-enterprise.serialization.test-util/with-random-dump-dir [[:block 1]]
metabase-enterprise.serialization.test-util/with-world [[:block 0]]
metabase-enterprise.sso.integrations.jwt-test/with-users-with-email-deleted [[:block 1]]
metabase-enterprise.test/with-gtaps! [[:inner 0]]
metabase-enterprise.test/with-gtaps-for-user! [[:inner 0]]
metabase-enterprise.test/with-user-attributes [[:block 2]]
metabase.actions-test/with-actions-test-data-and-actions-permissively-enabled [[:block 0]]
metabase.actions.test-util/with-actions [[:block 1]]
metabase.actions.test-util/with-actions-disabled [[:block 0]]
metabase.actions.test-util/with-actions-enabled [[:block 0]]
metabase.actions.test-util/with-actions-test-data [[:inner 0]]
metabase.actions.test-util/with-actions-test-data-and-actions-enabled [[:block 0]]
metabase.actions.test-util/with-actions-test-data-tables [[:block 1]]
metabase.actions.test-util/with-empty-db [[:inner 0]]
metabase.actions.test-util/with-temp-test-data [[:inner 0]]
metabase.api.alert-test/with-alert-in-collection [[:block 1]]
metabase.api.card-test/with-cards-in-readable-collection [[:block 1]]
metabase.api.card-test/with-cards-in-writeable-collection [[:block 1]]
metabase.api.card-test/with-ordered-items [[:inner 0]]
metabase.api.card-test/with-temp-native-card! [[:block 1]]
metabase.api.card-test/with-temp-native-card-with-params! [[:block 1]]
metabase.api.collection-test/with-collection-hierarchy [[:block 1]]
metabase.api.collection-test/with-french-user-and-personal-collection [[:block 2]]
metabase.api.collection-test/with-some-children-of-collection [[:block 1]]
metabase.api.common/check [[:default]]
metabase.api.common/define-routes [[:block 0]]
metabase.api.common/let-404 [[:block 1]]
metabase.api.common.internal/auto-coerce [[:block 1]]
metabase.api.common.internal/auto-parse [[:block 1]]
metabase.api.common.internal-test/no-route-regexes [[:block 0]]
metabase.api.embed-test/do-response-formats [[:block 1]]
metabase.api.embed-test/with-embedding-enabled-and-new-secret-key [[:block 0]]
metabase.api.embed-test/with-embedding-enabled-and-temp-card-referencing [[:block 3]]
metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing [[:block 3]]
metabase.api.embed-test/with-new-secret-key [[:block 0]]
metabase.api.embed-test/with-temp-card [[:block 1]]
metabase.api.embed-test/with-temp-dashcard [[:block 1]]
metabase.api.preview-embed-test/with-embedding-enabled-and-new-secret-key [[:block 0]]
metabase.api.preview-embed-test/with-new-secret-key [[:block 0]]
metabase.api.public-test/with-sharing-enabled-and-temp-card-referencing [[:block 3]]
metabase.api.public-test/with-sharing-enabled-and-temp-dashcard-referencing [[:block 3]]
metabase.api.public-test/with-temp-public-card [[:block 1]]
metabase.api.public-test/with-temp-public-dashboard [[:block 1]]
metabase.api.public-test/with-temp-public-dashboard-and-card [[:block 1]]
metabase.api.search-test/do-test-users [[:block 1]]
metabase.api.session/http-401-on-error [[:block 0]]
metabase.async.streaming-response/streaming-response [[:block 2]]
metabase.async.streaming-response-test/with-streaming-response-thread-pool [[:block 0]]
metabase.async.streaming-response-test/with-test-driver-db! [[:block 0]]
metabase.async.util/cancelable-thread [[:block 0]]
metabase.cmd.copy/step [[:block 1]]
metabase.cmd.copy/with-connection-rollback-only [[:block 1]]
metabase.cmd.copy/with-disabled-db-constraints [[:block 2]]
metabase.config/build-type-case [[:block 0]]
metabase.dashboard-subscription-test/with-link-card-fixture-for-dashboard [[:block 2]]
metabase.db.liquibase/with-liquibase [[:block 1]]
metabase.db.liquibase/with-scope-locked [[:block 1]]
metabase.db.schema-migrations-test.impl/test-migrations [[:block 2]]
metabase.db/with-application-db [[:inner 0]]
metabase.driver.bigquery-cloud-sdk.query-processor/with-temporal-type [[:default]]
metabase.driver.druid.client/DELETE [[:default]]
metabase.driver.druid.client/GET [[:default]]
metabase.driver.druid.client/POST [[:default]]
metabase.driver.druid.query-processor-test/druid-query [[:block 0]]
metabase.driver.druid.query-processor-test/druid-query-returning-rows [[:block 0]]
metabase.driver.mongo.query-processor/mongo-let [[:block 1]]
metabase.driver.sql-jdbc.actions/with-jdbc-transaction [[:block 1]]
metabase.driver.sql-jdbc.connection/with-connection-spec-for-testing-connection [[:block 1]]
metabase.driver.sql-jdbc.execute.diagnostic/capturing-diagnostic-info [[:block 1]]
metabase.driver.sql.query-processor/apply-top-level-clause [[:default]]
metabase.driver/with-driver [[:block 1]]
metabase.lib.binning/with-binning [[:default]]
metabase.lib.core/with-binning [[:default]]
metabase.lib.core/with-join-alias [[:default]]
metabase.lib.core/with-join-conditions [[:default]]
metabase.lib.join/with-join-alias [[:default]]
metabase.lib.join/with-join-conditions [[:default]]
metabase.lib.test-util.macros/$ids [[:inner 0]]
metabase.lib.test-util.macros/mbql-query [[:inner 0]]
metabase.lib.util.match/match [[:inner 0]]
metabase.lib.util.match/match-one [[:inner 0]]
metabase.lib.util.match/replace [[:inner 0]]
metabase.lib.util.match/replace-in [[:inner 0]]
metabase.models.collection-test/with-collection-hierarchy [[:block 1]]
metabase.models.collection-test/with-current-user-perms-for-collections [[:block 1]]
metabase.models.collection-test/with-personal-and-impersonal-collections [[:block 1]]
metabase.models.dashboard-test/with-dash-in-collection [[:inner 0]]
metabase.models.interface/define-batched-hydration-method [[:inner 0]]
metabase.models.interface/define-simple-hydration-method [[:inner 0]]
metabase.models.params.chain-filter-test/with-clean-field-values-for-field [[:block 1]]
metabase.models.params.chain-filter-test/with-fk-field-to-field-remapping [[:block 0]]
metabase.models.params.chain-filter-test/with-human-readable-values-remapping [[:block 0]]
metabase.models.pulse-test/with-dashboard-subscription-in-collection [[:block 1]]
metabase.models.pulse-test/with-pulse-in-collection [[:inner 0]]
metabase.models.setting/defsetting [[:block 1]]
metabase.models.setting.multi-setting/define-multi-setting [[:inner 0]]
metabase.models.task-history/with-task-history [[:block 1]]
metabase.query-processor-test.pipeline-queries-test/pmbql-query [[:block 1]]
metabase.query-processor-test.pipeline-queries-test/run-pmbql-query [[:block 1]]
metabase.query-processor.debug/debug> [[:block 0]]
metabase.query-processor.error-type/deferror [[:block 1]]
metabase.query-processor.middleware.cache-backend.interface/with-cached-results [[:block 4]]
metabase.query-processor.middleware.process-userland-query-test/with-query-execution [[:block 1]]
metabase.query-processor.store/cached [[:block 1]]
metabase.query-processor.store/with-metadata-provider [[:inner 0]]
metabase.query-processor.streaming/streaming-response [[:block 1]]
metabase.query-processor.test-util/format-rows-by [[:default]]
metabase.sample-data-test/with-temp-sample-database-db [[:block 1]]
metabase.server.middleware.session/as-admin [[:block 0]]
metabase.server.middleware.session/with-current-user [[:inner 0]]
metabase.sync.fetch-metadata/log-if-error [[:block 1]]
metabase.sync.sync-metadata.fields-test/with-test-db [[:block 0]]
metabase.sync.util/do-with-start-and-finish-debug-logging [[:default]]
metabase.sync.util/sum-for [[:block 1]]
metabase.sync.util/sync-operation [[:block 3]]
metabase.sync.util/with-db-logging-disabled [[:default]]
metabase.sync.util/with-duplicate-ops-prevented [[:default]]
metabase.sync.util/with-emoji-progress-bar [[:block 1]]
metabase.sync.util/with-error-handling [[:block 1]]
metabase.sync.util/with-start-and-finish-logging [[:default]]
metabase.sync.util/with-start-and-finish-logging* [[:default]]
metabase.sync.util/with-sync-events [[:default]]
metabase.test/$ids [[:inner 0]]
metabase.test/as-admin [[:inner 0]]
metabase.test/dataset [[:inner 0]]
metabase.test/discard-setting-changes [[:block 1]]
metabase.test/format-rows-by [[:default]]
metabase.test/let-url [[:block 1]]
metabase.test/mbql-query [[:inner 0]]
metabase.test/native-query [[:block 0]]
metabase.test/query [[:block 1]]
metabase.test/run-mbql-query [[:inner 0]]
metabase.test/test-driver [[:inner 0]]
metabase.test/test-drivers [[:inner 0]]
metabase.test/test-helpers-set-global-values! [[:block 0]]
metabase.test/throw-if-called! [[:block 1]]
metabase.test/with-actions [[:block 1]]
metabase.test/with-actions-disabled [[:block 0]]
metabase.test/with-actions-enabled [[:block 0]]
metabase.test/with-actions-test-data [[:inner 0]]
metabase.test/with-actions-test-data-and-actions-enabled [[:block 0]]
metabase.test/with-actions-test-data-tables [[:block 1]]
metabase.test/with-additional-premium-features [[:block 1]]
metabase.test/with-current-user [[:inner 0]]
metabase.test/with-driver [[:block 1]]
metabase.test/with-empty-db [[:inner 0]]
metabase.test/with-empty-h2-app-db [[:block 0]]
metabase.test/with-metadata-provider [[:inner 0]]
metabase.test/with-premium-features [[:block 1]]
metabase.test/with-temp [[:inner 0]]
metabase.test/with-temp-copy-of-db [[:block 0]]
metabase.test/with-temp-scheduler [[:block 0]]
metabase.test/with-temp-test-data [[:inner 0]]
metabase.test/with-temp-vals-in-db [[:block 3]]
metabase.test/with-test-user [[:inner 0]]
metabase.test/with-user-in-groups [[:inner 0]]
metabase.test.data/$ids [[:inner 0]]
metabase.test.data/dataset [[:inner 0]]
metabase.test.data/mbql-query [[:inner 0]]
metabase.test.data/native-query [[:block 0]]
metabase.test.data/query [[:block 1]]
metabase.test.data/run-mbql-query [[:inner 0]]
metabase.test.data/with-empty-h2-app-db [[:block 0]]
metabase.test.data/with-temp-copy-of-db [[:block 0]]
metabase.test.data.datasets/test-driver [[:inner 0]]
metabase.test.data.datasets/test-drivers [[:inner 0]]
metabase.test.data.one-off-dbs/with-blank-db [[:block 0]]
metabase.test.data.one-off-dbs/with-blueberries-db [[:block 0]]
metabase.test.data.users/with-test-user [[:inner 0]]
metabase.test.util/discard-setting-changes [[:block 1]]
metabase.test.util/let-url [[:block 1]]
metabase.test.util/throw-if-called! [[:block 1]]
metabase.test.util/with-temp-scheduler [[:block 0]]
metabase.test.util/with-temp-vals-in-db [[:block 3]]
metabase.test.util/with-user-in-groups [[:inner 0]]
metabase.test.util.public-settings/with-additional-premium-features [[:block 1]]
metabase.test.util.public-settings/with-premium-features [[:block 1]]
metabase.test.util.thread-local/test-helpers-set-global-values! [[:block 0]]
metabase.timeseries-query-processor-test.util/test-timeseries-drivers [[:block 0]]
metabase.timeseries-query-processor-test/run-mbql-query [[:inner 0]]
metabase.upload-test/with-upload-table! [[:inner 0]]
metabase.upload.types/with-currency [[:default]]
metabase.upload.types/with-parens [[:default]]
metabase.util/auto-retry [[:block 1]]
metabase.util/ignore-exceptions [[:block 0]]
metabase.util/or-with [[:block 1]]
metabase.util/profile [[:block 1]]
metabase.util/prog1 [[:inner 0]]
metabase.util/varargs [[:inner 0]]
metabase.util/with-us-locale [[:block 0]]
metabase.util.date-2/with-time-zone-same-instant [[:default]]
metabase.util.encryption-test/with-secret-key [[:block 1]]
metabase.util.honey-sql-2/with-database-type-info [[:default]]
metabase.util.i18n/deferred-trs [[:default]]
metabase.util.i18n/deferred-tru [[:default]]
metabase.util.i18n/trs [[:default]]
metabase.util.i18n/trsn [[:default]]
metabase.util.i18n/tru [[:default]]
metabase.util.i18n/trun [[:default]]
metabase.util.jvm/auto-retry [[:block 1]]
metabase.util.jvm/varargs [[:block 1]]
metabase.util.jvm/with-us-locale [[:block 0]]
metabase.util.malli/disable-enforcement [[:block 0]]
metabase.util.malli/with [[:default]]
metabase.util.malli/with-api-error-message [[:default]]
metabase.util.namespaces/import-fns [[:default]]
metabuild-common.core/exit-when-finished-nonzero-on-exception [[:block 0]]
metabuild-common.core/step [[:block 1]]
metabuild-common.entrypoint/exit-when-finished-nonzero-on-exception [[:block 0]]
metabuild-common.steps/step [[:block 1]]
methodical.core/defmethod [[:inner 0]]
methodical.core/defmulti [[:inner 0]]
methodical.core/with-dispatcher [[:default]]
methodical.core/with-method-table [[:default]]
methodical.core/with-prefers [[:default]]
methodical.interface/with-dispatcher [[:default]]
methodical.interface/with-method-table [[:default]]
methodical.interface/with-prefers [[:default]]
methodical.macros/defmethod [[:inner 0]]
methodical.macros/defmulti [[:inner 0]]
saml20-clj.sp.response/validate-confirmation-datas [[:block 1]]
toucan2.connection/with-transaction [[:block 1]]
toucan2.core/build [[:block 0]]
toucan2.core/compile [[:block 0]]
toucan2.core/debug [[:block 0]]
toucan2.core/define-after-insert [[:inner 0]]
toucan2.core/define-after-select [[:inner 0]]
toucan2.core/define-after-update [[:inner 0]]
toucan2.core/define-before-delete [[:inner 0]]
toucan2.core/define-before-insert [[:inner 0]]
toucan2.core/define-before-select [[:inner 0]]
toucan2.core/define-default-fields [[:inner 0]]
toucan2.core/define-named-query [[:block 1]]
toucan2.core/deftransforms [[:block 1]]
toucan2.core/with-transaction [[:block 1]]
toucan2.tools.after/define-after-impl [[:default]]
toucan2.tools.after-insert/define-after-insert [[:inner 0]]
toucan2.tools.after-select/define-after-select [[:inner 0]]
toucan2.tools.after-update/define-after-update [[:inner 0]]
toucan2.tools.before-delete/define-before-delete [[:inner 0]]
toucan2.tools.before-insert/define-before-insert [[:inner 0]]
toucan2.tools.before-select/define-before-select [[:inner 0]]
toucan2.tools.compile/build [[:block 0]]
toucan2.tools.compile/compile [[:block 0]]
toucan2.tools.compile/resolved [[:block 0]]
toucan2.tools.debug/debug [[:block 0]]
toucan2.tools.default-fields/define-default-fields [[:inner 0]]
toucan2.tools.named-query/define-named-query [[:block 1]]
toucan2.tools.simple-out-transform/define-out-transform [[:inner 0]]
toucan2.tools.transformed/deftransforms [[:block 1]]
toucan2.tools.with-temp/with-temp [[:inner 0]]
toucan2.util/try-with-error-context [[:inner 0]]}}

View File

@@ -1,11 +1,11 @@
FROM mcr.microsoft.com/vscode/devcontainers/java:21
FROM mcr.microsoft.com/vscode/devcontainers/java:11
# Set up nodesource, install node, yarn, fontconfig for static viz, rlwrap for dev ergonomics
RUN ( curl -fsSL https://deb.nodesource.com/setup_22.x | bash ) \
RUN ( curl -fsSL https://deb.nodesource.com/setup_18.x | bash ) \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com \
&& apt-get update && apt-get -y install --no-install-recommends nodejs yarn rlwrap fontconfig
# install Clojure
RUN curl https://download.clojure.org/install/linux-install-1.12.0.1488.sh | bash
RUN curl https://download.clojure.org/install/linux-install-1.11.1.1262.sh | bash

View File

@@ -20,8 +20,13 @@
(clojure-mode
;; Specify which arg is the docstring for certain macros
;; (Add more as needed)
(eval . (put 'defendpoint-schema 'clojure-doc-string-elt 3))
(eval . (put 'defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'defendpoint-async 'clojure-doc-string-elt 3))
(eval . (put 'define-premium-feature 'clojure-doc-string-elt 2))
(eval . (put 'api.macros/defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'api/defendpoint-schema 'clojure-doc-string-elt 3))
(eval . (put 'api/defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'api/defendpoint-async 'clojure-doc-string-elt 3))
(eval . (put 'defsetting 'clojure-doc-string-elt 2))
(eval . (put 'setting/defsetting 'clojure-doc-string-elt 2))
(eval . (put 's/defn 'clojure-doc-string-elt 2))

View File

@@ -1,20 +1,13 @@
/* eslint-disable import/no-commonjs */
/* eslint-disable no-undef */
const path = require("path");
// `postcss-modules` lints css modules class names, but it currently crashes
// eslint on vscode. If you use webstorm or want to run the lint for the cli, you
// can use this flag to enable it. This is set to true in CI
const shouldLintCssModules =
process.env.LINT_CSS_MODULES === "true" || process.env.CI;
const plugins = ["react", "no-only-tests", "ttag", "i18next"];
if (shouldLintCssModules) {
plugins.push("postcss-modules");
}
module.exports = {
ignorePatterns: ["!.storybook"],
rules: {
strict: [2, "never"],
"no-undef": 2,
@@ -24,14 +17,11 @@ module.exports = {
{
vars: "all",
args: "none",
varsIgnorePattern: "^_.+$",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"no-empty": [1, { allowEmptyCatch: true }],
// Note: adding this rule to a eslint config file in a subfolder will remove
// *not* carry over the restricted imports from parent folders, you will
// need to copy them over
"no-restricted-imports": [
"error",
{
@@ -49,7 +39,6 @@ module.exports = {
],
curly: [1, "all"],
eqeqeq: [1, "smart"],
"import/no-duplicates": ["warn", { considerQueryString: true }],
"import/no-default-export": 2,
"import/no-named-as-default": 0,
"import/no-commonjs": 1,
@@ -119,10 +108,11 @@ module.exports = {
"When",
"Then",
"describeWithSnowplow",
"describeEE",
],
},
],
complexity: ["error", { max: 55 }],
complexity: ["error", { max: 54 }],
...(shouldLintCssModules
? {
"postcss-modules/no-undef-class": "error",
@@ -142,7 +132,7 @@ module.exports = {
"jest/globals": true,
},
parser: "babel-eslint",
plugins,
plugins: ["react", "no-only-tests", "postcss-modules"],
extends: [
"eslint:recommended",
"plugin:react/recommended",
@@ -153,13 +143,11 @@ module.exports = {
"plugin:import/typescript",
"plugin:depend/recommended",
"plugin:storybook/recommended",
"plugin:i18next/recommended",
],
settings: {
"import/internal-regex": "^metabase/|^metabase-lib/",
"import/resolver": {
webpack: {
config: path.resolve(__dirname, "./rspack.main.config.js"),
typescript: true,
},
},
@@ -180,9 +168,7 @@ module.exports = {
{
files: ["*.js", "*.jsx", "*.ts", "*.tsx"],
rules: {
"jtag-missing-key": "error",
"no-unconditional-metabase-links-render": "error",
"no-color-literals": "error",
"no-literal-metabase-strings": "error",
"depend/ban-dependencies": [
"error",
@@ -202,40 +188,17 @@ module.exports = {
"*.unit.spec.*",
"frontend/src/metabase/admin/**/*",
"frontend/src/metabase/setup/**/*",
"enterprise/frontend/src/metabase-enterprise/whitelabel/**/*",
"frontend/lint/**/*",
"*.stories.*",
"**/.storybook/*",
"stories-data.*",
"e2e/**/*",
"**/tests/*",
"release/**/*",
"rspack.config.js",
"rspack.main.config.js",
"rspack.embedding-sdk-package.config.js",
"rspack.embedding-sdk-bundle.config.js",
],
rules: {
"no-color-literals": "off",
"no-unconditional-metabase-links-render": "off",
"no-literal-metabase-strings": "off",
},
},
{
files: [
"*.unit.spec.*",
"frontend/lint/**/*",
"*.stories.*",
"stories-data.*",
"e2e/**/*",
"**/tests/*",
"release/**/*",
"rspack.main.config.js",
],
rules: {
"i18next/no-literal-string": "off",
},
},
{
extends: ["plugin:@typescript-eslint/recommended"],
files: ["*.ts", "*.tsx"],
@@ -257,10 +220,10 @@ module.exports = {
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_.+$",
varsIgnorePattern: "^_.+$",
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
destructuredArrayIgnorePattern: "^_.+$",
destructuredArrayIgnorePattern: "^_",
},
],
// This was introduced in 6.0.0
@@ -283,13 +246,6 @@ module.exports = {
],
rules: {
"jest/valid-title": ["error", { ignoreTypeOfDescribeName: true }],
"jest/expect-expect": [
"error",
{
assertFunctionNames: ["expect*", "assert*"],
additionalTestBlockFunctions: [],
},
],
},
},
{
@@ -320,32 +276,13 @@ module.exports = {
message:
"You may not use base colors in the application, use semantic colors instead. (see colors.module.css)",
},
{
selector:
"CallExpression[callee.property.name='legacyQuery'] > ObjectExpression > Property[key.name='useStructuredQuery'][value.value=true]",
message: "StructuredQuery usage is forbidden. Use MLv2",
},
],
},
},
{
files: ["frontend/src/metabase/query_builder/**/*"],
rules: {
"import/no-cycle": "error",
},
},
{
files: ["docs/**/snippets/**/*.{ts,tsx,js,jsx}"],
rules: {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"import/no-commonjs": "off",
"import/no-default-export": "off",
"import/order": "off",
"import/no-unresolved": "off",
"no-color-literals": "off",
},
},
{
files: ["frontend/build/**/*.js"],
rules: {
"import/no-commonjs": "off",
},
},
],
};

272
.github/CODEOWNERS vendored
View File

@@ -1,266 +1,12 @@
# Before changing this file, make sure you have read how we use it:
# https://www.notion.so/metabase/Pull-Request-Code-Review-Guide-374f05df889748b69d67af753f9bc9b8?pvs=4#36550c04ceab40b5a8b8bee6264b090c
enterprise/frontend/src/embedding-sdk-package @metabase/embedding
enterprise/frontend/src/embedding-sdk-bundle @metabase/embedding
enterprise/frontend/src/embedding-sdk-shared @metabase/embedding
frontend/src/metabase/embedding-sdk @metabase/embedding
frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion @metabase/embedding
frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard @metabase/embedding
frontend/src/metabase/ui @metabase/core-frontend-ux-west
# snowplow/* @metabase/data
src/metabase/analytics/prometheus.clj @metabase/cloud-ops
.github @metabase/devexp
.clj-kondo @metabase/devexp
deps.edn @metabase/backend-developers
docs @metabase/tech-writers
docs/developers-guide # exclude from tech-writer ownership
#
# Backend modules <=> teams that own them
#
# modules/drivers @metabase/drivers
src/metabase/driver/sql_jdbc/actions.clj @metabase/core-ux-east
test/metabase/driver/sql_jdbc/actions_test.clj @metabase/core-ux-east
# enterprise/backend/src/metabase_enterprise/advanced_config @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/advanced_config @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/advanced_permissions @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/advanced_permissions @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/airgap @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/airgap @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/api @metabase/devexp
# enterprise/backend/test/metabase_enterprise/api @metabase/devexp
# enterprise/backend/src/metabase_enterprise/audit_app @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/audit_app @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/auth_provider @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/auth_provider @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/billing @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/billing @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/cache @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/cache @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/content_verification @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/content_verification @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/core @metabase/devexp
# enterprise/backend/test/metabase_enterprise/core @metabase/devexp
# enterprise/backend/src/metabase_enterprise/dashboard_subscription_filters @metabase/core-ux-east
# enterprise/backend/test/metabase_enterprise/dashboard_subscription_filters @metabase/core-ux-east
# enterprise/backend/src/metabase_enterprise/enhancements @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/enhancements @metabase/core-backend-admin-webapp
# # enterprise/backend/src/metabase_enterprise/llm
# # enterprise/backend/test/metabase_enterprise/llm
# enterprise/backend/src/metabase_enterprise/query_reference_validation @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/query_reference_validation @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/sandbox @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/sandbox @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/scim @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/scim @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/search ...
# enterprise/backend/test/metabase_enterprise/search ...
# enterprise/backend/src/metabase_enterprise/serialization @metabase/core-ux-east
# enterprise/backend/test/metabase_enterprise/serialization @metabase/core-ux-east
# enterprise/backend/src/metabase_enterprise/snippet_collections @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/snippet_collections @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/sso @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/sso @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/stale @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/stale @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/stats @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/stats @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/task @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/task @metabase/core-backend-admin-webapp
# enterprise/backend/src/metabase_enterprise/upload_management @metabase/core-backend-admin-webapp
# enterprise/backend/test/metabase_enterprise/upload_management @metabase/core-backend-admin-webapp
src/metabase/actions @metabase/core-ux-east
test/metabase/actions @metabase/core-ux-east
# src/metabase/activity_feed @metabase/core-backend-admin-webapp
# test/metabase/activity_feed @metabase/core-backend-admin-webapp
# src/metabase/analytics @metabase/core-backend-admin-webapp
# test/metabase/analytics @metabase/core-backend-admin-webapp
# src/metabase/analyze @metabase/drivers
# test/metabase/analyze @metabase/drivers
# src/metabase/api @metabase/devexp
# test/metabase/api @metabase/devexp
# src/metabase/audit @metabase/core-backend-admin-webapp
# test/metabase/audit @metabase/core-backend-admin-webapp
# src/metabase/auth_provider @metabase/core-backend-admin-webapp
# test/metabase/auth_provider @metabase/core-backend-admin-webapp
# src/metabase/bookmarks @metabase/core-backend-admin-webapp
# test/metabase/bookmarks @metabase/core-backend-admin-webapp
# src/metabase/cmd @metabase/devexp
# test/metabase/cmd @metabase/devexp
# src/metabase/channel @metabase/core-ux-east
# test/metabase/channel @metabase/core-ux-east
# src/metabase/cloud_migration ...
# test/metabase/cloud_migration ...
# src/metabase/cmd @metabase/devexp
# test/metabase/cmd @metabase/devexp
# src/metabase/config @metabase/devexp
# test/metabase/config @metabase/devexp
# src/metabase/core @metabase/devexp
# test/metabase/core @metabase/devexp
# src/metabase/db @metabase/core-backend-admin-webapp
# test/metabase/db @metabase/core-backend-admin-webapp
# src/metabase/driver @metabase/drivers
# test/metabase/driver @metabase/drivers
# src/metabase/eid_translation @metabase/core-backend-admin-webapp
# test/metabase/eid_translation @metabase/core-backend-admin-webapp
# src/metabase/embed @metabase/embedding
# test/metabase/embed @metabase/embedding
# src/metabase/events @metabase/devexp
# test/metabase/events @metabase/devexp
# src/metabase/formatter @metabase/core-backend-querying
# test/metabase/formatter @metabase/core-backend-querying
# src/metabase/indexed_entities @metabase/core-backend-querying
# test/metabase/indexed_entities @metabase/core-backend-querying
# src/metabase/integrations ...
# test/metabase/integrations ...
# src/metabase/legacy_mbql @metabase/core-backend-querying
# test/metabase/legacy_mbql @metabase/core-backend-querying
# src/metabase/lib @metabase/core-backend-querying
# test/metabase/lib @metabase/core-backend-querying
# src/metabase/logger @metabase/devexp
# test/metabase/logger @metabase/devexp
# src/metabase/login_history @metabase/core-backend-admin-webapp
# test/metabase/login_history @metabase/core-backend-admin-webapp
# src/metabase/model_persistence @metabase/core-backend-querying
# test/metabase/model_persistence @metabase/core-backend-querying
# src/metabase/models @metabase/devexp
# test/metabase/models @metabase/devexp
# src/metabase/moderation @metabase/core-backend-admin-webapp
# test/metabase/moderation @metabase/core-backend-admin-webapp
# src/metabase/notification @metabase/core-ux-east
# test/metabase/notification @metabase/core-ux-east
# src/metabase/permissions @metabase/core-backend-admin-webapp
# test/metabase/permissions @metabase/core-backend-admin-webapp
# src/metabase/plugins @metabase/devexp
# test/metabase/plugins @metabase/devexp
# src/metabase/premium_features @metabase/core-backend-admin-webapp
# test/metabase/premium_features @metabase/core-backend-admin-webapp
# src/metabase/public_settings @metabase/core-backend-admin-webapp
# test/metabase/public_settings @metabase/core-backend-admin-webapp
# src/metabase/public_sharing @metabase/core-backend-admin-webapp
# test/metabase/public_sharing @metabase/core-backend-admin-webapp
# src/metabase/pulse @metabase/core-ux-east
# test/metabase/pulse @metabase/core-ux-east
# src/metabase/query_analysis @metabase/core-backend-querying
# test/metabase/query_analysis @metabase/core-backend-querying
# src/metabase/query_processor @metabase/core-backend-querying
# test/metabase/query_processor @metabase/core-backend-querying
# src/metabase/request @metabase/devexp
# test/metabase/request @metabase/devexp
# src/metabase/revisions @metabase/core-backend-admin-webapp
# test/metabase/revisions @metabase/core-backend-admin-webapp
# src/metabase/sample_data @metabase/core-backend-admin-webapp
# test/metabase/sample_data @metabase/core-backend-admin-webapp
# src/metabase/search ...
# test/metabase/search ...
# src/metabase/segments @metabase/core-backend-querying
# test/metabase/segments @metabase/core-backend-querying
# src/metabase/server @metabase/devexp
# test/metabase/server @metabase/devexp
# src/metabase/session @metabase/core-backend-admin-webapp
# test/metabase/session @metabase/core-backend-admin-webapp
# src/metabase/setup @metabase/core-backend-admin-webapp
# test/metabase/setup @metabase/core-backend-admin-webapp
# src/metabase/sso @metabase/core-backend-admin-webapp
# test/metabase/sso @metabase/core-backend-admin-webapp
# src/metabase/sync @metabase/drivers
# test/metabase/sync @metabase/drivers
# src/metabase/task @metabase/devexp
# test/metabase/task @metabase/devexp
# src/metabase/tiles @metabase/core-backend-dashviz
# test/metabase/tiles @metabase/core-backend-dashviz
# src/metabase/timeline @metabase/core-backend-dashviz
# test/metabase/timeline @metabase/core-backend-dashviz
# src/metabase/types @metabase/core-backend-querying
# test/metabase/types @metabase/core-backend-querying
# src/metabase/upload @metabase/core-backend-admin-webapp
# test/metabase/upload @metabase/core-backend-admin-webapp
# src/metabase/user_key_value @metabase/core-backend-admin-webapp
# test/metabase/user_key_value @metabase/core-backend-admin-webapp
# src/metabase/util @metabase/devexp
# test/metabase/util @metabase/devexp
# src/metabase/xrays @metabase/core-backend-querying
# test/metabase/xrays @metabase/core-backend-querying
enterprise/backend/src/metabase_enterprise/advanced_permissions @noahmoss
enterprise/backend/src/metabase_enterprise/audit_app @noahmoss
enterprise/backend/src/metabase_enterprise/sso @noahmoss
enterprise/backend/src/metabase_enterprise/task/truncate_audit_table.clj @noahmoss
enterprise/backend/src/metabase_enterprise/internal_user.clj @noahmoss
frontend/src/metabase/ui @metabase/core-frontend-admin-webapp
src/metabase/**/*permissions* @noahmoss
src/metabase/integrations @noahmoss
snowplow/* @metabase/data

View File

@@ -63,17 +63,15 @@ body:
attributes:
label: Information about your Metabase installation
description: |
For versions >= 56, copy and paste the Diagnostic info from `Admin -> Tools -> Help`.
For versions < 56, copy and paste the Diagnostic info from `Admin -> Troubleshooting`.
Copy and paste the JSON from `Admin -> Troubleshooting`.
_This will be automatically formatted into code, so no need for backticks._
placeholder: |
{"browser-info": {
"language": "en-US",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
"vendor": "Google Inc."},
"metabase-info": {
"databases": [ "postgres",...
- Your browser and the version: (e.g., Chrome 52.1, Firefox 48.0, Safari 11.1, …)
- Your operating system: (e.g., OS X 10.10, Windows 10.1809, Ubuntu 16.04, …)
- Your databases: (e.g, MySQL, Postgres, MongoDB, …)
- Metabase version: (e.g., 0.19.3)
- Metabase hosting environment: (e.g., Elastic Beanstalk, Docker, Heroku, Jar-file on Ubuntu, …)
- Metabase internal database: (e.g., H2 (default), Postgres or MySQL)
render: JSON
validations:
required: true

View File

@@ -3,7 +3,7 @@
> **Warning**
>
> If that is your first contribution to Metabase, please sign the [Contributor License Agreement](https://docs.google.com/a/metabase.com/forms/d/1oV38o7b9ONFSwuzwmERRMi9SYrhYeOrkbmNaq9pOJ_E/viewform). Also, if you're attempting to fix a translation issue, please submit your changes to our [Crowdin project](https://crowdin.com/project/metabase-i18n) instead of opening a PR.
> If that is your first contribution to Metabase, please sign the [Contributor License Agreement](https://docs.google.com/a/metabase.com/forms/d/1oV38o7b9ONFSwuzwmERRMi9SYrhYeOrkbmNaq9pOJ_E/viewform) (unless it's a tiny documentation change). Also, if you're attempting to fix a translation issue, please submit your changes to our [POEditor project](https://poeditor.com/join/project/ynjQmwSsGh) instead of opening a PR.
Closes https://github.com/metabase/metabase/issues/[issue_number]

View File

@@ -5,7 +5,7 @@ PENDING CI / PENDING REVIEW / READY _(choose one and update accordingly)_
- Reproduces #XXXXX
### How to test this manually?
- `yarn test-cypress`
- `yarn test-cypress-open`
- `relative/path/to/the/file`
> _(For still unfixed bug)_
- Replace `it.skip()` with `it.only()` to run the test in isolation

View File

@@ -1,5 +1,4 @@
name: await-port
description: Wait for localhost port to be ready
name: Wait for localhost port to be ready
inputs:
port:

View File

@@ -0,0 +1,73 @@
name: Build E2E Matrix
description: Build and output a custom matrix for E2E tests.
outputs:
matrix:
description: Parameterized matrix in JSON format
value: ${{ steps.matrix.outputs.result }}
runs:
using: "composite"
steps:
- uses: actions/github-script@v7
id: matrix
with:
script: | # js
const java = 21;
const defaultRunner = "ubuntu-22.04";
const defaultOptions = {
"java-version": java,
runner: defaultRunner,
edition: "ee",
context: "folder"
};
const testSets = [
["actions", {} ],
["admin", {} ],
["admin-2", {} ],
["binning", {} ],
["collections", {} ],
["custom-column", {} ],
["dashboard", {} ],
["dashboard-cards", {} ],
["dashboard-filters", {} ],
["dashboard-filters-2", {} ],
["dashboard-filters-matrix", {} ],
["embedding", {} ],
["embedding-sdk", { context: "embedding-sdk" } ],
["filters", {} ],
["filters-reproductions", {}],
["joins", {} ],
["metrics", {} ],
["models", {} ],
["native", {} ],
["native-filters", {} ],
["onboarding", {} ],
["organization", {} ],
["permissions", {} ],
["question", {} ],
["question-reproductions", {} ],
["search", {}],
["sharing", {} ],
["stats", {} ],
["visualizations-charts", {} ],
["visualizations-tabular", {} ],
["oss-subset", { edition: 'oss', context: "special" } ],
["slow", { context: "special" } ],
["flaky", { context: "special" } ],
["mongo", { context: "qa-database" } ],
];
const config = testSets.map(([name, specialOptions]) => {
return {
...defaultOptions,
...specialOptions,
name,
}
});
const matrix = { include: config };
return matrix;

View File

@@ -0,0 +1,132 @@
name: Build ee-extra
description: Build Metabase Enterprise Edition with extra features
inputs:
java-version:
required: true
# Use Java 17 to run steps like `jar uf`, otherwise the build fails because it tries to verify every file the JAR
# and some have 17+ bytecode for whatever reason... see https://metaboat.slack.com/archives/C5XHN8GLW/p1731504670951389
default: '17'
iam-role:
description: "The IAM role to assume"
required: true
runs:
using: composite
steps:
- name: Prepare Java
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
- name: Reveal its original version.properties
run: jar xf ./bin/docker/metabase.jar version.properties && cat version.properties
shell: bash
- name: get major version
id: major_version
run: echo "major_version=$(cat version.properties | grep 'tag=' | cut -d'.' -f2)" >> $GITHUB_OUTPUT
shell: bash
- name: get drivers registry
run: |
curl -OL https://raw.githubusercontent.com/metabase/metabase-registry/main/registry.yaml
shell: bash
- uses: actions/setup-node@v4
with:
node-version: lts/Hydrogen # 18.x.x
- run: rm package.json && npm install yaml
shell: bash
- name: parse drivers registry
uses: actions/github-script@v7
id: drivers_registry
with:
script: | # js
const { parse } = require('yaml');
const fs = require('fs');
const registry = parse(fs.readFileSync('registry.yaml', 'utf8'));
const drivers = registry.drivers;
const majorVersion = '${{ steps.major_version.outputs.major_version }}';
const getDriverUrl = (driverName) => {
const driver = drivers.find(driver => driver.name === driverName);
if (!driver) {
throw new Error(`Driver ${driverName} not found in the registry`);
}
const driverUrl = driver.versions[majorVersion] ?? driver.versions.default;
if (!driverUrl) {
throw new Error(`Driver ${driverName} version ${majorVersion} not found in the registry`);
}
return driverUrl;
};
const extraDrivers = {
firebolt: getDriverUrl('firebolt'),
starburst: getDriverUrl('starburst'),
exasol: getDriverUrl('exasol'),
exasol_jdbc: drivers.find(d => d.name === 'exasol').deps[0],
clickhouse: getDriverUrl('clickhouse'),
ocient: getDriverUrl('ocient'),
materialize: getDriverUrl('materialize'),
};
console.log(extraDrivers);
return extraDrivers;
- name: Download Firebolt driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).firebolt }}
working-directory: modules
shell: bash
- name: Download Starburst driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).starburst }}
shell: bash
working-directory: modules
- name: Download Exasol driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).exasol }}
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).exasol_jdbc }}
shell: bash
working-directory: modules
- name: Download Clickhouse driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).clickhouse }}
shell: bash
working-directory: modules
- name: Download Ocient driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).ocient }}
shell: bash
working-directory: modules
- name: Download Materialize driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).materialize }}
shell: bash
working-directory: modules
- name: Bundle additional drivers into the Uberjar
run: jar uf bin/docker/metabase.jar modules/*.jar
shell: bash
- name: Launch uberjar
run: >-
java --add-opens java.base/java.nio=ALL-UNNAMED -jar ./bin/docker/metabase.jar &
shell: bash
- name: Wait for Metabase to start
run: while ! curl 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
shell: bash
- name: Kill the java process
run: pkill -f metabase.jar
shell: bash
- name: configure aws credentials
if: ${{ github.ref_name == 'master' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.iam-role }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
if: ${{ github.ref_name == 'master' }}
uses: aws-actions/amazon-ecr-login@v2

View File

@@ -1,36 +0,0 @@
name: Cleanup Python Runner
description: Cleanup python-runner services and upload logs as artifacts
inputs:
upload-logs:
description: 'Whether to upload logs (typically on failure)'
required: false
default: 'false'
logs-artifact-suffix:
description: 'The unique name of the .zip artifact containing the logs'
required: false
default: ''
runs:
using: composite
steps:
- name: Cleanup python-runner services
if: always()
run: |
echo "Stopping python-runner services..."
if [ -d "python-runner" ]; then
cd python-runner
make stop || echo "WARNING: Failed to stop python runner"
fi
shell: bash
- name: Upload python-runner logs
if: ${{inputs.upload-logs == 'true' && inputs.logs-artifact-suffix != ''}}
uses: actions/upload-artifact@v4
with:
name: python-runner-logs-${{inputs.logs-artifact-suffix}}
path: |
python-runner.out.log
python-runner.err.log
retention-days: 1
if-no-files-found: warn

View File

@@ -1,110 +0,0 @@
name: Create Backport PR
inputs:
target-version: # major version number like 34 or 86
required: true
backport-commit:
required: true
github-token:
required: true
github-token-2: # need a second token to approve the PR
required: true
runs:
using: "composite"
steps:
- id: create_backport_pull_request
name: Create backport pull request
env:
TARGET_VERSION: ${{ inputs.target-version }}
TARGET_BRANCH: release-x.${{ inputs.target-version }}.x
ORIGINAL_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
ORIGINAL_TITLE: ${{ github.event.pull_request.title }}
GITHUB_TOKEN: ${{ inputs.github-token }}
COMMIT: ${{ inputs.backport-commit }}
shell: bash
run: | # bash
git config --global user.email "metabase-bot@metabase.com"
git config --global user.name "Metabase bot"
BACKPORT_BRANCH="backport-$TARGET_VERSION-$COMMIT"
# Checkout the target branch and create a new backport branch
git checkout ${TARGET_BRANCH}
git fetch --all
git checkout -b ${BACKPORT_BRANCH}
git cherry-pick ${COMMIT} || true
CONFLICT_LIST=$(git ls-files -u)
CONFLICTS=$(git ls-files -u | wc -l)
if [ "$CONFLICTS" -gt 0 ]; then
git cherry-pick --abort
echo "Could not cherry pick because of a conflict"
echo "has-conflicts=true" >> $GITHUB_OUTPUT
# Add a shell script for resolving conflicts
echo "git reset HEAD~1" > ./backport.sh
echo "rm ./backport.sh" >> ./backport.sh
echo "git cherry-pick ${COMMIT}" >> ./backport.sh
echo "echo 'Resolve conflicts and force push this branch.\n\nTo backport translations run: bin/i18n/merge-translations <release-branch>'" >> ./backport.sh
chmod +x ./backport.sh
git add ./backport.sh
git commit -m "Add backport resolution script"
PR_BODY=$(cat <<-END
#${ORIGINAL_PULL_REQUEST_NUMBER}
> [!IMPORTANT]
> Manual conflict resolution is required.
> Checkout the branch and run \`./backport.sh\` script. Force push your changes after cherry-picking. Check the box below when done.
Conflicts:
\`\`\`shell
${CONFLICT_LIST}
\`\`\`
- [ ] Conflicts resolved
END
)
else
echo "has-conflicts=false" >> $GITHUB_OUTPUT
PR_BODY="#${ORIGINAL_PULL_REQUEST_NUMBER}"
fi
git push -u origin ${BACKPORT_BRANCH}
BACKPORT_PR_URL=$(gh pr create --base "${TARGET_BRANCH}" --head "${BACKPORT_BRANCH}" --label "was-backported" --assignee "${{ github.event.pull_request.user.login }}" --title "🤖 backported \"${ORIGINAL_TITLE}\"" --body "${PR_BODY}")
BACKPORT_PR_NUMBER=${BACKPORT_PR_URL##*/}
echo "backport_pr_number=$BACKPORT_PR_NUMBER" >> $GITHUB_OUTPUT
echo "New PR has been created: #${BACKPORT_PR_NUMBER}"
git checkout ${{ github.sha }}
- name: Auto approve backport PR
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'false' }}
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ inputs.github-token-2 }}
number: ${{ steps.create_backport_pull_request.outputs.backport_pr_number }}
- name: Enable Pull Request Automerge
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'false' }}
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ inputs.github-token }}
pull-request-number: ${{ steps.create_backport_pull_request.outputs.backport_pr_number }}
merge-method: squash
- uses: ./.github/actions/notify-pull-request
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'true' }}
with:
include-log: false
message: Manual conflict resolution is required on \#${{ steps.create_backport_pull_request.outputs.backport_pr_number }}
- uses: ./.github/actions/notify-pull-request
if: ${{ failure() }}
with:
include-log: true
message: Something went wrong while creating backport

View File

@@ -1,15 +1,12 @@
name: Cross-branch migration test
inputs:
base-ref: ## Base branch PR came from
required: true
head-ref: ## Source branch of the pull request
base-ref:
required: true
runs:
using: "composite"
steps:
## First we deploy the base branch
- name: Check out base branch
uses: actions/checkout@v4
with:
@@ -42,11 +39,10 @@ runs:
run: kill $(cat metabase_pid)
shell: bash
## Then we deploy the PR branch to ensure it migrates up successfully
- name: Check out pull request branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.head-ref }}
ref: ${{ github.head_ref }}
- name: Run backend on pull request branch
run: |
@@ -69,38 +65,3 @@ runs:
- name: Stop Metabase on pull request branch
run: kill $(cat metabase_pid)
shell: bash
## Testing that originally deploying this PR allows you to roll back to a previous release
## Reset the checksums so when we go back to the base branch, it's as if the PR branch was what was originally deployed
- name: Reset the checksums as if the PR branch was what was originally deployed
run: |
clojure -M:dev:ee:migrate reset-checksums
shell: bash
- name: Rollback the last deployment
run: |
clojure -M:dev:ee:migrate rollback last-deployment
shell: bash
- name: Re-check out base branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.base-ref }}
- name: Re-run backend on base branch
run: |
clojure -M:run:ee > metabase.log 2>&1 & echo $! > metabase_pid
tail -F metabase.log &
shell: bash
- name: Wait for Metabase to start
run: |
while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}' > /dev/null; do
if ! kill -0 $(cat metabase_pid) 2>/dev/null; then
cat metabase.log
echo "Metabase process has exited."
exit 1
fi
sleep 1
done
shell: bash

View File

@@ -68,3 +68,10 @@ runs:
- name: Unzip Metabase artifact containing an uberjar
run: unzip mb.zip
shell: bash
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
cat version.properties
mv version.properties resources/
shell: bash

View File

@@ -8,7 +8,7 @@ inputs:
description: DockerHub password/token
required: true
maildev:
description: Maildev containers
description: Maildev container
required: true
default: false
openldap:
@@ -31,10 +31,6 @@ inputs:
description: Webhook tester container
required: false
default: false
snowplow:
description: Snowplow micro container
required: false
default: false
runs:
using: "composite"
@@ -46,68 +42,56 @@ runs:
password: ${{ inputs.password }}
- name: Start Containers
shell: bash
run: | # bash
run: |
Y='\033[33m'
G='\033[1;32m'
cd e2e/test/scenarios/
docker compose up \
$([ ${{ inputs.postgres }} = true ] && echo "postgres-sample") \
$([ ${{ inputs.mysql }} = true ] && echo "mysql-sample") \
$([ ${{ inputs.mongo }} = true ] && echo "mongo-sample") \
$([ ${{ inputs.maildev }} = true ] && echo "maildev") \
$([ ${{ inputs.maildev }} = true ] && echo "maildev-ssl") \
$([ ${{ inputs.openldap }} = true ] && echo "ldap") \
$([ ${{ inputs.webhook }} = true ] && echo "webhook-tester") \
$([ ${{ inputs.snowplow }} = true ] && echo "snowplow-micro") \
-d
if ${{ inputs.maildev }}; then
echo -e "${Y}checking maildev container..." &&
echo -e "${Y}Starting maildev container..." &&
docker run -d -p 1080:1080 -p 1025:1025 maildev/maildev:2.0.5 &&
while ! nc -z localhost 1080; do sleep 1; done &&
while ! nc -z localhost 1025; do sleep 1; done &&
echo -e "${G}Maildev is up and running!"
echo -e "${Y}checking maildev-ssl container..." &&
while ! nc -z localhost 1081; do sleep 1; done &&
while ! nc -z localhost 465; do sleep 1; done &&
echo -e "${G}Maildev-ssl is up and running!"
fi
if ${{ inputs.openldap }}; then
echo -e "${Y}checking openldap container..." &&
echo -e "${Y}Starting openldap container..." &&
docker run -d -p 389:389 \
--env LDAP_ADMIN_PASSWORD=adminpass \
--env LDAP_USERS=user01@example.org,user02@example.org \
--env LDAP_PASSWORDS=123456,123465 \
--env LDAP_ROOT=dc=example,dc=org \
--env LDAP_PORT_NUMBER=389 \
bitnami/openldap:2.6.4 &&
while ! nc -z localhost 389; do sleep 1; done &&
echo -e "${G}Openldap is up and running!"
fi
if ${{ inputs.postgres }}; then
echo -e "${Y}checking postgres container..." &&
echo -e "${Y}Starting postgres container..." &&
docker run -d -p 5404:5432 -e TZ='US/Pacific' metabase/qa-databases:postgres-sample-12 &&
while ! nc -z localhost 5404; do sleep 1; done &&
echo -e "${G}Postgres is up and running!"
fi
if ${{ inputs.mysql }}; then
echo -e "${Y}checking mysql container..." &&
echo -e "${Y}Starting mysql container..." &&
docker run -d -p 3304:3306 -e TZ='US/Pacific' metabase/qa-databases:mysql-sample-8 &&
while ! nc -z localhost 3304; do sleep 1; done &&
echo -e "${G}MySQL is up and running!"
fi
if ${{ inputs.mongo }}; then
echo -e "${Y}checking mongo container..." &&
echo -e "${Y}Starting mongo container..." &&
docker run -d -p 27004:27017 metabase/qa-databases:mongo-sample-4.4 &&
while ! nc -z localhost 27004; do sleep 1; done &&
echo -e "${G}Mongo is up and running!"
fi
if ${{ inputs.webhook }}; then
echo -e "${Y}checking webhook test container..." &&
echo -e "${Y}Starting webhook test container..." &&
docker run -d -p 9080:8080/tcp tarampampam/webhook-tester:1.1.0 serve --create-session 00000000-0000-0000-0000-000000000000 &&
while ! nc -z localhost 9080; do sleep 1; done &&
echo -e "${G}Webhook tester is up and running!"
fi
if ${{ inputs.snowplow }}; then
echo -e "${Y}checking snowplow micro container..." &&
while ! nc -z localhost 9090; do sleep 1; done &&
echo -e "${G}Snowplow micro is up and running!"
fi
shell: bash

View File

@@ -1,105 +0,0 @@
name: Fetch artifact
description: Fetches a specific artifact and downloads it to the current directory
inputs:
name:
description: The name of the artifact to fetch
required: true
output-name:
description: Optional custom name for the output jar file (defaults to metabase.jar)
required: false
default: "metabase.jar"
extract-path:
description: Directory path where the jar should be extracted (defaults to current directory)
required: false
default: "."
runs:
using: "composite"
steps:
- name: find_release_artifact
id: find_release_artifact
uses: actions/github-script@v7
with:
result-encoding: string
script: | # js
const fs = require('fs');
const artifacts = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
name: "${{ inputs.name }}",
per_page: 1,
});
if (!artifacts.data?.artifacts?.[0]?.id) {
throw new Error(`No artifacts found for ${{ inputs.name }}`);
}
const artifact_id = artifacts.data.artifacts[0].id;
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact_id,
archive_format: 'zip',
});
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/mb.zip`, Buffer.from(download.data));
- name: Extract and rename JAR
shell: bash
run: | # bash
OUTPUT_NAME="${{ inputs.output-name }}"
EXTRACT_PATH="${{ inputs.extract-path }}"
# Create a temporary directory for extraction to avoid conflicts
TEMP_DIR=$(mktemp -d)
# Extract to temporary directory
unzip mb.zip -d "$TEMP_DIR"
# Create target directory
mkdir -p "$EXTRACT_PATH"
# Find the jar and move all files from its directory
if [ -e "$TEMP_DIR/metabase.jar" ]; then
# Move all files to extract path
mv "$TEMP_DIR"/* "$EXTRACT_PATH/" 2>/dev/null || true
# Rename the jar to custom name if different
if [ "$OUTPUT_NAME" != "metabase.jar" ]; then
mv "$EXTRACT_PATH/metabase.jar" "$EXTRACT_PATH/$OUTPUT_NAME"
fi
elif [ -e "$TEMP_DIR/target/uberjar/metabase.jar" ]; then
# Move all files from uberjar directory to extract path
mv "$TEMP_DIR/target/uberjar"/* "$EXTRACT_PATH/" 2>/dev/null || true
# Rename the jar to custom name if different
if [ "$OUTPUT_NAME" != "metabase.jar" ]; then
mv "$EXTRACT_PATH/metabase.jar" "$EXTRACT_PATH/$OUTPUT_NAME"
fi
else
echo "Could not find metabase.jar in extracted files"
exit 1
fi
# Clean up temporary directory
rm -rf "$TEMP_DIR"
# Set the JAR_PATH environment variable
if [ "$EXTRACT_PATH" == "." ]; then
echo "JAR_PATH=$OUTPUT_NAME" >> $GITHUB_ENV
else
echo "JAR_PATH=$EXTRACT_PATH/$OUTPUT_NAME" >> $GITHUB_ENV
fi
- name: Verify that this is a valid JAR file
shell: bash
run: |
echo "Verifying JAR at: $JAR_PATH"
file --mime-type "$JAR_PATH"
- name: Reveal its version.properties
shell: bash
run: |
echo "Extracting version.properties from: $JAR_PATH"
jar xf "$JAR_PATH" version.properties && cat version.properties

View File

@@ -28,5 +28,3 @@ runs:
env:
PULL_REQUEST_NUMBER: ${{ inputs.pull-request-number }}
BASE_REF: ${{ inputs.base-ref }}
- run: git checkout ${{ github.sha }} # return to original commit
shell: bash

View File

@@ -1,74 +0,0 @@
name: Get Docker Info
description: Determines Docker repository and tag based on branch and edition
inputs:
branch:
description: Branch name (defaults to current branch)
required: false
default: ${{ github.head_ref || github.ref_name }}
edition:
description: Edition (ee or oss)
required: false
default: ee
owner:
description: Repository owner (defaults to current repo owner)
required: false
default: ${{ github.repository_owner }}
outputs:
repo:
description: Docker repository name
value: ${{ steps.docker-info.outputs.repo }}
tag:
description: Docker tag
value: ${{ steps.docker-info.outputs.tag }}
full_image:
description: Full Docker image name (repo:tag)
value: ${{ steps.docker-info.outputs.full_image }}
editions:
description: JSON array of editions to build
value: ${{ steps.docker-info.outputs.editions }}
runs:
using: "composite"
steps:
- name: Determine Docker info
id: docker-info
uses: actions/github-script@v7
with:
script: | # js
const branch = '${{ inputs.branch }}';
const edition = '${{ inputs.edition }}';
const owner = '${{ inputs.owner }}';
console.log(`Determining Docker info for branch: ${branch}, edition: ${edition}`);
let repo, tag, editions;
if (branch === 'master') {
// Master builds both editions with specific repos
editions = ['ee', 'oss'];
tag = 'latest';
if (edition === 'ee') {
repo = `${owner}/metabase-enterprise-head`;
} else {
repo = `${owner}/metabase-head`;
}
} else {
// All other branches only build EE to metabase-dev
editions = ['ee'];
tag = branch.replaceAll('/', '-'); // slashes make docker sad
repo = `${owner}/metabase-dev`;
}
const fullImage = `${repo}:${tag}`;
// Set outputs
core.setOutput('repo', repo);
core.setOutput('tag', tag);
core.setOutput('full_image', fullImage);
core.setOutput('editions', JSON.stringify(editions));
console.log(`Docker image: ${fullImage}`);
console.log(`Editions: ${JSON.stringify(editions)}`);

View File

@@ -0,0 +1,41 @@
name: Get latest release branch
outputs:
branch-name:
value: ${{ steps.get-latest-release-branch.outputs.result }}
runs:
using: "composite"
steps:
- uses: actions/github-script@v7
id: get-latest-release-branch
with:
result-encoding: string
script: |
const releaseBranches = await github.rest.git.listMatchingRefs({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "heads/release-x.",
});
const getVersionFromBranch = branch => {
const match = branch.match(/release-x\.(.*?)\.x$/);
return match && parseInt(match[1]);
};
const latestReleaseBranch = releaseBranches.data
.filter(branch => getVersionFromBranch(branch.ref) !== null)
.reduce(
(prev, current) =>
getVersionFromBranch(prev.ref) > getVersionFromBranch(current.ref)
? prev
: current,
{ ref: "" },
);
const latestReleaseBranchName = latestReleaseBranch.ref.replace(
/^refs\/heads\//,
"",
);
console.log(`Latest release branch: ${latestReleaseBranchName}`);
return latestReleaseBranchName;

View File

@@ -1,13 +1,5 @@
name: Notify Pull Request
inputs:
remove-previous-comment:
required: false
type: boolean
default: false
add-new-comment:
required: false
type: boolean
default: true
message:
required: true
include-log:
@@ -17,56 +9,12 @@ inputs:
runs:
using: "composite"
steps:
- name: Remove previous pull-request comment
uses: actions/github-script@v7
if: ${{ inputs.remove-previous-comment == 'true' && always() && github.event_name == 'pull_request' }}
with:
script: |
const pr = context.payload.pull_request ?? context.payload.issue;
if (!pr) {
console.error("This action can only be run on pull requests");
return;
}
const { owner, repo } = context.repo;
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: pr.number,
}).catch(console.error);
if (!comments) {
return;
}
const message = "${{ inputs.message }}";
const comment = comments.find((comment) => comment.body.includes(message));
if (comment) {
await github.rest.issues.deleteComment({
owner,
repo,
comment_id: comment.id,
});
}
- name: Notify pull-request
uses: actions/github-script@v7
if: ${{ inputs.add-new-comment == 'true' && always() && github.event_name == 'pull_request' }}
id: notify-pull-request
- uses: actions/github-script@v7
id: get-latest-release-branch
with:
result-encoding: string
script: | # js
const pr = context.payload.pull_request ?? context.payload.issue;
if (!pr) {
console.error("This action can only be run on pull requests");
return;
}
const message = "${{ inputs.message }}";
script: |
const message = "${{ inputs.message }}"
const shouldIncludeLog = ${{ inputs.include-log }}.toString() === "true";
const author = context.payload.sender.login;
@@ -79,7 +27,7 @@ runs:
}
github.rest.issues.createComment({
issue_number: pr.number,
issue_number: context.payload.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,

View File

@@ -1,14 +1,11 @@
name: Prepare back-end environment
description: |
Prepare the backend. Installs jdk, Clojure, and fetches the cache for m2. The CI config fetchs `ci-test-config.json`
from master and lets us ignore tests at the var level if they are flaking.
inputs:
java-version:
required: true
default: '21'
clojure-version:
required: true
default: '1.12.0.1488'
default: '1.11.1.1262'
m2-cache-key:
description: 'Key to cache M2 packages from Maven Central'
required: true
@@ -24,14 +21,9 @@ runs:
distribution: 'temurin'
- name: Install Clojure CLI
shell: bash
continue-on-error: true
run: |
curl -O https://download.clojure.org/install/linux-install-${{ inputs.clojure-version }}.sh &&
sudo bash ./linux-install-${{ inputs.clojure-version }}.sh
- name: Fetch CI config
shell: bash
run: |
curl -o ci-test-config.json https://raw.githubusercontent.com/metabase/metabase/refs/heads/master/ci-test-config.json
- name: Check to see if dependencies should be cached
if: ${{ contains(github.event.head_commit.message, '[ci nocache]') }}
run: echo "Commit message includes [ci nocache]; dependencies will NOT be cached"

View File

@@ -1,12 +1,6 @@
name: Prepare cypress environment
description: Cypress preparation steps
inputs:
working-directory:
description: "Optional working directory for yarn commands"
required: false
default: "."
outputs:
chrome-path:
description: Path to the custom Chrome executable
@@ -39,4 +33,3 @@ runs:
yarn cypress cache list
yarn cypress verify
shell: bash
working-directory: ${{ inputs.working-directory }}

View File

@@ -33,5 +33,18 @@ runs:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock', '**/patches/*.patch') }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
if: steps.node-modules-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile --prefer-offline
shell: bash

Some files were not shown because too many files have changed in this diff Show More