Skip to content

The generated Go wire models carry no digest of the whole registry - #2250

Merged
zlareb1 merged 4 commits into
mainfrom
fix/go-wire-models-no-registry-digest
Dec 5, 2026
Merged

zlareb1 merged 4 commits into
mainfrom
fix/go-wire-models-no-registry-digest

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Related: #2094

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

The generated Go wire models (sdk/go/wire/models.gen.go) carry no digest of the whole registry schema, so two pull requests that each change an operation do not conflict on that header line.

Why

scripts/codegen/sdk_go_gen.py wrote one header line into sdk/go/wire/models.gen.go: // Registry model schema SHA-256: <digest of the whole registry schema>. A change to any model changed that line, so two pull requests that each changed an op always conflicted on it, whatever the two changes were. A conflict in a generated file cannot be resolved by hand: the branch is merged with main, the file is regenerated and the pull request is reviewed again.

Nothing read the line. Outside the generator, no test, script, workflow or Go file names it. One test asserted its effect (test_static_factory_default_change_changes_generated_bytes) and one paragraph of docs/development/code-generation.md described it as the schema hash.

The digest existed because a bound, a static default or an enum value can change without changing a Go type. That case needs no marker: the Go code is the same, so the file is current. --check compares the whole generated text of both files, so a file that is stale in any declaration still fails.

Design: the digest is removed, not replaced by a digest per model. A digest per model would also end the conflict, but it keeps a marker nothing reads at the cost of one more line for each of the 1,152 generated types, and it rewrites a line of a model whose Go type did not change.

Scope and risk

  • scripts/codegen/sdk_go_gen.py: the header line, the digest computation and its two imports are removed. The x-loom-factory-defaults schema annotation, _factory_defaults and _STATIC_FACTORIES are removed with them: no renderer reads the annotation, so they only fed the digest, and they failed generation for a default factory that the list did not classify.
  • sdk/go/wire/models.gen.go: regenerated. The diff is the one removed header line; every declaration is byte-identical. sdk/go/client.gen.go is unchanged.
  • docs/development/code-generation.md: the paragraph on the schema hash becomes one sentence on when the two files change.
  • Not touched: the Rust generator and sdk/rust/. The serde default helpers that renumber on a model change are the subject of the related pull request.
  • Risk: a reader of the header comment loses it. Nothing in the repository reads it, and a comment is not part of the Go package's API.

Lines of other generated files that change with every added op, table or setting, whichever it is. They are listed here and not changed:

File and line Line
sdk/typescript/src/generated/ops.ts:12664 export const GENERATED_OP_COUNT = 396; (a public export of the TypeScript SDK)
sdk/ruby/lib/clickhouse/loom/generated/ops.rb:11 OP_COUNT = 396
docs/reference/operations.md:127 396 operations in 45 groups.
docs/reference/status.md:28 396 operations, 282 of them experimental.
docs/reference/status.md:94 57 boolean settings load false.
docs/reference/schema.md:145 198 tables, 5 views and 19 materialized views
schemas/schema.sql:19 -- Counts: 198 tables + 5 views + 19 materialized views.

The Python tables, the Go client, the CLI snapshots, tests/analyzer/shapes.txt, the reach manifest and the plugin eval tool definitions hold no such line.

Compatibility, rollout and rollback

  • Wire: none. No op, field, table, setting or default is added, changed or removed.
  • Operator steps: none.
  • Rollback: a revert restores the header line; regenerate sdk/go/wire/models.gen.go after it.

Tests

tests/unit/test_sdk_go_codegen.py holds four tests of the contract. Each fails on main:

  • the wire header is the generated-code marker and the package comment, with nothing between them;
  • a changed max_length on TrackerSimilarInput.text leaves both generated sources identical;
  • a changed static default on TrackerSimilarInput.kinds leaves both generated sources identical. This replaces test_static_factory_default_change_changes_generated_bytes, which asserted the opposite: the behaviour it pinned is the one this change removes;
  • a field added to TrackerSimilarInput changes that declaration only, by one line, and leaves the client unchanged.

The branch is merged with main three times. The first two merges conflicted on the digest line, and the file is regenerated with its generator: it differs from the file on main by that line only. The third merge did not conflict and no generator rewrote a file.

