Skip to content

FEATURE BRANCH: Add v2alpha2 api version: Consolidate schema breaking changes #108172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

@dprokop dprokop added no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Jul 17, 2025
@dprokop dprokop changed the title Schemav2 bring back reverts Consolidate Breaking changes from DS refactor through app platform conversion Jul 17, 2025
@ivanortegaalba ivanortegaalba changed the title Consolidate Breaking changes from DS refactor through app platform conversion Add v2alpha2 api version: Consolidate schema breaking changes Jul 17, 2025
ivanortegaalba and others added 4 commits July 17, 2025 12:17
* Use v2alpha2 by default

* Apply only DS changes to alpha2

* Use v2alpha2 by default except to query

* Create a v2 index in @grafana/schema

* Update path and apply lint

* Update tests
@dprokop dprokop added no-changelog Skip including change in changelog/release notes and removed no-changelog Skip including change in changelog/release notes labels Jul 17, 2025
@dprokop dprokop marked this pull request as ready for review July 17, 2025 14:17
@dprokop dprokop requested review from a team as code owners July 17, 2025 14:17
@dprokop dprokop requested review from axelavargas and juanicabanas and removed request for a team July 17, 2025 14:17
dprokop and others added 2 commits July 22, 2025 12:41
… variable (#108237)

* Schema v2: Introduce group/datasource convention to GroupBy and AdHoc variables

* add conversion

* App Installer: Authorizer support (#108419)

* Chore: use `satisfies` and remove a load of `any`s (#108397)

use satisfies and remove a load of anys

* improve logging and fail unified-storage migration with more than 0 errors (#108471)

improve logging and fail unified-storage migration with more than 0 errors

* fix conversion test

* Secrets: Create more granular fixed roles for SecureValues (#108382)

* Provisioning: Fix bug in job progress recording (#108440)

Fix bug in job progress recording

* Provisioning: Fix ImportAllPanelsFromLocalRepository test (#108441)

* Provisioning: Skip flaky test

* Fix flaky provisioning test

* Fix lint

---------

Co-authored-by: Roberto Jimenez Sanchez <[email protected]>

* BulkDeleteProvisionedResource: Move progress bar into a second step (#108417)

* Move progress bar into a second step

---------

Co-authored-by: Alex Khomenko <[email protected]>

* [Dashboard Schema Codegen] Move dashboard CUE codegen block back up into kind body (#108476)

[Dashboard Schema Codegen] Move dashboard CUE codegen block back up into kind body to make sure new versions have the same settings.

---------

Co-authored-by: Haris Rozajac <[email protected]>
Co-authored-by: Todd Treece <[email protected]>
Co-authored-by: Ashley Harrison <[email protected]>
Co-authored-by: Will Assis <[email protected]>
Co-authored-by: Matheus Macabu <[email protected]>
Co-authored-by: Roberto Jiménez Sánchez <[email protected]>
Co-authored-by: Roberto Jimenez Sanchez <[email protected]>
Co-authored-by: Yunwen Zheng <[email protected]>
Co-authored-by: Alex Khomenko <[email protected]>
Co-authored-by: Austin Pond <[email protected]>
Co-authored-by: Ivan Ortega <[email protected]>
harisrozajac and others added 2 commits July 22, 2025 17:48
…onvention (#108148)

* Dashboards API: Register v2alpha2 API

* Prepare conversion functions

* Fix test

* Refactor VizConfigKind to follow DataQueryKind convention

* fix tests

* use new dataquerykind convention alpha 2

* add conversion

* fix tests

* fix tests

* fix another test

* Fix merge

---------

Co-authored-by: Dominik Prokop <[email protected]>
@harisrozajac harisrozajac marked this pull request as ready for review July 23, 2025 14:55
@harisrozajac harisrozajac requested a review from a team as a code owner July 23, 2025 14:55
Copy link
Contributor

@ivanortegaalba ivanortegaalba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove unnecessary changes from other apps/* and code-wise looks good to me!

Comment on lines 974 to 979
"variables": [
null,
null,
null,
null
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no conversions for variables!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch!

Copy link
Collaborator Author

@dprokop dprokop Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivanortegaalba - just pushed these :)

2d941da
be8b999

@ivanortegaalba ivanortegaalba requested a review from Copilot July 25, 2025 11:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the v2alpha2 API version by consolidating schema breaking changes. The main purpose is to update all imports and references from v2alpha1 to v2alpha2 throughout the codebase, while also implementing structural changes to better organize data queries and visualization configurations.

Key changes include:

  • Migration from v2alpha1 to v2alpha2 API version across all files
  • Restructuring of data query schema to use a more consistent DataQuery pattern with group and datasource properties
  • Refactoring of visualization configuration to separate plugin metadata from configuration data

Reviewed Changes

Copilot reviewed 107 out of 107 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/grafana-schema/src/schema/dashboard/v2alpha2/types.spec.gen.ts New schema definition for v2alpha2 with restructured data queries and viz config
packages/grafana-schema/src/schema/dashboard/v2.ts Updated export path to point to v2alpha2
public/app/features/dashboard/api/v2.ts Updated API version constant from v2alpha1 to v2alpha2
Multiple test files Updated API version references and test data structures
Multiple transformation files Updated to handle new data query structure with group/datasource pattern

enable: boolean;
hide: boolean;
iconColor: string;
name: string;
builtIn?: boolean;
filter?: AnnotationPanelFilter;
// Catch-all field for datasource-specific properties
// Catch-all field for datasource-specific properties. Should not be available in as code tooling.
Copy link
Preview

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states this field 'should not be available in as code tooling' but doesn't explain why or provide guidance on alternatives. Consider expanding this comment to explain the intended use case and provide clearer guidance.

Suggested change
// Catch-all field for datasource-specific properties. Should not be available in as code tooling.
// Catch-all field for datasource-specific properties. This field is intended for internal use by datasources
// to store configuration options that are not part of the standard schema. It should not be available in
// "as code" tooling because its structure is highly dynamic and specific to individual datasources, making
// it unsuitable for validation or code generation. Developers should avoid relying on this field in generic
// tooling and instead use well-defined schema fields whenever possible.

Copilot uses AI. Check for mistakes.

Comment on lines +434 to +437
console.error(
'Misconfigured AnnotationsDataLayer: Data source is required for annotations. Resolving default data source',
layer,
layerDs
Copy link
Preview

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using console.error directly in production code is not recommended. Consider using a proper logging framework or service that can be configured for different environments.

Suggested change
console.error(
'Misconfigured AnnotationsDataLayer: Data source is required for annotations. Resolving default data source',
layer,
layerDs
const logger = getLogger('transformSceneToSaveModelSchemaV2');
logger.error(
'Misconfigured AnnotationsDataLayer: Data source is required for annotations. Resolving default data source',
{ layer, layerDs }

Copilot uses AI. Check for mistakes.

@@ -257,14 +266,22 @@ function getDataSourceForQuery(
};
}

// If we don't find a default datasource, return undefined
return undefined;
if (dsList && !dsList[defaultDatasource]) {
Copy link
Preview

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks if dsList exists but then accesses dsList[defaultDatasource] without verifying that defaultDatasource is defined. This could throw an error if defaultDatasource is undefined or null.

Copilot uses AI. Check for mistakes.

Comment on lines +275 to +277
if (!dataQuery.datasource?.name) {
delete dataQuery.datasource;
}
Copy link
Preview

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for handling missing datasource names appears in multiple places. Consider extracting this into a utility function to reduce code duplication and improve maintainability.

Suggested change
if (!dataQuery.datasource?.name) {
delete dataQuery.datasource;
}
const sanitizedDataQuery = sanitizeDatasource(dataQuery);

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate Breaking changes from DS refactor through app platform conversion
3 participants