Skip to content

Enhance CPS onRequest handler#253691

Closed
gsoldevila wants to merge 1 commit into
elastic:mainfrom
gsoldevila:core-cps-onrequest-enhancements
Closed

Enhance CPS onRequest handler#253691
gsoldevila wants to merge 1 commit into
elastic:mainfrom
gsoldevila:core-cps-onrequest-enhancements

Conversation

@gsoldevila
Copy link
Copy Markdown
Member

@gsoldevila gsoldevila commented Feb 18, 2026

Summary

Improves the getOnRequestHandler in ElasticsearchService with two behavioral changes:

  • When CPS is disabled, the handler now actively strips any project_routing present in body, params.querystring, or options.querystring to prevent ES request failures. This avoids plugins having to check if CPS is enabled for every API call that might inject project_routing.
  • When CPS is enabled, the handler now checks all three locations (body, params.querystring, options.querystring) for caller-provided project_routing before injecting the default value, avoiding unintended overrides.

Tests updated to use setCpsFeatureFlag via the setup contract instead of accessing private properties, and expanded to cover the new stripping and querystring scenarios.

Made with Cursor

…and respect caller-provided values

Co-authored-by: Cursor <cursoragent@cursor.com>
@gsoldevila gsoldevila added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Feb 18, 2026
@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!

@gsoldevila
Copy link
Copy Markdown
Member Author

Handled in #253697

@gsoldevila gsoldevila closed this Feb 18, 2026
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 release_note:skip Skip the PR/issue when compiling release notes Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants