feat(codegen): wire [[codegen]].options through to tx3c, re-cut #128 regressions - #131
Open
scarmuega wants to merge 1 commit into
Open
feat(codegen): wire [[codegen]].options through to tx3c, re-cut #128 regressions#131scarmuega wants to merge 1 commit into
scarmuega wants to merge 1 commit into
Conversation
…regressions
Part 1 — the options channel. `[[codegen]].options` has been dead config
since it was introduced: written `None` by `codegen`/`init`, never read,
and `spawn::tx3c::codegen` forwarded only tii/template/output. It now
resolves and forwards.
- `config/convention.rs` gains `KnownCodegenPlugin::default_options` and
`CodegenConfig::resolved_options`: plugin defaults with the project's
`options` merged on top, user values winning. Plugin knowledge lives in
trix's config layer — `tx3c` stays generic. The one default today is
`ts-client → {standalone: true}`, the knob the codegen-v1beta0
templates gate `package.json.hbs` / `tsconfig.json.hbs` on.
- `spawn::tx3c::codegen` takes the resolved map and forwards it as one
JSON object under `--options`. An empty map omits the flag entirely, so
a project that asks for nothing sends exactly the argv it sent before.
- Unit tests on the merge rule; contract tests on the wire (argv against
the fake tx3c): default injects `standalone: true`, explicit
`standalone = false` overrides it, a plugin with no defaults forwards
user options unchanged, no options means no flag.
Part 2 — PR #128's regression value, re-cut onto the #129 layout. #128 is
built on the deleted `tests/e2e/` layer and cannot merge; these are the
three defects worth locking, at the layers the current policy puts them:
- `@`→`:` forbidden-character rejection → `tests/cli/refs.rs`. Parse-time,
zero registry traffic.
- `image/png` logo-layer pull (regression of #118) and lowercase OCI repo
addressing with case-preserving identity (regression of #120) →
`tests/cli/registry.rs`, against `tests/harness/oci_stub.rs` — #128's
in-process registry stub, ported. Pulls are trix's own code, not a
helper binary, so they belong to the CLI layer and the suite stays
offline.
#128's package.json fixture lock and `#[ignore]`d live test are not
ported: emission verification belongs to the e2e journey, and the trix
layer asserts argv only.
Each of the three was spot-checked by reverting its fix locally; each
fails and only that one fails.
Plan: plans/trix-codegen-options-wiring.md
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.
Plan
plans/trix-codegen-options-wiring.md(tx3 domain root) — acode-change-requestscoped to this repository only.Done criterion: met. Both parts land, the full suite is green, and each
ported regression was verified to fail when its fix is reverted.
What changed
Part 1 — wire the dead
[[codegen]].optionsfieldThe field has been dead config since it was introduced: written
Noneatsrc/commands/codegen.rsandsrc/commands/init.rs, never read, andsrc/spawn/tx3c.rs::codegen()forwarded only tii/template/output. A projectsetting
optionsgot silence.src/config/convention.rs—KnownCodegenPlugin::default_options()and
CodegenConfig::resolved_options(). Plugin defaults with theproject's
optionsmerged on top, key by key, user values winning(including setting a default's key back to
false). Plugin knowledgestays in trix's config layer;
tx3cremains generic. The one defaulttoday is
ts-client → {standalone: true}— the knob thecodegen-v1beta0templates gatepackage.json.hbsandtsconfig.json.hbson.BTreeMap, so the JSON on the wire is stable.src/spawn/tx3c.rs—codegen()takes the resolved map and forwardsit as one JSON object under
--options. An empty map omits the flagentirely, so a project that asks for nothing produces exactly the argv
trix sent before the channel existed.
src/commands/codegen.rs— resolves once per[[codegen]]entry andpasses it to every protocol in that entry.
Part 2 — PR #128's regression value, re-cut onto the #129 layout
#128 is built entirely on the
tests/e2e/layer #129 deleted and cannotmerge. Its three surviving regressions are re-homed at the layers the
current policy puts them:
@→:forbidden-character rejection →tests/cli/refs.rs. Parse-time,zero registry traffic, so no stub is needed.
image/pnglogo-layer pull (regression of fix(use): accept image/png logo layer when pulling protocol images #118) and lowercase OCI repoaddressing with case-preserving identity (regression of fix(publish): lowercase OCI repository path for uppercase scopes #120) →
tests/cli/registry.rs, againsttests/harness/oci_stub.rs— test(e2e): regression coverage for ref grammar, logo-layer pull, OCI casing, package.json placement #128'sin-process registry stub, ported. Pulls are trix's own code, not a helper
binary, so they belong to the CLI layer and the suite stays offline.
sha2joins dev-dependencies:oci_clientverifies every blob againstits descriptor, so the stub's digests must be real.
#128's package.json fixture lock and
#[ignore]d live test are deliberatelynot ported — emission verification moves to the e2e journey, and the
trix layer asserts argv only (the #129 policy).
Closing #128 as superseded is the owner's act, not mine — flagging it
here per the plan.
Test placement note
The plan asks for the
ts-clientdefault to be asserted at the contractlayer. Reaching a known plugin's argv normally means fetching the web-sdk
templates from GitHub, which the hermeticity policy forbids. Both contract
tests that need
ts-clientuse the existing local-template seam instead:plugin.repois treated as a local template root whenever it names adirectory, and
reporesolves relative to the process CWD, sostage_local_ts_client_templates()materializestx3-lang/web-sdk/.trix/client-lib/inside the test project. No network, noproduction seam added. The merge rule is additionally unit-tested next to
itself in
src/config/convention.rs, per the "rules go innermost" doctrine.tests/README.mdgains a section on the OCI stub and the layering rule forpull-path tests.
Verification
All run locally on macOS at
20eeebc, using CI's exact commands:cargo fmt --all -- --check— cleancargo clippy --all-targets --all-features -- -D warnings— cleancargo test --workspace --all-targets --all-features --locked—115 passed, 0 failed (83 unit, 13 CLI, 19 contract)
Regression spot-checks — each fix reverted locally in turn, only its own
test failing:
image/pngdropped fromoci::pull's accepted media typesuse_accepts_image_with_png_logo_layerFAILED, other passedscope/nameno longer lowercased inoci::reference_foruse_addresses_registry_repo_path_in_lowercaseFAILED, other passed@added torefs::validate_ident's charsetuse_rejects_npm_style_at_version_separatorFAILEDThe
tests/README.mdinvariant holds: no test in the repo spawns a realhelper binary (the only
Command::newoutside the harness's fake-tx3cwiring is the
rustcthat compiles that fake).Release ordering — please read before merging
--optionsis a flagtx3cdoes not have yet; its side isplans/lang-tx3c-options-channel.mdagainsttx3-lang/tx3, still ready.The two are independent to develop (this repo's contract layer stubs tx3c)
but not independent to release:
[[codegen]].optionsand a plugin with no defaults areunaffected — trix omits the flag, so the argv is byte-identical to today.
ts-clientprojects are not: they now always carry{"standalone":true}, so a released trix carrying this change paired witha released
tx3cpredating the options input would failtrix codegenfor every TypeScript user.
The compat floor (
src/spawn/compat.rs,tx3cmin0.22.0) is notraised here — the version that carries the flag does not exist yet, and
raising the floor is the toolchain release train's step, not this plan's.
Filed as a follow-up draft plan in the domain root
(
plans/trix-compat-floor-tx3c-options.md) for the owner to release. Mergingthis PR is safe; shipping a trix release from it before the tx3c side is
released is not.
Not in this PR
Per the plan's boundary, the remaining parent-plan work stays where it is:
the web-sdk
codegen-check.shextension, the07-codegen-consumejourneyamendment, and the release-train note.
🤖 Generated with Claude Code