Skip to content

[Discover sessions as Code] Default-on discover.embeddableTransforms#260945

Merged
lukasolson merged 4 commits into
elastic:mainfrom
lukasolson:discover-embeddable-transforms-default-on
Apr 7, 2026
Merged

[Discover sessions as Code] Default-on discover.embeddableTransforms#260945
lukasolson merged 4 commits into
elastic:mainfrom
lukasolson:discover-embeddable-transforms-default-on

Conversation

@lukasolson
Copy link
Copy Markdown
Contributor

@lukasolson lukasolson commented Apr 2, 2026

Summary

Implements #260103.

When the discover.embeddableTransforms feature flag is unset, Kibana now defaults to enabled (declarative Discover session panel shape / dashboards-as-code alignment). Setting the flag explicitly to false continues to use the legacy transformOut path.

Changes

  • Server: initial embeddableTransformsEnabled matches the default; getBooleanValue$ already used this field as fallback.
  • Public: getEmbeddableTransformsEnabled() uses the same default for getBooleanValue when the flag is unset.
  • Tests: createDiscoverServicesMock returns true for embeddable transforms to mirror production default; tests that need legacy behavior still override the mock.

Acceptance criteria

  • Fresh installs / unset flag → embeddable transforms enabled.
  • Explicit false still disables new path (legacy unchanged).
  • No removal of legacyTransformOut or flag key.

Closes #260103

Made with Cursor

@lukasolson lukasolson requested a review from a team as a code owner April 2, 2026 14:21
@lukasolson lukasolson self-assigned this Apr 2, 2026
@lukasolson lukasolson added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Project:Dashboards API labels Apr 2, 2026
Use true as the fallback for unset flags in server state, getBooleanValue$,
and client getEmbeddableTransformsEnabled. Explicit false keeps legacy path.

The discover services test mock returns true to match production default.

Refs elastic#260103

Made-with: Cursor
Copy link
Copy Markdown
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Approving now so it's ready assuming we're enabling it. I think we should try to get that unsaved changes bug in dashboard fixed first though.

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #2 / should call onSelectionChange on user selection

Metrics [docs]

✅ unchanged

History

cc @lukasolson

@lukasolson lukasolson merged commit f5b61cc into elastic:main Apr 7, 2026
18 checks passed
lukasolson added a commit that referenced this pull request Apr 8, 2026
)

### Summary

Closes #260804.
Related to #260945.

### Problem

With **`discover.embeddableTransforms`** enabled, opening a dashboard
that includes Discover session panels could mark the dashboard as
**dirty immediately**, even though nothing was edited ([issue
#260804](#260804)).

### Solution

- Pass **`defaultState`** into `initializeUnsavedChanges` so comparator
inputs fall back to the same defaults when a key is absent on **last
saved** or **current** serialized state:
- **Transforms / sessions shape:** `selected_tab_id` → first tab id when
present.
- **Legacy saved-search shape:** `selectedTabId` plus other embeddable
defaults (`sort`, `grid`, and values from
`getSearchEmbeddableDefaults(uiSettings)`) so omitted persisted fields
align with what we serialize at runtime.
- **Remove** the bespoke `compareSelectedTabId` helper;
**`referenceEquality`** on the tab id fields is sufficient once
`defaultState` supplies the default tab id.
- **Refactor** Discover-specific comparator maps into
**`get_search_embeddable_comparators.ts`**
(`getSearchEmbeddableComparators` /
`getDiscoverSessionEmbeddableComparators`) and **add unit tests**

### How to verify

1. Enable **`discover.embeddableTransforms`**.
2. Open a dashboard that contains Discover session (by-reference) panels
that do **not** persist an explicit selected tab (or match the scenario
from the issue).
3. Confirm the dashboard **does not** show unsaved changes on load until
something is actually edited.

---------

Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
nickpeihl added a commit that referenced this pull request Apr 8, 2026
…cal Preview (#256302)

Fixes #256073

## Summary

Introduces the Dashboard API endpoints as Technical Preview

Dashboard API documentation will be published as OpenAPI specifications
and available in the [Kibana API
Documentation](https://www.elastic.co/docs/api/doc/kibana/). Dashboard
API create/update endpoints are initially limited to a select few types
including Lens, markdown, synthetics, and SLO panels. Support for
additional panel types will be available in future updates.

## OAS documentation
To build documentation bundle for public route
* Add `server.oas.enabled: true` to `config/kibana.dev.yml`
* Run `node scripts/capture_oas_snapshot --include-path /api/dashboards
--no-serverless --update`

### Blocked by

- [x] #259670
- [x] #259461
- [x] #260040
- [x] #261186
- [x] #260945

---------

Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Project:Dashboards API release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover sessions as Code] Default-on feature flag

5 participants