Skip to content

[Fleet] Add meta:{id} to fleet schemas#270560

Merged
criamico merged 10 commits into
elastic:mainfrom
criamico:261258_oas_meta_ids
May 27, 2026
Merged

[Fleet] Add meta:{id} to fleet schemas#270560
criamico merged 10 commits into
elastic:mainfrom
criamico:261258_oas_meta_ids

Conversation

@criamico
Copy link
Copy Markdown
Member

@criamico criamico commented May 22, 2026

Fixes #261258
possibly also #264565 (to be verified)

Summary

Add meta: { id } to Fleet body/response schemas

Files changed:

  • server/types/models/agent_policy.ts — versioned policy schemas (v3–v6), new_agent_policy, agent_policy, agent_policy_response, full_agent_policy, outputs responses
  • server/types/rest_spec/agent_policy.ts — bulk get, copy, delete, full policy, K8s manifest, list outputs, cleanup task request/response schemas
  • server/types/models/enrollment_api_key.ts enrollment_api_key
  • server/types/rest_spec/enrollment_api_key.ts — enrollment key CRUD and bulk delete schemas
  • common/types/models/package_policy_schema.ts — all package policy schemas: new, versioned (v22–v24), simplified, update, response, dry-run, status
  • server/types/rest_spec/package_policy.ts — bulk get, create, delete, upgrade, dry-run schemas
  • server/types/rest_spec/epm.ts — ~40 package management schemas (categories, package info/list/stats, install/delete/bulk operations, etc.)
  • server/types/rest_spec/agent.tsaction_id_response / action_message_response branches of ActionIdOrMessageSchema (resolves items links to styles and js #1 and Change of links to styles and js #2 of [OAS Validation] Fix structural schema issues in Fleet APIs #264565)

Testing

Verified locally with:

node scripts/capture_oas_snapshot --no-serverless --include-path /api/fleet
node scripts/validate_oas_docs
node scripts/check_api_contracts --distribution stack

It looks like there are no Fleet errors left after this change but the final verification step will be ran in the ci for Terraform

@criamico criamico self-assigned this May 22, 2026
@criamico criamico added the release_note:skip Skip the PR/issue when compiling release notes label May 22, 2026
@criamico criamico requested a review from a team as a code owner May 22, 2026 09:22
@criamico criamico added Team:Fleet Team label for Observability Data Collection Fleet team backport:version Backport to applied version labels v9.4.0 v9.5.0 labels May 22, 2026
@infra-vault-gh-plugin-prod
Copy link
Copy Markdown

Pinging @elastic/fleet (Team:Fleet)

@criamico criamico requested a review from a team May 22, 2026 09:23
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod Bot requested a review from a team as a code owner May 22, 2026 10:02
Copy link
Copy Markdown
Member

@vishaangelova vishaangelova left a comment

Choose a reason for hiding this comment

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

LGTM from a docs perspective
(Leaving a couple of suggestions to improve some of the description fields. Please ignore if fixing these is out of scope of this PR.)

Comment thread x-pack/platform/plugins/shared/fleet/server/types/rest_spec/epm.ts Outdated
Comment thread x-pack/platform/plugins/shared/fleet/server/types/models/agent_policy.ts Outdated
Comment thread x-pack/platform/plugins/shared/fleet/server/types/models/agent_policy.ts Outdated
Comment thread x-pack/platform/plugins/shared/fleet/common/types/models/package_policy_schema.ts Outdated
Comment thread x-pack/platform/plugins/shared/fleet/common/types/models/package_policy_schema.ts Outdated
Copy link
Copy Markdown
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Nice work @criamico ! Approving to unblock progress.

Would you mind trying to preview the new OAS on bump.sh before merging? From root you should be able to run make -C oas_docs api-docs-preview.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: changed due to added meta. Not due to runtime/behavioural changes.

Copy link
Copy Markdown
Member Author

@criamico criamico May 22, 2026

Choose a reason for hiding this comment

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

so I guess I can ignore these failure safely?

@criamico
Copy link
Copy Markdown
Member Author

@jloleysens I generated the preview:

Your preview is visible at: https://bump.sh/preview/4d15bfec-3062-4533-8429-d7d032ae0fe2 (Expires at 2026-05-22T17:10:42+02:00)

@jloleysens
Copy link
Copy Markdown
Contributor

Nice! Does it look as expected?

@criamico
Copy link
Copy Markdown
Member Author

Nice! Does it look as expected?

It looks ok to me and I can see the new descriptions added. I'm not sure if the meta:id fields can be validated from the docs though?

The other thing is that the original ticket said:

We'll run the downstream pipeline (Terraform provider codegen) to make sure the generated types look right, naming, shared types, scalar fields all stay clean.

@jloleysens Can you help me to verify the current changes on this pipeline? I don't know if it's automatically triggered.

@criamico
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

Saved Objects CI check failed

4 issue(s) across 1 type(s).

General

  • [generic] The SO type 'ingest-agent-policies' has mapping fields not present in the latest model version schema: is_preconfigured, revision, schema_version, status, updated_at, updated_by. (docs)
  • [generic] The SO type 'fleet-agent-policies' has mapping fields not present in the latest model version schema: is_preconfigured, revision, schema_version, status, updated_at, updated_by. (docs)
  • [generic] The SO type 'ingest-package-policies' has mapping fields not present in the latest model version schema: bump_agent_policy_revision, created_at, created_by, elasticsearch, latest_revision, package.name, package.requires_root, package.title, package.version, revision, secret_references.id, updated_at, updated_by. (docs)
  • [generic] The SO type 'fleet-package-policies' has mapping fields not present in the latest model version schema: bump_agent_policy_revision, created_at, created_by, elasticsearch, latest_revision, package.name, package.requires_root, package.title, package.version, revision, secret_references.id, updated_at, updated_by. (docs)

Run locally

node scripts/check_saved_objects --baseline 388461351fec95f2bd766f32124dd4705a1a2863

See the Saved Objects troubleshooting guide and the model versions documentation for details.

@nchaulet nchaulet self-requested a review May 25, 2026 15:19
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.

LGTM 🚀

@kibanamachine
Copy link
Copy Markdown
Contributor

kibanamachine commented May 26, 2026

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #11 / Alert table context menu Case actions it render AddToCase context menu item if timelineId === TimelineId.detectionsPage
  • [job] [logs] FTR Configs #142 / Entity Analytics - Privilege Monitoring @ess @serverless @skipInServerlessMKI Entity Analytics Privileged user monitoring Migrations source_index migration for space default should run the migration when users have source_index field
  • [job] [logs] Jest Tests #12 / GraphGroupedNodePreviewPanel Pagination Behavior Page Size Changes should reset pageIndex to 0 when changing pageSize to 25
  • [job] [logs] Scout Lane #46 - serverless-observability_complete / default / local-serverless-observability_complete - Hosts Page - Empty State - should show onboarding page when no data is present

Metrics [docs]

✅ unchanged

History

cc @criamico

Copy link
Copy Markdown
Contributor

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@criamico criamico merged commit f8da12e into elastic:main May 27, 2026
31 of 32 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.4

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

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
9.4 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 270560

Questions ?

Please refer to the Backport tool documentation

smith pushed a commit to smith/kibana that referenced this pull request May 27, 2026
Fixes elastic#261258
possibly also elastic#264565 (to be
verified)

## Summary

Add `meta: { id }` to Fleet body/response schemas

Files changed:

- `server/types/models/agent_policy.ts` — versioned policy schemas
(v3–v6), `new_agent_policy`, `agent_policy`, `agent_policy_response`,
`full_agent_policy`, outputs responses
- `server/types/rest_spec/agent_policy.ts` — bulk get, copy, delete,
full policy, K8s manifest, list outputs, cleanup task request/response
schemas
- `server/types/models/enrollment_api_key.ts `— `enrollment_api_key`
- `server/types/rest_spec/enrollment_api_key.ts` — enrollment key CRUD
and bulk delete schemas
- `common/types/models/package_policy_schema.ts `— all package policy
schemas: new, versioned (v22–v24), simplified, update, response,
dry-run, status
- `server/types/rest_spec/package_policy.ts` — bulk get, create, delete,
upgrade, dry-run schemas
- `server/types/rest_spec/epm.ts `— ~40 package management schemas
(categories, package info/list/stats, install/delete/bulk operations,
etc.)
- `server/types/rest_spec/agent.ts` — `action_id_response` /
`action_message_response` branches of `ActionIdOrMessageSchema`
(resolves items #1 and #2 of elastic#264565)

### Testing
Verified locally with:
```
node scripts/capture_oas_snapshot --no-serverless --include-path /api/fleet
node scripts/validate_oas_docs
node scripts/check_api_contracts --distribution stack
```

It looks like there are no Fleet errors left after this change but the
final verification step will be ran in the ci for Terraform

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label May 29, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 270560 locally
cc: @criamico

@criamico
Copy link
Copy Markdown
Member Author

💚 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
Copy link
Copy Markdown
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @criamico

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport missing Added to PRs automatically when the are determined to be missing a backport. 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.

[OAS] Fleet: Add meta:{id} to plugin schemas for named OAS components

7 participants