Skip to content

Remove duplicate enum values for jsonschema.json#5839

Merged
janniklasrose merged 3 commits into
mainfrom
janniklasrose/fix-5713-redundant-sse-enum
Jul 6, 2026
Merged

Remove duplicate enum values for jsonschema.json#5839
janniklasrose merged 3 commits into
mainfrom
janniklasrose/fix-5713-redundant-sse-enum

Conversation

@janniklasrose

@janniklasrose janniklasrose commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

catalog.SseEncryptionDetailsAlgorithm published a duplicated enum in the generated bundle JSON schema:

"enum": ["AWS_SSE_S3", "AWS_SSE_KMS", "AWS_SSE_KMS", "AWS_SSE_S3"]

JSON Schema requires enum values to be unique, so strict validators (e.g. OPA) reject the entire schema at compile time. The duplicate has shipped since v0.290.0 (Feb 26 2026); the issue reports it "since v0.299.1" only because that is the first release where jsonschema.json was published as a downloadable release asset, so it is the earliest version an external consumer could inspect.

Fixes #5713.

Root cause

The enum was hand-authored for catalog.SseEncryptionDetailsAlgorithm in #4484 (UC external locations, Feb 18 2026), in the hand-authored override annotation file, with order [AWS_SSE_KMS, AWS_SSE_S3]. At that point the SDK-derived annotations did not define this type, so the generated schema had the correct 2 entries.

Two days later, #4552 (Upgrade Go SDK to v0.110.0, Feb 20 2026) regenerated the SDK-derived annotation file, which now defined the same enum with order [AWS_SSE_S3, AWS_SSE_KMS]. From then on both annotation sources supplied the enum. The annotation merge concatenates sequences, so the two pairs combined into four entries — [S3, KMS] (SDK, merge base) followed by [KMS, S3] (override), producing [S3, KMS, KMS, S3].

The later consolidation of the annotation files into a single annotations.yml + .codegen/cli.json (#5484 / #5574) preserved this pre-existing duplicate rather than causing it; only the file names changed. annotations.yml is not generated from cli.json./task generate-schema only syncs descriptions and placeholders and drops stale entries; it never rewrites hand-authored enums. So the redundant entry persisted silently across the refactor.

Fix

  • Remove the redundant hand-authored enum from annotations.yml, leaving cli.json (SDK-derived) as the single source of truth. The description override there is intentional (it differs from cli.json's text) and is kept.
  • Regenerate bundle/schema/jsonschema.json; the enum is now ["AWS_SSE_S3", "AWS_SSE_KMS"].
  • Add TestJsonSchemaEnumsAreUnique, a whole-schema guard that walks every enum in the embedded schema and fails on any duplicate, so this class of bug cannot return regardless of source.

Tests

  • go test ./bundle/internal/schema ./bundle/schema -count=1
  • Verified the new guard fails on the pre-fix schema, reporting the exact path $defs/.../catalog.SseEncryptionDetailsAlgorithm/oneOf[0].
  • Confirmed the regenerated schema is reproducible via the schema generator.

This pull request and its description were written by Isaac, an AI coding agent.

`catalog.SseEncryptionDetailsAlgorithm` published a duplicated enum
(`["AWS_SSE_S3", "AWS_SSE_KMS", "AWS_SSE_KMS", "AWS_SSE_S3"]`) in the
generated schema, which strict JSON Schema validators (e.g. OPA) reject.

Root cause: the enum was hand-authored in `annotations.yml` back when
`cli.json` did not define this type (#4484). Once #5484 introduced the
enum into `cli.json`, both sources supplied it, and the annotation merge
concatenates sequences, producing the duplicate. The annotation sync only
rewrites descriptions/placeholders, never hand-authored enums, so the
redundant entry persisted.

Remove the redundant enum from `annotations.yml` so `cli.json` is the
single source; the description override is kept. Add a whole-schema
uniqueness guard so this class of duplicate can't return.

Fixes #5713

Co-authored-by: Isaac
Simplify the copyloopvar in duplicateEnumPaths by reassigning the range
variable directly, and point the changelog entry at the PR instead of the
issue.

Co-authored-by: Isaac
@janniklasrose janniklasrose changed the title Fix duplicate enum values in bundle JSON schema Remove duplicate enum values for jsonschema.json Jul 6, 2026

@pietern pietern left a comment

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.

Nice!

The linked issue claims this was an issue since v0.299.1, but that doesn't align with the timeline for the new generator. Could the claim in the issue be incorrect?

@janniklasrose

Copy link
Copy Markdown
Contributor Author

@pietern

The linked issue claims this was an issue since v0.299.1, but that doesn't align with the timeline for the new generator. Could the claim in the issue be incorrect?

Yes. The issue & also Claude's initial assessment (in this PR) were both wrong. The PR is now updated with the correct root cause & timeline

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: b9da757

Run: 28788709784

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 1 4 233 1056 4:05
💚​ aws windows 1 4 235 1054 4:21
💚​ aws-ucws linux 1 4 317 974 5:03
💚​ aws-ucws windows 1 4 319 972 4:21
💚​ azure linux 1 4 233 1055 4:05
💚​ azure windows 1 4 235 1053 4:13
💚​ azure-ucws linux 1 4 319 971 5:14
💚​ azure-ucws windows 1 4 321 969 4:11
💚​ gcp linux 1 4 232 1057 3:50
💚​ gcp windows 1 4 234 1055 4:33
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/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
Top 5 slowest tests (at least 2 minutes):
duration env testname
3:41 gcp windows TestAccept
3:30 aws windows TestAccept
3:24 aws-ucws windows TestAccept
3:04 azure-ucws windows TestAccept
3:04 azure windows TestAccept

@janniklasrose janniklasrose added this pull request to the merge queue Jul 6, 2026
Merged via the queue into main with commit 535a8ef Jul 6, 2026
23 checks passed
@janniklasrose janniklasrose deleted the janniklasrose/fix-5713-redundant-sse-enum branch July 6, 2026 12:29
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.

bundle/schema/jsonschema.json: duplicate enum in SseEncryptionDetailsAlgorithm breaks strict JSON Schema validators

3 participants