[kibana-type-check-analysis] Kibana type check: spec fixes needed
kibana-type-check-analysiskibana-spec-checkauto-pr: kibana type check
Build: (buildkite.com/redacted)
## Analysis
### SPEC errors (5 errors) — root cause: missing `max_retention` in `RetentionSource` enum
The `RetentionSource` enum in `specification/indices/_types/DataStreamLifecycle.ts` is missing the `max_retention` value. Elasticsearch returns `"max_retention"` as a valid `retention_determined_by` value when the data stream's effective retention is capped by the global `max_retention` setting (`GlobalRetention.max_retention`), but the spec enum only defines:
```typescript
export enum RetentionSource {
data_stream_configuration,
default_global_retention,
max_global_retention,
default_failures_retention
}
```
Kibana code in multiple files uses `retention_determined_by: "max_retention"` against the generated client type, causing TypeScript to reject it as outside the known union.
**Required fix:** Add `max_retention` to the `RetentionSource` enum in `specification/indices/_types/DataStreamLifecycle.ts`.
**Affected Kibana files:**
- `x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/data_streams_project_level_retention.test.ts:57` — TS2322: `'"max_retention"'` not assignable to `RetentionSource | undefined`
- `x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/data_streams_tab.test.ts:216` — same TS2322
- `x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.test.tsx:241` — TS2352: object literal with `retention_determined_by: "max_retention"` cannot be cast
- `x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.test.tsx:269` — same TS2352
- `x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx:264` — TS2367: comparison `retention_determined_by === "max_retention"` has no overlap with the narrowed enum type
---
### Non-SPEC errors (for reference)
The remaining 3 errors are classified as **KIBANA** and do not require spec changes:
- `server/routes/api/data_streams/register_get_route.ts:192` and `:271` — TS2322: `Duration | undefined` (= `string | -1 | 0 | undefined`) not assignable to `string | undefined`. Kibana's internal response type uses `string` for `frozen_after` but the spec correctly types it as `Duration`. Kibana needs to widen its local type or cast the value.
- `server/lib/data_stream_serialization.ts:125` — TS2322: partially a downstream effect of the same `Duration`/`frozen_after` mismatch in Kibana's `IndicesDataStreamLifecycleWithRollover` augmentation type.
> Generated by [Kibana type check analysis](https://github.com/elastic/elasticsearch-specification/actions/runs/26647864243) · ● 1.6M · [◷](https://github.com/search?q=repo%3Aelastic%2Felasticsearch-specification+is%3Aissue+%22gh-aw-workflow-call-id%3A+elastic%2Felasticsearch-specification%2Fkibana-type-check-analysis%22&type=issues)
<!-- gh-aw-agentic-workflow: Kibana type check analysis, engine: claude, model: llm-gateway/claude-sonnet-4-6, id: 26647864243, workflow_id: kibana-type-check-analysis, run: https://github.com/elastic/elasticsearch-specification/actions/runs/26647864243 -->
<!-- gh-aw-workflow-id: kibana-type-check-analysis -->
<!-- gh-aw-workflow-call-id: elastic/elasticsearch-specification/kibana-type-check-analysis -->
7 条评论