Commit graph

174 commits

Author SHA1 Message Date
Sebastian Herrlinger
3f47c98dc6 refactor(codemode): keep the incremental collector's hooks small for short runs
Allocation paths ask the collector for a freed slot rather than handing
it the object, so every allocation no longer builds its object in
memory first, and a reused slot's placeholder is replaced without drop
code. The heap's mark state is held inline, and the strings' collector
state is made only once a run passes its first threshold, so a short
run allocates nothing for the collector.
2026-11-19 15:53:16 +01:00
Sebastian Herrlinger
344e66c398 feat(codemode): bound incremental collector pauses with snapshot marking and chunked tracing
Replace the incremental-update barrier and its atomic finish with a
snapshot-at-the-beginning barrier: the first write to an object while
marking traces it before the write, cell writes shade the value they
overwrite, objects made while marking are black, and marking ends when
nothing is grey, with no rescan of the roots.

Count marking work in slots and trace long properties, elements and
entries a chunk at a time. Pay for no idle allocations at a cycle's
start, set the next threshold from the data live when marking ended,
and share the room between the arenas so the threshold holds.
2026-11-19 15:15:54 +01:00
Sebastian Herrlinger
2871ed66a8 fix(codemode): bound incremental collector pauses on atoms and rewritten objects 2026-11-19 14:28:05 +01:00
Sebastian Herrlinger
073cbeb11f feat(codemode): add an incremental mark-sweep collector behind gc-incremental 2026-11-19 14:17:24 +01:00
Sebastian Herrlinger
6ca5dee148 test(codemode): add a memory benchmark for long-lived psychoscript runs 2026-11-19 13:13:15 +01:00
Sebastian Herrlinger
34d2637981 feat(codemode): move long stretches of a run's compute to a worker thread, keeping host code on the executor 2026-11-19 03:32:56 +01:00
Sebastian Herrlinger
15a0948a0d refactor(codemode): runs own their module list and source, so a run outlives its caller's borrow 2026-11-19 03:24:13 +01:00
Sebastian Herrlinger
0e3de44007 refactor(codemode): size compile threads by a conservative nesting scan, not source size 2026-11-19 03:22:37 +01:00
Sebastian Herrlinger
3b682d0d93 refactor(codemode): make a run's state Send 2026-11-19 03:20:54 +01:00
Sebastian Herrlinger
c01c31121e feat(codemode): keep unpaired surrogates in namespace paths, error names, RegExp sources, bindings, metadata and durable data 2026-11-19 03:11:19 +01:00
Sebastian Herrlinger
7bddc79372 feat(codemode): keep unpaired surrogates in diagnostics and host failures 2026-11-19 03:02:33 +01:00
Sebastian Herrlinger
9257f8889f feat(codemode): keep unpaired surrogates in the result and the logs (Data, HostString) 2026-11-19 02:53:56 +01:00
Sebastian Herrlinger
f679776772 perf(codemode): make a namespace path a small heap object, spelled out only when a call needs it 2026-11-19 02:47:59 +01:00
Sebastian Herrlinger
6cfcfcf628 feat(codemode): cross strings to the host losslessly, unpaired surrogates included (HostString) 2026-11-19 02:41:41 +01:00
Sebastian Herrlinger
4c7e4da0d7 fix(codemode): give each read of a namespace path a new reference, as the reference does 2026-11-19 02:41:40 +01:00
Sebastian Herrlinger
e9e4e1ecad test(codemode): skip round trips after a large state in proportion to its size, as the reference does 2026-11-19 02:09:50 +01:00
Sebastian Herrlinger
4f456097f8 perf(codemode): count the frames toward the call-stack limit as they are pushed, not on every call past it 2026-11-19 02:09:50 +01:00
Sebastian Herrlinger
6d7e96a399 refactor(codemode): make the Rust crate the language layer only
The crate becomes the Rust implementation of the reference's language layer (`src/language/`): its public API is
the Rust form of `Language` (`Runtime::make` with `globals(run)`, modules, limits and translation; `HostFunction`
for `Host.fn` with sync, async and sync-thenable types, idempotent, constructible and takes-functions;
`DurableFunction`; `Namespace`; `Failure` for `Host.fail` and `Host.missing`; `Run` with its metadata; programs,
suspend and resume; snapshots). Code Mode (tools, schemas, the catalog, `search`, OpenAPI, hooks, max tool calls,
extensions) is removed, and the language files move from `src/language/` to `src/`.

Host calls follow the reference's language runtime: arguments cross under the runtime's translation (functions and
promises fail the call unless dropped or awaited), a function from a result crosses back only to a function that
takes functions, async and durable calls start at the next handover, sync work can block (`Returned::Block`) or
stay pending (`Returned::Pending`), and a suspend is refused while a call that can't be detached runs. Namespace
paths carry their root label, and their `keys` may fail. Snapshots save the run's metadata and its calls by global
path, and restart them by resolving that path again.

The replays define the generators' host globals (`conformance/reference.rs` shares `tools` with
`conformance/reference.ts`): the cases, `host.json`, `boundary.json` and `streaming.json`. `tests/host.rs` mirrors
the reference's `test/language.test.ts`; the API tests are ported, and the Code Mode tests are removed.
2026-11-19 01:54:11 +01:00
Sebastian Herrlinger
3cf39e761d test(codemode): record unsupported syntax at run time and acorn's parse errors from the reference
Programs in frames/core.ts record, with message and location, unsupported syntax that
runs or is never reached (classes, with, debugger, new.target, import.meta, super,
nested exports), the bindings it hides, using declarations, nested imports, names
located inside parentheses, and parse errors in acorn's words; a suspension reaches
unsupported syntax after resuming. New cases record values around it, and the api
test checks the suggestion, which the recordings do not capture. streaming.json is
to be regenerated at integration.
2026-11-19 00:28:20 +01:00
Sebastian Herrlinger
84af887ec8 fix(codemode): word and locate parse errors as the reference does
The reference parses with acorn and reports its message, ending with a period and
the hint "Code must be plain JavaScript written as a program body.", at acorn's
position. oxc words most errors differently and sometimes points elsewhere (the
first of two declarations, the end of the previous token, the keyword instead of
the token after it), so its diagnostics are translated to acorn's wording and
position, with the AST deciding what text cannot (a binding or an assignment of
eval, a duplicate parameter, super() inside a method). Regular expression literal
errors take acorn's reasons, its offset after the opening slash and the pattern
without flags. An import or export below the top level, which acorn accepts in a
script, is no longer a parse error, and empty code reads "Code cannot be empty."
2026-11-19 00:28:20 +01:00
Sebastian Herrlinger
fedd6bd772 fix(codemode): bind and run what never-run syntax hides as the reference does
A var declared only inside a with body is not bound, since the reference never
compiles that body, so the name reads the global. A using or await using
declaration is a const that nothing disposes. An import below the top level does
nothing in the program and throws its SyntaxError where it runs in a function. A
read of, or write to, a name fails at the name itself, so a parenthesized
assignment target is located where the reference locates it. ThrowSyntax now
throws a plain SyntaxError and ThrowUnsupported the unsupported-syntax one.
2026-11-19 00:28:20 +01:00
Sebastian Herrlinger
603c5653b3 fix(codemode): throw unsupported syntax where it runs instead of refusing the program
The reference compiles a class, with, debugger, new.target, import.meta, super or a
nested export to a THROW_ERROR at that node, so code that never reaches it runs, code
before it runs, and it fails with a catchable SyntaxError named after the ESTree node
type, with kind UnsupportedSyntax, the supported-syntax orientation as its suggestion
and the node's location. A new ThrowSyntax instruction does the same here. A class's
name is not a binding, as in the reference, so it reads the global of that name, and
dynamic import() evaluates and ignores its options instead of being refused.
2026-11-19 00:28:20 +01:00
Sebastian Herrlinger
7ae50ead66 fix(codemode): check the member an update or compound assignment writes before it reads it
The reference checks the member first (CHECK_BASE WRITE_PROP, and emitWritableKey for a computed one), so
`tools.t.a += 1`, `tools.t.a ??= 1` and `tools.t[0]++` fail with "Only data fields may be assigned." or the
namespace key error, where Rust read the namespace and failed in the operator or not at all. A computed write
target's base is checked before its key converts and, for `o[k] = v`, before the right side runs, so a nullish base
fails without calling the key's toString or evaluating `v`. GetPropW reads a member it then writes after that check,
and WriteKey makes a computed write target's key after it; both only leave the fast path for a base that isn't a plain
object, and a key conversion that calls the program runs as a convert frame (code WRITE_KEY).

