Skip to content

Simplify bundle JSON schema annotation system#4670

Draft
shreyas-goenka wants to merge 12 commits intomainfrom
simplify-schema-annotations
Draft

Simplify bundle JSON schema annotation system#4670
shreyas-goenka wants to merge 12 commits intomainfrom
simplify-schema-annotations

Conversation

@shreyas-goenka
Copy link
Contributor

@shreyas-goenka shreyas-goenka commented Mar 5, 2026

Summary

Simplify how bundle JSON schema annotations are managed:

  • Read OpenAPI descriptions directly from the spec at runtime instead of pre-extracting them into separate YAML files. Persist them back to annotations.yml so the schema is reproducible without the spec.
  • Remove annotations_openapi.yml and annotations_openapi_overrides.yml which flip-flopped on every SDK bump. Merge everything into a single annotations.yml.
  • Use bundle paths (e.g. resources.jobs.*) as annotation keys instead of Go type paths.
  • Remove unused bundle/docsgen/ package.

Test plan

  • Existing schema tests pass
  • Schema generation is deterministic (make schema is idempotent)

🤖 Generated with Claude Code

@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Mar 5, 2026

Commit: 2d318c0

Run: 22982178959

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 8 7 268 781 5:57
💚​ aws windows 8 7 270 779 4:35
🔄​ aws-ucws linux 2 7 7 364 696 8:43
🔄​ aws-ucws windows 2 7 7 366 694 5:42
💚​ azure linux 2 9 271 779 5:28
💚​ azure windows 2 9 273 777 5:07
🔄​ azure-ucws linux 2 1 9 369 692 8:53
🔄​ azure-ucws windows 2 1 9 371 690 6:44
💚​ gcp linux 2 9 267 782 5:49
💚​ gcp windows 2 9 269 780 4:32
16 interesting tests: 7 SKIP, 6 RECOVERED, 3 flaky
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🔄​ TestAccept 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestAccept/ssh/connect-serverless-gpu 🙈​s 🙈​s 🔄​f 🔄​f 🙈​s 🙈​s 🔄​f 🔄​f 🙈​s 🙈​s
🔄​ TestAccept/ssh/connection 💚​R 💚​R 🔄​f 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R 💚​R
Top 20 slowest tests (at least 2 minutes):
duration env testname
3:40 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:39 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:35 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:24 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:14 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:13 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:13 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:13 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:13 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:13 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:13 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:06 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:38 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:21 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:15 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:12 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:10 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:09 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:06 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:05 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct

@shreyas-goenka shreyas-goenka force-pushed the simplify-schema-annotations branch from 2f2a2d7 to 6225f44 Compare March 6, 2026 21:52
@shreyas-goenka shreyas-goenka force-pushed the simplify-schema-annotations branch from e58258b to 08a6413 Compare March 9, 2026 13:19
@shreyas-goenka shreyas-goenka force-pushed the simplify-schema-annotations branch from 08a6413 to 963126c Compare March 9, 2026 13:22
@shreyas-goenka shreyas-goenka force-pushed the simplify-schema-annotations branch from 963126c to a508ab4 Compare March 9, 2026 13:38
shreyas-goenka and others added 6 commits March 11, 2026 23:10
Read OpenAPI descriptions directly from the spec at runtime instead of
pre-extracting them into annotation YAML files. This makes the OpenAPI
spec a requirement for schema generation and eliminates annotation files
that flip-flopped on every SDK bump.

Changes:
- Remove annotations_openapi.yml and annotations_openapi_overrides.yml
- Merge manual overrides into a single annotations.yml
- Use bundle paths (e.g. resources.jobs.*) as annotation keys instead
  of Go type paths
- Add path_mapping.go to resolve bundle paths to Go types via reflection
- Remove bundle/docsgen (was the only other consumer of annotations)
- Makefile schema targets now require DATABRICKS_OPENAPI_SPEC

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix copyloopvar lint warnings in annotations.go
- Fix gofmt issue in path_mapping_test.go
- Use maps.Copy instead of manual loop
- Restore permission level enums, lifecycle descriptions,
  markdownDescription, and SDK type overrides from the deleted
  annotations_openapi_overrides.yml into annotations.yml
- Update getOpenApiAnnotations to check embedded types for
  promoted field descriptions from OpenAPI spec
- Update TestNoDetachedAnnotations to handle Go type path keys

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…qlWarehouse, and SDK types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ter rebase

