Skip to content

[8.19] [Console] Fix method suggestion order (#270787)#271634

Merged
kapral18 merged 2 commits into
elastic:8.19from
kapral18:backport/8.19/pr-270787
May 29, 2026
Merged

[8.19] [Console] Fix method suggestion order (#270787)#271634
kapral18 merged 2 commits into
elastic:8.19from
kapral18:backport/8.19/pr-270787

Conversation

@kapral18
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

@kapral18 kapral18 requested a review from kibanamachine as a code owner May 28, 2026 08:24
@kapral18 kapral18 added the backport This PR is a backport of another PR label May 28, 2026
@kapral18 kapral18 enabled auto-merge (squash) May 28, 2026 08:24
@kibanamachine kibanamachine requested review from SoniaSanzV and removed request for kibanamachine May 28, 2026 08:24
Closes elastic#259251

## Summary

- Pins Console HTTP method completion ordering with explicit `sortText`
values so Monaco does not fall back to alphabetical label sorting.
- Keeps the existing method set unchanged while ordering `GET` first and
`DELETE` last.

## Root Cause

- Monaco uses `sortText` for completion ordering and falls back to the
item label when `sortText` is missing, which can put `DELETE` before
safer/default verbs.

## Fix

- Assign stable `sortText` values to method completion items based on
the intended canonical order.
- Add a focused unit test that sorts method suggestions the same way and
verifies `GET` is first and `DELETE` is last.

## Before
<img width="723" height="466" alt="image"
src="https://github.com/user-attachments/assets/faf244b2-4207-483b-acbc-32b148441b18"
/>

## After
<img width="725" height="437" alt="image"
src="https://github.com/user-attachments/assets/782c0c60-6052-4c28-80bc-f45403fa1383"
/>

## Test Plan

- `node scripts/jest
--config=src/platform/plugins/shared/console/jest.config.js
src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_actions_provider.test.ts`
— passed.
- `node scripts/check_changes.ts` — passed.

## Release Note

- Fixes Console autocomplete so `GET` is shown before `DELETE` when
suggesting HTTP methods on an empty request line.

Assisted with Cursor using GPT-5.5

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

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit 8849fcf)

# Conflicts:
#	src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_actions_provider.test.ts
@kapral18 kapral18 force-pushed the backport/8.19/pr-270787 branch from e785329 to 77255e0 Compare May 29, 2026 11:02
The console autocomplete FTR suite is active on 8.19 (describe.skip on
main/9.x), so the new sortText-based ordering from elastic#270787 made the
stale HTTP methods assertion fail. Update the expected P* order to
match the pinned order (POST, PUT, PATCH).

Co-authored-by: Cursor <cursoragent@cursor.com>
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
console 199.8KB 199.8KB +23.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.6MB 3.6MB +127.0B

History

@kapral18 kapral18 merged commit c1d06a0 into elastic:8.19 May 29, 2026
24 checks passed
@kapral18 kapral18 deleted the backport/8.19/pr-270787 branch May 29, 2026 22:42
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.

3 participants