Skip to content

[Fleet] Resolve streams and secrets by effective input name#264366

Merged
teresaromero merged 6 commits intoelastic:mainfrom
teresaromero:composable/fix-effective-name
Apr 21, 2026
Merged

[Fleet] Resolve streams and secrets by effective input name#264366
teresaromero merged 6 commits intoelastic:mainfrom
teresaromero:composable/fix-effective-name

Conversation

@teresaromero
Copy link
Copy Markdown
Contributor

@teresaromero teresaromero commented Apr 20, 2026

Summary

Completes propagation of effective input names (name ?? type, getInputEffectiveName) for places that still matched registry streams[].input against input.type. That mismatch caused package policy creation to fail with Stream template not found, unable to find stream for input <type> when integration manifests reference streams by input name (same agent type, disambiguated names), as exercised by composable/elastic-package dual-input fixtures.

Changes

  • package_policy.ts: _compilePackageStream selects the registry stream using getInputEffectiveName(input); error message includes effective name and type.
  • validate_package_policy.ts: stream var-def lookup key uses ${dataset}-${getInputEffectiveName(input)} to match the registry map keyed by stream.input.
  • secrets/package_policies.ts: stream secret var-def lookup uses the same effective name in the dataset key; import getInputEffectiveName.
  • get_template_inputs.ts: buildIndexedPackage indexes streams and input ids using getInputEffectiveName(packageInput) so docs/template indexing matches named stream references.
  • package_policy.test.ts: Jest coverage for a manifest whose streams[].input is the input name while input.type remains the real type.

Relates to Fleet: Support setting explicit names for ambiguous inputs and composable packages that set streams[].input to the input name qualifier.

Related issue: This gap surfaced while testing work for elastic/elastic-package#3465 (composable requires.input: input name and stream input per package-spec qualified inputs). The elastic-package change that implements that issue is still WIP; this Kibana PR closes the Fleet side so policies compile when manifests follow the spec (streams reference the input name while the policy input keeps the real agent type).

Release notes: Follow-up to #262138; no additional user-facing release note beyond that change. Use label release_note:skip.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

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.

Risks

  • Wrong stream match if a package mis-declares streams[].input: Low. Behavior is aligned with getInputEffectiveName; packages that still use plain type in manifests continue to work because name is absent.
  • EPM template / comment indexing: Low. buildIndexedPackage now keys by effective name; verify integration detail docs for packages with duplicate types and names if any UI relies on old type-only ids.

Follow up to named/qualified inputs (name ?? type): registry data stream
streams reference streams[].input by effective name while package policy
inputs still carry the real agent type. Align stream template compilation,
stream var validation, stream secret var lookup, and EPM template indexing
with getInputEffectiveName(input).

Adds a Jest case for manifests whose stream.input uses the input name.

Made-with: Cursor
@teresaromero teresaromero added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team labels Apr 20, 2026
@teresaromero teresaromero requested a review from a team as a code owner April 20, 2026 10:34
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@teresaromero teresaromero added backport:version Backport to applied version labels v9.4.0 labels Apr 20, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 20, 2026

Approvability

Verdict: Needs human review

This PR changes runtime behavior by resolving streams and secrets using the input's effective name (name ?? type) instead of just type. This affects how Fleet validates, generates templates, and resolves secrets for inputs with custom names. All modified files are owned by @elastic/fleet who should review this behavioral change.

No code changes detected at b0ca12f. Prior analysis still applies.

You can customize Macroscope's approvability policy. Learn more.

Align getTemplateInputs placeholder lookup and templatePackagePolicyToFullInputStreams input ids with buildIndexedPackage (policy_template + name ?? type) so inputs with explicit names still resolve registry vars and YAML comments.

Made-with: Cursor
Copy link
Copy Markdown
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

code LGTM 🚀

@teresaromero teresaromero enabled auto-merge (squash) April 20, 2026 14:55
@teresaromero teresaromero merged commit 170d52a into elastic:main Apr 21, 2026
17 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.4

https://github.com/elastic/kibana/actions/runs/24716526625

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 203.6KB 203.6KB -2.0B

