Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Oct 31, 2023
    • Cal Herries's avatar
      Unverified
      1c69bc24
    • Alexander Solovyov's avatar
      Return correct values for linked filters using non-equality filters (#34837) · 7c47e04b
      Alexander Solovyov authored
      `api.dashboard/chain-filter-constraints` now generates a list of constraints using a filter type defined (like
      `:string/!=` or `:number/between`). `chain-filter/filter-clause` down the call chain has no access
      to _dashboard_ data, but accepts operators like `:!=` and `:between` readily.
      Unverified
      7c47e04b
    • Kamil Mielnik's avatar
      Add test coverage for Dashboard Click Behavior - Table & Full app embedding (#35051) · f550f95a
      Kamil Mielnik authored
      * Reuse addOrUpdateDashboardCard
      
      * Extract 15993 repro
      
      * Extract 16334 repro
      
      * Extract 23137 repro
      
      * Extract 18067 repro
      
      * Remove unused alias
      
      * Add empty test suite for click-behavior
      
      * Add a test for text cards
      
      * Add createHeadingCard helper
      
      * Add a test for heading cards
      
      * Add createActionCard helper
      - make text/label params optional in helpers
      - remove unused dashboardId param in helpers
      
      * Add a test for an action card
      
      * Format code
      
      * Reuse createActionCard in #32974 repro
      
      * Simplify text code
      
      * Reuse createActionCard, createTextCard & getNextUnsavedDashboardCardId in dashboard back navigation e2e
      
      * Remove unused alias
      
      * Inline 1-line createLinkCard helper
      
      * Add createLinkCard helper
      
      * Add a test for link cards
      
      * Simplify interfaces of helper functions
      
      * Update test title
      
      * Add a test for object detail dashcard
      
      * Remove redundant identifier
      
      * Format code
      
      * Add data-testid to ClickBehaviorSidebar
      
      * Add setup for line chart test
      
      * Test the actual click behavior
      
      * Refactor expectDynamicAnchorClick to expectNextAnchorClick
      - get rid of manual mock resetting
      
      * Add test for editing URL filter
      
      * Refactor expectNextAnchorClick to onNextAnchorClick
      
      * Extract URL parameters test as a seprate one
      
      * Fix assertions
      - Add escapeCypressCurlyBraces
      
      * Assert user can use dashboard filters and click event columns
      
      * Use cy.get("aside") instead of sidebar functions
      - Revert adding data-testid to sidebars
      
      * Use all available parameters in the URL
      
      * Add test for 0 filters
      
      * Extract addFilter
      
      * Add a test for single dashboard filter
      - Add constants for magic numbers and values
      
      * Extract OBJECT_DETAIL_CHART
      
      * Use saveDashboard
      
      * Add a test for multiple dashboard filters
      
      * Improve URL assertion
      
      * Improve assertions
      
      * Format code
      
      * Add a test for saved question destination
      
      * Improve assertions
      
      * Consolidate assertions
      
      * Improve assertions
      
      * Add a test for saved question with single parameter passed
      
      * Update JSDoc
      
      * Extract GAUGE_QUESTION_DETAILS & PROGRESS_QUESTION_DETAILS
      
      * Reuse addOrUpdateDashboardCard
      
      * Add a test for saved question with multiple parameters passed
      
      * Extract FILTER_CREATED_AT & FILTER_COUNT
      
      * Do not use elevated privileges
      
      * Rename FILTER_COUNT to FILTER_QUANTITY
      
      * Reuse ORDERS_ID
      
      * Add a test for no saved question permissions
      
      * Create dashboard filters via API
      
      * Add a test
      
      * Add a test for dashboard target
      
      * Add test for 1 and multiple dashboard parameters
      
      * Extract addTextParameter & addTimeParameter
      
      * Improve assertions
      
      * Use different question as target
      
      * Use TARGET_QUESTION instead of SECRET_QUESTION
      
      * Add a test for no dashboard permissions
      
      * Add a test for drill-through menu behavior
      
      * Fix typo
      
      * Destructure location
      
      * Format code, remove console.log
      
      * Use slug instead of name where appropriate
      
      * Add a test case for editing the click behavior
      
      * Update comment
      
      * Commit a dumb change to trigger uberjar rebuild
      
      * Commit a dumb change to trigger uberjar rebuild
      
      * Optimize line chart question
      - add limit: 5
      - update constants & assertions
      - rename LINE_CHART to QUESTION_LINE_CHART
      - extract clickLastLineChartPoint as click({ force: true }) is now needed
      
      * Fix click simulation
      
      * Add first test for tables
      - extract assertDrillThroughMenuOpen
      
      * - extract clickLastTableCreatedAtCell
      - extract clickLastTableCountCell
      
      * Revert "Commit a dumb change to trigger uberjar rebuild"
      
      This reverts commit 27ef0600ad0dae1dec98bf1e7282e5872b7293e7.
      
      * Revert "Commit a dumb change to trigger uberjar rebuild"
      
      This reverts commit a5141eb020db0dc9bd2ca61d47bae98b435e80c8.
      
      * Add logs for clarity
      
      * Prepare single test case for all click behavior in table
      
      * Update labels
      
      * Remove year aggregation
      
      * Extract addCustomDashboardDestination
      
      * Extract addSavedQuestionDestination
      
      * Extract addSavedQuestionCreatedAtParameter and addSavedQuestionQuantityParameter
      
      * Fix assertions
      
      * Fix typo
      
      * Extract helpers
      
      * Extract addUrlDestination
      
      * Add more assertions
      
      * Remove redundant indentation
      
      * Reduce indentation, remove redundant assertions
      
      * Chain assertions
      
      * Chain assertions
      
      * Add test for URL click
      
      * Rename test case
      
      * Use parseSpecialCharSequences and get rid of escapeCypressCurlyBraces
      
      * Assert dashboard pathname
      
      * Remove pointless assertions
      
      * Sort tests
      
      * Test reverting to default click behavior
      
      * Handle month column first
      
      * Format code
      
      * Remove redundant assertions
      
      * Move assertions closer to tests
      
      * Add test for dashboard mapping
      
      * Refactor clickTableCell into getTableCell
      
      * Update post-merge conflicts
      
      * Update post-merge conflicts
      
      * Fix test crashing
      
      * Add custom link text assertions
      
      * Add full app embedding tests
      
      * Add a test for URL
      
      * Format code
      
      * Add test for custom question destination
      
      * Add a test for passing question parameters, skip other failing tests
      
      * Add test for updating dashboard filters in embedding
      
      * Add an edge case test
      
      * Add missing attributes
      
      * Add missing assertion
      
      * Format code
      
      * Fix failing test
      
      * Fix failing test
      
      * Update tests to account for disallowing targeting saved questions & dashboards in embedding context
      - see https://metaboat.slack.com/archives/C01LQQ2UW03/p1698669573035739
      Unverified
      f550f95a
    • Ngoc Khuat's avatar
      Drop parameter_card.entity_id (#35134) · e9c2d108
      Ngoc Khuat authored
      Unverified
      e9c2d108
    • Ngoc Khuat's avatar
  2. Oct 30, 2023
    • shaun's avatar
      Unverified
      6e5fc510
    • lbrdnk's avatar
      Add percentile capabilities to sqlserver -- do not merge plz (#34783) · 2a763bfa
      lbrdnk authored
      * Add percentile capabilities to sqlserver
      
      * Bind sqlserver percentile capabilities to version
      
      * Modify version retrieval
      
      Take advantage of `db` containing `:dbms_version`.
      
      * Extend honeysql with `::approx-percentile-cont`
      
      Use `fn-handler` to extend honeysql instead of a `raw`.
      Unverified
      2a763bfa
    • lbrdnk's avatar
      Add `prettify-native-form` driver multimethod and refactor `mdb.query/format-sql` (#34991) · e6fd2ed2
      lbrdnk authored
      * Add multimethod to pretty-format native form
      
      `driver/prettify-native-form` is added. It is added to `driver`
      namespace, even though at the time of writing there is no need
      to pretty format nosql, eg. mongo, but this way branchings,
      as present in `dataset/native`, or rather `mbql.query/format-sql`
      can be avoided.
      
      * Move and update `mdb.query/format-sql`
      
      * Add `prettify-native-form` sql implementation
      
      * Refactor endpoint `/dataset/native`
      
      * Update docstring in `prettify-native-form`
      
      `prettify-native-form`has now docstring explaining its relationship
      to `sql.u/format-sql`.
      
      * Update tests
      
      * Refactor references in sql-jdbc code
      
      * Implement `prettify-native-form`in drivers
      
      - sqlserver
      - oracle
      - bigquery-cloud-sdk
      
      * Update test format-sql references
      
      * Refactor modules use of format-sql
      
      * Correct whitespace
      
      * Correct whitespace for bigquery
      
      * Update test
      
      Make `nonsql-dialects-return-original-query-test` run only for mongo
      as it now requires initialized mongo driver - mongo paths on class path.
      
      * Update docstring (review suggestions)
      
      For `prettify-native-form`.
      
      * Update docstring (review suggestion)
      
      For `mdb.query/format-sql`.
      
      * Whitespace (review suggestions)
      
      * Update docs (review suggestions)
      Unverified
      e6fd2ed2
    • Uladzimir Havenchyk's avatar
    • Ryan Laurie's avatar
      Automate reordering release tags (#35105) · 03b5b858
      Ryan Laurie authored
      Unverified
      03b5b858
    • John Swanson's avatar
      Clarify stacktraces from malli validation errors (#34712) · 1a0f2d65
      John Swanson authored
      * Improve stacktraces for validation errors in malli-instrumented fns
      
      First, when we throw exceptions in `metabase.util.malli/validate`, manually edit the stacktrace to remove those
      StackTraceElements that start with `metabase.util.malli.fn`.
      
      Second, instead of rewriting `mu/fn` bodies like so:
      
      ```
      (let [f& ...] (fn [args] (do-validation) (f& args)))
      ```
      
      Rewrite them like this:
      
      ```
      (fn [args] (do-validation) ((fn [args'] ...) args))
      ```
      
      I wasn't entirely sure that this wouldn't have a negative performance impact, so I tested it with these toy examples:
      
      ```
      (def option-1
        (let [f (fn [x] (+ x 10))]
          (fn [x]
            (f x))))
      
      (def option-2
        (fn [x]
          ((fn [x'] (+ x 10)) x)))
      ```
      
      Then evaluated them with Criterium to benchmark.
      
      The first option (our current behavior) looked like this:
      
      ```
      Evaluation count : 10184236800 in 60 samples of 169737280 calls.
            Execution time sample mean : 4.117003 ns
                   Execution time mean : 4.117119 ns
      Execution time sample std-deviation : 0.017140 ns
          Execution time std-deviation : 0.017686 ns
         Execution time lower quantile : 4.100963 ns ( 2.5%)
         Execution time upper quantile : 4.149603 ns (97.5%)
                         Overhead used : 1.783065 ns
      ```
      
      The second option (the new behavior) looked like this:
      
      ```
      Evaluation count : 13861192260 in 60 samples of 231019871 calls.
            Execution time sample mean : 2.553532 ns
                   Execution time mean : 2.553510 ns
      Execution time sample std-deviation : 0.019674 ns
          Execution time std-deviation : 0.019824 ns
         Execution time lower quantile : 2.524266 ns ( 2.5%)
         Execution time upper quantile : 2.599826 ns (97.5%)
                         Overhead used : 1.783065 ns
      ```
      
      So overall the performance does not look to be worse and may actually be slightly better.
      
      In the end, we end up with stacktraces like:
      
      ```
      (mu/defn bad-input :- :string
        [x :- :int]
        (str x))
      
      (mu/defn bad-output :- :string
        [x :- :int]
        x)
      
      (defn call-bad-input []
        (bad-input "1"))
      
      (call-bad-input)
      
      ;;   Invalid input: ["should be an integer"]
      ;;   {:type :metabase.util.malli.fn/invalid-input,
      ;;    :error {:schema :int, :value "1", :errors ({:path [], :in [], :schema :int, :value "1"})},
      ;;    :humanized ["should be an integer"],
      ;;    :schema :int,
      ;;    :value "1",
      ;;    :fn-name playground/bad-input}
      ;;                      REPL:   19  playground/bad-input
      ;;                      REPL:   19  playground/bad-input
      ;;                      REPL:   28  playground/call-bad-input
      ;;                      REPL:   27  playground/call-bad-input
      
      (defn call-bad-output []
        (bad-output 1))
      
      (call-bad-output)
      
      ;;   Invalid output: ["should be a string"]
      ;;   {:type :metabase.util.malli.fn/invalid-output,
      ;;    :error {:schema :string, :value 1, :errors ({:path [], :in [], :schema :string, :value 1})},
      ;;    :humanized ["should be a string"],
      ;;    :schema :string,
      ;;    :value 1,
      ;;    :fn-name playground/bad-output}
      ;;                      REPL:   23  playground/bad-output
      ;;                      REPL:   23  playground/bad-output
      ;;                      REPL:   31  playground/call-bad-output
      ;;                      REPL:   30  playground/call-bad-output
      ```
      Unverified
      1a0f2d65
    • Luis Paolini's avatar
    • Tim Macdonald's avatar
      Add ::offset-datetime support for CSV uploads (#34826) · 502ad0cd
      Tim Macdonald authored
      * varchar_255 -> varchar-255
      
      * Add ::offset-datetime support for CSV uploads
      
      * Use appropriate TZ logic for MySQL
      
      * Now with more whitespace tolerance
      
      * Handle OffsetDateTimes properly in MySQL export
      
      * Make MySQL handle 0-offset datetimes
      
      * Fix OffsetDateTimes for MariaDB uploads
      Unverified
      502ad0cd
    • Nicolò Pretto's avatar
      [Move dashcard to another tab] milestone 2 - undo logic (#34961) · e416d464
      Nicolò Pretto authored
      
      * undo logic
      
      * test(e2e): e2e test for undo dashcard to tab movement
      
      * Revert "test(e2e): e2e test for undo dashcard to tab movement"
      
      This reverts commit 050817b895022336753128c27e00c91aa56adea7.
      
      * better e2e test for undoing
      
      * self review new lines
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarMahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
      
      * destTabId -> destinationTabId
      
      * undo moved into thunk
      
      * use checkNotNull
      
      * throw Error -> throw new Error for consistency
      
      * Update e2e/test/scenarios/dashboard/tabs.cy.spec.js
      
      Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
      
      * change toast to match figma
      
      * ??= operator
      
      * Revert "undo moved into thunk"
      
      This reverts commit 753a7d9357af4bec12616a5e379388d06594a581.
      
      * restored design from figma after revert
      
      * address pr feedback
      
      * fix import after rebase on master
      
      * Revert "address pr feedback"
      
      This reverts commit bea6a27511358b87c4d95367d5952f43e3fe1276.
      
      * re-implement part of the feedback
      
      * wip refactor to use thunk and avoid global redux state
      
      * refactor: removed unused code + used selector
      
      ---------
      
      Co-authored-by: default avatarMahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
      Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
      Unverified
      e416d464
    • Mark Bastian's avatar
      Fixing cell queries with a temporal unit of year (#35175) · cd7f82d4
      Mark Bastian authored
      Fixing situations where a cell queries with a temporal unit of year produced nulls in description strings like:
      
       "A closer look at number of Orders where null of Created At is 2025"
      
      The simple fix was just to add `:year` to the `unit-name` function in
      `metabase.automagic-dashboards.names`. In addition to adding a unit
      test for this case, several other temporal units were added to the test.
      
      This fixes https://github.com/metabase/metabase/issues/35170.
      Unverified
      cd7f82d4
    • Braden Shepherdson's avatar
      [MLv2] Add underlying-records drill and `top-level-query` machinery (#34450) · e1850459
      Braden Shepherdson authored
      This adds the `underlying-records` drill, the one that allows you to click an aggregation (possibly with a breakout)
      and see the raw table rows with appropriate filtering.
      
      Removes some hacks in how dimensions are handled by drill-thru, and
      fixes up some tests accordingly. This changed the format of
      `zoom-in.timeseries` drills somewhat.
      
      Also adds `dev.fe-helpers` for inspecting the current query in the CLJS
      REPL.
      
      Resolves #34233
      Unverified
      e1850459
    • Mark Bastian's avatar
      Add humanize-filter-value implementations for inequality operators to fix 30350 (#35101) · 6ca62be4
      Mark Bastian authored
      * I was able to reproduce this in the UI as well as by adding the `">"`, `"<"`, `">="`, and `"<="` clauses to the `cell-title-test` in `metabase.automagic-dashboards.names-test`.
      
      The fix is to add the following `humanize-filter-value` implementations:
      
      ```clojure
      (defmethod humanize-filter-value :>=
        [root [_ field-reference value]]
        (let [field      (magic.util/field-reference->field root field-reference)
              field-name (field-name field)]
          (if (isa? ((some-fn :effective_type :base_type) field) :type/Temporal)
            (tru "{0} is at least {1}" field-name (humanize-datetime value (:unit field)))
            (tru "{0} is at least {1}" field-name value))))
      
      (defmethod humanize-filter-value :>
        [root [_ field-reference value]]
        (let [field      (magic.util/field-reference->field root field-reference)
              field-name (field-name field)]
          (if (isa? ((some-fn :effective_type :base_type) field) :type/Temporal)
            (tru "{0} is greater than {1}" field-name (humanize-datetime value (:unit field)))
            (tru "{0} is greater than {1}" field-name value))))
      
      (defmethod humanize-filter-value :<=
        [root [_ field-reference value]]
        (let [field      (magic.util/field-reference->field root field-reference)
              field-name (field-name field)]
          (if (isa? ((some-fn :effective_type :base_type) field) :type/Temporal)
            (tru "{0} is at most {1}" field-name (humanize-datetime value (:unit field)))
            (tru "{0} is at most {1}" field-name value))))
      
      (defmethod humanize-filter-value :<
        [root [_ field-reference value]]
        (let [field      (magic.util/field-reference->field root field-reference)
              field-name (field-name field)]
          (if (isa? ((some-fn :effective_type :base_type) field) :type/Temporal)
            (tru "{0} is less than {1}" field-name (humanize-datetime value (:unit field)))
            (tru "{0} is less than {1}" field-name value))))
      ```
      
      With these in place, both the unit tests pass and the UI reproduction now produces the right result.
      
      * Incorporated suggestions for humanized >= and <= wording for numeric and date values.
      
      Added unit tests for humanized data comparisons.
      
      * Updated comment string
      
      * Added a default case for `humanize-filter-value` of "{0} relates to {1}".
      
      IDK if there's anything better, but for now it's something.
      Unverified
      6ca62be4
    • Cal Herries's avatar
    • Cal Herries's avatar
    • Cal Herries's avatar
    • dpsutton's avatar
      Bump ring-jetty9-adapter to 0.22.3 (#35181) · 90867d89
      dpsutton authored
      ```diff
      -  info.sunng/ring-jetty9-adapter            {:mvn/version "0.22.1"}             ; Drop-in replacement for official Ring Jetty adapter. Supports Jetty 11 webserver.
      +  info.sunng/ring-jetty9-adapter            {:mvn/version "0.22.3"}             ; Drop-in replacement for official Ring Jetty adapter. Supports Jetty 11 webserver.
      ```
      
      Simple change, and quite possibly a no-op.
      
      We have previously been overriding the jetty dep to be
      
      ```clojure
      org.eclipse.jetty/jetty-server            {:mvn/version "11.0.17"}
      ```
      
      And the dep tree before this change was:
      
      ```
      info.sunng/ring-jetty9-adapter 0.22.1
        X ring/ring-core 1.10.0 :use-top
        X org.eclipse.jetty/jetty-server 11.0.15 :use-top
      ```
      
      This is saying it declared a dep on 11.0.15 but was ignoring that in
      favor of "use-top", aka the top level dependency we declared (11.0.17).
      
      But synk is a scanning tool that doesn't check the artifact but the
      manifests involved and flags issues in 11.0.15 and therefore Metabase
      despite us not having that version.
      
      Now the deps tree:
      
      ```
      clj -X:deps tree :aliases '[:ee :drivers]'
      info.sunng/ring-jetty9-adapter 0.22.3
        X org.eclipse.jetty/jetty-server 11.0.17 :use-top
      ```
      
      Doesn't specify an older version of jetty and we're using the same jetty
      version as we have for the last bit.
      Unverified
      90867d89
    • Kamil Mielnik's avatar
      Add test coverage for Dashboard Click Behavior - Line Chart (#34899) · 13424d36
      Kamil Mielnik authored
      * Reuse addOrUpdateDashboardCard
      
      * Extract 15993 repro
      
      * Extract 16334 repro
      
      * Extract 23137 repro
      
      * Extract 18067 repro
      
      * Remove unused alias
      
      * Add empty test suite for click-behavior
      
      * Add a test for text cards
      
      * Add createHeadingCard helper
      
      * Add a test for heading cards
      
      * Add createActionCard helper
      - make text/label params optional in helpers
      - remove unused dashboardId param in helpers
      
      * Add a test for an action card
      
      * Format code
      
      * Reuse createActionCard in #32974 repro
      
      * Simplify text code
      
      * Reuse createActionCard, createTextCard & getNextUnsavedDashboardCardId in dashboard back navigation e2e
      
      * Remove unused alias
      
      * Inline 1-line createLinkCard helper
      
      * Add createLinkCard helper
      
      * Add a test for link cards
      
      * Simplify interfaces of helper functions
      
      * Update test title
      
      * Add a test for object detail dashcard
      
      * Remove redundant identifier
      
      * Format code
      
      * Add data-testid to ClickBehaviorSidebar
      
      * Add setup for line chart test
      
      * Test the actual click behavior
      
      * Refactor expectDynamicAnchorClick to expectNextAnchorClick
      - get rid of manual mock resetting
      
      * Add test for editing URL filter
      
      * Refactor expectNextAnchorClick to onNextAnchorClick
      
      * Extract URL parameters test as a seprate one
      
      * Fix assertions
      - Add escapeCypressCurlyBraces
      
      * Assert user can use dashboard filters and click event columns
      
      * Use cy.get("aside") instead of sidebar functions
      - Revert adding data-testid to sidebars
      
      * Use all available parameters in the URL
      
      * Add test for 0 filters
      
      * Extract addFilter
      
      * Add a test for single dashboard filter
      - Add constants for magic numbers and values
      
      * Extract OBJECT_DETAIL_CHART
      
      * Use saveDashboard
      
      * Add a test for multiple dashboard filters
      
      * Improve URL assertion
      
      * Improve assertions
      
      * Format code
      
      * Add a test for saved question destination
      
      * Improve assertions
      
      * Consolidate assertions
      
      * Improve assertions
      
      * Add a test for saved question with single parameter passed
      
      * Update JSDoc
      
      * Extract GAUGE_QUESTION_DETAILS & PROGRESS_QUESTION_DETAILS
      
      * Reuse addOrUpdateDashboardCard
      
      * Add a test for saved question with multiple parameters passed
      
      * Extract FILTER_CREATED_AT & FILTER_COUNT
      
      * Do not use elevated privileges
      
      * Rename FILTER_COUNT to FILTER_QUANTITY
      
      * Reuse ORDERS_ID
      
      * Add a test for no saved question permissions
      
      * Create dashboard filters via API
      
      * Add a test
      
      * Add a test for dashboard target
      
      * Add test for 1 and multiple dashboard parameters
      
      * Extract addTextParameter & addTimeParameter
      
      * Improve assertions
      
      * Use different question as target
      
      * Use TARGET_QUESTION instead of SECRET_QUESTION
      
      * Add a test for no dashboard permissions
      
      * Add a test for drill-through menu behavior
      
      * Fix typo
      
      * Destructure location
      
      * Format code, remove console.log
      
      * Use slug instead of name where appropriate
      
      * Add a test case for editing the click behavior
      
      * Update comment
      
      * Commit a dumb change to trigger uberjar rebuild
      
      * Commit a dumb change to trigger uberjar rebuild
      
      * Optimize line chart question
      - add limit: 5
      - update constants & assertions
      - rename LINE_CHART to QUESTION_LINE_CHART
      - extract clickLastLineChartPoint as click({ force: true }) is now needed
      
      * Fix click simulation
      
      * Revert "Commit a dumb change to trigger uberjar rebuild"
      
      This reverts commit 27ef0600ad0dae1dec98bf1e7282e5872b7293e7.
      
      * Revert "Commit a dumb change to trigger uberjar rebuild"
      
      This reverts commit a5141eb020db0dc9bd2ca61d47bae98b435e80c8.
      
      * Extract helpers
      
      * Reduce indentation, remove redundant assertions
      
      * Chain assertions
      
      * Rename test case
      
      * Use parseSpecialCharSequences and get rid of escapeCypressCurlyBraces
      
      * Assert dashboard pathname
      
      * Remove pointless assertions
      
      * Sort tests
      
      * Test reverting to default click behavior
      
      * Update post-merge conflicts
      
      * Update post-merge conflicts
      Unverified
      13424d36
  3. Oct 29, 2023
  4. Oct 28, 2023
  5. Oct 27, 2023
  6. Oct 26, 2023
    • dpsutton's avatar
      Suppress some route logs on startup (#35120) · 19f6d315
      dpsutton authored
      Annoying warnings on startup
      
      ;#### Before
      
      ```shell
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/rule/:prefix/:dashboard-template [prefix Prefix]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/rule/:prefix/:dashboard-template [dashboard-template DashboardTemplate]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/cell/:cell-query [cell-query Base64EncodedJSON]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/cell/:cell-query/rule/:prefix/:dashboard-template [prefix Prefix]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/cell/:cell-query/rule/:prefix/:dashboard-template [dashboard-template DashboardTemplate]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/cell/:cell-query/rule/:prefix/:dashboard-template [cell-query Base64EncodedJSON]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/rule/:prefix/:dashboard-template/compare/:comparison-entity/:comparison-entity-id-or-query [prefix Prefix]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/rule/:prefix/:dashboard-template/compare/:comparison-entity/:comparison-entity-id-or-query [dashboard-template DashboardTemplate]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/cell/:cell-query/compare/:comparison-entity/:comparison-entity-id-or-query [cell-query Base64EncodedJSON]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/cell/:cell-query/rule/:prefix/:dashboard-template/compare/:comparison-entity/:comparison-entity-id-or-query [prefix Prefix]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/cell/:cell-query/rule/:prefix/:dashboard-template/compare/:comparison-entity/:comparison-entity-id-or-query [dashboard-template DashboardTemplate]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:entity/:entity-id-or-query/cell/:cell-query/rule/:prefix/:dashboard-template/compare/:comparison-entity/:comparison-entity-id-or-query [cell-query Base64EncodedJSON]
       Either add :fn to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:key [key kebab-cased-keyword]
       Either add :keyword to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:key [key kebab-cased-keyword]
       Either add :keyword to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:zoom/:x/:y/:lat-field/:lon-field [lat-field :string]
       Either add :string to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
       Warning: missing route-param regex for schema: /:zoom/:x/:y/:lat-field/:lon-field [lon-field :string]
       Either add :string to metabase.api.common.internal/->matching-regex or metabase.api.common.internal/no-regex-schemas.
      ```
      
      ;#### After
      
      ;#### Fixes
      
      ;###### :fn
      
      We logged lots of startups that we didn't have a regex for the `:fn` type validator in routes. And this is generally not possible. So we should generally just ignore function based validators, as we're not going to write a regex for what a function validates/accepts. All of these `:fn` matchers are in the x-ray namespace matching base64 encoded json, an existing dashboard template prefix (`(malli.core/validate Prefix "TransactionTable")`),
      
      ;###### `:keyword`: Add a regex `#"[\S]+"` that just looks for non space characters
      
      ;###### String matches `:string`
      
      ```clojure
      (def ^:private kebab-cased-keyword
        "Keyword that can be transformed from \"a_b\" -> :a-b"
        [:keyword {:decode/json #(keyword (u/->kebab-case-en %))}])
      
      ...
      
      (api/defendpoint GET "/:key"
        "Fetch a single `Setting`."
        [key]
        {key kebab-cased-keyword}
        (with-setting-access-control
          (setting/user-facing-value key)))
      ```
      
      We don't want a regex for this. Whatever we are currently accepting in the route matching is our desired behavior. Arbitrary strings don't have a good regex and we don't want to restrict what the route currently does.
      
      ```clojure
      (api/defendpoint GET "/:zoom/:x/:y/:lat-field/:lon-field"
        "This endpoints provides an image with the appropriate pins rendered given a MBQL `query` (passed as a GET query
        string param). We evaluate the query and find the set of lat/lon pairs which are relevant and then render the
        appropriate ones. It's expected that to render a full map view several calls will be made to this endpoint in
        parallel."
        [zoom x y lat-field lon-field query]
        {zoom        ms/Int
         x           ms/Int
         y           ms/Int
         lat-field   :string
         lon-field   :string
         query       ms/JSONString} ...)
      ```
      Unverified
      19f6d315
    • Oisin Coveney's avatar
    • Denis Berezin's avatar
      Fix entities fetch caching (#34661) · adb2df0c
      Denis Berezin authored
      * Fix entities fetch caching
      
      * Add proper unit test, fix loop issue
      
      * Review fixes, unit test fix
      Unverified
      adb2df0c
    • lbrdnk's avatar
      Support interval subtraction in expressions (#34752) · 25d7129c
      lbrdnk authored
      * Update sql qp to handle interval subtraction
      
      * Update tests checking interval subtraction
      
      * Transform assertions to exceptions
      Unverified
      25d7129c
Loading