Skip to content

[9.5] [Lens] Assert truncate formatter contract instead of pinning top value (#288956) - #290653

Merged
kibanamachine merged 1 commit into
elastic:9.5from
kibanamachine:backport/9.5/pr-288956
Sep 11, 2026
Merged

[9.5] [Lens] Assert truncate formatter contract instead of pinning top value (#288956)#290653
kibanamachine merged 1 commit into
elastic:9.5from
kibanamachine:backport/9.5/pr-288956

Conversation

@kibanamachine

Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.5:

Questions ?

Please refer to the Backport tool documentation

elastic#288956)

Fixes elastic#287650

### Summary
- The `keyword formatters > should display truncate string formatter
correctly` test failed with `expected 'ant...' to sort of equal
'dal...'`.
- The datatable is a `Top 9 values` terms aggregation over a runtime
field emitting `links.raw`, spanning a 3-shard `logstash-*` data view.
Multi-shard terms aggregations are approximate, so when candidate values
are tightly clustered in count the #1 slot flips between runs (`dal...`
vs `ant...`) — both are valid truncations.
- This patch asserts the truncation *contract* (3 chars + `...`) via
`/^.{3}\.\.\.$/` instead of pinning a specific top value, since the
`TRUNCATE` formatter — not which value ranks first — is what this test
verifies.

### Context
- Follows the fix proposed by the [Failed Test
Investigator](elastic#287650 (comment)):
the returned cell was a valid truncation, so the formatter rendered
correctly; only the non-deterministic underlying top value changed. This
is expected Elasticsearch behavior, not a product or timing bug.
- The new assertion still fails if truncation regresses (wrong length or
missing ellipsis), so formatter coverage is preserved. `.match(RegExp)`
is supported by `@kbn/expect`.
- Failed twice on `kibana-on-merge` (main) — the local pipeline, not
Cloud-specific — consistent with a data/assertion issue rather than an
environment one.

<details>
<summary>Verification</summary>

#### Verified locally

✅ Passed: `node scripts/eslint
x-pack/platform/test/functional/apps/lens/group2/field_formatters.ts`

#### Not verified locally

- This is an FTR test requiring a live Elasticsearch + Kibana, which
cannot be run in this environment. Its CI covers the change once the PR
is open.

</details>

> [!NOTE]
> Share feedback in #kibana-qa. Mention `@copilot` to make quick
changes.

> Generated by [Flaky Test
Fixer](https://github.com/elastic/kibana/actions/runs/33747031300) for
elastic#287650 · opus · 156.2 AIC · ⌖ 38 AIC · ⊞ 12.8K ·
[◷](https://github.com/search?q=repo%3Aelastic%2Fkibana+%22gh-aw-workflow-id%3A+flaky-test-fixer%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: Flaky Test Fixer, engine: claude, version:
2.1.165, model: opus, id: 33747031300, workflow_id: flaky-test-fixer,
run: https://github.com/elastic/kibana/actions/runs/33747031300 -->

<!-- gh-aw-workflow-id: flaky-test-fixer -->
<!-- gh-aw-workflow-call-id: elastic/kibana/flaky-test-fixer -->

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
(cherry picked from commit dfab8ee)
@kibanamachine kibanamachine self-assigned this Sep 11, 2026
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Sep 11, 2026
@kibanamachine
kibanamachine enabled auto-merge (squash) September 11, 2026 17:35
@kibanamachine

Copy link
Copy Markdown
Contributor Author

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

Test Failures

  • [job] [logs] FTR Configs #8 / core route timeouts idle socket should timeout if payload sending has too long of an idle period

cc @kibanamachine

@kibanamachine
kibanamachine merged commit e0127ad into elastic:9.5 Sep 11, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant