build(deps): migrate frontend to Grafana 13.x#156
Merged
Conversation
Bump @grafana/data, @grafana/ui, @grafana/runtime, @grafana/schema, and @grafana/i18n to ^13.1.1, @grafana/llm to ^1.0.9, and @grafana/scenes to ^8.13.3 (required, since 6.42.3s PanelBuilders imports a @grafana/schema datagrid export removed in v13). React and react-dom stay on 18 since Grafana 13 (through the latest release and main) still peer-depends on React 18; per Grafana own 12.x to 13.x migration guide, plugins should align with the host runtime React instance rather than bundling a different major version. Also: - Drop the now-obsolete @grafana/scenes deep-import webpack alias and shim (its dist layout and package.json exports field changed in v8, and the jsx-runtime bundling issue it originally worked around no longer reproduces for scenes itself). - Add an override so @grafana/llm (still capped at ^12) peerDependencies do not block installing the v13 @grafana/data and runtime line. - Narrow the local React 19 compat artifact scan to compiled .js output only, since .js.map sourcesContent embeds dependencies pre-bundling source and can contain informational-only jsx-runtime references that never reach the shipped bundle. - Allowlist the one remaining, Grafana-documented false-positive react-detect finding (floating-ui react jsxRuntimeImport), since our global jsx-runtime webpack alias already keeps that string out of the compiled bundle. - Bump plugin.json grafanaDependency floor to >=13.0.0 and pin is-compatible.yml levitate targets to the validated 13.1.1 baseline. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…7a347e715a9 # Conflicts: # .github/workflows/is-compatible.yml
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.
Summary
Migrates the frontend from Grafana 12.x to 13.x dependencies. This is a deliberate housekeeping upgrade (not urgent - no v13 feature is currently blocking us), done to stop future
@grafana/*@latestcompatibility drift and to close the gap with the dev environment, which already defaults to a Grafana 13.0.1 server.@grafana/data,@grafana/ui,@grafana/runtime,@grafana/schema,@grafana/i18n→^13.1.1@grafana/llm→^1.0.9(peer-capped at@grafana/data/runtime ^12; added anoverridesentry so install succeeds - verified functionally fine)@grafana/scenes→^8.13.3(required, not optional:6.42.3'sPanelBuildersstatically imports a@grafana/schemadatagrid export removed in v13, hard build failure otherwise)plugin.jsongrafanaDependencyfloor bumped>=12.3.0→>=13.0.0, since we have only built/tested against the 13.1.1 surface.github/workflows/is-compatible.ymltargetspinned to the validated13.1.1baselineReact stays on 18. I initially assumed a React 19 bump was needed alongside this, but verified directly against
grafana/grafana's ownpackage.json(tagsv13.0.1,v13.0.4,v13.1.0,v13.1.1, andmain) that Grafana 13 still ships React 18.3.1, and@grafana/ui@13.1.1's peer dependencies hard-requirereact/react-dom ^18.0.0(forcing 19 breaksnpm install). Grafana's own 12.x→13.x migration guide explicitly says not to force a different React version - plugins should align to the host's runtime. So no React 19 changes here.Removed an obsolete workaround: the
@grafana/scenesdeep-import webpack alias and its accompanying type shim (src/grafanaScenes.ts,src/types/grafanaScenesDeep.d.ts) existed to route around a jsx-runtime bundling leak in scenes' old barrel file. v8.13.3'sdist/esmno longer referencesreact/jsx-runtimeand itspackage.jsonexportsfield is now fully restrictive (deep imports aren't even possible anymore), so the shim was both obsolete and incompatible with the new file layout.Validator scan tightened: narrowed
scripts/validate-react19.js's artifact scan to compiled.jsonly (excluding.js.map, whosesourcesContentembeds dependencies' pre-bundling source and produced a false positive from@floating-ui/react's jsx-runtime import - confirmed the compiled.jsnever contains that string). Allowlisted the one remaining@grafana/plugin-validatorreact-detectfinding on the same package, per Grafana's migration docs, which lists this as a common false positive once the existing jsx-runtime webpack alias is applied. Documented as a third expected-benignnpm run validatefinding inCLAUDE.md.Test plan
npm run typecheck- cleannpm run lint- 0 errors, 9 warnings (pre-existing, confirmed identical on base branch)npm run build- frontend + backend both succeednpm run test:ci- 491/491 passing, 34 suitesnpm run validate- exit 0; only expected findings (unsigned plugin, sponsor-link recommendation, documented floating-ui/react false positive, pre-existing "Go SDK older than 2 months")go test ./pkg/...- all packages passmodule.js, config/app page routes, and backend routes (mcp/servers,prompt-defaults,sessions) all 200, clean container logs🤖 Generated with Claude Code
Note
High Risk
Major Grafana/scenes upgrade changes the entire UI dependency surface and minimum host version; regressions in plugin loading, scenes panels, or LLM integration are possible until manual browser QA completes.
Overview
Frontend baseline moves from Grafana 12.4.x to 13.1.1, with
@grafana/scenesjumping to 8.13.3 so builds stay compatible with the v13@grafana/schemasurface.@grafana/llmis bumped andpackage.jsonoverrides align its peers with the new@grafana/data/@grafana/runtimeversions. React stays on 18 (matches Grafana 13 host expectations).Host and CI alignment:
src/plugin.jsongrafanaDependencyfloor is raised to>=13.0.0, and.github/workflows/is-compatible.ymlpins compatibilitytargetsto the same 13.1.1 stack (plus@grafana/e2e-selectorsand@grafana/experimental) instead of tracking@latest.Validator / docs:
CLAUDE.mddocuments an expected benignreact-19-dep-jsxRuntimeImportfinding from transitive@floating-ui/react, tied to existingwebpack.config.tsjsx-runtime aliases andscripts/validate-react19.js(per the PR’s validator tightening). Obsolete@grafana/scenesdeep-import webpack shims are removed where v8 no longer needs them.Reviewed by Cursor Bugbot for commit 51f01f2. Bugbot is set up for automated code reviews on this repo. Configure here.