[9.5] [Lens] Assert truncate formatter contract instead of pinning top value (#288956) - #290653
Merged
Merged
Conversation
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)
Contributor
Author
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
Test Failures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.5:Questions ?
Please refer to the Backport tool documentation