Skip to content

Conversation

@davismcphee
Copy link
Contributor

Summary

This pull request introduces several updates to the discover plugin's context awareness features, focusing on refactoring, improving test mocks, and standardizing return values for profile resolution. The most notable changes include replacing isMatch: false with a new constant RESOLUTION_MISMATCH, consolidating mock implementations into dedicated files, and simplifying the logic for extracting index patterns.

Refactoring and Standardization:

  • Replaced isMatch: false with RESOLUTION_MISMATCH across multiple profile providers and tests to standardize mismatch handling.

Mock Improvements:

  • Extracted createContextAwarenessMocks into a dedicated file context_awareness_mocks.tsx and updated its exports for better modularity.
  • Moved createProfileProviderServicesMock to a new file profile_provider_services.ts to streamline mock creation for profile provider services.

Logic Simplification:

  • Refactored the logic for extracting index patterns by introducing extractIndexPatternFrom to replace repetitive checks and conditions.
  • Updated the discoverShared property in createDiscoverServicesMock to use the entire start contract instead of just features.

Test Updates:

  • Updated tests to reflect the introduction of RESOLUTION_MISMATCH and the new mock structure, ensuring consistency across the codebase.

These changes improve code clarity, maintainability, and consistency, particularly in handling profile resolution and mock implementations.

Checklist

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@davismcphee davismcphee self-assigned this Jun 14, 2025
@elasticmachine
Copy link
Contributor

elasticmachine commented Jun 14, 2025

🤖 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!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 1317 1311 -6

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1.1MB 1.1MB -360.0B

History

cc @davismcphee

@davismcphee
Copy link
Contributor Author

Linking this issue since it should be resolved by this PR if I ever get back to it: #219338.

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.

3 participants