A string's length and indexes are its own values, so writing them fails as "Only data fields may be assigned.", as in
the reference, rather than "Cannot create property".
2026-11-18 23:50:22 +01:00
Sebastian Herrlinger
a20402a268 fix(codemode): read destructured promises as the reference does and report its error locations
Destructuring compiled to member reads, so `const { a } = Promise.resolve(1)` refused with the missing-await error;
the reference reads a pattern's keys with destructuredProperty, which skips that guard. Patterns now read with
DestructProp/DestructElem, and a computed pattern key converts with ToKey at its expression first, as the reference's
TO_KEY does.

Uncaught errors now point where the reference's node does:
- a pattern's property, element, rest and simple target, the for-in right side, a labeled loop, an object spread, a
  computed object key and a template substitution;
- a fused constant operand (`x > 1`, `x += 1`) at the operator rather than the constant;
- a member instruction's errors at its object (a nullish or promise base, without parentheses as ESTree has it) or
  its key (a namespace path's non-string key, a key with no primitive), which a per-instruction site table records
  and the failure's Site picks when it is located; a callee that isn't a function at the callee;
- a tool call's arguments that can't cross and a rejected import() at the call.
The TDZ ReferenceError message gains the reference's final period.
2026-11-18 23:50:22 +01:00
Sebastian Herrlinger
93abe8d1e5 fix(codemode): let then name a namespace path, and never take a namespace as a thenable
Reading then from a namespace gave undefined, so awaiting one could not
mistake it for a thenable and call a tool. The reference reads it as a
path like any other (typeof tools.then is "function") and never takes a
namespace as a thenable. Rust now does both: the read gives the path, and
resolving a promise with a namespace, or crossing one, doesn't look for
then.

Recorded: boundary-namespace-then.
2026-11-18 23:50:22 +01:00
Sebastian Herrlinger
a0ab788627 fix(codemode): refuse calling the namespace itself and hide an uncaught value that isn't data
Left over from the boundary sweep, outside its files: tools() fails with
tools is not a function, delete with a number or symbol key on a
namespace fails as reading one does, and a thrown value that holds a
function, a promise, a namespace or a built-in object, at any depth,
fails as Uncaught: a non-data value, as the reference's
containsRuntimeReference has it.

Recorded: boundary-namespace-calls and six uncaught values.
2026-11-18 23:11:59 +01:00
Sebastian Herrlinger
9e87d3b91a fix(codemode): check prototype method receivers and arguments in the reference's order
Headers and URLSearchParams methods count their arguments before they check their receiver; Uint8Array.set reads
its offset as a number before its source; Number.prototype methods name themselves ("Number.prototype.toFixed
requires that 'this' be a Number."); Array.with words an index out of range as the reference does. A namespace is
no callable receiver for Function.prototype.call, apply and bind (Rust called the tool), no argument list for apply
(which words any other non-object the reference's way), and no Set-like object for the Set methods.
Object.prototype.toLocaleString refuses a symbol as it refuses null, since neither has a prototype to look in.
2026-11-18 23:05:06 +01:00
Sebastian Herrlinger
9f4fca2982 fix(codemode): refuse built-in inputs as the reference does
Built-ins given a namespace, a promise or a primitive where they need something else now fail with the reference's
words: new Map, Set, WeakMap and WeakSet, Object.groupBy and the other prelude loops over a value with no iterator
fail InvalidData "for...of requires an iterable value, received <a Date>.", naming the value as describeValue does
(also in the for...of statement, which said "an object" for a Date, a RegExp or a URL). Array.from, Iterator.from,
String.raw and new Promise take no namespace, which is no object; Object.isFrozen, isSealed and isExtensible answer
for it as for a primitive; Object(...) and new Number, String and Boolean word their refusals as the reference does,
and String.fromCodePoint words an invalid code point as the reference's host. A combinator's rejection for an input
it cannot iterate points at its call, as the reference's does.

Records cases for these and for the member writes, deletes, in and instanceof of the earlier commit.
2026-11-18 23:05:06 +01:00
Sebastian Herrlinger
f2eb1ac29f fix(codemode): word the two symbols as the reference's host does
The reference's symbols are its host's, described "codemode.iterator" and "codemode.async-iterator". Where its
host's String makes a symbol text (String(s), a template literal, join, the String methods' arguments, an Error
message), it reads "Symbol(codemode.iterator)"; Rust threw "Cannot convert a Symbol value to a string" or wrote
"Symbol(Symbol.iterator)". The host's + still refuses ("Cannot convert a symbol to a string"), ToNumber words its
refusal "Cannot convert a symbol to a number", Object.prototype.toString gives "[object Object]", JSON.stringify
writes a symbol as an object with no fields, as the reference's walk with a replacer already did, and an uncaught
symbol names itself the same way.
2026-11-18 23:05:06 +01:00
Sebastian Herrlinger
1bfc8f666d fix(codemode): read namespace paths and nullish bases as the reference does
A namespace path takes string names only: a number or a symbol key fails "tools paths must use string property
names.", where Rust read undefined or a path named by the number. Object.keys and for...in of a path that names
neither a tool nor a namespace fail with the reference's UnknownTool "Unknown tool namespace '<path>'." instead of
listing nothing.

A computed member write on null or undefined fails as the read the reference resolves it with, and an object key in
that message is made without calling the program ("[object Object]"), as the reference's coerceToString makes it.
Promise.prototype.then, catch and finally name themselves and the receiver they refuse, and new URLSearchParams
words a symbol as the reference does.
2026-11-18 23:05:06 +01:00
Sebastian Herrlinger
84d9ab3f47 fix(codemode): take enumeration sources and property bases as the reference does
Object.keys, values, entries, assign and hasOwn, for...in, object spread and object rest read their source through
the reference's enumerableSource: null and undefined fail "<label> cannot convert null to an object.", a promise
fails InvalidData "<label> received an un-awaited Promise; ..." and a namespace InvalidData "<label> cannot read
tools: it is a namespace of host functions, not plain data. ...", except that Object.keys and for...in list a
namespace's names. Rust gave V8's message, and enumerated a promise or a namespace as empty. Object.assign names the
target it refuses, sets fields on a promise as they are, and a string source reads as its characters (so it owns
length); Object.getPrototypeOf and Object.create word their failures as the reference does.

Destructuring null or undefined no longer quotes the value. A member assignment on null or undefined fails as the
read the reference resolves it with, on a primitive names the value, and a symbol has no properties to read, write or
delete. `in` checks its right side before it converts its key, and fails for a namespace or another opaque operand as
the binary operators do; instanceof is false for a namespace and words its failures as the reference does.

The spread and rest checks run inside one out-of-line call each, as the copy before them did: a second call in those
arms of the run loop cost numeric-loop 1% of its instructions.
2026-11-18 23:00:42 +01:00
Sebastian Herrlinger
a56513f977 fix(codemode): reject String method arguments that are still not data
The reference's String methods read each argument through requireDataArgument once the receiver and the arguments
converted: one that is still a promise or a namespace fails with InvalidData "String.<name> expects argument <n> to
be a data value.", in the order the method reads its arguments (padStart checks its length before its fill, split
its limit before its separator, replace its pattern before its replacement). Rust read a promise as
"[object Promise]" and threw for a namespace.

A receiver of null or undefined now names the method ("String.prototype.trim called on null or undefined."), and
split tells a missing separator from one that converts to undefined by the argument, as the reference does.
2026-11-18 23:00:42 +01:00
Sebastian Herrlinger
a31e7f534d fix(codemode): convert a namespace or a promise without calling its methods
The reference keeps its namespace references outside its objects, so a built-in that converts one reads the text
"[object Object]" (NaN as a number) without a call and without a conversion request of its own; Rust threw
"Cannot convert object to primitive value." for String(tools), [1, 2].join(tools), Math.max(tools) and the like.
Its $vmToPrimitive also keeps a promise as it is, spending only its own unit, so that what reads it can reject it as
an un-awaited value; Rust called the promise's toString and valueOf.

primitive_of now returns both unchanged, number_of and string_of give their text and NaN, and a list of conversions
counts neither as an object to convert. A property key made from either is its text: key_of looped forever on one
before (const { [tools]: a } = {} overflowed the stack).
2026-11-18 23:00:42 +01:00
Sebastian Herrlinger
f2f3a08937 refactor(codemode): name a tool or an array method only when a message needs it
A tool call formatted its tool's label before crossing its arguments, and
an Array.prototype method's receiver check carried the code naming the
method inline: both cost every call (tool-fan-out +7%, string-building
+0.9% by instruction count). The label is now made lazily, and naming the
method is out of line.
2026-11-18 22:25:48 +01:00
Sebastian Herrlinger
2a9405dedc refactor(codemode): keep the language layer from depending on Code Mode
The language layer reached tools in a handful of places: the run's host
state held the runtime's setup and tool context, the VM called tools and
search directly, a snapshot looked tools up to restore calls in flight,
and extension calls ran Code Mode's hooks. It now asks the layer embedding
it through one trait, Embedder: the globals it makes (search), calls into
its namespace and its blocking global, a namespace's keys, cancelling,
checking and restarting calls in flight, its natives, and the hooks around
host function calls. The runtime's Setup implements it, in
codemode/tool_host.rs, which takes the tool calls, search and the unknown
tool's suggestions from host.rs. A run's interruption, its record of calls
and its natives table are the language's.

Code Mode's modules are no longer named at the crate root, and
tests/language_boundary.rs fails when a language file names a path through
codemode or an item the root takes from it, as the reference's
test/language-boundary.test.ts does. The public API is unchanged.
2026-11-18 22:21:34 +01:00
Sebastian Herrlinger
8b5ba7fabe refactor(codemode): let the language layer see a run's suspenders only through SuspendWatch
The run's host state held Code Mode's suspend state, which carries a run's
outcome. It now holds a SuspendWatch: whether a suspend is requested,
whether anyone is watching, and the synchronous call that refuses one
meanwhile. Code Mode's state implements it, and a program installs its own
into the run it drives; a run nobody drives is unwatched.
2026-11-18 22:08:24 +01:00
Sebastian Herrlinger
44500d0dbc refactor(codemode): give each layer its own shared types
Diagnostics, their kinds and the limits a run runs under move to the
language layer (language/diagnostic.rs), with the boxed future host work
is and a run's id and call keys. The runtime a host makes, its options and
a run's outcome move to the Code Mode layer (codemode/runtime.rs), with
the test262 harness, which builds runs through it. The crate root
re-exports them as before.
2026-11-18 22:04:54 +01:00
Sebastian Herrlinger
7b10229572 refactor(codemode): put the crate's modules in a language layer and a Code Mode layer
The reference split its sources into src/language/ (compiler, VM,
runtime, stdlib, host functions, snapshots) and src/codemode/ (tools,
schemas, catalog, search, OpenAPI, hooks). The crate's modules now live in
language/ and codemode/ the same way. This commit only moves files: the
crate root still names every module by its short name, and the language
layer still reaches into tools; the commits after it cut those
dependencies.
2026-11-18 22:01:10 +01:00
Sebastian Herrlinger
e8fafb8a56 fix(codemode): fail a host call whose saved value had no data form once the run resumes
On dev the reference saves a host value with no data form, such as a live
response a busy loop kept the run from taking, as a Lost. Restoring
succeeds, and the call fails when the value crosses into the program:
fetch produced a Lost, which the program cannot hold, at the call. Rust
refused the snapshot instead, as the reference did before. A host call's
settlement now carries its source offset, saved in the snapshot, so this
error and any other error converting a host function's value point at the
call, as the reference's do.
2026-11-18 21:55:08 +01:00
Sebastian Herrlinger
b97c413f60 fix(codemode): match the reference's callback rules and messages in built-ins
Found while reading the rebase's recordings; none of these were recorded
before, and the pre-rebase reference behaves the same except where noted.

- Callback sites (array methods, sort, then/catch/finally, replace and
  replaceAll, JSON.parse's reviver and JSON.stringify's replacer) admit
  what the reference's isSupportedCallback does: not the Promise statics
  or Symbol (marked NOT_CALLBACK), nor a namespace reference, each refused
  with the site's wording. The hint now says (value) => fn(value), as on
  dev.
- Symbol says it isn't callable, and new Symbol() asks for a call.
- Array.prototype methods on a receiver that isn't an array name themselves
  and what they got.
- JSON.parse fails with its host runtime's message after the reference's
  prefix, from the parser Response.json already used.
- Assigning to a namespace says only data fields may be assigned; a
  namespace is described as a namespace reference, and the un-awaited
  promise hint names load(...), as on dev.

Recorded: std-callback-admission, std-json-parse-errors and
std-array-receivers.
2026-11-18 21:55:08 +01:00
Sebastian Herrlinger
0514a867e2 fix(codemode): let a synchronous host call wait only from a frame the loop runs
A synchronous host call (search, an extension function) whose arguments hold a
promise parks its caller's frames while it waits. Whether it could was decided
by how the call was made, and a native calling back through call_counted marks
its calls as counted although Rust code still waits on the stack below. The
wait now decides from its own frame when it starts: one native code drives as a
base frame cannot park, so the call fails as before.
2026-11-18 21:29:00 +01:00
Sebastian Herrlinger
96a65673fb fix(codemode): count a host call wait's loop back-edge as bytecode does
The reference's $vmHostWait loops in its internal bytecode, whose back-edge
counts toward the interpreter's own clock check like any of the program's.
The wait now spends it as fuel_step does rather than as fuel alone.
2026-11-18 21:29:00 +01:00
Sebastian Herrlinger
e941709ea3 test(codemode): mirror the reference's host-call argument tests
tools.rs mirrors codemode.test.ts: a tool's arguments leave a function (a
toJSON included) out and await a promise, pending ones too, and a rejection
fails the call before the tool runs. extensions.rs mirrors extensions.test.ts
and language.test.ts: a host function from a result arrives back as itself
wherever it sits, a program function or a global's function is left out, a
promise that never settles waits until the timeout, and a result holding
functions is handed to a tool as its data. The host-args-promise case mirrors
promise.test.ts: a tool's promise inside another call's arguments is awaited.
2026-11-18 21:29:00 +01:00
Sebastian Herrlinger
a8901203bc fix(codemode): keep an error's own name among its host copy's fields
The reference copies a program error for the host with every own key but
stack, message, constructor, toString and __proto__, so an own name is a field
of the copy as well as its name. to_host left it out of the fields.
2026-11-18 21:29:00 +01:00
Sebastian Herrlinger
d8f218b226 fix(codemode): start a streaming response's operations when they are called
The reference hands a program a streaming response's methods (text, json,
getReader, cancel, read, ...) as plain functions inside a result, which run as
synchronous host calls: the operation starts inside the call, so locked and
bodyUsed change at once. The busy loops that read a fetch body flip at their
first iteration in the regenerated recordings for that reason. An operation
now starts as soon as it is queued instead of at the next handover.
2026-11-18 21:29:00 +01:00
Sebastian Herrlinger
5e7afe14fd fix(codemode): cross host-call arguments as the reference's toHost does
The reference now converts the arguments of every host call (tools, search,
extension functions) with toHost under Code Mode's translation: a function is
left out (an object's key is skipped, an array's item is null, an argument is
undefined, a Map's or Set's entry is undefined), a fulfilled promise is its
value, and a call whose arguments hold a promise that hasn't fulfilled waits for
each in turn and then calls again ($vmHostWait). A tool's or search's arguments
then become JSON through the tool runtime's toJson, so a toJSON of the
program's is no longer called, Date and URL cross as their ISO string and href
whatever their prototype's toJSON is, and a Uint8Array fails a known tool's
call once it starts.

