translate CLI + artifactsFromEnvelope: build-time translation deploy path (A4) - #59
Merged
Conversation
…deploy path (A4) Item 2 of the #16 delivery design note: apps that know their components at build time should not ship the translator at all. The pieces already existed — Translator.translateRaw emits the envelope (single-file JSON: plan + FACT adapters base64, the same format the artifact cache stores) and loadEnvelope is public — this PR assembles them into the consumer story: - tools/translate/main.ts: translate a component to its envelope at build time (deno run tools/translate/main.ts app.wasm). Validates the envelope before writing so a rejected component fails at build, not at deploy. - artifactsFromEnvelope(envelopeJson, componentBytes) on the embedder surface (embedder-api.md amendment A4): pure, fetch-agnostic reconstitution of ComponentArtifacts. The deploy set is component.wasm + envelope + runtime; the envelope's embedded sha-256/length are verified at instantiation, so a mismatched deploy pair fails loudly — pinned by the second test. - tools/translate/README.md: the deploy-host recipe (3 lines of fetch) and the decision line vs runtime translation (dynamic components -> A3 + the artifact cache). Gates: test-translate (new recipe, wired into gates and the CI core matrix), test-runtime, conformance (1254/0, 0 unexpected, 0 stale).
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.
PR 2 of 4 from the #16 delivery design note.
Browser-production answer: don't ship the translator.
tools/translateemits the envelope (the single-file plan+adapters JSONtranslateRawalready produces — same format the §10 artifact cache stores), andartifactsFromEnvelope(embedder A4) reconstitutesComponentArtifactsfrom envelope + component bytes, fetch-agnostic. Deploy set:component.wasm+component.plan.json+ runtime. The envelope's embedded sha-256 makes a mismatched pair fail loudly at instantiation — pinned.New
test-translaterecipe wired into gates + CI core. Gates: test-translate, test-runtime, conformance 1254/0 (0 unexpected/stale).