Skip to content

[ENHANCEMENT] Loki: upgrade @grafana/lezer-logql to 0.4.2 - #932

Merged
Nexucis merged 1 commit into
mainfrom
agents/loki-upgrade-lezer-logql
Nov 16, 2026
Merged

Nexucis merged 1 commit into
mainfrom
agents/loki-upgrade-lezer-logql

Conversation

@Nexucis

@Nexucis Nexucis commented Nov 16, 2026

Copy link
Copy Markdown
Member

Description

Follow-up of #904, which upgraded @grafana/lezer-logql to 0.4.2 for the VictoriaLogs plugin only. This PR upgrades the
Loki plugin to the same version.

  • loki/package.json: @grafana/lezer-logql ^0.2.8 → ^0.4.2. It was the only outdated dependency of the plugin
    (react-compiler-runtime is already at its latest version, 1.0.0).
  • package-lock.json: the root copy moves from 0.2.9 to 0.4.2 and the nested copy that [Snyk] Upgrade @grafana/lezer-logql from 0.2.9 to 0.4.2 #904 installed for VictoriaLogs
    is removed, so both plugins share a single version of the parser.
  • loki/src/components/logql-extension.test.ts (new): checks that the editor's LogQL language parses the approximate
    aggregations without syntax errors. The two approx_* cases fail with 0.2.9 and pass with 0.4.2.

User-visible change: with 0.2.9, the Loki query editor parsed valid queries using approx_topk (added in 0.4.1)
or approx_count_distinct (added in 0.4.2) into error nodes, which the highlighter styles as invalid. They now parse
correctly. Otherwise the grammar change is additive (4 new node types, none removed); on a sample of existing LogQL
queries, the syntax trees are identical between both versions, and label name/value and pipe completions keep working,
including inside the new functions.

Compatibility notes:

  • Term IDs shift by one between both versions. complete.ts imports them by name from the package, and
    @grafana/lezer-logql/@lezer/* are bundled with the plugin (not shared through module federation), so the parser
    and the IDs always come from the same copy.
  • Since 0.4.0, the package pins its @lezer/lr peer dependency to exactly 1.4.10, which is already the version in the
    lockfile (still a single copy).
  • 0.4.0 removed the formatLokiQuery export, which is not used in this repository.

Validation (Node v24.19.0 from .nvmrc, npm 11.17.0 from packageManager):

  • npm ci: passed
  • npm run lint: passed (no new warnings)
  • npm run format:check: passed
  • npm run type-check: passed
  • npm run test: passed (Loki: 97 tests)
  • npm install --no-save react@^19 react-dom@^19 @types/react@^19 @types/react-dom@^19, then npm run type-check and
    npm run test: passed
  • percli plugin build --plugin.path=loki --skip.npm-install=true: passed
  • percli plugin build --plugin.path=victorialogs --skip.npm-install=true: passed

Screenshots

No component changes. The only visible effect is that queries using approx_topk or approx_count_distinct are no
longer highlighted as invalid in the Loki query editor.

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

The Loki query editor now parses the approx_topk and approx_count_distinct
aggregations instead of reporting syntax errors for these valid queries.

The Loki and VictoriaLogs plugins now share a single version of the parser.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Augustin Husson <augustin.husson@amadeus.com>
@Nexucis
Nexucis requested a review from a team as a code owner November 16, 2026 12:02
@Nexucis
Nexucis requested review from jgbernalp and removed request for a team November 16, 2026 12:02
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 4d1f24f.

@Nexucis
Nexucis merged commit d1b9223 into main Nov 16, 2026
19 checks passed
@Nexucis
Nexucis deleted the agents/loki-upgrade-lezer-logql branch November 16, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant