Skip to content

Stabilize since-versions and publish the docs schema only to docgen#5401

Closed
shreyas-goenka wants to merge 2 commits into
databricks:mainfrom
shreyas-goenka:shreyas-goenka/stable-since-versions
Closed

Stabilize since-versions and publish the docs schema only to docgen#5401
shreyas-goenka wants to merge 2 commits into
databricks:mainfrom
shreyas-goenka:shreyas-goenka/stable-since-versions

Conversation

@shreyas-goenka

@shreyas-goenka shreyas-goenka commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Makes x-since-version stable and moves the docs schema + its state off main.

Two commits

1. Persist since-versions on docgen for stable annotations.
x-since-version was recomputed from git history on every generation, keyed by Go type path, so versions drifted when a type was renamed or a shared struct was split into per-resource typed structs (e.g. permissions). Now a since-versions map is persisted as append-only state — stored entries are authoritative and never change. It lives on the docgen branch (via DATABRICKS_SINCE_VERSIONS_FILE), so local/regular generation is unchanged and main stays clean. sinceVersionAliases lets a renamed field inherit its previous key's version.

2. Stop keeping the docs schema on main; publish it only to docgen.
bundle/schema/jsonschema_for_docs.json was a checked-in generated artifact on main, but nothing in the CLI reads it (the binary embeds jsonschema.json; bundle/docsgen regenerates from Go types). Its only consumer is downstream docs tooling, which now reads from docgen. So:

  • Delete bundle/schema/jsonschema_for_docs.json and drop generate-schema-docs from the all/generate aggregators and the Taskfile.
  • The update-schema-docs workflow now regenerates the schema straight into the docgen worktree (next to since_versions.json) and commits both to docgen, instead of generating on main and copying. Drops the now-unneeded assert/capture/copy steps.
  • Drop the file from .wsignore, .gitattributes, and the auto-generated-files rule.

Sequencing (done)

The downstream universe docs-tool previously fetched the schema from the latest release tag; it was switched to read from the docgen branch and that change is merged to universe master (databricks-eng/universe#2008134). So removing the file from main (and hence future tags) no longer affects it.

Behavior on release

update-schema-docs runs on every v* tag: it regenerates the schema, refreshes the append-only state, and commits both to docgen. The first run seeds the state from history.

Test

  • go build / go vet / gofmt clean; unit tests for the merge/load/save logic pass.
  • End-to-end: ran the generator in --docs mode with DATABRICKS_SINCE_VERSIONS_FILE set — a frozen stored version won in the output schema and the state was written back.
  • Taskfile and workflow YAML validated.

This pull request and its description were written by Isaac.

`x-since-version` was recomputed from git history on every schema generation,
keyed by the Go type path. That made versions drift: when a type is renamed or
a shared struct is split into per-resource typed structs (e.g. permissions),
the field re-keys and gets re-stamped with a newer version.

Persist the computed map as an append-only state file and treat stored entries
as authoritative so a recorded version never changes, even across refactors.

The state lives on the `docgen` branch (next to jsonschema_for_docs.json), not
in the main source tree:

- since_version.go reads/writes the state at the path in
  DATABRICKS_SINCE_VERSIONS_FILE. When unset (local `task generate`, regular
  CI) behavior is unchanged: versions are computed from history and nothing is
  persisted, so main stays clean and the workflow's "only the docs schema
  changed" assertion still holds.
- When set, computeSinceVersions loads the stored map, refreshes it from git
  history to discover new fields, merges with stored entries winning, and writes
  it back. sinceVersionAliases lets a renamed/retyped field inherit its previous
  key's version.
- The update-schema-docs workflow checks out docgen, points the env var at its
  since_versions.json, regenerates, and commits both the schema and the refreshed
  state back to docgen. It runs on every release tag, so the state is updated on
  each release; the first run seeds it from history.

The map is written deterministically (sorted, trailing newline) so it stays
diff-stable. No existing annotation changes; this only prevents future drift.

Co-authored-by: Isaac
@shreyas-goenka shreyas-goenka force-pushed the shreyas-goenka/stable-since-versions branch from b243a6e to 2a3b079 Compare June 1, 2026 22:19
@shreyas-goenka shreyas-goenka changed the title Persist since-versions in an append-only map for stable annotations Persist since-versions on docgen for stable annotations Jun 1, 2026
bundle/schema/jsonschema_for_docs.json was a checked-in generated artifact on
main, but nothing in the CLI reads it — the binary embeds jsonschema.json, and
bundle/docsgen regenerates from Go types. Its only consumer is downstream docs
tooling, which now reads from the docgen branch.

Remove it from main and generate it only on release:

- Delete bundle/schema/jsonschema_for_docs.json and drop generate-schema-docs
  from the `all`/`generate` aggregators and the Taskfile (so `task generate`
  no longer recreates it on main).
- The update-schema-docs workflow now regenerates the schema straight into the
  docgen worktree (next to since_versions.json) and commits both to docgen,
  instead of generating on main and copying. Drops the now-unneeded
  "assert only the docs schema changed on main" / capture / copy steps.
- Drop the file from .wsignore, .gitattributes, and the auto-generated-files
  rule.

Co-authored-by: Isaac
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 5401
  • Commit SHA: 858198aa4c744de32994c19770d24f45c012baba

Checks will be approved automatically on success.

@shreyas-goenka shreyas-goenka changed the title Persist since-versions on docgen for stable annotations Stabilize since-versions and publish the docs schema only to docgen Jun 19, 2026
@shreyas-goenka

Copy link
Copy Markdown
Contributor Author

Splitting this into two focused PRs as discussed. Removal of the docs schema from main is now #5663. The since-version stabilization will follow as a separate PR stacked on #5663. Closing this combined PR.

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.

1 participant