Repository navigation
Commit .codegen/cli.json sharded to keep every file under 1MB - #7399
Draft
janniklasrose wants to merge 1 commit into
Draft
janniklasrose wants to merge 1 commit into
janniklasrose wants to merge 1 commit into
Conversation
Alternative to gzipping cli.json. genkit still writes a single ~10MB .codegen/cli.json; generate-clijson-post now splits it into: .codegen/index.json commands minus services, plus ordered service IDs .codegen/schemas/<pkg>.json schemas entries for that package .codegen/commands/<pkg>/<Name>.json one service The largest shard is ~370KB. Shards keep each entry's raw JSON, so the split is lossless. clijson.ReadDir reassembles the document for all Go readers via clijson.Parse; the Python direct-engine generators merge schemas/*.json. TestCommittedShardsAreCanonical fails if the committed shards drift from what Split produces. Co-authored-by: Isaac <no-reply@databricks.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
generate-clijson-postsplits genkit's.codegen/cli.jsoninto shards and removes it (the plain file is gitignored):.codegen/index.json:commandswithoutservices, plus the ordered service IDs.codegen/schemas/<pkg>.json: 40 files, largestcatalogat ~370KB.codegen/commands/<pkg>/<Name>.json: 194 files, largestpostgres/Postgresat ~214KBclijson.Split/clijson.ReadDir(internal/clijson/shard.go) plus ago run ./internal/clijson/splitentry point. Shards carry each entry's raw JSON, so the round trip is lossless..codegendirectory:clijson.Parseand the cligen/schema tests go throughReadDir; the Python direct generators mergeschemas/*.json.Taskfile.yml,update-schema-docs.yml, cligen's--input,.codegen/.gitattributes(eol=lfon shards) and agent docs.Why
cli.json is 9.7MB. Alternative to #7250 (gzip): shards stay plain text, so spec bumps still produce small, readable git deltas instead of a new ~0.85MB blob each time. References between schemas and services are resolved by name after the full document is reassembled, so sharding doesn't affect them.
Tests
shard_test.go: round trip with out-of-order services, stale shard removal, rejection of unknown blocks and IDs/keys without a package, andTestCommittedShardsAreCanonical(re-splitting the committed shards reproduces them byte for byte).cli.json(also checked independently with jq).task generate-cligen generate-schema generate-directproduce no diff.go test ./internal/clijson/... ./internal/cligen/... ./bundle/internal/schema/...,task fmt checks ws lintpass.This pull request and its description were written by Isaac.