Skip to content

[Discover Sessions as Code] Integrate simplified filter schemas - fix type errors & add round-trip tests#257484

Closed
lukasolson wants to merge 12 commits into
elastic:mainfrom
lukasolson:discover_sessions_as_code/filter_integration
Closed

[Discover Sessions as Code] Integrate simplified filter schemas - fix type errors & add round-trip tests#257484
lukasolson wants to merge 12 commits into
elastic:mainfrom
lukasolson:discover_sessions_as_code/filter_integration

Conversation

@lukasolson
Copy link
Copy Markdown
Contributor

Summary

Resolves remaining work items from #255213 for #248927.

This PR builds on top of #255213 (the embeddable transforms PR) and addresses the outstanding tasks:

Changes

  • Fix type error in get_legacy_log_stream_embeddable_factory.ts: The legacy log stream factory was passing API-format sort (objects) and columns (objects) to SavedSearch which expects stored format (tuples/strings). Now uses toStoredSort()/toStoredColumns() to convert.

  • Fix type error in get_search_embeddable_factory.tsx: The initializeUnsavedChanges<DiscoverSessionEmbeddableState> comparators were using stored-format keys (sampleSize, rowHeight, etc.) and invalid legacy keys (attributes, breakdownField, etc.). Replaced with API-format keys (sample_size, row_height, etc.) matching DiscoverSessionEmbeddableState.

  • Fix toStoredSearchEmbeddableState: No longer includes empty grid: {} when no columns have explicit widths.

  • Add full round-trip tests: End-to-end stored → API → stored tests for both by-value (with filters, query, columns, sort, grid) and by-reference (with panel overrides) states.

  • Add filter-specific round-trip integration tests: Covers phrase (is), negated phrases (is_not_one_of), exists, range, custom DSL, and combined group filters through fromStoredTab/toStoredTab.

  • Update search_embeddable_transforms tests: Migrated a legacy test from main that used the old SearchEmbeddableByValueState type to use the new DiscoverSessionEmbeddableByValueState API format.

Test plan

  • All 90 embeddable tests pass (transform_utils, search_embeddable_transforms, serialization_utils)
  • Lint passes on all changed files
  • CI pipeline validation

Related

Made with Cursor

@elasticmachine
Copy link
Copy Markdown
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!
  • Click to trigger kibana-entity-store-performance-from-pr for this PR!
  • Click to trigger kibana-storybooks-from-pr for this PR!

lukasolson and others added 2 commits March 12, 2026 16:23
… filter integration

- Fix type error in get_legacy_log_stream_embeddable_factory.ts: convert
  API-format sort/columns to stored format using toStoredSort/toStoredColumns
- Fix type error in get_search_embeddable_factory.tsx: replace stored-format
  comparator keys with API-format keys (snake_case) in initializeUnsavedChanges
- Fix toStoredSearchEmbeddableState to not include empty grid objects
- Add full round-trip tests (stored → API → stored) for by-value state
  including filters, query, columns, sort, grid, and row heights
- Add round-trip test for by-reference state with panel overrides
- Add filter-specific round-trip integration tests covering phrase, phrases,
  exists, range, DSL, and combined (group) filter types
- Update search_embeddable_transforms tests for new API-format expectations

Resolves remaining tasks from elastic#255213 for elastic#248927.

Made-with: Cursor
@lukasolson lukasolson force-pushed the discover_sessions_as_code/filter_integration branch from 67b601b to 399d289 Compare March 12, 2026 23:28
@lukasolson
Copy link
Copy Markdown
Contributor Author

Closing as this will be included in #255213.

@lukasolson lukasolson closed this Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants