Compare commits

...

657 Commits

Author SHA1 Message Date
Nathan Voxland
5ad741c0d2 Cleaning up code 2026-04-01 13:58:39 -05:00
Nathan Voxland
69570bc65f Cleaning up code 2026-03-31 20:15:55 -05:00
Nathan Voxland
b719615aa6 Cleaning up code 2026-03-31 17:09:51 -05:00
Nathan Voxland
afcc49f6f6 Refactor MQ test init: use :mq initialization step instead of is-test? checks
Replace scattered is-test? checks at var definition time with a proper
:mq initialization step in the test startup flow. This mirrors how
production initializes MQ via MqInit in startup/run-startup-logic!.

The :mq step:
- Loads driver.init (so def-listener! namespaces are loaded)
- Calls mq.init/init-for-tests! which sets sync backends, disables
  publish buffering, and registers all listeners

Also:
- Reverts var defaults to production values (appdb backends, 100ms buffer)
- Reverts def-listener! to lazy registration (no eager call)
- Restores with-sync-mq to use fresh *listeners* atom
- Removes all [TZ-DEBUG] diagnostic traces
- :db initialization depends on :mq

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 16:00:26 -05:00
Nathan Voxland
d12184f4a0 Fix eager listener registration: call multimethod, not method map lookup
The eager registration code used ((methods def-listener*) channel) which
returns the method fn from the methods map but doesn't invoke it. Changed
to (def-listener* channel) which dispatches through the multimethod and
actually calls the registration function.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 14:08:09 -05:00
Nathan Voxland
bde8a43aeb Add tracing to :db init to verify driver.init loading
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:27:56 -05:00
Nathan Voxland
76f8cb6ce3 Don't rebind *listeners* to empty atom in with-sync-mq
with-sync-mq was binding *listeners* to (atom {}), which created a
fresh empty atom that shadowed the root atom where listeners were
eagerly registered at def-listener! time. Since eftest propagates
bindings to worker threads, parallel tests running on threads spawned
within a with-sync-mq scope would see the empty atom and fail to find
any listeners.

Fix: stop rebinding *listeners*. Listeners are eagerly registered into
the root atom at namespace load time and should remain globally visible.
with-sync-mq still binds backends and buffer settings as needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 12:55:18 -05:00
Nathan Voxland
31840a1a31 Add atom identity tracing to diagnose listener registration
Trace which *listeners* atom instance is used during registration vs
lookup to detect if a dynamic rebinding is causing listeners to be
registered in one atom but looked up in another.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 12:35:43 -05:00
Nathan Voxland
a5968cdf24 Load driver/init.clj during test :db initialization
The MQ listeners defined in driver_notifications.clj (e.g.
connection-pool-invalidated) are only loaded via driver/init.clj, which
is loaded via core/init.clj in production. Tests don't load core/init.clj,
so these listener namespaces are never required and the eager registration
from def-listener! never happens.

Fix: require driver.init during test :db initialization so the listener
namespaces get loaded and listeners are registered.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 11:37:56 -05:00
Nathan Voxland
5bcdea9b51 Eagerly register MQ listeners at def-listener! time
def-listener! now immediately registers the listener when the namespace
loads, instead of deferring to register-listeners! called from MqInit.
This ensures listeners are available in test mode where MqInit never runs
(tests use initialize-if-needed!, not startup/run-startup-logic!).

register-listener! is idempotent so the production path (MqInit calling
register-listeners!) still works fine.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 10:37:11 -05:00
Nathan Voxland
8eafca6c74 Add tracing to invoke-listener! to diagnose missing listener
The sync backend publish fires but listener output never appears.
Adding trace to see if listener is registered or not.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 09:57:50 -05:00
Nathan Voxland
6adf7f2ef8 Default MQ backends to sync in test mode
Same issue as *publish-buffer-ms*: MqInit never runs in tests, so the
alter-var-root that sets backends to sync has no effect. Set defaults
at var definition time based on config/is-test?.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 08:59:56 -05:00
Nathan Voxland
2ea7960d5c Default *publish-buffer-ms* to 0 in test mode
MqInit never runs in tests (tests use initialize-if-needed!, not
run-startup-logic!), so the alter-var-root in the previous fix had
no effect. Instead, set the default value at var definition time
based on config/is-test?.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 01:26:49 -05:00
Nathan Voxland
66af12b9cd Add more MQ tracing to diagnose CI failures
Traces at buffered-publish!, transport/publish!, sync-backend/publish!,
and MqInit to understand why *publish-buffer-ms* is still 100 in CI
(meaning messages are buffered instead of delivered immediately).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 01:02:26 -05:00
Nathan Voxland
8171f24196 Debugging CI failures 2026-03-31 00:27:49 -05:00
Nathan Voxland
a86dffa344 Fix MQ topic messages silently dropped in test mode
In test mode, MqInit sets sync backends but leaves *publish-buffer-ms*
at its default of 100ms. This causes buffered-publish! to buffer messages
instead of delivering them immediately. Since start-publish-buffer-flush!
is never called in test mode, no background thread drains the buffer,
so topic messages are silently dropped.

This broke report-timezone change notifications — connection pools were
never invalidated when timezone changed, causing stale timezone sessions
on database connections. This manifested as timezone-shifted query results
across 28+ driver tests in CI.

Fix: set *publish-buffer-ms* to 0 in test init path so messages publish
immediately without buffering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:56:59 -05:00
Nathan Voxland
db09e70823 Debugging CI failures 2026-03-30 20:27:04 -05:00
Nathan Voxland
407f3bc2df Merge branch 'master' into persistent-queue 2026-03-29 18:22:27 -05:00
Fraser
e9b56f49b5 Allow Enterprise module to import from feature modules (#71468) 2026-03-29 16:26:56 +13:00
Fraser
307b2906b7 Fix module stats upload script (#71385) 2026-03-29 16:26:43 +13:00
Nathan Voxland
5b1181eba5 Fixed module setup 2026-03-28 01:40:24 -05:00
Nathan Voxland
1574a28b4f Fixed tests 2026-03-28 01:26:44 -05:00
lbrdnk
b8d3ac0869 Adjust search schemas (#71572) 2026-03-27 16:13:42 -07:00
Alexander Polyankin
ad4dfb41b1 Fix typo in transform database validation messages (#71596) 2026-03-27 22:34:25 +00:00
Nathan Voxland
ace1e034a2 Fixed tests 2026-03-27 15:50:33 -05:00
Nathan Voxland
9142569d91 Fixed tests 2026-03-27 14:58:23 -05:00
github-automation-metabase
38e28e0ec3 Fix pagerDurty workflow edge case (#71574)
Fix PagerDuty alert broken by single quote in issue title

Use jq --arg to safely construct the JSON payload instead of
interpolating user-controlled data directly into a shell string.
This prevents shell syntax errors when issue titles contain single
quotes or other special characters.

Removes the now-unnecessary 'Setting title' step that only escaped
double-quotes but left single quotes unhandled.
2026-03-27 20:52:32 +01:00
Nathan Voxland
30c6275dc5 Fixed tests 2026-03-27 14:05:41 -05:00
Nathan Voxland
0f2e7ea906 Fixed tests 2026-03-27 13:51:36 -05:00
Nathan Voxland
cff57cbbb5 Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	enterprise/backend/test/metabase_enterprise/agent_api/api_test.clj
2026-03-27 13:38:08 -05:00
Edward Paget
655a3f6ac7 Move agent API tests from enterprise to OSS (#71456) 2026-03-27 18:30:00 +00:00
Nathan Voxland
62c13bb028 Fixed formatting 2026-03-27 13:16:24 -05:00
Chris Truter
3c968befff Improve model encapsulation with serialization bypass (#71553) 2026-03-27 20:11:07 +02:00
Nathan Voxland
8f7064e87f Fixing tests 2026-03-27 12:56:26 -05:00
Sloan Sparger
334ed1fe42 [Metabot] Hide metabot feedback buttons on non-hosted instances (#71539)
hide metabot feedback buttons on non-hosted instances
2026-03-27 12:53:02 -05:00
Sloan Sparger
8e79105b9b [Metabot] Temporary removal of analyze chart button on dashboard page (#71540)
temp removal of analyze chart button on dashboard page
2026-03-27 12:52:53 -05:00
Ryan Laurie
92cd3f6cbf Converts some tests to ts (#71520)
converts tests to ts
2026-03-27 11:23:51 -06:00
Noah Moss
7089932b89 Move slack connect tests over to oss + fix API routes (#71525)
* move slack connect tests over to oss and remove some references to the token

* remove EE routes, always use OSS

* simplify

* undo some of that simplification

* fix tests / lint

* Move one test back to EE since it tests slack-connect's interaction with SAML
2026-03-27 10:50:48 -04:00
Nathan Voxland
27e5f298d8 Fixing tests 2026-03-27 09:27:36 -05:00
Nicolò Pretto
c4a27f18d3 embedding-hub: preserve "Select data" state + reset next steps after changing data segregation strategy (#71368)
* move up the state to persist it across steps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: reopen create tenants step when changing segregation strategy

When the user changes the data segregation strategy after already
creating tenants, the create tenants step now correctly reopens
instead of skipping to summary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* address feedback

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 15:24:32 +01:00
Phoomparin Mano
811e4466b2 Update in-app JWT onboarding to use snippets instead of iframes (#70475)
* share the same snippets for onboarding flow

* use sdk-docs-snippets namespace

* sync snippets

* fix rspack config

* rspack config: use path

* rspack: simplify resolve aliases

* remove node_modules from react refresh

* add copy button

* cleanup codemirror styling

* future proof: allow importing tsx files as well

* fix eslint pattern

* chore: move eslint ignore

* test to simplify aliases

* add context to ttag strings

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2026-03-27 15:24:18 +01:00
Jeff Bruemmer
48c41ec6c8 Docs metabot slack (#71526) 2026-03-27 10:02:47 -04:00
Oleksandr Solovyov
b93319ab57 metabot llm calls: tools are optional/maybe (#71555) 2026-03-27 13:25:04 +00:00
lbrdnk
31905eaba4 Add 60 to version-helpers.ts (#71480)
Update versionRequirements
2026-03-27 11:02:22 +01:00
Nicolò Pretto
a0a14a42d3 scroll to top on page change in admin settings (#71369)
* scroll to top on page change in admin settings

* make tests green

* switch to useRouter instead of hoc
2026-03-27 09:55:04 +01:00
lbrdnk
839784b50c Fix transform writing tools (#71100)
* Add needed capabilities

* Partly fix transforms-write ns

* Partial fix to python transforms

* Add tool prompts

* Cleanup native transforms

* Add parameter schema descriptions

* Python schemas adjustments

* Adjust tool prompts

* Cleanup

* Tests

* Add capabilities test

* tests

* cleanup

* cleanup

* mbql5 and tests

* tests

* tests

* tests

* feature sentinel

---------

Co-authored-by: Tyler Plude <tsplude@gmail.com>
2026-03-27 08:44:57 +01:00
Nemanja Glumac
e9bc4ac447 Notify Slack on cross-version test failures (#71491) 2026-03-27 08:16:10 +01:00
Chris Truter
7180c6ae4b Optimize transform target table backfill migrations (#71487)
Better safe than sorry, given recent problems with expensive migrations.
2026-03-27 06:49:07 +02:00
Nick Fitzpatrick
a57a1c0ab8 preserve navbar status in the url update at the end of handleQBInit (#71505) 2026-03-27 09:59:12 +05:30
Nick Fitzpatrick
bee30e6423 Uxw 3355 page titles not in sync with data studio tabs (#71401)
* Fixing page titles in Data Studio

* shuffling Library files around. Adding library page title to all library subpages
2026-03-27 09:50:52 +05:30
Nick Fitzpatrick
281aa0dc12 decrease font size in click behavior sidebar (#71519) 2026-03-27 09:48:40 +05:30
Nick Fitzpatrick
14bd0853f6 set line height to 'normal' for textareas (#71498) 2026-03-27 09:48:20 +05:30
Romeo Van Snick
8be374db14 Convert query builder redux store to ts (#71063)
* Convert query_builder reducers to js

* Convert query_builder selectors to ts

* Fix types

* Fix types

* Fix types

* Fix isResultDirty selector

* Fix selector

* Move selector tests to TS

* Move reducers-typed into reducers

* Fix types

* Fix types

* Fix object id parsing

* Fix more types

* Fix PKRowIndexmap types

* Make name for EDIT_SUMMARY consistent

* Fix hanging test
2026-03-27 13:59:05 +11:00
Nathan Voxland
c6dff735a9 Fixing tests 2026-03-26 18:13:35 -05:00
Alexander Polyankin
b7e1d1eff8 Serdes for cards, segments, measures, transforms - allow deserializing only with minimal required properties without computed ones (#71464) 2026-03-26 18:51:58 -04:00
github-automation-metabase
3dd4c46871 Auto-update documentation for master (#71533)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-26 18:49:20 -04:00
Noah Moss
e7ae8072ca Reorganization + consolidation of metabot system prompts (#71506)
* Reorganization + consolidation of metabot system prompts

* More reorganization

* More shared prompt files

* revert search changes included accidentally

* more organization

* Fix dialect resource paths in module drivers

Update llm-sql-dialect-resource defmethods to use correct metabot/prompts/dialects/ path.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* share personality prompt for nlq profile

* bump ci

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 17:27:26 -04:00
Riley Thompson
483f2086dd Bump databricks jdbc driver to 3.3.1 (#71513)
* bump databricks jdbc

* trigger ci
2026-03-26 21:17:38 +00:00
Edward Paget
cb9c042404 Fix MCP tool dispatch to pass query params correctly per Ring spec (#71502)
invoke-agent-api-with-params was encoding GET/DELETE query params into
the URI string, but defendpoint reads from :query-params (a parsed
map) on the Ring request. The synthetic request never passes through
wrap-params middleware, so query params in the URI were silently
ignored.

Fix by moving the method-based dispatch into deliver-agent-api-response:
POST params go to :body, GET/DELETE params go to :query-params.
Remove invoke-agent-api-with-params which is no longer needed.
2026-03-26 15:49:09 -05:00
Anderson
1b26236cf1 Do not show JWT shared secret as plaintext after it is saved (#71165)
* Handle JWT shared secret as write-only after initial generation (#UXW-3300)

- Thread generated token through wizard state so AddEndpointStep displays
  the plaintext key without re-reading it from session properties
- FormSecretKey now recognises the backend obfuscated format (**********XX)
  and renders an empty input with 'Already set' placeholder and a
  'Regenerate key' button, rather than showing the masked value

* Add unit tests for FormSecretKey obfuscated value handling (#UXW-3300)

- Tests covering no-value, plaintext, and obfuscated backend secret states
- Verifies 'Already set' placeholder and button labels are correct per state
- Verifies confirmation modal uses caller-supplied title/body
- Verifies token regeneration clears obfuscated value

* Fix prettier formatting in FormSecretKey.tsx

* Update the way we obfuscate the key and handle it on the frontend

* Add be test, improve alert

* Fix ts

* discard unnecessary changes

* Remove section that displayed the JWT secret in embedding set up

* Fix e2e test

* Show dedicated modal when generating new JWT shared key

* Fix unit test

* Fix e2e tests

* Fix latest UI changes

* Address review comments

* Add loading state to secret key modal and assert obfuscated key in E2E test

* Read jwt-shared-secret from /api/setting instead of session-properties / Revert unneeded obfuscated? implementation

* Fix tests

* Replace reads of session properties with api settings to simplify component logic
2026-03-26 16:34:54 -03:00
Chris Truter
14ff22021e Support non-datetime migration ids in tests (#71471)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 21:03:02 +02:00
Nick Fitzpatrick
55df67b632 Update Value normalization / collapsing in ChartSettingInputNumeric.tsx (#71440) 2026-03-27 00:14:41 +05:30
Edward Paget
53b678bcd6 Flatten root-level :or/:and/:multi into flat object schemas for MCP clients (#71494)
* Flatten root-level :or/:and/:multi into flat object schemas for MCP clients

Only the outermost composite schemas are flattened — nested anyOf/allOf
within properties are preserved since LLM clients handle them fine.

- :and → :merge then deref (flattens the [:map {:encode/...}] pattern)
- :or → :union with optional-keys, then deref (merges branches)
- :multi → same as :or, extracts schemas from dispatch triples

Also updates construct_query and query tool descriptions to explain
which fields are mutually exclusive (table_id vs metric_id vs
continuation_token).

* Refactor flatten-root-schema to worklist with cycle detection

Replace the recursive flatten-root-schema with a two-phase approach:
collect-root-maps walks the root composite tree using an iterative
worklist, then flatten-root-schema merges the collected leaves.

This eliminates stack recursion (:or/:multi no longer call
flatten-root-schema on children) and replaces the fuel counter with
a seen set that precisely detects deref cycles. On cycle detection,
emit an empty :map (-> {"type":"object"}) as a safe fallback.

The worklist also fixes :and wrapping :or — both layers now flatten
correctly since all composite nodes are expanded uniformly.

Adds tests for deeply nested composites, nested composites within
properties (preserved as anyOf/allOf), and :multi root flattening.
2026-03-26 17:48:52 +00:00
Nathan Voxland
daaca9ef62 CI fixes 2026-03-26 12:30:15 -05:00
Cam Saul
6a15fee1c5 Test to prove #32068 is fixed 🔧 (#71382)
* Test to prove #32068 is fixed 🔧

* Whoops revert deliberate test breakage

* Simplify test
2026-03-26 16:43:44 +00:00
Nicolò Pretto
92c07ddea1 hide sample db from embedding onboarding picker (#71304)
* hide sample db from embedding onboarding picker

* simplify e2e

* let's see if ci is green

* remove useless line, this is always pg
2026-03-26 17:23:19 +01:00
Sébastien
3dd99b6494 Fixed flaky custom elements api <metabase-question> test (#71500) 2026-03-26 17:20:53 +01:00
Riley Thompson
edb5eaad63 Handle non-dates in sqlite date columns (#71492)
* fix sqlite non date handling

* kondo
2026-03-26 12:14:00 -04:00
Nathan Voxland
ad9b980fef Merge remote-tracking branch 'origin/master' into persistent-queue 2026-03-26 11:12:10 -05:00
Nathan Voxland
96a308a64e CI fixes 2026-03-26 11:11:47 -05:00
Chris Truter
77afdaafc0 MCP further nits (#71478) 2026-03-26 16:08:18 +00:00
metamben
56f04b92ca Render |> as a single operator when formatting SQL (#71435)
Closes #70447
2026-03-26 16:06:37 +00:00
Braden Shepherdson
8020b65546 [MBQL lib] Add user docs for joins to lib.core (#71442)
Part of QUE2-366.
2026-03-26 16:06:19 +00:00
Sébastien
0cc35ac876 Sprinkled upsell gems in embed wizard (#71076) 2026-03-26 16:59:33 +01:00
Kevin Kelleher
617ca0f5f0 Fix boolean cartesian charts defaulting to timeseries axis (#71486) 2026-03-26 11:13:37 -04:00
John Swanson
607fb9ba58 Hide destination DBs from permissions (#71395)
* FE: do not show destination DBs in permissions editor

If you add a destination database, don't show it in the perms editor.

This was a temporary bug (disappears on refresh) BUT if you edit permissions
for the destination database then that is persisted, which is not great. I
will fix that in a separate PR.

* Don't add data permissions rows for destination DBs

- Exclude destination databases from the permissions graph

- Don't add permissions for destination DBs when creating a new group
2026-03-26 06:46:59 -08:00
Nathan Voxland
3c24edbf47 Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	src/metabase/settings/models/setting.clj
2026-03-26 09:33:55 -05:00
Ngoc Khuat
74c8811981 Fix silent data loss when importing unparseable YAML files (#71421)
* Surface ingestion errors instead of silently skipping unparseable YAML files

The serdes ingestion layer was silently dropping YAML files that failed
to parse (introduced in #41887 as defensive coding for editor temp
files). This caused remote sync imports to silently lose entities when
YAML files were malformed or exceeded SnakeYAML's nesting depth limit,
with no error reported to the user.

Add `ingestion-errors` to the Ingestable protocol so the ingestion
layer collects parse failures and surfaces them through `load-metabase\!`.
When `continue-on-error` is false (default, used by remote sync), the
import fails immediately on ingestion errors. When true, errors are
collected and reported alongside load-phase errors.

The dotfile filter from #41567 is preserved — editor temp files are
still silently skipped before parsing is attempted.

Fixes #71257

* Rename ingestion-errors to ingest-errors, extract populate-cache\! helper, add e2e tests

- Rename protocol method to ingest-errors for consistency with ingest-list/ingest-one
- Extract populate-cache\! helper to DRY up duplicated cache-population logic
- Add e2e test for continue-on-error true/false with ingestion errors

* Add tests for ingest-errors on IngestableSnapshot and wrapper delegation

* Fix log/warnf misuse, tighten tests, remove stale comment

- log/warnf -> log/warn to prevent MissingFormatArgumentException
  when error messages contain % characters
- Add tests for ingest-errors ordering contract and multi-file corruption
- Tighten continue-on-error assertion to check exact error count
- Remove stale comment describing pre-fix behavior

* Include file names in ingestion error messages

Wrap parse/read exceptions with ex-info containing the file path,
so the error message shows which files failed, e.g.
"Failed to read 1 file(s) during ingestion: bad_card.yaml"
2026-03-26 23:29:58 +09:00
Oleksandr Solovyov
ce15b2d9f0 fix metabot sql tools incorrectly checked query type (#71428) 2026-03-26 14:06:13 +00:00
github-automation-metabase
e5db491df4 Auto-update documentation for master (#71454)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-26 09:54:44 -04:00
Chris Truter
fdffe7dc82 Add db fallback for renamed settings (#71470) 2026-03-26 15:42:32 +02:00
lbrdnk
3bd3bf5b6a Edit chart fix (#71424)
* Add edit_chart.md instructions

* Ensure ids of state elements are stringified

* Cleanup

* Test

* add test and do cleanup

* Review comments
2026-03-26 14:00:04 +01:00
Chris Truter
c940bb3935 Add FKs from transforms back to tables (#70617) 2026-03-26 13:40:22 +02:00
Timofey Kachalov
366c74c02e Support entityId for guest embedded questions (#71246) 2026-03-26 14:44:00 +04:00
Chris Truter
0303419907 Increase transform test timeout (#71453) 2026-03-26 12:26:05 +02:00
Sébastien
1511899a7e Implement proper column width measurement for custom font sizes (#71407) 2026-03-26 11:08:04 +01:00
lbrdnk
b1a2673e1a Inject context in user message (#71045)
* Add context injection to user message

* Remove context from internal template

* whitespace

* Adjust tests

* Apply suggestion from @appleby

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>

* use lib

---------

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
2026-03-26 10:42:20 +01:00
Nicolò Pretto
7074e0236a fix frontmatter in add-tracing skill (#71438) 2026-03-26 09:38:16 +01:00
Nemanja Glumac
ddba65c368 Add E2E (questions) tests on top of the cross-version automation (#70190) 2026-03-26 09:13:57 +01:00
Nathan Voxland
93b375bbe2 Merged from master 2026-03-26 01:33:25 -05:00
Edward Paget
d8bb291939 Inline malli refs and flatten root anyOf in MCP tool schemas (#71457)
* Inline malli refs and flatten root anyOf in MCP tool schemas

MCP clients (Claude API, OpenAI, Gemini, AWS Bedrock) reject or
mishandle $ref and top-level anyOf in tool input schemas. Fix by:

- Walking malli schemas with ::walk-refs and ::walk-schema-refs to
  replace all registered-schema refs with their dereferenced content
  before JSON Schema generation, so mjs/transform never emits $ref
- Flattening root-level anyOf into a merged object schema for
  construct_query (table vs metric request union)
- Expanding construct_query tool description to explain table vs
  metric query differences since the schema no longer structurally
  separates them

Removes all $ref/$defs sanitization code and the defs accumulator
atom that are no longer needed.

* Replace :or/:and with :merge at malli level to eliminate anyOf/allOf

Instead of post-processing JSON Schema to flatten anyOf/allOf, handle
it at the malli schema level: in inline-malli-refs, replace :and with
:merge (eliminates allOf from the encode-map pattern) and :or with
:merge after making all entries optional via mut/optional-keys
(eliminates anyOf, all properties become optional in the merged
output).

This produces clean flat {type: "object", properties: {...}} schemas
that all MCP clients can handle. The construct_query tool now has all
table and metric properties in a single flat schema with none
required, and the description explains which to use.

Removes flatten-any-of and clojure.set dependency.
2026-03-26 06:21:33 +00:00
Nathan Voxland
ca3a2ea136 Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	src/metabase/search/core.clj
#	src/metabase/search/ingestion.clj
#	src/metabase/search/task/search_index.clj
#	src/metabase/testing_api/api.clj
2026-03-25 23:49:31 -05:00
Aleksandr Lesnenko
1132bfd402 New Metric Home page (#71055) 2026-03-26 03:05:51 +00:00
Nathan Voxland
e9f6c93013 Improved performance benchmark and added back skip lock 2026-03-25 21:17:35 -05:00
Maksym Yakubych
37f3a01838 [Metabot] Bring your own keys (#70714)
* move ee/llm into oss

* lots of file movement

* move slack connect to opensource

* ability to have enterprise-only tools

* move tests

* Fix stale metabot-v3 aliases, dangling module refs, disabled linting, broken test paths, and typo

* start using deprecated-name, more ns path fixes

* move llm transforms code to oss

* fix namespaces

* whitespace fix

* checkpoint: switch tools to use mu/defn or defenterprise directly

* compilation fix

* lint fixes

* move around some code to break drivers dependency

* fix tests

* fix tool calls

* sort routes

* fix openapi

* fix module config

* lint

* fix clj-kondo

* fix test

* fix token check tests

* cljfmt

* fix slack test

* maybe fix dashboard tests?

* cljfmt

* is this a fix for dashboard tests

* move metabot models to oss

* untangle module config after rebase

* fix module order

* cleanup

* add back ai service-related settings that are still used

* move some more code to more appropriate places

* more code movement

* better schema names

* clean up mu/defn function name formatting

* update module config

* remove unneeded ai service-related test

* fix module config again

* fix auth in tests by removing more ai service stuff

* enable native agent by default

* test transforms over normal function calls

* requires

* pass through metabot-id to tool calls instead of hardcoding embedded-metabot-id, to fix answer sources test

* fix wrap-tools-with-state calls

* try to fix failing field/dashboard tests by matching the code on master (might have been from a bad rebase)

* Revert "try to fix failing field/dashboard tests by matching the code on master (might have been from a bad rebase)"

This reverts commit cd5ec8b487.

* hard revert parameters.dashboard-test to the version on master after the latest rebase

* mark snippet tests as sequential to try to fix perms test issues, remove a couple stray metabot feature checks

* move entity analysis + sql fixing code to oss

* wrap dashboard tests with with-full-data-perms-for-all-users to isolate the failure

* move ai-entity-analysis and ai-sql-fixer under the metabot module

* fix module test

* remove now-unneeded ai feature falgs

* disable perms cache for these failing dashboard tests

* feat: self-hosted metabot provider settings

* test: patch is-hosted temporarily

* fix: grouping

* move files to the frontend/ folder

* move MetabotProviderSection into MetabotSetup to accomidate design changes

* make anthropic the only allowed provider, updat sonnet 4.6 as default model, small layout change to api key input

* remove PLUGIN_METABOT usage, remove purchase pages, consolidate new connections settings ui

* remove oss impl of sql gen on the FE

* remove MetabotSettingUpModal, add alert for slackbot requiring metabot be setup, remove PLUGIN_METABOT, PLUGIN_METABOT.isCloudManaged checks now check llm-metabot-configured? which breaks things for enterprise for now

* add mock Metabase provider

* fix build

* impl copy feedback

* type-fix

* clean up

* fix unit tests

* fix metabot e2e tests

* type fix

* more test fixes

* fix semantic search tests

* more test fix

* kondo fix

* more test fixes

* copy change

* more kondo fixes

* app db test failure fixes

* fix failing BE tests

* fix e2e tests

* more e2e failure fixes

* fix typo

* remove mocked out endpoint definition

* fix last failing e2e test

---------

Co-authored-by: Oleksandr Solovyov <o@solovyov.net>
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2026-03-25 23:49:07 +00:00
Chris Truter
87dc660191 Minor improvements to MCP server (#71406)
* Fix token scope logic to match middleware

* Add :secure to CSRF and DRY up

* Add comment to magic number for clarity

* Clean up complex threading

* Don't clobber token-scopes

* Optimize and improve no user-id failure mode

* trim comment fluff

* Simplify and avoid double str call

* Use database time for revoke-token for robustness

* Use long for user-id actually

* Enable refresh token rotation

A stolen refresh token was reusable for its entire 30-day TTL with no
way to detect theft. The oidc-provider library supports rotation — on
each refresh grant the old token is revoked and a new one issued.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Sanitize brand-color on consent page to prevent CSS injection

The brand-color setting is interpolated via h/raw into a <style> block on
the consent page. A non-hex value could break out of the CSS rule.
Validate defensively at the rendering site rather than changing the setting
setter, to handle already-persisted invalid values gracefully.

* HMAC-bind consent params to CSRF token and sanitize error messages

Two security improvements to the OAuth server:

1. The authorization decision endpoint re-parsed OAuth parameters from
   the POST body without verifying they matched what the user saw on
   the consent page. A modified form could request broader scopes than
   shown. Now the authorize endpoint HMAC-signs the parsed params using
   the CSRF token as key, and the decision endpoint verifies the
   signature against the re-parsed params before proceeding.

2. Error catch blocks on /authorize, /authorize/decision, and /token
   returned raw exception messages that could leak internal details
   (client IDs, redirect URIs, expected vs actual values). Now returns
   generic RFC-compliant error descriptions and logs details server-side.

* Truncate long client name. Show client id

* Non-functional nits

* Clean up

* Align and extract helper

* DRY OCD

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:04:40 -04:00
Chris Truter
40691f70d8 Faster search index sync when loading snapshots (#71410) 2026-03-25 21:42:40 +00:00
Noah Moss
f4b0e5946b Consolidate metabot-enabled checks and add them to a number of endpoints (#71366)
* consolidate metabot-enabled checks and add them to a number of endpoints

* switch describe_tests to use mbql-query helper for cards

* Remove metabot.settings namespace import
2026-03-25 21:17:14 +00:00
Noah Moss
f3a2cfab7f Query pagination for MCP (#70971)
* Combined /v1/query endpoint with pagination and continuation tokens

- Add /v1/query that combines query construction and execution in one step
- Implement continuation_token-based pagination for large result sets
- Cap agent query rows at 200 per page; pagination stops at userland limits (2k/10k)
- Refactor construct-query into shared construct-query* helper
- Move agent-api dispatch behind defenterprise seam in EE MCP tools
- Add streaming JSON-RPC support for tool results in MCP layer
- Add json-string-escaping OutputStream for embedding streamed JSON in JSON-RPC
- Move /agent route out of naughty-routes into intentional top-level-routes
- Fix SSO test_setup to handle nil server port in CLI test runner

* Remove streaming JSON-RPC, buffer all tool responses in memory

Strip the streaming code path from the MCP layer so this branch
focuses purely on the query tool and pagination. Buffering ~120KB
for 200 rows is fine for the limits we enforce.

- Remove json-string-escaping OutputStream and streaming-tool-response
- Revert MCP api.clj to synchronous Ring form (no SSE streaming)
- Move StreamingResponse materialization into EE MCP tools layer
- Simplify invoke-agent-api to handle only plain map responses
- Remove streaming-specific tests (escaping, SSE streaming, error)

* a bunch of other changes to try get the rebased build working

* Roll back a bunch of fixes from the oss branch that don't need to be fixed here

* restore code accidentally lost via multiple rebases

* update modules + lint

* strip out dead ee code

* update tool  count test
2026-03-25 16:47:10 -04:00
Nathan Voxland
817eb1d787 Roll back transform perms (#71094) 2026-03-25 15:27:25 -05:00
Nathan Voxland
89786605c1 Fixing tests and created a mq-perf script 2026-03-25 15:19:29 -05:00
Egor Grushin
8b5224136b Cypress bail (#71420)
* add bail feature to the e2e stress test flake workflow

* add bail feature to the e2e stress test flake workflow

* add bail feature to the e2e stress test flake workflow

* Update e2e/support/cypress.js

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

* renamed BAIL to FAIL_FAST, replace Cypress.env with Cypress.expose

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2026-03-25 20:11:22 +00:00
Braden Shepherdson
051c1a6b25 [Params] Always return [] for param /values requests (#71302)
Fixes #71164.

On the BE, always return an empty list rather than nil. Old models with `:id` different from `:field_ref` in their metadata could result in `{:values nil ...}` being returned, which breaks the schema and FE. See #71164 for full details.
2026-03-25 20:11:07 +00:00
Jeff Bruemmer
c3c7feeddf docs - OIDC (#70892) 2026-03-25 13:54:47 -04:00
appleby
274b7de269 Remove dangling reference to use-native-agent setting in e2e tests (#71437)
This defsettings was removed in 311b735ae5
2026-03-25 16:48:29 +00:00
Stas Gavrylov
a0bea40dab GDGT-1755: Migrate common components from deprecated Popover to Mantine Popover (#70503)
* GDGT-1755: Migrate RightClickPopover to use Mantine

* GDGT-1755: Migrate DropdownSidebarFilter to Mantine Popover

* GDGT-1755: Migrate ParameterTargetWidget to Mantine Popover

* GDGT-1755: Make DropdownSidebarFilter close on Esc press

* GDGT-1755: Migrate GroupSelect to Mantine Popover

* GDGT-1755: Migrate deprecated Select to Mantine popover to remove deprecated Popover

* GDGT-1755: Cleanup. Delete unused deprecated components

* Fix prettier

* fix: fix test failures after Popover cleanup

- Remove jest.unmock for deleted Popover module in ChartSkeleton tests
- Add missing data-testid="popover" to DropdownSidebarFilter dropdown

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* GDGT-1755: Cleanup

* GDGT-1755: Address code review comments

* Clean up Popover.module.css: keep only tippy.js global styles

Remove unused module-level classes and obsolete tether-related classes.
Import the remaining global styles in TippyPopover.tsx.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-25 18:33:12 +02:00
Nicolò Pretto
2576505465 fix flaky test in embedding hub (#71434) 2026-03-25 17:04:32 +01:00
Nick Fitzpatrick
9f5298fa9a Update TablePicker when users publish/unpublish tables, change name (#70954)
* update TablePicker when users publish/unpublish tables, change name

* refetch tables in useTableLoader

* update table owners
2026-03-25 21:27:23 +05:30
Kevin Kelleher
07f25c0cc7 Allow changing conditional formatting to color range when rule condition is set (#71079) 2026-03-25 10:59:01 -04:00
Nicolò Pretto
cfb3ab406c Implement SSO setup checklist locking for steps 2 and 3 until JWT is configured (#71345)
* Implement SSO setup checklist locking for steps 2 and 3 until JWT is configured

* remove e2e for something already covered by unit

* update checklist default values after merging master
2026-03-25 15:52:01 +01:00
Egor Grushin
a4db64b01b GDGT-2017 write watermark to the DB before setting "succeed" status t… (#71334) 2026-03-25 14:21:55 +00:00
Noah Moss
efcefcad96 Avoid sending only whitespace in a slack API request (#71391)
Don't send only whitespace to the Slack API
2026-03-25 14:09:29 +00:00
Braden Shepherdson
38b071e39d [MBQL lib] Add user docs for filter functions in lib.core (#71035)
Part of QUE2-366.
2026-03-25 14:04:28 +00:00
Braden Shepherdson
46902911c8 [QP] Change the nested query alias from source to __mb_source (#70955)
closes #70224
Fixes QUE2-396.

### Description

This is necessary because `source` is a reasonably common name for a
column, and databases diverge on how they treat a reference like
`"source"."source"`:

- Postgres et al see the relation `source` in scope, and access its
  column called `source`, and all is well.
- Athena et al:
  - See that there is a **column** `source` in scope that doesn't require a prefix.
  - Assume it's a nested column with `ROW` type, and try to access the
    nested `source` field.
  - Type mismatch! It's a string or whatever, not `ROW`.

This PR doesn't *eliminate* the problem, but there's not really anything
we can do to fix Athena's honestly pretty odd choice of how to resolve this
ambiguous parse tree. But by changing our hard-coded alias for all
nested queries from `source` to `__mb_source`, we can make it extremely
unlikely that it will collide with a column that's in scope.
2026-03-25 13:53:00 +00:00
Noah Moss
23f686e698 Include conversation history in slackbot feedback (#71359) 2026-03-25 09:47:42 -04:00
Oleksandr Solovyov
311b735ae5 clean up references to ai-service (#71353) 2026-03-25 15:33:26 +02:00
Ngoc Khuat
e2f1a1a315 Fix flaky schema-change integration test (follow-up to #70863) (#71339) 2026-03-25 21:51:33 +09:00
Alex Yarosh
1f7e4b12f7 docs: update embedding skills (#71415)
Remove development note from SSO for embeds section
2026-03-25 08:30:39 -04:00
Sébastien
178ecbaeef fixed flaky (#71405) 2026-03-25 13:22:25 +01:00
Nick Fitzpatrick
5ac346612f Small positioning adjustments to the data studio nav bar (#71379)
* Small positioning adjustments to the data studio nav bar

* pr feedback
2026-03-25 17:36:41 +05:30
Chris Truter
2ace0b69c1 Built-in MCP server (#70787)
* Add MCP server with agent API integration

Implements an MCP (Model Context Protocol) server for Metabase that exposes
agent API endpoints as MCP tools. Includes an Oauth server, SSE transport, 
session management, scope-based auth, and tool dispatch via defendpoint metadata.

Co-Authored-By: Edward Paget <edpaget@users.noreply.github.com>
Co-Authored-By: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2026-03-25 05:04:46 -04:00
Nick Fitzpatrick
6b8d7846de Update response on set token with network error (#70959)
* Update response on set token with network error

* report error message from checker when setting token

Currently when anything goes wrong during token checking while we're
setting a token, we *always* report that the token is invalid. This is
incorrect.

The token checker already gives us a descriptive `status` for the token,
which can tell the user whether the token is invalid or if we just
weren't able to check it.

One slight change here is to add `:canonical? true` to responses we
receive from MetaStore directly. This allows us to respond with the
correct HTTP status, since if we receive a response from the MetaStore
that tells us the token is invalid, that's a 400 error, where if we
weren't able to get a canonical response at all, that's a 503.

* add unit test

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2026-03-25 14:19:32 +05:30
Nathan Voxland
82f5dea54d Code cleanup 2026-03-25 02:28:42 -05:00
Chris Truter
d34d1dc9ff Fix search related testing race conditions (#71290)
Closes [BOT-1105: Search API tests fail with missing temp table](https://linear.app/metabase/issue/BOT-1105/search-api-tests-fail-with-missing-temp-table)
2026-03-25 09:10:23 +02:00
appleby
95f85256c2 BOT-1172 Fix markdown link buffering for slack links (#71388)
Fix markdown link buffering for slack links

find-potential-slack-link-start was looking for a full `<metabase://` prefix which doesn't work if the link prefix is
split across streamed text chunks. Updated it to deal with this case.
2026-03-25 00:37:50 +00:00
appleby
33661d4b6a BOT-1044 Convert links back to metabase:// format before sending to llm (#71125)
* BOT-1044 Convert links back to metabase:// format before sending to llm

This is a re-implementation of https://github.com/metabase/ai-service/pull/597

resolve-links converts metabase:// links into real URLs before sending them back to the client. When the LLM sees
these resolved URLs in the conversation history, it can get confused and start generating resolved links
itself (e.g. /question#<base64>), rather than following instructions to always use metabase:// links. This sometimes
results in wrong/hallucinated base64 repr, especially in longer conversations where many resolved links accumulate in
the history.

With this commit, we add a link-registry to the agent state to record every link rewritten by resolve-links, and use
invert-links to restore them to metabase:// URIs in the message history before sending it to the LLM for completion.

* Simplify state management for link-registry-atom

We don't need to track it separately in the agent state in init-agent. Just extract it from the agent memory in
the loop-step and sync it back after the llm call.

* Only invert urls in markdown links

* Replace handcrafted legacy MBQL in markdown_link_buffer_test.clj

* Mark deftests ^:parallel in markdown_link_buffer_test.clj

* Mark deftests ^:parallel in links_test.clj and breakup into smaller deftests

* Replace handcrafted legacy MBQL in links_test.clj

* Move resolve-slack-links into metabot.agent.links ns

To match existing resolve-links handling for generic metabase links

* Use with-temporary-setting-values to override site-url in markdown_link_buffer_test.clj

To match existing conventions in the codebase.

* Consolidate with-temporary-setting-values and breakup deftests in markdown_link_buffer_test.clj

* Record slack links into the registry map and invert them before sending history back to the llm

See f90619f5e2

* Fix agent memory initialize-test

* review feedback: extract part->invert-links-key helper
2026-03-24 23:41:03 +00:00
github-automation-metabase
d39d8c5800 Auto-update documentation for master (#71389)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-24 18:06:41 -04:00
Ryan Laurie
60da7517d1 Allow toggling auto releases via variable (#71313)
allow toggling auto releases via variable
2026-03-24 15:58:32 -06:00
appleby
ea43a75160 Fix metabot snowplow test flakes (#71337)
Fix snowplow test flakes

In call-llm-snowplow-test and call-llm-structured-snowplow-test filter the snowplow events to remove potential
new_instance_created events.
2026-03-24 17:23:04 -04:00
Noah Moss
77f28324a0 Add saved question display type to metabot context (#71372)
add saved question display type to metabot context
2026-03-24 20:14:19 +00:00
metamben
778dcf54a1 Introduce config option to specify known hosts for SSH tunnels (#71194)
* Introduce config option to specify known hosts for SSH tunnels

Closes QUE2-424
2026-03-24 22:44:56 +03:00
Alex Yarosh
161ebe81d5 docs: tenant example (#71365)
* Refine tenant attributes and permissions documentation

* Update docs/embedding/tenants.md

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

* Update docs/embedding/tenants.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2026-03-24 15:38:54 -04:00
Jeff Bruemmer
1dbfa65885 docs - agent API oss (#71380)
* oss and session

* link

* update
2026-03-24 14:51:59 -04:00
Cam Saul
8cb8e93394 Update GH teams config + modules config for Querying Platform (#71182) 2026-03-24 18:25:45 +00:00
Cam Saul
afc8eb428e Fix Snowflake Netty code scanning alert (#71309)
* Fix Snowflake Netty code scanning alert

* Dummy commit to trigger CI
2026-03-24 18:18:05 +00:00
Anderson
1fbe726c08 Fix ARIA grid role hierarchy in DataGrid for accessibility compliance (#70978)
* Fix aria-expanded on dashboard filter trigger button (#70543)

Closes https://github.com/metabase/metabase/issues/70543

### Description

Move aria-expanded from a wrapper div to the actual trigger button element
for dashboard filter popovers. Mantine's Popover.Target injects
aria-expanded via cloneElement onto its direct child. Previously, a Box
wrapper div was the direct child, so aria-expanded landed on a
non-interactive div instead of the button. This restructures the
component hierarchy so ParameterValueWidgetTrigger (which renders as a
button) is the direct child of Popover.Target, and moves the Sortable
wrapper outside the Popover.

### How to verify

1. Open a dashboard with filter parameters
2. Inspect the filter trigger button element in the DOM
3. Verify aria-expanded is on the button element (not a wrapper div)
4. Click the filter to open the popover and confirm aria-expanded
   toggles to true on the button

### Checklist

- [x] Tests have been added/updated to cover changes in this PR

* Fix ARIA grid role hierarchy in DataGrid for accessibility compliance (#70547)

Closes https://github.com/metabase/metabase/issues/70547

### Description

The DataGrid component had an invalid ARIA role hierarchy: `role="button"`
elements (from dnd-kit's useSortable) were nested directly inside a
`role="grid"` element without proper intermediate roles. Per the WAI-ARIA
grid pattern, the hierarchy must be: grid > rowgroup? > row > gridcell/columnheader.

This commit:
- Adds `role="rowgroup"` to header and body container divs
- Adds `role="row"` to the header row div
- Adds `role="columnheader"` to header cell wrapper divs in DataGrid
- Adds `role="gridcell"` to body cell wrapper divs in DataGrid
- Strips the invalid `role="button"` that dnd-kit injects into SortableHeader
- Removes now-redundant role attributes from HeaderCellWrapper and BodyCell
  (roles are now correctly placed on their parent wrapper elements)

### How to verify

1. Open any dashboard with a table/grid visualization
2. Inspect the DOM of the table-scroll-container element
3. Verify the ARIA role hierarchy follows: grid > rowgroup > row > columnheader/gridcell
4. Run an accessibility audit tool and confirm no `role="button"` violations inside the grid

* Keep button role in sortable header (it's ok since it's not wrapping the columnheader)

* Clean up

* Add unit test

* Fix a few tests

* Fix more e2e tests broken by ARIA role changes

* Fix more e2e tests

* Fix embedding-native.cy

* Another e2e test fix batch

* Fix e2e tests (again)

* fix reproductions-3.cy.spec.js
2026-03-24 15:05:33 -03:00
Jeff Bruemmer
2aec3aa887 Update agent API reference documentation (#71360)
* Update agent API reference documentation

Removed requirement for Metabase Pro/Enterprise from documentation.

* path
2026-03-24 17:36:43 +00:00
Nicolò Pretto
446de63944 feat(embedding-hub): add "copy dashboard to shared tenant collection" step (#70726)
* wip

* wip3

* test ci

* update tests

* remove code from tests

* sort xray dashboards

* cleanup

* clean up tests

* small refactor

* more cleaning up

* keep step disabled if  tenants is not active
2026-03-24 16:18:41 +01:00
Oleksandr Solovyov
08717ff883 closing-connection-native-agent-test: lower amount of chunks we check for (#71354) 2026-03-24 16:38:06 +02:00
Chris Truter
ccef0576f9 Calculate init time reliably (#71356) 2026-03-24 14:16:25 +00:00
github-automation-metabase
1b12502ec3 Revive and merge PR #67694: disable sync_schema side-effect in db-operations-test (#71201)
Fix H2 lock timeout in db-operations-test by mocking sync task

Split the monolithic db-operations-test into three focused tests:
- non-admin-sync-schema-test: mocks quick-task/submit-task! to prevent
  the actual sync job from running, eliminating the race condition with
  DATA_PERMISSIONS cleanup in mt/with-all-users-data-perms-graph!
- non-admin-discard-field-values-test: isolated test for discard_values
- non-admin-rescan-field-values-test: isolated test for rescan_values

Also renames update-database-test, delete-database-test, and fetch-db-test
to non-admin-* for consistency, and adds explicit permission-denial (403)
test cases to each test.

Revives the fix from closed PR #67694.
2026-03-24 14:00:45 +00:00
Braden Shepherdson
b42c2f6605 [QP] Override LIMIT for pivot queries to ensure consistent results (#71033)
Closes #70963
Fixes QUE2-431.

Previously, pivot queries got the same default row limits added as any
aggregated query. But since pivot queries synthesize the results from
several inner queries with different subsets of breakouts, they
have different row counts.

The main ("row details") query the user wrote has all the breakouts,
so it has the most rows. If that query gets truncated, only a subset
of the data is returned, leaving gaps in the pivot table. Worse, the
sub-queries with other subsets of the breakouts, intended to collect
group, column and row subtotals, and the grand total, are inconsistent
with the details in the cells, and with each other, because they can
all end up `SUM`ing (etc.) over different sets of the raw rows.

With this change, a new and much larger row limit is permitted for the
pivot sub-queries. The pivot table viz contains one cell for each
aggregation in the query, multiplied by the rows of the main query.
We budget for **200k cells**, divide by the number of aggregations,
and that becomes the row limit.

If the row details query reaches that limit, the query is rejected:
- Other sub-queries are skipped
- A `pivot-rows-truncated` flag in the results signal the FE
- Which shows an error suggesting the user add a filter or remove
  breakouts to lower the row count.

Some reasonable pivot queries might still be excluded, but now we never
run a pivot query with incorrect data in it. If we execute the query and
render the pivot results, then all the returned data should be correct.
2026-03-24 13:45:34 +00:00
Nick Fitzpatrick
cfa96f3fe0 Catch drag events on Dashcard placeholders (#71274)
* Catch drag events on Dashcard placeholders

* scope drag events, add test
2026-03-24 18:46:31 +05:30
github-automation-metabase
3f55d1b9f4 Use env var indirection in Loki stress-test workflow (#71349)
Fix script injection via env var indirection in loki-stress-test-flake-fix.yml
2026-03-24 13:48:02 +01:00
Nemanja Glumac
acbf9bcc88 Delete Claude bug fix workflow (#70993) 2026-03-24 12:52:30 +01:00
Uladzimir Havenchyk
442cf4abb9 fix: cross branch migration workflow (#71153) 2026-03-24 14:31:51 +03:00
Kamil Mielnik
aee64c6047 GDGT-1869 Remove "as VisualizationSettingsDefinitions" casts (#71217) 2026-03-24 17:30:47 +07:00
Nicolò Pretto
41ca038f67 feat(embedding hub): add ability to hide sidebar for some pages (#71278) 2026-03-24 10:09:27 +01:00
Chris Truter
a0896d1faf Fix clickhouse test flake (#71306) 2026-03-24 10:26:47 +02:00
Nathan Voxland
ad62aed71a Cleaning up code 2026-03-24 02:15:25 -05:00
Nathan Voxland
3ab76adf8d Merged from master 2026-03-24 01:36:35 -05:00
Nathan Voxland
1f019c1e10 Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	enterprise/backend/src/metabase_enterprise/action_v2/data_editing.clj
#	enterprise/backend/test/metabase_enterprise/action_v2/api_test.clj
#	enterprise/backend/test/metabase_enterprise/agent_api/api_test.clj
#	enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.clj
#	enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.clj
#	src/metabase/analytics/prometheus.clj
2026-03-24 01:28:52 -05:00
Nathan Voxland
3e4335a798 Merge remote-tracking branch 'origin/persistent-queue' into persistent-queue 2026-03-24 01:19:44 -05:00
Nathan Voxland
70967125aa Code cleanup 2026-03-24 01:16:36 -05:00
Nathan Voxland
5921542894 Code cleanup 2026-03-24 01:05:12 -05:00
Romeo Van Snick
c8cb9c2f04 Remove sync buttons for managed cloud databases (#71203)
* Remove sync buttons for managed cloud databases

* Remove sync settings button for table in attached data warehouse in admin > table metadata and data studio
2026-03-24 14:17:29 +11:00
Fraser
b8c90cdfbe Push shared files down from feature modules (#71137) 2026-03-24 15:24:34 +13:00
Romeo Van Snick
0ab5a0f603 Fix parameter tags reordering in the presence of snippet tags (#71209)
* Disregard snippet tags when reordering parameters

* Add repro for metabase#69160

* Wording

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2026-03-24 11:59:52 +11:00
Riley Thompson
8f9282dca1 Don't generate join alias that matches source table name (#70876)
* include source name in taken names

* add test

* Update src/metabase/lib/join.cljc

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* fix tests

* fix test

* Fix test metadata for self-join test

* e2e test fix attempt

* second attempt

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2026-03-24 00:39:09 +00:00
Nathan Voxland
8c572f77f4 Fix race conditions in submit-delivery! and topic offset advancement
- submit-delivery!: atomic busy-check and registration via single swap!
  to prevent concurrent handlers for the same channel
- start-worker-pool!: use compare-and-set! to prevent pool leak on
  concurrent initialization
- Topic backends: only advance offset when submit-delivery! returns true,
  preventing silent message loss when channel is busy
2026-03-23 19:10:23 -05:00
bryan
c8560d8251 Models to transforms (#70735)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2026-03-23 23:59:16 +00:00
Nathan Voxland
7e5bb21c3d Fix high-priority issues: retry flush failures, non-blocking batch processing, atomic after-commit drain
- Publish buffer: re-buffer messages on flush failure instead of dropping them, with Prometheus counter
- Queue/topic processing: centralized non-blocking dispatch via shared worker pool in mq.impl, with busy-channel tracking so poll threads never block on listener execution
- Queue heartbeats: poll thread updates status_heartbeat every 2min for in-flight batches to prevent stale recovery during long processing
- After-commit callbacks: atomically drain with reset-vals! loop to support callbacks that register new callbacks
- Document all-or-nothing ACK semantics on queue bundle retry in handle! docstring
2026-03-23 18:58:14 -05:00
appleby
74a9d5baeb BOT-1157 Update metabot prometheus and snowplow metrics to include both provider and model (#71259)
We now report the full provider and model rather than just the model, e.g.

    anthropic/claude-haiku-4-5 -> openrouter/anthropic/claude-haiku-4-5
    claude-haiku-4-5           -> anthropic/claude-haiku-4-5

In addition to being useful info to capture, this matches the behavior of the pre-existing ai-service metrics.
2026-03-23 16:42:40 -07:00
bryan
fb428f307e Extend ci-report to accept branch names and commit SHAs (#70742) 2026-03-23 15:50:21 -06:00
Jeff Bruemmer
e50748827a docs - sdk playground (#71314)
* sdk playground link

* edit

* image

* Optimized 1 images, saved 188.7 KB (35.5% smaller)

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2026-03-23 21:48:31 +00:00
Ben Grabow
9ec99afb69 Ghy-3258/table tag dependencies missing in incremental transforms (#71316)
Include table tags as dependencies of native queries
2026-03-23 16:40:06 -05:00
Oleksandr Solovyov
c2ad36cccb move ee/llm into oss (#71068)
* move ee/llm into oss

* lots of file movement

* move slack connect to opensource

* ability to have enterprise-only tools

* move tests

* Fix stale metabot-v3 aliases, dangling module refs, disabled linting, broken test paths, and typo

* start using deprecated-name, more ns path fixes

* move llm transforms code to oss

* fix namespaces

* whitespace fix

* checkpoint: switch tools to use mu/defn or defenterprise directly

* compilation fix

* lint fixes

* move around some code to break drivers dependency

* fix tests

* fix tool calls

* sort routes

* fix openapi

* fix module config

* lint

* fix clj-kondo

* fix test

* fix token check tests

* cljfmt

* fix slack test

* maybe fix dashboard tests?

* cljfmt

* is this a fix for dashboard tests

* move metabot models to oss

* untangle module config after rebase

* fix module order

* cleanup

* add back ai service-related settings that are still used

* move some more code to more appropriate places

* more code movement

* better schema names

* clean up mu/defn function name formatting

* update module config

* remove unneeded ai service-related test

* fix module config again

* fix auth in tests by removing more ai service stuff

* enable native agent by default

* test transforms over normal function calls

* requires

* pass through metabot-id to tool calls instead of hardcoding embedded-metabot-id, to fix answer sources test

* fix wrap-tools-with-state calls

* try to fix failing field/dashboard tests by matching the code on master (might have been from a bad rebase)

* Revert "try to fix failing field/dashboard tests by matching the code on master (might have been from a bad rebase)"

This reverts commit cd5ec8b487.

* hard revert parameters.dashboard-test to the version on master after the latest rebase

* mark snippet tests as sequential to try to fix perms test issues, remove a couple stray metabot feature checks

* move entity analysis + sql fixing code to oss

* wrap dashboard tests with with-full-data-perms-for-all-users to isolate the failure

* move ai-entity-analysis and ai-sql-fixer under the metabot module

* fix module test

* remove now-unneeded ai feature falgs

* disable perms cache for these failing dashboard tests

* simplify test that was still using agent-api feature flag

* memoize spec-index-query by app db to fix failing search tests caused by new test execution order

* LLM OSS FE (#71197)

* bulk move files

* replace usage of /ee/metabot-v3/ to /metabot

* remove PLUGIN_METABOT

* fix broken metabot routes, removes metabot_v3 token feature usage

* remove PLUGIN_AI_*

* bring back enterprise vs oss behavoir, with the code still being OSS

* fix lint + unit tests

* fix embedding sdk stories

* add back missing FixSqlQueryButton.unit.spec.tsx test

* fix last references of `/ee/ai-*` endpoints

* pr feedback

* test fix

---------

Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
2026-03-23 17:30:50 -04:00
Chris Truter
76b01b772b Define additional metrics for release monitoring (#71237) 2026-03-23 17:20:34 -04:00
Noah Moss
733176c925 Add cancelled check for sdk-tests (#71307) 2026-03-24 10:03:27 +13:00
Ryan Laurie
88a87db2b8 Sanitize database details during serialization import (#71311)
[59] Sanitize database details during serialization import (#335)

* Sanitize database details during serialization import

Strip low-level JDBC keys (classname, subprotocol, connection-uri, subname,
init) from database details during serialization import and reject h2 engine.

Also add subname and init to the connection-details dispatch blocklist and
sanitize details in h2 connection-details->spec as defense in depth.

* Use custom runners

* fix error printing and test

* rebind assert-not-h2! during tests

* kondo ignore

---------



# Conflicts:
#	.github/workflows/backend.yml
#	.github/workflows/cross-branch-migrations.yml
#	.github/workflows/tusk-sanity-check.yml

Co-authored-by: Nicola Mometto <nicola.mometto@metabase.com>
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2026-03-23 14:40:06 -06:00
Ryan Laurie
45380db283 Send release jars to cloud bucket (#71093)
* update var

* do it in the tag step
2026-03-23 14:29:58 -06:00
metamben
84b79b9126 Reorganize QP module (#70808)
* Introduce qp.core and qp.test namespaces
2026-03-23 20:14:12 +00:00
Nathan Voxland
2c8c0e30aa Better consolidation of topic vs queue logic 2026-03-23 14:44:03 -05:00
Nicola Mometto
d6d3bbb89a Fix bug with temporal values in bigquery incremental transforms (#71291)
* fix: coerce temporal values used in incremental transforms filters

* fallthrough on LocalDateTime

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2026-03-23 18:41:40 +00:00
Alex Yarosh
1bb4b60d60 docs: workflow schedule (#71305)
docs workflow schedule
2026-03-23 14:33:38 -04:00
Sébastien
1827c0c37d Fixed dancing MB (#71211) 2026-03-23 16:48:56 +01:00
github-automation-metabase
5dd6f68c46 Fix title escaping for JSON (#71289) 2026-03-23 16:08:50 +01:00
Nemanja Glumac
c85d47365d Remove hard-coded Trivy version (#71287) 2026-03-23 15:03:46 +01:00
github-automation-metabase
17bca77f06 Auto-update documentation for master (#71268)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-23 09:19:13 -04:00
Jakub Chodorowicz
4c4c049ac8 update copy and styling of table variable select (#71101)
* update copy and styling of table variable select

* extract common LabelWithInfo component

standardize styling
2026-03-23 13:13:42 +01:00
Kevin Kelleher
38fa86db3f Fix scatter plot flicker on hover (#71036) 2026-03-23 07:38:27 -04:00
Nemanja Glumac
ac3a38209f Patch vulnerable Trivy action (#71282)
Resolves DEV-1712

Patches Trivy GitHub action to a version that is confirmed not to be affected by the supply chain attack. We're using SHA-1 instead of a tag for an improved security.

See: https://app.mendral.com/insights/01KM6NFNZPV1JS72KAPCA2K9XH
2026-03-23 12:22:55 +01:00
Chris Truter
c568186ebc Only run Eastwood (test) on master (#71232) 2026-03-23 12:30:13 +02:00
Nicolò Pretto
a49e97237f add ability to hide Our analytics in MiniPicker and hide it in the table picker in the embedding setup (#70920)
* add ability to hide Our analytics in MiniPicker

* remove changes not needed

* update getOurAnalytics with the values from EntityPicker
2026-03-23 11:12:55 +01:00
Fraser
f1c36719aa Move shared query_builder logic to querying (#71129) 2026-03-23 09:22:12 +00:00
Sébastien
292a667717 Fixes a loki flaky (#71225)
* loki flaky

* .

* .

* fonts
2026-03-23 10:02:28 +01:00
Kamil Mielnik
361549c5af GDGT-2024 Consolidate ChartSettingsWidget's noPadding, marginBottom, and borderBottom (#71154) 2026-03-23 14:25:07 +07:00
Romeo Van Snick
c009e25907 Fix timeline form icon input (#71199)
* Add icon to timeline icons

* Use Select from mantine/ui for timeline form

* Add test for icon in timeline creation
2026-03-23 16:21:20 +11:00
Romeo Van Snick
e13fd47144 Convert dataref to ts (#71062)
* Convert dataref to ts

* Fix unit test

* Fix actions

* Fix field reference

* Fix native data reference

* Fix field pane
2026-03-23 13:01:43 +11:00
metabase-bot[bot]
2812c4496d [chore] Update E2E test timings with recent data (#71265)
Update E2E test timings with averaged data

Collected timing data from 7 days of test runs.
All specs with timing data were included (simple averages).

🤖 Generated automatically by update-e2e-timings workflow

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>
2026-03-23 10:11:46 +13:00
Nathan Voxland
28093ce803 Support Group Sync in OIDC (#71176) 2026-03-21 00:24:40 -05:00
Nathan Voxland
a649b08171 Field filter does not show dropdown values (#71114) 2026-03-21 00:23:58 -05:00
Egor Grushin
7a7585be68 Gdgt 1864 Add pinned columns and rows to the DataGrid (#70384) 2026-03-21 02:10:09 +00:00
Anderson
6b241a18fd Fix dashboard tab list items having role="button" instead of role="tab" (#70546) (#70976)
* Fix aria-expanded on dashboard filter trigger button (#70543)

Closes https://github.com/metabase/metabase/issues/70543

### Description

Move aria-expanded from a wrapper div to the actual trigger button element
for dashboard filter popovers. Mantine's Popover.Target injects
aria-expanded via cloneElement onto its direct child. Previously, a Box
wrapper div was the direct child, so aria-expanded landed on a
non-interactive div instead of the button. This restructures the
component hierarchy so ParameterValueWidgetTrigger (which renders as a
button) is the direct child of Popover.Target, and moves the Sortable
wrapper outside the Popover.

### How to verify

1. Open a dashboard with filter parameters
2. Inspect the filter trigger button element in the DOM
3. Verify aria-expanded is on the button element (not a wrapper div)
4. Click the filter to open the popover and confirm aria-expanded
   toggles to true on the button

### Checklist

- [x] Tests have been added/updated to cover changes in this PR

* Fix dashboard tab list items having role="button" instead of role="tab"

Closes https://github.com/metabase/metabase/issues/70546

### Description

The Sortable wrapper around each dashboard tab item was applying a default
`role="button"` to its container div, which overrode the inner TabButton
`role="tab"` from the perspective of screen readers and accessibility tools.
Changed the Sortable wrapper to use `role="presentation"` so it is transparent
to the accessibility tree, allowing the inner TabButton role="tab" to be
properly recognized within the role="tablist" container.

### How to verify

1. Open a dashboard with multiple tabs
2. Inspect the tab items in the browser DevTools
3. Verify that tab items have `role="tab"` (not `role="button"`)
4. Verify the tab list container has `role="tablist"`

### Checklist

- [x] Tests have been added/updated to cover changes in this PR

* Add issue number to test titles (#70546)

* Improve test

* Clean up
2026-03-20 20:19:30 -03:00
Ryan Laurie
b9573fc138 Use Local DigiCert for docker container builds (#71095)
use local cert

# Conflicts:
#	Dockerfile
#	bin/docker/Dockerfile
#	bin/docker/Dockerfile_ubuntu
2026-03-20 21:55:40 +00:00
Ben Grabow
8d41c7d068 Disallow adding new classpath resources as geojson paths (#70745)
* Disallow adding new classpath resources as geojson paths
2026-03-20 21:16:01 +00:00
Ben Grabow
e0365e3297 Revert "Temporarily disable app db version checks" (#71191)
Revert "Temporarily disable app db version checks (#70884)"

This reverts commit c5dcdc3238.
2026-03-20 15:36:19 -05:00
Braden Shepherdson
6b6ea19ab7 [MBQL lib] Add user docs for breakouts functions (#71034)
Part of QUE2-366.
2026-03-20 19:56:00 +00:00
Uladzimir Havenchyk
5a142f6eb1 add a workflow to publish custom viz npm package (#71221)
* add a workflow to publish custom viz npm package

* trigger CI
2026-03-20 12:32:56 -06:00
ignacio
cfacacd556 Update account settings docs (#71240)
This is currently doable in version 59.3.



See this issue: https://github.com/metabase/metabase/issues/63581
2026-03-20 15:22:12 -03:00
Uladzimir Havenchyk
a9b9ad9d85 chore: convert isa.js to typescript (#71014)
* chore: convert isa.js to typescript

* address comments

* address review

* revert back broken checks

* fix review
2026-03-20 20:35:23 +03:00
Chris Truter
68ec84ae4d Make all model imports and exports explicit (#71224) 2026-03-20 09:58:44 -07:00
Jakub Chodorowicz
6724b20a7b enable transform inspector only with advanced (python) transforms (#71067)
hide inspect tab when it's not supported by current features
2026-03-20 17:40:50 +01:00
Edward Paget
dd34d56120 fix: cancel serialization when client disconnects (#69864)
* fix: cancel serialization when client disconnects

Co-Authored-By: John Swanson <john.swanson@metabase.com>

* fix: complete serialization virtual thread streaming response

- Fix channel signal direction: use >!! to write to done-chan instead of <!! (read)
- Fix streaming response: use io/copy instead of .write for File objects
- Set explicit 200 status on success, set-status!/set-content-type! on error path
- Add Content-Disposition header on success for proper download behavior
- Clean up temp files on cancel and use finally for deterministic cleanup
- Remove commented-out old synchronous code
- Use canonical clojure.core.async alias (a instead of async)
- Add server module to enterprise/serialization allowed dependencies
- Relax full_stacktrace test threshold (200 -> 50 lines) to avoid JVM-dependent flakiness

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2026-03-20 11:28:41 -05:00
Braden Shepherdson
3559ec98b0 [QP] Do coercions (eg. Unix timestamps) with native sandboxing (RCLS) (#70885)
Fixes QUE2-376.

For MBQL queries, type coercions (like integers to Unix timestamps) only
get applied on the earliest stage where that field is introduced. When
the table the field comes from is sandboxed by a native query, an
extra stage is introduced but it doesn't do the coercion.

Decorates the metadata of any native sandbox column whose table counterpart had coercion defined.

It's unfortunately complicated inside lib since the metadata needs to be propagated through exactly one
stage boundary. If it propagates all the way then we get double-coercion and SQL errors.
2026-03-20 16:24:21 +00:00
Jeff Bruemmer
bc80f935a2 docs - transform inspector (#71188)
* draft

* edits

* edits

* toc

* Optimized 3 images, saved 326.0 KB (47.1% smaller)

* Update docs/data-studio/transforms/transform-inspector.md

Co-authored-by: Alex Yarosh <alexandra@metabase.com>

* edits

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2026-03-20 12:19:19 -04:00
github-automation-metabase
d0ac061fee Fix trivy action tag prefix (#71213)
fix: use v prefix on aquasecurity/trivy-action@v0.29.0 tag reference
2026-03-20 09:17:26 -06:00
Jeff Bruemmer
0cdcd2232c docs - agent resources for embedding (#71108) 2026-03-20 10:40:15 -04:00
Sébastien
8de615a69d Fixed empty csv for adhoc pivot tables in SDK (#71141) 2026-03-20 14:28:59 +01:00
Uladzimir Havenchyk
24968aa972 build: use a proper link for cert download (#71064) 2026-03-20 16:22:23 +03:00
Ngoc Khuat
a3ae3ba1f4 Transform inspector reorganization (#71136) 2026-03-20 10:34:24 +00:00
Nicola Mometto
22b6962656 default transforms impls with informative errors (#71145)
feat: provide default transforms impls with informative errors
2026-03-20 10:14:14 +00:00
Nicolò Pretto
94be4bfae3 Emb 1450 simplify sdk e2e test commands and docs (#71168)
* remove the embedding dev command and update the docs

* fix typo
2026-03-20 09:42:10 +01:00
Ngoc Khuat
39bc014f14 Server-side rendering for comment emails (#70938) 2026-03-20 07:55:16 +00:00
Fraser
4864f0ae24 Revert "Further pdf export improvements" (#71208)
Revert "Further pdf export improvements (#71031)"

This reverts commit 536d6bf22f.
2026-03-20 19:45:09 +13:00
Aleksandr Lesnenko
cd7eb82bdb remove emotion from browse pages (#71184) 2026-03-20 06:43:45 +05:30
Nick Fitzpatrick
536d6bf22f Further pdf export improvements (#71031)
* use cssText

* include font props on <text>, <tspan>, and <textPath> nodes
2026-03-20 05:59:35 +05:30
Anderson
ac092618ac Hide 'New metric' and 'Publish a table' actions on Data Studio Library empty state when in read-only mode (#71112)
* Fix: Hide metric creation and table publishing actions in read-only mode

In read-only instances (remote sync read-only mode), the Library still showed:
- 'New metric' action link in the Metrics empty state
- 'Publish a table' action button in the Data empty state
- 'New snippet' action link in the SQL snippets empty state

While the +New button was already hidden in read-only mode, the empty state
action links were not checking for this permission, allowing users to attempt
actions that should be disabled.

Changes:
- Add read-only mode check to EmptyStateAction component in LibrarySectionLayout
- Empty state actions now return null when in remote sync read-only mode
- Add e2e test to verify actions are hidden in read-only mode

* Refactor: use hideAction param and call-site guard instead of returning null from EmptyStateAction

Leverage the existing third param of createEmptyStateItem to suppress
actionUrl for metrics/snippets in read-only mode (consistent with how
the snippet tree handles it). Guard the 'Publish a table' button at
the EmptyStateAction call site in LibrarySectionContent, outside the
component itself. Reorganise the e2e test into the empty state describe
block.
2026-03-19 20:34:20 -03:00
Tyler Plude
03a09e1832 BOT-1127 Metabot Conditional Tool Schema Params (#71050)
* conditional tool schema input params

* simplify feature-available?

* unit tests

* applying to other search tools
2026-03-19 16:01:59 -07:00
Chris Truter
cc74f66a1b Restrict which models are accessible by each module (#71010) 2026-03-19 21:08:20 +00:00
John Swanson
bfa572ec6b Metric viewer can use metrics based on cards (#71107)
[UXW-3260: Metrics from models/table questions are not viewable in the Metrics viewer](https://linear.app/metabase/issue/UXW-3260/metrics-from-modelstable-questions-are-not-viewable-in-the-metrics)
2026-03-19 12:22:17 -08:00
Romeo Van Snick
fb38572a8c Fix flaky test in sidebar content (#71135)
Fix flaky test
2026-03-20 07:11:37 +11:00
lbrdnk
a02acabac1 Add database_engine to enhanced tables (#70968) 2026-03-19 20:59:15 +01:00
Rodrigo López Dato
198cd9a9a3 Remove X-Metabase-Session from autogenerated API docs in favor of X-API-Key (#71155)
* X-API-Key capitalization in docs

* Use X-API-Key instead of X-Metabase-Session in Scalar API docs
2026-03-19 19:32:45 +00:00
Eric Normand
c9c7f230fb Fix string field IDs leaking into bulk-metadata queries (#71167)
Add pos-int? guard to all-implicitly-joined-field-ids pattern match,
matching the guard already used by all-field-ids. String field names
(e.g. from native/model sources) were being collected and passed to
bulk-metadata, causing Postgres type mismatch errors.
2026-03-19 13:58:07 -05:00
Aleksandr Lesnenko
e1608e708d Add skill to migrate emotion to mantine and css modules (#71173)
add skill to migrate emotion to mantine and css modules
2026-03-19 14:21:59 -04:00
Chris Truter
213b1b5905 Add mechanism for more reliably renaming settings (#71088) 2026-03-19 14:12:31 -04:00
Eric Normand
42fdf326b6 Fix StackOverflowError in deduplicated column name resolution (#71096)
Add a dynamic guard `*in-deduplicated-column-resolution?*` and convert the
mutual recursion between `resolve-nonexistent-deduplicated-column-name` and
`resolve-from-previous-stage-or-source` into a loop. Previously, resolving
a field like `name_5000` would create O(N) deep mutual recursion, overflowing
the JVM stack at ~3000-4000 frames.
2026-03-19 12:24:47 -05:00
Anderson
3969de09bb Enable keyboard navigation in dashcard download data popover (#70541) (#70965)
* Enable keyboard navigation in dashcard download data popover

* Use mantine's Menu.Sub for submenus in DashCardMenu
2026-03-19 13:22:04 -03:00
bryan
99548507aa Add ci:run-<driver> and ci:run-all-drivers labels to mage driver decisions (#70894)
* Add ci:run-<driver> and ci:run-all-drivers labels to mage driver decisions

Allow force-running specific drivers or all drivers via PR labels,
overriding quarantine. Inserted at priority 3 (after H2/Postgres
always-run, before quarantine check). Added Labels of Interest and
All Drivers sections to help output.

* Add hint about ci:run labels in CI driver decisions output

Shows a helpful message in CI logs pointing users to the new labels
and the local help command for more info.

---------

Co-authored-by: Ben Grabow <ben.grabow@gmail.com>
2026-03-19 16:07:07 +00:00
Edward Paget
e0a2e2a80a fix: remove logging from session api (#70444) 2026-03-19 11:03:02 -05:00
Edward Paget
b8805a8d92 feat: admin password reset link for users (#70464)
* feat: admin password reset link for users

* fixup! add missing dep to modules.edn

* fixup! response schema position

* fixup! reset e2e tests

* fix: store temporary password in Redux after no-SMTP password reset

The handleResetConfirm function called updatePassword via RTK Query but
never dispatched storeTemporaryPassword, so the temporary password modal
never appeared.

* fix: replace smart quotes with straight apostrophes in password reset modal

The modal title and body strings used Unicode RIGHT SINGLE QUOTATION MARK
(U+2019) instead of ASCII apostrophe, causing E2E tests to fail on text
matching.

* fix: correct reset URL assertion in e2e test

The test expected "password-reset" but the actual URL path is
"reset_password".
2026-03-19 10:30:32 -05:00
Braden Shepherdson
90042b1f02 [MBQL lib] User docs for aggregation functions (#70515)
Part of QUE2-366.

Adds user-facing documentation for aggregations functions in `lib.core`.
2026-03-19 14:26:22 +00:00
Kamil Mielnik
55144d12be GDGT-2001 Get rid of VisualizationSettingDefinition["default"] (#71015) 2026-03-19 14:08:16 +00:00
Stas Gavrylov
91ca661215 GDGT-2037: Fix CssVarsDeclarationPlugin crashing dev server on missing files (#71139)
* Fix CssVarsDeclarationPlugin to not break on build if file is missing

* Fix path to color-keys file

* Add CssVarsDeclarationPlugin warning comments to referenced source files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 14:03:29 +00:00
github-automation-metabase
b42f3332c0 Auto-update documentation for master (#71128)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-19 09:32:36 -04:00
Nicola Mometto
4937134c3e Batch metabase_table update migration (#70996)
* fix: batched metabase_table update on data_layer

* don't replace inline

* preserve

* no need for rollback in liquidbase

* run outside of a transaction

* runInTransaction:false
2026-03-19 12:05:42 +00:00
Jakub Chodorowicz
ebbc0adc70 display sql transforms errors in editor (#71092)
* update setupCardDataset to use named params

* display sql transform errors in editor

* improve mock data in test

* use isObject helper
2026-03-19 11:10:33 +00:00
Nicolò Pretto
45cd62fe3e remove claude from mise as it's not a required tool (#71138) 2026-03-19 10:22:47 +01:00
Jakub Chodorowicz
2d250a7a71 change incremental transform copy (#71103) 2026-03-19 09:59:14 +01:00
Chris Truter
7ecba8f6d4 Create table entries for transform targets on save (#70552) 2026-03-19 08:09:03 +00:00
Aleksandr Lesnenko
e53b32e245 stacked series (#70682) 2026-03-19 00:49:25 +00:00
Edward Paget
48d1a7c36e fix: handle recycled jetty http response objects (#70674)
* fix: handle recycled jetty http response objects

In the streaming response handler. Make sure that the response object is
both committed and that its AsyncContext has not been timedout.
Attempting the write after the timeout results in an NPE.

* fixup! missing reify method

* make async-context-completed? private
2026-03-18 16:37:35 -05:00
Anderson
d2406bf64b Fix aria-expanded on dashboard filter trigger button (#70543) (#70973)
* Fix aria-expanded on dashboard filter trigger button (#70543)

Closes https://github.com/metabase/metabase/issues/70543

Move aria-expanded from a wrapper div to the actual trigger button element
for dashboard filter popovers. Mantine's Popover.Target injects
aria-expanded via cloneElement onto its direct child. Previously, a Box
wrapper div was the direct child, so aria-expanded landed on a
non-interactive div instead of the button. This restructures the
component hierarchy so ParameterValueWidgetTrigger (which renders as a
button) is the direct child of Popover.Target, and moves the Sortable
wrapper outside the Popover.

1. Open a dashboard with filter parameters
2. Inspect the filter trigger button element in the DOM
3. Verify aria-expanded is on the button element (not a wrapper div)
4. Click the filter to open the popover and confirm aria-expanded
   toggles to true on the button

- [x] Tests have been added/updated to cover changes in this PR

* Wrap dashboard filter items in a list container for a11y
2026-03-18 17:30:40 -03:00
Kevin Kelleher
c62b32e78f Fix pivot text overlapping when next header column is collapsed (#71104) 2026-03-18 15:49:56 -04:00
Noah Moss
241e1fb189 Better error logging for slackbot (#71098) 2026-03-18 14:23:36 -05:00
Rodrigo López Dato
db25f8fa80 Docs: improve embedding appearance theming section (#70967)
* Docs: improve embedding appearance theming section

Rewrite the basic theming section for clarity: rename to "Dark mode and
light mode", simplify the explanation, and preserve the old
#basic-theming anchor for existing links.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update docs/embedding/appearance.md

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2026-03-18 18:35:09 +00:00
Ben Grabow
86d1b95df0 Bgrabow/ci test repl mage task (#71025)
* ci-test-repl mage task

* Use ci port map to set port. Include junit name in job string

* Move to bgrabow

* Add dry-run mode

* task! wrapper to support helptext
2026-03-18 18:18:33 +00:00
Jeff Bruemmer
ee6203aa6e docs - agent demo link (#71074)
* agent demo link

* Optimized 1 images, saved 125.8 KB (45.1% smaller)

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2026-03-18 18:03:17 +00:00
Anderson
4b7056a383 Make it clearer why transforms can't be created in read-only mode (#71051)
test: update tests for read-only mode transform creation UI changes

Update E2E tests to verify:
- Create transform button is disabled with explanatory tooltip in read-only mode
- New transform pages show not found message when accessed directly in read-only mode
2026-03-18 13:58:32 -03:00
Nathan Voxland
25100c1310 Allow linear to trigger repro-bot (#71049) 2026-03-18 09:03:46 -07:00
Alex Yarosh
2f7a83ddc5 docs: new incremental transforms (#71080)
* incremental transforms

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2026-03-18 11:21:06 -04:00
Ben Grabow
0abb871d3f Fix flaky metabase-enterprise.dependencies.api-test (#71024)
* Drain the single-threaded async executor to ensure all pending dependency work completes before model cleanup deletes cards, avoiding lock timeouts.

* Use fresh-dependency-async-executor-fixture on every test
2026-03-18 10:01:34 -05:00
Eric Normand
693550cf45 Correctly hide/show card filters based on permissions (#70980)
Backend (query_processor/dashboard.clj): Added an explicit view-data permission check using most-permissive-database-permission-for-user. This returns 403 when a user has no view-data access, taking precedence over parameter validation errors (400).

Frontend (DashCardVisualization.tsx): Decoupled the three concerns:

* Inline parameters render when inlineParameters.length > 0 AND the user has view access (no 403 on the card result)
* DashCardMenu (download button) renders when DashCardMenu.shouldRender() is true (requires canEditQuestion or canDownloadResults)
* 403 from backend hides both inline params and menu — no point showing UI for data the user can't access
2026-03-18 09:35:17 -05:00
Ryan Laurie
8255a879de Parameterize runners (#71077)
* Use custom runners

# Conflicts:
#	.github/workflows/cross-branch-migrations.yml
#	.github/workflows/pre-release.yml
#	.github/workflows/tusk-sanity-check.yml

* more updates

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2026-03-18 08:24:12 -06:00
Sébastien
ea2e642c82 Fixed flaky e2e test (#71019) 2026-03-18 15:00:06 +01:00
github-automation-metabase
3bfd0aa9bf Auto-update documentation for master (#71058)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-18 08:41:53 -04:00
Uladzimir Havenchyk
f45dbe78a1 chore: update formatting (#71072) 2026-03-18 13:04:05 +01:00
Kevin Kelleher
43ab4dbb8d Allow grid columns in Detail visualization to grow and shrink (#70964) 2026-03-18 07:49:40 -04:00
Jakub Chodorowicz
80d08cce82 use array/list for sources table in transforms (#70100) 2026-03-18 11:11:24 +01:00
Fraser
7e5435f6f1 Dev 1662 move libcolors into UI (#70754) 2026-03-18 22:52:16 +13:00
Kamil Mielnik
3c229eb38d GDGT-1998 Get rid of VisualizationSettingDefinition["marginBottom"] (#71004) 2026-03-18 15:59:11 +07:00
Nathan Voxland
4ca03e17ef Took out now-unneeded search delay 2026-03-18 02:05:25 -05:00
Kamil Mielnik
e271bc5e52 GDGT-1995 Get rid of VisualizationSettingDefinition["disabled"] (#71000) 2026-03-18 14:00:46 +07:00
Nathan Voxland
ec2b0f38ae Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	src/metabase/analytics/prometheus.clj
2026-03-18 01:46:46 -05:00
Nathan Voxland
2bad85564e Publish messages after an appdb transaction. Plus batch them still for 100ms to handle times we don't really have a transaction to avoid so many small batches 2026-03-18 01:45:26 -05:00
Cam Saul
f5eeabb4be Rework Pivot QP to add pivot-grouping in post-processing (#70986)
* Rework Pivot QP to add `pivot-grouping` in post-processing

* PR feedback

* Fix MongoDB test failures

* Fix test failures

* cljfmt

* Fix calculating pivot group for queries with remaps

* cljfmt

* Test fix 🔧

* Test fix 🔧

* Delete unused code
2026-03-18 01:29:20 +00:00
Anderson
f2164af918 Add snowplow events when creating new job (#70279)
* Add snoplow events when creating new job

* Fix e2e
2026-03-17 21:05:09 -04:00
Anderson
832e71aa46 Add aria-level attribute to dashboard title heading (#70985)
* Add aria-level attribute to dashboard title heading

Closes https://github.com/metabase/metabase/issues/70544

### Description

Dashboard title elements with role="heading" now include the aria-level
attribute set to 1, properly indicating they are primary headings. This
improves accessibility for screen reader users by establishing the correct
heading hierarchy.

The fix adds aria-level={1} to the Box component in DashboardHeaderView
that already has role="heading". This ensures screen readers can properly
navigate the heading structure of the dashboard page.

### How to verify

1. Open any dashboard in Metabase
2. Inspect the dashboard title element in browser DevTools
3. Verify the heading has both role="heading" and aria-level="1"
4. Test with a screen reader (e.g., NVDA, JAWS) to verify it's announced
   as a level 1 heading

Alternatively, run the new unit test:
```bash
bun jest --testPathPatterns="DashboardHeader/tests/common.unit.spec"
```

### Checklist

- [x] Tests have been added/updated to cover changes in this PR

* Clean up
2026-03-17 20:45:09 -03:00
Sloan Sparger
6826140380 [Metabot] Slackbot (#68473)
* wip

* clean up and move secrets to settings

* validate incoming slack requests and better sending of messages / processing responses

* get ai response working, make slack app an agent, fetch threads

* add loading / thinking state

* image uploading and clean up

* add test coverage for validation of slack requests

* add test coverage for endpoints only being available with metabot token feature

* add test coverage for user messages

* fix image uploads not working

* add test coverage for messages with visualizations

* fix convo history

* allow for rendering adhoc questions and surrounding the static viz with padding

* Re-enable +auth middleware for endpoints in metabase-enterprise.metabot-v3.api

* Ensure user has linked slack and metabase accounts before sending messages

And send them an ephemeral message with a (currently invalid) link to authorize

* Add some more repl testing comments

* dev comments: fix assert when updating manifest and encourage env vars for dev secrets

* Use request/with-current-user rather than binding api/*current-user* directly

This is the preferred way to set the user and handles binding things like api/*is-superuser?* and
api/*current-user-permissions-set* as well.

* smol refactor to clean up process-user-message

* Fix kondo lint warning about undeclared channel module dep

* Fix reflection warning for metabase.server.streaming_response/StreamingResponse

* Fix reflection warning in user-message-with-visualizations-test

* Use :on-complete handler to capture lines in make-ai-request

* Make all defs except endpoints and routes private

* Rename client :bot-token to :token

Currently only used for endpoints that expect a bot token, but in principal these could be used for other endpoints
that might expect, e.g. an app config token to update the app manifest.

* fix builds

* throw down a basic settings ui page

* validate slack bot token

* fix failing verification step

* refine sso flow, update temp admin form to collect info we need

* ensure slackbot is only enabled if setup is complete

* add instructions to add bot image

* Re-enable user-not-linked-sends-auth-message-test

This deftest got accidentally slurped into the preceding one in 07eb42c76f4. Extract it back out into the toplevel.

* Fix kondo whitespace lint

* temp staging deploy fix?

* BOT-853 Add malli schemas to slackbot defendpoints

* Ensure site-url is configured and fix failing test

* Add reminder to set MB_SLACK_CONNECT_ENABLED

* make image rendering larger

* Ensure :test-users are initialized in slackbot tests

* Fix busted tests due to missing site-url

Site-url needs to be added to with-slackbot-setup and do-with-setup-override since I added site-url to
metabase-enterprise.metabot-v3.api.slackbot/setup-complete?

These tests passed when run from the REPL because I had site-url configured locally, but failed when run from the cli.

* make setup instructions clearer

* clean up dev comment form

* BOT-852 Add malli schemas for slack event types

* improve auth flow

* oops

* Rename SlackHandledMessageEvent to SlackKnownMessageEvent

And fix the order of types in SlackKnownMessageEvent

* improve settings page

* WIP csv uploads

* tweaks

* tweaks

* fixes & cleanups

* Ad-hoc querying for slackbot (#69315)

* basic ad-hoc query support

* fix capabilities

* cleanup + another test

* more test fixes

* fix some kondo

* move middleware auth tests to a new EE namespace

* minor fixes

* fix tests

* remove unneeded transforms capability

* remove some debug code

* [Metabot] Slackbot channel support (#69391)

* channel support

* ignore edited messages

* add tests

* lint fix

* lint fix

* pr feedback

* test fix

* skip channel messages

* default enable slack sso

* Fix failing metabase.core.modules-test/module-uses-should-be-sorted-test

* Require user to be active in slack-id->user-id

* metabot/slackbot - Adjust CSV upload support (#69832)

* init

* remove debug def

* BOT-984 Add slack channel support to create-dashboard-subscription tool (#69371)

* Add slack channel support to create-dashboard-subscription tool

* Fix render-html-to-png

We recently added a new 3-arg arity, but were only passing along the :content of the ::body/RenderedPartCard rather
than the full map, resulting in a malli schema error due to dropping the required :attachments key for any callers of
the 2-arg arity, e.g. when trying to send a slack notification.

    clojure.lang.ExceptionInfo: Invalid input: {:attachments ["missing required key, got: nil"]}
	at metabase.channel.render.png$fn__107479$fn__107505.invoke(png.clj:124)
	at metabase.channel.render.png$fn__107479$render_html_to_png107478__107482.invoke(png.clj:128)
	at metabase.channel.render.png$fn__107479$fn__107505.invoke(png.clj:124)
	at metabase.channel.render.card$fn__108322$png_from_render_info108321__108323.invoke(card.clj:302)
	at metabase.channel.render.card$fn__108322$fn__108325.invoke(card.clj:298)
	at metabase.channel.impl.slack$part__GT_sections_BANG_.invokeStatic(slack.clj:117)
	at metabase.channel.impl.slack$part__GT_sections_BANG_.invoke(slack.clj:87)

* Add find-cached-slack-channel-or-username

* Validate slack-channel in create-dashboard-subscription

Serves the dual purpose of making sure the channel exists and also normalizing the name to the display-name with
leading # which is how channels selected in the UI are stored.

* Drop support for email subscriptions

Since this is only going to be used from the slackbot profile, we'll only support sending subscriptions to slack
channels for now.

* handle-agent-error in create-dashboard-subscription

* Add create-pulse-with-perm-checks! and call that from create-dashboard-subscription tool

To ensure the same permission checks and other logic is used as when creating a pulse from the UI or API.

* Do no export pulse.models.create-pulse! from pulse.core

The only consumer was metabot's create-dashboard-subscription which now calls create-pulse-with-perm-checks! instead.

* BOT-985 Add create-alert metabot tool for slackbot (#69533)

* Add create-alert metabot tool

To allow the agent to create alerts for a given card on a given schedule, similar to the existing
create-dashboard-subscription tool.

* Add notification.api/create-notification! and call it from metabot_v3.tools/create-alert

This ensures that create-alert does the same perms checks and send the same verification email and notifications as
the main api endpoint.

* Improve ::create-alert-arguments malli schema

Use :multi with :dispatch on :channel_type to make it clear that email is required when :channel_type is "email" and
likewise :slack_channel is required when :channel_type is "slack"

* Destructure email in create-alert args

* handle-agent-error in create-alert

* Drop support for email subscriptions

Since this is only going to be used from the slackbot profile, we'll only support sending subscriptions to slack
channels for now.

* Add api test for create-alert metabot tool endpoint

* Fix bad conflict resolution from rebase

* BOT-1026 Pass slack-channel-id in the ai-service request context (#69828)

* BOT-1026 Pass slack-channel-id in the ai-service request context

For ai-service requests originating from slackbot, send along the slack channel id. The ai-service tools will also be
updated to use this channel id when creating dashboard subscriptions or alerts.

* Add make-ai-request-args-test

* Slackbot table output format (#69511)

* WIP - table ouptut for Slack metabot

* lint

* WIP support for pre-fetched data

* WIP

* lint

* add slack-connect-enabled to do-with-other-sso-types-disabled

* fix another test

* change slack-connect-enabled default to false

* simplify approach

* Misc fixups

* more cleanup

* fix another test

* small readability improvements

* Move some of the table data preparation stuff to a new namespace to share with  existing slack/email rendering code

* fix modules lint

* extract table-block components and include in thread history

* revert query results changes (for now) and just drive slack table formatting via viz type selection

* truncation message

* truncation message test case

* rollback more execute-query stuff

* fix build

* temporarily comment out extract-table-blocks stuff

* fix test

* Merge slackbots and settings pages (#69782)

* wip

* more progress

* conslidate manifest endpoints

* remove slack-token

* handle missing scopes case

* respect slackbot feature toggle in event handler

* other-sso-enabled? now takes into account sso mode

* new slack app-info endpoint for getting helpful metadata for the connected slack app, update links on FE to more direct location in slack

* replaced "metabot-slack-bot-enabled" with "slack-connect-enabled"

* misc. small fixes

* move slack scopes endpoint to app-info endpoint, update copy, misc ui improvements

* fix slack events api endpoint to still ack events if metabot later becomes disabled

* first step now configured to show obscured token, remove old modal component that was unused

* improve app icon section

* small design pass and linkage improvement to step 3

* new settings endpoint for metabot slackbot settings, updated FE component and form validation

* improve slack bug channel input, also update api endpoint so that slack setting values can be set seperately

* obfuscate client secret and signing secret

* improve the webhooks page a bit

* inline save / delete btuton for slack oauth token input

* allow removing metabot related slack settings in the ui

* self-review

* fix kondo

* fix some be tests

* test fixes, link fixes, page reorg

* poll for updates

* fix some e2e tests

* show info button w/ bot token info on hover

* updated profile image for slackbot

* fix be tests

* fix unit tests

* fix be test

* add unit test converage for base setup

* remove SlackSettingsPage which had duplicate tests

* add test coverage for settings endpoint

* new settings ui tests

* remove todo comment

* set default icon / name for slackbot

* make slack-get match slack-post response format

* show api errors better in slack metabot form

* impl set-many feedback

* fix requiring resolve code smell

* log error based on feedback

* handle error for app-info

* Slackbot streaming (#69947)

* [wip] Slackbot streaming

* simplify, lint

* Fix tests

* Use a volatile

* fix tests

* refactors, cleanup

* more cleanup

* fix tool name

* Better stream-related error handling + tests

* add another test

* properly destructure api calls for streaming / auth

* fix streaming not having icon_url set and make sure that channel level @mentions has the bot reply with auth request at channel level too

* embarrassing

* Rework + simplify streaming using an agent to try to reduce burstiness

* prevent tests from clearing out setting values

* Add a thinking... placeholder before stream starts +  do initial Slack requests in futures

* rip out overrides, streaming api reverts the defaults so it flashes images if they differ from the one saved for the slack app

* [Slackbot] Render unsupported static viz as tables (#70077)

render unsupported static viz as tables

* Slackbot test refactor + fix overwriting encrypted settings (#70113)

* Fix encryption overwriting in tests; small cleanup

* more refactor

* [Slackbot] Modularize (#70130)

modularize

* [Slackbot] Adds check to prevent replay attacks (#70081)

* prevent relay attack

* fix syntax issue

* pr feedback

* lint fix

* [Slackbot] Prevent channel response (#70136)

* add more tests, refactor

* bit more clean up

* ignore channel messages without @mention

* simplify, fix tests

* add file mock to tests

* move bot id fetch

* Migrate slack-connect SSO to dedicated /auth/sso/slack-connect URL pattern

Move slack-connect from the old unified /auth/sso multimethod dispatch to
dedicated GET /auth/sso/slack-connect and GET /auth/sso/slack-connect/callback
endpoints, aligning with the pattern used by custom OIDC providers.

* fix oauth flow requiring user page refresh

* kick ci

* fix threading for auth message in dms

* Report QP errors to Slack, and run queries off the main thread (#70124)

* WIP - surface QP errors, don't block queries on text stream

* simplifications

* fix up a couple other tests that were corrupting values

* try to fix test

* cleanup

* more cleanup

* more cleanup

* Fix test

* small simplification

* more fixes

* timeouts

* simplify comment

* call shutdown-agents at the end of the core shutdown routine

* [Slackbot] Stable conversation ids (#70281)

* make convo ids stable for slack conversations

* fix lint

* fix missing paren

* Update enterprise/backend/test/metabase_enterprise/metabot_v3/api/slackbot_test.clj

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>

---------

Co-authored-by: appleby <86076+appleby@users.noreply.github.com>

* fixup! set a proper response code in safari

* Slack SSO info logs in initiate & callback endpoints

* make slack user look up deterministic

* log actual oidc cookie

* [Slackbot] Better static viz sizing (#70288)

* make slack user look up deterministic

* calc size of static viz based on display type

* fix doc string

* fix tests, add sankey support

* fix lint

* make metabot self-aware... of @mentions

* add some truncation logic for slack blocks + long cell values

* Improved titles for slackbot visualizations; misc other fixes (#70396)

* support context text for results

* viz captions with links; hold viz results until stream finishes

* tests; remove separate caption & description fields

* grab bag of fixes

* strip out user mention stuff from this branch

* caption->title

* fix build

* fix test

* polish

* some escaping logic for markdown links

* fix filename

* Slackbot feedback buttons (#70280)

* WIP slack feedback buttons

* wire up feedback buttons

* tests

* feedback modal

* revert back to a single hm call

* fix parens

* revert an unexpected change

* small fixes

* fix tests

* tweaks

* fix rebase

* Update enterprise/backend/src/metabase_enterprise/metabot_v3/api/slackbot/streaming.clj

* fix rebase

* [Slackbot] Enrich chat history (#70408)

* poc

* move code around

* fix tests, clean up logs

* clean up

* fix

* automated review feedback

* do not store messages on error

* test coverage

* lint fix

* Ensure we respect slack api rate limits (#70409)

* try to respect slack streaming rate limits

* tests

* simplify

* lint

* try to fix tests, some tweaks

* bump ci

* [Slackbot] Better auth messages (#70465)

* improve auth message responses

* better auth messages

* pr feedback

* Split slackbot DM and channel response paths, embed viz in message (#70531)

* Viz delivery refactor for slackbot

* simplify

* more refactor

* more test porting

* Update enterprise/backend/src/metabase_enterprise/metabot_v3/api/slackbot/channel.clj

* condense some code

* fix tests

* fix stale session bug

* Slackbot message deletion (#70533)

* Slackbot message deletion

* Tests

* Fix tests

* minor cleanup

* add user_id to metabot_message to drive deletion permissions

* balence parens

* fix parens

* feedback

* fix failing migration tests

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>

* Fix slackbot feedback acknowledgement (#70642)

* fix slackbot feedback acknowledgement

* simplify docstring

* remove feedback acknowledgement entirely

* Add slackbot prometheus metrics (#70654)

* add slackbot prometheus metrics

* simplify

* lint

* remove todo comment

* [Slackbot] Cleanup (#70692)

* move migrations to v60 file

* clean up auth debug logging

* move slackbot into its own module and split up the core test file

* fix whitespace lint

* [Slackbot] Fancy (#70729)

* mostly working w/o proper saving of messages

* backfill slack_msg_id

* Minor tweaks: swap volatiles for atoms, switch away from deprecated StringBufferInputStream

* address libor's comments

* fix tests - wrap async functions with bound-fn*

* oops, fix last test

* fix reflection issue

* whitespace chagne to kick new jar build

* update subscription tool + tests

* fix .clj-kondo/config/modules/config.edn resolution and related failing tests

* [Slackbot] Port ai service (#71026)

* main port

* port https://github.com/metabase/ai-service/pull/626/changes

* clean up

* kondo fix

---------

Co-authored-by: Mike Appleby <86076+appleby@users.noreply.github.com>
Co-authored-by: Tyler Plude <tsplude@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
2026-03-17 23:23:40 +00:00
Riley Thompson
47ff6b70a6 Pin google auth dependency to avoid driver mismatches (#70958)
* pin dep

* trigger ci tests

* update test
2026-03-17 20:59:53 +00:00
Nathan Voxland
7ab0784977 ReproBot Improvements (#70990) 2026-03-17 15:57:47 -05:00
Jeff Bruemmer
e8bc1db487 docs - remote sync providers (#70969) 2026-03-17 16:16:15 -04:00
Uladzimir Havenchyk
527a4d67e9 chore: upgrade underscore (#70778) 2026-03-17 22:58:29 +03:00
Nick Fitzpatrick
b0deebf2b6 Clear ChartSettingSelect display value on remove (#70957) 2026-03-17 15:57:55 -04:00
appleby
09d9a4a446 BOT-1131 Rename :snake_case keys to :kebab-case in metabot stats (#71027) 2026-03-17 19:55:33 +00:00
Fraser
08b84f4b16 Lift data_grid.js up to shared (#70755)
* Lift data_grid.js up to shared

     data_grid.js is in lib/lib but imports makeCellBackgroundGetter from table_format in shared/visualizations, causing a lib/lib → shared/visualizations boundary violation. data_grid.js is not used by
     anything in lib — all consumers are in shared/visualizations, feature/dashboard, and visualizer. table_format already lives in shared/visualizations and only depends on basic/ui colors.
2026-03-18 08:33:39 +13:00
Fraser
829b34e44a Remove metadata re export from reference (#70561) 2026-03-18 08:32:01 +13:00
Nathan Voxland
5d6c208865 Improve search endpoint performance with many disabled tables (#70982) 2026-03-17 13:09:19 -05:00
Jeff Bruemmer
6d37120fb9 docs - Fix typo in JWT group mapping documentation (#71017)
Fix typo in JWT group mapping documentation
2026-03-17 11:52:02 -04:00
Sébastien
2390c28119 Fixed metrics not being translated in guest embeds (#70484) 2026-03-17 16:44:59 +01:00
Cam Saul
5217327fb9 Fix running app DB with MariaDB 10.6 official image in CI (#70824)
* Fix running app DB with MariaDB 10.6 official image

* Update all MariaDB configs

* Use custom Docker image 🔧

* Loosen dependence on quoting format of mysql/mariadb error messages

* Use tz aliases supported in mariadb 12

* Run tests in series. Use fresh H2 DB.

---------

Co-authored-by: Ben Grabow <ben.grabow@metabase.com>
2026-03-17 14:52:37 +00:00
Chris Truter
b215b0ff3d Fix mage mise-diagnosis (#71012) 2026-03-17 14:34:13 +00:00
Mihael Konjević
9796110af3 Ai service port (#68463)
* Experiment with communicating with LLMs in Clojure

* Libor comments

* switch to new openai /v1/responses api, check for structured output support

* support for claude to show how different adapters are

* linter fixes

* Implement native Clojure agent for MetaBot v3

This commit implements a production-ready native Clojure agent loop that
replaces the external Python AI Service with an in-process implementation,
leveraging the existing llm-inside streaming infrastructure.

Key Components:
- agent/core.clj: Main agent loop with iteration control and streaming
- agent/memory.clj: Conversation state and step tracking
- agent/messages.clj: Message formatting and LLM communication
- agent/profiles.clj: Profile configurations (embedding, internal, transforms)
- agent/tools.clj: Tool registry with 13 wrapped tools

Integration:
- api.clj: Feature-flagged routing via use-native-agent setting
- settings.clj: New use-native-agent boolean setting (default: false)

Benefits:
- Direct Toucan2 database access (no HTTP round-trips)
- Single JVM process deployment
- Lower latency for tool execution
- Unified logging and error handling
- Reuses 80%+ of existing streaming infrastructure

Test Coverage:
- 5 test files with comprehensive coverage
- All tests passing (133 total assertions)
- Unit tests for memory, messages, profiles, tools
- Integration tests for agent loop with mocked LLM

The implementation is production-ready and can be enabled via feature flag
for gradual rollout and validation against the Python service.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Integrate Phase 2A: Prompts & Context System into agent loop

This commit completes Phase 2A of the native Clojure agent implementation,
integrating the templated prompt system with context enrichment into the
main agent execution loop.

## New Features

### Prompt System (prompts.clj)
- Selmer template loading with caching
- SQL dialect instruction injection (14 dialects supported)
- Tool instruction extraction from docstrings
- System message template rendering with context variables

### Context Enrichment (user_context.clj)
- Timezone-aware time formatting
- SQL dialect extraction from context
- Viewing context formatting for all types:
  - Adhoc queries (notebook editor)
  - Native SQL queries with error context
  - Transforms with source information
  - Code editor with buffer/cursor/selection details
  - Entity details (tables, models, questions, metrics, dashboards)
- Recent views formatting with relevance hints
- Full context enrichment pipeline for template variable injection

### Resource Files
- 3 system prompt templates (embedding, internal, transform-codegen)
- 14 SQL dialect instruction files
- All templates support dynamic context injection

## Integration Changes

### Agent Core (core.clj)
- Updated build-messages-for-llm to accept context, profile, and tools
- Integrated system message building with enriched context
- Fixed pre-existing async blocking issue in run-llm-with-tools
  (changed from blocking a/<!! to returning channel for non-blocking a/<!)
- Agent now builds fresh system messages with context on each iteration

### Messages (messages.clj)
- Updated build-system-message to use templated prompts
- Accepts context, profile, and tools parameters
- Calls prompts/build-system-message-content for rendering

### Profiles (profiles.clj)
- Added :prompt-template mapping to all three profiles
- Maps profile IDs to template files in resources/metabot/prompts/system/

## Tests

All Phase 2A functionality is comprehensively tested:
- prompts-test: 6 tests, 46 assertions ✅
- user-context-test: 5 tests, 81 assertions ✅
- messages-test: 3 tests, 47 assertions ✅
- profiles-test: 1 test, 36 assertions ✅

Total: 15 tests, 210 assertions passing

Note: core-test integration tests have pre-existing failures due to blocking
calls in self/core.clj tool-executor-rff (line 116), which existed before
this change. The async pipeline architecture issue is tracked separately.

## Architecture

The agent now follows this flow on each iteration:
1. Enrich raw context (user_context/enrich-context-for-template)
2. Load and render system prompt template (prompts/build-system-message-content)
3. Build full message array with system message + history
4. Execute LLM call with enriched context
5. Process tool calls and responses
6. Repeat until completion

This matches the Python implementation's prompt and context system while
leveraging Clojure's functional architecture.

* Add Selmer dependency for template rendering

Selmer v1.12.70 provides Jinja-like templating for Clojure,
used by the Phase 2A prompts system for rendering system messages
with dynamic context variables.

* Fix async blocking issue in agent loop by using pipeline-blocking

The tool-executor-rff reducing function blocks in its completion arity
to wait for tool results. Using a/pipeline causes 'Invalid blocking call
in dispatch thread' errors because the regular pipeline uses a fixed
thread pool that doesn't allow blocking.

Solution: Use a/pipeline-blocking instead, which uses a separate thread
pool designed for blocking operations. This allows the tool executor's
completion arity to safely block while waiting for tool results.

Fixes the core-test integration test failures.

* Implement Phase 2B: SQL Query Tools

Add four SQL query manipulation tools to enable the agent to create, edit,
and search SQL queries:

New Tools:
- create_sql_query: Create new SQL queries with validation
- edit_sql_query: Apply structured edits (replace, append, insert, etc.)
- replace_sql_query: Replace SQL content entirely while preserving metadata
- sql_search: Search for SQL queries by content with relevance ranking

Features:
- Direct Toucan2 Card model access (no HTTP round-trips)
- Database and permissions validation
- Structured edit operations (replace, replace-all, append, prepend, insert-after, insert-before)
- Search with ranking by name match, description match, SQL position, and recency
- Integration with existing agent tool registry
- Added to metabot-internal profile and new metabot-sql-only profile

Testing:
- Comprehensive test coverage for all SQL tools
- Integration tests for full workflow (create → edit → search)
- All tests passing (18 assertions, 0 failures)

Architecture:
- Follows existing tool pattern (mu/defn with Malli schemas)
- Returns structured output for agent state tracking
- Error handling with agent-error? flag for LLM-friendly messages

Phase 2B complete. Ready for Phase 2C: Visualization Tools.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix SQL tools to handle lib/query format

Fixed multiple issues with SQL tools not handling the transformed
lib/query format when Card models are read from the database:

## Issues Fixed

1. **extract-sql-content not finding SQL**: Card dataset_query transforms
   from {:native {:query "SQL"}} to {:stages [{:native "SQL"}]} when read.
   Updated extract-sql-content in all SQL tools to handle both formats.

2. **OffsetDateTime vs Date**: The rank-result function in sql_search
   called .getTime on timestamps, but Toucan2 returns OffsetDateTime.
   Added instanceof check to convert appropriately.

3. **Missing visualization_settings**: Test code using t2/insert! needed
   :visualization_settings {} field (database constraint).

4. **Test permissions**: Wrapped all test code with mt/with-current-user
   to provide proper permission context.

5. **Fixed typo in sql_search**: Changed accessible-cards variable reference
   from undefined to all-cards.

## Files Changed

- edit_sql_query.clj: Handle both lib/query and legacy formats
- replace_sql_query.clj: Handle both lib/query and legacy formats
- sql_search.clj: Handle both formats + OffsetDateTime conversion
- sql_tools_test.clj: Add visualization_settings, fix permissions,
  add clojure.string alias, fix indentation

## Test Results

All 19 assertions passing (4 test functions):
- edit-sql-query-test: 4 edit types tested
- replace-sql-query-test: Replace with metadata preservation
- sql-search-test: Search, filter by database, limit parameter
- integration-create-edit-search-test: Full workflow

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Add read_resource tool for fetching Metabase resources via URIs

Implement the foundational read_resource tool that provides unified
interface for fetching detailed information about Metabase resources
using URI patterns. This tool implements the "Context Engineering with
Links" pattern where URIs serve as lightweight, token-efficient
references that can be fetched on-demand at the appropriate detail level.

Supported URI patterns:
- metabase://table/{id} - Basic table info
- metabase://table/{id}/fields - Table structure with fields
- metabase://table/{id}/fields/{field_id} - Specific field details
- metabase://model/{id}/fields - Model structure with fields
- metabase://metric/{id}/dimensions - Metric dimensions
- metabase://transform/{id} - Transform details (not yet implemented)
- metabase://dashboard/{id} - Dashboard details (not yet implemented)

Key features:
- Parses metabase:// URIs and routes to appropriate handlers
- Supports fetching multiple resources in parallel (max 5)
- Handles field IDs with slashes (e.g., c75/17)
- Returns formatted XML-like output for LLM consumption
- Provides detailed error messages for invalid URIs

This tool is critical for:
- Enabling agents to get more context about resources on demand
- Supporting workflows where search returns URIs that agents fetch later
- Reducing token usage by deferring detail fetching until needed

Changes:
- Created read_resource.clj with URI parsing and resource handlers
- Added read-resource-tool wrapper in tools.clj with Malli schema
- Updated all 4 profiles to include read_resource tool
- Added comprehensive tests for URI parsing and resource fetching

Tests: 24 assertions, 0 failures

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Implement Phase 2C chart tools, 2F profiles, and fix async blocking

Phase 2C - Chart Tools:
- Add create_chart tool to create visualizations from queries
- Add edit_chart tool to modify existing chart types
- Register chart tools in agent tools registry

Phase 2F - Profiles & Templates:
- Port sql-querying-only.selmer from Jinja2 (fixes broken :metabot-sql-only)
- Port metabot-next.selmer template
- Port natural-language-querying-only.selmer template
- Add :metabot-next, :metabot-nlq-only, :metabot-beta-customer profiles

Async Blocking Fix:
- Use a/thread instead of a/pipeline-blocking in run-llm-with-tools
- tool-executor-rff uses a/<!! in completion arity which cannot run in go-blocks
- Synchronous transducer application in thread context is now aligned with self code
- Fix stream-parts-to-output! and finalize-stream! to use a/>! in go blocks
- Fix api.clj syntax error with metadata on string literal
- Update tests to generate proper Claude raw SSE format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add AI SDK v4 line protocol output format for native agent

The Python ai-service outputs a specific line protocol format that the
frontend expects. This adds the conversion layer to output the same format
from the native Clojure agent.

Format examples:
- 0:"text content"  - Text (JSON-encoded string)
- 2:{"type":...}    - Data parts
- 3:"error"         - Errors
- 9:{"toolCallId":..., "toolName":..., "args":...}  - Tool calls
- a:{"toolCallId":..., "result":...}  - Tool results
- d:{"finishReason":"stop", "usage":{...}}  - Finish message
- f:{"messageId":...}  - Start message

Changes:
- Add format-* functions for each part type in self/core.clj
- Add aisdk-line-xf transducer for batch conversion
- Export new functions via self.clj
- Update api.clj to stream parts in line protocol format
- Add comprehensive tests for all format functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix native agent loop for multi-turn conversations with tools

Key fixes:
- Fix premature loop exit: Continue when tool calls present, regardless of text
- Fix Claude API integration: Extract system message separately, pass via :system param
- Fix tool name mismatch: Pass tools as [name, var] pairs so Claude sees registry keys
- Fix message format for tool_use: Use content array format for assistant messages
- Handle START_STEP/FINISH_STEP types in aisdk->messages
- Rename profiles to simpler keys (:embedding, :internal, etc.)
- Add /native-agent-streaming endpoint for testing (bypasses feature flag)
- Add debug logging for message building

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add state management for query/chart IDs in native agent tools

State-dependent tools (show_results_to_user, create_chart, edit_chart) now
look up queries and charts from agent memory by ID instead of expecting raw
query objects. This mirrors the Python AI service pattern.

Key changes:
- memory.clj: Add query/chart storage functions (remember-query, find-query,
  store-chart, find-chart, load-queries-from-state, load-charts-from-state)
- core.clj: Extract queries/charts from tool outputs and store in memory
- tools.clj: Wrap state-dependent tools with memory atom access
- claude.clj: Update schema to accept wrapped tool maps with :fn/:doc/:schema
- self/core.clj: Handle wrapped tool maps in tool-executor-rff
- show_results_to_user.clj: Accept query-id and look up from queries-state

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add metabase:// link resolution for native agent streaming

The native agent now resolves metabase:// URIs in text parts before
streaming to clients. This mirrors the Python AI service's
MarkdownLinkBuffer behavior.

Link types supported:
- metabase://query/{uuid} - Resolves to /question# using stored query
- metabase://chart/{uuid} - Resolves to /question# via chart's query
- metabase://model/{id} - Resolves to /model/{id}
- metabase://metric/{id} - Resolves to /metric/{id}
- metabase://dashboard/{id} - Resolves to /dashboard/{id}
- metabase://question/{id} - Resolves to /question/{id}
- metabase://transform/{id} - Resolves to /admin/transforms/{id}

Changes:
- links.clj: New module for link resolution with markdown parsing
- core.clj: Integrate link processing in stream-parts-to-output!
- Tests for link resolution and streaming integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix tool result formatting for LLM and link resolution

Key changes:
- Format tool results as XML for LLM consumption (messages.clj)
  - Query results now show query ID clearly: <query id="..." type="query">
  - Chart results include chart ID and reference link
  - This matches Python ai-service format so LLM can extract IDs properly

- Add fallback for chart link resolution (links.clj)
  - When LLM uses metabase://chart/ with a query ID, fall back to
    treating it as a query link
  - Handles common LLM mistake of using wrong link type

- Fix chart extraction logic (core.clj)
  - Charts identified by :chart-id + :query-id (without :query)
  - Distinguishes charts from query results correctly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add InstructionResultSchema pattern for native agent tool outputs

Align Clojure native agent tool outputs with Python AI Service patterns
by wrapping results in <result>/<instructions> XML format for consistent
LLM guidance.

- Add llm_representations.clj with entity-to-XML formatting utilities
- Add instructions.clj with LLM guidance constants for each tool type
- Update messages.clj to use format-with-instructions wrapper
- Add type-specific formatters for search, entity, query, chart results
- Include comprehensive tests for LLM representation functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Align Clojure LLM representations exactly with Python AI Service

Updates tool output formatting to match Python AI Service patterns exactly:

- field->xml: Add quotes around name, database_type attr, ## Description header
- metric->xml: Add collection, default_time_dimension_field, metabase:// URIs
- table->xml: Add database_engine, fully_qualified_name, related_tables section
- model->xml: Use <metabase-model> tag, slug-based fqn, related_tables
- query->xml: Include database_id, query-content, query_results with rows
- Add question->xml, dashboard->xml, collection->xml, user->xml formats
- Add visualization->xml for full chart representation
- Add field-metadata->xml, get-metadata-result->xml for metadata results
- Update search result tags: model→metabase-model, card→metabase_question
- Update instructions.clj with complete Python-matching guidance text
- Update messages.clj to use <metabase-models> tag
- Expand tests to verify Python format compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add auto-navigation and fix tool output handling for native agent

- Add redirect reactions to SQL query tools (create, edit, replace) for
  auto-navigation after query operations
- Add streaming module to convert reactions to AI SDK data parts
- Fix structured output extraction to handle both :structured-output and
  :structured_output key formats (Clojure vs JSON style)
- Add role normalization in message formatting to handle both keyword
  and string roles from frontend
- Include :query key in SQL tool returns for memory storage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Implement AI Service parity for native Clojure agent

This commit adds feature parity between the Clojure native agent and
Python AI service, implementing all phases from the parity plan.

New Tools:
- todo_write / todo_read: Task management with todo_list data parts
- navigate_user: Page and entity navigation with redirect reactions
- ask_for_sql_clarification: SQL clarification with final-response flag
- write_transform_sql / write_transform_python: Transform code editing
- create_autogenerated_dashboard: X-ray dashboard generation
- list_snippets / get_snippet_details: SQL snippet access

Core Changes:
- State data part format: {type: data, data-type: "state", version: 1}
- Finish message format: {type: finish, finish-reason: "stop"|"error"}
- New data part types: todo_list, code_edit, transform_suggestion
- Data part streaming from tool results via :data-parts key
- Final response pattern: tools return :final-response? true to stop loop
- Capability-based tool filtering with tool-capabilities map

Profile Updates:
- internal: Added navigate_user, create_autogenerated_dashboard
- transforms-codegen: Added todo tools, transform write tools, snippets
- sql-only: Added ask_for_sql_clarification, :required-tool-call? flag
- nlq-only: Added navigate_user, create_chart, edit_chart

Tests:
- Comprehensive tests for all new tools (29 new tests, 200+ assertions)
- Updated existing tests for new formats and capabilities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add streaming link buffer and improve AI service compatibility

Key changes:
- Add markdown_link_buffer.clj for handling links split across streaming
  text chunks (matches Python AI Service MarkdownLinkBuffer behavior)
- Seed agent state with queries from user_is_viewing context
- Support both snake_case and kebab-case keys in context for prompts
- Normalize entity types (keyword/string) in message formatting
- Decode tool arguments from JSON strings when needed
- Add table link resolution (metabase://table/{id})
- Preserve system-instructions when wrapping state-dependent tools
- Fix iteration boundary check (use inc iteration for comparison)
- Gracefully handle unresolvable links by falling back to link text

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Refactor SQL tools to use in-memory state and data parts

Key changes:
- SQL tools (edit_sql_query, replace_sql_query) now operate on in-memory
  query state instead of persisting to database
- Convert tools from reactions to data-parts pattern (navigate_to)
- Add semantic_queries and keyword_queries to search tool schema
- Make edit_sql_query and replace_sql_query state-dependent tools
- Support string query IDs (in addition to int) for memory-based queries
- Extract SQL dialect only from native query context type
- Use streaming.navigate-to-part instead of direct reactions
- Add instructions pattern to SQL tools for better LLM guidance

This aligns the SQL tools with the AI Service's transient query model
where queries exist in conversation state until explicitly saved.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Cleanup

* AI Service cleanup

* Refactor metabot tool registration

* Render LLM representations with Selmer

* Refactor tool result formatting

* define caps by metadata

* Refactor metabot v3 tools namespace

* Route agent tools to core implementations

* Simplify metabot tool wrappers

* factor out core.async as much as possible

* Refactor metabot v3 to use IReduceInit reducibles instead of core.async

- Replace channels with IReduceInit (reducible) pattern throughout
- Standard Clojure transducers work directly: (into [] xf (llm-call {...}))
- Remove core.async dependency from self namespace
- Rename chan? -> reducible?, sse-chan -> sse-reducible
- Rename tool-executor-rff -> tool-executor-xf
- Add malli schemas for agent state, messages, parts
- Simplify agent loop using reducible composition
- Update tests to use reducible patterns

* clarify

* ehhh sideeffect

* fix capabilities/nicer profiles

* tools tests

* api tests

* tools tests

* llm-repr test fixes

* fix profiles.clj

* clj-kondo woes

* is this the last test

* damn

* cljfmt

* fix api test

* update path for e2e tests

* little things

* output text fluidly to a user

* update modules config

* cleaning up links code duplication

* cleanup user context templates

* integration test

* cljfmt

* test

* fix read resource output format

* make clj-kondo happier

* simpler tool executor function

* better error messages from metabot backend

* potentially: ability to reload repl state when js is compiled differently

* metabot error messages and tests

* cleanup agent.messages code/tests a bit

* configurable api urls for llms

* use simple templates more

* format tools to string at their definition

* collecting usage and schema on tool

* system prompts

* datadog observability

* fix modules config

* make clj-kondo happy

* fix read_resource

* fix fe formatting

* more prompt changes

* improve search results tool response

* little cleanups and field-metadata with instructions

* sql dialect

* proper context instructions for sql tools

* report tool args well

* tool result should always have 'result' key

* coerce tool args to json

* good filters validation/errors to llm

* fix construct rendering in system prompt

* fix 'SQL Fixing'

* put queries in the context

* proper rendering for query data

* no :system-instructions

* proper capability check

* handle inline llm errors

* ability to debug llm queries

* fixes to improve llm behavior

* unify query formatting

* accept both variations of db id

* debug for python ai-service

* do not escape instructions

* fix claude usage tracking

* python has no header for tool instructions

* instruct llms to use fq table names

* slight prompt rewording to bring it closer to what benchmarks measure

* fancy field select - reduces amount of tool calls needed

* more clear naming

* simpler date filters handling

* retry logic

* great namespace movement

* no more stacktraces on agent errors

* fix token undercounting

* make sure request cancellation works through with native agent streaming

* Replace raw/endraw tags with safe/endsafe

* Fix issues with the sql profile

* openrouter as main provider

* review comments

* fix test for closing connections

* better schema for incoming messages

* fix agent tests

* cumulative usage from agent loop to reduce need for arithmetics

* clj-kondo/cljfmt

* transforms in read_resource tool

* get-dashboard-details

* test fixes

* fix temporal checks

* fix field_stats test

* fix remove-unreadable-transforms

* oh yeah very important type

* fix usage in native streaming

* fix api test formatting

* Get tools back (#69901)

* drop separate url for native agent, only have single url with a toggle

* fix error message in custom-elements e2e

* prompt generation (#69970)

* feat: documents content generation for clojure metabot (#69807)

* llm model select (#70061)

* BOT-866 Add prometheus metrics to metabot clojure agent part II (#70094)

* BOT-866 Add prometheus metrics to metabot clojure agent

* BOT-866 Also count inline aisdk errors

* BOT-866 push prometheus token counting down into call-llm

This is more in keeping with how current ai-service reports the metric, i.e. per llm call rather than a single batched
token usage per agent request.

This also has the advantage of keeping most prometheus metrics localized to the llm layer.

* Ensure that :metabase-metabot/llm-requests counts retries

This is more consistent with the existing ai-service llm_invocations_total metric

* Make :metabase-metabot/llm-duration-ms per llm invocation rather than cumulative

This more closely matches the existing ai-service llm_duration_ms metric

* Add :metabase-metabot/agent-duration-ms prometheus metric

Records the full duration of the outer agent loop, now that :metabase-metabot/llm-duration-ms records individual llm calls.

* Add comment on :metabase-metabot/llm-duration-ms buckets

And extend the low end of the range down to 100ms

* fixup! Add :metabase-metabot/agent-duration-ms prometheus metric

* Fix whitespace

* Add prometheus metrics tracking to call-llm-structured

* Allow llm callers to specificy the source label for prometheus metrics

And pass "example-question-generation" for question generation.

* Fix call-llm-prometheus-test

After rebasing on #70061 these tests need to include the "openrouter/" provider prefix along with the model.

* BOT-1051 Fix provider in generate-example-questions (#70121)

After #70061 call-llm-structured now expects the model to include a
provider prefix, so "anthropic/claude-haiku-4-5" was getting parsed as
:provider "anthropic" :model "claude-haiku-4-5".

Update metabase-enterprise.metabot-v3.example-question-generator/call-llm to
use the provider + model configured via llm/ee-ai-metabot-provider

* BOT-1039 Add snowplow token_usage event tracking to the clojure agent (#70049)

* BOT-1039 Include the profile :name in the profile map in register-profile!

Sometimes it's useful to be able to exract the profile name when you only
have a reference to the profile.

* Add token_usage snowplow event tracking to the clojure agent

- refactor register-profile! to single-arg form with :name now stored in the profile map and returned by get-profile
- report-token-usage-xf now emits a :snowplow/token_usage event per LLM call alongside existing prometheus metrics
- pass tracking-opts from loop-step through call-llm into the token-usage transducer
- likewise for callers of call-llm-structured
- init-agent generates a per-run request-id UUID
- run-agent-loop accepts an optional conversation-id that turns into the snowplow token_usage session_id

* Add :model to tracking-opts and drop separate source arg

The prometheus source label should always be the same as the snowplow :tag (that's how it works in ai-service), so
drop the separate `source` arg from various functions and just take the source label from the tracking-opts :tag.

* Destructure token-opts in report-token-usage-xf

* Allow passing tracking-opts to run-agent-loop

And use this to override the :source in metabot-v3.api.document/native-generate-content

* Improve docstring for tracking-opts

* Provide model and source defaults in report-aisdk-errors-xf

* Fallback to analytics-uuid if premium-embedding-token is unset

* Fix typo: snowplot -> snowplow

* Compute hashed-token-or-uuid once rather than for each usage part in report-token-usage-xf

* BOT-1039 Move token-usage funcs into analytics module (#70213)

* BOT-1052 Move token-usage funcs into analytics module

So they can be shared between oss sql gen and metabot.

* Add some snowplot tests for self/call-llm and call-llm-structured

* Add prometheus tests for call-llm-structured

* Add basic snowplow and prometheus tests for example question generation

* Modify agent loop snowplot test to use with-fake-snowplow-collector

* Modify native-generate-content-snowplow-test to use with-fake-snowplow-collector

* Fix whitespace

* fix: context not included in sql profile

* drop unused tool find-outliers (#70424)

* fix: add error field to transforms

* fix: common library not used by agent

* BOT-1053 Add snowplow events for agent tool calls (#70338)

* BOT-1039 Create metabase.analytics.util

And move some func there from metabase.analytics.llm-token-usage that will also be needed for agent_used_tool events.

* Add ai_service_event snowplow schema

In preparation for tracking the following events:

- agent_tool_used
- user_intent
- agent_action_summary

* Track snowplow agent_used_tool events in metabase-enterprise.metabot-v3.self/call-llm

- add agent loop :iteration to tracking-opts
- add :duration-ms to :tool-output parts
- add report-tool-usage-xf to transducer chain in metabase-enterprise.metabot-v3.self/call-llm to track
  :snowplow/ai_service_event with :event "agent_used_tool"

* BOT-1054 Add snowplow events for user intent classification (#70351)

* BOT-1054 Add snowplow events for user intent classification

* Move run-agent-loop :conversation-id into :tracking-opts :session-id

It does make some sense as a top-level argument, but it's currently only used for snowplow tracking, so push it down
into the tracking-opts.

* Move run-agent-loop :track-user-intent? into :tracking-opts

* Add ee-ai-metabot-provider-lite defsetting and use it in classify-user-intent!

This allows using a lighter weight model for simple tasks like user intent and/or agent response
classification. Defaults to openrouter/openai/gpt-oss-20b which is the same model used by ai-service for these tasks.

* Add run-agent-loop! test helper to run the agent for side effects

* whitespace: fix alignment

* Extract :tracking-opts schema into an mr/def similar to other agent opts

* Rename :profile-name -> :profile-id in tracking-opts

* use embeddings proxy directly rather than via ai-service (#70419)

* fix modules config

* fix: metabot has no context on the currently open transform (#70506)

* sql profile requires tool call to be forced (#70497)

* fix snowplow test

* revert back renames for ai-service embedding provider to evade migration (#70649)

* Add ai-service-port to branches list in uberjar.yml

* BOT-1085 Allow user-intent classification to be disabled (#70521)

Add a new ee-ai-metabot-internal-tasks-enabled? setting to allow disabling metabot internal "bookkeeping" tasks that might make additional llm calls, like user intent classification.

* Fix incorrect docstrings and copy-paste errors in settings and tools (#70793)

* Ai service port  validate sql (#70259)

* metabot-v3.tools.util/validate-sql stub

* Add query to dialect mapping

* Hook validation into tools code

* Add validation error instruction

* query-by-id helper

* Move sql validation to agent/tools/sql.clj

* WIP convert edit-sql-query-tool

* Revert edit-sql-query tool

* Drop validation code from tools/util.clj

* Add tools/sql_validation.clj

* Use sql-validation in tools/create_sql_query.clj

* Use sql-validation in agent.tools.sql/create-sql-query-tool

* Add transpile_sql to sql_tools.py

* Add transpile-sql to sql-parsing

* Macaw implementation stub

* Add transpile-sql interface multimethod

* Update transpile_sql in sql_tools.py

* sql-tools/transpile-sql stub

* Add template tag sentinel to sql_tools.py

* sql-tools/transpile-sql schema

* Sqlglot transpile-sql wrapper

* sql-parsing/transpile-sql result normalization

* Hook sql-tools/transpile-sql into metabot-v3.tools.sql-validation/validate-sql

* Adjust create-sql-query-tool to validate-sql changes

* Adjust reason in sql_tools.py

* Add create-sql-query-validation-failure-test

* Addjust validate-sql

* Revert edit-sql-query tool

* Add validation to metabot_v3/tools/edit_sql_query.clj

* Add schema and update returns for create-sql-query

* Add metabot-v3.tools.sql.common

* Update edit_sql_query

* Update edit_sql_query tool

* Add validation failure test for edit-sql-query-tool

* Adjust edit-sql-query-code-edit-tool

* Adjust create-sql-query-code-edit-tool

* Update replace-sql-query and related

* Adjust replace-sql-query-tool

* Update replace-sql-query-code-edit-tool

* Adjsutment for test

* metabot-v3.tools.sql.validation ns

* validate-sql sentinels

* Hoist template tags sentinel into tools.sql.validation

* Update schema

* Validation tests

* Add transpilation tests and adjust sql_tools.py

* Add dialect mapping

* Adjust validation and tests

* Adjust test

* linter

* Cleanup

* Add tests

* Tests and validation

* More tests and cleanup

* Drop redundant tests

* Use original dialect

* Adjust tests

* whitespace

* Remove direct query manipulation from tests

* Remove direct mbql manipulation from create-sql-query

* Remove more of direct query manipulation

* More remarks

* surface openrouter error messages

* API keys are sensitive (#70847)

* Generate tool manifest from endpoint metadata (#70780)

* Generate tool manifest from endpoint metadta

* Delete reference file

* tweak-and-tidy

* More testing, more robustness

* Fix kondo and cljfmt

* Scrap name inference

* Clean up tool assertions

* Remove silly separators

* Switch away from tool registry approach

* rename + slightly simplify prefer-tool-descriptions

* Replace definitions binding with an explicitly threaded atom

* Minor cleanups/refactor

* Pull over some annotations from my prior PR; tweak test comments

* address comments

---------

Co-authored-by: Noah Moss <noahbmoss@gmail.com>

* properly fetch data for user-is-viewing context (#70857)

* serialize error to string if it is not - backend expects a string anyways

* chore: trigger CI

* [BOT-1056] Metabot Analyze Chart in CLJ Port (#70177)

* init analyze chart tool

* fix compilation error; add interpretation instructions; reduce memory leak

* Add license overrides for techascent/tech.config and net.openhft/zero-allocation-hashing

* Remove hard-coded :debug true in /agent-streaming endpoint

* Fix conflict resolution due to tools.analytics after rebase

tools.analytics and find-outliers were dropped in 974b595784

* BOT-1058 analyze chart add support for non timeseries charts (#70616)

* Add stats for categorical charts to analyze-chart tool

* Add stats for scatter plots to analyze-chart tool

* Add stats for histograms to analyze-chart tool

* Add time series tests for metabot chart analytics

* Add outliers tests for metabot chart analytics

* Small tweaks to reduce the diff between clojure port an ai-service stats

stats/scatter.clj

- Added sample-points helper (random sample up to 30 pairs)
- compute-series-stats: adds :sampled_points (30 random [x y] pairs),
  :outliers (MAD-based, x-values passed as "dates" so each outlier carries its x-coordinate in :date)
- compute-scatter-stats: extracts :x_name / :y_name from series metadata

stats/categorical.clj

- compute-categorical-stats: extracts :x_name / :y_name from series metadata

stats/histogram.clj

- compute-series-stats: now takes optional x-values (single-arity falls back to sequential indices);
  adds :bin_data (all [x y] pairs)
- compute-histogram-stats: extracts :x_name / :y_name from series metadata

stats/repr.clj

- generate-temporal-context: added "incomplete period" sentence
- New compute-data-characteristics: derives small_counts/high_variance/sparse_data flags from existing stats fields (no raw values needed)
- New render-data-characteristics-note: emits **Note**: ... matching Python's exact warning text
- All generate-*-representation functions: use display-type from context for the **Type**: line (fixes "Scatter" → "bar" for binned bar charts)
- Scatter: added **X-axis**, **Y-axis**, note, **Sample Data**, **Outliers** (x=..., y=...) sections
- Categorical: added **X-axis**, **Y-axis**, note
- Histogram: added **X-axis**, **Y-axis**, note, **Bin Data** section (in addition to existing percentile/shape stats)

* Add Data Points to categorical repr to match python implementation

* Do not mention cross-referencing the chart visual

Unlike the Python implementation, the clojure port does not include the chart image in the context.

* Fix detect-chart-type to correctly detect histograms

histograms have :display_type "bar" not "histogram"

* Add some limits on amount of data to analyze in analyze_charts

Downsample series data to 10k datapoints and cap series at 10 when calculating cross-series correlations.

* Add metabot-v3.stats.util ns and move some shared code there

* Use TMD funcs to compute percentiles, quartiles, skew and kurtosis in histogram.clj

* Cleanup comments and formatting in stats/core.clj

* Cleanup comments and formatting in stats/categorical.clj

* Cleanup comments and formatting in stats/histogram.clj

* Cleanup comments and formatting in stats/repr.clj

* Cleanup comments and formatting in stats/scatter.clj

* Fix make-series and drop compute-summary-median-test in util_test.clj

* Cleanup stats tests

* Use =?/approx in test assertions where appropriate

* Move all repr tests into repr_test.clj

* Add some more repr tests

* Add ^:parallel to metabot stats tests

* Make defs private where possible

* Add malli schemas for public funcs in metabot stats

* Replace some? with more specific test assertions where appropriate

* Remove unused find-outlier-indices

* Remove unused malli schemas ::analyze-chart-input ::analyze-chart-output ::chart-type

* Move nan->nil into stats.util and use it in compute-series-stats

* Rename `dates` arg to `labels` in find-outliers and find-outliers-cumulative

These funcs were originally added for timeseries data where the dependent variable was a date/time value, but are now
used for other chart types were the dimension might be any value.

* Fix trailing whitespace

* Convert series keys to strings in chart configs

* Change ::column-type malli enum from keywords to strings

This matches what we get from the frontend

* Add X-axis range to histogram stats and rename **Bin Data** to **Sample Data**

To match the scatter plot output

* Reduce code dup and extract shared helpers in repr.clj

* Fix kondo warning: reduce -> apply

* Add missing keys to malli schemas

* Ensure top/bottom categories are also deduped and aggregated

* Only calculate categorical :percentage if all values are non-negative

* Handle case where correlation coefficient is exactly zero when setting :direction

* Record :data_points in addtion to :categor_count for categorical stats

* Switch to computing weighted estimates plus structural metrics for binned histogram data

* Fix lint error due to reflection warning

* Fix waterfall chart type detection and improve handling for :unknown charts

Co-authored-by: Oleksandr Solovyov <o@solovyov.net>
Co-authored-by: Maksym Yakubych <undrfined@gmail.com>
Co-authored-by: Mike Appleby <86076+appleby@users.noreply.github.com>
Co-authored-by: Maksym Yakubych <maksym@metabase.com>
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Tyler Plude <tsplude@gmail.com>
2026-03-17 16:22:57 +02:00
Nemanja Glumac
65309ff9cb Revert "Update translations 2026-03-11 (#70712)" (#71003)
This reverts commit a989194135.
2026-03-17 14:26:08 +01:00
Nemanja Glumac
36be55e774 Increase the polling timeout (#70999) 2026-03-17 14:00:30 +01:00
Riley Thompson
0c0f3450dd Show expected type in custom expression error message (#70400)
* initial attempt at better error message

* clean up

* Clean up

* improve doc string

* fix cljc test

* add test

* fix test

* exclude perf functions

* have schema produce user facing expected type

* clean up

* Add test

* fix kondo

* defer i18n

* try test fix

* address comments

* update tests
2026-03-17 08:54:48 -04:00
github-automation-metabase
5ac9afd0f5 Auto-update documentation for master (#70988)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-17 08:52:37 -04:00
Jakub Chodorowicz
21ebfb0a1b Gdgt 2002 transform inspector shows 12 matched columns but renders 2 (#70951)
* create failing test case for comparison layout and groups

* fix cards not loading when they part of group is visible
2026-03-17 13:48:32 +01:00
Uladzimir Havenchyk
52d5e78767 fix: perf improvements for documents (#70802)
* fix: perf improvements for documents

* fix unit test

* address comments
2026-03-17 13:40:47 +03:00
Kamil Mielnik
492008d7fd GDGT-1939 Get rid of VisualizationSettingDefinition["props"] (#70867) 2026-03-17 14:12:56 +07:00
Rodrigo López Dato
08c8928cf3 Update Athena parameter suggestions to JDBC v3 driver (#62689) 2026-03-16 17:16:14 -06:00
github-automation-metabase
a989194135 Update translations 2026-03-11 (#70712)
* Update translation sources 2026-03-11

* Update translations

* Fix host/sample apps e2e assertions

* Improve assertion

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2026-03-16 17:15:56 -06:00
Braden Shepherdson
3c152db0a1 [MBQL lib] Start on user docs: top-level and expressions (#70375)
Part of QUE2-366.
2026-03-16 17:15:33 -06:00
Nathan Voxland
19d6d374c8 Correctly detect funnel chart config in static-viz (#68158) 2026-03-16 15:43:29 -05:00
Kevin Kelleher
7e3b3f1818 Fix trend visualizations that rely on aggregated datetimes (#70941) 2026-03-16 14:37:45 -04:00
Kevin Kelleher
4cb40dd358 Fix sunburst chart labels not appearing (#70889) 2026-03-16 14:37:25 -04:00
Nicola Mometto
525b09b87b incremental transforms with source filter (#70573)
* WIP: incremental transforms with source filter

* fix: route through substitution

* chore: remove useless check, we're already in python specific code

* fix: validate before parsing

* style

* fix test

* chore: format

* chore: turn off legacy incremental settings

* chore: remove dead code

* chore: remove dead code

* fix tests

* fix warnings

* fix

* update modules

* feat: store actual type

* feat: derive type, store lo/hi in transform runs

* feat: store checkpoint early so it's available on afailure

* feat: surface checkpoint values in UI

* refetch after run

* surface checkpoint value in UI

* fixes for the linter gods

* chore: format

* remove dead e2e test

* fix rebase

* feat: reset checkpoint if incremental field changes

* chore: do it in before-update instead

* chore: test

* chore: add preconds

* fix: remove rebase field that got in

* feat: thread source-range-params through

* fix test

* remove secondary index

* chore: proper schema

* fix: extract proper source columns from UI components

* fix e2e test

* add option to reset checkpoint

* UI: confirmation on field change

* style

* don't break on old import

* fail when running an incremental transform w/o a field set

* chore: polish UI

* appease linter

* add source-filters to table template tags in the BE

* chore: test

* chore: restrict ops

* extend schema

* chore: extract ->sql util

* chore

* some BE cleanup

* make checkpointFilterFieldId mandatory

* preselect first checkpointFilterFieldId when selecting incremental in standalone variant

* improve forced type assertion

* autoselect first value for checkpoint field also in embedded mode

* extract useAutoSelectFirstOption hook

* refactor nested ternary

* disable incremental toggle when no fields checkpoint available

* add better warning for native query lack of tag

* allow turning off incremental for transforms with issues

* consolidate temporal value to ISO

* Adjust style of reset checkpoint button

* Adjust modal confirmation copy

* convert date to iso also in  save-watermark

* fix date time field type detection

* remove superflous space

* feat: better mbql migration

* fix: whitespaces

* extend FormInlineUpdated to accept break condition onBeforeUpdate

* adjust styling

* extract ResetCheckpointSection

* remove superfluous comment

* rename hooks file

* refactor hasCheckpointOptions

* add comment about stage

* chore: validation

* CTA warning on malformed transforms

fix

* fix: refer to variable instead of template tag

* chore: i18n

* refactor transform warning

* schemas for source-range-params

* deal with review comments

* feat: emit via honeysql instead of string interpolation

* fix: use lib/template-tags

* cleanup

* fix IncrementalTransformSettings tests

* refactor, extract TransformType type

* fix: indent

* fix check

* fix tests

* fix lint

* simplify useHasCheckpointOptions

* cleanup utils unit tests

* chore: also add to lib/schema

* fix missing query metadata in useHasCheckpointOptions

* reset the checkpointFilterFieldId if incremental switch is toggled of

* fix transforms e2e tests

* feat: migration test

* chore: reorder

* adjust transform create tracking

* fix e2e GDGT-1774 reproduction

* fix missing space

* simplify useAutoSelectFirstOption hook

* add incremental sql transform e2e test

* add native sql incremental transform test

* add python incremental transform e2e test

* skip sql test for now

* auto include aliases

* simplify hover info

* fix and unskip incremental schema test

---------

Co-authored-by: Dan Stone <wotbrew@gmail.com>
Co-authored-by: Jakub Chodorowicz <jakub.chodorowicz@metabase.com>
2026-03-16 17:20:46 +00:00
Riley Thompson
0ac98129d9 Inline parameter in clickhouse honeysql method (#70905)
* suggested fix and test

* Clean up test

* clean up test
2026-03-16 15:49:00 +00:00
Nicolò Pretto
64712e1f3f feat(embed-onboarding): Block all schemas that does not contain selected (#70717)
* feat(embed-onboarding): Block all schemas that does not contain selected
tables when setting up RLS

* v2

* fix e2e

* clean up tests
2026-03-16 16:16:45 +01:00
Eric Normand
f3bff3f028 Fix 500 error in check-card endpoint for cards with broken dependents (#70828)
Fix unhandled exception in POST /api/ee/dependencies/check-card that causes a 500 when a transitive dependent card fails to compile

 When check-query-soundness iterates over all dependents, if any card's query throws during compilation (e.g. alias resolution errors), the exception propagated uncaught and crashed the entire endpoint
 
Added try/catch around check-entity calls in check-query-soundness, returning a validation-exception-error instead of crashing — consistent with the pattern already used in `/dependencies/findings.clj`

On the stats instance, card 4523 has 2,557 transitive card dependents. One of those dependents (a native query referencing card 34523 via a template tag) fails during query compilation with `Missing ::desired-alias->escaped for "email_domain"`. This compilation error is unrelated to the proposed edit but was bringing down the whole endpoint.

Test plan

  - Verify POST /api/ee/dependencies/check-card returns 200 with {success: false, bad_cards: [...]} instead of 500 when a dependent card has a query compilation error
  - Verify that cards with compilation errors appear in the response as validation-exception-error findings
  - Existing dependency check tests still pass
2026-03-16 14:59:17 +00:00
Ngoc Khuat
8454245aaa Use safe identifier quoting in workspace grant statements (#70869) 2026-03-16 14:58:24 +00:00
Nicola Mometto
3cc709ee43 Aliases for table template tags (#70893)
* auto include aliases

* simplify hover info

* add unit test for emit tables toggle

---------

Co-authored-by: Jakub Chodorowicz <jakub.chodorowicz@metabase.com>
2026-03-16 14:56:21 +00:00
Nicola Mometto
88729c52f1 Table tags filters (#70699)
* add source-filters to table template tags in the BE

* chore: test

* chore: restrict ops

* extend schema

* chore: extract ->sql util

* deal with review comments

* feat: emit via honeysql instead of string interpolation

* fix check

* chore: also add to lib/schema
2026-03-16 13:56:47 +00:00
Nicola Mometto
d8104c911d untgz: use resolveIn to prevent zip slip (#70921) 2026-03-16 12:49:46 +00:00
Nicola Mometto
5d5930ab64 Track OSS transform usage in Snowplow (#70925)
move snowplow transform metrics to OSS, as transforms are now available on OSS
2026-03-16 12:47:28 +00:00
github-automation-metabase
2738ec81b7 Reduce number of tests kept in memory for embedding SDK component tests (#70928)
* Add memory management settings to SDK component test Cypress config

Add experimentalMemoryManagement: true and numTestsKeptInMemory: 0 to
the embedding SDK component test config. The config spreads defaultConfig
which lacks these settings, causing Cypress to retain 50 DOM snapshots
per test (the default). This leads to Chrome renderer OOM crashes during
content-translations.cy.spec.tsx.

- experimentalMemoryManagement: true triggers gc() between tests
- numTestsKeptInMemory: 0 prevents DOM snapshot heap accumulation

* Use numTestsKeptInMemory: 1 to match main CI config convention

Change from 0 to 1 per review feedback. This matches the value used in
the main e2e config (config.js:190) and keeps the last snapshot available
for debugging while still preventing OOM from the default of 50.
2026-03-16 12:35:32 +00:00
Nicola Mometto
cd77eb5140 Skip running transform jobs if there are no transforms to run (#70926)
* fix: don't run transform jobs if there are no tranforms to run

* chore: add test
2026-03-16 12:34:46 +00:00
Kevin Kelleher
2a4046736a Fix pivot table drill through when binning a datetime by day (#70680) 2026-03-16 07:29:47 -04:00
Ngoc Khuat
660c1ddfe6 Fix flaky scoring-test/mine-test on H2 (#70852) 2026-03-16 17:48:53 +07:00
Ngoc Khuat
6845e78a5d Fix flaky schema-change integration test on Redshift (#70863)
Fix flaky python-transform-schema-change-integration-test on Redshift

Replace fixed Thread/sleep with polling for correct field metadata.
The transform pipeline sets run status to :succeeded before
complete-execution! (which runs the metadata sync) finishes. On
Redshift, the sync takes longer due to network latency, so the
2-second sleep was insufficient — the QP would query with stale
Field records (still referencing the old "age" column).
2026-03-16 17:48:27 +07:00
github-automation-metabase
eea9a750d6 Add 403 error handling to rerun-workflows.yml (#70916)
Handle 403 errors in rerun-workflows.yml

Wrap the reRunWorkflowFailedJobs API call in a try/catch that
gracefully handles HTTP 403 errors. This prevents false-positive CI
failures when the target run is cancelled, a PR run, or otherwise
ineligible for retry.

Also adds missing await to the API call so errors are properly caught.
2026-03-16 08:42:34 +01:00
metabase-bot[bot]
123a4f966d [chore] Update E2E test timings with recent data (#70913)
Update E2E test timings with averaged data

Collected timing data from 7 days of test runs.
All specs with timing data were included (simple averages).

🤖 Generated automatically by update-e2e-timings workflow

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>
2026-03-16 07:02:38 +01:00
Denis Berezin
659d0a37b1 Add side-panel to Tables and Metrics in the Library (#69673)
* Temp

* Add full implementation

* Add e2e tests

* Remove excess image file

* Temp

* Address design issues

* Fix design review comments

* One more fix

* Fix e2e tests

* Remove empty source gotcha

* Address review issues

* Revert graphy changes
2026-03-14 02:22:45 +03:00
Eric Normand
59a52b2631 Validate FK target and dimension remap fields belong to the same database (#70879)
- Adds same-database validation for `fk_target_field_id` in `PUT /api/field/:id` (resolves existing TODO)
- Adds existence and same-database validation for `human_readable_field_id` in `POST /api/field/:id/dimension`
- Returns 400 if the target field belongs to a different database than the source field
2026-03-13 22:22:20 +00:00
bryan
a83196324b Fix MySQL 8.4 app-db test failures in dependencies tests (#70897) 2026-03-13 16:11:42 -06:00
Robert Kosara
9ab2bfbae8 Update HAR file creation instructions to include sensitive data (#70394)
Updated the documentation to clarify that the HAR file contains sensitive data and revised the instructions for saving the HAR file accordingly. Also added a screenshot of the settings in Chrome.

---------

Co-authored-by: Rodrigo López Dato <rodrigo@metabase.com>
2026-03-13 14:28:16 -07:00
Eric Normand
c261122999 Fix broken deps not surfaced for missing fields in :fields (GHY-3157) (#70865)
- The `:soft?` marking in `find-bad-refs-with-source` was too broad — it marked **all** bad refs in `:fields` clauses as soft, even when the field was completely missing from the source (not just inactive).
- Added `(not (:active column true))` guard so only **inactive** fields in `:fields` are marked `:soft?`. Missing/unresolvable fields remain hard errors and are properly surfaced by dependency analysis.
- This preserves the GHY-3044 fix (inactive fields the QP can drop are still soft) while fixing GHY-3157 (genuinely missing fields are reported).
2026-03-13 21:03:54 +00:00
Denis Berezin
0b65ccce3a UXW-3177 batch dashcard queries by 5 (#70542)
* UXW-3177 batch dashcard queries by 5

* Add unit tests

* Remove fetch limit for HTTP2+
2026-03-13 23:44:45 +03:00
Nathan Voxland
bb2adc5f46 Changed repro-bot label to ".Run Repro Bot" (#70890) 2026-03-13 15:37:09 -05:00
Ben Grabow
c5dcdc3238 Temporarily disable app db version checks (#70884)
* Temporarily disable app db version checks

* Comment out unused code

* Entirely rip out unused code
2026-03-13 12:47:04 -07:00
Aleksandr Lesnenko
5537f0f258 Add cypress claude setup (#70715)
e2e skills
2026-03-13 15:06:50 -04:00
Riley Thompson
bfdd8a0b23 Handle clickhouse dbname when it has spaces in it (#70822)
* take first name

* Add test

* fix test

* Add comment

* fix typos

Fix typo in comment regarding legacy `dbname` handling.
2026-03-13 18:47:35 +00:00
Riley Thompson
3c05a30b8e Enable old clickhouse tests (#70756)
* enable clickhouse tests

* enable more tests

* fix kondo and test
2026-03-13 18:22:20 +00:00
Alex Yarosh
106a707fcc docs: it's writable not writeable (#70877)
* it's writable

* no md in redirect dummy
2026-03-13 14:14:52 -04:00
Nathan Voxland
21c8136e7e Repro Bot Enabling (#70823) 2026-03-13 13:10:22 -05:00
Nathan Voxland
d1252c7e8e Fixed merges from master 2026-03-13 11:59:15 -05:00
John Swanson
7319599ceb Fix token check errors on startup (#70789)
During startup, the database isn't migrated yet, so we can't check the
token hash.

If the database hasn't been started yet, skip checking the token hash in
the DB and just delegate to the lower-level checker that actually hits
the store.
2026-03-13 08:46:20 -08:00
Nathan Voxland
13bc693357 Can't use regex filter with \b on non-ascii names (#70838) 2026-03-13 11:36:45 -05:00
Nick Fitzpatrick
2b11a3bed2 Update react-grid-layout and react-resizeable (#70760)
* Update react-grid-layout and react-resizeable

* adding e2e test

* e2e adjustment
2026-03-13 13:20:12 -03:00
Nathan Voxland
4a7059cac7 Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	resources/migrations/059_update_migrations.yaml
#	src/metabase/search/appdb/core.clj
#	src/metabase/search/core.clj
#	src/metabase/search/impl.clj
#	src/metabase/search/ingestion.clj
#	src/metabase/search/task/search_index.clj
2026-03-13 11:09:28 -05:00
Nick Fitzpatrick
c910ca3fd3 measure table names in tree in v1 data model page (#70657) 2026-03-13 12:23:45 -03:00
bryan
d8b40292d1 Disable blocking dependency checks on save (#70819) 2026-03-13 15:18:49 +00:00
Nick Fitzpatrick
b773f68f23 update html2canvas-pro (#70728)
* update html2canvas

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2026-03-13 12:13:20 -03:00
Edward Paget
647861b624 test: agent-specific test runner (#70821)
* test: agent-specific test runner

Adds an "agent" test runner that filters the output of running `clojure
-X:...:test` commands to make it more relevant for agents preventing
them from needing to use tail or grep to find information and reducing
context pollution.

Also implements randomized ports for test web-servers allowing multiple
agents to run tests in parallel (or to run multiple commands in
parallel). This removes the directive to use the ./bin/mage-based test
runner, to direct agents to use the agent-specific runner.

* fixup! missing import

* add the test agent script
2026-03-13 10:00:49 -05:00
lbrdnk
e741639713 Error source for native entities (#70021)
* Update schema with unknown error source

* Adjust validate-native-query

* Update tests

* Extend error source to multi table queries

* Update test

* Sql-tools providing more functions

* Card references

* Update tests

* require

* Unrelated fix

* repl reloading

* Tests

* Use placeholders instead of dummy subqueries

* Comment

* Placeholders

* Modules (temporary)

* potemkin

* Address circular deps extend sql-tools interface

* Sort modules

* Fix params

* Adjust test

* Placeholder

* More tests

* Cleanup

* whitespace

* Remove explicit unknown for now

* typo

* Update tests

* Break the circular dep more standard way

* Add comment

* whitespace
2026-03-13 16:00:06 +01:00
Anton Kostenko
5765b0df15 Add OpenTelemetry Tracing module (#69295)
* Add OpenTelemetry Tracing module

---------

Co-authored-by: dan sutton <dan@dpsutton.com>
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2026-03-13 10:48:13 -04:00
Nicola Mometto
40d00b8e7f add missing tags to enterprise settings (#70846)
fix: add missing tags to enterprise settings
2026-03-13 13:07:48 +00:00
github-automation-metabase
58cde65c4e Auto-update documentation for master (#70840)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-13 09:05:50 -04:00
Sébastien
5995621da8 Fixed color flickering for sdk question titles (#70842) 2026-03-13 13:52:48 +01:00
Sébastien
70d4a78914 Fixed issue when hiding SDK banner (#70727) 2026-03-13 13:52:30 +01:00
Fraser
cf6e1c032a Add module metrics (#70841) 2026-03-13 06:49:54 -06:00
Riley Thompson
e70f22e0eb Upgrade snowflake jdbc to 4.0.1 (#70505)
* upgrade snowflake jdbc to 4.0.1

* remove unnecessary exclusions

* replace internal parse

* fix eastwood

* address comments

* handle edge case
2026-03-13 08:43:15 -04:00
Riley Thompson
4fd189509f Ignore unknown settings in clickhouse (#70799)
* move additional options to clickhouse settings

* add test

* add test description

* add prefix and keep in subname

* just ignore unknown settings

* fix test
2026-03-13 12:39:37 +00:00
Ngoc Khuat
f7fd7fe5c5 Add workflow_dispatch action to reset cloud datasets (#70744) 2026-03-13 19:06:30 +07:00
Nicolò Pretto
a0e28bc775 fix: use the correct setting for enabling metabot in the embed wizard (#70820) 2026-03-13 09:54:13 +01:00
Aleksandr Lesnenko
a5b4f10c10 Metrics viewer fixes (#70655)
* fix conflicting filters on the same dimension

* og pr review feedback

* fix label
2026-03-12 22:54:34 +00:00
bryan
57502d5ef1 Fix cloud driver tests skipped when deps.edn changes [DEV-1672] (#70833) 2026-03-12 15:24:41 -07:00
bryan
b2f981e967 Fix flaky sync-materialized-views-test with auto-retry (#70750) 2026-03-12 15:50:48 -06:00
Fraser
fb8f72b7bd Setup boundaries linter (#70768) 2026-03-13 10:14:20 +13:00
Riley Thompson
502b66528c Wrap sqlserver boolean expressions in a case statement (#67136)
* wrap in case

* wrap case in cast, cleanup

* comments

* rename

* add test

* move comparison operators to lib.schema.filter

* Add boolean ops

* add and, or, not. rename comparison to predicate

* clean up tests
2026-03-12 17:05:01 -04:00
Jeff Bruemmer
2838b6501c docs - clickhouse server setting prefix (#70827)
clickhouse server setting prefix
2026-03-12 14:01:06 -07:00
Nemanja Glumac
7603550836 Revert "Replace circleci Docker images with the official DB images (#70773) (#70813)
This reverts commit 9ad40ab1c3.
2026-03-12 20:56:55 +01:00
Nick Fitzpatrick
ba8074bb87 New password generation for users (#70646)
* New password generation for users

* update to use window.crypto
2026-03-12 16:31:12 -03:00
John Swanson
90097715d2 dev env + start (mage -johnswanson-dev-env) (#70741)
Babashka task that starts up an isolated dev environment per worktree. Expands on @edpaget's excellent work, with interactive fzf prompts for edition, token, appdb, and warehouse services. Optional `--run` flag to launch backend + frontend in the background with PID tracking. Persistent config in `.dev-env-state.edn` for reuse across invocations.
2026-03-12 08:58:06 -08:00
Stas Gavrylov
12839276af GDGT-1893: Generate .d.css files to support CSS Variables autocomplete (#68723)
* CssVarsDeclarationPlugin: Add plugin and documentation to generate .d.css files at build step

* CssVarsDeclarationPlugin: Add recommended .vscode settings to support CSS vars autocomplete

* CssVarsDeclarationPlugin: Fix nested unions parsing

* CssVarsDeclarationPlugin: Add unit tests

* Update vscode settings for css vars to include Mantine
2026-03-12 18:24:54 +02:00
Nemanja Glumac
2ef536a0fe Cross-version follow up (#70800)
See:
https://github.com/metabase/metabase/pull/70063#discussion_r2924663893
2026-03-12 16:53:57 +01:00
Nemanja Glumac
9ad40ab1c3 Replace circleci Docker images with the official DB images (#70773) 2026-03-12 15:21:32 +01:00
Mahatthana (Kelvin) Nomsawadi
6351e5bc0e Fix SDK subscription not working under StrictMode (#70663)
* Fix can't click on the time dropdown on subscription sidebar in StrictMode

* Add tests

* update e2e test

* Fix unit tests

* improve code clarity

* Fix E2E tests

* Simplify code

* Make default value consistent

* Make the new Select button have dynamic size

* Fix unit tests

* Fix E2E tests
2026-03-12 14:09:28 +00:00
Nemanja Glumac
18d8dadf1b Cross-version testing infrastructure - Stage 1 (#70063)
Adds health-check-only cross-version migration tests using Docker Compose
with PostgreSQL. Tests verify that Metabase can upgrade/downgrade between
versions by checking the `/api/health` endpoint.

Usage:
```
./cross-version/test.sh --source v1.58.6 --target v1.58.7
```

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-12 14:36:47 +01:00
Chris Truter
d5f606e8f2 Upgrade toucan2 to 1.0.571 (#70771) 2026-03-12 14:00:09 +01:00
Alex Yarosh
acbf476d8b docs: maybe not deprecating (#70790)
Revise guidance on using Transforms over models

Updated recommendation for using Transforms instead of models.
2026-03-12 08:56:37 -04:00
Nick Fitzpatrick
21af2827f2 homepage redirect in useLayoutEffect (#70658) 2026-03-12 09:22:45 -03:00
Mahatthana (Kelvin) Nomsawadi
04b141b975 Fix flakes because we used JS instead of CSS (#70718) 2026-03-12 12:09:36 +00:00
Sébastien
ff9d9acdac Embedding upsells now open data studio modal in cloud (#70565) 2026-03-12 12:47:49 +01:00
Nemanja Glumac
d7848ee998 Bump eastwood timeout to 30 minutes (#70770) 2026-03-12 11:31:06 +01:00
Chris Truter
47c037a3f8 Use lib for MBQL construction in Workspace tests (#70532) 2026-03-12 09:38:01 +00:00
Chris Truter
ab1ccbf8ec Forward port migration moves from 58 -> 59 (#70765) 2026-03-12 09:30:07 +00:00
Chris Truter
8662aaaa87 Re-enable schema that was giving trouble (#70708) 2026-03-12 08:27:07 +00:00
Chris Truter
81b10ad959 Delete changesets orphaned by move from 59 -> 60 (#70719) 2026-03-12 08:25:10 +00:00
bryan
0a67d24d79 Fix dataset-already-loaded?-test flake on Redshift (#70748) 2026-03-11 16:20:36 -06:00
Romeo Van Snick
258305b914 Fix flakes (#70296)
* Fix flake

* Wait for unreferenced entities

* Wait for unreferenced entities

* Fix helper

* Fix test
2026-03-12 08:58:46 +11:00
Ben Grabow
21b67b2892 Show read-only mode banner to all users (#70529) 2026-03-11 16:22:01 -05:00
Nathan Voxland
3dcbfef5c5 Support MB_MONITOR_PERFORMANCE to write as files to a directory (#69582) 2026-03-11 15:41:56 -05:00
Ben Grabow
1ccf800dee Update minimum App DB versions (#70446)
* Upgrade mariadb images to 10.4.0

* Update job names to match the new version

* Advance minimum mariadb version to 10.4.6 to exclude unstable early versions of 10.4

* Don't specify patch version

* Upgrade images to MariaDB 10.6

* Upgrade CI actions to use pg14

* WIP: start updating MySQL 8.0 -> 8.4

* Advance minimum required app db versions

* Revert "Upgrade CI actions to use pg14"

This reverts commit 82f1aec823.

* Revert "WIP: start updating MySQL 8.0 -> 8.4"

This reverts commit c1c78d4298.

* Revert "Upgrade images to MariaDB 10.6"

This reverts commit f99d3c4f04.

* Revert just about all the changes to run CI

* Use newer MariaDB in semantic search tests

* Use newer mysql in semantic search tests

* Use newer postgres in semantic search tests

* Update app db version

* Update postgres version

* Trigger mysql driver tests

* Update unit tests to expect the new required versions

* Update mariadb and mysql used in drivers tests

* Fix expected supported mysql versions

* Remove dirt

* DRY the tests

* Dirt to trigger some CI tests

* Dirt to trigger some CI tests

* Remove dirt and update failing CI job

* Remove dirt

* Update another missed CI definition
2026-03-11 13:58:35 -05:00
da
d4d83d2f8e Upgrade Jetty to 12.1.7 (#70731)
CVE fix
2026-03-11 18:29:58 +00:00
Riley Thompson
3e655a0bb2 Get default port from nested connection properties (#70713)
* search for port in group fields

* add test

* update test

* simplify test

* fix sqlite
2026-03-11 18:06:17 +00:00
github-automation-metabase
0409c4a20b Add retry + checksum to Clojure install, remove continue-on-error (#70700)
* Add retry + checksum to Clojure install, remove continue-on-error

Remove continue-on-error: true from the Install Clojure CLI step so failures
surface immediately instead of silently propagating to downstream steps.

Add retry logic (3 attempts with curl --retry and --fail) and a post-install
clojure --version gate to handle transient download failures from
download.clojure.org.

* Add explicit error message when all Clojure install retries fail
2026-03-11 17:14:53 +00:00
Nicolò Pretto
b51c0c9efa fix typecheck broken on parameters.unit.spec.ts (#70725) 2026-03-11 15:53:12 +00:00
Nicola Mometto
51f8fb9af1 fix expected status of bigquery tests after #62351 (#70710) 2026-03-11 15:20:44 +00:00
metamben
bfb0b42b42 Get rid of category and id parameter types (#70196)
* Get rid of `category` and `id` parameter types

Closes QUE2-326
2026-03-11 17:40:42 +03:00
Chris Truter
09544d950d Log the migrations blocking the downgrade (#70701) 2026-03-11 13:19:18 +00:00
github-automation-metabase
03dd34ec4a Auto-update documentation for master (#70689)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-11 08:51:41 -04:00
Kamil Mielnik
d08e561420 GDGT-1793 Visualization Typescript Conversions - lib/ (#70249)
* Convert frontend/src/metabase/visualizations/lib/timeseries.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/timeseries.unit.spec.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/errors.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/mapping.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/warnings.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/trends.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/numeric.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/table.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/table.unit.spec.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/action.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/renderer_utils.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/renderer_utils.unit.spec.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/table_format.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/table_format.unit.spec.js to TypeScript
* Convert frontend/src/metabase/visualizations/lib/utils.js to TypeScript
2026-03-11 12:00:12 +00:00
mendral-app[bot]
214c38b3f2 Add retry loop to fetch-artifact action's download step (#70513)
Add retry loop to fetch-artifact download step

Wrap the downloadArtifact API call with a retry loop (3 attempts,
exponential backoff at 15s/30s) to handle transient GitHub API 500
errors that have been causing e2e and health-check job failures.

Co-authored-by: mendral-app[bot] <233154221+mendral-app[bot]@users.noreply.github.com>
2026-03-11 11:36:20 +01:00
mendral-app[bot]
52ae8a14db Fix prompt shell expansion in codespell workflow (#70290)
Fix codespell workflow: use prompt_file instead of shell expansion in YAML

The prompt field contained $(cat codespell_output.txt) which YAML passes
as a literal string — shell expansion does not occur in YAML values.
This caused Claude Code to receive the literal text instead of the actual
codespell output, resulting in exit code 1 on every nightly run.

Fix by writing the prompt to a file in a dedicated build step, then
passing it via the prompt_file input which claude-code-action supports.

Co-authored-by: mendral-app[bot] <233154221+mendral-app[bot]@users.noreply.github.com>
2026-03-11 11:23:16 +01:00
Chris Truter
e153a3290b Rename migrations that didn't make it to v59 (#70673) 2026-03-11 09:54:35 +00:00
Chris Truter
2830b3c94a Agent API for Workspaces (#70496) 2026-03-11 09:43:37 +00:00
Nicolò Pretto
2fa8abc247 Fix nested button DOM nesting in StepperWithCards (#70667) 2026-03-11 10:19:07 +01:00
Nemanja Glumac
be2a29d138 Remove devex from clj-kondo code owners (#70693) 2026-03-11 10:18:43 +01:00
Alexander Polyankin
ab089eb84d Fix CSS wrapping in replace sources (#70688) 2026-03-11 03:09:58 +00:00
Fraser
b40d76f5b4 Extract shared upsell components into common (#70619)
* Extract shared upsell components into common

 Moved to common/components/upsells/:
  - components/ subdir — the building blocks: UpsellBanner, UpsellBigCard, UpsellCta, UpsellGem, UpsellPill, UpsellWrapper, UpgradeModal, analytics, use-upsell-link
  - constants.ts — shared URLs and constants
  - 4 composed upsell pages used outside admin: UpsellEmbedHomepage, UpsellMetabaseBanner, UpsellStorage, UpsellUsageAnalytics
  - UpsellCard (merged in from its old location at common/components/UpsellCard/)

  Kept in admin/upsells/:
  - 13 admin-only upsell pages (UpsellBetterSupport, UpsellCacheConfig, UpsellCloud, UpsellDevInstances, UpsellEmailWhitelabel, UpsellHosting, UpsellPerformanceTools, UpsellPermissions, UpsellSSO, UpsellSdkLink,
  UpsellSemanticSearch, UpsellUploads, UpsellWhitelabel)
  - These now import primitives from metabase/common/components/upsells/ instead of ./components

  Updated ~30 import paths across the codebase. Reduced shared/common → feature/admin violations from 12 to 2.
2026-03-11 11:41:28 +13:00
Nathan Voxland
b12dfa4fd9 Per-PR liquibase changelogs (#70263) 2026-03-10 16:58:26 -05:00
John Swanson
5e2e510811 Handle Data Analyst group name conflict (#70594)
There are 30 instances on stats with groups named "Data Analysts". We
need to handle this case.

First, we modify the migration:

- set `validCheckSum` to `ANY` to handle the case where this migration
already ran

- skip if there's already a `data-analyst` magic group

- insert a group named "Data Analysts", if one doesn't already exist

- otherwise name it "Metabase Data Analysts" (there are 0 groups on
with this name in cloud, theoretically it's possible but someone would
have to have BOTH `Metabase Data Analysts` and `Data Analysts` for this
to be an issue).

Similarly, we create a "Data Analysts" group on startup in OSS if one
doesn't already exist. This group is an invisible placeholder, that will
become visible if the instance ever upgrades. Adopt similar logic here:
if the existing group for data analysts is called "Metabase Data
Analysts", rename it to "Metabase Data Analysts (converted)" and create
the new placeholder group as "Metabase Data Analysts".
2026-03-10 14:02:47 -07:00
Edward Paget
c6a2880b31 Add mage dev-env task for isolated worktree dev environments (#70602)
* Add worktree dev environment tooling

Add `mage dev-env` task for isolated worktree dev environments with
Docker containers and deterministic per-worktree ports. Includes workmux
layout with nREPL dev server, frontend build, and nvim panes. Adds a
custom Claude Code Docker image with Clojure tooling via mise, and
a bin/claude-dangerous helper script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Move dev-env mage task to personal -edpaget-dev-env task

Move the worktree dev environment tooling from the shared mage task
namespace (mage.dev-env) to a personal task namespace (mage.edpaget.dev-env),
remove the sample .workmux.example.yaml, and update .workmux.yaml hooks
to use the new command name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:01:59 -05:00
Jeff Bruemmer
5cd8e165fa docs - notes on timeouts (#70468)
notes on timeouts
2026-03-10 16:52:19 -04:00
Alexander Polyankin
05c26a4363 Clean up CODEOWNERS (#70666) 2026-03-10 14:32:41 -04:00
William
8ceeb1fce4 source replacement (#69257)
* fixes

* test parser changes

* schema test

* fix linter

* implicit join error

* fe tests

* fix linter

* test fixes

* more tests

* tests

* upgrade field refs for dashboardcard_series and dashboards in transitive deps

- Add dashboard-upgrade-field-refs! for Phase 1b: upgrades parameter_mappings
  on dashboards found in transitive deps (cards are upgraded first in Phase 1)
- Fix dashboard-card-update-field-refs! to find dashcards via
  DashboardCardSeries, not just by primary card_id
- Split dashboard-ids out of transitive in runner, pass separately to run-swap*
- Add tests for series card parameter mapping swap and dedup

* fixup some tests, add promise to progress instance

useful for test so we don't have to loop on the db row

```clojure
     (reify replacement.protocols/IRunnerProgress
       (set-total! [_ total] ...)
       (advance! [this] ...)
       (advance! [this n]
         (let [c    (swap! completed* + n)
               t    @total*
               prev (- c n)
               crossed-boundary? (or (= c t)
                                     (not= (quot prev progress-batch-size)
                                           (quot c progress-batch-size)))]
           (when crossed-boundary?
             (let [progress (if (pos? t) (double (/ c t)) 0.0)]
               (update-progress! run-id progress)
               (when (replacement.protocols/canceled? this)
                 (log/infof "Replacement run %d was canceled" run-id)
                 (when on-complete
                   (deliver on-complete :run/cancelled))  ;; <-----------
                 (throw (ex-info "Run canceled" {:run-id run-id})))))))
       (canceled? [_] ...)
       (start-run! [_] ...)
       (succeed-run! [_]
         (log/infof "Replacement run %d succeeded." run-id)
         (succeed-run! run-id)
         (when on-complete
           (deliver on-complete :run/success)))  ;; <--------
       (fail-run! [_ throwable]
         (log/errorf throwable "Replacement run %d failed" run-id)
         (fail-run! run-id (ex-message throwable))
         (when on-complete
           (deliver on-complete :run/fail))))     :<-----
```

and in tests we can do like so:

```clojure
(deftest advance!-progress-write-boundaries-test
  (testing "advance! writes progress at batch boundaries and on final item"
    (mt/with-premium-features #{:dependencies}
      (mt/with-model-cleanup [:model/ReplacementRun]
        (let [writes (atom [])
              done?  (promise)]
          (with-redefs [replacement-run/update-progress!
                        (fn [_run-id progress]
                          (swap! writes conj progress))]
            (let [record (replacement-run/create-run! :card 1 :card 2 (mt/user->id :rasta))
                  progress (replacement-run/run-row->progress record done?)]
              (execute/execute-async!
               (fn [progress]
                 (replacement.protocols/set-total! progress 120)
                 ;; advance one-at-a-time for 120 items
                 (dotimes [_ 120]
                   (replacement.protocols/advance! progress)))
               progress)
              ;; wait for virtual thread
              (is (= :run/success (u/deref-with-timeout done? 500)))  ;; <------------
              ;; Writes at items 50, 100, 120 (final) → progress 50/120, 100/120, 120/120
              (is (= [(double (/ 50 120)) (double (/ 100 120)) 1.0]
                     @writes))
              (is (=? {:is_active nil :progress 1.0 :status :succeeded}
                      (t2/select-one :model/ReplacementRun :id (:id record)))))))))))
```

* fixes

* add new flag to resolution

* fix

* fix sandboxing

* fix

* wip be

* wip  be

* wip be

* wip

* wip be

* wip be

* missing join-alias

* wip be

* more field ref cases

* wip be

* wip be

* wip be

* remove healing

* implicit join second level

* swap refactoring

* both loops process all

[GHY-3182: swap all dependencies](https://linear.app/metabase/issue/GHY-3182/swap-all-dependencies)

* field refs

* fix types

* fix ref types

* short curcuit when swapping

* base-type test

* fix order by

* test

* Viz settings in cards

* handle field->expression conversion

* base-type fix

* unique fix

* deduplicate test

* only upgrade/swap when well-formed query

`(-> card :dataset_query :stages seq)`

degenerate cases are `{}` and `{:lib/type :lib/query}`

* remove tests with broken schema

* test that :field -> :expression works in parameters, too

* viz_settings!

* legacy->pMBQL

* preserve native queries metadata

* fix typo in a comment

* Tests for field_refs.clj

* swap function order

* remove transitive card ids, add usages tests

we don't need to keep a set of all card ids. it's huge, and we're gonna
upgrade cards either way. So no need to not upgrade card references

* Fix upgrade-field-ref-to-name crash on :aggregation refs

Viz-settings locations (pivot_table.column_split etc.) can contain
[:aggregation 0] refs, not just [:field ...]. Wrap ->pMBQL in
with-aggregation-list so it can resolve legacy index-based aggregation
refs to UUID-based pMBQL. Add try/catch as safety net for other
unexpected ref types.

Fixes 13 cards failing with "no aggregation at index 0" error.

* fix expressions

* add a test

* fix the test

* add a proper test

* Skip non-field refs in upgrade-field-ref-to-name

Per Alexander's feedback: since we only resolve :field refs downstream,
skip :aggregation/:expression refs at the gate instead of setting up
aggregation context for ->pMBQL.

* remove log call in source-swap

* add schemas

* add schemas

* repro test

* guard against missing tables

* more fixes

* wip tests

* add tests for resolution with missing metadata

* Mutation testing improvements

* Some more tests

* revertme: adds comilation tracker for statsdb swap+upgrade analysis

* add checks for wrong queries

* fixes

* test fixes

* fix

* remove old code

* temp test fixes

* fix viz

* fixes

* One more tests.

* Singular mutation testing run

* tests

* fix tests

* remove not needed column checks

* fix tests

* run-swap throws with old-source new-source and check-result

* fix dependencies check test

```clojure
source-swap-test=> (clojure.test/run-test swap-native-card-source!-updates-dependencies-test)

Testing metabase-enterprise.replacement.source-swap-test

Ran 1 tests containing 1 assertions.
0 failures, 0 errors.
{:test 1, :pass 1, :fail 0, :error 0, :type :summary}
```

So an interesting bit:
we must update dependencies regardless. It's important that the dep
graph is updated. Imagine if Card A is swapped for Card B. All cards
that use Card A will be listed as deps of Card A even if they don't
reference it and don't require changes. We are still swapping the source
so we need to update the graph.

We don't have a real api for dependencies. So to ensure the cards are in
the graph we call `(events/publish-event! :event/card-create {:object
card :user-id (mt/user->id :rasta)})` and when swapping we prefer to use
`(models.dependency/swap-dependency! :measure entity-id old-source
new-source)`. But for dashboards we'll just do the full recompute
accomplished with

```clojure
(events/publish-event! :event/dashboard-update
                       {:object (t2/select-one :model/Dashboard :id dashboard-id)})
```

* working field-refs tests

* Fix logic

* Strong logic (but is it possible?)

* fix ::entity-id schema to include all entity types

* refactor

* fixes

* fixes

* fixes

* fixes

* fixes

* wip

* fix

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* wip be

* wip be

* wip be

* remove unused

* wip be

* remove invalid queries

* wip fixes

* wip walk function

* Measure and segment tests

* fixes

* aliases

* fixes

* fix tests

* make source_swap accept the preloaded entity

* renaming

* unify sources

* database id fixes

* fix table id check

* deps fixes

* reflection warning

* fixes

* fixes

* fixes

* fix team

* fix CI

* check for admin

* disable plugin

* Disable api endpoints in prod

* wip tests

* fire events; namespace doc

```clojure
clj -X:dev:test:ee:ee-dev :only metabase-enterprise.replacement.source-swap-test
Ran 29 tests in 29.144 seconds
219 assertions, 0 failures, 0 errors.
{:test 29, :pass 219, :fail 0, :error 0, :type :summary, :duration 29144.393083, :single-threaded 29}
Ran 0 tests in parallel, 29 single-threaded.
Finding and running tests took 40.1 s.
```

All tests passing

Fire event only when things change, swap sources before. That's faster
and must happen regardless, change event only on change.

Namespace docstring indicating why

* fix constraint error if dependency already exists:

```
custom-swap=> (source-swap/swap-source! [:card 27452] [:card 6759] [:table 52728])
Execution error (PSQLException) at org.postgresql.core.v3.QueryExecutorImpl/receiveErrorResponse (QueryExecutorImpl.java:2736).
ERROR: duplicate key value violates unique constraint "idx_unique_dependency"
  Detail: Key (from_entity_type, from_entity_id, to_entity_type, to_entity_id)=(card, 27452, table, 52728) already exists.
```

it seems to have already have a dependency. So now we just remove
dependency if the one we are adding already exists, otherwise we swap.

swap card A: dep on B -> dep on C
if it already depends on C, just delete the dep on B
otherwise swap where card A dep B -> dep C

* simplify check

* upgrade parameter value_source_config

* field refs

* tests

* viz tests

* parameters

* tests

* fixes

* tests

* check sources fixes

* fix tests

* tests

* wip tests

* fixes

* wip tests

* wip tests

* wip tests

* wip cleanup

* cleanup

* move test

* lint

* fix

* fix

* fixes

* fixes

* fixes

* fix

* fixes

* fix

* fix

* fixes

* fix

* FE cache fixes

* fix checks

* fix

* polish: remove tracing code, update docstring, add :pending to ::run-status enum

* Add test for table->card in check-column-mappings

* Remove unneeded argument.

* Remove unused function.

* Test that all api endpoints are gated behind dependencies feature flag

* use api/*current-user-id* instead of (:id @api/*current-user*) in source swap

Avoids unnecessarily forcing the *current-user* delay (which loads the
full User record from the DB) when only the integer ID is needed.

* stop swapping card_id in parameters

* throw on partial swap failures so the run is marked as failed

Previously run-swap* returned {:failures [...]} which execute-async!
ignored, marking the run as succeeded. Now it throws with a descriptive
message (count + first 10 failures) that gets persisted in the run's
message column.

* Check that all routes are protected behind superuser

* Add test for runner.run-swap

* FE checks

* Remove source-error schema (unused)

* Reuse lib-be.schema.source-swap/column-error schema instead of remaking it

* Kondo error

* move code to lib-be

* Better mutation testing

* fixes

* More tests for field-refs

* Better test

* More source swap tests.

* suppress dependency event handlers during source replacement

Source replacement manages dependencies itself via swap-dependency!, so
the event-driven dependency recalculation, stale-marking, and metadata
propagation triggered by entity update events is redundant work.

Adds *suppress-dependency-events?* dynamic var, checked by all dependency
event handlers. Bound to true in run-swap* phase 2.

* Fewer deps! Yay!

* Revert "suppress dependency event handlers during source replacement"

This reverts commit 03625e9c26.

* Clearer code

* update 2 docstrings

* publish dashboard-update event only when a dashcard changed

* simplify implementation

* simplify

* bulk mbql replacement

* Revert "bulk mbql replacement"

This reverts commit cf12636c42.

* simplify

* fix reseting selection when the graph changes

* fix

* add source_swap module

* fix lint

* fix comment

* fix

* fixes

* fix module order

* fix module order

* fix order

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
Co-authored-by: dan sutton <dan@dpsutton.com>
Co-authored-by: Eric Normand <ericwnormand@gmail.com>
2026-03-10 14:25:01 -04:00
Fraser
49a3037d2a Move range-for-value into value (#70622) 2026-03-11 07:14:27 +13:00
Fraser
fa959aaab4 Remove deprecated getCurrentUser selector (#70558) 2026-03-11 07:13:06 +13:00
Kevin Kelleher
eadbd4b00d Fix broken pie chart colors for some strings in static-viz (#70640) 2026-03-10 13:53:45 -04:00
bryan
1da8e5751a Run Mage Tests on all PRs and fix module count (#70656) 2026-03-10 16:22:11 +00:00
Alex Yarosh
d47651a2cf docs: clarify transform perms (#70650)
clarify perms

Clarified the permissions required for viewing and executing transforms in Metabase.
2026-03-10 11:31:50 -04:00
Sébastien
92001b00de Fixed extraneous item in filter popover in embeds (#70634) 2026-03-10 16:17:24 +01:00
Sébastien
186c9dca65 Fix missing translation in guest embed filters (#70583) 2026-03-10 16:15:29 +01:00
Edward Paget
42aebbf137 Add configurable CSV field separator setting (#69827)
* Add configurable CSV field separator setting

- Adds csv-field-separator setting for configuring CSV export delimiter
- Supports comma (default), semicolon, tab, and other delimiters
- Useful for European locales where semicolon is standard
- Configurable via MB_CSV_FIELD_SEPARATOR environment variable
- Includes tests for different separator types and quoting behavior

Fixes #10256

* Split CSV separator tests into smaller deftests and clean up comments

Break the monolithic csv-field-separator-test into four focused tests:
- csv-field-separator-default-test
- csv-field-separator-semicolon-test
- csv-field-separator-tab-test
- csv-separator-quoting-test (already separate, just removed extra nesting)

Remove the "Changed from hardcoded" comment in csv.clj and the unused
metabase.test.util require.

* fixup! eastwood and serialization baseline

* fixup! whitespace

---------

Co-authored-by: kevin raymond <kevray39@gmail.com>
2026-03-10 09:55:03 -05:00
Eric Normand
df7d834e2e [Mutation Testing] Kill mutations in metabase.lib.field/find-visible-column-for-ref (#69320)
### Stats
- **Surviving mutations before:** 6
- **Tests added:** 2
- **Mutations killed by this PR:** 4
- **Mutations remaining:** 2

### Mutations killed
- Replace -1 with 0
- Replace field-ref with nil
- Replace :aggregation with :aggregation__
- Replace lib.metadata.calculation/returned-columns with nil

### Mutations not killed (with rationale)
- Replace some? with nil — Schema-only mutation — changing the Malli schema annotation does not affect runtime behavior
- Replace query with nil (in find-matching-column) — lib.equality/find-matching-column does not use the query arg for field ref matching in these test cases
2026-03-10 14:48:44 +00:00
Maksym Yakubych
bc7ffe094f feat: fix this query feature not using inline sql edits (#70172) 2026-03-10 11:06:04 -03:00
Ryan Laurie
205205174c Bump backport reminder threshhold to 25 hours (#70636)
bump backport reminder threshhold
2026-03-10 13:16:45 +00:00
John Swanson
05567456f2 Use virtualized table for data perms (#70343) 2026-03-10 09:01:10 -04:00
Kevin Kelleher
9bfb9ed7a4 Use lowest cardinality dimension as default for boxplot (#70569) 2026-03-10 08:49:24 -04:00
Kevin Kelleher
b161e19442 Fix handling of object columns in pie charts (#68095) 2026-03-10 07:22:13 -04:00
Uladzimir Havenchyk
c28beea344 chore: convert ObjectDetail viz to typescript (#70425)
* chore: convert ObjectDetail viz to typescript

* add column_title to viz definition type
2026-03-10 14:00:07 +03:00
Mahatthana (Kelvin) Nomsawadi
b22ab2010d Improve modular embedding analytics (#70449)
* Add v3 for modular embedding analytics

* Add implementation

* Improve test readability

* Improve code format

* Make the code autocomplete-able to prevent human-error

* Add missing default value tests

* Format

* Ensure we assert all properties

* fix "id_new" and "id_new_native" tracking

* Update the implementation so it count 0 like before

* Fix logic

* Fix snowplow schema lint

* Remove too much linear ticket number references
2026-03-10 10:54:58 +00:00
Jakub Chodorowicz
6f4d71c279 Gdgt 1801 Leaflet components (#70299)
* make LeafletMap generic component

* convert leaflet grid heatmap

* use filter guard to make sure we're dealing with L.Rectangle

* remove  param which doesn't exist

* add guard helper for data set column

* create LeafletMapPoint variadic generic type

# Conflicts:
#	frontend/src/metabase/visualizations/components/LeafletMap.tsx

* extact sync map from props methods

* migrate LeafletMarkerPinMap to TS

* don't force assert existence of pin dependencies

* use 3 tuple point everywhere in LeafletMarkerPinMap

* use ClickObject type

* migrate LeafletTilePinMap to TS

* convert LeafletChoropleth to TS

* remove type assertions in LeafletMarkerPinMap

* remove TileLayerWithInternals casting

* improve tile layer typings

* add casting comment

* improve embedding context types

* improve LeafletGridHeatMap types

* don't hardcode default scale for d3 scale linear

* call zoom control also when prevProps are missing

* improve HoveredObject, use HoveredObject in LeafletGridHeatMap

* remove unneeded nullish coalescence

* simplify getTileUrl by using just parameters as arguments

* remove unneeded assertion

* remove unneeded this param
2026-03-10 10:04:38 +01:00
Nicolò Pretto
c8d5e94ffa test(eajs): handleLink should prevent default behavior when returning {handled:true} (#70592)
test(eajs): handleLink should  prevent default behavior when returning {handled:true}
2026-03-10 09:43:31 +01:00
Ngoc Khuat
22a1f275f0 Fix computed transform tables being editable (#70441) 2026-03-10 14:54:23 +07:00
Nathan Voxland
9bd22bf4b1 Added dedup-fn feature 2026-03-10 02:03:18 -05:00
mendral-app[bot]
ce8660f161 Use env vars for embedding workflow (#70614)
fix: prevent script injection via PR title in embedding-sdk workflow

Move user-controlled PR context values (title, number, URL) and secrets
from direct GitHub Actions expression interpolation into env vars.
This prevents a crafted PR title from breaking out of the shell string
and executing arbitrary commands on the runner.

Co-authored-by: mendral-app[bot] <233154221+mendral-app[bot]@users.noreply.github.com>
2026-03-10 06:51:16 +04:00
Denis Berezin
dcf260f4c9 Fix broken e2e test for #68998 (#70585) 2026-03-10 03:24:04 +03:00
Aleksandr Lesnenko
4897452a08 Metrics Explorer (#68961)
Co-authored-by: Edward Paget <ed.paget@gmail.com>
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Kevin Kelleher <kevin.kelleher@metabase.com>
Co-authored-by: Maz Ameli <maz@metabase.com>
2026-03-09 20:18:15 -04:00
dpsutton
c87ad18e21 quarantined driver notifications (#70612)
* quarantined driver notifications

* temp on push to bot-testing channel

* prettier

* more compact

* add back a bit of emphasis

* remove push edge and restore channel
2026-03-09 18:14:56 -05:00
Fraser
78a8c59d71 Move expandable string to where it's used (#70559) 2026-03-10 12:08:58 +13:00
Fraser
336c2a8b1a Convert OnClickOutsideWrapper to TypeScript (DEV-1496) (#69418)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 11:50:54 +13:00
Rodrigo López Dato
567bbd68bb Clarify that SSO provisioning also allows reactivating accounts (#67524)
* Clarify that SSO provisioning also allows reactivating accounts

* Update wording in docs

* ditto LDAP

* Use radio buttons instead of a toggle

* lint/wording

* lint

* Revert changes to autogenerated docs

* Fix eslint rule + improve wording

* Make OIDC provisioning setting consistent with other providers

* Add detailed descriptions only to env var docs, not UI

* Fix E2E test

* fix: update ESLint configuration file path from .eslintrc.js to eslint.config.mjs

* run lint when we change component tests specs

* fixing linting

* ignore linting issue in embedding test

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2026-03-09 18:09:00 -03:00
Braden Shepherdson
ba6895665f [MBQL lib] Ignore inherited-temporal-unit on bucketed columns (#70512)
Fixes QUE2-394.

This issue was caused by losing the thread of a column between stages in
the case where it has a different `:inherited-temporal-unit` than its
proper `:temporal-unit`.

`lib.equality/=` was checking the `:temporal-unit`s, which match, and
then returning `false` because only one column had
`:inherited-temporal-unit` for a different, finer unit. That shouldn't
fail the match, since the `:inherited-temporal-unit` is obsolete when
the column has just been bucketed differently.
2026-03-09 21:02:10 +00:00
Ben Grabow
09c04d91bb Remove minimally useful semantic search log messages (#70524) 2026-03-09 21:01:38 +00:00
Jeff Bruemmer
8977542307 docs - remote sync limitations (#70598)
* branch limitations

* edits

* link

* Apply suggestions from code review

Co-authored-by: Alex Yarosh <alexandra@metabase.com>

---------

Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2026-03-09 20:51:35 +00:00
Ben Grabow
ec678a17fc Uxw 1070/fail early if unsupported appdb version is detected (#70402) 2026-03-09 15:33:16 -05:00
Chris Truter
6eda44fc53 Fix reflection warnings in tests + add linter (#70551) 2026-03-09 13:29:04 -06:00
metamben
4219500b7a Preserve expression names when fixing bad field refs (#70530)
Closes QUE2-397
2026-03-09 21:48:51 +03:00
Will Bryant
2f2ab17ebb Fix race condition in FormattingWidget initialization (#69777) (#69778)
Although there was an early return if isLoading is true, the useState had already run, and set the state to the DEFAULT_FORMATTING_SETTINGS. This would then not get replaced when isLoading became false.

Instead, use the same idiom as SessionTimeoutSetting - install a useEffect hook that depends on the setting value and applies that setting value to the local state.
2026-03-09 11:43:20 -07:00
Nathan Voxland
0462cde56d Fixed kondo 2026-03-09 11:14:43 -05:00
Maksym Yakubych
89c1712267 fix: Metabot not receiving transform errors from transforms (#70462) 2026-03-09 15:54:48 +00:00
Nicolò Pretto
ba03f8d368 remove ThemeProvider from sdk component test (#70568) 2026-03-09 16:51:29 +01:00
Edward Paget
6d84d80c06 fix: allow dashboard caching in read-only mode (#70511)
* fix: allow dashboard caching in read-only mode

* fix: split out cache permissions from can-write?

We were denying changing caching policy for dashboards on read-only
remote-synced instances because we set can-write? to false for
dashboards when we are in read-only mode.

we also need to create a new boolean flag we can return to the frontend
to indicate that caching is still allowed even when editing a dashboard
is otherwise disabled.

* fixup! PR feedback
2026-03-09 10:37:16 -05:00
Nathan Voxland
e99312fe64 Renamed def-listener to def-listener! 2026-03-09 10:24:36 -05:00
Denis Berezin
b130d0d812 Pivot Table shows a blank card when rendered on a dashboard (#70385) 2026-03-09 18:18:37 +03:00
Riley Thompson
caafceff99 Upgrade clickhouse to 0.9.7 with pinned dependencies (#70448)
* upgrade clickhouse jdbc to 0.9.7

* clean up todos

* update deps
2026-03-09 11:12:36 -04:00
Jakub Chodorowicz
5fe95dbbae fix self-heal openapi job and update openapi.json (#70499) 2026-03-09 15:42:44 +01:00
Nicolò Pretto
65d9029a55 fix: update ESLint configuration file path for eslint config (#70507)
* fix: update ESLint configuration file path from .eslintrc.js to eslint.config.mjs

* run lint when we change component tests specs
2026-03-09 13:32:17 +00:00
github-automation-metabase
e4ec44c4af Auto-update documentation for master (#70560)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-09 09:28:12 -04:00
Uladzimir Havenchyk
0e9fd4c48c add transform-basic feature flag for transforms (#70442)
* add another feature flag for transforms

* fix linting error from master

* add debug info

* enable-transforms-basic -> enable-basic-transforms

* remove logs
2026-03-09 15:08:51 +03:00
Phoomparin Mano
cd32f3b89c Integration branch for embedding onboarding improvements (#69456)
* Add "configure data permissions and enable tenants" skeleton for onboarding (#68895)

* use onboarding stepper

* add TODO for EMB-1266

* add e2e test for skeleton

* use gap=sm for steppers

* align with design

* Add completion checks for data segregation and tenants (#68890)

* add completion information for segregation and tenants

* add data segregation checks

* add data segregation config test

* add the combined data-permissions-and-enable-tenants step

* separate main and sub checklist

* explain the purely ui step

* add schema for checklist response

* update checklist completion states

* add test cases

* address review on test permutations and using is_active for tests

* remove stale configure data permissions unit test

* remove stale test on user strategy card

* Add enable tenants and create shared collection button (#69131)

Add enable tenants and create shared collection button (#69131)

* Add data segregation strategy selection step for embedding onboarding (#69127)

Add data segregation strategy selection step for embedding onboarding (#69127)

* Lock steps 2 to 5 in data permissions setup checklist (#69135)

Lock steps 2 to 5 in data permissions setup checklist (#69135)

* Add link to documentation for database routing in the onboarding step (#69138)

Add link to documentation for database routing in the onboarding step (#69138)

* Add tenant creation and tenant summary step for tenants onboarding (#69454)

Add tenant creation and tenant summary step for tenants onboarding (#69454)

use index as key instead

update failing unit test

refactor: use slugify instead

add assertion on configure data permissions step should be done

cleanup summary components

adjust font size

use related setting card for summary

refactor: cleanup card components

add e2e test verifying tenant errors are shown

add e2e test verifying tenants are created

fix: prevent going to previous incomplete step

fix: skip locked steps

fix: consider locked steps when auto-advancing

fix: failing e2e by enabling tenants via ui

refactor: cleanup tenants import

add fallback logic for tenants listing

refactor: move onboarding step to tenants plugin

scaffold tenant summary step

scaffold tenant creation step

use paper from mantine-ui instead

scaffold tenant creation step

* Onboarding stepper should navigate to next steps correctly even when all steps are done (#69653)

Onboarding stepper should navigate to next steps correctly even when all steps are done (#69653)

cleanup: remove redundant test

fix: cleanup broken tests

remove inapplicable test case

apply onboarding stepper fixes

* Add row and column level security step for onboarding (#69622)

fix failing e2e tests

wait for permission graphs to update before checking error toasts

add test assertion on hiding selected tables

hide tables that are selected by other cards

add unit test for building permissions graph

address review on type-safe sandbox policy

extract error and success toasts into UI consumer

add clarification on why we assert GTAP

extract MiniPicker hard-coded margins to the data picker call site

address review on using design system units and rem

address review on "All tenant users" permission update hook

Add row and column level security step for onboarding

revert all changes to OnboardingStepper

update the permission graph as well

refactor: renamings

lock step "Select data to make available" if strategy not chosen

cleanup: remove button

use metabase/ui for select style

refactor: extract table column card

simplify trigger styles

revert MiniPicker change

undo test name change

refactor: simplify stepper

update e2e test assertions

add step completion assertion to e2e tests

refactor: extract to step components

allow going to next step

fix onboarding stepper re-rendering

chore: cleanup sandboxing creation test

add e2e tests

add sandbox on clicking next

clicking next on rls selector should advance to next step

refactor: rename to selections and onSelectionsChange

display options on the bottom

position dropdown directly below the trigger

fix: trigger height

fix: do not hide title on RLS step

do not collapse current step when all steps are complete

make it clearer what is goToNextIncompleteStep

simplify logic for going to next incomplete step

add data selector for row and column security

* Create a multi-select database selector component (#69635)

Create a multi-select database selector component (#69635)

chore: remove fluff tests

allow disabling rightSection with null

add data fetching to DatabaseMultiSelect

use multi autocomplete

add storybook story and unit test for disabled options

allow disabling database options

update multi select tests

chore: formatting

cleanup dropdown style

show placeholder always

apply brand focus color

remove inline-end

limit combo box width

update styles to match figma design

update option icon

scaffold database multi select

* Add connection impersonation onboarding step (#69644)

Add connection impersonation onboarding step (#69644)

add permission graph and impersonation assertion

add e2e test

use useUpdateTenantGroupPermissions for permission updates

add connection impersonation creation hook

add edge case for database does not support impersonation

disable dbs without connection impersonation

scaffold ui for connection impersonation

* Add JWT authentication onboarding for embedding hub (#69823)

test: e2e fail due to lock icons found in related settings section

replace e2e test on jwt completion

update e2e tests

scaffold e2e tests

refactor: cleanup sso stepper component

add help url and complete step button

scaffold "Test that JWT authentication is working correctly" step

scaffold "Add a new endpoint to your app" step

add ui to configure identity provider

scaffold sso setup

* Mark get embed snippet step as done when guest embed is published (#69889)

* mark guest embedding onboarding test step as done

* add e2e test for guest embed

* simplify e2e test

* fix invalid imports due to merge conflicts

* fix guest embed snippet copy incorrectly marking production embed step as done

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Embed wizard should default to newly created dashboards (#69907)

Embed wizard should default to newly created dashboards (#69907)

scaffold defaulting to newly created dashboards

add a comment on why newly created dashboards are prioritized

chore: update inline comments

de-duplicate recent items at call site

refactor: cleanup implementation

add created_at time filter

address review feedback on variable naming

address review by going through actual x-ray flow

remove invalid unit test

update duplicated and failing tests

fix failing tests

fix failing select-embed-experience e2e test

fix failing select-embed-entity e2e test

* Remove create models step from embedding onboarding checklist (#70256)

remove create models step

* Show tenant_identifier autocompletion from column values in RLS (#69829)

Show tenant_identifier autocompletion from column values in RLS (#69829)

scaffold basic tenant_identifier autocompletion

make placeholder dynamic to tenant identifier input

fix: update broken types

document why we use ad-hoc query

refactor: small cleanup

cleanup docstring

chore: update hook tests

add e2e tests for autocompletion

explicitly pass tenant attributes

simplify CreateTenantInput

Suppress ad-hoc query errors in tenant identifier autocomplete

Autocomplete suggestions are best-effort during onboarding. Query
failures (permissions, timeout, etc.) should not surface global
error UI noise.



Make attributes optional in CreateTenantInput to match API contract

The backend marks attributes as optional; the frontend type was
overly strict and forced callers to always send attributes: {}.



Derive selectedFieldIds from sandboxedTables, not tableColumnSelections

Previously, field IDs were extracted from all tableColumnSelections,
including entries skipped because the table failed to fetch. Now we
only include IDs from policies that were actually applied, deduplicated.



Use stable placeholder and aria-label in TenantIdentifierInput

The old dynamic placeholder (first suggestion value) looked pre-selected
to users. Now prefix with "e.g." using c().t for localization context,
falling back to "e.g. acme-corp" when no suggestions are loaded. Also
adds aria-label for accessible and stable test targeting.



Update E2E tests to use "e.g. 1" placeholder for tenant_identifier input

The placeholder is now prefixed with "e.g." to clarify it's an example.
This also implicitly validates that autocomplete suggestions were fetched
successfully, since the placeholder is dynamic when data is available.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* Tenant creation should differ the data isolation field by strategy (#70258)

Tenant creation should differ the data isolation field by strategy (#70258)

scaffold implementation on tenant isolation fields

refactor: use ts-pattern for isolation field config and label lookups

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

update checklist endpoint to return checklist separate from isolation strategy field

refactor: use dataIsolationFieldValue field for creating tenants

fix: use activeStrategy for reload-aware strategy picker and step content

On page reload, selectedStrategy is null but activeStrategy is populated
from the backend. Switch the data segregation picker value, select-data
step lock condition, title hide flag, and match expression to use
activeStrategy so the correct state is reflected on reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

tweak tenant name styling

always require data isolation strategy field value to create tenants

update embedding hub checklist backend test

add e2e tests for reload and isolation strategy

fix: remove hard-coded string in tenant identifier input

refactor: move DataSegregationStrategy type to embedding-hub types module

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

refactor: remove single-letter variables

* Show segregation strategy specific data permissions in tenant summary (#70268)

Show segregation strategy specific data permissions in tenant summary (#70268)

show segregation strategy specific summary

test: add unit tests for getDataPermissionsDescription

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

fix: add selectedFieldIds to TenantsSummaryOnboardingStep plugin interface

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

add e2e test assertions and test cases

simplify row-level security summary logic

fix rls imports

update data permission description span

add bold text to description summaries

fix failing e2e tests

fix starter test failing

remove focused test

update comment on the rls e2e test

fix: use singular 'table' for single-table RLS data permissions description

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

add a comment on why RLS needs the same column

use conjunct method for string formatting

simplify textFromReactNode

simplify getDataPermissionsDescription unit test

chore: code formatting

remove route title

fix: failing test due to placeholder update

remove the starter test as it does not apply

fix: reset hiddenParameters when switching from guest to SSO embed mode for dashboards

When recentlyCreatedDashboards pre-populates the dashboardId, the resource loads
in guest mode and initializes hiddenParameters with all parameters as disabled.
Switching to SSO now resets hiddenParameters to [] for dashboard embeds, matching
the existing behavior for question embeds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

fix ignore_error flag

fix: incorrect test assertion for database selector

fix: incorrect placeholder assertion

* Tenant users are unable to query database after onboarding flow (#70476)

Tenant users are unable to query database after onboarding flow (#70476)

fix(embedding): set create-queries permission for RLS tenant users

Tenant users with RLS could view dashboards but were unable to query
the database because the permissions graph only set `view-data` without
`create-queries`. Add `"create-queries": "query-builder"` at the
database level for both sandboxed and impersonated configurations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

fix: update unit tests on embed settings

fix failing tests due to parameters reset

* Polish tenant creation and SSO for embedding onboarding (#70477)

Polish tenant creation and SSO for embedding onboarding (#70477)

polish permissions setup and create tenants onboarding

update copy for tenant identifier

* fix(type): add rlsColumnName type to plugin defs

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 19:02:34 +07:00
Fraser
6d79bbc173 Stop using 2am in tests to avoid DST issues (#70562)
* Stop using 2am in tests to avoid DST issues

* Scope to table cell data
2026-03-09 07:41:57 +00:00
Nathan Voxland
d8a7cd3501 Fixing tests 2026-03-08 01:41:38 -06:00
Eric Normand
7c8125d4bb Fix typo in self-dependency removal GHY-3198 (#70535)
There was a typo in a transducer where the cat and remove were swapped. The cat was meant to combine collections (`#{x})` and the remove was looking for `x`, but since it happened in the wrong order, it never removed them. This led to self-dependent entities, and therefore cycles which caused infinite loops.
2026-03-07 21:58:17 +00:00
Chris Truter
54439261a4 Fix case sensitiviy issues with workspace query execution (#69350) 2026-03-07 07:35:50 +00:00
Nathan Voxland
2d2c4b35a5 Fixing tests 2026-03-07 01:25:05 -06:00
Nathan Voxland
9e717a6056 Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	resources/migrations/059_update_migrations.yaml
2026-03-07 00:09:19 -06:00
Nathan Voxland
9ed603e6ce Better multi-backend handling 2026-03-06 17:30:39 -06:00
Maz Ameli
18706c2456 Switch component improvements (#70520)
* fix toggle alignment

* reduce space above description

* change usage guidelines to recommend sm

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2026-03-06 22:57:08 +00:00
Nathan Voxland
8a5545ad32 Fixed whitespace and migrations 2026-03-06 16:01:30 -06:00
Chris Truter
3d5b673c9a Support template tags in Workspace transforms (#69561) 2026-03-06 21:21:37 +00:00
Nathan Voxland
82b89e31fb Fixing tests 2026-03-06 15:09:41 -06:00
Chris Truter
0e1325ba1e Implement scoped authorization to limit API surface (#70372) 2026-03-06 23:01:36 +02:00
Jacob Joseph
9c801dfbd9 Fix numbered list for row and column security section (#70525) 2026-03-06 20:31:04 +00:00
Nick Fitzpatrick
c27eee3f51 ignore linting issue in embedding test (#70514) 2026-03-06 16:13:58 -04:00
Maksym Yakubych
1cfc71fed7 fix: NLQ profile incorrectly used for SQL editor requests (#70436)
* fix: NLQ profile incorrectly used for SQL editor requests

* fix: tests
2026-03-06 12:55:40 -06:00
Nathan Voxland
619f2b2be6 Add repro-bot github workflow (#70435) 2026-03-06 11:02:20 -06:00
Nick Fitzpatrick
64978428b8 fixing linting (#70504) 2026-03-06 16:55:14 +00:00
dpsutton
58d2cd37b6 bump c3p0 to 0.12.0 (#70494) 2026-03-06 09:36:34 -06:00
Nicolò Pretto
6901847ed2 remove noisy logs from sdk component tests (#70416)
* should fix clj files imported from sdk component tests

* reduce noise when not finding the sdk package

* remove mantine from tests that don't need it

* eslint rule
2026-03-06 16:32:49 +01:00
Nicolò Pretto
10286754ee feat(sdk): speed up the embedding sdk loading time: do auth flow in parallel with bundle loading and split the bundle in chunks (#70015)
* test ci

* fix

* fix e2e

* make linters happy?

* more ci fixes

* more ci fixes

* maybe fix flake

* more ci things?

* more things including a test that we do fallback to old auth

* remove un-needed changes

* more cleaning

* make tests more stable

* clean up debug comments

* remove ! that was not needed

* fix broken build

* cleanup

* more cleaning up

* more cleanup

* clean up consts

* more cleaning up and saml bail out tests + logic

* revert uneeded change in copy js plugin

* better comments and renamed chunk auth function

* merge test files, fix double auth requests done due to missing redux dispatch

* fix typo in backend comment

* fixed version of renaming param to useLegacyMonolithicBundle

* remove cy wait

* remove wait + fix matcher on request for dev mode to not match map file

* clean up tests

* remove empty lines from gitignore

* remove unrelated gitignore change

* r emove imports

* cleanup tests from redundant tests

* remove other un-needed code

* comments

* add date to a TODO as suggested by Kelvin

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* rename checkForAuthConfig -> checkForAuthConfigAndStartAuth

* startAuth -> startJwtAuth

* use new URL to construct baseUrl

* use shared auth  logic

* use the real version as we can actually

* add comment on numTestsKeptInMemory usage

* add test about path traversal

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-06 14:51:25 +00:00
Nicola Mometto
8f1606adc5 Allow loading of 58 serialized tables in 59+ (#70486)
* fix: allow importing 58 serialized data-layer values

* add test
2026-03-06 14:13:16 +00:00
Ngoc Khuat
5b6e3071ac Fix duplicate alerts/subscriptions firing in multi-pod clusters (#70474)
* Fix duplicate alerts/subscriptions firing in multi-pod clusters

Set acquireTriggersWithinLock=true to force pessimistic locking during
trigger acquisition. Without this, Quartz uses an optimistic UPDATE that
is vulnerable to an ABA race condition where multiple cluster nodes can
acquire and fire the same trigger simultaneously.

* Add *warn-on-reflection* to custom_migrations/util

Fixes clj-kondo warning triggered by Java interop (System/setProperty,
System/clearProperty) added in the acquireTriggersWithinLock fix.
2026-03-06 10:35:46 -03:00
Edward Paget
76e96af834 fix: only skip deleting commonpy not pushing it (#70439)
* fix: only skip deleting commonpy not pushing it

* fixup! kondos
2026-03-06 07:16:39 -06:00
Sébastien
92017bab3f fixed table width in guest embed (#70418)
* fixed table width in guest embed

* fixed test
2026-03-06 14:10:57 +01:00
Ngoc Khuat
c86caa092e Unifying source tables transform format (#70298) 2026-03-06 18:48:41 +07:00
Jakub Chodorowicz
29590b8e09 Fix TS failure - duplicated selectors (#70480)
remove duplicated selectors
2026-03-06 10:07:41 +00:00
Ngoc Khuat
e822288497 GDGT-1872: Change transform metering to tier-based keys (#70366) 2026-03-06 05:46:42 +00:00
Nathan Voxland
607985e054 Fixing tests 2026-03-05 22:15:42 -06:00
Nathan Voxland
a2e43e1996 Fixing tests 2026-03-05 21:23:23 -06:00
Noah Moss
a6c90cc7ff Filter out inactive tables for metabot (#70440)
* Filter out inactive tables for metabot

* fix another spot
2026-03-05 23:02:01 +00:00
Riley Thompson
1571e58188 Data migration to fix clickhouse upload dbs with missing schema (#70363)
* testing

* add migration

* add test

* reorder test

* improve migration

* improve test

* add comment explanation

* fmt
2026-03-05 17:05:33 -05:00
Fraser
ae1e0d6311 Convert admin/people/selectors to TypeScript (#69431)
* Convert `admin/people/selectors` to TypeScript

Part of the Accelerate TypeScript Migration project.

Closes DEV-1509

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add people property to AdminState type

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 10:57:15 +13:00
Fraser
3f547462c9 Convert linked-filters to ts (#70045) 2026-03-06 10:57:01 +13:00
Nathan Voxland
3b96cd4619 Deps fix 2026-03-05 15:56:10 -06:00
Nathan Voxland
31790b6052 Added def-listener! and fixing tests 2026-03-05 15:42:23 -06:00
Jeff Bruemmer
05aaad4f3a README - updates (#70460) 2026-03-05 16:02:15 -05:00
Ben Grabow
92ec0df7b1 Ignore some generated files (#70454) 2026-03-05 14:56:22 -06:00
metamben
35b542b651 Fix column-metadata->field-ref-source-alias-test (#70458) 2026-03-05 20:21:57 +00:00
Cam Saul
ab7e4712b1 Omit pivot-grouping from window function OVER PARTITION BY and ORDER BY expressions (#70273)
* Experimental fix for #70088

* cljfmt

* Document the new key

* Cleanup
2026-03-05 10:31:07 -08:00
Maksym Yakubych
47471f9518 fix: metabot returns null for pasted question references (#70388) 2026-03-05 12:23:16 -06:00
Eric Normand
86868639b4 test: mutation tests for column-metadata->field-ref (#69342)
* [Mutation Testing] Add tests for metabase.lib.field/fieldable-columns

* test: mutation tests for column-metadata->field-ref source-alias propagation

Tests the MEGA HACK source-alias-to-join-alias propagation in column-metadata->field-ref:
- Verifies source-alias becomes :join-alias for table-default columns
- Verifies inherited columns do not propagate source-alias
- Verifies inherited columns do not get non-inherited propagated keys

Kills 6 more mutations (51/60 total, 9 unkillable due to schema constraints).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 12:23:21 -05:00
Eric Normand
c61c93e825 test: mutation tests for add/remove field operations (#69329)
* [Mutation Testing] Add tests for metabase.lib.field/fieldable-columns

* test: mutation tests for add-field, add-field-to-join, remove-field, remove-field-from-join

Adds tests that kill surviving mutations:
- add-field: expression column with explicit :fields (kills :source/expressions mutation)
- add-field-to-join: join with :none fields (kills 5 mutations)
- remove-field: expression column removal (kills :source/expressions mutation)
- remove-field-from-join: join with :none fields (kills 4 mutations)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 10:44:10 -06:00
Filipe Silva
6dfde80586 rfct: remove superfluous comments (#69099)
Fix https://github.com/metabase/metabase/pull/68478#discussion_r2760627013
2026-03-05 15:48:59 +00:00
Nemanja Glumac
009911d60a Fix incomplete URL substring sanitization in LeafletMap (#70428)
The previous check used `.includes("openstreetmap.org")` which could be
bypassed by malicious domains like `openstreetmap.org.evil.com` or
`fake-openstreetmap.org`.

This fix validates that the hostname is either exactly `openstreetmap.org`
or a legitimate subdomain ending with `.openstreetmap.org`.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-05 14:40:14 +00:00
Braden Shepherdson
237bbe2919 [MBQL lib] Unexport lib.options namespace (#70276)
Fixes QUE2-351.

I added a new exported function `lib/ignore-case`, since some drivers,
test, and Metabot were using `lib.options/update-options` to set
`:case-sensitive false` on `:contains` et al clauses.

`lib.options` is only used by friends now (mostly QP).
2026-03-05 14:28:44 +00:00
Oleksandr Solovyov
c8b1767e66 Semantic search speedup (#70317)
* do not put embeddings in metadata json for semantic search
* semantic search: filter personal_owner_id right in the database
* simplify batch-update code
2026-03-05 15:18:13 +02:00
Uladzimir Havenchyk
18e327042f chore: drop unnecessary react imports (#70415) 2026-03-05 16:00:30 +03:00
Alberto Perdomo
f02d26aa14 EMB-1329: update embed wizard terms copy and add link (#69856)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Nicolò Pretto <info@npretto.com>

closes #69302
Closes linear.app/metabase/issue/EMB-1329/embedding-tooltip-directs-you-to-read-license-text-linked-above-no
2026-03-05 11:58:06 +00:00
Timofey Kachalov
8056c1835a fix(sdk): Fix the empty container detection in SDK question layouts (#70389) 2026-03-05 15:40:13 +04:00
Kevin Kelleher
04055423f0 Admin TS conversions (#69825) 2026-03-05 06:37:33 -05:00
Nathan Voxland
846f38d443 Fixing tests 2026-03-05 02:00:51 -06:00
Uladzimir Havenchyk
4e7d009a53 chore: convert Text visualization to typescript (#70364)
* chore: convert Text visualization to typescript

* fixup
2026-03-05 10:28:55 +03:00
Nathan Voxland
e7a9e8c100 Removed other settings cache sync code 2026-03-05 01:20:07 -06:00
Nathan Voxland
e1b7b8e912 Use new queue better in search 2026-03-05 00:46:36 -06:00
Romeo Van Snick
a41303a180 Wrap buttons and title on smaller screens (#67681)
* Wrap title and buttons earlier when nav bar is open

* Wrap title in header at wider breakpoint

* Left align ad-hoc questions too

* Add gap when question title collapses

* Increase breakpoint

* Fix padding on ViewSection

* Use container query for query builder breakpoints

* Make padding more consistent with other headers on small screens

* Tweak question action buttons on small screens

* Add separator for actions

* Fix padding on filter panel

* Fix padding on back button

* Fix padding to match header

* Break sooner

* Do not break subheader as soon

* Fix test

* Remove reliance on query-builder from FilterPanel component

* Remove spurious margin

* Fix gap between header items

* Move container to header and footer
2026-03-05 15:02:09 +11:00
Fraser
8474a8f7f5 Convert metabase-lib utils to ts (#70044) 2026-03-05 16:24:06 +13:00
Anderson
2b61cce77b Don't call trial check EE endpoint in OSS for Remote Sync upsell (#70349) 2026-03-04 21:16:03 -05:00
Riley Thompson
0a0625d163 Revert "Upgrade clickhouse jdbc driver to 0.9.7" (#70403)
Revert "Upgrade clickhouse jdbc driver to 0.9.7 (#70387)"

This reverts commit 3a69ad8f49.
2026-03-04 16:50:23 -08:00
Jeff Bruemmer
bb42762372 docs - keys to data studio (#70405)
* keys to data studio

* link
2026-03-04 18:04:50 -05:00
Alexander Polyankin
420c4e27e0 Add writable-connection feature flag (#70287) 2026-03-04 15:54:40 -07:00
Romeo Van Snick
7d8f3849bf Polish transform template tag frontend (#70095)
* Rename confusingly named setParameterAttribute

* Remove unnecessary check

* Add options to disable parameter settings

* Disable parameters settings in transform sidebar

* Add e2e test for parameter field settings

* Rename disableParamaterSettings to parametersAreUserVisible

* Make parametersAreUserVisible configurable all the way up to QueryEditor

* Update copy when parameters aren't visible to user

* Fix test
2026-03-04 13:37:06 -08:00
Denis Berezin
def46a7c0c Update jspdf to fix security issues (#70393) 2026-03-04 23:28:10 +03:00
Riley Thompson
3a69ad8f49 Upgrade clickhouse jdbc driver to 0.9.7 (#70387)
* upgrade clickhouse jdbc to 0.9.7

* clean up todos
2026-03-04 19:22:08 +00:00
metamben
3a62030c09 Generate different column group names for joins to the same table (#70119)
* Generate different column group names for joins to the same table

Closes QUE2-180
2026-03-04 18:52:17 +00:00
metamben
8a93fb4fcd Make excluded-datetime return integers for days too (#69915)
* Make excluded-datetime return integers for days too

Closes QUE2-254
2026-03-04 18:24:04 +00:00
Egor Grushin
483117981c DEV-1599 DEV-1598 fix flakiness (#70166) 2026-03-04 17:51:33 +00:00
Nathan Voxland
2480ce058b Support exclusive queue listeners 2026-03-04 11:27:19 -06:00
Nathan Voxland
cf04ba48c2 Immediately deliver topic posts locally without waiting for backend roundtrip 2026-03-04 09:51:00 -06:00
Nicola Mometto
88f48ce996 Restrict notification schema and allowed template values (#70261)
* fix: restrict channel renderer to hbs files in the template path

* restricted api schemas

* explicit validation

* chore: tests

* fix: test
2026-03-04 15:23:35 +00:00
Rodrigo López Dato
7eb9d27107 Conceal JWT signing secret by default (#70329) 2026-03-04 11:50:29 -03:00
Nemanja Glumac
c5b8eef4d9 Add cache restore keys for M2 and Node modules (#70370) 2026-03-04 14:17:36 +00:00
Chris Truter
9c44b33887 Add malli typing for transform execution methods (#70250) 2026-03-04 13:23:12 +00:00
Nicola Mometto
3b030bcd58 fix test after out-of-order merge (#70368) 2026-03-04 13:01:13 +00:00
Nicola Mometto
4b9c2e7720 support multiple join conditions in join-analysis lens (#70247)
* fix: count on the condition rather than trying to extract field, generalized for multiple join conditions

* chore: tests

* fix: inline
2026-03-04 11:59:29 +00:00
Chris Truter
57586f2427 Extract non-appdb module out of transforms (attempt #3) (#70245) 2026-03-04 09:50:35 +00:00
Stas Gavrylov
d813be6b09 GDGT-1755: Migrate AdHocQuestionLoader, Breadcrumbs, QuestionLoader, QuestionResultLoader, SavedQuestionLoader to TS (#70106)
* Migrate AdHocQuestionLoader component to TS

* Migrate Breadcrumbs to TS

* Migrate QuestionLoader, QuestionResultLoader, SavedQuestionLoader to TS

* GDGT-1755: Add type guards for Breadcrumbs

* GDGT-1755: Restore comments

* GDGT-1755: Address review comments

* GDGT-1755: Fix tests

* GDGT-1755: Rename type
2026-03-04 11:30:20 +02:00
Chris Truter
ccd3e61ff0 Fix clickhouse transform flake, hopefully (#70316) 2026-03-04 08:49:54 +00:00
Nathan Voxland
8a853116bf Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	.clj-kondo/config.edn
2026-03-04 01:26:56 -06:00
Nathan Voxland
c54c9ded12 improving code 2026-03-04 01:20:12 -06:00
Nathan Voxland
0fc1a4b8c9 Code improvements and removed postgres topic listener 2026-03-04 00:18:19 -06:00
Ben Grabow
5e647df5be Add bgrabow (#70347) 2026-03-03 22:18:36 +00:00
Braden Shepherdson
04a5c90dab [MBQL lib] Move lib.util/join-strings-with-conjunction to util.i18n (#70270)
Fixes QUE2-371.

This function has nothing to do with lib, and only depends on
`clojure.string`.
2026-03-03 22:13:40 +00:00
Nathan Voxland
bbc00a8677 Don't fail on unknown settings when calling set-many (#70282) 2026-03-03 15:57:10 -06:00
Nemanja Glumac
a43d62a505 Disable scheduled cloverage reports (#70313) 2026-03-03 22:39:11 +01:00
Ben Grabow
693ac2a9ce Make a mage task to generate resolve-as XML from clj-kondo lint-as data (#70342) 2026-03-03 15:33:17 -06:00
Alex Yarosh
d4a888c2ec docs: a lot of updates (#70176)
* oops

* links

* more links

* Update docs/configuring-metabase/appearance.md

* Apply suggestions from code review

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

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2026-03-03 20:39:03 +00:00
Alex Yarosh
73a53fd72d docs: update default target branch for docs autogen (#70334)
Update default target branch to release-x.59.x
2026-03-03 20:04:50 +00:00
Abed Habli
7a88dfba69 Docs V59: Adding profile icon for non-admin nav paths (#69969)
adding profile icon for non-admin nav paths
2026-03-03 14:30:32 -05:00
Alex Yarosh
b6b44f3cd6 docs: transform screenshots (#70225)
* transform updates

* more transform

* Optimized 11 images, saved 1015.9 KB (45.3% smaller)

* screenshot typo

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2026-03-03 14:19:42 -05:00
Jeff Bruemmer
e586b78513 docs - embedded Metabot (#70275) 2026-03-03 18:44:55 +00:00
John Swanson
330fb2727e SSO users can reset password if provider disabled (#70219)
Previously, password-reset-disabled? blocked password reset for all
SSO users unconditionally (except Google when SSO was globally
disabled). After a license downgrade, EE SSO users were locked out —
they couldn't use SSO (no license) and couldn't reset their password
either.

Introduce sso-source-enabled? which checks whether a user's specific
SSO provider is currently active, using setting/get to respect the
:feature guards on EE settings. password-reset-disabled? now delegates
to this function, so password reset is only blocked when the provider
is actually usable.
2026-03-03 10:42:00 -08:00
Maksym Yakubych
ea89a862ec feat: improve mention menu in metabot (#69650) 2026-03-03 17:33:32 +00:00
Alex Yarosh
0e6915287b docs: start redirect (#70323)
start redirect
2026-03-03 12:25:40 -05:00
Jakub Chodorowicz
d0ffa5115d Gdgt 1801 visualization typescript conversions leafletmap.tsx (#70248) 2026-03-03 17:26:53 +01:00
dpsutton
86dcec8883 Set team.json and assign modules: (#70309)
team:

```javascript
    {
      "name": "Graphy",
      "label": ".Team/Graphy",
      "members": [
        "ranquild",    // alex p
        "romeovs",     // romeo
        "ericnormand", // eric
        "galdre",      // timothy
        "dpsutton",    // dan
        "escherize",   // bryan
        "bgrabow"      // ben
      ]
    }
```

Modules:
- analyze
- graph
- sync
- enterprise/dependencies
2026-03-03 09:45:28 -06:00
Rodrigo López Dato
b2c736e4ca Missing space + log4j capitalization (#70271)
* Missing space + log4j capitalization

* Don't make changes in autogenerated MD files
2026-03-03 11:56:20 -03:00
Dan Stone
4a3e155ac9 Reenable bigquery incremental test (#70252)
Was toggled off individually due to issues with write consistency:
https://github.com/metabase/metabase/pull/69753
2026-03-03 14:44:16 +00:00
Braden Shepherdson
0f687a4a6b [MBQL lib] Prefer calling exported versions of several lib.util fns (#70269)
Fixes QUE2-352.

- `lib.util/strip-id` is newly exported with the more self-documenting
  name `lib/display-name-without-id`.
- `lib.util/clause?` and `clause-of-type?` were already exported
- `lib.util/source-card-id` (and `source-table-id`) are exported as
  `lib/primary-source-card-id` (and likewise for tables).

This isn't all the escaped usages of `lib.util` functions, but other PRs
will handle those.
2026-03-03 09:25:08 -05:00
Jakub Chodorowicz
5274ca8dcb Remove obsolete LeafletHeatMap and leaflet.heat (#70301) 2026-03-03 15:18:29 +01:00
github-automation-metabase
e0123c6246 Auto-update documentation for master (#70289)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-03-03 09:03:48 -05:00
Anderson
4301a00c1b Add snowplow events when creating measures and segments (#70218)
* Add snowplow events when creating measures

* Track also from the table measures page

* Add tracking events when creating segments

* Fix e2e
2026-03-03 13:47:37 +00:00
Kamil Mielnik
7dc0929cc1 GDGT-1834 Visualization Typescript Conversions - lib/settings/ (#69893) 2026-03-03 19:39:50 +07:00
Nicolò Pretto
cf40c24b36 set fail-fast to false in sdk host/sample apps tests (#70260)
disable fail-fast on sdk tests
2026-03-03 09:20:37 +01:00
Uladzimir Havenchyk
5c4c8753d7 chore: convert viz tests and helpers to typescript (#70059)
* chore: convert viz tests to typescript

* convert more tests

* more tests

* more tests

* more tests

* use global helpers

* more tests

* more tests

* convert settings definition

* more files to typescript

* more files to typescript

* fixup

* fixup

* Update v59 sample Examples visualizations and dashboard. (#70075)

Adds Box Plot viz and a Scalar viz with conditional colors to the Example dashboard.
The resources/sample-content.edn was regenerated from the live instance content.

* Pin patched libraries to their patched version (#70143)

* address review

* add a guard

---------

Co-authored-by: Katya Voropaieva <110612633+KorowkaMu@users.noreply.github.com>
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2026-03-03 11:14:29 +03:00
Anderson
d6540d2d62 Add snowplow events when creating a metric (#69990)
* Add snowplow events when creating a metric

* Fix tests in data-studio-metrics.cy.spec.ts

* Fix prettier
2026-03-03 01:09:31 -05:00
Nathan Voxland
d7f7d8285f Use the search cluster lock for both init indexing and re-indexing (#70272) 2026-03-02 18:07:55 -06:00
Jeff Bruemmer
cd68964a13 docs - fix summary formatting in users-roles-privileges.md (#70277)
Fix summary formatting in users-roles-privileges.md
2026-03-02 21:49:38 +00:00
Cam Saul
5e35a33837 Track whether column is :lib/from-model? (#70128)
* Track whether column is `:lib/from-model?`

* Additional fix 🔧

* Fix GH issue number

* (Try an evil hacc)

* Explain the HACC
2026-03-02 12:56:49 -08:00
Eric Normand
1734750c21 [Mutation Testing] Kill mutations in metabase.lib.field/fieldable-columns (#69321)
[Mutation Testing] Add tests for metabase.lib.field/fieldable-columns
2026-03-02 13:56:24 -06:00
Fraser
bb7604b53e Convert hoc-utils to ts (#70046) 2026-03-03 08:53:39 +13:00
Fraser
ea43ff2816 Convert Legend components to TypeScript (DEV-1502) (#69427)
* Convert Legend components to TypeScript (DEV-1502)

Convert Legend, LegendItem, LegendItemDot, and LegendLayout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 08:53:24 +13:00
Alex Yarosh
e8c624b479 docs: update plans for writeable connection (#70264)
* 😑

* remove blockquotes

* Update docs/databases/users-roles-privileges.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2026-03-02 19:06:42 +00:00
metamben
97d10fee1c Preserve metadata edits for summary columns (#70235)
* Preserve metadata edits for summary columns

Closes QUE2-17
2026-03-02 21:50:22 +03:00
Stas Gavrylov
5c6250fe4d GDGT-1859: Fix enabling Advanced Transforms (#70183)
* GDGT-1859: Fix Python transforms not enabled after adding to the trial

* GDGT-1859: Add page refresh after enabling Advanced Transforms

* GDGT-1859: Update unit tests
2026-03-02 13:42:27 -05:00
Nicolò Pretto
21a620c6e8 fix stress tests for sdk component tests (#70253) 2026-03-02 17:30:51 +01:00
Braden Shepherdson
1e3b836a7b [MBQL lib] Improve the docstrings for lib.computed (#70207)
The high-level docs in this namespace were lacking, and I got asked for a tour of it, so I improved the docs as well.
2026-03-02 10:25:52 -05:00
Dan Stone
a6ae573321 Turn on snowflake/bq tests for transforms (#70199)
They seem to be working ok https://github.com/metabase/metabase/actions/runs/22575305288
2026-03-02 14:21:42 +00:00
Egor Grushin
14740891cd GDGT-1785 Load cards in batches in the Transform Inspector (#70129) 2026-03-02 11:54:30 +00:00
Uladzimir Havenchyk
908ca1a1d6 chore: split into components and hooks ClickMappings (#70097)
* chore: convert dashcard related redux components to typescript

* fixup

* address review

* another review iteration

* add a missing import

* chore: split into components and hooks ClickMappings

* fix imports

* delete old file

* make hook code human readable
2026-03-02 12:11:53 +03:00
Oleksandr Solovyov
94309cd070 Add toggle to enable/disable the Metabot (#70111) 2026-03-02 10:38:59 +02:00
Romeo Van Snick
d54e6b64e2 Convert parameters to typescript (#70137)
* Convert parameters to TypeScript

* Fix types

* Fix types in normalizeValue

* Fix types in dashboard tests

* Fix more types

* Fix test

* Remove duplicate check

* Naming
2026-03-02 17:07:10 +11:00
metabase-bot[bot]
763d5e1777 [chore] Update E2E test timings with recent data (#70236)
Update E2E test timings with averaged data

Collected timing data from 7 days of test runs.
All specs with timing data were included (simple averages).

🤖 Generated automatically by update-e2e-timings workflow

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>
2026-03-02 12:16:14 +13:00
Fraser
b746306e12 Convert VisualizationError utils to TypeScript (#69062)
* Convert VisualizationError utils to TypeScript

Closes DEV-1407

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-02 11:53:39 +13:00
Fraser
f0c90980ff Convert DefaultParametersSection to TypeScript (#69075)
* Convert DefaultParametersSection to TypeScript

Closes DEV-1420

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-02 11:53:21 +13:00
Egor Grushin
e53f226b40 GDGT-1852 fix ui issues in Data Summary tab in Transform Inspector (#70150)
* GDGT-1852 fix ui issues
2026-03-01 22:48:32 +00:00
Romeo Van Snick
40cbf2ffb5 Avoid updating url when navigating to query builder (#68982)
* Use Question.serializeCardForUrl for consistency

* Convert metabase/lib/card to typescript

* Remove broken createCard helper

* Fix types

* Remove unused parameter

* Remove entityId from cards

* Remove createCard tests

* Avoid renaming Card to CardObject for no reason

* Also allow serializing UnsavedCard

* Make options optional

* Simplify serializeCardForUrl

* Make serializeCardForUrl implementation match the Question.serializeCardForUrl implementation

* Use serializeCardForUrl from metabase/lib/card

* Use serializeCardForUrl from metabase/lib/card

* Use stable stringify for url hashes

* Remove unnecessary _serializeForUrl helper

* Correctly ignore possibly infinite type instantiations

* Fix unit tests

* Allow passing parameterValues

* Fix comparison

* Coerce values to undefined

* Update unit tests

* Remove duplicate key

* Make cards optional
2026-03-02 08:38:55 +11:00
Braden Shepherdson
55a0afbd2a [MBQL lib] Stop using ID-based refs for fields from joined cards (#70116)
Fixes QUE2-383.

Uses `:lib/card-id` in metadata to check if a column came from a card at any point.
If so, it should use a name-based `:field` ref rather than an ID-based one.
This makes the refs to joined columns consistent with those to main source columns,
based on whether the source is a table or card.
2026-02-28 20:10:19 +00:00
Robert Kosara
f759d9f473 Docs: Tenant attributes and collections improvements (#70179)
* Tenant attributes and collections improvements

First round of edits to add the ability to create tenant attributes using SSO.

* Revise tenant-specific access for non-admin internal users

* Edits based on Alberto's comments

* Move tenant claims info to claims section, link to it from attributes

* Apply suggestion from @alexyarosh

Co-authored-by: Alex Yarosh <alexandra@metabase.com>

* Moved tenant attribute logic and simplified sentence

* Fix a sentence, improve code example, and clean up permissions bullet points

---------

Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2026-02-27 13:46:20 -08:00
Uladzimir Havenchyk
39951a570a chore: make entity copy modal generic (#70018)
* chore: convert dashcard related redux components to typescript

* fixup

* address review

* another review iteration

* chore: make entity copy modal generic

* chore: convert dashcard related redux components to typescript

* fixup

* address review

* another review iteration

* add a missing import

* type cleanup

* address review
2026-02-28 00:07:56 +03:00
Alex Yarosh
6b369ef818 docs: writeable connection (#70210)
* writeable connection

* Optimized 1 images, saved 89.0 KB (46.9% smaller)

* routing notes

* typos

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2026-02-27 14:33:37 -05:00
Nemanja Glumac
f3c352d920 Increase viewport to reduce "extract column" flakes (#70206) 2026-02-27 20:06:00 +01:00
Anderson
9c0576cc5c Add snowplow event for opening Data Studio (#69880)
* Add snowplow event for when opening Data Studio

* Update triggered_from
2026-02-27 18:21:02 +00:00
Nemanja Glumac
fc00027fca Migrate away from deprecated Cypress.env() API (#70189)
As of Cypress 15.10.0, `Cypress.env()` is deprecated. This commit migrates
all usages to the new recommended APIs:

- Non-sensitive config values → `Cypress.expose()` (synchronous)
- Sensitive token values → `cy.env()` (asynchronous)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-27 19:03:29 +01:00
Nathan Voxland
6ca5625902 Code improvements 2026-02-27 12:47:50 -05:00
Ngoc Khuat
3be69174e6 Improve logging around notifications (#70099) 2026-02-27 16:55:43 +00:00
Nicola Mometto
11a73d8621 Add position field to dashboard parameters for stable serialization (#70107)
* revert sorting by id on parameters serialization, parameters ordering is significant and must be preserved

* revert, we're storing position

* feat: add :position to parameters, backfill

* feat: backfill position on imported parameters

* chore: tests

* FE: update position

* chore: gitignore python-sources.lock

* chore: ensure we get position

* restrict to dashboard params

* tests

* simpler approach: just sort by position on serialization export/import
2026-02-27 16:06:32 +00:00
Dan Stone
d1e7b483dd Prefer SQL DML for insert-from-source! to fix bigquery metadata consistency (#69753)
The legacy .insertAll API (and newer Storage API) do not work well with
tables that are created/dropped frequently. This is because their
metadata caches can take a long time to up date.

Python transforms use the drop-recreate fallback strategy for bigquery
so we observe this inconsistency for every run after the first, even
with absurd multi minute timeouts.

The SQL API does not have a problem, so we'll use that. We expect a
performance regression but its better to work slowly than not work at
all.

Other changes:

- Removed now redundant bigquery retry loop

- Dropped dictionary support, we cannot support it easily and it cannot be
considered higher prio than bigquery working at all.

- Added correct parameter typing for JSON.

- Fixed ordering issues in tests (assumed row order when it is
non-deterministic)
2026-02-27 15:47:58 +00:00
Ngoc Khuat
aa66ab25d6 Simplify notification result data flow (#70115) 2026-02-27 21:58:54 +07:00
Edward Paget
8207fc3181 feat: error code on streaming response throw/fail (#62351)
* fix: real error codes in streaming responses

* fixup! try faking old errors deeper in the stack

* fixup! wrap fetch endpoint in embedding too

* fixup! treat string only errors differently

* fixup! handle errors in a couple other places

* fixup! hard to figure out what kind of error it is

* fixup! typecasts

* fixup! test arity

* fixup! remove blanket 403 page from dataset

* fixup! simplify backend 403 responses

* fixup! a couple missed tests

* fixup! add mockresponse for mockclient

* fixup! other failing tests

* fixup! last failing test

* fixup! add another OSS check

* fixup! one more oss test

* fixup! update status codes on some more tests

* fixup! use committed function
2026-02-27 09:42:20 -05:00
Nicolò Pretto
b429839f0a remove sdk import error on core app e2e tests (#70188)
try to untangle imports
2026-02-27 14:41:19 +01:00
Jakub Chodorowicz
451f080ede add new variants to action icon and use it in Inspector Header cell (#70180)
* add new variants to action icon and use it in Inspector Header cell

* add is-active state
2026-02-27 12:10:07 +01:00
Dan Stone
4f00289729 Fix bigquery routing test (#70154)
- Was using wrong project / creds
- Using two different sha names only worked when shas were not used as
qualifiers in the query (they are for bigquery)

Added the ability to override the hash-key used for tx/hash-dataset to
support forcing a hash collision (as is required by routing).
2026-02-27 10:58:14 +00:00
Maksym Yakubych
369d410d4d fix: new SQL questions automatically open DataReference sidebar (#70120) 2026-02-26 21:09:43 +00:00
Nicola Mometto
b8c13482df fix: replace usage of source-table-id with primary-source-table-id (#70162) 2026-02-26 14:24:20 -05:00
Sloan Sparger
126eb6b1b1 [Metabot] Prevent OSS SQL gen UI from showing in cloud migrated instances (#69649)
prevent oss sql gen ui from showing for customsers with had set it up locally and migrated to cloud
2026-02-26 12:54:41 -06:00
Noah Moss
4ab19dce4d Ring middleware for public sharing endpoints (#70153)
* Ring middleware for public sharing endpoints

* Refactor test

* move +public-sharing-enabled to address module lint

* Fix documents test
2026-02-26 12:59:54 -05:00
Braden Shepherdson
39b4a21830 [MBQL lib] Refactor a common pattern into new lib functions (#68474)
Many uses of `lib.util/source-card-id` and `source-table-id` were
followed by calling `lib.metadata/card` or `lib.metadata/table`
respectively.

This PR adds two new functions `lib.metadata.calculation/primary-source-card`
and `primary-source-table` which look up the card/table directly.

It also adds `lib.metadata.calculation/primary-source` for the handful
of places where whichever of `primary-source-card` or `primary-source-table`
returns non-nil gets used, such as in some drill-thrus.
2026-02-26 17:32:57 +00:00
Eric Normand
3ba0f90cf0 Automate mutation testing end-to-end with run! orchestrator (#70126)
- Adds a fully automated `run!` entry point to `dev.mutation-testing` that orchestrates the entire mutation testing workflow: generate report → create Linear project → group functions → write tests via `claude -p` → verify → retry →
  commit → create draft PRs
  - Replaces the previous manual, step-by-step SKILL.md instructions (which required the operator to execute each step) with Clojure functions that handle the full pipeline automatically
  - Key new functions: `parse-namespace`, `group-functions`, `build-test-prompt`, `invoke-claude!`, `verify-and-retry!`, `process-group!`, `print-summary!`

  ## Motivation

  The mutation testing workflow previously required ~20 manual steps per namespace, with the Claude operator interpreting skill instructions and running each step. This was slow, error-prone, and required constant supervision. Now you just
  call `(mut-test/run! 'metabase.lib.order-by)` and walk away.

  ## How it works

  1. **`parse-namespace`** — derives source/test paths, short names, auto-detects `.cljc` vs `.clj`
  2. **`group-functions`** — clusters private functions with their public entry points based on test overlap, skips fully-covered functions
  3. **`build-test-prompt`** — assembles a prompt with function source, existing tests, and surviving mutations
  4. **`invoke-claude!`** — shells out to `claude -p` with scoped tool access (`Edit`, `Read`, `Bash(clj-nrepl-eval*)`)
  5. **`verify-and-retry!`** — checks which mutations were killed, retries up to 2x with targeted prompts for survivors
  6. **`process-group!`** — full per-group pipeline: branch → invoke Claude → verify → commit & push → Linear issue → draft PR
  7. **`run!`** — ties it all together, catches errors per group so one failure doesn't stop the batch
2026-02-26 09:51:59 -07:00
Nemanja Glumac
6e799b2ef6 Bump Cypress retries to two (#70157) 2026-02-26 17:42:51 +01:00
Dan Stone
dcd2d7394d Fix snowflake integer type (#70031)
BigInteger is observed
2026-02-26 16:04:33 +00:00
Aleksandr Lesnenko
3c693179e4 fix content translations break visualization settings (#70054)
* fix content translation produces unstable translated keys in viz settings
2026-02-26 10:54:11 -05:00
Braden Shepherdson
b01732fd69 [perf] Tools to repro query + metadata locally, given instance API access (#67952)
Given browser or API access to a Metabase instance, the tools in this PR
can recursively fetch cards and all the metadata (tables, fields, etc.)
required to run them through QP preprocessing and compilation.

Of course this cannot actually _execute_ the compiled form, since you
don't have access to the user's DWH, but it enables debugging of
hard-to-reproduce user bug reports in your local REPL.

This works by making API calls like `/api/card` and
`/api/card/query_metadata` until a complete picture of the metadata is
acquired. This is poured into a `MetadataProvider`, which is all the QP
needs to analyze and compile the query.
2026-02-26 15:49:56 +00:00
Nicola Mometto
a75ee49fd1 restrict a transform inspector test to sql (#70152)
fix: restrict to sql drivers
2026-02-26 15:23:21 +00:00
Eric Normand
dbfe313b4a Filter transforms based on permissions GHY-3152 (#70125)
Filter transforms based on permissions

We were leaking transforms in the :bad_transforms key
2026-02-26 14:55:12 +00:00
github-automation-metabase
088bd180d5 Auto-update documentation for master (#70133)
Update generated docs (master)

Co-authored-by: github-actions <github-actions@github.com>
2026-02-26 09:46:51 -05:00
metabase-bot[bot]
0226eaa5d2 [chore] Update E2E test timings with recent data (#69996)
Update E2E test timings with averaged data

Collected timing data from 7 days of test runs.
All specs with timing data were included (simple averages).

🤖 Generated automatically by update-e2e-timings workflow

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>
2026-02-26 15:04:49 +01:00
Nicola Mometto
3d68aa1ac4 feat: restrict join-analysis to only table-level join analysis (#70105) 2026-02-26 13:08:34 +00:00
Nemanja Glumac
c18c08b02c Pin patched libraries to their patched version (#70143) 2026-02-26 13:02:41 +01:00
Katya Voropaieva
851bedf5bb Update v59 sample Examples visualizations and dashboard. (#70075)
Adds Box Plot viz and a Scalar viz with conditional colors to the Example dashboard.
The resources/sample-content.edn was regenerated from the live instance content.
2026-02-26 10:45:57 +01:00
Uladzimir Havenchyk
9981cd5323 chore: convert dashboard reducer to typescript and rtk (#69842)
* chore: convert dashboard reducer to typescript

* convert to rtk

* use immer when possible

* fixup

* Apply suggestion from @kamilmielnik

I checked it locally and it is indeed unnecessary guard

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2026-02-26 11:47:52 +03:00
Uladzimir Havenchyk
264604b61e chore: convert dashcard mapping files to ts (#69836) 2026-02-26 10:30:10 +03:00
Sébastien
a5a0773eaf Migrate ChartTypeDropdown to use Mantine ComboBox (#69734)
* Migrate ChartTypeDropdown to use Mantine ComboBox

* test fixes

* .

* .

* .

* .

* screenshot
2026-02-26 10:56:02 +07:00
Romeo Van Snick
c463756c60 Remove deprecated unit test helpers (#69275)
* Replace createQueryWithClauses with createTestQuery

# Conflicts:
#	frontend/src/metabase-lib/test-helpers.ts
#	frontend/src/metabase/querying/filters/hooks/use-date-filter/use-date-filter.unit.spec.ts

* Remove unnused helpers

# Conflicts:
#	frontend/src/metabase-lib/test-helpers.ts

* WIP

* Export createMetadataProvider

* Use Lib.createTestHelper

* Remove createQuery helper usage

* Remove createQuery helper

* Remove unneeded getJoinQueryHelpers

* Fix test

* Remove DEFAULT_QUERY

* Move or remove unneeded test helpers

* Fix lint

* Allow auto binning in test spec

* Fix test

* Allow disamiguating column name by index

* Fix tests

* Fix imports
2026-02-26 13:09:27 +11:00
Romeo Van Snick
0f7e8983ca Metakey helper (#68987)
* Use H.metaKey where applicable

* Add helper for meta key options

* Fix import

* Update more instances

* Fix test
2026-02-26 00:51:03 +00:00
Sloan Sparger
3401c9e902 Fix e2e dashboard-questions.cy.spec.js scrollTo flakes (#70114)
* invert assertions about scrollTo hash param and instead assert on visibility

* update e2e/test/scenarios/question/saved.cy.spec.js

* try to improve flakiness

* trying something dumb
2026-02-25 16:22:00 -06:00
Eric Normand
0aeda87a3d [Mutation Testing] Kill mutations in metabase.lib.field/fingerprint-based-default-unit (#69319)
Part of the mutation testing project for metabase.lib.field.

Closes QUE2-338

Functions
Stats
Surviving mutations before: 16
Tests added: 1
Mutations killed by this PR: 16
Mutations remaining: 0
Mutations killed
Replace fingerprint with nil
Replace :type with :type__
Replace :type/DateTime with :DateTime__
Replace let with comment
Replace earliest with nil
Replace latest with nil
Replace when-not with when
Replace days with nil
Replace > with >=
Replace > with nil
Replace days with nil
Replace 1 with 0
Replace :minute with :minute__
Replace 31 with 0
Replace 365 with 0
Replace :week with :week__
Mutations not killed (with rationale)
Replace :day with :day__ — available-temporal-buckets-for-type has its own internal default of :day for datetime types, so the :day return value from fingerprint-based-default-unit is redundant with the fallback
2026-02-25 22:07:25 +00:00
metamben
b1ece80c0d Support DB-local settings in the JVM and JS metadata-providers (#70117)
Closes QUE2-292
2026-02-25 21:52:17 +00:00
metamben
486a6fc826 Add test to prove that #35842 has been fixed (#70080)
Closes #35842
2026-02-25 21:25:19 +00:00
Eric Normand
29f75c1251 test: mutation tests for column-metadata-effective-type and nest-display-name (#69328)
* [Mutation Testing] Add tests for metabase.lib.field/fieldable-columns

* test: add mutation tests for column-metadata-effective-type and nest-display-name

Adds tests that exercise:
- type-of fallback to :base-type when :effective-type is absent
- type-of preference for :effective-type over :base-type
- temporal extraction returning :type/Integer
- temporal truncation preserving effective type
- nested field with nil parent display-name graceful fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:03:39 +00:00
metamben
66dc6b6cdc Add test to prove that #57978 has been fixed (#70076)
Closes #57978
2026-02-25 23:37:16 +03:00
metamben
7433f38a22 Make visible-columns for cards respect field visibility (#70040)
Closes QUE2-5
2026-02-25 23:36:59 +03:00
Cam Saul
71606de98c Test to prove #28060 is fixed 🔧 (#69865)
* Test to prove #28060 is fixed 🔧

* Update src/metabase/driver/mysql.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Update src/metabase/driver/mysql.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Fix syntax error from PR feedback suggestion

* Test fix 🔧

* Fix 🔧

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2026-02-25 17:25:35 +00:00
Nathan Voxland
a4fdcdef64 Code review fixes 2026-02-21 10:21:20 -06:00
Nathan Voxland
b1fe71ca2f Cleaning up force-sync usage 2026-02-21 02:29:02 -06:00
Nathan Voxland
4daf2cb8a2 Added batch-listen! 2026-02-21 01:52:57 -06:00
Nathan Voxland
4a3d739318 Started to migrate old util.queue code to new mq 2026-02-20 15:41:51 -06:00
Nathan Voxland
ba85c0513c Cleanup failed queue messages 2026-02-19 16:55:00 -06:00
Nathan Voxland
b8c26e3c0c Code review fixes 2026-02-19 16:48:09 -06:00
Nathan Voxland
21b5b3e93a Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	resources/migrations/059_update_migrations.yaml
2026-02-19 16:20:28 -06:00
Nathan Voxland
0a1a13b48b Code cleanup 2026-02-19 16:09:11 -06:00
Nathan Voxland
a18f7a94e2 Code cleanup 2026-02-19 15:34:05 -06:00
Nathan Voxland
067626c71d Added metrics 2026-02-19 10:41:42 -06:00
Nathan Voxland
3bc10ee2e1 Cleanly shut down 2026-02-19 09:53:39 -06:00
Nathan Voxland
b9fba6ab7a Cleaning up topic code 2026-02-19 01:15:32 -06:00
Nathan Voxland
20e5611810 Cleaning up topic code 2026-02-18 16:26:15 -06:00
Nathan Voxland
37d68bca75 Made mq.topic code look like mq.queue code 2026-02-18 15:52:48 -06:00
Nathan Voxland
e58e0b7f80 Queue code improvements 2026-02-18 15:21:22 -06:00
Nathan Voxland
81aab7b8ca Added schemas 2026-02-18 14:15:45 -06:00
Nathan Voxland
bcf8a422f6 Queue code cleanup 2026-02-18 14:03:30 -06:00
Nathan Voxland
ac434a50aa Queue code cleanup 2026-02-18 13:02:49 -06:00
Nathan Voxland
4f050fba0a Use notify on postgres 2026-02-18 01:25:29 -06:00
Nathan Voxland
c36a72146e moved queue and pubsub to .mq 2026-02-18 00:27:53 -06:00
Nathan Voxland
d82ec362ba Added pub/sub messaging 2026-02-17 17:04:11 -06:00
Nathan Voxland
c2172311f5 Better queue testing with memory queue 2026-02-17 16:19:34 -06:00
Nathan Voxland
5a7bcfab93 Better naming for storing messages in the appdb queue 2026-02-17 15:37:43 -06:00
Nathan Voxland
decbc82b1a Code review fixes 2026-02-17 14:56:27 -06:00
Nathan Voxland
bd0f5b3b69 Merge remote-tracking branch 'origin/master' into persistent-queue 2026-02-17 14:33:54 -06:00
Nathan Voxland
7f98271a59 Don't have a queue_message model since it's an implementationd detail 2026-01-26 17:04:26 -06:00
Nathan Voxland
8cc219994d Merge remote-tracking branch 'origin/master' into persistent-queue 2026-01-26 16:44:09 -06:00
Nathan Voxland
84168dbf05 Merge remote-tracking branch 'origin/master' into persistent-queue
# Conflicts:
#	resources/migrations/059_update_migrations.yaml
2026-01-26 15:27:21 -06:00
Nathan Voxland
d6da219a70 Fixes from code review and getting back to project 2026-01-16 16:28:37 -06:00
Nathan Voxland
65426fe653 Merge remote-tracking branch 'refs/remotes/origin/master' into persistent-queue
# Conflicts:
#	resources/migrations/059_update_migrations.yaml
2026-01-16 16:11:19 -06:00
Nathan Voxland
6403d80fea Merge branch 'master' into persistent-queue 2026-01-14 11:11:53 -06:00
Nathan Voxland
bbcba1500c Added queue_message table back 2026-01-12 14:29:48 -06:00
Nathan Voxland
fcf4dbb6e8 Merge branch 'master' into persistent-queue
# Conflicts:
#	.clj-kondo/config/modules/config.edn
#	resources/migrations/056_update_migrations.yaml
2026-01-12 14:29:04 -06:00
Nathan Voxland
3d75754ad8 Added sucess and failure handling, general cleanup 2025-07-18 17:06:05 -05:00
Nathan Voxland
af72309d8e e2e test works again 2025-07-17 22:30:10 -05:00
Nathan Voxland
646b4c4548 Reverted metabase.queue changes, implemented metabase.queue.memory, code cleanup 2025-07-15 21:00:16 -05:00
Nathan Voxland
92ada9186c Code cleanup 2025-07-15 14:33:44 -05:00
Nathan Voxland
e67ce4582e Moved migrations 2025-07-14 23:07:20 -05:00
Nathan Voxland
25e3afcdbb Refactoring and trying to get e2e test to pass again 2025-07-14 23:07:20 -05:00
Nathan Voxland
b31a9a09c5 Configured queue listener to use persistent queue 2025-07-14 23:07:20 -05:00
Nathan Voxland
50614c15aa Initial implementation 2025-07-14 23:07:20 -05:00
4457 changed files with 215335 additions and 69081 deletions

View File

@@ -12,14 +12,7 @@
## Testing
- **Run a test:** `./bin/mage run-tests namespace/test-name`
- **Run all tests in a namespace:** `./bin/mage run-tests namespace`
- **Run all tests for a module:** `./bin/mage run-tests test/metabase/notification` Because the module lives in that directory.
Note: the `./bin/mage run-tests` command accepts multiple args, so you can pass
`./bin/mage run-tests namespace/test-name namespace/other-test namespace/third-test`
to run 3 tests, or
`./bin/mage run-tests test/metabase/module1 test/metabase/module2` to run 2 modules.
Use `./bin/test-agent` to run backend tests. See the top-level CLAUDE.md for usage.
## Code Readability

View File

@@ -0,0 +1,357 @@
---
name: add-tracing
description: Add OpenTelemetry tracing spans to Clojure code following Metabase tracing conventions. Use when instrumenting backend code with trace coverage.
---
# Add Tracing Spans to Clojure Code
This skill helps you add OpenTelemetry (OTel) tracing spans to the Metabase backend codebase using the custom `tracing/with-span` macro.
## Reference Files
- `src/metabase/tracing/core.clj` - `with-span` macro, group registry, SDK lifecycle, `best-effort-sanitize-sql`, Pyroscope integration
- `src/metabase/task/impl.clj` - `defjob` macro that wraps Quartz jobs with root spans
- `.clj-kondo/config/modules/config.edn` - Module boundary configuration
## Module Architecture
The tracing module has a deliberately minimal API surface. **Only 2 namespaces are public** (listed in `:api` in the module config):
| Namespace | Role | Status |
|---|---|---|
| `tracing.core` | Primary API: `with-span`, groups, SDK lifecycle, Pyroscope, MDC, `best-effort-sanitize-sql` | **Public API** |
| `tracing.init` | Side-effect loader for `quartz` and `settings` | **Public API** (init convention) |
| `tracing.attributes` | `best-effort-sanitize-sql` implementation (re-exported via `tracing.core`) | Internal |
| `tracing.settings` | Setting definitions (`MB_TRACING_*` env vars) | Internal |
| `tracing.quartz` | Quartz JDBC proxy + JobListener | Internal |
**Rules:**
- Only require `[metabase.tracing.core :as tracing]` from outside the module. `tracing/best-effort-sanitize-sql` and all other public functions are available from this single namespace.
- Do not add new API namespaces. Add new public functions to `tracing.core` instead.
- Do not require internal namespaces (`tracing.attributes`, `tracing.settings`, `tracing.quartz`) from outside the module.
- `:uses :any` on the `core` module does NOT bypass the target module's `:api` check — internal namespaces are still enforced.
### Cyclic Dependency Avoidance
`tracing/core.clj` is required by many modules across the codebase. It **must NOT** compile-time require `tracing.settings`, as this creates transitive cyclic load dependencies (e.g., `settings/core -> tracing/settings -> tracing/core -> events/impl -> events/core`).
Instead, `tracing/core.clj` uses `requiring-resolve` for settings access:
```clojure
;; CORRECT — lazy runtime resolution, no compile-time dependency
((requiring-resolve 'metabase.tracing.settings/tracing-enabled))
;; WRONG — creates cyclic load dependency
(require '[metabase.tracing.settings :as settings])
(settings/tracing-enabled)
```
External library namespaces (clj-otel API, SDK, exporters) are safe to require normally — they don't participate in Metabase namespace cycles.
**Important:** `requiring-resolve` must use **literal quoted symbols**. Kondo hooks validate that `required-namespaces` are all simple symbols, so dynamic construction fails:
```clojure
;; CORRECT — literal quoted symbol
(requiring-resolve 'metabase.tracing.settings/tracing-endpoint)
;; WRONG — kondo hook rejects this: "Assert failed: (every? simple-symbol? required-namespaces)"
(requiring-resolve (symbol "metabase.tracing.settings" "tracing-endpoint"))
```
## Quick Checklist
When adding tracing spans:
- [ ] Module has `tracing` in its `:uses` set in `.clj-kondo/config/modules/config.edn`
- [ ] Added `[metabase.tracing.core :as tracing]` to ns requires (alphabetically sorted)
- [ ] Span wraps a meaningful I/O boundary (not pure computation)
- [ ] Group matches the domain (check `src/metabase/tracing/core.clj` for registered groups; add a new one if none fit)
- [ ] Span name follows dot-notation convention (`"domain.subsystem.operation"`)
- [ ] Attributes use namespaced keywords (`:search/query-length`, `:db/id`)
- [ ] No sensitive data in attributes (use `best-effort-sanitize-sql` for HoneySQL, never raw SQL)
- [ ] No new tracing namespaces created (add to `tracing.core` instead)
- [ ] No `DO_NOT_ADD_NEW_FILES_HERE.txt` violations in the target directory
- [ ] Run `clj-kondo --lint <files>` to verify 0 errors, 0 warnings
- [ ] Add or update tests in the corresponding `test/` path (see Testing section below)
- [ ] Run tests: `clojure -X:dev:test :only <test-ns>`
## The `with-span` Macro
```clojure
(tracing/with-span group span-name attrs & body)
```
- **group** - A keyword selecting which trace group this span belongs to (e.g., `:tasks`, `:sync`)
- **span-name** - A string identifying the span in traces (e.g., `"search.execute"`)
- **attrs** - A map of span attributes (e.g., `{:db/id 42}`)
- **body** - The code to execute inside the span
**When disabled:** zero overhead -- single atom deref + boolean check, body runs directly.
**When enabled:** creates OTel span AND injects `trace_id`/`span_id` into Log4j2 MDC for log-to-trace correlation.
## Trace Groups
Groups are registered in `src/metabase/tracing/core.clj`. Check that file for the current list. The general rule: **match the group to the domain, not the call site.** If code runs inside a Quartz job but is logically search work, use `:search`, not `:tasks`.
To add a new group:
```clojure
;; In src/metabase/tracing/core.clj
(register-group! :my-domain "Description of what this covers")
```
Users enable groups via `MB_TRACING_GROUPS=tasks,search,sync` (comma-separated, or `"all"`).
## Naming Conventions
### Span Names
Use dot-separated hierarchical names: `"domain.subsystem.operation"`. The domain prefix should match the group name:
```
search.execute -- `:search` group
sync.fingerprint.table -- `:sync` group
task.session-cleanup.delete -- `:tasks` group
db-app.collection-items -- `:db-app` group
```
### Attributes
Use namespaced keywords. The namespace groups related attributes:
```clojure
:db/id -- Database ID (integer)
:db/engine -- Database engine name (string)
:db/statement -- Sanitized SQL (string, via best-effort-sanitize-sql)
:search/engine -- Search engine name (string)
:search/query-length -- Query string length (integer)
:sync/table -- Table name (string)
:sync/step -- Sync step name (string)
:task/name -- Task name (string)
:http/method -- HTTP method (string)
:http/url -- Request URL (string)
```
Invent new namespaced attributes as needed (e.g., `:pulse/id`, `:transform/count`). Keep values as primitives (strings, numbers, booleans) -- no maps or collections.
## Step-by-Step: Adding a Span
### 1. Check module boundaries
Look up the module for your namespace in `.clj-kondo/config/modules/config.edn`. If `tracing` is not in the module's `:uses` set, add it (keep alphabetically sorted):
```edn
my-module
{:team "MyTeam"
:uses #{analytics config tracing util}}
```
### 2. Add the require
```clojure
(ns metabase.my-module.thing
(:require
[metabase.tracing.core :as tracing]
[metabase.util :as u]))
```
`best-effort-sanitize-sql` is available from `tracing.core` — no additional require needed.
### 3. Identify the I/O boundary
Only wrap code at **meaningful I/O boundaries**:
**DO trace:**
- External API calls (embedding APIs, metabot, webhooks)
- Database queries (both app DB and user DB)
- Network requests (HTTP calls to external services)
- Heavy batch processing (batch indexing, batch embedding)
- Top-level orchestration functions that coordinate multiple sub-operations
**DO NOT trace:**
- Pure computation (sorting, filtering, mapping)
- Simple single-row lookups (`t2/select-one :model/Setting :key k`)
- Every function in a call chain (only boundaries matter)
- Trivial operations (string formatting, hash calculations)
### 4. Wrap with `with-span`
```clojure
;; Simple span (no attributes needed)
(tracing/with-span :search "search.init-index" {}
(do-expensive-thing))
;; Span with static attributes
(tracing/with-span :sync "sync.fingerprint.table"
{:db/id (:db_id table)
:sync/table (:name table)}
(fingerprint-fields! table fields))
;; Span with computed attributes
(tracing/with-span :search "search.execute"
{:search/engine (name (:search-engine ctx))
:search/query-length (count (:search-string ctx))}
(search.engine/results ctx))
;; Span with sanitized SQL (for dynamic HoneySQL queries)
(let [hsql {:delete-from [(t2/table-name :model/Session)]
:where [:< :created_at oldest-allowed]}]
(tracing/with-span :tasks "task.session-cleanup.delete"
{:db/statement (tracing/best-effort-sanitize-sql hsql)}
(t2/query-one hsql)))
;; Sub-spans breaking a function into I/O phases
(let [embedding (tracing/with-span :search "search.semantic.embedding"
{:search.semantic/provider (:provider model)}
(get-embedding model search-string))
results (tracing/with-span :search "search.semantic.db-query" {}
(into [] xform reducible))]
(process results))
;; Per-item iteration spans
(doseq [e (search.engine/active-engines)]
(tracing/with-span :search "search.ingestion.update" {:search/engine (name e)}
(search.engine/update! e batch)))
```
### 5. Add tests
Create or update tests in the corresponding `test/` path. Follow the patterns in existing tracing tests:
- **Reference tests:** `test/metabase/tracing/quartz_test.clj`, `test/metabase/server/middleware/trace_test.clj`
- Use `tracing/init-enabled-groups!` / `tracing/shutdown-groups!` with `try`/`finally` to manage group lifecycle
- Test both enabled and disabled paths (verify zero overhead when group is off)
- Use `reify` mocks for Java interfaces (Connection, PreparedStatement, JobListener, etc.)
- Add `(set! *warn-on-reflection* true)` and type-hint proxy/reify calls to avoid reflection warnings
```clojure
(deftest my-span-enabled-test
(testing "when group is enabled, span is created"
(try
(tracing/init-enabled-groups! "my-group" "INFO")
;; ... test that span behavior occurs ...
(finally
(tracing/shutdown-groups!)))))
(deftest my-span-disabled-test
(testing "when group is disabled, code runs without tracing"
(tracing/shutdown-groups!)
;; ... test that code still works, no wrapping applied ...
))
```
### 6. Lint and run tests
```bash
# Lint modified source and test files — expect 0 errors, 0 warnings
clj-kondo --lint path/to/modified/file.clj path/to/test/file.clj
# Run tests (requires Java 21+)
clojure -X:dev:test :only my-ns.test-ns
```
Expect: all tests pass, 0 failures, 0 errors, no reflection warnings from your files.
## Sanitizing SQL for Attributes
When including SQL in span attributes, **always** use `tracing/best-effort-sanitize-sql`. This converts HoneySQL maps to parameterized SQL strings where values become `?` placeholders -- no data leaks.
```clojure
(let [hsql {:delete-from [:core_session]
:where [:< :created_at some-timestamp]}]
(tracing/with-span :tasks "task.cleanup.delete"
{:db/statement (tracing/best-effort-sanitize-sql hsql)}
(t2/query-one hsql)))
;; Trace attribute: db/statement = "DELETE FROM core_session WHERE created_at < ?"
```
**Rules:**
- Never put raw SQL strings or user-provided values in attributes
- Use `best-effort-sanitize-sql` only for app DB (HoneySQL) queries
- For external/user DB queries, trace only timing and counts, not SQL content
## Defjob and Root Spans
The `defjob` macro in `metabase.task.impl` automatically wraps every Quartz job with a `:tasks` root span:
```clojure
(task/defjob ^{DisallowConcurrentExecution true} SessionCleanup [_]
(cleanup-sessions!))
;; Automatically creates span: "task.SessionCleanup" {:task/name "SessionCleanup"}
```
You do NOT need a root span inside `defjob` bodies. Add **child spans** for I/O inside the job.
For code on plain `Thread`s (not Quartz), add the root span manually:
```clojure
(defn init! []
(tracing/with-span :search "search.task.init" {}
(search/init-index!)))
```
## What NOT to Do
### Span Usage Mistakes
```clojure
;; WRONG - pure computation, no I/O
(tracing/with-span :search "search.format-results" {}
(map format-result results))
;; WRONG - trivial single-row lookup
(tracing/with-span :db-app "db-app.get-setting" {}
(t2/select-one :model/Setting :key "my-setting"))
;; WRONG - raw SQL in attributes (data leak)
(tracing/with-span :tasks "task.cleanup" {:db/statement raw-sql-string}
(execute! raw-sql-string))
;; WRONG - wrong group (search work should use :search, not :tasks)
(tracing/with-span :tasks "search.execute" {} ...)
;; WRONG - redundant nesting (do-search already has a span)
(tracing/with-span :search "search.process" {}
(let [results (do-search ctx)]
(tracing/with-span :search "search.format" {}
(format-results results))))
```
### Architecture Mistakes
```clojure
;; WRONG - creating a new tracing namespace
(ns metabase.tracing.my-feature ...)
;; WRONG - requiring internal tracing namespaces from outside the module
(ns metabase.my-module.thing
(:require [metabase.tracing.attributes :as trace-attrs] ;; internal!
[metabase.tracing.settings :as tracing.settings] ;; internal!
[metabase.tracing.quartz :as tracing.quartz])) ;; internal!
;; WRONG - adding compile-time requires to tracing/core.clj for settings or SDK
;; This creates cyclic load dependencies because tracing/core is widely required
(ns metabase.tracing.core
(:require [metabase.tracing.settings :as settings])) ;; causes cycle!
;; WRONG - dynamic symbol construction with requiring-resolve (kondo rejects it)
(requiring-resolve (symbol "metabase.tracing.settings" "tracing-enabled"))
```
## Configuration
All settings are env-var-only (defined in `src/metabase/tracing/settings.clj`):
```bash
# Core
MB_TRACING_ENABLED=true # Enable tracing (default: false)
MB_TRACING_ENDPOINT=host:4317 # OTLP collector endpoint (default: http://localhost:4317)
MB_TRACING_GROUPS=tasks,search,sync # Comma-separated groups or "all" (default: all)
MB_TRACING_SERVICE_NAME=metabase # Service name in traces (default: hostname)
MB_TRACING_LOG_LEVEL=DEBUG # Log threshold for traced threads: TRACE/DEBUG/INFO (default: INFO)
# Batch span processor tuning
MB_TRACING_MAX_QUEUE_SIZE=2048 # Max spans queued for export; drops when full (default: 2048)
MB_TRACING_EXPORT_TIMEOUT_MS=10000 # Max wait for batch export to complete (default: 10000)
MB_TRACING_SCHEDULE_DELAY_MS=5000 # Delay between consecutive batch exports (default: 5000)
```

View File

@@ -0,0 +1,173 @@
---
name: clojure-eval
description: Evaluate Clojure code via nREPL using clj-nrepl-eval. Use this when you need to test code, check if edited files compile, verify function behavior, or interact with a running REPL session.
---
# Clojure REPL Evaluation
## When to Use This Skill
Use this skill when you need to:
- **Verify that edited Clojure files compile and load correctly**
- Test function behavior interactively
- Check the current state of the REPL
- Debug code by evaluating expressions
- Require or load namespaces for testing
- Validate that code changes work before committing
## How It Works
The `clj-nrepl-eval` command evaluates Clojure code against an nREPL server. **Session state persists between evaluations**, so you can require a namespace in one evaluation and use it in subsequent calls. Each host:port combination maintains its own session file.
## Instructions
### 0. Discover and select nREPL server
First, discover what nREPL servers are running in the current directory:
```bash
clj-nrepl-eval --discover-ports
```
This will show all nREPL servers (Clojure, Babashka, shadow-cljs, etc.) running in the current project directory.
**Then use the AskUserQuestion tool:**
- **If ports are discovered:** Prompt user to select which nREPL port to use:
- **question:** "Which nREPL port would you like to use?"
- **header:** "nREPL Port"
- **options:** Present each discovered port as an option with:
- **label:** The port number
- **description:** The server type and status (e.g., "Clojure nREPL server in current directory")
- Include up to 4 discovered ports as options
- The user can select "Other" to enter a custom port number
- **If no ports are discovered:** Prompt user how to start an nREPL server:
- **question:** "No nREPL servers found. How would you like to start one?"
- **header:** "Start nREPL"
- **options:**
- **label:** "deps.edn alias", **description:** "Find and use an nREPL alias in deps.edn"
- **label:** "Leiningen", **description:** "Start nREPL using 'lein repl'"
- The user can select "Other" for alternative methods or if they already have a server running on a specific port
IMPORTANT: IF you start a REPL do not supply a port let the nREPL start and return the port that it was started on.
### 1. Evaluate Clojure Code
> Evaluation automatically connects to the given port
Use the `-p` flag to specify the port and pass your Clojure code.
**Recommended: Pass code as a command-line argument:**
```bash
clj-nrepl-eval -p <PORT> "(+ 1 2 3)"
```
**For multiple expressions (single line):**
```bash
clj-nrepl-eval -p <PORT> "(def x 10) (+ x 20)"
```
**Alternative: Using heredoc (may require permission approval for multiline commands):**
```bash
clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(+ x 20)
EOF
```
**Alternative: Via stdin pipe:**
```bash
echo "(+ 1 2 3)" | clj-nrepl-eval -p <PORT>
```
### 2. Display nREPL Sessions
**Discover all nREPL servers in current directory:**
```bash
clj-nrepl-eval --discover-ports
```
Shows all running nREPL servers in the current project directory, including their type (clj/bb/basilisp) and whether they match the current working directory.
**Check previously connected sessions:**
```bash
clj-nrepl-eval --connected-ports
```
Shows only connections you have made before (appears after first evaluation on a port).
### 3. Common Patterns
**Require a namespace (always use :reload to pick up changes):**
```bash
clj-nrepl-eval -p <PORT> "(require '[my.namespace :as ns] :reload)"
```
**Test a function after requiring:**
```bash
clj-nrepl-eval -p <PORT> "(ns/my-function arg1 arg2)"
```
**Check if a file compiles:**
```bash
clj-nrepl-eval -p <PORT> "(require 'my.namespace :reload)"
```
**Multiple expressions:**
```bash
clj-nrepl-eval -p <PORT> "(def x 10) (* x 2) (+ x 5)"
```
**Complex multiline code (using heredoc):**
```bash
clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(* x 2)
(+ x 5)
EOF
```
*Note: Heredoc syntax may require permission approval.*
**With custom timeout (in milliseconds):**
```bash
clj-nrepl-eval -p <PORT> --timeout 5000 "(long-running-fn)"
```
**Reset the session (clears all state):**
```bash
clj-nrepl-eval -p <PORT> --reset-session
clj-nrepl-eval -p <PORT> --reset-session "(def x 1)"
```
## Available Options
- `-p, --port PORT` - nREPL port (required)
- `-H, --host HOST` - nREPL host (default: 127.0.0.1)
- `-t, --timeout MILLISECONDS` - Timeout (default: 120000 = 2 minutes)
- `-r, --reset-session` - Reset the persistent nREPL session
- `-c, --connected-ports` - List previously connected nREPL sessions
- `-d, --discover-ports` - Discover nREPL servers in current directory
- `-h, --help` - Show help message
## Important Notes
- **Prefer command-line arguments:** Pass code as quoted strings: `clj-nrepl-eval -p <PORT> "(+ 1 2 3)"` - works with existing permissions
- **Heredoc for complex code:** Use heredoc (`<<'EOF' ... EOF`) for truly multiline code, but note it may require permission approval
- **Sessions persist:** State (vars, namespaces, loaded libraries) persists across invocations until the nREPL server restarts or `--reset-session` is used
- **Automatic delimiter repair:** The tool automatically repairs missing or mismatched parentheses
- **Always use :reload:** When requiring namespaces, use `:reload` to pick up recent changes
- **Default timeout:** 2 minutes (120000ms) - increase for long-running operations
- **Input precedence:** Command-line arguments take precedence over stdin
## Typical Workflow
1. Discover nREPL servers: `clj-nrepl-eval --discover-ports`
2. Use **AskUserQuestion** tool to prompt user to select a port
3. Require namespace:
```bash
clj-nrepl-eval -p <PORT> "(require '[my.ns :as ns] :reload)"
```
4. Test function:
```bash
clj-nrepl-eval -p <PORT> "(ns/my-fn ...)"
```
5. Iterate: Make changes, re-require with `:reload`, test again

View File

@@ -0,0 +1,260 @@
---
name: e2e-test-create
description: >
Analyze React component source code to understand UI structure,
then generate idiomatic Cypress E2E tests following Metabase conventions.
Falls back to Playwright MCP browser exploration only when code reading
and screenshot debugging are insufficient.
disable-model-invocation: true
allowed-tools:
- Bash
- Read
- Write
- Grep
- Glob
- Skill
- "mcp__playwright__*"
---
# Code-Reading-First → Generate Cypress Tests (Metabase)
You are writing Cypress E2E tests for the **Metabase** codebase.
Before generating ANY test code, you MUST analyze React component source code
to understand DOM structure, selectors, and user flows.
## Phase 0 — Research
1. Read existing helpers before writing anything:
- `e2e/support/helpers/` — all shared helpers (restore, signInAs, openOrdersTable, etc.)
- `e2e/support/cypress_sample_database.ts` — table/field schema constants (ORDERS, PRODUCTS, etc.)
- `e2e/support/cypress_sample_instance_data.ts` — instance-specific IDs (ORDERS_DASHBOARD_ID, NORMAL_USER_ID, etc.)
2. Glob `e2e/test/scenarios/` to find the closest existing spec to the area under test.
Study its patterns — match them exactly.
3. Glob `frontend/src/metabase/` to find React components for the feature area.
## Phase 1 — Code Analysis
Read React component source to understand DOM structure. No browser needed — source code has everything.
1. **Find relevant components**: Glob and grep `frontend/src/metabase/` for the feature area.
2. **Extract selectors**: Grep for `data-testid` in relevant components.
3. **Note visible text**: Read component JSX for button labels, headings, placeholders.
4. **Note aria attributes**: Grep for `aria-label` in relevant components.
5. **Understand user flows**: Read event handlers (onClick, onSubmit, onChange) to understand interactions.
6. **Find API calls**: Grep for `Api.use`, `fetch`, `useQuery`, endpoint definitions to identify API calls to intercept.
7. **Cross-reference with existing specs**: Find specs in the same area and reuse their proven selectors and `cy.intercept` patterns.
## Phase 2 — Start Backend
Use `MB_EDITION=oss` by default. Only use `MB_EDITION=ee` when the user explicitly asks to write an enterprise test.
Start the backend using `run_in_background: true` (NOT `&`).
`bin/e2e-backend` automatically detects if a backend is already running and reuses it.
```bash
MB_EDITION=oss bin/e2e-backend
```
Do NOT manually generate snapshots by running unrelated test specs.
The `bun test-cypress` runner has `GENERATE_SNAPSHOTS: true` by default and automatically
generates snapshots before running any spec. When running tests in Phase 4 via the `/e2e-test` skill,
snapshots will be generated on the first run if they don't already exist.
Restore clean test data:
```bash
curl -sf -X POST http://localhost:4000/api/testing/restore/default
```
## Phase 3 — Generate Cypress Spec
### File location & naming
Place specs in `e2e/test/scenarios/<area>/` mirroring the URL structure.
Name: `<feature>.cy.spec.js` (NOT `.cy.spec.ts`).
### Metabase conventions (mandatory)
- **Helpers via `cy.H`**: All helpers are accessed via `const { H } = cy;` — NOT via direct imports from `e2e/support/helpers`.
```js
const { H } = cy;
describe("feature name", () => {
beforeEach(() => {
H.restore();
cy.signInAsAdmin();
});
});
```
- **Sample Database schema** (table/field definitions): Import from `cypress_sample_database`.
```js
import { ORDERS, ORDERS_ID, PRODUCTS } from "e2e/support/cypress_sample_database";
```
- **Instance data** (dashboard IDs, user IDs, etc.): Import from `cypress_sample_instance_data`.
```js
import { ORDERS_DASHBOARD_ID } from "e2e/support/cypress_sample_instance_data";
```
- **Selectors** (priority order):
1. `cy.findByText()` / `cy.findByLabelText()` / `cy.findByRole()` — from `@testing-library/cypress`
2. `cy.findByTestId()` — for `data-testid` attributes
3. `cy.get("[data-testid='...']")` — fallback
4. NEVER use positional selectors, CSS class names, or XPaths.
- **Navigation helpers**: Use existing helpers like `H.openOrdersTable()`, `H.openNativeEditor()`,
`H.visitDashboard(id)`, `H.visitQuestion(id)` instead of raw `cy.visit()` chains.
Grep `e2e/support/helpers/` to discover what's available for your area.
- **API setup over UI setup**: Use `cy.request()` or existing API helpers to set up state.
Only use the UI for the flow you're actually testing.
- **Assertions**: Assert on visible text, URL, aria state — not DOM structure.
- **Waits**: Never use `cy.wait(ms)`. Use `cy.intercept()` + `cy.wait("@alias")` for API calls,
or `cy.findByText().should("be.visible")` for DOM readiness.
- **Isolation**: Each `it()` block must be independently runnable.
Don't depend on state from a previous `it()`.
### Spec structure template
```js
const { H } = cy;
import { ORDERS_DASHBOARD_ID } from "e2e/support/cypress_sample_instance_data";
import { ORDERS, ORDERS_ID } from "e2e/support/cypress_sample_database";
describe("area > sub-area > feature (#issue-number)", () => {
beforeEach(() => {
H.restore();
cy.signInAsAdmin();
});
it("should do the primary happy-path thing", () => {
// test
});
it("should handle the edge case", () => {
// test
});
});
```
### Intercepts
When you identified API calls during code analysis, stub or wait on them:
```js
cy.intercept("POST", "/api/dataset").as("dataset");
// ... trigger action ...
cy.wait("@dataset");
```
## Phase 4 — Validate
After generating specs:
1. Check that all imported helpers exist (Grep `e2e/support/helpers/`).
2. **You MUST use the `/e2e-test` skill** to run tests — do NOT run `bun test-cypress` directly.
The `/e2e-test` skill handles edition selection, snapshot management, and correct env vars.
`/e2e-test GREP="should do the thing" --spec e2e/test/scenarios/<path>`
If you created multiple `it()` blocks, run each one individually to isolate failures.
## Phase 5 — Fix Failures (up to 2 attempts)
When a test fails, **try to fix it from Cypress output first**:
1. Read the failure screenshot (path printed under `(Screenshots)`).
2. Read the error message and code frame from the console output.
3. Fix the test and re-run (back to Phase 4, step 2).
If you cannot diagnose the issue after 2 attempts, proceed to Phase 6.
## Phase 6 — Playwright Fallback
Only reach this phase after 2 failed fix attempts from Phase 5. The backend is already running.
Restore clean test data:
```bash
curl -sf -X POST http://localhost:4000/api/testing/restore/default
```
**Bypass CSP** headers before navigating (Metabase serves strict CSP that blocks dev server scripts).
Use `browser_run_code` to set this up:
```js
async (page) => {
// Strip CSP headers so the page loads (mirrors Cypress chromeWebSecurity: false)
await page.context().route('**/*', async (route) => {
const response = await route.fetch();
const headers = { ...response.headers() };
delete headers['content-security-policy'];
delete headers['content-security-policy-report-only'];
await route.fulfill({ response, headers });
});
// Sign in via API
const response = await page.request.post('http://localhost:4000/api/session', {
data: { username: 'admin@metabase.test', password: '12341234' }
});
const session = await response.json();
await page.context().addCookies([{
name: 'metabase.DEVICE',
value: session.id,
domain: 'localhost',
path: '/'
}]);
await page.goto('http://localhost:4000');
await page.waitForLoadState('networkidle');
return 'signed in';
}
```
**Maintain an observation log incrementally.** After EVERY significant Playwright interaction,
IMMEDIATELY append what you observed to the scratch file BEFORE performing the next interaction:
```bash
cat >> /tmp/e2e-observations.md << 'OBSERVATION'
## [Page/Flow name]
- URL: /question/notebook#...
- Clicked: "Box plot" button → visible text "Box plot", role: radio
- Selectors: data-testid="viz-type-button", findByText("Box plot")
- API call: POST /api/dataset (triggered on viz change)
- Key state: after selecting viz type, summary sidebar shows metric picker
OBSERVATION
```
For each page/flow:
- Take an accessibility snapshot (`browser_snapshot`).
- Click through interactive elements, fill forms, trigger modals.
- **Append to the observation log immediately after each step**: URLs, visible text, aria labels, `data-testid` attrs, API calls.
- Screenshot key states.
After exploration:
1. Read back your observation log: `cat /tmp/e2e-observations.md`
2. Fix the test using observed selectors and behavior.
3. Re-run the test (back to Phase 4).
4. Clean up: `rm -f /tmp/e2e-observations.md`
## Phase 7 — Cleanup
After all tests pass (or after giving up on fixing failures), **always kill the backend on port 4000**:
```bash
lsof -ti:4000 | xargs kill 2>/dev/null || true
```
Do NOT use broad `pkill` patterns — there may be other Metabase instances on different ports.
The backend process started in Phase 2 will NOT be killed automatically when the Claude session ends.
Leaving it running wastes resources and can interfere with future sessions. Always clean up.
## What NOT to do
- Do NOT use Playwright as the first step — always analyze source code first.
- Do NOT kill the backend between phases — it stays running throughout.
- Do NOT invent selectors you didn't find in source code or observe in the browser.
- Do NOT hardcode database IDs — import from `cypress_sample_database` or `cypress_sample_instance_data`.
- Do NOT use `cy.wait(1000)` or any numeric wait.
- Do NOT create setup flows through the UI when an API helper exists.
- Do NOT put tests in `cypress/e2e/` — Metabase uses `e2e/test/scenarios/`.
- Do NOT import helpers directly from `e2e/support/helpers` — use `const { H } = cy;`.

View File

@@ -0,0 +1,78 @@
---
name: e2e-test
description: Run Cypress E2E tests, analyze failures including screenshots, and stress test for flakiness
disable-model-invocation: false
---
Run Cypress E2E test: $ARGUMENTS
## Edition selection
**Default: `MB_EDITION=oss`** — runs without enterprise tokens, simpler and faster.
Only use `MB_EDITION=ee` when the user explicitly asks to write or run an enterprise test.
**For `MB_EDITION=ee`:**
These tokens must be exported in the shell before starting Claude Code:
- `CYPRESS_MB_ALL_FEATURES_TOKEN` — all features (most EE tests need this)
- `CYPRESS_MB_PRO_SELF_HOSTED_TOKEN` — pro self-hosted (permissions, SSO, sandboxing)
- `CYPRESS_MB_STARTER_CLOUD_TOKEN` — starter plan (rarely needed)
- `CYPRESS_MB_PRO_CLOUD_TOKEN` — pro cloud (rarely needed)
**NEVER echo, print, or log token values. Only check if they are set:**
```bash
echo "ALL_FEATURES: ${CYPRESS_MB_ALL_FEATURES_TOKEN:+set}" && echo "PRO_SELF_HOSTED: ${CYPRESS_MB_PRO_SELF_HOSTED_TOKEN:+set}" && echo "STARTER: ${CYPRESS_MB_STARTER_CLOUD_TOKEN:+set}" && echo "PRO_CLOUD: ${CYPRESS_MB_PRO_CLOUD_TOKEN:+set}"
```
If tokens are missing, tell the user: "EE tokens are not set. Either export them and restart Claude Code, or add `MB_EDITION=oss` to run OSS-only tests."
## Running
First check if snapshots exist:
```bash
ls e2e/snapshots/default.sql 2>/dev/null && echo "snapshots exist" || echo "snapshots missing"
```
If snapshots exist, skip regeneration for speed:
```bash
MB_EDITION=oss CYPRESS_VIDEO=false CYPRESS_RETRIES=0 CYPRESS_GUI=false GENERATE_SNAPSHOTS=false bun test-cypress $ARGUMENTS
```
If snapshots are missing (first run), let the runner generate them:
```bash
MB_EDITION=oss CYPRESS_VIDEO=false CYPRESS_RETRIES=0 CYPRESS_GUI=false bun test-cypress $ARGUMENTS
```
When running enterprise tests, replace `MB_EDITION=oss` with `MB_EDITION=ee` in the commands above.
If `$ARGUMENTS` is empty, ask the user which spec to run.
If the user provides a test name or fuzzy name instead of a spec path, find the spec file:
```bash
find e2e/test/scenarios -name "*FUZZY_NAME*.cy.spec.*" -type f
```
Then run with `--spec "path/to/matched.cy.spec.js"`.
To filter by test name, use the `GREP` env var (not `--env grep=`, which breaks on commas):
```bash
GREP="test name here" MB_EDITION=oss bun test-cypress --spec path/to/spec.js
```
## Stress test (flaky detection)
When the user asks to verify a test is not flaky:
```bash
MB_EDITION=oss bin/e2e-stress-test $ARGUMENTS
```
Set `E2E_STRESS_RUNS=N` for more iterations (default: 5). Stops on first failure and prints screenshot paths. Read those screenshots to analyze the failure.
## Analyzing failures
When tests fail:
1. Read the **screenshot** for each failure — paths are printed in Cypress output under `(Screenshots)`, typically at `cypress/screenshots/<spec-name>/<test-name> (failed).png`
2. Read the error message and code frame from the console output
3. Identify the root cause: is it a test bug, a product bug, or a timing issue?
4. Suggest a fix with specific code changes

View File

@@ -0,0 +1,834 @@
---
name: emotion-migrate
description: Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports from components.
---
# Emotion → Mantine + CSS Modules Migration Skill
Migrate Emotion styled-components (`@emotion/styled`, `@emotion/react`) to Mantine layout components with style props and CSS modules. The goal is zero Emotion imports, zero inline styles, and maximum use of design system tokens.
## Priority Order (Strict)
1. **Mantine components + style props** — `Box`, `Flex`, `Stack`, `Group`, `Text`, `Title`, `Card`. This is the DEFAULT. Every CSS property must be checked against style props FIRST.
2. **CSS modules** (`.module.css`) — ONLY for properties that Mantine style props genuinely cannot express: pseudo-selectors (`:hover`, `:focus`, `::before`), `box-shadow`, `border` shorthand, `animation`/`@keyframes`, complex selectors, `cursor`, `pointer-events`, `overflow`, `text-overflow`, `white-space`, `transition`.
3. **Inline styles ONLY for dynamic values** — `style={{ }}` is allowed only for truly dynamic runtime values (e.g., computed widths, positions, data-driven colors). All static styles must use Mantine props or CSS modules.
### Mantine-First Decision Gate (CRITICAL)
For EACH styled component, go through every CSS property and ask: "Can this be a Mantine style prop?" If yes → style prop. If no → CSS module. Do NOT dump an entire component into a CSS module just because one property needs it — split them.
**Properties that ARE style props** (use these, not CSS modules):
- `display` → `display` prop
- `color` → `c` prop (`c="brand"`, `c="text-primary"`)
- `background-color` → `bg` prop (`bg="background-primary"`)
- `font-size` → `fz` prop (`fz="md"`)
- `font-weight` → `fw` prop (`fw="bold"`)
- `line-height` → `lh` prop (`lh="md"`)
- `text-align` → `ta` prop (`ta="center"`)
- `padding` (all variants) → `p`, `px`, `py`, `pt`, `pb`, `pl`, `pr`
- `margin` (all variants) → `m`, `mx`, `my`, `mt`, `mb`, `ml`, `mr`
- `width` → `w`, `min-width` → `miw`, `max-width` → `maw`
- `height` → `h`, `min-height` → `mih`, `max-height` → `mah`
- `flex` → `flex` prop (`flex="0 0 auto"`, `flex={1}`)
- `gap` → `gap` prop (on Flex/Stack/Group)
- `align-items` → `align` prop (on Flex/Stack/Group)
- `justify-content` → `justify` prop (on Flex/Stack/Group)
- `flex-direction` → `direction` prop (on Flex)
- `flex-wrap` → `wrap` prop (on Flex)
- `position` → `pos` prop
- `top/right/bottom/left` → `top`, `right`, `bottom`, `left` props
- `opacity` → `opacity` prop
**Properties that NEED CSS modules** (no style prop equivalent):
- `:hover`, `:focus`, `:active`, `::before`, `::after` (pseudo-selectors)
- `box-shadow`, `border` (shorthand with color), `outline`
- `cursor`, `pointer-events`
- `overflow`, `text-overflow`, `white-space`
- `animation`, `transition`, `transform`
- `@media` queries (UNLESS it's simple responsive spacing/sizing — then use responsive syntax: `p={{ base: "md", lg: "xl" }}`)
**Hybrid approach** — when a component needs BOTH, put style props on the Mantine component AND add a CSS module class for the rest:
```tsx
<Flex
className={S.root} /* for :hover, box-shadow, border */
align="center" /* style prop */
gap="sm" /* style prop */
p="md" /* style prop */
bg="background-primary" /* style prop */
>
```
## CSS Module Conventions (Strict)
### Class Naming: camelCase
All CSS module class names MUST use **camelCase**. This is the dominant convention across the codebase (~830 camelCase vs ~620 PascalCase classes), used consistently in Mantine UI components, and matches standard CSS module conventions.
```css
/* CORRECT */
.root {
}
.settingsSection {
}
.dragHandle {
}
.closeIcon {
}
/* WRONG — do not use PascalCase or kebab-case */
.ItemRoot {
}
.settings-section {
}
```
Modifier/state classes also use camelCase:
```css
.selected {
}
.disabled {
}
.interactive {
}
.draggable {
}
```
### No Cascading — Direct Class Assignment
Cascading selectors are **discouraged**. Instead of styling through parent-child relationships, assign a class directly to the element that needs styling.
```css
/* WRONG — cascading/descendant selectors */
.root > input {
}
.root .label {
}
.container > div > span {
}
/* CORRECT — direct class on the target element */
.input {
}
.label {
}
.title {
}
```
The only acceptable nesting patterns are:
- **Pseudo-selectors on the same element**: `.item { &:hover { } }`
- **Modifier composition**: `.item { &.selected { } }`
- **Hover-reveal patterns** where a parent hover affects a child: `.root:hover .showOnHover { opacity: 1; }` — but only when structurally necessary (the child has no way to know about the parent's hover state)
### Import Alias
Always import the CSS module as `S`:
```tsx
import S from "./ComponentName.module.css";
```
## Step-by-Step Migration Process
### Step 1: Read and Understand
Read the `.styled.tsx` file AND every component that imports from it. Understand:
- Which styled components are used and where
- Which props drive dynamic styles
- Which styles are static vs conditional
- Which styles can map directly to Mantine style props
### Step 2: Classify Each Styled Component
For each styled component, apply the Mantine-First Decision Gate above. Then determine the migration target:
| Emotion Pattern | Migration Target |
| ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `styled.div` with only layout/spacing/color | `Box`, `Flex`, `Stack`, or `Group` with style props. **NO CSS module needed.** |
| `styled.div` with flexbox column | `Stack` component with style props |
| `styled.div` with flexbox row | `Flex` or `Group` component with style props |
| `styled.span` / `styled.p` with color/weight/size | **`Text component="span"` with style props** (`c`, `fw`, `fz`). NO CSS module. |
| `styled.div` with hover/focus/pseudo-selectors | **Hybrid**: Mantine component with style props for expressible properties + CSS module class for pseudo-selectors only |
| `styled.div` with media queries (simple spacing/sizing) | **Responsive style props**: `p={{ base: "md", lg: "xl" }}`. NO CSS module. |
| `styled.div` with media queries (complex/non-spacing) | CSS module for the media query parts, style props for the rest |
| `styled.div` with animations/keyframes | CSS module for animation, style props for layout |
| `styled(SomeComponent)` with only color/spacing/flex | **Wrap in Mantine component** with style props: `<Box c="brand" flex="0 0 auto"><Icon /></Box>`, or pass style props if the component accepts them |
| `styled(SomeComponent)` with pseudo-selectors/complex styles | CSS module `className` on the component |
| Dynamic props `styled.div<{ isActive: boolean }>` | Mantine style props for simple toggles (`c={active ? "brand" : "text-primary"}`), `cx()` with CSS module classes for complex state combinations involving pseudo-selectors |
### Step 3: Create CSS Module (if needed)
Create `ComponentName.module.css` alongside the component file:
```css
/* Use design system tokens — NEVER raw color/spacing values */
.root {
border: 1px solid var(--mb-color-border);
border-radius: var(--mantine-radius-md);
background-color: var(--mb-color-background-primary);
}
/* Conditional states as separate classes, combined with cx() */
.active {
background-color: var(--mb-color-brand);
color: var(--mb-color-text-primary-inverse);
}
.disabled {
color: var(--mb-color-text-tertiary);
pointer-events: none;
}
/* Hover/focus/pseudo-selectors — nest with & */
.interactive {
cursor: pointer;
&:hover {
color: var(--mb-color-brand);
background-color: var(--mb-color-background-hover);
}
}
/* Hover-reveal: acceptable parent→child nesting */
.root:hover .showOnHover {
opacity: 1;
}
/* Responsive styles */
@media (--breakpoint-min-md) {
.root {
padding: var(--mantine-spacing-lg);
}
}
```
### Step 4: Update the Component TSX
```tsx
import cx from "classnames";
import CS from "metabase/css/core/index.css";
import { Box, Flex, Group, Stack, Text } from "metabase/ui";
import S from "./ComponentName.module.css";
// Dynamic props → cx() with conditional classes
<Flex
className={cx(S.root, {
[S.active]: isActive,
[S.disabled]: disabled,
})}
align="center"
gap="sm"
p="md"
w="100%"
>
```
### Step 5: Delete the `.styled.tsx` File
Remove the old styled file entirely. Remove all imports of it from other files.
### Step 6: Verify
- Confirm zero `@emotion/styled` or `@emotion/react` imports remain in the migrated files
- Confirm no static inline styles (dynamic runtime values are fine)
- Confirm all colors use tokens, not raw hex/rgb values
## Design System Token Reference
### Mantine Style Props (use directly on components)
**Spacing** (`p`, `px`, `py`, `pt`, `pb`, `pl`, `pr`, `m`, `mx`, `my`, `mt`, `mb`, `ml`, `mr`):
- `"xs"` = 4px, `"sm"` = 8px, `"md"` = 16px, `"lg"` = 24px, `"xl"` = 32px
- Custom: `rem(48)` for non-standard values (import `rem` from `metabase/ui`)
**Dimensions** (`w`, `h`, `maw`, `mah`, `miw`, `mih`):
- `"100%"`, `"100vh"`, `rem(400)`, etc.
**Colors** (`c`, `bg`):
- Text: `"text-primary"`, `"text-secondary"`, `"text-tertiary"`
- Background: `"background-primary"`, `"background-secondary"`, `"background-hover"`
- Brand: `"brand"`, `"error"`, `"success"`, `"warning"`
**Typography** (`fz`, `fw`, `lh`, `ta`, `ff`):
- Font size: `"xs"` = 11px, `"sm"` = 12px, `"md"` = 14px, `"lg"` = 17px, `"xl"` = 21px
- Font weight: `"bold"`, `"normal"`, or numeric `700`
- Line height: `"xs"` = 100%, `"sm"` = 115%, `"md"` = 122%, `"lg"` = 138%, `"xl"` = 150%
- Text align: `"center"`, `"left"`, `"right"`
**Flexbox** (`align`, `justify`, `gap`, `direction`, `wrap`, `flex`):
- `align="center"`, `justify="space-between"`, `gap="sm"`, `direction="column"`, `wrap="nowrap"`
- `flex={1}`, `flex="0 0 auto"`
**Other**: `pos` (position), `display`
**Responsive syntax**: `px={{ base: "md", md: "lg", lg: rem(48) }}`
### CSS Variable Tokens (use in `.module.css` files)
**Colors** — `var(--mb-color-<name>)`:
- `--mb-color-text-primary`, `--mb-color-text-secondary`, `--mb-color-text-tertiary`
- `--mb-color-background-primary`, `--mb-color-background-secondary`, `--mb-color-background-hover`
- `--mb-color-border`, `--mb-color-border-strong`, `--mb-color-border-subtle`
- `--mb-color-brand`, `--mb-color-brand-hover`
- `--mb-color-error`, `--mb-color-success`, `--mb-color-warning`
- `--mb-color-shadow`, `--mb-color-focus`
- `--mb-color-accent0` through `--mb-color-accent7`
**Mantine spacing** — `var(--mantine-spacing-<size>)`:
- `--mantine-spacing-xs` (4px), `--mantine-spacing-sm` (8px), `--mantine-spacing-md` (16px), `--mantine-spacing-lg` (24px), `--mantine-spacing-xl` (32px)
**Mantine radius** — `var(--mantine-radius-<size>)`:
- `--mantine-radius-xs` (4px), `--mantine-radius-sm` (6px), `--mantine-radius-md` (8px), `--mantine-radius-xl` (40px)
**Mantine font sizes** — `var(--mantine-font-size-<size>)`:
- `--mantine-font-size-xs` (11px), `--mantine-font-size-sm` (12px), `--mantine-font-size-md` (14px), `--mantine-font-size-lg` (17px), `--mantine-font-size-xl` (21px)
**Breakpoints** (in `.module.css` files):
- `@media (--breakpoint-min-sm)` (40em / 640px)
- `@media (--breakpoint-min-md)` (60em / 960px)
- `@media (--breakpoint-min-lg)` (80em / 1280px)
- `@media (--breakpoint-min-xl)` (120em / 1920px)
- Also available: `--breakpoint-max-*` variants
### Snap Hardcoded Literals to Nearest Design Token (CRITICAL)
When migrating, **never carry over hardcoded `rem`/`px` values** from the original Emotion code. Instead, snap them to the nearest design system token. The original values were often arbitrary — the migration is an opportunity to align with the design system.
**Spacing** — snap to the nearest Mantine spacing token:
| Hardcoded value | Nearest token | Style prop | CSS variable |
| --------------------------------- | ------------- | ------------ | ------------------------------ |
| `0.125rem` (2px) | `2px` | `2` (number) | `2px` (keep literal, no token) |
| `0.2rem` (3.2px), `0.25rem` (4px) | **xs** (4px) | `"xs"` | `var(--mantine-spacing-xs)` |
| `0.5rem` (8px) | **sm** (8px) | `"sm"` | `var(--mantine-spacing-sm)` |
| `0.75rem` (12px) | between sm/md | `rem(12)` | `0.75rem` (no exact token) |
| `1rem` (16px) | **md** (16px) | `"md"` | `var(--mantine-spacing-md)` |
| `1.5rem` (24px) | **lg** (24px) | `"lg"` | `var(--mantine-spacing-lg)` |
| `2rem` (32px) | **xl** (32px) | `"xl"` | `var(--mantine-spacing-xl)` |
**Border radius** — snap to the nearest Mantine radius token:
| Hardcoded value | Nearest token | CSS variable |
| ---------------- | ----------------------------- | -------------------------- |
| `0.25rem` (4px) | **xs** (4px) | `var(--mantine-radius-xs)` |
| `0.375rem` (6px) | **sm** (6px) | `var(--mantine-radius-sm)` |
| `0.5rem` (8px) | **md** (8px) | `var(--mantine-radius-md)` |
| `1rem`+ (16px+) | **xl** (40px) or keep literal | `var(--mantine-radius-xl)` |
**Font sizes** — snap to the nearest Mantine font size token:
| Hardcoded value | Nearest token | Style prop | CSS variable |
| -------------------------------- | ------------- | ---------- | ----------------------------- |
| `0.6875rem` (11px) | **xs** (11px) | `fz="xs"` | `var(--mantine-font-size-xs)` |
| `0.75rem` (12px) | **sm** (12px) | `fz="sm"` | `var(--mantine-font-size-sm)` |
| `0.875rem` (14px), `1rem` (16px) | **md** (14px) | `fz="md"` | `var(--mantine-font-size-md)` |
| `1.063rem` (17px) | **lg** (17px) | `fz="lg"` | `var(--mantine-font-size-lg)` |
| `1.3rem` (21px) | **xl** (21px) | `fz="xl"` | `var(--mantine-font-size-xl)` |
**Rules:**
- If the hardcoded value is within ~2px of a token, use the token
- If it falls exactly between two tokens, prefer the smaller one (tighter is safer)
- If no token is close (e.g., `48px` spacing), use `rem(48)` for style props or the literal value in CSS modules
- This applies everywhere: style props, CSS module values, Icon `size` props, etc.
## Common Migration Patterns
### Pattern 1: Static Layout Container → Mantine Component
**Before:**
```tsx
// Component.styled.tsx
export const Container = styled.div`
display: flex;
align-items: center;
gap: 0.5rem;
padding: 1rem;
width: 100%;
`;
```
**After:**
```tsx
<Flex align="center" gap="sm" p="md" w="100%">
```
### Pattern 2: Vertical Stack → Stack Component
**Before:**
```tsx
export const Wrapper = styled.div`
display: flex;
flex-direction: column;
gap: 1.5rem;
padding: 2rem;
`;
```
**After:**
```tsx
<Stack gap="lg" p="xl">
```
### Pattern 3: Dynamic Props → cx() with CSS Module Classes
**Before:**
```tsx
export const Item = styled.div<{ isSelected: boolean; disabled: boolean }>`
color: ${(props) =>
props.disabled ? color("text-tertiary") : color("text-primary")};
background-color: ${(props) =>
props.isSelected ? color("brand") : "transparent"};
cursor: ${(props) => (props.disabled ? "default" : "pointer")};
&:hover {
color: ${(props) => !props.disabled && color("brand")};
}
`;
```
**After (CSS module):**
```css
/* Item.module.css */
.itemRoot {
color: var(--mb-color-text-primary);
cursor: pointer;
&:hover {
color: var(--mb-color-brand);
}
}
.selected {
background-color: var(--mb-color-brand);
}
.disabled {
color: var(--mb-color-text-tertiary);
cursor: default;
&:hover {
color: var(--mb-color-text-tertiary);
}
}
```
**After (TSX):**
```tsx
<Box
className={cx(S.itemRoot, {
[S.selected]: isSelected,
[S.disabled]: disabled,
})}
>
```
### Pattern 4: Extending a Component → Style Props First, CSS Module Only If Needed
When a styled component wraps another component, first check if the styles can be expressed as style props on a Mantine wrapper or on the component itself. Only use a CSS module when properties genuinely need it.
**Before:**
```tsx
export const CardIcon = styled(Icon)`
display: block;
flex: 0 0 auto;
color: var(--mb-color-brand);
`;
export const CardTitle = styled(Ellipsified)`
color: var(--mb-color-text-primary);
font-size: 1rem;
font-weight: bold;
margin-left: 1rem;
`;
```
**After — style props on Mantine wrapper (preferred when ALL properties are expressible):**
```tsx
<Box display="block" flex="0 0 auto" c="brand">
<Icon {...icon} />
</Box>
<Box c="text-primary" fz="md" fw="bold" ml="md">
<Ellipsified>{title}</Ellipsified>
</Box>
```
**After — CSS module (use only when component has pseudo-selectors or non-expressible styles):**
```css
.icon {
color: var(--mb-color-brand);
width: 1.5rem;
height: 1.5rem;
cursor: pointer;
&:hover {
color: var(--mb-color-brand-hover);
}
}
```
```tsx
<Icon className={S.icon} name="warning" />
```
### Pattern 4b: `styled.span` / `styled.p` with Text Styles → `Text` Component
**Before:**
```tsx
export const Label = styled.span`
color: var(--mb-color-text-secondary);
font-weight: bold;
`;
export const Title = styled.span`
color: var(--mb-color-text-primary);
font-size: 1rem;
font-weight: bold;
margin-left: 0.5rem;
`;
```
**After — `Text` component with style props (NO CSS module needed):**
```tsx
<Text component="span" c="text-secondary" fw="bold">
{label}
</Text>
<Text component="span" c="text-primary" fz="md" fw="bold" ml="sm">
{title}
</Text>
```
`Text` renders as `<p>` by default. Use `component="span"` to render inline. All color, typography, and spacing props work directly — no CSS module needed for pure text styling.
### Pattern 5: Keyframes Animation → CSS Module
**Before:**
```tsx
const spin = keyframes`
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
`;
export const Spinner = styled.div`
animation: ${spin} 1s infinite linear;
`;
```
**After (CSS module):**
```css
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.spinner {
animation: spin 1s infinite linear;
}
```
**After (TSX):**
```tsx
<Box className={S.spinner} />
```
### Pattern 6: color() Function → CSS Variables
| Emotion (JS) | CSS Module | Mantine Style Prop |
| ----------------------- | ------------------------------------------------------------ | --------------------------- |
| `color("brand")` | `var(--mb-color-brand)` | `c="brand"` or `bg="brand"` |
| `color("text-primary")` | `var(--mb-color-text-primary)` | `c="text-primary"` |
| `color("border")` | `var(--mb-color-border)` | N/A (use CSS module) |
| `alpha("brand", 0.2)` | `color-mix(in srgb, var(--mb-color-brand), transparent 80%)` | N/A (use CSS module) |
### Pattern 7: Responsive Spacing/Sizing → Responsive Style Props (NOT CSS Media Queries)
When a styled component only changes spacing, sizing, or other style-prop-expressible values at breakpoints, use Mantine's responsive syntax instead of CSS module media queries.
**Before:**
```tsx
export const CaptionRoot = styled.div`
margin-bottom: 1.5rem;
${breakpointMinExtraLarge} {
margin-bottom: 2rem;
}
`;
```
**After — responsive style prop (NO CSS module needed):**
```tsx
<Flex mb={{ base: "lg", xl: "xl" }}>
```
Breakpoint keys: `base` (default), `xs` (40em), `sm` (48em), `md` (60em), `lg` (80em), `xl` (120em).
Only use CSS module `@media` queries when the responsive change involves non-style-prop properties (e.g., `box-shadow`, `border`, `cursor` changes at breakpoints).
### Pattern 8: Dynamic Computed Styles → Inline Styles
Inline styles are allowed **only** for truly dynamic values computed at runtime (e.g., widths, positions, colors from data). Everything else must use Mantine style props or CSS modules.
**Before:**
```tsx
export const Bar = styled.div<{ width: number }>`
width: ${(props) => props.width}%;
`;
```
**After:**
```tsx
<Box style={{ width: `${width}%` }} />
```
### Pattern 9: Core CSS Utility Classes (Discouraged)
**Do NOT introduce new `CS` utility class usage.** Core CSS utilities (`CS` from `metabase/css/core/index.css`) are legacy and discouraged for new code. Prefer Mantine style props or CSS modules instead.
If existing code already uses `CS` classes and you're not migrating that specific code, leave them alone. But when migrating Emotion → Mantine, replace with the proper alternative:
| Instead of `CS.*` | Use |
| ------------------- | ------------------------------------------------------- |
| `CS.overflowHidden` | CSS module: `overflow: hidden` |
| `CS.cursorPointer` | CSS module: `cursor: pointer` |
| `CS.flex1` | Style prop: `flex={1}` |
| `CS.flexNoShrink` | Style prop: `flex="0 0 auto"` |
| `CS.textBrandHover` | CSS module: `&:hover { color: var(--mb-color-brand); }` |
### Pattern 10: Shared Emotion Styles Across Files → Shared CSS Module + cx()
When Emotion exports a shared `css` block (like `animationStyles`) imported by many files, create ONE CSS module with the shared keyframe and a reusable class, then compose via `cx()`.
**Before (Emotion — shared animation used by 13+ skeleton files):**
```tsx
// ChartSkeleton.styled.tsx — defines shared animation
const fadingKeyframes = keyframes`
0% { opacity: 0.0625; }
50% { opacity: 0.125; }
100% { opacity: 0.0625; }
`;
export const animationStyles = css`
opacity: 0.1;
animation: ${fadingKeyframes} 1.5s infinite;
`;
// AreaSkeleton.styled.tsx — consumes it
import { animationStyles } from ".../ChartSkeleton.styled";
export const SkeletonImage = styled.svg`
${animationStyles};
flex: 1 1 0;
margin-top: 1rem;
border-bottom: 1px solid currentColor;
`;
// BarSkeleton.styled.tsx — also consumes it
import { animationStyles } from ".../ChartSkeleton.styled";
export const SkeletonImage = styled.svg`
${animationStyles};
flex: 1 1 0;
margin-top: 1rem;
`;
```
**After — shared CSS module:**
```css
/* ChartSkeleton.module.css */
@keyframes fading {
0% {
opacity: 0.0625;
}
50% {
opacity: 0.125;
}
100% {
opacity: 0.0625;
}
}
.animated {
opacity: 0.1;
animation: fading 1.5s infinite;
}
```
**After — per-component CSS modules with own styles only:**
```css
/* AreaSkeleton.module.css */
.skeletonImage {
flex: 1 1 0;
margin-top: 1rem;
border-bottom: 1px solid currentColor;
}
```
```css
/* BarSkeleton.module.css */
.skeletonImage {
flex: 1 1 0;
margin-top: 1rem;
}
```
**After — component TSX uses cx() to compose:**
```tsx
// AreaSkeleton.tsx
import cx from "classnames";
import ChartSkeletonS from "../ChartSkeleton/ChartSkeleton.module.css";
import S from "./AreaSkeleton.module.css";
const AreaSkeleton = (): JSX.Element => {
return (
<svg
className={cx(ChartSkeletonS.animated, S.skeletonImage)}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 371 113"
preserveAspectRatio="none"
>
<path d="..." fill="currentColor" />
</svg>
);
};
```
The shared module owns the `@keyframes` and the `.animated` class. Each consumer composes it with its own module class via `cx()`. No duplication of the keyframe definition.
## Import Template
```tsx
import cx from "classnames"; // only if needed for conditional classes
import { Box, Flex, Group, Stack, Text, rem } from "metabase/ui";
import S from "./ComponentName.module.css"; // only if CSS module is needed
```
## Checklist Before Finishing
- [ ] **MANTINE-FIRST CHECK**: Every CSS property that has a style prop equivalent (`c`, `bg`, `p`, `m`, `fw`, `fz`, `flex`, `gap`, `align`, `w`, `h`, etc.) is expressed as a style prop, NOT in a CSS module
- [ ] `styled.span`/`styled.p` with only color/weight/size are replaced with `Text component="span"` + style props, NOT CSS module classes
- [ ] `styled.div` with only layout props are replaced with `Flex`/`Stack`/`Group`/`Box` + style props, NOT CSS module classes
- [ ] Responsive spacing/sizing uses responsive style props (`mb={{ base: "lg", xl: "xl" }}`), NOT CSS module `@media` queries
- [ ] CSS modules are used ONLY for: pseudo-selectors, box-shadow, border, cursor, overflow, animation, transition, transform, or complex selectors
- [ ] All `@emotion/styled` and `@emotion/react` imports removed from migrated files
- [ ] The `.styled.tsx` file is deleted
- [ ] All imports of the deleted styled file are updated
- [ ] No static inline styles — `style={{ }}` used only for truly dynamic runtime values
- [ ] All colors use design tokens (`c="brand"`, `var(--mb-color-brand)`), not raw hex/rgb
- [ ] All spacing uses design tokens (`p="md"`, `var(--mantine-spacing-md)`), not arbitrary px values — hardcoded `rem`/`px` literals snapped to the nearest token (see mapping table above)
- [ ] All border-radius values use radius tokens (`var(--mantine-radius-md)`), not hardcoded `0.5rem`
- [ ] All font sizes use font-size tokens (`fz="md"`, `var(--mantine-font-size-md)`), not hardcoded `1rem`
- [ ] Layout uses Mantine components (`Flex`, `Stack`, `Group`, `Box`, `Text`) not raw divs/spans with CSS
- [ ] All CSS module class names use camelCase
- [ ] No cascading/descendant selectors targeting raw elements — use direct class assignment instead
- [ ] Component renders identically to the original (visually verify if possible)
## Visual Verification with Screenshots (Optional — Only When Explicitly Asked)
When the user explicitly asks to create before/after screenshots, use the Playwright MCP tools to capture them. This is NOT done by default — only when requested.
Screenshots must be taken in **both light and dark mode** to verify token usage is correct in both themes.
### Switching Color Scheme via API
Toggle between light and dark mode using the Metabase settings API. Use Playwright's `browser_evaluate` or `browser_navigate` with fetch:
```js
// Switch to dark mode
await fetch("/api/setting/color-scheme", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ value: "dark" }),
});
// Switch to light mode
await fetch("/api/setting/color-scheme", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ value: "light" }),
});
```
After switching, reload the page for the theme to take effect.
### Process
For each state (**after** = migrated code, **before** = stashed original), capture screenshots in both themes at both viewport widths. This produces **8 screenshots total**.
1. **Take "after" screenshots first** (migrated code is already in place):
- Navigate to the page that renders the migrated components (`browser_navigate`)
- Wait for content to load (`browser_wait_for` with key text, or `textGone: "Loading..."`)
- Close the sidebar if it overlaps content on narrow viewports (`browser_click` the toggle button)
- **Light mode** (set `color-scheme` to `"light"` via API, reload):
- Desktop (1280x900): `after-light-desktop.png`
- Narrow (640x900), close sidebar: `after-light-narrow.png`
- **Dark mode** (set `color-scheme` to `"dark"` via API, reload):
- Desktop (1280x900): `after-dark-desktop.png`
- Narrow (640x900), close sidebar: `after-dark-narrow.png`
2. **Stash changes to capture "before" screenshots**:
- Run `git stash --include-untracked` to temporarily revert to the Emotion version
- Repeat the same 4 screenshots with `before-` prefix:
- `before-light-desktop.png`, `before-light-narrow.png`
- `before-dark-desktop.png`, `before-dark-narrow.png`
- Run `git stash pop` to restore the migrated code
3. **Restore the user's original color scheme** (set back to `"auto"` or whatever it was before).
4. **Display all 8 screenshots** using the `Read` tool so the user can visually compare before/after in both themes at both viewport sizes.
### Key Details
- Save screenshots in the repo root (they will be untracked — user can delete after review)
- The dev server must be running (typically `http://localhost:3000`)
- Use `browser_snapshot` to find element refs when you need to click buttons (e.g., sidebar toggle)
- The greeting text on the home page changes randomly on each load — this is expected, not a regression
- If the page being tested is not the home page, navigate to the correct URL that exercises the migrated components
- Dark mode screenshots are critical for verifying that CSS variable tokens (`var(--mb-color-*)`) are used correctly — hardcoded colors will look wrong in dark mode

View File

@@ -5,227 +5,110 @@ description: Run mutation testing on a Clojure namespace, generate tests to kill
# Mutation Testing Skill
This skill runs mutation testing on a target namespace, writes tests to kill surviving mutations, and creates draft PRs with Linear issues for each function.
This skill runs mutation testing end-to-end: generates a coverage report, groups functions, shells out to `claude -p` to write tests, verifies mutations are killed, and creates draft PRs with Linear issues.
## Prerequisites
- A running nREPL connected to the Metabase dev environment
- `LINEAR_API_KEY` environment variable set with a valid Linear personal API key
- `gh` CLI authenticated with GitHub
- `claude` CLI available on PATH
## Reference Files
- `dev/src/dev/coverage.clj` — mutation testing tool (generates reports, runs mutations)
- `dev/src/dev/mutation_testing.clj` — Linear API client and PR template helpers
- `mutation-testing-report.lib.card.md` — example report from the pilot
- `dev/src/dev/coverage.clj` — mutation testing engine (generates reports, runs mutations)
- `dev/src/dev/mutation_testing.clj` — orchestration, Linear API, PR helpers
## Invocation
The argument is a Clojure namespace, e.g.:
The argument is a Clojure namespace, optionally followed by a base branch:
```
/mutation-testing metabase.lib.order-by
/mutation-testing metabase.lib.order-by --base-branch release-x.52.x
/mutation-testing metabase.lib.order-by --project-id abc-123
/mutation-testing metabase.lib.order-by --base-branch release-x.52.x --project-id abc-123
```
## Workflow
- `--base-branch`: defaults to the value in config (set via `set-config!`), or `"master"` if not configured.
- `--project-id`: if provided, issues are added to this existing Linear project instead of creating a new one.
### Step 1: Parse the namespace
## Steps
From the argument (e.g., `metabase.lib.order-by`), derive:
- **Test namespace**: append `-test` (e.g., `metabase.lib.order-by-test`)
- **Short name**: the last segment (e.g., `order-by`)
- **Source path**: `src/metabase/lib/order_by.cljc` (replace `-` with `_` in path segments)
- **Test path**: `test/metabase/lib/order_by_test.cljc`
### 1. Parse arguments
### Step 2: Set up Linear and load tools
Parse `$ARGUMENTS` to extract:
- **namespace** (required) — the first positional argument
- **`--base-branch`** (optional) — if present, the next argument is the base branch name
- **`--project-id`** (optional) — if present, the next argument is an existing Linear project ID
### 2. Load and configure
```clojure
(require '[dev.coverage :as cov] :reload)
(require '[dev.mutation-testing :as mut-test] :reload)
(require '[dev.coverage :as cov] :reload)
```
If this is the first invocation (or the REPL was restarted), set up the Linear team:
```clojure
;; Find the team
(mut-test/list-teams!)
;; Set team ID from the output
(mut-test/set-config! {:team-id "<team-id>"})
(mut-test/set-config! {:team-id "<id>"})
```
If config is already set from a previous invocation, skip this.
### Step 3: Generate baseline report and create Linear project
### 3. Run
```clojure
(cov/generate-report
'<target-ns>
['<test-ns>]
"mutation-testing-report.lib.<short-name>.before.md")
(mut-test/run! '<target-ns>)
;; Or with options:
(mut-test/run! '<target-ns> {:base-branch "release-x.52.x"})
(mut-test/run! '<target-ns> {:project-id "abc-123"})
(mut-test/run! '<target-ns> {:base-branch "release-x.52.x" :project-id "abc-123"})
```
Read the generated report file. It has three sections:
- **Uncovered Functions** — never called by any test
- **Partially Covered Functions** — called but with surviving mutations
- **Fully Covered Functions** — all mutations killed
Pass the opts map with `:base-branch` and/or `:project-id` if those flags were provided in the arguments.
Then create a Linear project for this namespace (uses report stats in the description):
This will:
1. Generate a baseline mutation testing report
2. Create a Linear project for the namespace
3. Group functions by coverage relationships
4. For each group: create branch → invoke Claude to write tests → verify → retry if needed → commit & push → create Linear issue → create draft PR
5. Print a summary with PR links
### 4. Handle failures
If a group fails mid-processing, `run!` catches the error and continues to the next group. To retry a single group manually:
```clojure
(mut-test/create-project-for-namespace!
"<target-ns>"
"mutation-testing-report.lib.<short-name>.before.md")
;; => {:project-id "...", :name "Mutation Testing: metabase.lib.order-by"}
;; Automatically sets :project-id in config for subsequent create-issue! calls
;; Get the parsed namespace info
(def parsed (mut-test/parse-namespace '<target-ns>))
;; Run coverage to get the data
(def coverage-results (cov/test-namespace (:target-ns parsed) [(:test-ns parsed)]))
;; Group and find the one you want
(def groups (mut-test/group-functions coverage-results))
;; Process just that group
(mut-test/process-group! parsed (nth groups <index>))
```
### Step 4: Plan the work
### 5. Verify the prompt (dry run)
Before creating branches, analyze the report to plan how to group the work:
1. **Identify killable functions.** For each function with surviving mutations, assess whether any mutations are killable. Run `cov/test-mutations` to see the full mutation list. If ALL mutations for a function are unkillable (schema-only, semantically equivalent, etc.), skip that function — no branch or PR needed.
2. **Group private functions by public entry point.** Private functions cannot be tested directly. Group them with the public function that exercises them. Create one branch/PR per group, not per private function.
3. **Track mutations per group.** The `:mutations-before` and `:not-killed` fields in the PR should only reflect mutations for functions covered by that specific PR — never mutations from other functions.
### Step 5: Process each group
For each group of functions that has killable mutations:
#### 5a. Create a branch
To inspect what Claude will see without invoking it:
```clojure
(mut-test/create-branch! "<target-ns>" "<primary-fn-name>")
;; => "mutation-testing-lib-order-by-orderable-columns"
(def parsed (mut-test/parse-namespace '<target-ns>))
(def coverage-results (cov/test-namespace (:target-ns parsed) [(:test-ns parsed)]))
(def groups (mut-test/group-functions coverage-results))
(println (mut-test/build-test-prompt
(merge (select-keys parsed [:target-ns :test-ns :source-path :test-path])
(select-keys (first groups) [:fn-names :mutations]))))
```
Use the primary public function name for the branch. If the group covers private functions too, name the branch after the public entry point.
#### 5b. Read context
- Read the source function(s) from the source file
- Read the full test file to understand existing test patterns, helpers, and metadata providers used
- If the function is private, identify which public function(s) call it
#### 5c. Write tests
Generate the **simplest tests** that kill the surviving mutations while still making semantic sense. Guidelines:
- **Never call private functions directly.** Always test through public API functions. Use the coverage data to identify which public functions exercise the private function.
- **Keep tests simple.** Each test should verify one meaningful behavior. Don't over-engineer tests just to chase mutation kills.
- **Follow existing patterns.** Match the style of the existing tests: same metadata providers, same helper functions, same assertion patterns.
- **Insert tests near related existing tests** for the same function, not at the end of the file. This minimizes merge conflicts between branches. If there are no existing tests for the function, find the most logical location based on the order of functions in the source file.
**IMPORTANT: Use `file_edit` (not `clojure_edit`) when editing test files.** The `clojure_edit` tool reformats the entire file, introducing unnecessary whitespace changes that pollute the diff. Use `file_edit` with exact string matching to make surgical insertions that only touch the lines you intend to change.
#### 5d. Verify mutations are killed
Use the REPL to check that the new tests kill the targeted mutations:
```clojure
;; Reload the test namespace to pick up new tests
(require '<test-ns> :reload)
;; Test mutations for the specific function
(cov/test-mutations
'<target-ns>/<fn-name>
;; Set of test names that cover this function
#{'<test-ns>/<test-name-1> '<test-ns>/<test-name-2>})
```
Check the `:survived` key in the result. If mutations still survive:
- Try writing additional tests
- If a mutation is truly unkillable (semantically equivalent), note it for the PR description
- If a mutation reveals dead/unreachable code, consider suggesting removal as a code improvement
#### 5e. Handle unkillable mutations and improvements
**Do NOT edit the source namespace just for documentation.** Instead:
- **Unkillable mutations**: Note them in the PR description with rationale
- **Code improvements** (dead code removal, expression simplification) that directly relate to surviving mutants:
1. Make the change in the source file
2. Verify all tests still pass with the change
3. Note the file path, line range, and the improved code
4. **Reset the change**: `git checkout -- <source-file>` — do NOT commit it
5. After creating the PR, use `add-suggested-change!` to post the improvement as a GitHub suggested change (Step 5h)
6. The reviewer decides whether to accept it
#### 5f. Commit and push
```clojure
;; Only commit the test file — never commit source changes for improvements
(mut-test/commit-and-push! "<target-ns>" "<primary-fn-name>"
["test/metabase/lib/<short_name>_test.cljc"])
```
#### 5g. Create Linear issue and draft PR
```clojure
;; Create a Linear issue (use the primary function name)
(def issue (mut-test/create-issue-for-function! "<target-ns>" "<primary-fn-name>"))
;; => {:identifier "QUE-1234", :url "https://linear.app/...", ...}
;; Create draft PR linked to the Linear issue
;; :fn-names lists ALL functions covered by this PR
;; :mutations-before counts only mutations for functions in this PR
;; :not-killed lists only unkillable mutations for functions in this PR
(def pr-url
(mut-test/create-draft-pr!
{:target-ns "<target-ns>"
:fn-name "<primary-fn-name>"
:linear-identifier (:identifier issue)
:mutations-before 9 ;; surviving mutations for these functions only
:tests-added 2 ;; number of new test functions
:killed ["Replace :segment-id with :segment-id__"
"Replace cycle-path with nil"]
:not-killed [{:description "Replace acc with nil"
:rationale "reduce always has single iteration"}]
:suggested-changes []}))
;; => "https://github.com/metabase/metabase/pull/12345"
```
#### 5h. Add code improvement suggestions (if any)
If you identified code improvements in step 5e (and reset them), post each as a GitHub suggested change:
```clojure
(mut-test/add-suggested-change!
{:pr-url pr-url
:path "src/metabase/lib/<short_name>.cljc"
:start-line 42 ;; first line of the code to replace
:end-line 45 ;; last line of the code to replace
:suggestion "(improved-code-here)" ;; the replacement code
:comment "**Suggested improvement:** <description of the change and why it's related to the surviving mutant>"})
```
### Step 6: Return to master and repeat
```clojure
(mut-test/return-to-master!)
```
Repeat Step 5 for the next group.
### Step 7: Summary
Print a summary of what was done:
- Link to the Linear project for this namespace
- Number of functions processed
- Number of functions skipped (all mutations unkillable)
- Number of draft PRs created
- Number of mutations killed vs. unkillable
- List of test PRs with links
- List of mutation rule PRs with links (if any were created)
## Suggesting New Mutation Rules
If you notice patterns in surviving mutations that suggest the mutation testing tool should have additional rules (e.g., a common Clojure form that isn't being mutated), open a separate PR proposing additions to `dev.coverage/mutation-rules` with an explanation.
## Configuration
The `dev.mutation-testing` namespace reads `LINEAR_API_KEY` from the environment and stores team/project IDs in an atom.
- **Team ID**: Set once per REPL session via `(mut-test/list-teams!)` and `(mut-test/set-config! {:team-id "..."})` (Step 2)
- **Project ID**: Set automatically when `create-project-for-namespace!` is called (Step 3) — one project per namespace
- **Team ID**: Set once per REPL session via `(mut-test/list-teams!)` and `(mut-test/set-config! {:team-id "..."})`
- **Project ID**: Set automatically when `run!` calls `create-project-for-namespace!`
- **Base Branch**: Defaults to `"master"`. Override via `(mut-test/set-config! {:base-branch "release-x.52.x"})` or pass `{:base-branch "..."}` as the second arg to `run!`
- **Project ID**: If set (via `set-config!` or `run!` opts), `run!` reuses the existing Linear project instead of creating a new one

View File

@@ -176,8 +176,10 @@
clojure.core.async/to-chan!
clojure.core.async/to-chan!!
metabase.channel.core/send!
metabase.warehouses.models.database/assert-not-h2!
metabase.driver.sql-jdbc.execute/execute-prepared-statement!
metabase.notification.models/create-notification!
metabase.oauth-server.core/reset-provider!
metabase.pulse.send/send-pulse!
metabase-enterprise.transforms-python.python-runner-test/execute!
;; Workspace isolation functions are safe in parallel tests because they operate on
@@ -422,6 +424,8 @@
ring.util.codec codec
ring.util.response response
saml20-clj.core saml
metabase.transforms-base.util transforms-base.u
metabase.transforms.util transforms.u
toucan2.core t2}}}
:lint-as
@@ -550,6 +554,7 @@
metabase-enterprise.cache.config-test/with-temp-persist-models hooks.common/with-seven-bindings
metabase-enterprise.dependencies.api-test/with-dependents-test! hooks.common/with-two-bindings
metabase-enterprise.metabot-v3.tools.dependencies-test/with-dependent-transforms! hooks.common/with-two-bindings
metabase-enterprise.metabot.tools.dependencies-test/with-dependent-transforms! hooks.common/with-two-bindings
metabase-enterprise.semantic-search.db.connection/with-migrate-tx hooks.common/let-one-with-optional-value
metabase-enterprise.serialization.api-test/with-serialization-test-data! hooks.common/with-three-bindings
metabase-enterprise.serialization.test-util/with-temp-dpc hooks.toucan2.tools.with-temp/with-temp
@@ -591,6 +596,9 @@
metabase.model-persistence.api-test/with-persistence-setup! hooks.common/with-one-top-level-binding
metabase.model-persistence.api-test/with-setup! hooks.common/with-one-top-level-binding
metabase.model-persistence.test-util/with-persistence-enabled! hooks.metabase.model-persistence.test-util/with-persistence-enabled!
metabase.mq.core/with-queue hooks.common/let-second
metabase.mq.core/with-topic hooks.common/let-second
metabase.mq.core/def-listener! hooks.metabase.mq.impl/def-listener
metabase.models.interface/define-batched-hydration-method hooks.metabase.models.interface/define-hydration-method
metabase.models.interface/define-simple-hydration-method hooks.metabase.models.interface/define-hydration-method
metabase.permissions.core/allow-changing-all-users-group-members hooks.common/do*
@@ -791,7 +799,7 @@
:private-call {:level :off}
:metabase/defsetting-must-specify-export {:level :off}
:metabase/defsetting-namespace {:level :off}
:metabase/test-helpers-use-non-thread-safe-functions {:level :warning} ; more config in `.clj-kondo/config/test-helpers/config.edn
:metabase/test-helpers-use-non-thread-safe-functions {:level :warning} ; more config in `.clj-kondo/config/test-helpers/config.edn`
:discouraged-var
{metabase.driver/database-supports? {:level :off}

File diff suppressed because it is too large Load Diff

View File

@@ -110,6 +110,7 @@
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/log-deprecated-env-var-usage!
metabase.settings.models.setting/set!
metabase.settings.models.setting/validate-settings-formatting!
metabase.setup.core/create-token!

View File

@@ -0,0 +1,24 @@
(ns hooks.metabase.mq.impl
(:require
[clj-kondo.hooks-api :as hooks]))
(defn def-listener
"Kondo hook for `mq/def-listener`. Rewrites to a `fn` form so kondo can analyze bindings.
Forms:
(mq/def-listener! :topic/foo [msg] body...)
(mq/def-listener! :queue/bar {:config map} [msgs] body...)"
[{:keys [node]}]
(let [[_ _channel-name & args] (:children node)
;; skip optional config map
args (if (hooks/map-node? (first args))
(rest args)
args)
[bindings & body] args
;; rewrite as: (fn [bindings...] body...)
new-node (hooks/list-node
(list*
(hooks/token-node 'fn)
bindings
body))]
{:node new-node}))

View File

@@ -55,7 +55,6 @@
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

View File

@@ -303,7 +303,6 @@
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/for-map [[:block 1]]

8
.gitattributes vendored
View File

@@ -1,7 +1,9 @@
# Custom merge driver for YAML migration files
# Treats each changeset as an atomic unit to avoid conflicts within changesets
# Custom merge driver for per-release YAML migration files.
# Treats each changeset as an atomic unit to avoid conflicts within changesets.
# Only applies to per-release *_update_migrations.yaml files — directory-based
# migrations (e.g. 060/*.yaml) have one file per migration and don't need this.
# Execute this in your shell to enable custom merge driver:
# echo '\n[include]\npath=../.gitconfig' >> .git/config
#
# TODO (Bryan 12/12/25) -- reenable this when we can completely verify correctness
# resources/migrations/*.yaml merge=yaml-migrations
# resources/migrations/*_update_migrations.yaml merge=yaml-migrations

View File

@@ -1,5 +1,5 @@
# execute this in your shell to enable custom merge driver:
# echo '\n[include]\npath=../.gitconfig' >> .git/config
[merge "yaml-migrations"]
name = YAML migration changeset-aware merge
name = Per-release YAML migration changeset-aware merge
driver = bin/mage -merge-yaml-migrations %O %A %B %L %P

268
.github/CODEOWNERS vendored
View File

@@ -1,266 +1,30 @@
# 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
# @metabase/core-backend-querying-platform
src/metabase/lib @metabase/core-backend-querying-platform
src/metabase/lib_be @metabase/core-backend-querying-platform
src/metabase/query_processor @metabase/core-backend-querying-platform
# @metabase/graphy
src/metabase/graph @metabase/graphy
enterprise/backend/src/metabase_enterprise/dependencies @metabase/graphy
enterprise/frontend/src/metabase-enterprise/dependencies @metabase/graphy
# @metabase/embedding
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
# @metabase/tech-writers
docs @metabase/tech-writers
docs/developers-guide # exclude from tech-writer ownership
#
# Backend modules <=> teams that own them
#
# @metabase/devexp
.github @metabase/devexp
# 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
# @metabase/cloud-ops
src/metabase/analytics/prometheus.clj @metabase/cloud-ops

View File

@@ -51,12 +51,25 @@ runs:
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',
});
let download;
const maxAttempts = 3;
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
try {
download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact_id,
archive_format: 'zip',
});
break;
} catch (err) {
console.log(`Attempt ${attempt}/${maxAttempts} failed: ${err.message}`);
if (attempt === maxAttempts) throw err;
const delay = attempt * 15000; // 15s, 30s
console.log(`Retrying in ${delay / 1000}s...`);
await new Promise(r => setTimeout(r, delay));
}
}
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/mb.zip`, Buffer.from(download.data));

View File

@@ -7,9 +7,15 @@ outputs:
m2-cache-key:
description: "The cache key for the Maven cache."
value: ${{ steps.keys-factory.outputs.m2-cache-key }}
m2-restore-key:
description: "The fallback restore key prefix for the Maven cache."
value: ${{ steps.keys-factory.outputs.m2-restore-key }}
node-cache-key:
description: "The cache key for the Node.js cache."
value: ${{ steps.keys-factory.outputs.node-cache-key }}
node-restore-key:
description: "The fallback restore key prefix for the Node.js cache."
value: ${{ steps.keys-factory.outputs.node-restore-key }}
eslint-cache-key:
description: "The cache key for Eslint cache"
value: ${{ steps.keys-factory.outputs.eslint-cache-key }}
@@ -31,7 +37,9 @@ runs:
CACHE_SUFFIX="${{ runner.os }}-$WEEK_OF_YEAR"
echo "m2-cache-key=$M2_CACHE_PREFIX-$CACHE_SUFFIX" >> $GITHUB_OUTPUT
echo "m2-restore-key=$M2_CACHE_PREFIX-" >> $GITHUB_OUTPUT
echo "node-cache-key=$NODE_CACHE_PREFIX-$CACHE_SUFFIX" >> $GITHUB_OUTPUT
echo "node-restore-key=$NODE_CACHE_PREFIX-" >> $GITHUB_OUTPUT
echo "eslint-cache-key=$ESLINT_CACHE_PREFIX-$CACHE_SUFFIX" >> $GITHUB_OUTPUT
echo "cypress-cache-key=$CYPRESS_CACHE_PREFIX-$CACHE_SUFFIX" >> $GITHUB_OUTPUT
shell: bash

View File

@@ -19,10 +19,18 @@ 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
for attempt in 1 2 3; do
curl --retry 3 --retry-delay 5 --fail -O https://download.clojure.org/install/linux-install-${{ inputs.clojure-version }}.sh \
&& sudo bash ./linux-install-${{ inputs.clojure-version }}.sh \
&& break
echo "::warning::Clojure install attempt $attempt failed, retrying in 10s..."
sleep 10
done
if ! clojure --version; then
echo "::error::Clojure CLI installation failed after 3 attempts"
exit 1
fi
- name: Get M2 cache key
uses: ./.github/actions/get-cache-keys
@@ -42,3 +50,5 @@ runs:
~/.m2
~/.gitlibs
key: ${{ steps.get-cache-keys.outputs.m2-cache-key }}
restore-keys: |
${{ steps.get-cache-keys.outputs.m2-restore-key }}

View File

@@ -11,17 +11,10 @@ inputs:
runs:
using: "composite"
steps:
- name: Prepare Node.js
uses: actions/setup-node@v4
- name: Prepare Node + Bun environment
uses: ./.github/actions/prepare-node-bun
with:
node-version: ${{ inputs.node-version }} # this overrides, if present
node-version-file: ".nvmrc"
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.7"
token: ${{ github.token }}
node-version: ${{ inputs.node-version }}
- name: Get cache keys
uses: ./.github/actions/get-cache-keys
@@ -34,6 +27,8 @@ runs:
~/.m2
~/.gitlibs
key: ${{ steps.get-cache-keys.outputs.m2-cache-key }}
restore-keys: |
${{ steps.get-cache-keys.outputs.m2-restore-key }}
- name: Get bun cache directory
id: bun-cache
@@ -51,6 +46,8 @@ runs:
${{ steps.bun-cache.outputs.dir }}
node_modules
key: ${{ steps.get-cache-keys.outputs.node-cache-key }}
restore-keys: |
${{ steps.get-cache-keys.outputs.node-restore-key }}
# postinstall lifecycle hook can be dangerous in CI so we only run it locally (see package.json)
# If a job wants to patch packages, it does so explicitly in the CI. This setting is opt-out.

View File

@@ -0,0 +1,20 @@
name: Prepare Node + Bun environment
description: "Set up Node.js and Bun for CI jobs"
inputs:
node-version:
description: "The version of Node.js to use, overriding .nvmrc"
required: false
runs:
using: "composite"
steps:
- name: Prepare Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
node-version-file: ".nvmrc"
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.7"
token: ${{ github.token }}

View File

@@ -35,9 +35,22 @@ runs:
with:
name: metabase-${{ inputs.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
path: temp/current-uberjar
- name: Extract embedding-sdk.js from current uberjar
- name: Extract embedding-sdk bundles from current uberjar
shell: bash
run: unzip -j temp/current-uberjar/target/uberjar/metabase.jar frontend_client/app/embedding-sdk.js -d temp/current-bundle
run: |
# Try new layout first (app/embedding-sdk/legacy/), fall back to old layout (app/embedding-sdk.js)
unzip -j temp/current-uberjar/target/uberjar/metabase.jar \
"frontend_client/app/embedding-sdk/legacy/embedding-sdk.js" \
-d temp/current-bundle 2>/dev/null || \
unzip -j temp/current-uberjar/target/uberjar/metabase.jar \
"frontend_client/app/embedding-sdk.js" \
-d temp/current-bundle
# Extract chunks directory if it exists (new layout only)
mkdir -p temp/current-chunks
unzip -j temp/current-uberjar/target/uberjar/metabase.jar \
"frontend_client/app/embedding-sdk/chunks/*" \
-d temp/current-chunks 2>/dev/null || true
- name: Checkout base ref
uses: actions/checkout@v4
with:
@@ -53,13 +66,21 @@ runs:
id: compare
shell: bash
run: |
# --- Legacy (monolithic) bundle comparison ---
current_size=$(wc -c < temp/current-bundle/embedding-sdk.js) || { echo "::error::Failed to read current bundle"; exit 1; }
base_ref_size=$(wc -c < temp/base-ref-src/resources/frontend_client/app/embedding-sdk.js) || { echo "::error::Failed to read base-ref bundle"; exit 1; }
# Base ref: try new layout first, fall back to old
if [ -f "temp/base-ref-src/resources/frontend_client/app/embedding-sdk/legacy/embedding-sdk.js" ]; then
base_ref_size=$(wc -c < "temp/base-ref-src/resources/frontend_client/app/embedding-sdk/legacy/embedding-sdk.js")
else
base_ref_size=$(wc -c < "temp/base-ref-src/resources/frontend_client/app/embedding-sdk.js")
fi
[ "$current_size" -gt 0 ] && [ "$base_ref_size" -gt 0 ] || { echo "::error::Bundle file is empty"; exit 1; }
diff=$((current_size - base_ref_size))
percent=$(( diff * 100 / base_ref_size ))
echo "=== Legacy (monolithic) bundle ==="
echo "Current size: $current_size bytes"
echo "Base ref size: $base_ref_size bytes"
echo "Difference: $diff bytes ($percent%)"
@@ -75,3 +96,15 @@ runs:
echo "status=$status" >> $GITHUB_OUTPUT
echo "size_change_percent=$percent" >> $GITHUB_OUTPUT
# --- Chunked bundle (informational) ---
if ls temp/current-chunks/*.js 1>/dev/null 2>&1; then
chunks_size=$(cat temp/current-chunks/*.js | wc -c)
echo ""
echo "=== Chunked bundle (bootstrap + chunks) ==="
echo "Total chunked size: $chunks_size bytes"
echo "chunks_size=$chunks_size" >> $GITHUB_OUTPUT
else
echo ""
echo "No chunked bundle found (expected on master)"
fi

View File

@@ -30,7 +30,7 @@ frontend_configs: &frontend_configs
- "**/tsconfig*.json"
- "package.json"
- "babel.config.json"
- ".eslintrc.js"
- "eslint.config.mjs"
- "postcss.config.js"
- "rspack.config.js"
- "rspack.main.config.js"

View File

@@ -0,0 +1,52 @@
// This script is used in .github/workflows/cross-version.yml
// to generate a matrix for cross-version migration testing
/**
* Generate a CI matrix for cross-version migration testing (EE only).
*
* Creates pairs of [source, target] for testing HEAD against the last N
* minor versions in both upgrade and downgrade directions.
*
* @param {number} currentVersion - The current major version number (e.g., 59)
* @param {number} count - Number of previous minor versions to test against (default: 3)
* @returns {{ config: Array<{ source: string, target: string }> }}
*
* @example
* buildMatrix(59)
* // Returns:
* // {
* // config: [
* // { source: "HEAD", target: "v1.59.x" },
* // { source: "v1.59.x", target: "HEAD" },
* // { source: "HEAD", target: "v1.58.x" },
* // { source: "v1.58.x", target: "HEAD" },
* // { source: "HEAD", target: "v1.57.x" },
* // { source: "v1.57.x", target: "HEAD" },
* // ]
* // }
*/
function buildCrossVersionMatrix(currentVersion, count = 3) {
if (!Number.isInteger(currentVersion) || currentVersion < 1) {
throw new Error(
`Invalid currentVersion: ${currentVersion}. Must be a positive integer.`,
);
}
if (!Number.isInteger(count) || count < 1) {
throw new Error(`Invalid count: ${count}. Must be a positive integer.`);
}
const config = Array.from({ length: count }, (_, i) => currentVersion - i)
.filter((majorVersion) => majorVersion >= 1)
.flatMap((majorVersion) => {
const version = `v1.${majorVersion}.x`;
return [
{ source: "HEAD", target: version },
{ source: version, target: "HEAD" },
];
});
return { config };
}
module.exports = { buildCrossVersionMatrix };

View File

@@ -0,0 +1,242 @@
const { buildCrossVersionMatrix } = require("./build-cross-version-matrix");
describe("buildCrossVersionMatrix", () => {
describe("default behavior", () => {
it("should generate matrix with 3 versions by default", () => {
const result = buildCrossVersionMatrix(59);
expect(result).toEqual({
config: [
{ source: "HEAD", target: "v1.59.x" },
{ source: "v1.59.x", target: "HEAD" },
{ source: "HEAD", target: "v1.58.x" },
{ source: "v1.58.x", target: "HEAD" },
{ source: "HEAD", target: "v1.57.x" },
{ source: "v1.57.x", target: "HEAD" },
],
});
});
it("should use EE prefix (v1)", () => {
const result = buildCrossVersionMatrix(50);
expect(result.config[0].target).toBe("v1.50.x");
expect(result.config[1].source).toBe("v1.50.x");
});
it("should create pairs in both directions (upgrade and downgrade)", () => {
const result = buildCrossVersionMatrix(59);
const entries = result.config;
// Check HEAD -> version (upgrade test)
expect(entries.filter((e) => e.source === "HEAD")).toHaveLength(3);
// Check version -> HEAD (downgrade test)
expect(entries.filter((e) => e.target === "HEAD")).toHaveLength(3);
});
});
describe("custom count", () => {
it("should generate matrix with custom count", () => {
const result = buildCrossVersionMatrix(59, 5);
expect(result.config).toHaveLength(10); // 5 versions × 2 directions
expect(result.config).toEqual([
{ source: "HEAD", target: "v1.59.x" },
{ source: "v1.59.x", target: "HEAD" },
{ source: "HEAD", target: "v1.58.x" },
{ source: "v1.58.x", target: "HEAD" },
{ source: "HEAD", target: "v1.57.x" },
{ source: "v1.57.x", target: "HEAD" },
{ source: "HEAD", target: "v1.56.x" },
{ source: "v1.56.x", target: "HEAD" },
{ source: "HEAD", target: "v1.55.x" },
{ source: "v1.55.x", target: "HEAD" },
]);
});
it("should generate matrix with count=1", () => {
const result = buildCrossVersionMatrix(59, 1);
expect(result.config).toHaveLength(2);
expect(result.config).toEqual([
{ source: "HEAD", target: "v1.59.x" },
{ source: "v1.59.x", target: "HEAD" },
]);
});
it("should generate matrix with large count", () => {
const result = buildCrossVersionMatrix(59, 10);
expect(result.config).toHaveLength(20);
// Check first and last entries
expect(result.config[0]).toEqual({
source: "HEAD",
target: "v1.59.x",
});
expect(result.config[18]).toEqual({
source: "HEAD",
target: "v1.50.x",
});
expect(result.config[19]).toEqual({
source: "v1.50.x",
target: "HEAD",
});
});
});
describe("edge cases", () => {
it("should handle version 1", () => {
const result = buildCrossVersionMatrix(1);
expect(result).toEqual({
config: [
{ source: "HEAD", target: "v1.1.x" },
{ source: "v1.1.x", target: "HEAD" },
],
});
});
it("should stop when version would go below 1", () => {
const result = buildCrossVersionMatrix(2, 5);
// Can only generate v1.2.x and v1.1.x (2 versions, not 5)
expect(result.config).toHaveLength(4);
expect(result).toEqual({
config: [
{ source: "HEAD", target: "v1.2.x" },
{ source: "v1.2.x", target: "HEAD" },
{ source: "HEAD", target: "v1.1.x" },
{ source: "v1.1.x", target: "HEAD" },
],
});
});
it("should handle high version numbers", () => {
const result = buildCrossVersionMatrix(100, 2);
expect(result).toEqual({
config: [
{ source: "HEAD", target: "v1.100.x" },
{ source: "v1.100.x", target: "HEAD" },
{ source: "HEAD", target: "v1.99.x" },
{ source: "v1.99.x", target: "HEAD" },
],
});
});
});
describe("error handling", () => {
it("should throw for undefined currentVersion", () => {
expect(() => buildCrossVersionMatrix()).toThrow(
"Invalid currentVersion: undefined. Must be a positive integer.",
);
});
it("should throw for non-integer currentVersion", () => {
expect(() => buildCrossVersionMatrix(59.5)).toThrow(
"Invalid currentVersion: 59.5. Must be a positive integer.",
);
});
it("should throw for zero currentVersion", () => {
expect(() => buildCrossVersionMatrix(0)).toThrow(
"Invalid currentVersion: 0. Must be a positive integer.",
);
});
it("should throw for negative currentVersion", () => {
expect(() => buildCrossVersionMatrix(-1)).toThrow(
"Invalid currentVersion: -1. Must be a positive integer.",
);
});
it("should throw for NaN currentVersion", () => {
expect(() => buildCrossVersionMatrix(NaN)).toThrow(
"Invalid currentVersion: NaN. Must be a positive integer.",
);
});
it("should throw for non-integer count", () => {
expect(() => buildCrossVersionMatrix(59, 2.5)).toThrow(
"Invalid count: 2.5. Must be a positive integer.",
);
});
it("should throw for zero count", () => {
expect(() => buildCrossVersionMatrix(59, 0)).toThrow(
"Invalid count: 0. Must be a positive integer.",
);
});
it("should throw for negative count", () => {
expect(() => buildCrossVersionMatrix(59, -1)).toThrow(
"Invalid count: -1. Must be a positive integer.",
);
});
});
describe("matrix structure for GitHub Actions", () => {
it("should return object with config array", () => {
const result = buildCrossVersionMatrix(59);
expect(result).toHaveProperty("config");
expect(Array.isArray(result.config)).toBe(true);
});
it("should produce valid JSON for GitHub Actions", () => {
const result = buildCrossVersionMatrix(59);
const json = JSON.stringify(result);
expect(() => JSON.parse(json)).not.toThrow();
const parsed = JSON.parse(json);
expect(parsed.config).toHaveLength(6);
expect(parsed.config[0]).toEqual({
source: "HEAD",
target: "v1.59.x",
});
});
it("should have consistent entry structure", () => {
const result = buildCrossVersionMatrix(59, 5);
result.config.forEach((entry) => {
expect(entry).toHaveProperty("source");
expect(entry).toHaveProperty("target");
expect(typeof entry.source).toBe("string");
expect(typeof entry.target).toBe("string");
// Either source or target should be HEAD
expect(entry.source === "HEAD" || entry.target === "HEAD").toBeTruthy();
});
});
});
describe("version ordering", () => {
it("should generate versions in descending order", () => {
const result = buildCrossVersionMatrix(59, 5);
const versions = result.config
.filter((e) => e.source === "HEAD")
.map((e) => e.target);
expect(versions).toEqual([
"v1.59.x",
"v1.58.x",
"v1.57.x",
"v1.56.x",
"v1.55.x",
]);
});
it("should interleave upgrade and downgrade tests", () => {
const result = buildCrossVersionMatrix(59, 2);
expect(result.config[0]).toEqual({
source: "HEAD",
target: "v1.59.x",
});
expect(result.config[1]).toEqual({
source: "v1.59.x",
target: "HEAD",
});
expect(result.config[2]).toEqual({
source: "HEAD",
target: "v1.58.x",
});
expect(result.config[3]).toEqual({
source: "v1.58.x",
target: "HEAD",
});
});
});
});

View File

@@ -3,7 +3,7 @@ const { buildMatrix } = require("./build-e2e-matrix");
describe("buildMatrix", () => {
const options = {
java: "11",
defaultRunner: "ubuntu-22.04",
defaultRunner: "${{ vars.DEFAULT_RUNNER_KEY }}",
};
const testBuildMatrix = (entry, chunks) =>
buildMatrix(options, entry, chunks);

24
.github/team.json vendored
View File

@@ -1,17 +1,26 @@
{
"teams": [
{
"name": "Querying",
"label": ".Team/Querying",
"name": "Querying Platform",
"label": ".Team/QueryingPlatform",
"members": [
"bshepherdson",
"metamben",
"rileythomp",
"camsaul"
]
},
{
"name": "Graphy",
"label": ".Team/Graphy",
"members": [
"ranquild",
"romeovs",
"bshepherdson",
"metamben",
"wzimrin",
"ericnormand",
"galdre",
"rileythomp"
"dpsutton",
"escherize",
"bgrabow"
]
},
{
@@ -36,9 +45,6 @@
"name": "DevEx",
"label": ".Team/DevEx",
"members": [
"camsaul",
"dpsutton",
"escherize",
"fraserdrops",
"nemanjaglumac"
]

View File

@@ -14,20 +14,20 @@ concurrency:
jobs:
be-tests-mariadb:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
version:
- name: MariaDB 10.2
junit-name: be-tests-mariadb-10-2-ee
image: circleci/mariadb:10.2.23
- name: MariaDB 10.6
junit-name: be-tests-mariadb-10-6-ee
image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-image
env:
enable-ssl-tests: 'false'
- name: MariaDB Latest
junit-name: be-tests-mariadb-latest-ee
image: circleci/mariadb:latest
image: mariadb:latest
env:
enable-ssl-tests: 'false'
job:
@@ -57,8 +57,8 @@ jobs:
ports:
- "3306:3306"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: circle_test
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: mb_test
env:
# Only run old migrations tests on pushes to master or release branches. All other branches should skip tests
# with the tag `mb/old-migrations-test`. `__ADDITIONAL_EXCLUDED_TAG__` is not used anywhere outside of splicing
@@ -81,7 +81,7 @@ jobs:
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
#
@@ -100,7 +100,7 @@ jobs:
MB_MYSQL_SSL_TEST_USER: metabase
MB_MYSQL_SSL_TEST_PASSWORD: ${{ secrets.MYSQL_RDS_SSL_INSTANCE_PASSWORD }}
# for historic reasons (I don't want to mess around with required jobs) the job name should be something like
# "be-tests-mariadb-10-2-ee (0)"
# "be-tests-mariadb-10-6-ee (0)"
name: "${{ matrix.version.name }} ${{ matrix.job.name }}"
steps:
- uses: actions/checkout@v4
@@ -128,15 +128,15 @@ jobs:
be-tests-mysql:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
version:
- name: MySQL 8.0
junit-name: be-tests-mysql-8-0-ee
image: cimg/mysql:8.0
- name: MySQL 8.4
junit-name: be-tests-mysql-8-4-ee
image: mysql:8.4
env:
enable-ssl-tests: 'false'
enable-aws-iam-tests: 'false'
@@ -174,7 +174,7 @@ jobs:
- "3306:3306"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: circle_test
MYSQL_DATABASE: mb_test
env:
# Only run old migrations tests on pushes to master or release branches. All other branches should skip tests
# with the tag `mb/old-migrations-test`. `__ADDITIONAL_EXCLUDED_TAG__` is not used anywhere outside of splicing
@@ -197,7 +197,7 @@ jobs:
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
#
@@ -224,7 +224,7 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_AURORA_IAM_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_AURORA_IAM_SECRET_ACCESS_KEY }}
# for historic reasons (I don't want to mess around with required jobs) the job name should be something like
# "be-tests-mariadb-10-2-ee (0)"
# "be-tests-mariadb-10-6-ee (0)"
name: "${{ matrix.version.name }} ${{ matrix.job.name }}"
steps:
- uses: actions/checkout@v4
@@ -252,15 +252,15 @@ jobs:
be-tests-postgres:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
version:
- name: Postgres 12.x
- name: Postgres 14.x
junit-name: postgres-ee
docker-image: postgres:12-alpine
docker-image: postgres:14-alpine
env:
enable-ssl-tests: 'false'
enable-aws-iam-tests: 'false'
@@ -366,7 +366,7 @@ jobs:
- be-tests-mariadb
- be-tests-mysql
- be-tests-postgres
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
name: app-db-tests-result
if: always() && !cancelled()

View File

@@ -11,7 +11,7 @@ on:
jobs:
deploy:
name: Publish Athena JDBC Driver
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
steps:
- name: Check out the code

View File

@@ -7,7 +7,7 @@ on:
jobs:
update_pr:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- uses: tibdex/github-app-token@v2.1.0

View File

@@ -20,7 +20,7 @@ jobs:
github.event.label.name == 'triple-backport'
)
)
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- uses: actions/checkout@v4
with:

View File

@@ -11,12 +11,13 @@ name: Backend-Cloverage
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * 1-5' # every weekday at 5am US eastern time
# re-enable once we figure out the correctness of the reports in DEV-1104
# schedule:
# - cron: '0 10 * * 1-5' # every weekday at 5am US eastern time
jobs:
setup-oss:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
outputs:
modules: ${{ steps.get-modules.outputs.modules }}
steps:
@@ -30,7 +31,7 @@ jobs:
needs: setup-oss
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
strategy:
fail-fast: false
@@ -63,7 +64,7 @@ jobs:
flags: back-end
setup-ee:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
outputs:
modules: ${{ steps.get-modules.outputs.modules }}
steps:
@@ -77,7 +78,7 @@ jobs:
needs: setup-ee
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
strategy:
fail-fast: false

View File

@@ -14,7 +14,7 @@ concurrency:
jobs:
be-linter-clj-kondo:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
name: Clj-Kondo
steps:
@@ -26,7 +26,7 @@ jobs:
be-linter-eastwood:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
name: Eastwood
steps:
@@ -36,9 +36,21 @@ jobs:
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood
name: Run Eastwood linter
be-linter-eastwood-test:
if: ${{ !inputs.skip && github.ref_name == 'master' }}
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
name: Eastwood (tests only)
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood/test
name: Run Eastwood linter on our backend tests
be-tests:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
@@ -155,7 +167,7 @@ jobs:
# as `:dev` dependencies). See #27009 for more context.
be-check:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
strategy:
matrix:
@@ -171,7 +183,7 @@ jobs:
be-cljfmt:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
name: Cljfmt
steps:
@@ -184,12 +196,13 @@ jobs:
be-tests-result:
needs:
- be-linter-eastwood
- be-linter-eastwood-test
- be-linter-clj-kondo
- be-cljfmt
- be-check
- be-tests
if: always() && !cancelled()
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
env:
needs: ${{ toJson(needs) }}

View File

@@ -10,7 +10,7 @@ on:
jobs:
backport-reminder:
name: Decide whether to backport or not
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- uses: jesusvasquez333/verify-pr-label-action@v1.4.0

View File

@@ -5,7 +5,7 @@ on:
jobs:
check-source-branch:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- name: Block master branch PRs
if: github.head_ref == 'master'

View File

@@ -14,7 +14,7 @@ on:
jobs:
start-message:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
@@ -45,7 +45,7 @@ jobs:
}).catch(console.error);
trigger-milestone-check:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
needs: start-message
steps:
@@ -66,7 +66,7 @@ jobs:
check-version:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
outputs:
ee: ${{ fromJson(steps.canonical_version.outputs.result).ee }}
@@ -118,7 +118,7 @@ jobs:
return versions;
check-commit:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
steps:
- name: Check out the code to verify the release branch
@@ -150,7 +150,7 @@ jobs:
git checkout -
get-build-requirements:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
outputs:
java_version: ${{ fromJson(steps.dependencies.outputs.result).java_version }}
@@ -185,7 +185,7 @@ jobs:
build-uberjar-for-release:
needs: [check-version, check-commit, get-build-requirements]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 50
strategy:
matrix:

View File

@@ -10,7 +10,7 @@ on:
jobs:
test-build-scripts:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment

View File

@@ -39,7 +39,7 @@ concurrency:
jobs:
get-cache-keys:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- uses: actions/checkout@v4
- name: Get cache keys
@@ -52,7 +52,7 @@ jobs:
cypress-cache-key: ${{ steps.get-cache-keys.outputs.cypress-cache-key }}
generate-caches:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
needs: get-cache-keys
env:

View File

@@ -7,7 +7,7 @@ on:
jobs:
check-backport-script:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -15,7 +15,7 @@ on:
jobs:
set-milestone:
name: Automatically set milestone
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
env:
isNewReleaseBranch: ${{ github.event_name == 'workflow_dispatch' }}

View File

@@ -14,7 +14,7 @@ concurrency:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
frontend_all: ${{ steps.changes.outputs.frontend_all }}
@@ -30,7 +30,7 @@ jobs:
fe-chromatic:
needs: files-changed
if: contains(github.event.pull_request.labels.*.name, 'chromatic') || (github.ref_name == 'master' && needs.files-changed.outputs.frontend_all == 'true')
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

View File

@@ -1,360 +0,0 @@
name: "Claude Code Bug Fix"
on:
issues:
types:
- labeled
pull_request_review:
types:
- submitted
workflow_dispatch:
inputs:
issue_number:
description: "Issue number to fix"
required: true
type: string
override_employee_check:
description: "Override employee check for issue creator"
required: false
default: false
type: boolean
jobs:
auto-fix-bug:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
if: |
(github.event_name == 'issues' && github.event.label.name == 'Claude Bug Fix' && github.event.issue.state == 'open') ||
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'pull_request_review' && github.event.review.state == 'changes_requested' && startsWith(github.event.pull_request.head.ref, 'claude-fix/'))
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get issue data and check employee status
id: get_issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { getIssueData } = require('${{ github.workspace }}/.github/scripts/get-issue-data.js');
try {
const result = await getIssueData({
context,
github,
manualIssueNumber: '${{ github.event.inputs.issue_number }}'
});
const { issueNumber, issueData, employeeComments, prReviews, triggerType, isIssueAuthorEmployee } = result;
// Check employee status and fail if not authorized
if (!result.isIssueAuthorEmployee && '${{ github.event.inputs.override_employee_check }}' !== 'true') {
core.setFailed(`User ${result.issueData.user.login} is not a Metabase employee. Skipping bug fix automation.`);
}
core.setOutput('issue_number', issueNumber);
core.setOutput('issue_data', JSON.stringify(issueData));
core.setOutput('issue_comments', JSON.stringify(employeeComments));
core.setOutput('pr_reviews', JSON.stringify(prReviews));
core.setOutput('trigger_type', triggerType);
} catch (error) {
core.setFailed(error.message);
}
- name: Find linked Linear issue
id: find_linear
continue-on-error: true
uses: actions/github-script@v7
env:
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
ISSUE_NUMBER: ${{ steps.get_issue.outputs.issue_number }}
with:
script: |
const { findLinearIssue } = require('${{ github.workspace }}/.github/scripts/find-linear-issue.js');
const githubIssueUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/issues/${process.env.ISSUE_NUMBER}`;
const result = await findLinearIssue({
githubIssueUrl,
linearApiKey: process.env.LINEAR_API_KEY
});
if (result.success) {
console.log(`Found Linear issue: ${result.issue}`);
core.setOutput('linear_issue', result.issue);
} else {
console.log(`Could not find Linear issue: ${result.message}`);
}
- name: Set up git configuration
run: |
git config --global user.name "Claude Code[bot]"
git config --global user.email "noreply@anthropic.com"
- name: Prepare issue context and bug fix prompt
id: prepare_prompt
uses: actions/github-script@v7
env:
ISSUE_DATA: ${{ steps.get_issue.outputs.issue_data }}
ISSUE_COMMENTS: ${{ steps.get_issue.outputs.issue_comments }}
PR_REVIEWS: ${{ steps.get_issue.outputs.pr_reviews }}
TRIGGER_TYPE: ${{ steps.get_issue.outputs.trigger_type }}
with:
script: |
const issueData = JSON.parse(process.env.ISSUE_DATA);
const issueComments = JSON.parse(process.env.ISSUE_COMMENTS);
const prReviews = JSON.parse(process.env.PR_REVIEWS);
const triggerType = process.env.TRIGGER_TYPE;
const issueNumber = '${{ steps.get_issue.outputs.issue_number }}';
// Convert issue title to kebab case and create branch name
const issueTitle = issueData.title || 'untitled';
const kebabTitle = issueTitle
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '')
.replace(/-+/g, '-')
.substring(0, 50);
const branchName = `claude-fix/issue-${issueNumber}-${kebabTitle}`;
// Format data for bash environment
const formattedComments = issueComments.length > 0
? issueComments.map(comment =>
`**Comment by @${comment.user.login} on ${comment.created_at}:**\n${comment.body}`
).join('\n\n---\n\n')
: '';
const formattedReviews = prReviews.length > 0
? prReviews.map(review =>
`**Review by @${review.user.login} on ${review.submitted_at} (Changes Requested):**\n${review.body || 'No review comment provided'}`
).join('\n\n---\n\n')
: '';
core.exportVariable('BRANCH_NAME', branchName);
core.exportVariable('ISSUE_NUMBER', issueNumber);
core.exportVariable('ISSUE_TITLE', issueData.title);
core.exportVariable('ISSUE_AUTHOR', issueData.user.login);
core.exportVariable('ISSUE_CREATED', issueData.created_at);
core.exportVariable('ISSUE_BODY', issueData.body || 'No description provided');
core.exportVariable('ISSUE_COMMENTS_FORMATTED', formattedComments);
core.exportVariable('PR_REVIEWS_FORMATTED', formattedReviews);
core.exportVariable('TRIGGER_TYPE', triggerType);
- name: Generate bug fix prompt
run: |
cat << 'EOF' >> $GITHUB_ENV
BUG_FIX_PROMPT<<PROMPT_END
You are helping to fix a bug reported in GitHub issue #${{ env.ISSUE_NUMBER }}.
## Bug Report Details
**Title:** ${{ env.ISSUE_TITLE }}
**Reporter:** ${{ env.ISSUE_AUTHOR }}
**Created:** ${{ env.ISSUE_CREATED }}
**Description:**
${{ env.ISSUE_BODY }}
**Comments:**
${{ env.ISSUE_COMMENTS_FORMATTED }}
EOF
# Add review feedback section only if this is a review trigger
if [ "${{ env.TRIGGER_TYPE }}" = "pull_request_review" ]; then
cat << 'EOF' >> $GITHUB_ENV
## Previous Fix Attempt - Review Feedback (MUST ADDRESS)
Your previous automated fix attempt received the following feedback that needs to be addressed:
${{ env.PR_REVIEWS_FORMATTED }}
EOF
fi
# Add the rest of the prompt (always the same)
cat << 'EOF' >> $GITHUB_ENV
## Instructions
1. **Analyze the issue description and comments** - Understand what the issue is describing
a. Pay particular attention to reproduction steps and if there's an agreed upon fix.
2. **Search the codebase** - Use Grep and Glob tools to find relevant files
3. **Implement a fix** - Use the appropriate write skill based on the file types:
- Use clojure-write for Clojure/ClojureScript files
- Use typescript-write for TypeScript/JavaScript files
- Follow the coding standards and patterns in each skill
4. **Test the fix** - Run appropriate tests as specified in the skills
5. **Verify the fix** - Ensure tests pass and code follows conventions
## Important Guidelines
- Use the appropriate write skill for the language you're working in
- Write failing tests first, then fix them
- Work in small, testable increments
- Don't commit changes - leave that for the workflow
- IMPORTANT: Focus only on fixing the reported bug, don't make unrelated changes
## Scratchpad Directory
A `.claude-scratchpad/` directory has been created for your temporary files:
- Use this directory for ALL temporary verification files. However, prefer using production test files rather than adhoc ones.
- Only modify actual production code in the main repository directories
- The scratchpad will be cleaned up automatically - nothing from it will be committed
Start by understanding the bug and then systematically work toward a solution.
PROMPT_END
EOF
- name: Determine branch strategy
run: |
BRANCH_NAME="${{ env.BRANCH_NAME }}"
if git branch -r --list "origin/${BRANCH_NAME}" | grep -q .; then
echo "Branch already exists: $BRANCH_NAME"
echo "Will push to existing branch and skip PR creation"
echo "BRANCH_EXISTS=true" >> $GITHUB_ENV
else
echo "Creating new branch: $BRANCH_NAME"
echo "Will create new PR"
echo "BRANCH_EXISTS=false" >> $GITHUB_ENV
fi
# Export the branch name
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Create scratchpad directory for Claude
run: |
# Create a scratchpad directory for Claude to use for temporary files
mkdir -p .claude-scratchpad
echo "Scratchpad directory created for Claude's temporary verification files"
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- name: Generate GitHub App Token for Claude
uses: actions/create-github-app-token@v1
id: claude-app-token
with:
app-id: ${{ secrets.METABASE_BOT_APP_ID }}
private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- name: Generate Bug Fix with Claude Code
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ steps.claude-app-token.outputs.token }}
prompt: ${{ env.BUG_FIX_PROMPT }}
claude_args: |
--allowedTools "Bash(bun run test-unit*),Bash(bun run lint-eslint-pure),Bash(./bin/mage*),Bash(clojure*),Bash(find*),Bash(ls*),Bash(grep*),Write,Read,Glob,Grep,Edit,MultiEdit"
--disallowedTools "Bash(git commit*),Bash(git push*),Bash(gh*)"
- name: Clean up scratchpad directory
run: |
# Remove the scratchpad directory so its contents don't get committed
rm -rf .claude-scratchpad/
# Remove output file generated by Claude Code action
rm -f output.txt
echo "Scratchpad directory and action output files cleaned up"
- name: Check for changes and analysis
id: check_changes
run: |
# Now check for actual code changes (excluding analysis file)
if [ -n "$(git status --porcelain)" ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "Changes detected:"
git status --short
else
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "No changes made by Claude."
fi
- name: Get issue team labels and prepare reviewers
if: steps.check_changes.outputs.has_changes == 'true'
id: prepare_reviewers
uses: actions/github-script@v7
env:
ISSUE_DATA: ${{ steps.get_issue.outputs.issue_data }}
with:
script: |
const issueData = JSON.parse(process.env.ISSUE_DATA);
const issueLabels = issueData.labels.map(label => label.name);
const teamLabels = issueLabels.filter(label => label.startsWith('.Team/'));
const issueCreator = issueData.user.login;
core.setOutput('team_labels', teamLabels.join(','));
core.setOutput('reviewers', issueCreator);
- name: Create Pull Request
id: create_pr
if: steps.check_changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.BRANCH_NAME }}
base: master
commit-message: |
Fix: ${{ env.ISSUE_TITLE }}
Fixes #${{ env.ISSUE_NUMBER }}
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
committer: "Claude Code[bot] <noreply@anthropic.com>"
author: "Claude Code[bot] <noreply@anthropic.com>"
title: "Fix: ${{ env.ISSUE_TITLE }}"
body: |
This PR automatically fixes the bug reported in #${{ env.ISSUE_NUMBER }}.
${{ steps.find_linear.outputs.linear_issue && format('Closes {0}', steps.find_linear.outputs.linear_issue) || '' }}
## Bug Report
**Original Issue:** #${{ env.ISSUE_NUMBER }}
**Reporter:** @${{ env.ISSUE_AUTHOR }}
**Issue Title:** ${{ env.ISSUE_TITLE }}
## Automated Fix
🤖 This fix was generated automatically by Claude Code based on the issue description.
**Please review carefully:**
- [ ] The fix addresses the reported issue
- [ ] Tests pass and code follows conventions
- [ ] No unrelated changes were introduced
- [ ] The solution is appropriate and maintainable
## Next Steps
- Review the changes and test thoroughly
- If the fix looks good, approve and merge
- If issues are found, either fix them or close this PR
---
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
labels: |
${{ steps.prepare_reviewers.outputs.team_labels }}
automated-fix
ci skip
reviewers: ${{ steps.prepare_reviewers.outputs.reviewers }}
assignees: ${{ github.actor }}
- name: Log existing branch update
if: steps.check_changes.outputs.has_changes == 'true' && env.BRANCH_EXISTS == 'true'
uses: actions/github-script@v7
with:
script: |
console.log('🔄 Updated existing branch: ${{ env.BRANCH_NAME }}');
console.log('The changes have been pushed to the existing PR for this issue.');
- name: Log analysis for no changes
if: steps.check_changes.outputs.has_changes == 'false'
uses: actions/github-script@v7
with:
script: |
console.log('🤖 No code changes were made by Claude.');

View File

@@ -14,7 +14,7 @@ concurrency:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
cljs: ${{ steps.changes.outputs.cljs }}
@@ -30,7 +30,7 @@ jobs:
shared-tests-cljs:
needs: files-changed
if: needs.files-changed.outputs.cljs == 'true'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

View File

@@ -10,7 +10,7 @@ on:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
codeql: ${{ steps.changes.outputs.codeql }}
@@ -25,7 +25,7 @@ jobs:
analyze:
needs: files-changed
if: needs.files-changed.outputs.codeql == 'true'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

View File

@@ -8,7 +8,7 @@ on:
jobs:
codespell:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
permissions:
contents: write
@@ -43,27 +43,35 @@ jobs:
app-id: ${{ secrets.METABASE_BOT_APP_ID }}
private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- name: Build Claude prompt
if: steps.codespell_check.outcome == 'failure'
run: |
cat > /tmp/claude_prompt.txt << 'PROMPT_HEADER'
You are tasked with fixing spelling errors detected by codespell in this repository.
## Codespell Output
The following spelling errors were detected:
```
PROMPT_HEADER
cat codespell_output.txt >> /tmp/claude_prompt.txt
cat >> /tmp/claude_prompt.txt << 'PROMPT_FOOTER'
```
## Instructions
1. **Review the codespell output and identify reported spelling errors** - The usual format codespell uses is `typo ==> correction`
2. **Fix every spelling error** - Use the Edit tool to fix each misspelling with the suggested correction
- If codespell suggests multiple corrections, choose the most appropriate one based on context
Human reviewers will verify the changes before merging, so fix all errors reported by codespell.
PROMPT_FOOTER
- name: Fix spelling errors with Claude Code
if: steps.codespell_check.outcome == 'failure'
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ steps.claude-app-token.outputs.token }}
prompt: |
You are tasked with fixing spelling errors detected by codespell in this repository.
## Codespell Output
The following spelling errors were detected:
```
$(cat codespell_output.txt)
```
## Instructions
1. **Review the codespell output and identify reported spelling errors** - The usual format codespell uses is `typo ==> correction`
2. **Fix every spelling error** - Use the Edit tool to fix each misspelling with the suggested correction
- If codespell suggests multiple corrections, choose the most appropriate one based on context
Human reviewers will verify the changes before merging, so fix all errors reported by codespell.
prompt_file: /tmp/claude_prompt.txt
claude_args: |
--allowedTools "Write,Read,Glob,Grep,Edit,MultiEdit,Bash(cat*),Bash(ls*)"
--disallowedTools "Bash(git commit*),Bash(git push*),Bash(gh*)"

View File

@@ -48,7 +48,7 @@ on:
jobs:
containerize:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 15
outputs:
platforms: ${{ steps.platforms.outputs.result }}
@@ -117,7 +117,7 @@ jobs:
bin/docker/.
verify-docker-pull:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
needs: containerize
timeout-minutes: 15
steps:

View File

@@ -6,7 +6,7 @@ on:
jobs:
get-container-info:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
name: Get container info
outputs:
@@ -68,7 +68,7 @@ jobs:
strategy:
matrix:
edition: ${{ fromJson(needs.get-container-info.outputs.editions) }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
name: Run Trivy vulnerability scanner
steps:
- name: Check out the code
@@ -76,7 +76,7 @@ jobs:
with:
ref: ${{ github.event.inputs.commit || github.event.pull_request.head.sha || github.sha }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.29.0
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1
env:
TRIVY_OFFLINE_SCAN: true
repo: ${{ fromJson(needs.get-container-info.outputs[matrix.edition]).repo }}
@@ -85,7 +85,6 @@ jobs:
image-ref: docker.io/${{ env.repo }}:${{ env.tag }}
format: sarif
output: trivy-results.sarif
version: "v0.57.1"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
@@ -94,7 +93,7 @@ jobs:
post-comment:
needs: [get-container-info, containerize]
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
name: Post PR comment
steps:
- name: Check out the code

View File

@@ -8,7 +8,7 @@ on:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
frontend_embedding_sources: ${{ steps.changes.outputs.frontend_embedding_sources }}
@@ -22,7 +22,7 @@ jobs:
filters: .github/file-paths.yaml
pr-title-reminder:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
permissions:
pull-requests: write

View File

@@ -7,7 +7,7 @@ on:
jobs:
fe-test-coverage:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4

View File

@@ -25,7 +25,7 @@ concurrency:
jobs:
migrations-h2-ee:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
env:
CI: 'true'
@@ -38,24 +38,24 @@ jobs:
base-ref: ${{ env.BASE_REF }}
head-ref: ${{ env.HEAD_REF }}
migrations-postgres-12-ee:
runs-on: ubuntu-22.04
migrations-postgres-14-ee:
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
env:
CI: 'true'
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: mb_test
services:
postgres:
image: postgres:12-alpine
image: postgres:14-alpine
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_USER: mb_test
POSTGRES_DB: mb_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
@@ -65,23 +65,23 @@ jobs:
head-ref: ${{ env.HEAD_REF }}
migrations-postgres-latest-ee:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
env:
CI: 'true'
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: mb_test
services:
postgres:
image: circleci/postgres:latest
image: postgres:latest
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_USER: mb_test
POSTGRES_DB: mb_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
@@ -90,21 +90,24 @@ jobs:
base-ref: ${{ env.BASE_REF }}
head-ref: ${{ env.HEAD_REF }}
migrations-mysql-8-0-ee:
runs-on: ubuntu-22.04
migrations-mysql-8-4-ee:
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
services:
mysql:
image: cimg/mysql:8.0
image: mysql:8.4
ports:
- "3306:3306"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: mb_test
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
@@ -113,14 +116,14 @@ jobs:
head-ref: ${{ env.HEAD_REF }}
migrations-mysql-latest-ee:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
services:
@@ -128,7 +131,7 @@ jobs:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: circle_test
MYSQL_DATABASE: mb_test
ports:
- "3306:3306"
steps:
@@ -138,21 +141,24 @@ jobs:
base-ref: ${{ env.BASE_REF }}
head-ref: ${{ env.HEAD_REF }}
migrations-mariadb-10-2-ee:
runs-on: ubuntu-22.04
migrations-mariadb-10-6-ee:
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
services:
mariadb:
image: circleci/mariadb:10.2.23
image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-image
ports:
- "3306:3306"
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: mb_test
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
@@ -161,20 +167,23 @@ jobs:
head-ref: ${{ env.HEAD_REF }}
migrations-mariadb-latest-ee:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
services:
mariadb:
image: circleci/mariadb:latest
image: mariadb:latest
ports:
- "3306:3306"
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: mb_test
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test

221
.github/workflows/cross-version.yml vendored Normal file
View File

@@ -0,0 +1,221 @@
name: Cross-Version Migration Tests
on:
workflow_dispatch:
inputs:
source_version:
description: "Source version (e.g., v1.58.6 or HEAD)"
required: true
type: string
target_version:
description: "Target version (e.g., v1.58.7 or HEAD)"
required: true
type: string
pull_request:
paths:
- "cross-version/**"
- ".github/workflows/cross-version.yml"
- ".github/scripts/build-cross-version-matrix.js"
schedule:
# Run nightly at 3 AM UTC
- cron: "0 3 * * *"
jobs:
# Generate matrix for scheduled/PR runs
generate-matrix:
if: github.event_name != 'workflow_dispatch'
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: .github
- name: Generate version matrix
id: set-matrix
uses: actions/github-script@v7
with:
script: |
const { buildCrossVersionMatrix } = require('${{ github.workspace }}/.github/scripts/build-cross-version-matrix');
const { config } = buildCrossVersionMatrix(${{ vars.CURRENT_VERSION }});
const matrix = JSON.stringify({ include: config });
core.setOutput("matrix", matrix);
console.log("matrix:", matrix);
# Matrix-based tests for scheduled/PR runs
test-matrix:
if: github.event_name != 'workflow_dispatch'
needs: generate-matrix
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Prepare release scripts
uses: ./.github/actions/prepare-release-scripts
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare Cypress environment
uses: ./.github/actions/prepare-cypress
- name: Run cross-version test
env:
CURRENT_VERSION: ${{ vars.CURRENT_VERSION }}
RESULT_FILE: ${{ runner.temp }}/cross-version-result-${{ matrix.source }}-${{ matrix.target }}.json
run: |
cd cross-version
./test.sh --source "${{ matrix.source }}" --target "${{ matrix.target }}"
- name: Upload failure result
uses: actions/upload-artifact@v4
if: failure()
with:
name: failure-result-${{ matrix.source }}-${{ matrix.target }}
path: ${{ runner.temp }}/cross-version-result-${{ matrix.source }}-${{ matrix.target }}.json
if-no-files-found: ignore
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-recording-${{ matrix.source }}-${{ matrix.target }}
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
- name: Show logs on failure
if: failure()
run: |
cd cross-version
docker compose logs metabase || true
docker compose logs postgres || true
# Notify Slack on nightly failures
notify-on-failure:
if: always() && github.event_name == 'schedule' && needs.test-matrix.result == 'failure'
needs: [test-matrix]
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
release
.github
- name: Prepare release scripts
uses: ./.github/actions/prepare-release-scripts
- name: Download failure results
uses: actions/download-artifact@v4
continue-on-error: true
with:
pattern: failure-result-*
path: failure-results
merge-multiple: true
- name: Notify Slack
continue-on-error: true
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: |
const fs = require('fs');
const path = require('path');
const { buildFailureResults, sendCrossVersionSlackNotification } = require('${{ github.workspace }}/release/dist/index.cjs');
// Get all failed jobs from the GitHub API
const { owner, repo } = context.repo;
const jobInfo = await github.rest.actions.listJobsForWorkflowRun({
owner,
repo,
run_id: context.runId,
per_page: 100,
});
const failedJobs = jobInfo.data.jobs
.filter(job => job.status === 'completed' && job.conclusion === 'failure' && job.name.startsWith('test-matrix'))
.map(job => ({ name: job.name, url: job.html_url }));
if (failedJobs.length === 0) {
console.log('No failed test-matrix jobs found');
return;
}
// Load artifact data for enrichment (phase)
const resultsDir = 'failure-results';
const artifactData = new Map();
if (fs.existsSync(resultsDir)) {
for (const file of fs.readdirSync(resultsDir)) {
if (!file.endsWith('.json')) continue;
try {
const result = JSON.parse(fs.readFileSync(path.join(resultsDir, file), 'utf8'));
artifactData.set(`${result.source}-${result.target}`, result);
} catch (e) {
console.log(`Skipping malformed result: ${file}`);
}
}
}
const failures = buildFailureResults(failedJobs, artifactData);
const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${context.runId}`;
const slackBotToken = process.env.SLACK_BOT_TOKEN;
if (!slackBotToken) {
console.log('SLACK_BOT_TOKEN is not set; skipping Slack notification.');
return;
}
await sendCrossVersionSlackNotification(failures, runUrl, slackBotToken);
console.log('Slack notification sent');
# Manual test for workflow_dispatch
test-manual:
if: github.event_name == 'workflow_dispatch'
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Prepare release scripts
uses: ./.github/actions/prepare-release-scripts
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare Cypress environment
uses: ./.github/actions/prepare-cypress
- name: Run cross-version test
env:
CURRENT_VERSION: ${{ vars.CURRENT_VERSION }}
run: |
cd cross-version
./test.sh --source "${{ inputs.source_version }}" --target "${{ inputs.target_version }}"
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-recording-${{ inputs.source_version }}-${{ inputs.target_version }}
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
- name: Show logs on failure
if: failure()
run: |
cd cross-version
docker compose logs metabase || true
docker compose logs postgres || true

View File

@@ -0,0 +1,79 @@
name: Disabled Drivers Slack Notification
on:
workflow_dispatch:
schedule:
- cron: "0 9 * * 1" # every Monday at 9:00 UTC
jobs:
notify-disabled-drivers:
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- uses: actions/setup-node@v4
with:
node-version: lts/Jod
- name: Install Slack SDK
run: npm install @slack/web-api
- name: Check disabled drivers and notify Slack
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: |
const { WebClient } = require('@slack/web-api');
// Fetch the config
const response = await fetch('https://raw.githubusercontent.com/metabase/ci-test-config/refs/heads/master/ci-test-config.json');
const config = await response.json();
const drivers = config.ignored?.drivers || [];
const lastUpdated = config.metadata?.last_updated || 'unknown';
const reason = config.metadata?.reason || 'No reason provided';
if (drivers.length === 0) {
console.log('No drivers are currently disabled. Skipping Slack notification.');
return;
}
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
const slack = new WebClient(process.env.SLACK_BOT_TOKEN);
await slack.chat.postMessage({
channel: 'engineering-ci',
text: 'CI Disabled Drivers Report',
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: `:no_entry: *CI Disabled Drivers*\n${drivers.map(d => `\`${d}\``).join(' ')}`
},
accessory: {
type: 'button',
text: {
type: 'plain_text',
text: 'View Config',
emoji: true
},
url: 'https://github.com/metabase/ci-test-config/blob/master/ci-test-config.json'
}
},
{
type: 'context',
elements: [
{
type: 'mrkdwn',
text: `${reason} · :clock1: *${lastUpdated}*`
}
]
}
]
});
console.log('Slack notification sent successfully');

View File

@@ -21,7 +21,7 @@ permissions:
jobs:
update-docs:
name: Update documentation for ${{ inputs.target_branch }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
steps:
- name: Checkout code

View File

@@ -7,7 +7,7 @@ on:
jobs:
link-checker:
name: Check documentation links
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
permissions:
contents: read

View File

@@ -2,7 +2,7 @@ name: Auto-update documentation (master)
on:
schedule:
- cron: "0 1 * * 1-5" # Every Monday through Friday at 1 AM UTC
- cron: "0 21 * * 1-5" # Every Monday through Friday at 9 PM UTC
workflow_dispatch:
jobs:

View File

@@ -2,13 +2,13 @@ name: Auto-update documentation (release)
on:
schedule:
- cron: "0 2 * * 1-5" # Every Monday through Friday at 2 AM UTC
- cron: "0 22 * * 1-5" # Every Monday through Friday at 10 PM UTC
workflow_dispatch:
inputs:
target_branch:
description: "Target branch for documentation update"
required: false
default: "release-x.58.x"
default: "release-x.59.x"
type: string
jobs:
@@ -16,6 +16,6 @@ jobs:
name: Call documentation update for release branch
uses: ./.github/workflows/docs-generate-base.yml
with:
target_branch: ${{ inputs.target_branch || 'release-x.58.x' }}
target_branch: ${{ inputs.target_branch || 'release-x.59.x' }}
secrets:
automation_token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}

View File

@@ -49,7 +49,7 @@ jobs:
be-tests-athena-ee:
if: inputs.driver == 'Athena'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -68,7 +68,7 @@ jobs:
be-tests-bigquery-cloud-sdk-ee:
if: inputs.driver == 'BigQuery'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -89,7 +89,7 @@ jobs:
be-tests-druid-ee:
if: inputs.driver == 'Druid'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -109,9 +109,9 @@ jobs:
junit-name: 'be-tests-druid-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-tests-mariadb-10-2-ee:
be-tests-mariadb-10-6-ee:
if: inputs.driver == 'Maria DB'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -119,25 +119,28 @@ jobs:
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
services:
mariadb:
image: circleci/mariadb:10.2.23
image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-image
ports:
- "3306:3306"
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: mb_test
steps:
- uses: actions/checkout@v4
- name: Test MariaDB driver (10.2)
- name: Test MariaDB driver (10.6)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mariadb-10-2-ee'
junit-name: 'be-tests-mariadb-10-6-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-tests-mariadb-latest-ee:
if: inputs.driver == 'Maria DB (latest)'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -145,14 +148,17 @@ jobs:
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
services:
mariadb:
image: circleci/mariadb:latest
image: mariadb:latest
ports:
- "3306:3306"
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: mb_test
steps:
- uses: actions/checkout@v4
- name: Test MariaDB driver (latest)
@@ -163,7 +169,7 @@ jobs:
be-tests-mongo-4-4-ee:
if: inputs.driver == 'Mongo 4'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -185,7 +191,7 @@ jobs:
be-tests-mongo-4-4-ssl-ee:
if: inputs.driver == 'Mongo 4 (SSL)'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -219,7 +225,7 @@ jobs:
be-tests-mongo-5-0-ee:
if: inputs.driver == 'Mongo 5'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -241,7 +247,7 @@ jobs:
be-tests-mongo-5-0-ssl-ee:
if: inputs.driver == 'Mongo 5 (SSL)'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -275,7 +281,7 @@ jobs:
be-tests-mongo-latest-ee:
if: inputs.driver == 'Mongo (latest)'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -284,7 +290,7 @@ jobs:
MB_MONGO_TEST_PASSWORD: metasample123
services:
mongodb:
image: circleci/mongo:latest
image: mongo:latest
ports:
- "27017:27017"
env:
@@ -298,9 +304,9 @@ jobs:
junit-name: 'be-tests-mongo-latest-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-tests-mysql-8-0-ee:
be-tests-mysql-8-4-ee:
if: inputs.driver == 'MySQL'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -308,25 +314,28 @@ jobs:
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
services:
mysql:
image: cimg/mysql:8.0
image: mysql:8.4
ports:
- "3306:3306"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: mb_test
steps:
- uses: actions/checkout@v4
- name: Test MySQL driver (8.0)
- name: Test MySQL driver (8.4)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mysql-8-0-ee'
junit-name: 'be-tests-mysql-8-4-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-tests-mysql-latest-ee:
if: inputs.driver == 'MySQL (latest)'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -334,7 +343,7 @@ jobs:
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
# set up env vars for something named "MYSQL_SSL" to run MySQL SSL tests verifying connectivity with PEM cert
@@ -364,7 +373,7 @@ jobs:
be-tests-oracle-18-4-ee:
if: inputs.driver == 'Oracle 18'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -390,7 +399,7 @@ jobs:
be-tests-oracle-21-3-ee:
if: inputs.driver == 'Oracle 21'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -425,7 +434,7 @@ jobs:
be-tests-postgres-ee:
if: inputs.driver == 'Postgres'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -438,7 +447,7 @@ jobs:
MB_POSTGRESQL_TEST_USER: mb_test
services:
postgres:
image: postgres:12-alpine
image: postgres:14-alpine
ports:
- "5432:5432"
env:
@@ -447,7 +456,7 @@ jobs:
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- name: Test Postgres driver (12)
- name: Test Postgres driver (14)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-postgres-ee'
@@ -455,7 +464,7 @@ jobs:
be-tests-postgres-latest-ee:
if: inputs.driver == 'Postgres (latest)'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -463,20 +472,20 @@ jobs:
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
MB_POSTGRESQL_TEST_USER: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: mb_test
MB_POSTGRESQL_TEST_USER: mb_test
MB_POSTGRES_SSL_TEST_SSL: true
MB_POSTGRES_SSL_TEST_SSL_MODE: verify-full
MB_POSTGRES_SSL_TEST_SSL_ROOT_CERT_PATH: 'test-resources/certificates/us-east-2-bundle.pem'
services:
postgres:
image: circleci/postgres:latest
image: postgres:latest
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_USER: mb_test
POSTGRES_DB: mb_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
@@ -488,7 +497,7 @@ jobs:
be-tests-presto-jdbc-ee:
if: inputs.driver == 'Presto JDBC'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -537,7 +546,7 @@ jobs:
be-tests-redshift-ee:
if: inputs.driver == 'Redshift'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -556,7 +565,7 @@ jobs:
be-tests-snowflake-ee:
if: inputs.driver == 'Snowflake'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -577,7 +586,7 @@ jobs:
be-tests-sparksql-ee:
if: inputs.driver == 'SparkSQL'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -597,7 +606,7 @@ jobs:
be-tests-sqlite-ee:
if: inputs.driver == 'SQLite'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -612,7 +621,7 @@ jobs:
be-tests-sqlserver-2017-ee:
if: inputs.driver == 'SQL Server 2017'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -639,7 +648,7 @@ jobs:
be-tests-sqlserver-2022-ee:
if: inputs.driver == 'SQL Server 2022'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -666,7 +675,7 @@ jobs:
be-tests-starburst-ee:
if: inputs.driver == 'Starburst'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
env:
CI: 'true'
@@ -691,7 +700,7 @@ jobs:
login-to-ecr:
if: inputs.driver == 'Vertica'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 15
permissions:
id-token: write
@@ -720,7 +729,7 @@ jobs:
be-tests-vertica-ee:
if: inputs.driver == 'Vertica'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
needs: login-to-ecr
timeout-minutes: 90
env:

View File

@@ -15,7 +15,7 @@ jobs:
# This job determines which driver tests should run based on PR context.
# All decision logic is consolidated in mage driver-decisions.
determine-driver-skips:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
outputs:
# All driver run decisions (from mage driver-decisions)
h2-should-run: ${{ steps.driver-decisions.outputs.h2-should-run }}
@@ -82,6 +82,9 @@ jobs:
echo ""
# First call: show human-readable output for debugging
./bin/mage -driver-decisions "${MAGE_ARGS[@]}"
echo ""
echo "Want to force-run a specific driver? Add a ci:run-<driver> or ci:run-all-drivers label to your PR."
echo "Run './bin/mage -driver-decisions -h' locally for the full list of drivers and labels."
# Second call: output only key=value lines for GITHUB_OUTPUT
./bin/mage -driver-decisions "${MAGE_ARGS[@]}" --github-output-only >> $GITHUB_OUTPUT
shell: bash
@@ -89,7 +92,7 @@ jobs:
be-tests-athena-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.athena-should-run == 'true' || needs.determine-driver-skips.outputs.athena-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -140,7 +143,7 @@ jobs:
be-tests-bigquery-cloud-sdk-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.bigquery-should-run == 'true' || needs.determine-driver-skips.outputs.bigquery-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 60
strategy:
fail-fast: false
@@ -151,11 +154,10 @@ jobs:
:only-tags [:mb/driver-tests]
:exclude-tags [:mb/transforms-python-test]
:fail-fast? true
# DS 2025-09-26 temporarily disabled while we diagnose flakes
# - name: Transforms Python Tests
# test-args: >-
# :only-tags [:mb/transforms-python-test]
# needs-python-runner: true
- name: Transforms Python Tests
test-args: >-
:only-tags [:mb/transforms-python-test]
needs-python-runner: true
env:
CI: 'true'
DRIVERS: bigquery-cloud-sdk
@@ -213,7 +215,7 @@ jobs:
be-tests-clickhouse-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.clickhouse-should-run == 'true' || needs.determine-driver-skips.outputs.clickhouse-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
@@ -296,7 +298,7 @@ jobs:
be-tests-druid-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.druid-should-run == 'true' || needs.determine-driver-skips.outputs.druid-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -345,7 +347,7 @@ jobs:
be-tests-druid-jdbc-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.druid-jdbc-should-run == 'true' || needs.determine-driver-skips.outputs.druid-jdbc-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -394,7 +396,7 @@ jobs:
be-tests-databricks-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.databricks-should-run == 'true' || needs.determine-driver-skips.outputs.databricks-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -443,7 +445,7 @@ jobs:
be-tests-databricks-multi-catalog-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.databricks-should-run == 'true' || needs.determine-driver-skips.outputs.databricks-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -493,7 +495,7 @@ jobs:
be-tests-h2:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.h2-should-run == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -524,7 +526,7 @@ jobs:
be-tests-h2-oss:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.h2-should-run == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -556,27 +558,27 @@ jobs:
be-tests-mysql-mariadb:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.mysql-mariadb-should-run == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
version:
- name: MariaDB 10.2
junit-name: be-tests-mariadb-10-2-ee
image: circleci/mariadb:10.2.23
- name: MariaDB 10.6
junit-name: be-tests-mariadb-10-6-ee
image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-image
env:
enable-ssl-tests: 'false'
enable-aws-iam-tests: 'false'
- name: MariaDB Latest
junit-name: be-tests-mariadb-latest-ee
image: circleci/mariadb:latest
image: mariadb:latest
env:
enable-ssl-tests: 'false'
enable-aws-iam-tests: 'false'
- name: MySQL 8.0
junit-name: be-tests-mysql-8-0-ee
image: mysql:8.0
- name: MySQL 8.4
junit-name: be-tests-mysql-8-4-ee
image: mysql:8.4
env:
enable-ssl-tests: 'false'
enable-aws-iam-tests: 'false'
@@ -603,7 +605,7 @@ jobs:
- "3306:3306"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: circle_test
MYSQL_DATABASE: mb_test
env:
# Only run old migrations tests on pushes to master or release branches. All other branches should skip tests
# with the tag `mb/old-migrations-test`. `__ADDITIONAL_EXCLUDED_TAG__` is not used anywhere outside of splicing
@@ -626,7 +628,7 @@ jobs:
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_DBNAME: mb_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
#
@@ -693,7 +695,7 @@ jobs:
be-tests-mongo:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.mongo-should-run == 'true' || needs.determine-driver-skips.outputs.mongo-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
@@ -774,7 +776,7 @@ jobs:
be-tests-mongo-ssl:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.mongo-ssl-should-run == 'true' || needs.determine-driver-skips.outputs.mongo-ssl-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
@@ -851,7 +853,7 @@ jobs:
be-tests-mongo-sharded-cluster-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.mongo-sharded-cluster-should-run == 'true' || needs.determine-driver-skips.outputs.mongo-sharded-cluster-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -897,7 +899,7 @@ jobs:
be-tests-oracle:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.oracle-should-run == 'true' || needs.determine-driver-skips.outputs.oracle-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
@@ -983,15 +985,15 @@ jobs:
be-tests-postgres:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.postgres-should-run == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
version:
- name: Postgres 12.x
- name: Postgres 14.x
junit-name: postgres-ee
docker-image: postgres:12-alpine
docker-image: postgres:14-alpine
env:
enable-ssl-tests: 'false'
enable-aws-iam-tests: 'false'
@@ -1094,7 +1096,7 @@ jobs:
be-tests-presto-jdbc-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.presto-jdbc-should-run == 'true' || needs.determine-driver-skips.outputs.presto-jdbc-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -1176,7 +1178,7 @@ jobs:
be-tests-redshift-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.redshift-should-run == 'true' || needs.determine-driver-skips.outputs.redshift-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
strategy:
fail-fast: false
@@ -1267,7 +1269,7 @@ jobs:
be-tests-snowflake-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.snowflake-should-run == 'true' || needs.determine-driver-skips.outputs.snowflake-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 60
strategy:
fail-fast: false
@@ -1278,12 +1280,10 @@ jobs:
:only-tags [:mb/driver-tests]
:exclude-tags [:mb/transforms-python-test]
:fail-fast? true
# DS 2025-09-26 temporarily disabled while we diagnose flakes
# - name: Transforms Python Tests
# test-args: >-
# :only-tags [:mb/transforms-python-test]
# needs-python-runner: true
- name: Transforms Python Tests
test-args: >-
:only-tags [:mb/transforms-python-test]
needs-python-runner: true
env:
CI: 'true'
DRIVERS: snowflake
@@ -1350,7 +1350,7 @@ jobs:
be-tests-sparksql-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.sparksql-should-run == 'true' || needs.determine-driver-skips.outputs.sparksql-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -1397,7 +1397,7 @@ jobs:
be-tests-sqlite-ee:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.sqlite-should-run == 'true' || needs.determine-driver-skips.outputs.sqlite-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -1439,7 +1439,7 @@ jobs:
be-tests-sqlserver:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.sqlserver-should-run == 'true' || needs.determine-driver-skips.outputs.sqlserver-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
strategy:
fail-fast: false
@@ -1523,7 +1523,7 @@ jobs:
# be-tests-starburst-ee:
# needs: determine-driver-skips
# if: ${{ !inputs.skip && !(needs.determine-driver-skips.outputs.skip == 'true') }}
# runs-on: ubuntu-latest
# runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
# timeout-minutes: 40
# env:
# CI: 'true'
@@ -1561,7 +1561,7 @@ jobs:
login-to-ecr:
needs: determine-driver-skips
if: ${{ needs.determine-driver-skips.outputs.vertica-should-run == 'true' || needs.determine-driver-skips.outputs.vertica-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 15
permissions:
id-token: write
@@ -1591,7 +1591,7 @@ jobs:
be-tests-vertica-ee:
needs: [determine-driver-skips, login-to-ecr]
if: ${{ needs.determine-driver-skips.outputs.vertica-should-run == 'true' || needs.determine-driver-skips.outputs.vertica-quarantine-conflict == 'true' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: 'true'
@@ -1665,7 +1665,7 @@ jobs:
# TODO(rileythomp, 2025-08-20): Re-enable vertica tests once the docker image is updated
# - be-tests-vertica-ee
- be-tests-clickhouse-ee
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
name: drivers-tests-result
if: always() && !cancelled()

View File

@@ -21,7 +21,7 @@ on:
jobs:
build-matrix:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
outputs:
matrix: ${{ steps.matrix.outputs.config }}
@@ -47,7 +47,7 @@ jobs:
const inputSpecs = "${{ inputs.specs }}";
const inputChunks = Number(process.env.chunks);
const java = 21;
const defaultRunner = "ubuntu-22.04";
const defaultRunner = "${{ vars.DEFAULT_RUNNER_KEY }}";
const options = {
java,
defaultRunner,

View File

@@ -31,11 +31,16 @@ on:
type: boolean
required: false
default: true
fail_fast:
description: "Stop running remaining tests after the first failure"
type: boolean
required: false
default: false
jobs:
determine-test-type:
name: Determine test type
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
outputs:
type: ${{ steps.detect.outputs.type }}
@@ -53,7 +58,7 @@ jobs:
workflow-summary:
name: Stress test inputs
needs: [determine-test-type]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- name: Generate workflow summary
@@ -67,12 +72,13 @@ jobs:
echo '- `grep`: "${{ inputs.grep }}"' >> $GITHUB_STEP_SUMMARY
echo '- `qa_db`: "${{ inputs.qa_db }}"' >> $GITHUB_STEP_SUMMARY
echo '- `enable_network_throttling`: "${{ inputs.enable_network_throttling }}"' >> $GITHUB_STEP_SUMMARY
echo '- `fail_fast`: "${{ inputs.fail_fast }}"' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo 'triggered by: @${{ github.event.sender.login }}' >> $GITHUB_STEP_SUMMARY
stress-test-flake-fix:
needs: [determine-test-type]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 60
name: Stress test E2E flake fix
env:
@@ -144,6 +150,7 @@ jobs:
env:
GREP: ${{ github.event.inputs.grep }}
CYPRESS_BROWSER: ${{ steps.cypress-prep.outputs.chrome-path }}
FAIL_FAST: ${{ inputs.fail_fast }}
run: |
node e2e/runner/run_cypress_ci.js ${{ needs.determine-test-type.outputs.type }} \
--spec '${{ github.event.inputs.spec }}' \

View File

@@ -21,7 +21,7 @@ on:
runner:
required: false
type: string
default: ubuntu-22.04
default: ${{ vars.DEFAULT_RUNNER_KEY }}
total_chunks: # number of chunks
required: false
type: number
@@ -45,8 +45,9 @@ jobs:
name: e2e-tests-${{ inputs.name }}-${{ inputs.edition }}
env:
MB_EDITION: ${{ inputs.edition }}
# Any env starting with `CYPRESS_` will be available to all Cypress tests via `Cypress.env()`
# Example: you can get `CYPRESS_FOO` with `Cypress.env("FOO")`
# Sensitive env vars (tokens, secrets) starting with `CYPRESS_` are accessed via async `cy.env()`
# Example: `cy.env(["FOO"]).then(({ FOO }) => ...)`
# For non-sensitive config, use `Cypress.expose()` in cypress config instead (synchronous)
CYPRESS_MB_ALL_FEATURES_TOKEN: ${{ secrets.STAGING_MB_ALL_FEATURES_TOKEN }}
CYPRESS_MB_STARTER_CLOUD_TOKEN: ${{ secrets.STAGING_MB_STARTER_CLOUD_TOKEN }}
CYPRESS_MB_PRO_CLOUD_TOKEN: ${{ secrets.STAGING_MB_PRO_CLOUD_TOKEN }}

View File

@@ -24,7 +24,7 @@ jobs:
reset-e2e-test-comment:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- name: Remove test results comment
@@ -75,7 +75,7 @@ jobs:
collect-timings:
name: Collect E2E Timings
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
needs: e2e-tests
if: always() && !cancelled() && github.ref == 'refs/heads/master'
@@ -138,7 +138,7 @@ jobs:
e2e-tests-result:
needs:
- e2e-tests
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
name: e2e-tests-result
if: always() && !cancelled()

View File

@@ -12,15 +12,16 @@ env:
jobs:
sdk-component-tests:
name: "SDK component tests (React ${{ matrix.react-version }})"
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 45
strategy:
matrix:
react-version: [18, 19]
fail-fast: false
env:
# Any env starting with `CYPRESS_` will be available to all Cypress tests via `Cypress.env()`
# Example: you can get `CYPRESS_FOO` with `Cypress.env("FOO")`
# Sensitive env vars (tokens, secrets) starting with `CYPRESS_` are accessed via async `cy.env()`
# Example: `cy.env(["FOO"]).then(({ FOO }) => ...)`
# For non-sensitive config, use `Cypress.expose()` in cypress config instead (synchronous)
CYPRESS_MB_ALL_FEATURES_TOKEN: ${{ secrets.STAGING_MB_ALL_FEATURES_TOKEN }}
CYPRESS_MB_STARTER_CLOUD_TOKEN: ${{ secrets.STAGING_MB_STARTER_CLOUD_TOKEN }}
CYPRESS_MB_PRO_CLOUD_TOKEN: ${{ secrets.STAGING_MB_PRO_CLOUD_TOKEN }}
@@ -127,7 +128,7 @@ jobs:
await core.summary.addRaw(summary).write();
decide-target-ref:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
outputs:
target-ref: ${{ steps.get-target-ref.outputs.value }}
steps:
@@ -150,13 +151,14 @@ jobs:
sdk-component-tests-backward-compatibility:
name: "SDK component tests (Backward compatibility)"
needs: [decide-target-ref]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 45
env:
MB_RUN_MODE: "e2e"
METASTORE_DEV_SERVER_URL: ${{ secrets.METASTORE_DEV_SERVER_URL }}
# Any env starting with `CYPRESS_` will be available to all Cypress tests via `Cypress.env()`
# Example: you can get `CYPRESS_FOO` with `Cypress.env("FOO")`
# Sensitive env vars (tokens, secrets) starting with `CYPRESS_` are accessed via async `cy.env()`
# Example: `cy.env(["FOO"]).then(({ FOO }) => ...)`
# For non-sensitive config, use `Cypress.expose()` in cypress config instead (synchronous)
CYPRESS_MB_ALL_FEATURES_TOKEN: ${{ secrets.STAGING_MB_ALL_FEATURES_TOKEN }}
CYPRESS_MB_STARTER_CLOUD_TOKEN: ${{ secrets.STAGING_MB_STARTER_CLOUD_TOKEN }}
CYPRESS_MB_PRO_CLOUD_TOKEN: ${{ secrets.STAGING_MB_PRO_CLOUD_TOKEN }}

View File

@@ -12,7 +12,7 @@ env:
MB_EDITION: ee
jobs:
get-sample-apps-data:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
env:
# we must support the last two stable releases
@@ -88,12 +88,13 @@ jobs:
e2e-sample-apps-tests:
needs: [get-sample-apps-data]
strategy:
fail-fast: false
matrix:
test_suite: ${{ fromJSON(needs.get-sample-apps-data.outputs.matrix) }}
environment: ["production", "development"]
if: |
!cancelled() && needs.get-sample-apps-data.result == 'success'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 45
name: e2e-sample-app-${{ matrix.test_suite }}-tests-${{ matrix.environment }}-bundle
env:
@@ -194,12 +195,13 @@ jobs:
e2e-shoppy-tests:
needs: [get-sample-apps-data]
strategy:
fail-fast: false
matrix:
environment: ["production", "development"]
if: |
!cancelled() && needs.get-sample-apps-data.result == 'success' &&
(github.ref == 'refs/heads/master' || github.base_ref == 'master')
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 45
name: e2e-sample-app-shoppy-e2e-tests-${{ matrix.environment }}-bundle
env:
@@ -262,7 +264,7 @@ jobs:
!cancelled() && needs.get-sample-apps-data.result == 'success' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 45
name: e2e-shoppy-synthetic-monitoring-tests
env:
@@ -342,6 +344,7 @@ jobs:
# For more details see `Embedding SDK integration tests with Host Apps` in `enterprise/frontend/src/embedding-sdk-package/dev.md`
e2e-host-apps-tests:
strategy:
fail-fast: false
matrix:
test_suite:
[
@@ -351,7 +354,7 @@ jobs:
"angular-20-host-app-e2e",
]
environment: ["production", "development"]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 45
name: e2e-host-app-${{ matrix.test_suite }}-tests-${{ matrix.environment }}-bundle
env:

View File

@@ -10,7 +10,7 @@ on:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
frontend_embedding_sdk_package_sources: ${{ steps.changes.outputs.frontend_embedding_sdk_package_sources }}
@@ -29,7 +29,7 @@ jobs:
!cancelled() &&
(needs.files-changed.outputs.frontend_embedding_sdk_package_sources == 'true')
name: Embedding SDK package release-notes/no-release-notes label reminder
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

View File

@@ -10,7 +10,7 @@ concurrency:
jobs:
build-sdk-package:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 25
steps:
- uses: actions/checkout@v4

View File

@@ -39,7 +39,7 @@ concurrency:
jobs:
embedding-sdk-cli-snippets-type-check:
if: inputs.cli-snippets-type-check && !inputs.skip
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
@@ -55,7 +55,7 @@ jobs:
embedding-sdk-docs-snippets-type-check:
if: inputs.docs-snippets-type-check && !inputs.skip
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
@@ -71,7 +71,7 @@ jobs:
embedding-sdk-api-documentation-generation-validation:
if: inputs.documentation-validation && !inputs.skip
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
@@ -131,7 +131,7 @@ jobs:
embedding-sdk-bundle-size-check:
if: inputs.bundle-size-check
continue-on-error: true
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
env:
BUNDLE_SIZE_THRESHOLD_PERCENT: 2
@@ -156,11 +156,18 @@ jobs:
- name: Send notification to Slack via Zapier
if: success() && steps.compare.outputs.status == 'increased'
shell: bash
env:
ZAPIER_WEBHOOK_URL: ${{ secrets.EMBEDDING_ZAPIER_WEBHOOK_URL }}
SIZE_CHANGE_PERCENT: ${{ steps.compare.outputs.size_change_percent }}
BUNDLE_SIZE_THRESHOLD_PERCENT: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
curl -s -X POST "${{ secrets.EMBEDDING_ZAPIER_WEBHOOK_URL }}" \
-d '⚠️ Embedding SDK bundle size increased by ${{ steps.compare.outputs.size_change_percent }}% (threshold: ${{ env.BUNDLE_SIZE_THRESHOLD_PERCENT }}%)
curl -s -X POST "$ZAPIER_WEBHOOK_URL" \
-d "⚠️ Embedding SDK bundle size increased by ${SIZE_CHANGE_PERCENT}% (threshold: ${BUNDLE_SIZE_THRESHOLD_PERCENT}%)
PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }} (${{ github.event.pull_request.html_url }})'
PR #${PR_NUMBER} ${PR_TITLE} (${PR_URL})"
- name: Comment on PR if bundle size has decreased
uses: ./.github/actions/notify-pull-request
@@ -179,7 +186,7 @@ jobs:
- embedding-sdk-api-documentation-generation-validation
- embedding-sdk-component-tests
if: always() && !cancelled()
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
env:
needs: ${{ toJson(needs) }}

View File

@@ -7,7 +7,7 @@ on:
jobs:
on-escalation-label:
if: github.event.label.name == '.Escalation'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
steps:
- name: Format issue title (escape quotes)

View File

@@ -19,7 +19,7 @@ on:
jobs:
workflow-summary:
name: Stress test inputs
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- name: Generate workflow summary
@@ -34,7 +34,7 @@ jobs:
echo 'triggered by: @${{ github.event.sender.login }}' >> $GITHUB_STEP_SUMMARY
frontend-unit-test-stress-test-flake-fix:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 60
name: Stress test frontend unit test flake fix
steps:

View File

@@ -27,7 +27,7 @@ concurrency:
jobs:
fe-lint:
if: ${{ !inputs.skip-lint }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
@@ -58,7 +58,7 @@ jobs:
fe-type-check:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
@@ -73,7 +73,7 @@ jobs:
fe-tests-unit:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
strategy:
fail-fast: false
@@ -111,7 +111,7 @@ jobs:
fe-tests-timezones:
if: ${{ !inputs.skip }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
@@ -129,7 +129,7 @@ jobs:
- fe-tests-unit
- fe-tests-timezones
if: always() && !cancelled()
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
env:
needs: ${{ toJson(needs) }}

View File

@@ -24,7 +24,7 @@ on:
# TODO: Consider renaming the job in next milestones
jobs:
generative-query-test:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 90
name: Generative Query Test
env:

View File

@@ -14,7 +14,7 @@ concurrency:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
i18n: ${{ steps.changes.outputs.i18n }}
@@ -30,7 +30,7 @@ jobs:
verify-i18n-files:
needs: files-changed
if: needs.files-changed.outputs.i18n == 'true'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

View File

@@ -7,7 +7,7 @@ on:
jobs:
js-stats:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

View File

@@ -6,7 +6,7 @@ on:
jobs:
add-issue-references:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -21,7 +21,7 @@ on:
jobs:
detect-changed-stories:
name: Detect changed stories
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
outputs:
story_files: ${{ steps.detect.outputs.story_files }}
@@ -84,32 +84,40 @@ jobs:
name: Summary
needs: detect-changed-stories
if: needs.detect-changed-stories.outputs.should_run == 'true'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- name: Generate workflow summary
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
STORY_FILES: ${{ needs.detect-changed-stories.outputs.story_files }}
BURN_IN: ${{ inputs.burn_in || 50 }}
EVENT_NAME: ${{ github.event_name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_ACTOR: ${{ github.event.pull_request.user.login }}
ACTOR: ${{ github.actor }}
run: |
echo '## Loki Stress Test' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '**Branch:** `${{ github.head_ref || github.ref_name }}`' >> $GITHUB_STEP_SUMMARY
echo "**Branch:** \`${BRANCH_NAME}\`" >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '**Story files:**' >> $GITHUB_STEP_SUMMARY
echo '${{ needs.detect-changed-stories.outputs.story_files }}' | tr ',' '\n' | while read -r file; do
echo "${STORY_FILES}" | tr ',' '\n' | while read -r file; do
echo "- \`$file\`" >> $GITHUB_STEP_SUMMARY
done
echo '' >> $GITHUB_STEP_SUMMARY
echo '**Burn-in:** ${{ inputs.burn_in || 50 }} runs' >> $GITHUB_STEP_SUMMARY
echo "**Burn-in:** ${BURN_IN} runs" >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo 'Triggered by PR #${{ github.event.pull_request.number }} from @${{ github.event.pull_request.user.login }}' >> $GITHUB_STEP_SUMMARY
if [[ "${EVENT_NAME}" == "pull_request" ]]; then
echo "Triggered by PR #${PR_NUMBER} from @${PR_ACTOR}" >> $GITHUB_STEP_SUMMARY
else
echo 'Triggered manually by @${{ github.actor }}' >> $GITHUB_STEP_SUMMARY
echo "Triggered manually by @${ACTOR}" >> $GITHUB_STEP_SUMMARY
fi
stress-test-loki:
needs: detect-changed-stories
if: needs.detect-changed-stories.outputs.should_run == 'true'
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 60
name: Stress test Loki visual tests
services:

View File

@@ -7,7 +7,7 @@ on:
jobs:
check-label-and-update-snapshot:
if: contains(github.event.pull_request.labels.*.name, 'loki-update')
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

View File

@@ -7,7 +7,7 @@ on:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
frontend_ci: ${{ steps.changes.outputs.frontend_ci }}
@@ -25,7 +25,7 @@ jobs:
visual-test:
needs: files-changed
if: needs.files-changed.outputs.frontend_ci == 'true' || needs.files-changed.outputs.frontend_sources == 'true' || needs.files-changed.outputs.frontend_loki_ci == 'true'
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
services:
docker:
image: docker:19.03.12

View File

@@ -2,14 +2,11 @@ name: Mage Tests
on:
pull_request:
paths:
- "mage/**"
- "bb.edn"
jobs:
# run mage tests even if the rest of be isnt needed
mage-tests:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
name: Mage
steps:
- uses: actions/checkout@v4

View File

@@ -6,7 +6,7 @@ on:
- labeled
jobs:
on-issue-labeled:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
if: |
contains(github.event.issue.labels.*.name, 'Type:New Feature')

View File

@@ -11,7 +11,7 @@ on:
- src/metabase/lib/js.cljs
jobs:
mbql-library-changelog-check:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
if: ${{ !contains( github.event.pull_request.labels.*.name, '.metabase-lib/no-change' ) }}
steps:
# - uses: jesusvasquez333/verify-pr-label-action@v1.4.0

View File

@@ -10,7 +10,7 @@ on:
jobs:
lint-migrations:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

View File

@@ -11,7 +11,7 @@ concurrency:
jobs:
# Only run if the PR has the minimal-tests label
check-label:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 1
outputs:
should-run: ${{ steps.check.outputs.result }}
@@ -29,7 +29,7 @@ jobs:
postgres-app-db-test:
needs: check-label
if: needs.check-label.outputs.should-run == 'true'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: "true"
@@ -80,7 +80,7 @@ jobs:
postgres-driver-test:
needs: check-label
if: needs.check-label.outputs.should-run == 'true'
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
env:
CI: "true"
@@ -128,7 +128,7 @@ jobs:
frontend-unit-tests:
needs: check-label
if: needs.check-label.outputs.should-run == 'true'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
env:
JEST_JUNIT_OUTPUT_DIR: ./target/junit
@@ -163,7 +163,7 @@ jobs:
- postgres-app-db-test
- postgres-driver-test
- frontend-unit-tests
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
name: minimal-tests-result
if: always() && !cancelled()

View File

@@ -0,0 +1,80 @@
name: Module Boundaries Stats
on:
workflow_dispatch:
schedule:
- cron: 40 1 * * 5 # every Friday at 1:40
jobs:
module-boundaries-stats:
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: get module boundary stats
id: get-stats
run: |
NAMED_MODULES=$(node --input-type=module -e "
import { elements } from './frontend/lint/module-boundaries.mjs';
const named = elements.filter(e => !['shared/other', 'app/misc', 'other'].includes(e.type));
console.log(named.length);
")
NAMED_DIRS=$(node --input-type=module -e "
import { elements } from './frontend/lint/module-boundaries.mjs';
const dirs = new Set();
for (const el of elements) {
const m = el.pattern.match(/^frontend\/src\/metabase\/(\w[\w-]*)\//)
if (m) dirs.add(m[1]);
}
for (const d of dirs) console.log(d);
")
TOTAL_DIRS=$(ls -d frontend/src/metabase/*/ | xargs -I{} basename {} | wc -l | tr -d ' ')
NAMED_COUNT=$(echo "$NAMED_DIRS" | grep -c . || true)
UNMODULED=$(($TOTAL_DIRS - $NAMED_COUNT))
VIOLATIONS=$(bun run module-boundaries 2>&1 | grep -o '✖ [0-9]* problems' | grep -o '[0-9]*' || echo "0")
echo "$NAMED_MODULES modules, $UNMODULED unmoduled folders, $VIOLATIONS violations"
echo "NAMED_MODULES=$NAMED_MODULES" >> $GITHUB_OUTPUT
echo "UNMODULED=$UNMODULED" >> $GITHUB_OUTPUT
echo "VIOLATIONS=$VIOLATIONS" >> $GITHUB_OUTPUT
- name: Upload stats
uses: actions/github-script@v7
env:
NAMED_MODULES: ${{ steps.get-stats.outputs.NAMED_MODULES }}
UNMODULED: ${{ steps.get-stats.outputs.UNMODULED }}
VIOLATIONS: ${{ steps.get-stats.outputs.VIOLATIONS }}
API_KEY: ${{ secrets.STATS_API_KEY }}
with:
script: | # js
const { uploadCsvToMb } = require('${{ github.workspace }}/.github/scripts/csv-to-mb.js');
console.log("NAMED_MODULES", Number(process.env.NAMED_MODULES));
console.log("UNMODULED", Number(process.env.UNMODULED));
console.log("VIOLATIONS", Number(process.env.VIOLATIONS));
const data = [
{
'Date': new Date().toISOString().slice(0, 10), // YYYY-MM-DD
'Modules': Number(process.env.NAMED_MODULES),
'Unmoduled folders': Number(process.env.UNMODULED),
'Violations': Number(process.env.VIOLATIONS),
}
];
uploadCsvToMb({
baseUrl: 'https://stats.metabase.com',
tableId: 75146,
jsonData: data,
mode: 'append',
}).then(() => {
console.log('Data uploaded successfully');
}).catch((error) => {
console.error('Error uploading data:', error);
process.exit(1);
});

View File

@@ -10,7 +10,7 @@ concurrency:
jobs:
check-openapi-specs:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
if: contains(github.event.pull_request.labels.*.name, 'openapi-self-healing')
steps:
@@ -22,10 +22,8 @@ jobs:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
# fetch full git history to allow fetching the latest base branch commit and comparing changes
fetch-depth: 0
- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Prepare Node + Bun environment
uses: ./.github/actions/prepare-node-bun
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- name: Generate version.properties

View File

@@ -14,7 +14,7 @@ concurrency:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
openapi: ${{ steps.changes.outputs.openapi }}
@@ -30,7 +30,7 @@ jobs:
validate-openapi:
needs: files-changed
if: needs.files-changed.outputs.openapi == 'true'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

View File

@@ -7,7 +7,7 @@ on:
jobs:
optimize-images:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
if: ${{ contains(github.event.pull_request.labels.*.name,'Type:Documentation') }}
steps:
- name: Checkout repository

View File

@@ -5,7 +5,7 @@ on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
if: github.event.pull_request.head.repo.full_name == github.repository
name: Build Metabase Docker image
timeout-minutes: 60
@@ -47,7 +47,7 @@ jobs:
push: true
launch_perf_test:
needs: [ build ]
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
name: Launch Perf Test
permissions:
id-token: write

View File

@@ -14,7 +14,7 @@ on:
jobs:
approve:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
environment: pr-env-admin
steps:
- name: Approved

View File

@@ -19,7 +19,7 @@ env:
jobs:
destroy_pr:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
name: PR Review ENV Destroy
permissions:
id-token: write

View File

@@ -16,7 +16,7 @@ on:
default: false
jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
if: github.event.pull_request.head.repo.full_name == github.repository
name: Build Metabase Docker image
timeout-minutes: 60
@@ -58,7 +58,7 @@ jobs:
push: true
deploy_pr:
needs: [build]
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
name: PR Review ENV
permissions:
id-token: write
@@ -188,7 +188,7 @@ jobs:
--atomic \
--timeout 10m
preview_links:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
needs: [deploy_pr]
steps:
- uses: marocchino/sticky-pull-request-comment@v2

View File

@@ -25,7 +25,7 @@ on:
jobs:
test-mode-config:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
outputs:
run_mode: ${{ fromJson(steps.config.outputs.result).runMode }}
@@ -65,7 +65,7 @@ jobs:
});
release-artifact:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
strategy:
matrix:
@@ -110,7 +110,7 @@ jobs:
check-uberjar-health:
needs: [release-artifact]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
name: Is ${{ matrix.edition }} (java ${{ matrix.java-version }}) healthy?
timeout-minutes: 10
strategy:
@@ -136,7 +136,7 @@ jobs:
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
run-sanity-check:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 30
needs: [test-mode-config, release-artifact]
strategy:
@@ -258,14 +258,8 @@ jobs:
tests-complete-message:
if: always()
runs-on: ubuntu-22.04
needs:
[
run-sanity-check,
check-uberjar-health,
containerize-ee,
containerize-oss,
]
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
needs: [run-sanity-check, check-uberjar-health, containerize-ee, containerize-oss]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

View File

@@ -18,7 +18,7 @@ on:
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 3
outputs:
backend_presto_kerberos: ${{ steps.changes.outputs.backend_presto_kerberos }}
@@ -34,7 +34,7 @@ jobs:
run-presto-kerberos-test:
needs: files-changed
if: needs.files-changed.outputs.backend_presto_kerberos == 'true'
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 40
steps:
- name: Install babashka

View File

@@ -10,7 +10,7 @@ jobs:
external-reminder:
name: External PR Helper
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
permissions:
pull-requests: write

View File

@@ -7,38 +7,41 @@ on:
jobs:
notify-querying-on-call:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
if: |
(github.event.label.name == 'Priority:P0' || github.event.label.name == 'Priority:P1' || github.event.label.name == '.Escalation') &&
contains(github.event.issue.labels.*.name, '.Team/Querying')
steps:
- name: Setting title
uses: actions/github-script@v7
id: vars
with:
script: |
core.setOutput('issue_title', ${{ toJson(github.event.issue.title) }}.replaceAll(/"/g, '\\"'));
- name: Trigger PagerDuty Incident
env:
ROUTING_KEY: ${{ secrets.QUERYING_PAGERDUTY_INTEGRATION_KEY }}
ISSUE_TITLE: ${{ github.event.issue.title }}
LABEL_NAME: ${{ github.event.label.name }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_URL: ${{ github.event.issue.html_url }}
REPO: ${{ github.repository }}
ALL_LABELS: ${{ join(github.event.issue.labels.*.name, ', ') }}
run: |
payload=$(jq -n \
--arg rk "$ROUTING_KEY" \
--arg dk "github-issue-$ISSUE_NUMBER" \
--arg sum "[$LABEL_NAME] $ISSUE_TITLE" \
--arg src "GitHub Issues - $REPO" \
--arg lbl "$ALL_LABELS" \
--arg url "$ISSUE_URL" \
'{
routing_key: $rk,
event_action: "trigger",
dedup_key: $dk,
payload: {
summary: $sum,
source: $src,
severity: "critical",
custom_details: { Labels: $lbl }
},
links: [{ href: $url, text: "View GitHub Issue" }]
}')
curl -X POST https://events.pagerduty.com/v2/enqueue \
-H 'Content-Type: application/json' \
-d '{
"routing_key": "${{ secrets.QUERYING_PAGERDUTY_INTEGRATION_KEY }}",
"event_action": "trigger",
"dedup_key": "github-issue-${{ github.event.issue.number }}",
"payload": {
"summary": "[${{ github.event.label.name }}] ${{ steps.vars.outputs.issue_title }}",
"source": "GitHub Issues - ${{ github.repository }}",
"severity": "critical",
"custom_details": {
"Labels": "${{ join(github.event.issue.labels.*.name, ', ') }}"
}
},
"links": [
{
"href": "${{ github.event.issue.html_url }}",
"text": "View GitHub Issue"
}
]
}'
-d "$payload"

View File

@@ -0,0 +1,68 @@
name: Release Custom Viz Package
run-name: Release @metabase/custom-viz v${{ inputs.version }} from ${{ inputs.branch }}
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to release from"
type: string
required: true
default: "custom-viz"
version:
description: "Version to publish (e.g. 0.1.0)"
type: string
required: true
npm_tag:
description: "NPM dist-tag"
type: choice
required: true
default: "latest"
options:
- latest
- next
- canary
jobs:
build-and-publish:
runs-on: ubuntu-22.04
timeout-minutes: 20
defaults:
run:
working-directory: frontend/src/custom-viz
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Setup npm registry auth
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
- name: Set package version
run: npm version ${{ inputs.version }} --no-git-tag-version
- name: Build package
run: bun run build
- name: Publish to NPM
run: npm publish --tag ${{ inputs.npm_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}
- name: Generate workflow summary
run: |
tee -a $GITHUB_STEP_SUMMARY << EOF
## Published @metabase/custom-viz
- **Version**: ${{ inputs.version }}
- **Tag**: ${{ inputs.npm_tag }}
- **Branch**: ${{ inputs.branch }}
- **Triggered by**: @${{ github.event.sender.login }}
EOF

View File

@@ -21,7 +21,7 @@ concurrency:
jobs:
workflow-summary:
name: Log inputs
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- name: Generate workflow summary
@@ -37,7 +37,7 @@ jobs:
send-slack-notification-start:
name: "Send Slack notification: SDK release started"
needs: determine-sdk-version
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
outputs:
slackMessageId: ${{ steps.send-slack-message-start.outputs.result }}
@@ -96,7 +96,7 @@ jobs:
"publish-npm",
"git-tag",
]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
env:
slackMessageId: ${{ needs.send-slack-notification-start.outputs.slackMessageId }}
@@ -134,7 +134,7 @@ jobs:
name: "Send Slack notification: SDK release successful"
needs:
["determine-sdk-version", "send-slack-notification-start", "publish-npm"]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
env:
slackMessageId: ${{ needs.send-slack-notification-start.outputs.slackMessageId }}
@@ -168,7 +168,7 @@ jobs:
});
determine-sdk-version:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
outputs:
sdk_version: ${{ fromJson(steps.new-sdk-version.outputs.result).version }}
@@ -219,7 +219,7 @@ jobs:
check-git-tag:
needs: determine-sdk-version
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
env:
tag: embedding-sdk-${{ needs.determine-sdk-version.outputs.sdk_version }}
@@ -243,7 +243,7 @@ jobs:
test:
needs: check-git-tag
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
steps:
- name: Check out the code using the provided branch
@@ -262,7 +262,7 @@ jobs:
build-sdk:
needs: [test, determine-sdk-version]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
steps:
- name: Check out the code using the provided branch
@@ -297,7 +297,7 @@ jobs:
publish-npm:
needs: [build-sdk, determine-sdk-version]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
env:
sdk_version: ${{ needs.determine-sdk-version.outputs.sdk_version }}
@@ -398,7 +398,7 @@ jobs:
git-tag:
needs: [publish-npm, determine-sdk-version]
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 20
env:
tag: embedding-sdk-${{ needs.determine-sdk-version.outputs.sdk_version }}

View File

@@ -23,7 +23,7 @@ on:
jobs:
update-release-log:
runs-on: ubuntu-latest
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
# don't run this workflow for forks
if: ${{ github.event_name != 'push' || github.repository == 'metabase/metabase' }}

View File

@@ -15,7 +15,7 @@ on:
jobs:
check-milestone:
permissions: write-all
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

View File

@@ -11,7 +11,7 @@ on:
jobs:
preview-release-notes:
runs-on: ubuntu-22.04
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- name: Fail early on the incorrect version format

View File

@@ -5,22 +5,22 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Major Metabase version (e.g. 45, 52, 68)'
description: "Major Metabase version (e.g. 45, 52, 68)"
type: number
required: true
override_sha:
description: DANGEROUSLY allow releasing from this commit sha, regardless of the state of CI (can be empty)
type: string
required: false
default: ''
default: ""
schedule:
- cron: '0 21 * * 1-5' # every weekday at 4 pm EST/5 pm EDT
- cron: "0 21 * * 1-5" # every weekday at 4 pm EST/5 pm EDT
jobs:
auto-patch-trigger:
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'schedule' || (github.repository == 'metabase/metabase' && vars.ENABLE_AUTO_PATCH == 'true') }}
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

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