Add a "Download OpenAPI spec" step to the validate-generated-is-up-to-date
CI job so make schema can find .codegen/openapi.json. Also regenerate schema
and python codegen to sync with latest main (removed grant types, updated
SDK descriptions).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When DATABRICKS_OPENAPI_SPEC is set, OpenAPI-derived descriptions,
deprecation info, and output-only markers are now persisted into
annotations.yml. This makes the schema fully reproducible from
annotations.yml alone, so CI can run `make schema` without downloading
the OpenAPI spec.

- Change OutputOnly from *bool to string for clean YAML serialization
- Add schema-openapi Makefile target for generating with the spec
- Revert CI download step; make schema now works without the spec
- Merge annotations from both Go type paths and bundle paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shreyas-goenka and others added 3 commits March 11, 2026 23:10
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tions

The Permission type is shared across alerts, dashboards, database_instances,
and postgres_projects. Only one canonical annotation entry is needed since the
path mapping selects the shortest path. Also adds nolint:forbidigo comment
and uses slices.Contains for modernize linter.

Co-authored-by: Isaac
@shreyas-goenka shreyas-goenka force-pushed the simplify-schema-annotations branch from 9a16182 to fe3b5b7 Compare March 11, 2026 23:45
Permission level descriptions are now derived from the OpenAPI spec at
runtime rather than being baked into annotations. Enum values are sorted
alphabetically.

Co-authored-by: Isaac
When annotations.yml has entries for the same type under both a Go type
path and a bundle path, the old maps.Copy would overwrite entire
descriptors depending on random map iteration order. This caused the whl
description in PipelineLibrary to appear or disappear non-deterministically.

Use mergeDescriptor to properly combine descriptor fields when merging
duplicate annotation entries.

Co-authored-by: Isaac
The docsgen package is no longer used anywhere. Remove it along with
its .wsignore exclusion entries.

Co-authored-by: Isaac
Copy link
Member

@simonfaltum simonfaltum left a comment

Choose a reason for hiding this comment

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

Review (automated, 2 agents)

Verdict: Not ready yet | 0 Critical | 3 Major | 3 Gap(Major) | 3 Nit | 2 Suggestion

[Major] syncAnnotations overwrites hand-written annotations with OpenAPI

bundle/internal/schema/annotations.go (syncAnnotations)

mergeDescriptor(existing, desc) treats the OpenAPI annotation as override, but the intent (stated in the comment: "preserving hand-written fields") is the opposite. Compare with addAnnotations which correctly uses OpenAPI as base.

Suggestion: Swap arguments: mergeDescriptor(desc, existing).

[Major] OpenAPI metadata not persisted for fields with existing descriptions

bundle/internal/schema/annotations.go:86-101

If annotations.yml has a description for a field, the entire OpenAPI annotation is skipped during persistence, losing enum values, deprecation messages, preview status, and output-only markers. This breaks the "reproducible without the spec" goal.

Suggestion: Always persist the OpenAPI descriptor as base, merge annotations.yml on top.

[Major] PLACEHOLDER insertion for new CLI-only fields removed

The old missingAnnotations flow inserted PLACEHOLDER entries for fields missing descriptions. This refactor removes that behavior. New fields defined only in CLI types won't get added to annotations.yml.

Suggestion: Reintroduce a pass that records missing non-OpenAPI fields with PLACEHOLDER.

[Gap (Major)] TestRequiredAnnotationsForNewFields now skipped by default

bundle/internal/schema/main_test.go:43-57

Gated on DATABRICKS_OPENAPI_SPEC env var not set in standard CI. Missing annotations go undetected.

Suggestion: Split into always-on CLI check + spec-backed SDK check, or ensure CI sets the env var.

[Gap (Major)] No unit tests for getOpenApiAnnotations, mergeDescriptor, or syncAnnotations

bundle/internal/schema/annotations.go

Three significant logic functions with no direct tests. The merge direction bug (finding 1) would be caught by a simple unit test.

[Gap (Nit)] AGENTS.md still references deleted make docs target

AGENTS.md:29 - Dead instruction after docsgen removal.

[Nit] Mixed key formats in annotations.yml

11 entries still use Go type paths instead of bundle paths.

[Nit] bundlePathToType stale entries on re-mapping

path_mapping.go:130-140 - Old reverse mapping not cleaned up when shorter path found. Harmless but messy.

[Nit] OutputOnly type change (*bool to string) has asymmetric semantics

"false" is truthy in mergeDescriptor (non-empty) but falsy in assignAnnotation (not "true").

[Suggestion] recordMapping heuristic: use depth instead of string length

path_mapping.go - strings.Count(path, ".") is more robust than len(path) for canonical path selection.

[Suggestion] getOpenApiAnnotations processes embedded types before parent

Works correctly but counterintuitive ordering. Consider parent-first with embedded fallback.

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.

3 participants