Skip to content

feat(tx3c): generate first-party clients with --language - #360

Merged
scarmuega merged 1 commit into
mainfrom
codegen/bundled-templates
Sep 26, 2026
Merged

scarmuega merged 1 commit into
mainfrom
codegen/bundled-templates

Conversation

@scarmuega

@scarmuega scarmuega commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

tx3c now owns first-party client codegen end to end. This removes the release chain of a tx3c release, then an SDK template PR, then a hand-moved codegen-v1beta0 tag.

  • Client templates move into tx3c. The Rust, TypeScript, Python and Go client templates move from each SDK repo's .trix/client-lib into bin/tx3c/templates/<language> and are compiled into the binary. They are the versions already migrated to the unified helpers.
  • A client is defined by its backend. Each language's backend keeps its type mapping and naming, and now also lists its client templates through Backend::client_templates(). Giving a language a client means adding its template directory and listing the files there.
  • New flag. tx3c codegen --tii X --language <rust|typescript|python|go> --output Y renders that language's client. --template <dir> still renders custom templates, and exactly one of the two flags is required.
  • One release unit. A tx3c release now carries the backends, the client templates and the SDK version range the templates pin. Changing an SDK's runtime API means releasing the SDK first, then a tx3c release whose templates target it. The order is always the same, so the two never have to ship together.
  • Java and Swift. They keep their type backends but have no client templates yet. --language java explains that and points to --template.

Tests and CI

  • A unit test fails if a template directory and its backend's list disagree.
  • The golden corpus renders every language's client under expected/<language>. The custom-template cases move under custom/, with output in expected/custom/. The corpus also adds the SDKs' shared transfer.tii fixture.
  • A new codegen compile CI job renders each client for the transfer and complex fixtures. It compiles the output against the published SDK release the templates pin, using .github/scripts/codegen-compile-check.sh.

Verification

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo test -p tx3c --locked, with 25 unit tests plus the golden corpus.
  • CI's codegen compile job passed for all four languages against the published 0.15.0 SDKs.

Follow-ups

🤖 Generated with Claude Code

tx3c now owns first-party client codegen end to end. The Rust,
TypeScript, Python, and Go client templates move from each SDK repo's
.trix/client-lib into bin/tx3c/templates/<language> and are compiled
into the binary. `tx3c codegen --language <language>` renders the
client for that language. `--template <dir>` keeps rendering custom
templates, and exactly one of the two is required.

A language's client is defined by its backend: the type mapping and
naming it already had, plus the client templates it now lists through
`Backend::client_templates()`. A tx3c release therefore carries the
backends, the client templates, and the SDK version range those
templates target as one consistent unit, with no separate template
release, git tag, or download to keep in step.

- A test fails if a template directory and its backend's list disagree.
- The golden corpus renders every language's client under
  expected/<language>, moves the custom-template cases under custom/,
  and adds the SDKs' shared transfer.tii fixture.
- A new CI job renders each client for the transfer and complex
  fixtures and compiles it against the published SDK release its
  templates pin.

Java and Swift keep their backends; they have no client templates yet,
and --language says so.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@scarmuega
scarmuega force-pushed the codegen/bundled-templates branch from a19751a to defedd9 Compare September 26, 2026 18:04
@scarmuega scarmuega closed this Sep 26, 2026
@scarmuega
scarmuega deleted the codegen/bundled-templates branch September 26, 2026 18:04
@scarmuega scarmuega changed the title feat(tx3c): bundle first-party client templates behind --language feat(tx3c): generate first-party clients with --language Sep 26, 2026
@scarmuega
scarmuega restored the codegen/bundled-templates branch September 26, 2026 18:05
@scarmuega scarmuega reopened this Sep 26, 2026
scarmuega added a commit to tx3-lang/trix that referenced this pull request Sep 26, 2026
tx3c now generates the first-party clients itself (tx3-lang/tx3#360).
The built-in plugins (ts-client, rust-client, python-client, go-client)
call `tx3c codegen --language <language>` instead of downloading the
SDK repos' `.trix/client-lib` at the `codegen-v1beta0` tag. A generated
client therefore always matches the installed tx3c, and codegen needs no
network access.

Custom `{ repo, path, ref }` plugins keep the download and `--template`
path unchanged.

- Remove CURRENT_CODEGEN_VERSION and the built-in repo/path/ref table.
- Raise the tx3c compatibility floor to 0.24.0, the release that ships
  `--language`.
- The fake tx3c accepts `--language`, and a new contract test pins that
  built-in plugins pass it and never download templates.
- Replace the stale `[[bindings]]` blocks in the example projects with
  `[[codegen]] plugin = "ts-client"`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@scarmuega
scarmuega merged commit 1536826 into main Sep 26, 2026
27 of 28 checks passed
@scarmuega
scarmuega deleted the codegen/bundled-templates branch September 26, 2026 18:12
scarmuega added a commit to tx3-lang/trix that referenced this pull request Sep 26, 2026
tx3c now ships the first-party templates itself and selects them by
name (tx3-lang/tx3#360, #361). A built-in plugin name such as
`rust-client` is also the name of its tx3c template, so the built-in
plugins (ts-client, rust-client, python-client, go-client) call
`tx3c codegen --template <plugin name>` instead of downloading the SDK
repos' `.trix/client-lib` at the `codegen-v1beta0` tag. A generated
client therefore always matches the installed tx3c, and codegen needs no
network access.

Custom `{ repo, path, ref }` plugins keep the download and pass the
downloaded directory to the same `--template` flag.

- Remove CURRENT_CODEGEN_VERSION and the built-in repo/path/ref table.
- Raise the tx3c compatibility floor to 0.24.0, the release that ships
  built-in templates.
- A new contract test pins that built-in plugins pass their name as
  `--template` and never download templates.
- Replace the stale `[[bindings]]` blocks in the example projects with
  `[[codegen]] plugin = "ts-client"`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant