Skip to content

[Cases] Narrow attachment shape in bulk create - #290934

Draft
christineweng wants to merge 5 commits into
elastic:mainfrom
christineweng:cases-bulk-create-attachments-cleanup
Draft

christineweng wants to merge 5 commits into
elastic:mainfrom
christineweng:cases-bulk-create-attachments-cleanup

Conversation

@christineweng

@christineweng christineweng commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Dependency: #290961 to be merged first

This PR narrows internal cases route bulk_create attachments to always receive v2 unified attachment types. It used to allow v1 and v2 for migration compatibility, since migration is complete and all production callers pass unified shape, this PR tighten it to accept v2 only.

Major code changes:

  • Replaced BulkCreateAttachmentsRequestRtV2 (v1+v2 union) with BulkCreateUnifiedAttachmentsRequestRt
  • v1 bulk create request is removed since it is no longer used
  • Updated tests from accepting v1 to rejecting

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
  • Review the backport guidelines and apply applicable backport:* labels.

This PR is assisted by Cursor and Claude Sonnet 5

@christineweng christineweng self-assigned this Sep 14, 2026
@christineweng christineweng added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting v9.6.0 Team:Lantern labels Sep 14, 2026
@infra-vault-gh-plugin-prod

infra-vault-gh-plugin-prod Bot commented Sep 14, 2026

Copy link
Copy Markdown
🤖 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!

@kibanamachine

kibanamachine commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

💔 Build Failed

Failed CI Steps

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
cases 3.0KB 3.0KB +64.0B
shared-plugins 12.1MB 12.1MB +73.0B
total +137.0B
Unknown metric groups

total optimizer output size

id before after diff
all 64.0MB 64.0MB +137.0B

History

cc @christineweng

christineweng and others added 2 commits September 14, 2026 12:34
Collapses the client/service/route/workflow layer onto unified-only
attachment requests (AttachmentRequestV2 / BulkCreateAttachmentsRequestV2),
adds BulkCreateUnifiedAttachmentsRequestRt / BulkGetUnifiedAttachmentsResponseRt,
and removes the now-unused BulkGetAttachmentsResponseRtV2 and legacy decode path.

Co-authored-by: Cursor <cursoragent@cursor.com>
Split attachment/v2.ts into:
- v2.ts: unified-only types (BulkCreateUnifiedAttachmentsRequest, etc.)
- v2_union.ts: v1-legacy union types (AttachmentRequestV2, etc.),
  exposed as the attachmentApiV2Union namespace.

Also migrate base_response_actions_client.ts to the unified-only
client type, matching cases_connector_executor.ts/add_alerts.ts.
@christineweng
christineweng force-pushed the cases-bulk-create-attachments-cleanup branch from 57f51ab to ded8dd8 Compare September 14, 2026 18:14
christineweng added a commit that referenced this pull request Sep 15, 2026
…sts (#290961)

## Summary

Context:
During cases attachment v2 work, all the v2 types (such as
`AttachmentRequestV2`) are unions of v1 and v2 for backward
compatibility. After #287729, all
public routes perform v1 -> v2 conversion before sending to cases
client, hence union shape is no longer necessary.

This PR migrates the client/service layer to accept unified-only
attachment payloads internally.

**Major changes**
- Replaced `....V2` (v1+v2 union) type with  `...Unified` (v2 only)
- To prevent naming confusion, split `common/types/api/attachment/v2.ts`
into:`v2.ts` and `v2_union.ts`
- Removed redundant decode calls
- Renamed utils like `validateRegisteredAttachments` to
`validateUnifiedAttachments`

No wire-shape changes in this PR. Follow-up PR
#290934 removes the legacy wire
shape from the bulk-create route.

Made with [Cursor](https://cursor.com)

### Checklist

- [ ] 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
- [x] [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
- [x] 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)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
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:Lantern v9.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants