Skip to content

[BREAKINGCHANGE] plugin-system: remove unused QueryEditorProps<Spec> type - #443

Open
armnkumar321-spec wants to merge 1 commit into
perses:mainfrom
armnkumar321-spec:breakingchange/remove-query-editor-props
Open

armnkumar321-spec wants to merge 1 commit into
perses:mainfrom
armnkumar321-spec:breakingchange/remove-query-editor-props

Conversation

@armnkumar321-spec

Copy link
Copy Markdown

Description

Fixes perses/perses#3202

Warning

Breaking change. This removes a type from the public API of @perses-dev/plugin-system. As agreed in perses/perses#3202, it is removed outright with no deprecation period.

This removes the exported generic QueryEditorProps<Spec> interface from plugin-system/src/model/plugin-base.ts, along with its QueryDefinition import. Nothing else in that file used the import.

-import type { QueryDefinition } from '@perses-dev/spec';
 import React from 'react';
 ...
-/**
- * Common props passed to query editor component
- */
-export interface QueryEditorProps<Spec> extends OptionsEditorProps<Spec> {
-  queries: QueryDefinition[];
-}

What this PR does not change:

  • QueryEditorProps in plugin-system/src/components/MultiQueryEditor/QueryEditorContainer.tsx stays. It's a separate, non-exported interface with a different shape (queryTypes, value: QueryDefinition, onQueryRun, …), and QueryEditor still uses it.
  • The wildcard barrels (model/index.ts → src/index.ts) are left alone. The type simply stops being exported through them.

Why the removal is safe

  • Inside this repo: an exact-word search for QueryEditorProps (grep -rnw) matches only the local interface in QueryEditorContainer.tsx. Nothing referenced the exported one.
  • Across the perses org: gh search code "QueryEditorProps" --owner perses returns 26 files outside this repo, in perses/plugins, perses/perses (CLI test data) and perses/examples-plugin. Every hit is a substring match on a plugin's own type, such as LokiQueryEditorProps or TraceQueryEditorProps. An exact-word grep on fresh shallow clones of all three repos found no uses.
  • At runtime: PluginSpecEditor renders <OptionsEditorComponent {...others} value={value} /> and never passes a queries prop. So an editor typed with QueryEditorProps<Spec> would never have received queries. The type described a contract the runtime didn't honour.

Migration notes (for the release notes)

QueryEditorProps<Spec> removed from @perses-dev/plugin-system

The exported QueryEditorProps<Spec> type has been removed. It extended OptionsEditorProps<Spec> with a queries: QueryDefinition[] field, which the plugin runtime never filled in.

Third-party plugins that import it will get a TypeScript error such as Module '"@perses-dev/plugin-system"' has no exported member 'QueryEditorProps'. To migrate, use OptionsEditorProps<Spec>, which the official query plugins (Prometheus, Loki, Tempo, …) already use:

-import { QueryEditorProps } from '@perses-dev/plugin-system';
+import { OptionsEditorProps } from '@perses-dev/plugin-system';

-type MyQueryEditorProps = QueryEditorProps<MyQuerySpec>;
+type MyQueryEditorProps = OptionsEditorProps<MyQuerySpec>;

If your editor read props.queries, it was always undefined at runtime, so you can delete that code. There's no runtime behaviour change.

The QueryEditor component and the props MultiQueryEditor uses internally are unchanged.

Verification

Run locally on top of main (169bfa3) after npm ci:

Check Result
npm run format:check ✅ pass
npm run lint ✅ pass
npm run type-check ✅ pass (all workspaces)
npm run build ✅ pass (10/10 tasks)
npm run test ✅ client 39/39, components 1021/1021, dashboards 256/256, plugin-system 227/227 (including MultiQueryEditor.test.tsx and QueryEditorContainer.test.tsx), explore 7/7 (see note)
Emitted declarations ✅ plugin-system/dist/model/plugin-base.d.ts no longer declares QueryEditorProps; no .d.ts under plugin-system, dashboards or explore dist/ references it
make checklicense ⚠️ not run: Go isn't installed locally. No files added, and the license header in the edited file is unchanged.

Note on explore: my machine has Node 26.3.0 instead of the pinned 24.19.0. On Node 26, Node's built-in localStorage global shadows jsdom's, so 5 ExploreManager.test.tsx tests fail with Cannot read properties of undefined (reading 'setItem'). The same 5 tests fail the same way on unmodified main, so this PR didn't cause them. With NODE_OPTIONS=--no-experimental-webstorage, all 7 explore tests pass on this branch.

Screenshots

N/A: type-only change, no UI impact.

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. (N/A)
  • Code follows the UI guidelines. (N/A)
  • E2E tests are stable and unlikely to be flaky. (N/A)

…type

Remove the exported generic QueryEditorProps<Spec> interface from
plugin-system/src/model/plugin-base.ts, together with the
QueryDefinition import that only that interface used.

The type was re-exported from the @perses-dev/plugin-system public
entry point, but nothing in perses/shared, perses/plugins,
perses/perses or perses/examples-plugin uses it, and the plugin
runtime never passes a `queries` prop to editor components.

Plugins that imported it should type their editors with
OptionsEditorProps<Spec>, which is what the official query plugins
already use.

The separate, non-exported QueryEditorProps interface in
MultiQueryEditor/QueryEditorContainer.tsx is unchanged.

Refs perses/perses#3202

Signed-off-by: Aman Kumar <246823277+armnkumar321-spec@users.noreply.github.com>
@armnkumar321-spec
armnkumar321-spec requested a review from a team as a code owner November 11, 2026 23:59
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.

QueryEditorProps should be removed from the code base

1 participant