What ran:

  • The generator's unformatted output against the output of main: the wire source is identical apart from the removed line, the client source is identical.
  • python -m scripts.codegen.sdk_go_gen --check: exit 1 before regenerating (sdk/go/wire/models.gen.go is stale), exit 0 after, and exit 0 again on the merged tree after each merge.
  • The local machine has no Go toolchain, so gofmt ran from the golang:1.27.4 image, the version CI installs: the generator formatted through it, gofmt -l over sdk/go prints nothing, and go vet ./... in sdk/go exits 0, before and after the first merge.
  • --check of sdk_py_gen, sdk_py_client_gen, sdk_py_admin_gen, sdk_ts_gen, sdk_rb_gen, agent_plugin_sync, standalone_skills, served_skills, settings_reference, settings_schema, settings_example, docs_reference, op_reach_census and plugin_eval_tools: all exit 0. sdk_rust_gen --check needs rustfmt, which the local machine lacks; its inputs are untouched and CI runs it.
  • ruff format --check and ruff check on the changed Python files, Prettier on the changed page, make typecheck, scripts/gates/function_length_gate.py, scripts/gates/check_no_secrets.py: pass.
  • pytest -n 2 over tests/unit/test_sdk_go_codegen.py, test_go_sdk_contract.py, test_sdk_parity.py, test_sdk_surface_contract.py, test_docs_reference.py, test_public_copy.py, test_doc_links.py, test_package_contracts.py, test_op_transport_contract.py, test_tunable_constants.py, test_store_names_refused.py, test_degraded_unnoted.py, test_agent_instructions.py and tests/analyzer, before the first merge: 655 passed, 12 skipped, 1 failed. After the first merge, tests/unit/test_sdk_go_codegen.py alone: 9 passed. After the second merge, tests/unit/test_sdk_go_codegen.py, test_doc_links.py and test_public_copy.py: 311 passed.
  • The failure is tests/analyzer/test_corpus.py::test_shapes_file_matches_builders, and it failed on main as well in that run: the code_repo.prs statement selects merge_commit_sha, and tests/analyzer/shapes.txt held the two shapes from before that column. main now holds the shapes that select the column and the third merge brings them; tests/analyzer did not run again after it. This change touches neither file.

Left to CI: the full unit and integration suites and the Go SDK's go test.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. Checked: the generated diff is one line, the unformatted generator output matches main apart from that line, and each new test fails on main.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

🤖 Generated with Claude Code

zlareb1 and others added 2 commits December 5, 2026 11:20
sdk/go/wire/models.gen.go held one header line with the SHA-256 of the
whole registry schema. A change to any model rewrote that line, so two
changes to different ops always conflicted on it, and a conflict in a
generated file is resolved only by merging and regenerating.

Nothing read the line. The check compares the whole generated text, so
a stale file still fails. A change to a bound, a default or an enum
value that leaves the Go types as they are leaves both generated files
unchanged: the Go code is the same.

The schema annotation that listed static factory defaults, and the list
that classified those factories, only fed the digest and go with it.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
sdk/go/wire/models.gen.go conflicted on the registry digest line. The
file is regenerated with its generator: it differs from the file on
main by that line only.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 5, 2026 12:13pm UTC
loom-telemetry Ready Ready Preview Dec 5, 2026 12:13pm UTC

Request Review

zlareb1 and others added 2 commits December 5, 2026 12:06
main brings the source worker's registration in knowledge.source.list
and knowledge.source.inspect, the knowledge.read rate bucket for
knowledge.source.worker_accounts, and the benchmark results for source
worker copy capacity.

sdk/go/wire/models.gen.go conflicted on the registry digest line. The
file is regenerated with its generator: it differs from the file on
main by that line only. Every other generated file is current.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
main brings one agent mock that answers every loom tool of a plugin
eval case's session, and the code_repo.prs shapes in the analyzer shape
list.

Nothing conflicted. docs/development/code-generation.md keeps both
changes: the plugin_eval_tools.py row from main and the Go generator
paragraph from this branch. No generator rewrites a file on the merged
tree.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@zlareb1
zlareb1 merged commit 87a15f9 into main Dec 5, 2026
74 of 78 checks passed
@zlareb1
zlareb1 deleted the fix/go-wire-models-no-registry-digest branch December 5, 2026 12:18
Suneeth12 added a commit to Suneeth12/loom that referenced this pull request Dec 5, 2026
… digest

Signed-off-by: Suneeth12 <suneethreddy2005@gmail.com>
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