Skip to content

Emit x-databricks-launch-stage for all stamped launch stages - #6516

Open
Sankalp-Mittal wants to merge 7 commits into
mainfrom
sankalp-mittal/jsonschema-add-release-version
Open

Emit x-databricks-launch-stage for all stamped launch stages#6516
Sankalp-Mittal wants to merge 7 commits into
mainfrom
sankalp-mittal/jsonschema-add-release-version

Conversation

@Sankalp-Mittal

@Sankalp-Mittal Sankalp-Mittal commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Changes

The bundle schema generator only emitted x-databricks-launch-stage for private-preview fields

As a result, downstream codegen could only tell private-preview fields apart from everything else — public-preview, public-beta, and GA fields all looked identical (unmarked).

  • Every field the contract stamps with a launch stage — GA, PUBLIC_BETA, PUBLIC_PREVIEW, PRIVATE_PREVIEW — now emits x-databricks-launch-stage, so downstream tooling can read each field's stability.
  • A field the contract leaves unstamped stays unmarked rather than defaulting to GA, handled by the new parseFieldLaunchStage. The enum path keeps dropping GA (normalizeLaunchStage), unchanged.

The human-readable [Public Preview] / [Beta] description prefix (PreviewTag) was already emitted for all stages, so this only adds the machine-readable field.

Keeping in line with the existing pattern PRIVATE_PREVIEW hides from autocomplete

Resource types

launchStageOverrides maps whole resource Go-types to a launch stage (the Postgres* resources at Public Beta). That override now applies to the resource type descriptor as well, not just its fields, so the 7 Postgres* resource types carry a type-level x-databricks-launch-stage: PUBLIC_BETA (and the [Beta] description prefix, matching how their fields already render). This makes launchStageOverrides a per-resource stability registry that tags both the type and its fields.

Generated output

bundle/schema/jsonschema.json regenerated via ./task generate-schema. The diff is large by design — many fields now carry an explicit stage marker. No existing markers were removed.

Verification

  • pydabs codegen is a no-op: it branches only on PRIVATE_PREVIEW, so python/databricks/bundles/** is unchanged after ./task pydabs-codegen.
  • Schema-generator unit tests updated to assert every stamped stage emits the marker, plus TestExtractAnnotationsStampsTypeLaunchStage for the type-level stamp.

This pull request and its description were written by Isaac.

The schema generator only emitted x-databricks-launch-stage for
private-preview fields, bundling two concerns in one branch: hiding
private-preview fields from editor completions (DoNotSuggest) and
emitting the machine-readable launch stage. Downstream codegen could
therefore only distinguish private-preview from everything else.

Split the two concerns: DoNotSuggest stays private-preview-only, while
every field the contract stamps with a launch stage — GA, PUBLIC_BETA,
PUBLIC_PREVIEW, PRIVATE_PREVIEW — now emits x-databricks-launch-stage so
downstream tooling can read each field's stability. A field the contract
leaves unstamped stays unmarked rather than defaulting to GA, via the new
parseFieldLaunchStage (the enum path keeps dropping GA, unchanged).

Regenerated jsonschema.json. pydabs codegen is unaffected (it branches
only on PRIVATE_PREVIEW), so python/databricks/bundles is unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @janniklasrose -- recent work in bundle/internal/schema/, bundle/schema/
  • @pietern -- recent work in bundle/internal/schema/, bundle/schema/

Eligible reviewers: @andrewnester, @anton-107, @denik, @lennartkats-db, @shreyas-goenka

Suggestions based on git history. See OWNERS for ownership rules.

launchStageOverrides maps whole resource Go-types to a launch stage
(the Postgres* resources at Public Beta), but OverrideLaunchStage was
only applied to fields, so the type's own (self) schema stayed
unstamped. Apply the override to the type descriptor too: the contract
carries no type-level stage, so passing GA ("") returns the override
when one is set, else "". The self descriptor already flows through
assignAnnotation, so the type-level x-databricks-launch-stage now lands
in jsonschema.json.

This makes launchStageOverrides a per-resource stability registry that
tags both the type and its fields.

Regenerated jsonschema.json: the 7 Postgres* resource types gain the
type-level PUBLIC_BETA marker (and the [Beta] description prefix, matching
how their fields already render). pydabs codegen is unaffected.

Co-authored-by: Isaac <no-reply@databricks.com>
// stability, not just previews. An empty stage means the contract assigns none;
// it stays empty (unmarked) instead of defaulting to GA, so only fields the
// contract actually stamps carry a stage.
func parseFieldLaunchStage(launchStage string) (clijson.LaunchStage, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can inline, the function is only used once.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

But then I'd have to remove the unit test that asserts the behaviour for this function, I think it's better to keep it

assert.Error(t, err)
}

func TestParseFieldLaunchStage(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tests are unnecessary. The clijson methods are already tested.

require.NoError(t, err)

self := annotations[getPath(reflect.TypeFor[resources.PostgresRole]())].Self
assert.Equal(t, clijson.LaunchStagePublicBeta, self.LaunchStage)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this test break once postgres role moves of beta? Where is this value even coming from?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For your context: postgres resources in DABs are pinned to Beta despite APIs being GA (#6226)

I assume when we remove that override eventually, this test will fail and be updated/removed alongside.

Comment thread bundle/internal/schema/annotations_test.go Outdated
Comment thread bundle/internal/schema/annotations_test.go Outdated
require.NoError(t, err)

self := annotations[getPath(reflect.TypeFor[resources.PostgresRole]())].Self
assert.Equal(t, clijson.LaunchStagePublicBeta, self.LaunchStage)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For your context: postgres resources in DABs are pinned to Beta despite APIs being GA (#6226)

I assume when we remove that override eventually, this test will fail and be updated/removed alongside.

Comment on lines +195 to +200
// The contract carries no schema-level launch stage, so a type's stage
// comes only from the override map (launchStageOverrides), which stamps
// whole resources — e.g. Postgres* at Public Beta. Passing "" (GA, the
// least restrictive stage) returns the override when one is set for the
// type, else "". Enum schemas do carry per-value launch stages below.
typeStage := annotation.OverrideLaunchStage(basePath, "")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typeStage is confusing - let's maybe call it what it is: typeLaunchStage or typeOverriddenLaunchStage. But this also feels a bit hacky (mostly because it's confusing to find that OverrideLaunchStage is called in two locations). Why do we need this extra override here if no other resources have launch stage in the schema?

The comment is too verbose and not helping: Remove mention of override map (that's internal to OverrideLaunchStage).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

So this is to add the Launch Stage tag for resources in jsonschema.json, if not overriden each resource has release stage GA, so that's why I use this here, I did not want to hardcode overrides in 2 places

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 994851a

Run: 33856876314

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 1 1 274 1220 5:24
💚​ aws windows 1 1 276 1218 4:08
💚​ azure linux 1 1 273 1220 6:20
💚​ azure windows 1 1 275 1218 4:12
💚​ gcp linux 1 1 274 1220 6:18
💚​ gcp windows 1 1 276 1218 4:12
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:07 gcp windows TestAccept
4:07 azure windows TestAccept
4:03 aws windows TestAccept
3:52 gcp linux TestAccept
3:51 aws linux TestAccept
3:49 azure linux TestAccept

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.

4 participants