Skip to content

spec(046): ratify the WebAssembly size budget - #136

Merged
bartekus merged 1 commit into
mainfrom
spec/046-ratify
Oct 21, 2026
Merged

bartekus merged 1 commit into
mainfrom
spec/046-ratify

Conversation

@bartekus

@bartekus bartekus commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Ratifies spec 046 (the WebAssembly module's uncompressed size budget; amends 027 3.10.4) on the owner's decision of 2026-10-20 (decision A-43).

  • specs/046-wasm-size-budget/spec.md: status approved; the draft notes replaced by the ratification.
  • docs/decisions/00-founding-decisions.md: A-43 records the decision: raise the uncompressed budget to 2,621,440 bytes rather than shrink the module (measured 2,216,152 bytes; wasm-opt options cannot reach the earlier 2,097,152), keeping the gzip budget (786,432), the instantiation budgets, the procedure and the gate unchanged. No release or publication is authorized.

The budget itself changes in #130's measurement check once this merges. As a ratification, this PR needs the owner's approval of the statecraft-review-exception Environment.

Review round 1 (1 finding, fixed): both figures were true at different commits (2,215,589 bytes at spec 046's first measurement, 2,216,152 on #130's current branch after later changes); A-43 now names both, so the records agree.

@bartekus
bartekus enabled auto-merge (squash) October 21, 2026 02:44
@github-actions

Copy link
Copy Markdown

AI review (findings)

There is one factual inconsistency between the two changed files.

The measured wasm size is reported differently:

  • docs/decisions/00-founding-decisions.md (A-43 entry): "measured 2,216,152"
  • specs/046-wasm-size-budget/spec.md summary: "measurement is 2,215,589 bytes"

The two documents contradict each other on the actual measured byte count; at least one figure is wrong.

{"head": "3dcb0534ad871ac130abc673f6719923505696f7", "verdict": "findings", "findings": [{"path": "docs/decisions/00-founding-decisions.md", "line": 226, "summary": "A-43 reports the measured wasm size as 2,216,152 bytes, conflicting with the spec summary's 2,215,589 bytes — one of these figures is incorrect."}]}

Subject: 5764d8b...3dcb053, diff digest 05f8bb7ec8371ad01b3dc8a2da9bc104db7eacf68c155165b5b942ec82e5f4e8, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

The diff is a governance record update: spec 046 moves from draft to approved and decision A-43 is appended recording the ratification.

Consistency checks:

  • Budget figure 2,621,440 bytes = 2.5 MiB: 2.5 × 1,048,576 = 2,621,440. Correct.
  • "5.6% over" the old 2,097,152 limit: 2,215,589 / 2,097,152 = 1.0565, rounds to 5.6%. Correct.
  • A-43 cites "amends 027 3.10.4"; spec.md amends: lists "027-node-and-wasm-bindings". Consistent.
  • A-43 says gzip budget (786,432 bytes) and instantiation budgets unchanged; spec.md body states the same.
  • A-43 "This approval does not authorize a release or publication"; spec.md implementation: pending is unchanged. Consistent.
  • A-42 explicitly noted spec 046 was not ratified at that time; A-43 now ratifies it. Sequence is coherent.
  • The spec summary still references only the first measurement (2,215,589 bytes); A-43 also records the current-branch figure (2,216,152). The spec summary was not updated to the second figure, but this is a precision gap in a narrative description, not a factual error or inconsistency that would mislead.

No bugs, security issues, or material inconsistencies found.

{"head": "ceb5a2ad31240c8500d2c978b1a9cef2aa2605b5", "verdict": "no-findings", "findings": []}

Subject: 5764d8b...ceb5a2a, diff digest df7a07f7efcc967d4711766e53032a56ad50e8907e62ef60176177d7d323e17d, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception October 21, 2026 02:55 — with GitHub Actions Inactive
bartekus added a commit that referenced this pull request Oct 21, 2026
Spec 027, increment 5: the WebAssembly package. Stacked on #129.

- `integrations/rustev-wasm` (`publish = false`, npm only; excluded from
the crates.io release set): `version`, `check`, `compile`, `show`,
`replay`, `eval`, `gate`, `calibrateFit`, `calibrateQualify` through
`rustev-surface` with an in-memory host (`rustev_surface::host::Memory`,
new, also used by the surface's tests). No runtime, backend, sink or
clock; time is an argument; external items resolve through a synchronous
host callback.
- `make bindings`: exact pins (`wasm-bindgen-cli` 0.2.129 = crate,
`wasm-opt` 116), `web`/`bundler`/`nodejs` targets at `-Oz` (a `wasm`
cargo profile used only here), declaration drift check plus strict
type-check, import allowlist, size and instantiation budgets with a
measurement document, and the JavaScript conformance runner.
- Declarations: `rustev-documents.d.ts` generated offline from the
committed schemas by `json-schema-to-typescript` 16.0.0 (committed
lockfile), type-checked by TypeScript 5.9.3 strict. Generated: 10k of
this PR's lines.
- Imports: only `wasm-bindgen` glue, each reviewed in
`wasm-imports.json`.
- Conformance: the harvest marks pure-command cases for the `wasm`
surface and records rules programs' derived descriptors; all 23 such
cases print the CLI's golden bytes and exit codes on WebAssembly.
- **Measurement (local):** raw 2,215,589 B (over the 2,097,152 B budget
by 5.6%), gzip 762,689 B (under 786,432), Brotli 543,501 B, Node
instantiation median 3.5 ms (budget 50). `make bindings` fails at the
raw gate as 3.10.4 requires; the budget change is drafted as spec 046
for the owner. Chromium timing and the CI measurement come with the
`bindings` job (increment 7).

Review round 1 (2 findings): (1) the resolver passes up to `maxBytes`
plus one byte on purpose, so the library classes an item past its budget
`oversized` exactly as for the CLI's store, which reads one byte past
the maximum; the comment now says so (anything longer is inaccessible).
(2) Fixed: the memory host names the case: an output that already
exists, or a label that names an input. Declarations regenerated after
#126's schema change (Timestamp range).

Review round 2 (3 findings): (1) fixed: `make bindings` refuses first
when cargo metadata names no target directory, so no path is built from
an empty prefix. (2) fixed: `Memory`'s outputs are private, with an
`output(label)` copy accessor; only `create` and `write_all` borrow
them, never across a call. (3) No case names `wasm` on a `run` (the
harvest gives `run` cases `cli` and `native`; `run` is no WebAssembly
command, 3.1.1), so none throws today; the runner now reports such a
case as a failure instead of ending, and the code says why. Restacked on
#129.

Review round 3 (4 findings): (1) `"private": true` is deliberate until
publication: spec 031 owns the npm release and makes the package
publishable then, so no build of this increment can be published by
accident; the spec record says so. (2) fixed: a test pins `join`: an
empty directory is the binding's top level, so the label is the name
alone. (3) lodash 4.18.1 is published on the public registry (`npm view
[email protected] version` answers 4.18.1) and the lockfile resolves it from
registry.npmjs.org with its integrity hash. (4) fixed: a throwing module
call fails its case and the runner continues.

Review round 4 (4 findings): (1) fixed: a derived descriptor that does
not canonicalize fails the harvest naming its program, never a silent
gap. (2) fixed: `Memory`'s inputs are private like its outputs, read
through `inputs()`. (3) Repeated: lodash 4.18.1 is on the public
registry (`npm view [email protected] version` answers 4.18.1); the lockfile
resolves it from registry.npmjs.org with its integrity hash, so the slot
is not unclaimed. (4) No `run` case names `wasm`: the harvest gives a
case `wasm` only when its command is pure, and every `run` case's
surfaces are `["cli"]` in this branch (`native` joins in #132).
Restacked on #129.

Review round 5 (6 findings): (1) Refusing an output that names an input
is deliberate and matches the CLI: on a file system the input is a file
at that path and the file host refuses to replace it, so every surface
gives the same outcome; the code says so. (2) fixed: `CARGO_TARGET` is
read by parsing cargo's JSON, not by a regex. (3) fixed: the unreachable
error arm is an `expect` stating why (`ms` admits at most 2^53 - 1). (4)
fixed: the harvest refuses a `--rules` argument that is not a plain
relative path before writing a descriptor under it. (5) fixed:
`wasm-check.mjs` parses `--chromium-ms`, records the median and fails it
against the 3.10.6 budget (the CI job of increment 7 supplies it). (6)
Repeated and wrong: lodash 4.18.1 is published (`npm view [email protected]
version`), and `npm ci` installs it from the lockfile locally and in CI.
Restacked on #129.

Review round 6 (3 findings): (1) fixed: the message states the
requirement (`must be a non-negative integer`). (2) No case names `wasm`
on a `run`: every case whose command is `run` lists `["cli"]` in this
branch (checked over all case files), and the manifest aggregates them
unchanged. (3) fixed: a flag without a value fails the case naming it;
every flag of the harvested commands takes one value (checked over all
case files).

Review round 7 (1 finding, fixed): `CARGO_TARGET` is evaluated lazily,
once, on first use, so only `make bindings` runs cargo metadata and
node; other targets pay nothing.

Review round 8 (2 findings, the same as rounds before): no `run` case
names `wasm`. The diff placed new `derived` entries on the `run` cases
next to the `wasm` surface added to neighbouring pure cases. To leave
nothing to misread, the harvest now records derived descriptors only for
the cases the WebAssembly surface runs (`plan check`, `plan compile`,
`plan show`, `replay`), so this PR no longer changes any `run` case:
every `run` case keeps its surfaces `["cli"]` and gains nothing. wasm
23/23.

Also fixed here (raised on #131, rounds 1 to 4): in the plan namespaces,
`AddressOverride.to` and `RemediationDecl.for` showed the `Party` type's
description instead of their own rule. The schemas were right; the
generator took whichever description a referenced type was first
resolved with. `gen-types.mjs` now wraps a reference that has its own
description in `allOf`, so every field keeps its own text (`to`: never
`caller`) and shared types become named (`Party`, `Grade`, `Predicate`)
instead of inlined; shapes are unchanged and `tsc --strict` passes.

Review round 9 (2 findings, fixed): (1) the store resolver is
`resolveItem`, no longer shadowing `path.resolve`. (2) a failed
instantiation sample is recorded as a 3.10.5 failure and the measurement
document is still written.

Review round 10 (5 findings): (1) fixed: the wasm-opt pin matches the
whole version token (`wasm-opt version 116` then a space or the end), so
`1160` fails it. (2) Repeated: refusing an output that names an input
matches the file host, where the input is an existing file and
`ensure_absent` refuses it the same way; the code says so. (3) Known and
recorded: the raw size is over its 3.10.4 budget, which draft spec 046
addresses; until the owner decides, the gate reports it rather than the
budget being weakened. (4) fixed: an output without `normalize` is read
as having none. (5) The allowlist is every module name with every base
name on purpose: the same reviewed glue is imported from `wbg` or
`./rustev_wasm_bg.js` depending on the target; the check says so.

Review round 11 (4 findings): (1) fixed: make expands a recipe's lines
before running the first, so the target directory is read before the
Node check whatever the order; the refusal now names what it needs
(cargo metadata and Node 20 or later on PATH). (2) Not a defect:
`max_bytes` goes to the host only as a hint; the guard compares the
returned length with it as integers, and on wasm32 a `usize` is 32 bits,
exact as an f64; the code says so. (3) A harvest that would write
outside its fixtures is a broken test, not a case to skip: the test
fails loudly, and the harvest rewrites its output on the next run. (4)
Verified: the lockfile's integrity for lodash 4.18.1 equals the
registry's (`npm view [email protected] dist.integrity` gives the same
`sha512-dMIn...0Q==`).

Review round 12 (1 finding, fixed): each case, comparison included, runs
in its own `runCase` under the per-case catch, so a throw while reading
a golden fails that case only.

Review round 13 (1 finding, fixed): a replay case without `--now-ms`
fails naming the flag (`flags().need`) instead of passing `NaN` on
(which the Rust side would also refuse).

Review round 14 (3 findings, all raised before): (1) lodash 4.18.1 is
published, and its lockfile integrity equals the registry's (verified in
round 13 and earlier). (2) A case that names the `wasm` surface for a
command it lacks is a failure by design, counted as run: the suite must
not silently skip a case it claims. (3) To settle it, the allowlist is
now the exact reviewed `module:name` pairs (22, both targets' module
names), checked as pairs.

Review round 15 (3 findings): (1) fixed: a case file from an earlier
harvest must record the same derived descriptors this harvest wrote, or
the harvest fails and says to rebuild; run cases now carry the harvest's
own `"derived": []`, so every committed case file is reproduced byte for
byte by `make conformance-harvest` (the wall-clock replay bundles
aside). (2) fixed: the flags a command cannot run without (`definition`,
`out`, `plan`, `bundle`, `now-ms`) fail the case by name when absent.
(3) No WebAssembly case pins a written output today (every one pins
stdout), so nothing passed vacuously; a case that did is now compared
against the artifact the command published under that name, never
skipped.

Review round 16 (1 finding, raised in earlier rounds too): lodash 4.18.1
was published on the public registry on 2026-04-01 (after the reviewer's
knowledge cutoff), and the lockfile's integrity equals the registry's
`sha512-dMIn...0Q==` (`npm view [email protected] time dist.integrity`); it
is json-schema-to-typescript 16.0.0's dependency and `npm ci` installs
it. The package now records this in its `//` note, so the diff carries
the evidence.

Review round 17 (1 finding): verified, and now verified on every build:
`npm view [email protected] dist.integrity` equals the lockfile's
`sha512-dMIn...0Q==`, and `make bindings` now runs `npm audit
signatures` after `npm ci`, which checks every installed package's
registry signature (locally: 16 packages with verified registry
signatures, lodash 4.18.1 among them).

Review round 18 (2 findings): (1) fixed: every path the `bindings`
recipe builds from `BINDINGS_OUT` or `CARGO_TARGET` is quoted, so a
target directory with a space is passed whole. (2) The spec says nothing
about lodash (no "4.18.1" appears in it), and lodash 4.18.1 is published
(2026-04-01) and now verified by registry signature on every `make
bindings` (`npm audit signatures`: 16 packages verified); `npm ci`
installs it.

Review round 19 (3 findings): (1) js-yaml 4.3.2 is published (`npm view
[email protected] version dist.integrity`), as is every package in the
lockfile; the package's note now covers the whole tree rather than one
package at a time: `npm ci` checks each package against its locked
integrity, and `make bindings` verifies every installed package's
registry signature (16 verified). (2) fixed: each scope mode's fields
are required, so a replay case without them fails by name. (3) The hash
width is fixed by the exact wasm-bindgen pin (0.2.129, 3.10.2); a new
pin that changes it fails the allowlist loudly, which is wanted; the
code says so.

Review round 20 (4 findings): (1) fixed: a test pins that an output
naming an input is refused. (2) fixed: a case file from an earlier
harvest must also record the same surfaces. (3) fixed: each built target
directory carries its module type (`web` and `bundler` ES modules,
`node` CommonJS, written by `make bindings`), and the exports name the
matching conditions (`import`, `require`); Node no longer warns that the
module type is unspecified. (4) Already done as asked: `make bindings`
runs `npm audit signatures` after `npm ci` (16 packages with verified
registry signatures, lodash 4.18.1 among them), which checks provenance,
not only content.

Review round 21 (1 finding, resolved): the owner ratified spec 046
(A-43, #136), raising the raw budget to 2,621,440 bytes and keeping the
gzip and instantiation budgets and the gate; `wasm-opt` could not close
the gap (`-Oz` is the smallest at 2,216,152 bytes). The measurement
check now applies the 046 budget, and `make bindings` passes end to end
(wasm conformance 23/23). The spec 027 record says so.
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

The diff records two documentation changes: promoting spec 046 from draft to approved status, and adding the corresponding A-43 ratification entry to the decisions log.

docs/decisions/00-founding-decisions.md

The A-43 entry states the measurement on the current branch is 2,216,152 bytes, and the new budget is 2,621,440 bytes. Both figures are internally consistent with the spec's summary (2,215,589 bytes at first measurement, budget raised to 2,621,440 / 2.5 MiB). No inconsistency there.

The A-43 entry says the spec "amends 027 3.10.4" -- this matches the spec's amends field and the body text. The decision log and the spec are mutually consistent.

specs/046-wasm-size-budget/spec.md

  • status changes from draft to approved -- correct per A-43.
  • The summary's trailing sentence about being a draft proposal is replaced with "Ratified by the owner on 2026-10-20 (A-43)" -- consistent.
  • The body's opening line changes from "Draft: a proposal..." to "Approved: ratified by the owner on 2026-10-20 (decision A-43)" -- consistent.
  • implementation: pending is left unchanged -- appropriate, as A-43 explicitly says this approval does not authorize a release.

No bugs, security issues, or internal inconsistencies found in either changed file.

{"head": "72978f3123fb49bcb307ca06bf9f834713f0b15a", "verdict": "no-findings", "findings": []}

Subject: 55df832...72978f3, diff digest df7a07f7efcc967d4711766e53032a56ad50e8907e62ef60176177d7d323e17d, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception October 21, 2026 03:31 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

The diff is purely documentation: a new ratification entry (A-43) and the matching status promotion in spec 046. I checked the following for consistency:

  • Budget figures: 2,621,440 bytes (2.5 MiB new limit) and 2,215,589 bytes (first measurement) appear identically in both files. The percentage claim (5.6% over 2,097,152) is arithmetically correct (2,215,589 / 2,097,152 ≈ 1.0565).
  • Cross-references: A-43 cites spec 046 amending 027 3.10.4; the spec frontmatter amends: "027-node-and-wasm-bindings" is consistent.
  • Dates: 2026-10-20 appears consistently in both files.
  • Preserved state: implementation: pending is correctly left unchanged (A-43 explicitly does not authorize a release).
  • Predecessor entry: A-42 marks spec 046 as not-yet-ratified; A-43 now ratifies it — the sequence is coherent.
  • Scope language: gzip and instantiation budgets described as unchanged in both files; no scope creep in A-43 vs the spec body.

No bugs, inconsistencies, or security issues found.

{"head": "79a7af2e999e8077d2d1c5110d184f72c2ed67f4", "verdict": "no-findings", "findings": []}

Subject: ba225e8...79a7af2, diff digest df7a07f7efcc967d4711766e53032a56ad50e8907e62ef60176177d7d323e17d, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception October 21, 2026 05:13 — with GitHub Actions Inactive
@bartekus
bartekus merged commit 7d37649 into main Oct 21, 2026
7 checks passed
@bartekus
bartekus deleted the spec/046-ratify branch October 21, 2026 05:36

This branch was previously deployed

1 inactive deployment
statecraft-review-exception — 79a7af2e Deployed Oct 21, 2026 by bartekus via review-exception #913
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