[kibana-type-check-analysis] Kibana type check: spec fixes needed - 2026-05-24
kibana-type-check-analysiskibana-spec-check
Build: (buildkite.com/redacted)
## Summary
The daily Kibana type check against the generated ES JS client found **5 TypeScript errors** rooted in a missing enum value in the Elasticsearch specification.
---
## SPEC errors
### Missing `max_retention` in `RetentionSource` enum
**File:** `specification/indices/_types/DataStreamLifecycle.ts`
**Root cause:** The `RetentionSource` enum currently defines four values:
```typescript
export enum RetentionSource {
data_stream_configuration,
default_global_retention,
max_global_retention,
default_failures_retention
}
```
However, the Elasticsearch server can return `"max_retention"` as the `retention_determined_by` field value in `IndicesDataStreamLifecycleWithRollover` responses. This value is not present in the enum, causing TypeScript errors throughout Kibana wherever `"max_retention"` is used.
**Required fix:** Add `max_retention` to the `RetentionSource` enum:
```typescript
export enum RetentionSource {
data_stream_configuration,
default_global_retention,
max_global_retention,
default_failures_retention,
max_retention // ← add this
}
```
**Affected Kibana files (5 errors):**
1. `x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/data_streams_project_level_retention.test.ts:57:9`
```
error TS2322: Type '"max_retention"' is not assignable to type '"data_stream_configuration" | "default_global_retention" | "max_global_retention" | "default_failures_retention" | undefined'
```
2. `x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/data_streams_tab.test.ts:216:13`
```
error TS2322: Type '"max_retention"' is not assignable to type '"data_stream_configuration" | "default_global_retention" | "max_global_retention" | "default_failures_retention" | undefined'
```
3. `x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.test.tsx:241:18`
```
error TS2352: Conversion of type '{ enabled: true; data_retention: string; effective_retention: string; retention_determined_by: "max_retention"; }' to type 'IndicesDataStreamLifecycleWithRollover & { ... }' may be a mistake because neither type sufficiently overlaps with the other.
```
4. `x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.test.tsx:269:18`
```
error TS2352: Conversion of type '{ enabled: true; data_retention: string; effective_retention: string; retention_determined_by: "max_retention"; }' to type 'IndicesDataStreamLifecycleWithRollover & { ... }' may be a mistake because neither type sufficiently overlaps with the other.
```
5. `x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx:264:13`
```
error TS2367: This comparison appears to be unintentional because the types '"data_stream_configuration" | "default_global_retention" | "max_global_retention" | "default_failures_retention" | undefined' and '"max_retention"' have no overlap.
```
---
## Non-SPEC errors (for reference)
The following 3 errors are **KIBANA** issues and do not require spec changes:
- `data_stream_serialization.ts:125:5` — Kibana's intersection type hardcodes `effective_retention?: string` but the spec correctly types it as `Duration` (`string | -1 | 0`). Kibana must widen its local type.
- `register_get_route.ts:192:11` and `register_get_route.ts:271:13` — Same root cause: Kibana has local variables typed as `string | undefined` being assigned `Duration | undefined` values from the generated client. Kibana needs to use `Duration` (or `string | number`) in its local types.
> Generated by [Kibana type check analysis](https://github.com/elastic/elasticsearch-specification/actions/runs/26350678081) · ● 1.2M · [◷](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: 26350678081, workflow_id: kibana-type-check-analysis, run: https://github.com/elastic/elasticsearch-specification/actions/runs/26350678081 -->
<!-- gh-aw-workflow-id: kibana-type-check-analysis -->
<!-- gh-aw-workflow-call-id: elastic/elasticsearch-specification/kibana-type-check-analysis -->
0 条评论