Tool and search arguments now cross in one pass that fuses toHost and toJson
(cross::tool_args); extension arguments cross through to_host, which also hands
a function from a host result back as the host function itself. An async host
function's wait keeps its state in an array resumed through Reaction::Cross,
spending the job and the loop's back-edge, then nothing for a tool's namespace
call or fifty for a native; a synchronous one's wait is a native frame that
parks its caller's frames as an await does. An async extension function now
rejects its promise when its arguments can't cross, instead of throwing.

The walk that crossed tool and search arguments (its tool and search targets,
the parking search walk and answer_search) goes; the program's result still
crosses through the JSON walk. The streaming harness records a suspend that
came after the run ended with the run's outcome, as the reference does.
2026-11-18 21:29:00 +01:00
Sebastian Herrlinger
f43cced4d2 docs(codemode): list per-run extensions, module names and constructible globals
The crate docs name RunOptions with the other pieces of the API, and the
package's scope lists the extension features the reference added.
2026-11-18 21:10:50 +01:00
Sebastian Herrlinger
b0407dc45f test(codemode): resume a run with the extensions it picked
Mirrors the reference's suspend test: a run started with some of the
runtime's extensions is refused by a resume with all of them or with
fewer, and resumes with the same ones picked in another order and with a
repeat. Picking an extension the runtime wasn't made with panics with the
reference's message.
2026-11-18 21:10:49 +01:00
Sebastian Herrlinger
beda44806f test(codemode): record extension configuration from the reference
catalog.ts now records an extensions section: runtimes made from a fixed
library of extensions, runs that pick some of them, constructible globals
called with and without new, an extension's module names loaded through
import, require and import(), and imports that can't be resolved with
their reasons, each with its outcome and what the host functions
received. It mirrors the reference's new tests for per-run extensions,
constructible globals, module names and import errors. tests/extensions.rs
replays it with the same library built in Rust.
2026-11-18 21:10:49 +01:00
Sebastian Herrlinger
05c6497272 fix(codemode): say where an import that can't be resolved failed
The error was made as a plain Error without a diagnostic, so the run's
failure had no line and column, where the reference reports the import's
position like any error it throws. It is made as a failure now, like the
type errors the host throws.
2026-11-18 21:10:49 +01:00