[9.4] [Inference] Make feature settings reading work for users without inference privileges (#290457) - #290625
Conversation
…rence privileges (elastic#290457) Without the searchInferenceEndpoints.read privilege, users using an LLM feature were presented with the full list of LLMs instead of only the list of LLMs allowed for that feature. Fixing that by using the internal user to read the settings. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) 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](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] 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](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) 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](https://www.elastic.co/docs/extend/kibana/contributing/workflow/how-we-use-github#release-notes) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit 0fa2625) # Conflicts: # x-pack/platform/plugins/shared/search_inference_endpoints/server/plugin.ts
There was a problem hiding this comment.
Reviewed this backport of #290457. One concrete issue: the start-contract getForFeature ended up with a duplicated const getConnectorById declaration in the same block scope, which is a redeclaration error and breaks the build. Note: the inline suggestion block on that line is not quite right — the correct fix is simply to delete the newly added duplicate line (the prose in the comment describes this). The rest of the backport (using getUnsafeInternalClient scoped to the request namespace, plus tests) matches the source PR and looks sound.
Generated by Claude Reviewer for #290625 · claude · opus · 105.4 AIC · ⌖ 22.9 AIC · ⊞ 5.5K
| request: KibanaRequest | ||
| ) => { | ||
| const soClient = getInferenceSettingsClient(core.savedObjects, request); | ||
| const getConnectorById = (id: string) => plugins.inference.getConnectorById(id, request); |
There was a problem hiding this comment.
This backport introduces a duplicate const getConnectorById declaration. A few lines below (before resolveFeatureEndpoints) the same const getConnectorById = (id: string) => plugins.inference.getConnectorById(id, request); already exists in this block scope. Two const declarations of the same name in the same block is a redeclaration error (TS2451 "Cannot redeclare block-scoped variable 'getConnectorById'"), which breaks the build. The backport didn't apply cleanly here — the line should be removed since the existing declaration below covers it.
| const getConnectorById = (id: string) => plugins.inference.getConnectorById(id, request); | |
| const soClient = getInferenceSettingsClient(core.savedObjects, request); |
The cherry-pick introduced a redundant `const getConnectorById` line immediately after `soClient`, duplicating the identical declaration that already exists after `uiSettingsClient` in the same block scope. Remove the extra declaration to resolve the TS2451 redeclaration error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
Test Failures
History
|
Backport
This will backport the following commits from
mainto9.4:Questions ?
Please refer to the Backport tool documentation