← Back to Pull requests

[js-api] Fix more editorial slips #2278

Closed
unknown closed this pull request without merging on Oct 13, 2026 15:15 UTC
View on GitHub
unknown unknown commented on Oct 13, 2026 13:42 UTC
Author

This PR makes a handful of small, unrelated editorial fixes bundled together,
which mostly come from the drift from the core Wasm spec.

1. Field access of table types and memory types

Memory.grow and Table.length each project a single field out of mem_type/table_type's return value:

1. Let addrtype be the address type in mem_type(store, memaddr).
1. Let addrtype be the address type in table_type(store, tableaddr).

This isn't technically wrong, but "the X in Y(...)" reads as projecting a named field,
when mem_type/table_type actually just return a plain tuple with no field names at all.
Other call sites of table_type (table.get/.set, the Table constructor)
instead destructure the full tuple, so rewritten to follow that pattern:

1. Let (addrtype, limits) be mem_type(store, memaddr).
1. Let (addrtype, limits, elementtype) be table_type(store, tableaddr).

2. limits represented as a named-field record, which the Core Spec doesn't have

Memory/Table's constructors each build a limits value as a named-field record:

1. Let memtype be memory type addrtype { min initial, max maximum }.
1. Let type be the table type addrtype { limits/min initial, limits/max maximum } elementtype.

But the Core Spec's actual grammar (limits ::= [u64 .. u64?]) is a range, not a two-field record.
Rewritten directly to the grammar's own bracket-ellipsis notation:

1. Let memtype be the memory type addrtype [initial .. maximum] page.
1. Let type be the table type addrtype [initial .. maximum] elementtype.

(Side note: this also makes two tweaks on memory type's own line:
a leading "the", and the trailing page keyword.)

3. Global mutability represented with const/var, which no longer exist

Global's constructor (and two other call sites) represent mutability with two named terms, const and var:

1. If mutable is true, let globaltype be var valuetype; otherwise, let globaltype be const valuetype.
...
1. If mut is const, throw a TypeError.

But the Core Spec's actual grammar (globaltype ::= mut? valtype) represents mutability as an optional marker.
Rewritten to match, using a new mut term for the present case and nothing at all for the absent one:

1. If mutable is true, let globaltype be mut valuetype; otherwise, let globaltype be valuetype.
...
1. If mut is empty, throw a TypeError.

(Side note: For stringExternType, the entire term was written using backtick, which is now rewritten using linked terms.)

4. deftype/comptype conversion at the Embedding API boundary, done implicitly instead of explicitly

Before the GC proposal, a function's type simply was a params -> results shape.
GC introduced deftype (a recursive-type wrapper that needs an explicit expand to get back to that shape) and turned comptype itself into a 3-variant sum (struct/array/func).

Several call sites still destructure or construct a deftype/comptype pair as if neither change happened:

1. Let [|parameters|] → [|results|] be |functype|.
...
1. Let (|store|, |tagAddress|) be tag_alloc(|store|, |wasmParameters| → « »).

functype/tagtype are deftypes, not already-expanded comptypes.
The Embedding API's own postcondition for both says so explicitly
("the returned defined type ... expands to a function type").

tag_alloc's argument requires a deftype too, not a bare comptype but the bare arrow notation is passed directly.

Separately, the arrow notation itself is missing the leading variant name,
func, that comptype's current 3-variant grammar requires.

Rewritten using terms the Core Spec already has: expansion for the deftype→comptype direction,
and "such that" idiom (already used by ToWebAssemblyValue) for the inverse:

1. Let func |parameters| → |results| be the expansion of |functype|.
...
1. Let |tagtype| be the defined type such that func |wasmParameters| → « » is the expansion of |tagtype|.
1. Let (|store|, |tagAddress|) be tag_alloc(|store|, |tagtype|).

Diff: 535 lines (+401 / -134) across 6 files Reviewer: Ms2ger Review duration: 92m
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 535 lines diff across 6 files
0.48
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.376
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2278"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 47.9% (MEDIUM) · Higher = larger blast radius
47.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 18.9% · Safe to merge
18.9%