History

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
9.4

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Apr 21, 2026
…64366) (#264634)

# Backport

This will backport the following commits from `main` to `9.4`:
- [[Fleet] Resolve streams and secrets by effective input name
(#264366)](#264366)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Tere","email":"teresa.romero@elastic.co"},"sourceCommit":{"committedDate":"2026-04-21T10:06:51Z","message":"[Fleet]
Resolve streams and secrets by effective input name (#264366)\n\n##
Summary\n\nCompletes propagation of **effective input names** (`name ??
type`,\n`getInputEffectiveName`) for places that still matched
registry\n`streams[].input` against **`input.type`**. That mismatch
caused package\npolicy creation to fail with `Stream template not found,
unable to find\nstream for input <type>` when integration manifests
reference streams by\n**input name** (same agent type, disambiguated
names), as exercised by\ncomposable/elastic-package dual-input
fixtures.\n\n**Changes**\n\n- **`package_policy.ts`**:
`_compilePackageStream` selects the registry\nstream using
`getInputEffectiveName(input)`; error message includes\neffective name
and type.\n- **`validate_package_policy.ts`**: stream var-def lookup key
uses\n`${dataset}-${getInputEffectiveName(input)}` to match the registry
map\nkeyed by `stream.input`.\n- **`secrets/package_policies.ts`**:
stream secret var-def lookup uses\nthe same effective name in the
dataset key; import\n`getInputEffectiveName`.\n-
**`get_template_inputs.ts`**: `buildIndexedPackage` indexes streams\nand
input ids using `getInputEffectiveName(packageInput)` so\ndocs/template
indexing matches named stream references.\n-
**`package_policy.test.ts`**: Jest coverage for a manifest
whose\n`streams[].input` is the input **name** while `input.type`
remains the\nreal type.\n\nRelates to [Fleet: Support setting explicit
names for
ambiguous\ninputs](#262138) and
composable\npackages that set `streams[].input` to the input name
qualifier.\n\n**Related issue:** This gap surfaced while testing work
for\n[elastic/elastic-package#3465](https://github.com/elastic/elastic-package/issues/3465)\n(composable
`requires.input`: input `name` and stream `input` per\npackage-spec
qualified inputs). The elastic-package change that\nimplements that
issue is still **WIP**; this Kibana PR closes the Fleet\nside so
policies compile when manifests follow the spec (streams\nreference the
input **name** while the policy input keeps the real
agent\n**type**).\n\n**Release notes:** Follow-up to #262138; no
additional user-facing\nrelease note beyond that change. Use label
`release_note:skip`.\n\n### Checklist\n\nCheck the PR satisfies
following conditions.\n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n(`release_note:skip`,
follow-up to #262138).\n- [ ] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n\n**Risks**\n\n-
**Wrong stream match if a package mis-declares
`streams[].input`**:\nLow. Behavior is aligned with
`getInputEffectiveName`; packages that\nstill use plain `type` in
manifests continue to work because `name` is\nabsent.\n- **EPM template
/ comment indexing**: Low. `buildIndexedPackage` now\nkeys by effective
name; verify integration detail docs for packages with\nduplicate types
and names if any UI relies on old `type`-only
ids.","sha":"170d52a1b934b921c81a4edc59130f54310d77e7","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:version","v9.4.0","v9.5.0"],"title":"[Fleet]
Resolve streams and secrets by effective input
name","number":264366,"url":"https://github.com/elastic/kibana/pull/264366","mergeCommit":{"message":"[Fleet]
Resolve streams and secrets by effective input name (#264366)\n\n##
Summary\n\nCompletes propagation of **effective input names** (`name ??
type`,\n`getInputEffectiveName`) for places that still matched
registry\n`streams[].input` against **`input.type`**. That mismatch
caused package\npolicy creation to fail with `Stream template not found,
unable to find\nstream for input <type>` when integration manifests
reference streams by\n**input name** (same agent type, disambiguated
names), as exercised by\ncomposable/elastic-package dual-input
fixtures.\n\n**Changes**\n\n- **`package_policy.ts`**:
`_compilePackageStream` selects the registry\nstream using
`getInputEffectiveName(input)`; error message includes\neffective name
and type.\n- **`validate_package_policy.ts`**: stream var-def lookup key
uses\n`${dataset}-${getInputEffectiveName(input)}` to match the registry
map\nkeyed by `stream.input`.\n- **`secrets/package_policies.ts`**:
stream secret var-def lookup uses\nthe same effective name in the
dataset key; import\n`getInputEffectiveName`.\n-
**`get_template_inputs.ts`**: `buildIndexedPackage` indexes streams\nand
input ids using `getInputEffectiveName(packageInput)` so\ndocs/template
indexing matches named stream references.\n-
**`package_policy.test.ts`**: Jest coverage for a manifest
whose\n`streams[].input` is the input **name** while `input.type`
remains the\nreal type.\n\nRelates to [Fleet: Support setting explicit
names for
ambiguous\ninputs](#262138) and
composable\npackages that set `streams[].input` to the input name
qualifier.\n\n**Related issue:** This gap surfaced while testing work
for\n[elastic/elastic-package#3465](https://github.com/elastic/elastic-package/issues/3465)\n(composable
`requires.input`: input `name` and stream `input` per\npackage-spec
qualified inputs). The elastic-package change that\nimplements that
issue is still **WIP**; this Kibana PR closes the Fleet\nside so
policies compile when manifests follow the spec (streams\nreference the
input **name** while the policy input keeps the real
agent\n**type**).\n\n**Release notes:** Follow-up to #262138; no
additional user-facing\nrelease note beyond that change. Use label
`release_note:skip`.\n\n### Checklist\n\nCheck the PR satisfies
following conditions.\n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n(`release_note:skip`,
follow-up to #262138).\n- [ ] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n\n**Risks**\n\n-
**Wrong stream match if a package mis-declares
`streams[].input`**:\nLow. Behavior is aligned with
`getInputEffectiveName`; packages that\nstill use plain `type` in
manifests continue to work because `name` is\nabsent.\n- **EPM template
/ comment indexing**: Low. `buildIndexedPackage` now\nkeys by effective
name; verify integration detail docs for packages with\nduplicate types
and names if any UI relies on old `type`-only
ids.","sha":"170d52a1b934b921c81a4edc59130f54310d77e7"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/264366","number":264366,"mergeCommit":{"message":"[Fleet]
Resolve streams and secrets by effective input name (#264366)\n\n##
Summary\n\nCompletes propagation of **effective input names** (`name ??
type`,\n`getInputEffectiveName`) for places that still matched
registry\n`streams[].input` against **`input.type`**. That mismatch
caused package\npolicy creation to fail with `Stream template not found,
unable to find\nstream for input <type>` when integration manifests
reference streams by\n**input name** (same agent type, disambiguated
names), as exercised by\ncomposable/elastic-package dual-input
fixtures.\n\n**Changes**\n\n- **`package_policy.ts`**:
`_compilePackageStream` selects the registry\nstream using
`getInputEffectiveName(input)`; error message includes\neffective name
and type.\n- **`validate_package_policy.ts`**: stream var-def lookup key
uses\n`${dataset}-${getInputEffectiveName(input)}` to match the registry
map\nkeyed by `stream.input`.\n- **`secrets/package_policies.ts`**:
stream secret var-def lookup uses\nthe same effective name in the
dataset key; import\n`getInputEffectiveName`.\n-
**`get_template_inputs.ts`**: `buildIndexedPackage` indexes streams\nand
input ids using `getInputEffectiveName(packageInput)` so\ndocs/template
indexing matches named stream references.\n-
**`package_policy.test.ts`**: Jest coverage for a manifest
whose\n`streams[].input` is the input **name** while `input.type`
remains the\nreal type.\n\nRelates to [Fleet: Support setting explicit
names for
ambiguous\ninputs](#262138) and
composable\npackages that set `streams[].input` to the input name
qualifier.\n\n**Related issue:** This gap surfaced while testing work
for\n[elastic/elastic-package#3465](https://github.com/elastic/elastic-package/issues/3465)\n(composable
`requires.input`: input `name` and stream `input` per\npackage-spec
qualified inputs). The elastic-package change that\nimplements that
issue is still **WIP**; this Kibana PR closes the Fleet\nside so
policies compile when manifests follow the spec (streams\nreference the
input **name** while the policy input keeps the real
agent\n**type**).\n\n**Release notes:** Follow-up to #262138; no
additional user-facing\nrelease note beyond that change. Use label
`release_note:skip`.\n\n### Checklist\n\nCheck the PR satisfies
following conditions.\n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n(`release_note:skip`,
follow-up to #262138).\n- [ ] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n\n**Risks**\n\n-
**Wrong stream match if a package mis-declares
`streams[].input`**:\nLow. Behavior is aligned with
`getInputEffectiveName`; packages that\nstill use plain `type` in
manifests continue to work because `name` is\nabsent.\n- **EPM template
/ comment indexing**: Low. `buildIndexedPackage` now\nkeys by effective
name; verify integration detail docs for packages with\nduplicate types
and names if any UI relies on old `type`-only
ids.","sha":"170d52a1b934b921c81a4edc59130f54310d77e7"}}]}] BACKPORT-->

Co-authored-by: Tere <teresa.romero@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v9.4.0 v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants