Skip to content

Commit 902aee9

Browse files
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, and bundle/docsgen regenerates from Go types. Its only consumer is downstream docs tooling, which now reads the schema from the docgen branch. - Delete bundle/schema/jsonschema_for_docs.json and remove generate-schema-docs from the `all`/`generate` aggregators and the Taskfile, so `task generate` no longer recreates it on main. (generate-check, the CI drift subset, already excluded it.) - The update-schema-docs workflow now regenerates the schema straight into the docgen worktree and commits it there, instead of generating on main and copying. Drops the now-unneeded "assert only the docs schema changed on main" and capture steps. - Drop the file from .wsignore, .gitattributes, and the auto-generated-files rule. Co-authored-by: Isaac
1 parent 3bac993 commit 902aee9

6 files changed

Lines changed: 24 additions & 11867 deletions

File tree

.agent/rules/auto-generated-files.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ globs:
1616
- "bundle/direct/dresources/*.generated.yml"
1717
- "bundle/internal/validation/generated/*.go"
1818
- "bundle/schema/jsonschema.json"
19-
- "bundle/schema/jsonschema_for_docs.json"
2019
- "python/databricks/bundles/version.py"
2120
- "python/databricks/bundles/*/__init__.py"
2221
- "python/databricks/bundles/*/_models/*.py"
@@ -36,7 +35,6 @@ paths:
3635
- "bundle/direct/dresources/*.generated.yml"
3736
- "bundle/internal/validation/generated/*.go"
3837
- "bundle/schema/jsonschema.json"
39-
- "bundle/schema/jsonschema_for_docs.json"
4038
- "python/databricks/bundles/version.py"
4139
- "python/databricks/bundles/*/__init__.py"
4240
- "python/databricks/bundles/*/_models/*.py"
@@ -69,8 +67,8 @@ Files matching this rule's glob pattern are most likely generated artifacts. Aut
6967
- `./task generate-direct` (or `./task generate-direct-apitypes`, `./task generate-direct-resources`)
7068
- Bundle schemas:
7169
- `./task generate-schema`
72-
- `./task generate-schema-docs`
73-
- Both rewrite `bundle/internal/schema/annotations.yml` in place: upstream docs are sourced from `.codegen/cli.json` at generation time, and the file is synced with the config structure (placeholders added, stale entries dropped).
70+
- Rewrites `bundle/internal/schema/annotations.yml` in place: upstream docs are sourced from `.codegen/cli.json` at generation time, and the file is synced with the config structure (placeholders added, stale entries dropped).
71+
- The docs schema (`jsonschema_for_docs.json`) is not generated on main; it is built and published to the `docgen` branch on release by `.github/workflows/update-schema-docs.yml`.
7472
- Validation generated code:
7573
- `./task generate-validation`
7674
- Mock files:

.github/workflows/update-schema-docs.yml

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: update-schema-docs
22

3-
# Regenerate bundle/schema/jsonschema_for_docs.json after every release and
4-
# publish it to the `docgen` branch.
3+
# Regenerate the bundle docs JSON schema after every release and publish it to
4+
# the `docgen` branch. The docs schema is NOT kept on main — `docgen` is its
5+
# only home (downstream docs tooling reads it from there).
56
#
67
# bundle/internal/schema/since_version.go derives `x-since-version` annotations
78
# from the list of `v*` git tags that exist when the schema is generated. The
@@ -68,43 +69,27 @@ jobs:
6869
echo "tag=$tag" >> "$GITHUB_OUTPUT"
6970
echo "Publishing for tag $tag"
7071
71-
- name: Regenerate jsonschema_for_docs.json
72-
run: go tool -modfile=tools/task/go.mod task --force generate-schema-docs
73-
74-
# Fail loudly if regeneration touches anything other than the docs schema.
75-
# Anything else (annotations.yml, untracked files, ...) is a bug in the
76-
# generator, not something we want to silently publish.
77-
- name: Assert only jsonschema_for_docs.json changed on main
78-
run: |
79-
changed=$(git status --porcelain)
80-
expected=" M bundle/schema/jsonschema_for_docs.json"
81-
if [ -z "$changed" ]; then
82-
echo "Regeneration produced no diff against main."
83-
exit 0
84-
fi
85-
if [ "$changed" != "$expected" ]; then
86-
echo "Expected only bundle/schema/jsonschema_for_docs.json to be modified."
87-
echo "Actual git status --porcelain:"
88-
echo "$changed"
89-
exit 1
90-
fi
91-
92-
- name: Capture regenerated file
93-
run: |
94-
mkdir -p "$RUNNER_TEMP/regen"
95-
cp bundle/schema/jsonschema_for_docs.json "$RUNNER_TEMP/regen/jsonschema_for_docs.json"
96-
9772
- name: Check out docgen worktree
9873
run: |
9974
git fetch origin docgen
10075
git worktree add "$RUNNER_TEMP/docgen" origin/docgen
10176
77+
# The docs schema is not kept on main; generate it straight into the docgen
78+
# worktree and publish from there.
79+
- name: Regenerate docs schema into the docgen worktree
80+
run: |
81+
# since_version.go reads `git tag --list 'v*'` (and `git show <tag>:...`)
82+
# to stamp x-since-version. The checkout above already fetches tags
83+
# (fetch-depth: 0 + fetch-tags: true); fetch them explicitly too so the
84+
# annotations are never silently dropped if that ever changes.
85+
git fetch origin 'refs/tags/v*:refs/tags/v*'
86+
mkdir -p "$RUNNER_TEMP/docgen/bundle/schema"
87+
go run ./bundle/internal/schema ./bundle/internal/schema \
88+
"$RUNNER_TEMP/docgen/bundle/schema/jsonschema_for_docs.json" .codegen/cli.json --docs
89+
10290
- name: Stage regenerated file on docgen
10391
working-directory: ${{ runner.temp }}/docgen
104-
run: |
105-
mkdir -p bundle/schema
106-
cp "$RUNNER_TEMP/regen/jsonschema_for_docs.json" bundle/schema/jsonschema_for_docs.json
107-
git add bundle/schema/jsonschema_for_docs.json
92+
run: git add bundle/schema/jsonschema_for_docs.json
10893

10994
- name: Commit and push to docgen
11095
working-directory: ${{ runner.temp }}/docgen

.wsignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.codegen/_openapi_sha
44
.release_metadata.json
55
bundle/schema/jsonschema.json
6-
bundle/schema/jsonschema_for_docs.json
76
python/docs/images/databricks-logo.svg
87
**/*.dist-info/METADATA
98
**/*.dist-info/WHEEL

Taskfile.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ tasks:
5555
- task: generate-refschema
5656
- task: generate-schema
5757
- task: generate-schema-map
58-
- task: generate-schema-docs
5958
- task: generate-validation
6059
- task: generate-direct
6160
- task: pydabs-codegen
@@ -740,7 +739,6 @@ tasks:
740739
# generate-direct-apitypes and generate-direct-resources below.
741740
- task: generate-refschema
742741
- task: generate-schema
743-
- task: generate-schema-docs
744742
- task: generate-validation
745743
- task: generate-direct
746744
- task: pydabs-codegen
@@ -752,9 +750,9 @@ tasks:
752750
# reproducible per-PR:
753751
# - generate-tf-schema downloads the Terraform provider, which no CI runner
754752
# sets up; its output only changes when schema/version.go changes.
755-
# - generate-schema-docs stamps x-since-version from `git tag`, so it churns
756-
# after every release; jsonschema_for_docs.json is published separately to
757-
# the docgen branch by .github/workflows/update-schema-docs.yml.
753+
# The docs schema (jsonschema_for_docs.json) is not generated here or on main
754+
# at all — it is built and published to the docgen branch by
755+
# .github/workflows/update-schema-docs.yml.
758756
# Keep this list in sync with `generate` when adding or removing generators.
759757
generate-check:
760758
desc: Run the reproducible generators (CI drift subset of `generate`)
@@ -860,7 +858,8 @@ tasks:
860858
# bundle/internal/schema/annotations.yml carries the CLI-owned docs and
861859
# overrides and is rewritten in place (synced with the config structure).
862860
# Editing either input and running `task generate` percolates into
863-
# jsonschema.json, jsonschema_for_docs.json and pydabs.
861+
# jsonschema.json and pydabs. (The docs schema is built only on release by
862+
# .github/workflows/update-schema-docs.yml and published to the docgen branch.)
864863
generate-schema:
865864
desc: Generate bundle JSON schema
866865
sources: &SCHEMA_SOURCES
@@ -877,20 +876,6 @@ tasks:
877876
cmds:
878877
- "go run ./bundle/internal/schema ./bundle/internal/schema ./bundle/schema/jsonschema.json .codegen/cli.json"
879878

880-
generate-schema-docs:
881-
desc: Generate bundle JSON schema for documentation
882-
sources: *SCHEMA_SOURCES
883-
generates:
884-
- bundle/schema/jsonschema_for_docs.json
885-
- bundle/internal/schema/annotations.yml
886-
cmds:
887-
# since_version.go reads `git tag --list 'v*'` to compute sinceVersion
888-
# annotations. Without tags (e.g. shallow clone), those annotations are
889-
# silently dropped from the output. Restore the fetch that lived in the
890-
# old tools/post-generate.sh.
891-
- git fetch origin 'refs/tags/v*:refs/tags/v*'
892-
- "go run ./bundle/internal/schema ./bundle/internal/schema ./bundle/schema/jsonschema_for_docs.json .codegen/cli.json --docs"
893-
894879
generate-validation:
895880
desc: Generate enum and required field validation code
896881
sources:

bundle/schema/.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
jsonschema.json linguist-generated=true
2-
jsonschema_for_docs.json linguist-generated=true

0 commit comments

Comments
 (0)