Skip to content

Consolidate bundle schema annotations into a single tree-structured file#5574

Open
pietern wants to merge 9 commits into
mainfrom
rethink-annotations
Open

Consolidate bundle schema annotations into a single tree-structured file#5574
pietern wants to merge 9 commits into
mainfrom
rethink-annotations

Conversation

@pietern

@pietern pietern commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Replace the three type-name-keyed annotation files (annotations_openapi.yml, annotations_openapi_overrides.yml, annotations.yml) with one annotations.yml structured like the bundle config tree.
  • Derive upstream docs (descriptions, enums, launch stages, field behaviors) from .codegen/cli.json in memory at generation time, instead of checking in ~7k lines of generated YAML. The file now holds only CLI-owned docs and overrides.
  • Structural keys are $type/$fields; absent entries inherit from cli.json, and description: PLACEHOLDER flags undocumented fields.
  • task generate-schema keeps the file in lockstep with the config structure: it adds placeholders for new fields and drops entries for fields the schema no longer emits.

Why

The old files duplicated cli.json data that went stale between regenerations and were keyed by Go type name, which hid where a field actually lives. One structured file gives a single place for CLI-owned docs, no duplicated upstream content, and a layout that reads like the config it documents.

Tests

  • bundle/schema/jsonschema.json and jsonschema_for_docs.json are byte-for-byte identical to before — this is purely an internal representation change.
  • New unit tests for the type graph and the file codec; existing annotation tests carried over.

This PR was written by Isaac.

Drop the checked-in annotations_openapi.yml: the schema generator now
derives those annotations from .codegen/cli.json in memory on every run.
Merge annotations.yml and annotations_openapi_overrides.yml into a single
annotations.yml whose structure mirrors the bundle configuration tree.
Docs absent from the file inherit from cli.json; entries override them.

The generated jsonschema.json and jsonschema_for_docs.json are unchanged.

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is June 12, 2026 14:02 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is June 12, 2026 14:02 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/bundle/ - needs approval

15 files changed
Suggested: @janniklasrose
Also eligible: @denik, @shreyas-goenka, @andrewnester, @lennartkats-db, @anton-107

General files (require maintainer)

Files: .agent/rules/auto-generated-files.md, Taskfile.yml
Based on git history:

  • @simonfaltum -- recent work in bundle/internal/schema/, .agent/rules/

Any maintainer (@andrewnester, @anton-107, @denik, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@pietern pietern marked this pull request as draft June 12, 2026 14:04
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 5aba24b

Run: 27534115920

Env ❌​FAIL 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 7 15 264 977 8:44
💚​ aws windows 7 15 266 975 12:38
💚​ aws-ucws linux 7 15 360 891 8:01
💚​ aws-ucws windows 7 15 362 889 14:33
❌​ azure linux 2 1 1 17 264 975 8:54
🔄​ azure windows 2 1 17 267 973 15:24
💚​ azure-ucws linux 1 17 365 887 8:28
💚​ azure-ucws windows 1 17 367 885 13:39
💚​ gcp linux 1 17 263 978 8:33
💚​ gcp windows 1 17 265 976 12:39
25 interesting tests: 15 SKIP, 7 RECOVERED, 2 FAIL, 1 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 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ 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/replace_existing 🙈​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/basic 🙈​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/postgres_projects/update_display_name 🙈​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/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/grants/select 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
❌​ TestFetchRepositoryInfoAPI_FromRepo ✅​p ✅​p ✅​p ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestFetchRepositoryInfoAPI_FromRepo/root ✅​p ✅​p ✅​p ✅​p ❌​F 🔄​f ✅​p ✅​p ✅​p ✅​p
🔄​ TestFetchRepositoryInfoAPI_FromRepo/subdir ✅​p ✅​p ✅​p ✅​p 🔄​f 🔄​f ✅​p ✅​p ✅​p ✅​p
Top 30 slowest tests (at least 2 minutes):
duration env testname
7:14 aws windows TestAccept
7:10 aws-ucws windows TestAccept
6:25 gcp windows TestAccept
6:11 azure windows TestAccept
5:51 azure-ucws windows TestAccept
5:26 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:46 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:40 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:39 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
4:20 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:48 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:45 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:33 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:31 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:24 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:20 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:17 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:59 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:57 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:57 gcp linux TestAccept
2:51 azure linux TestAccept
2:51 aws linux TestAccept
2:50 aws-ucws linux TestAccept
2:47 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:45 azure-ucws linux TestAccept
2:43 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:43 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:40 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:38 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:37 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform

Replace the "_" entry inside "fields" with an explicit "type" key on the
node, sibling to "fields". For map and sequence fields it documents each
entry; for scalar fields it documents the value's type (enum values live
here). Purely a file-format spelling change; the in-memory representation
and the generated schema are unchanged.

Co-authored-by: Isaac
Fold the near-identical inline-descriptor and type-docs serialization
paths into one descriptorToMap helper and hoist the shared key order to a
package var. Document RootTypeKey as the in-memory sentinel. No change to
the generated annotations file or schema.

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is June 13, 2026 06:32 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is June 13, 2026 06:32 — with GitHub Actions Inactive
The in-memory annotations keyed each type's docs by field name plus a
magic "_" entry for the type itself, forcing "_" to dodge real field
names (config has fields named type, fields, description). Model it
instead as TypeAnnotation{Self, Fields}: Self is the type's own docs
(applied to its $defs entry; also where enum values live), Fields is the
per-field docs. The "_" sentinel and RootTypeKey are gone.

No change to the generated annotations file or schema.

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is June 13, 2026 06:41 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is June 13, 2026 06:41 — with GitHub Actions Inactive
pietern added 2 commits June 13, 2026 09:30
structFieldNames re-implemented the generator's readonly/internal/
exported/json-tag skip rules and then cross-checked the result against
the emitted schema. The schema's property set is already authoritative,
so order the names by struct declaration and keep only those the schema
emitted; reflection now supplies order alone. A count check still catches
a struct walk that fails to reach a property.

Co-authored-by: Isaac
A config field named "type" (artifacts.*.type, variables.*.type) was told
apart from the structural type-docs key only by nesting level. Prefix the
two structural keys with "$" — matching the JSON-Schema convention this
file documents — so they can never be confused with or collide with a
field of the same name, which always appears as a bare key inside
"$fields". Also tidy the saver: a takeSelf accessor mirrors takeField, and
the ordering line numbers are named constants.

No change to the generated schema.

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is June 13, 2026 07:30 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is June 13, 2026 07:30 — with GitHub Actions Inactive
It wrapped clijson.Parse with an empty-schemas check and was called once.
Fold it into generateSchema and drop cli_json.go.

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is June 13, 2026 07:32 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is June 13, 2026 07:32 — with GitHub Actions Inactive
pietern added 2 commits June 15, 2026 10:25
The type graph was built from the unpruned schema, so fields the
generator deletes (jobs.GitSource.git_snapshot, resources.Pipeline.dry_run)
stayed valid graph edges and kept stale PLACEHOLDER entries alive in
annotations.yml even though they can never appear in the schema. Build the
graph with the structural prune transforms (removeJobsFields,
removePipelineFields) applied, via a shared configTypeGraph used by both
the generator and TestNoDetachedAnnotations, so the file only documents
fields the schema actually emits. The two stale entries are dropped.

Also: surface all type-graph drift errors via errors.Join instead of
keeping only the last; add a direct test for annotation.File's
SetField/SetSelf; document why descriptorToMap/descriptorEmpty rely on a
nil reference; and align the two "Dropping annotation" warnings.

No change to the generated schema.

Co-authored-by: Isaac
Reconciles #5443 (expose launch stage/release status in the schema) with
the consolidated single-file annotation system on this branch:

- Brought in unchanged: annotation.Descriptor's new LaunchStage /
  EnumLaunchStages / EnumDescriptions fields, the PreviewTag helper
  (preview.go), jsonschema.Extension's enumDescriptions, and
  assignAnnotation's launch-stage description prefixing + enumDescriptions
  emission (these merged cleanly onto our annotations.go).
- Reapplied in our in-memory extractor: parser.go now populates the launch
  stage on each field and the enum launch stages/descriptions on the type's
  Self descriptor via SetField/SetSelf, instead of the deleted
  annotations_openapi.yml. The launch-stage data is inherited from cli.json
  at generation time and never persisted to annotations.yml.
- Kept annotations_openapi.yml deleted (our system computes that layer in
  memory).

bundle/schema/jsonschema.json and jsonschema_for_docs.json are byte-for-byte
identical to origin/main after regeneration.

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is June 15, 2026 08:34 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is June 15, 2026 08:34 — with GitHub Actions Inactive
@pietern pietern changed the title Consolidate bundle schema annotations into one tree-structured file Consolidate bundle schema annotations into a single tree-structured file Jun 15, 2026
@pietern pietern marked this pull request as ready for review June 15, 2026 08:41
@pietern pietern requested a review from janniklasrose June 15, 2026 08:46
@pietern pietern requested review from andrewnester, denik, janniklasrose and shreyas-goenka and removed request for janniklasrose June 15, 2026 08:46
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.

2 participants