Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
ba00587
fix(codegen): update the JIT host test
metaphorics Jul 28, 2026
d2967d0
style: normalize the native toolchain sources
metaphorics Jul 28, 2026
44986d7
fix(bamts): correct the facade contract
metaphorics Jul 28, 2026
b989e87
test(compiler): generate the strictness rule reference
metaphorics Jul 28, 2026
57628fc
test(verification): add the corpus differential harness
metaphorics Jul 28, 2026
3b755e5
feat(cli): expose the strictness surface
metaphorics Jul 28, 2026
bdc6a71
feat(compiler): implement the type-dependent strictness rules
metaphorics Jul 28, 2026
b8138d4
test(verification): report exact corpus failure stages
metaphorics Jul 28, 2026
fac900a
feat(compiler): complete the strictness catalog
metaphorics Jul 28, 2026
8466ec6
fix(verification): classify backend lowering failures
metaphorics Jul 28, 2026
0571a4f
style: format the strictness and corpus gates
metaphorics Jul 28, 2026
e26eef5
refactor(compiler): group rule identity metadata
metaphorics Jul 28, 2026
ddc0d79
fix(verification): pin the optional node facade
metaphorics Jul 28, 2026
0497bed
fix(compiler): bind the standard global environment
metaphorics Jul 28, 2026
7098233
feat(compiler): resolve complete program graphs
metaphorics Jul 28, 2026
7d27b2a
style(compiler): format whole-program analysis
metaphorics Jul 28, 2026
7a75045
feat(cli): check complete program graphs
metaphorics Jul 28, 2026
328263c
refactor(compiler): type external module edges
metaphorics Jul 28, 2026
bbd0d35
fix(compiler): resolve legal type and value scopes
metaphorics Jul 28, 2026
d1ba4bd
fix(compiler): recognize const assertions and URI globals
metaphorics Jul 28, 2026
0e9660d
feat(bytecode): add the canonical program envelope
metaphorics Jul 28, 2026
3ebea36
fix(bytecode): enforce total live module linkage
metaphorics Jul 28, 2026
94d93f1
feat(compiler): lower canonical executable programs
metaphorics Jul 28, 2026
d0efbb4
fix(compiler): merge static and dynamic module edges
metaphorics Jul 28, 2026
28f6ac9
feat(runtime): execute live module programs
metaphorics Jul 28, 2026
f45fc40
fix(runtime): complete module namespace boundaries
metaphorics Jul 28, 2026
f0b5dba
feat(native): carry module identity through the ABI
metaphorics Jul 28, 2026
d96d8c0
feat(codegen): compile canonical module programs
metaphorics Jul 28, 2026
6c67c5f
feat(runtime): execute native module programs
metaphorics Jul 28, 2026
f48fa88
test(codegen): pin module-qualified entry symbols
metaphorics Jul 28, 2026
86f7b91
refactor(runtime): cut over every engine to Program
metaphorics Jul 28, 2026
232029a
fix(runtime): bind native entries to Program bytes
metaphorics Jul 28, 2026
2dd74b5
chore(corpus): declare the shared resolver root
metaphorics Jul 28, 2026
4d6504d
fix(verification): separate AOT compile and run evidence
metaphorics Jul 28, 2026
6ce899c
feat(runtime): provide Node external modules
metaphorics Jul 28, 2026
b0af554
feat(runtime): preserve symbol property keys
metaphorics Jul 28, 2026
f055f7a
feat(bytecode): add exact ECMAScript strings
metaphorics Jul 28, 2026
5d83184
fix(runtime): match Node external argument decoding
metaphorics Jul 28, 2026
1d4b7a7
refactor(runtime): index regular expressions by UTF-16 units
metaphorics Jul 28, 2026
0049647
fix(runtime): preserve exotic property identities
metaphorics Jul 28, 2026
ee01112
fix(runtime): meter every native instruction
metaphorics Jul 28, 2026
6fd4e9e
fix(runtime): preserve loose parseArgs values
metaphorics Jul 28, 2026
fb164f2
chore(node): gate AOT process wrappers from tests
metaphorics Jul 29, 2026
d08bcdd
fix: preserve exact ECMAScript UTF-16 strings
metaphorics Jul 29, 2026
0239325
fix(runtime): hide engine realm handles
metaphorics Jul 29, 2026
57e8777
refactor(runtime): store Date state in typed heap entry
metaphorics Jul 29, 2026
3f0fdd9
refactor(runtime): store iterator state in typed heap entry
metaphorics Jul 29, 2026
3243337
refactor(runtime): store collection state in typed heap entry
metaphorics Jul 29, 2026
7dcc0bf
feat(vm): add host-compiled script execution
metaphorics Jul 29, 2026
8e7ad46
feat(runtime): evaluate closed-graph dynamic imports
metaphorics Jul 29, 2026
501f0a6
fix(runtime): copy symbol-keyed properties
metaphorics Jul 29, 2026
dfda71b
fix(runtime): hide private names from reflection
metaphorics Jul 29, 2026
d4c4405
fix(codegen): preserve resumed instruction locations
metaphorics Jul 29, 2026
04b3601
fix(node): suppress stdout after AOT failure
metaphorics Jul 29, 2026
b079eba
fix(verification): use formal gate dependency order
metaphorics Jul 29, 2026
63f003a
fix(formal): synchronize bytecode format version
metaphorics Jul 29, 2026
3cecb82
fix(bytecode): report truncated payload offsets
metaphorics Jul 29, 2026
5c21f9b
feat(runtime): complete callable bind and apply
metaphorics Jul 29, 2026
25a8ce0
fix(cli): embed the current AOT runtime
metaphorics Jul 29, 2026
56156ed
feat(runtime): add synchronous corpus builtins
metaphorics Jul 29, 2026
498f49f
fix(runtime): complete Uint8Array construction coercion
metaphorics Jul 29, 2026
4763ccd
fix(runtime): support Uint8Array array-like inputs
metaphorics Jul 29, 2026
b0d7eb5
fix(compiler): preserve self-referential captures
metaphorics Jul 29, 2026
6f66d42
fix(compiler): preserve class declaration timing
metaphorics Jul 29, 2026
7bbc45e
feat(runtime): enforce local lexical temporal dead zones
metaphorics Jul 29, 2026
c9155b9
fix(compiler): reset completion on caught throws
metaphorics Jul 29, 2026
6109386
feat(runtime): complete node builtin providers
metaphorics Jul 29, 2026
72fd038
feat(runtime): add promise microtask queue
metaphorics Jul 29, 2026
702a9e7
feat(runtime): resume timers and suspended calls
metaphorics Jul 30, 2026
cac8e72
chore(publish): prepare workspace manifests and npm packages for regi…
metaphorics Jul 30, 2026
eae6a98
fix(runtime): clean up test helper allocations
metaphorics Jul 30, 2026
ccd50b0
fix(runtime): make automatic timer waits total
metaphorics Jul 30, 2026
e3cebe3
fix(verification): allow publishable path versions
metaphorics Jul 30, 2026
696a263
fix(codegen): enforce executable-memory separation
metaphorics Jul 30, 2026
bdea2a1
feat(runtime): complete Node parity for async iteration
metaphorics Jul 30, 2026
4af839a
fix(verification): isolate concurrent AOT artifacts
metaphorics Jul 30, 2026
5a8ba3d
fix(runtime): reject modules on first async dependency failure
metaphorics Jul 30, 2026
3175c7b
fix(runtime): await async-from-sync iterator values
metaphorics Jul 30, 2026
9d09652
fix(cli): publish runtime cache concurrently
metaphorics Jul 30, 2026
a17e99a
docs(architecture): capture exact UTF-16 string migration
metaphorics Jul 30, 2026
0b04085
feat(runtime): add exact non-moving garbage collector
metaphorics Jul 30, 2026
5342012
fix(runtime): keep collector heap charges exact
metaphorics Jul 30, 2026
8141d5e
fix(runtime): transfer collector storage charges
metaphorics Jul 30, 2026
1cf3e6b
fix: resolve PR review findings
metaphorics Jul 31, 2026
9c337e9
fix(node): preserve AOT stdout on failure
metaphorics Jul 31, 2026
4f1538e
fix(codegen): bind units by module identity
metaphorics Jul 31, 2026
5d34687
fix(compiler): isolate namespace var scope
metaphorics Jul 31, 2026
8dc35b4
fix(workspace): publish compatible dependency ranges
metaphorics Jul 31, 2026
3ad8f81
docs(native): restore local safety contracts
metaphorics Jul 31, 2026
bf7489f
fix(cli): preserve logical AOT process argv
metaphorics Jul 31, 2026
16da0da
fix(compiler): retain every resolved program edge
metaphorics Jul 31, 2026
5d91f27
refactor(compiler): share callable signature checks
metaphorics Jul 31, 2026
79d1261
fix(compiler): compare canonical semantic types
metaphorics Jul 31, 2026
442e684
feat(compiler): lower nondecimal bigint literals
metaphorics Jul 31, 2026
cc866ca
feat(compiler): erase debugger statements
metaphorics Jul 31, 2026
ac71256
fix(compiler): route nested finally completions
metaphorics Jul 31, 2026
a7fb84d
feat(compiler): lower labeled control flow
metaphorics Jul 31, 2026
e65b3a6
feat(compiler): support escaped identifier names
metaphorics Jul 31, 2026
9358316
feat(compiler): report debugger and with syntax
metaphorics Jul 31, 2026
a7952f3
fix(compiler): classify classic script syntax errors
metaphorics Jul 31, 2026
51eb247
fix(compiler): close for-of iterators on abrupt exits
metaphorics Jul 31, 2026
c9e84f2
docs(codegen): remove stale helper table count
metaphorics Jul 31, 2026
ea6506d
fix(node): consume authenticated AOT launch tokens
metaphorics Jul 31, 2026
6f29b13
fix(compiler): assert edge index ordering
metaphorics Jul 31, 2026
5cd22f5
fix(compiler): separate static accessor checks
metaphorics Jul 31, 2026
db064ce
wip(compiler): freeze decorator substrate for initializer ordering
metaphorics Aug 2, 2026
fbe3bd4
fix(compiler): order callable decorator initializers
metaphorics Aug 2, 2026
e92b973
fix(compiler): complete field accessor decorators
metaphorics Aug 2, 2026
191b1fd
test(compiler): prove decorator state closure
metaphorics Aug 2, 2026
5cfe4d6
test(compiler): pin decorator state invariants
metaphorics Aug 3, 2026
2cad268
wip(runtime): baseline before construct_value origin unit
metaphorics Aug 3, 2026
8a015a5
test(runtime): pin construct_value throw origin
metaphorics Aug 3, 2026
3fb4335
fix(runtime): normalize async intrinsic rejections
metaphorics Aug 3, 2026
62dad75
fix(compiler): make bare TypeError throws total
metaphorics Aug 3, 2026
8fc60bb
test(native): pin explicit new target parity
metaphorics Aug 3, 2026
f8b348c
fix(runtime): materialize promise rejection reasons
metaphorics Aug 3, 2026
0c4b488
refactor(compiler): reuse semantic text views
metaphorics Aug 3, 2026
566295e
Revert "refactor(compiler): reuse semantic text views"
metaphorics Aug 3, 2026
1a024c9
feat(compiler): complete TypeScript native execution foundation
metaphorics Aug 3, 2026
7962e0d
fix(bytecode): bound decoder allocation growth
metaphorics Aug 3, 2026
aaeecd9
fix(compiler): load module graphs iteratively
metaphorics Aug 3, 2026
373db5a
fix(runtime): trace active builtin new target
metaphorics Aug 3, 2026
bd8e422
fix(cli): isolate fallback AOT cache
metaphorics Aug 3, 2026
965dae4
test(bytecode): guard hostile decoder counts
metaphorics Aug 3, 2026
88dd5eb
fix(cli): preserve fallback cache reuse
metaphorics Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .outline/sdd/task-10-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Task 10 audit fix report

Status: DONE

## Verdict

`raise_type_error` is now total: it always loads a fresh known non-callable
(`Constant::Boolean(true)`) and issues a bare `Call`, never invoking a
user-returned value. Callable invalid auto-accessor decorator returns TypeError
in Interpreter/JIT/AOT with side-effect count zero, matching TypeScript+Node.

## Brief (authoritative)

`.outline/sdd/task-10-brief.md` Audit fix:

- Remove the offender parameter from `raise_type_error`.
- Helper loads a fresh known non-callable constant and issues the bare Call.
- Update every call site.
- Add `invalid_auto_accessor_decorator_return_matches_tsc_oracle_in_every_execution_mode`.
- Commit: `fix(compiler): make bare TypeError throws total`.

## Gap

`apply_auto_accessor_decorators` rejected non-object decorator returns by
passing the returned value to `raise_type_error`. When that return was a
function, the helper `Call`ed it, running user code instead of throwing an
engine-origin TypeError.

## Production fix

File: `crates/bamts-compiler/src/lower.rs`

```rust
fn raise_type_error(
&mut self,
builder: &mut ModuleBuilder,
range: TextRange,
) -> Result<(), LowerError> {
// Always call a fresh known non-callable. Never pass a user-returned
// value here: a callable invalid decorator return would run user code
// instead of throwing an engine TypeError.
let dummy = self.load_constant(builder, Constant::Boolean(true), range)?;
let undefined = self.undefined(builder, range)?;
let _ = self.call_with_registers(range, dummy, undefined, &[])?;
Ok(())
}
```

Updated call sites (5):

- `accept_replacement_callable` — drop `returned`
- `collect_optional_callable` — drop `returned`
- closed `addInitializer` arm — drop redundant `closed_dummy` load; helper owns it
- open `addInitializer` bad-callback arm — drop `callback`
- `apply_auto_accessor_decorators` — drop `returned` (the audit hole)

Instruction shape unchanged: still bare `Call` of a non-callable, no
`LoadGlobal("TypeError")`, no `Construct`, no `Throw`.

## New differential

`invalid_auto_accessor_decorator_return_matches_tsc_oracle_in_every_execution_mode`
in `crates/bamts-verification/tests/corpus_differential.rs`:

- Auto-accessor decorator returns a function that increments `sideEffects` if
invoked.
- TypeScript+Node and BamTS Interpreter/JIT/AOT catch `TypeError`.
- Observable output includes `sideEffects:0` (returned callable never invoked).

## Focused verification (exact evidence)

Instruction-shape:

```bash
cargo test -p bamts-compiler --lib raise_type_error
cargo test -p bamts-compiler --lib escaped_add_initializer_after_close_takes_type_error_path_not_append
```

```text
test lower::tests::raise_type_error_is_a_bare_throw_without_constructor_lookup ... ok
test result: ok. 1 passed; 0 failed; … 507 filtered out

test lower::tests::escaped_add_initializer_after_close_takes_type_error_path_not_append ... ok
test result: ok. 1 passed; 0 failed; … 507 filtered out
```

Named differentials (all-mode oracle):

```bash
cargo test -p bamts-verification --test corpus_differential \
invalid_class_decorator_return_matches_tsc_oracle_in_every_execution_mode -- --exact
cargo test -p bamts-verification --test corpus_differential \
invalid_auto_accessor_decorator_return_matches_tsc_oracle_in_every_execution_mode -- --exact
```

```text
test invalid_class_decorator_return_matches_tsc_oracle_in_every_execution_mode ... ok
test result: ok. 1 passed; 0 failed; … 45 filtered out

test invalid_auto_accessor_decorator_return_matches_tsc_oracle_in_every_execution_mode ... ok
test result: ok. 1 passed; 0 failed; … 45 filtered out
```

## Contract map

| Contract | Evidence | Status |
|---|---|---|
| `raise_type_error` loads internal non-callable and bare-Calls it — no offender param | `lower.rs` helper + call sites | PASS |
| Instruction shape still bare Call / no TypeError global / no Construct / no Throw | `raise_type_error_is_a_bare_throw_without_constructor_lookup` | PASS |
| Closed `addInitializer` still takes type-error path | `escaped_add_initializer_after_close_takes_type_error_path_not_append` | PASS |
| Invalid class decorator return still matches tsc/Node in every mode | `invalid_class_decorator_return_matches_tsc_oracle_in_every_execution_mode` | PASS |
| Callable invalid auto-accessor return TypeErrors; side effect count stays 0 | `invalid_auto_accessor_decorator_return_matches_tsc_oracle_in_every_execution_mode` | PASS |

## Scope boundaries

- Staged only `lower.rs`, the new differential, and this report.
- Other dirty tree work left unstaged.
- Native materialization remains Task 11.

## Commit

- Message: `fix(compiler): make bare TypeError throws total`

## Result

DONE.
97 changes: 97 additions & 0 deletions .outline/sdd/task-14-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Task 14 implementer report

Status: DONE

## Verdict

High-severity Promise rejection materialization defect is fixed at the single
`reject_promise` sink. Lazy engine-origin reasons (`UNDEFINED` + non-Bytecode
origin) materialize once into realm-intrinsic Errors before settlement;
already-materialized and Bytecode-origin reasons retain identity. Async
function, async generator body, incompatible receiver, failed import, and
direct sink identity/materialization tests are green.

## Blocking finding (resolved)

Engine-origin Promise rejections outside `settle_async_step` previously stored
`Value::UNDEFINED` with a non-Bytecode origin, so JavaScript handlers observed
`undefined` instead of an intrinsic Error. Paths affected:

- async generator body throws (`settle_async_generator_step` Throw arm)
- `AsyncGenerator.prototype.next` incompatible receiver
- failed-import / dynamic-import rejection forwarding
- any reaction that forwarded a still-lazy reason through `reject_promise`

## Production fix

`Machine::reject_promise` in `crates/bamts-runtime/src/lib.rs`:

- when `catch_value_needs_materialization(reason, origin)` holds and the
promise is still pending, replace `reason` with
`self.materialize_engine_origin(origin)?` before `settle_promise`
- already-settled promises remain no-ops and do not allocate a reason
- non-lazy / Bytecode reasons pass through unchanged

No call-site fan-out: async generators, incompatible receivers, import
replay, and reaction forwarding all inherit the sink contract. Existing
`settle_async_step` normalization remains harmless (post-materialize reasons
are non-`UNDEFINED`, so no double allocation).

## Tests

Added/strengthened in `crates/bamts-runtime/src/lib.rs`:

- `reject_promise_materializes_lazy_type_error_once` — direct sink; lazy
TypeError materializes once; second reject on settled promise is a no-op
- `reject_promise_keeps_prematerialized_identity` — direct sink; concrete
Bytecode reason keeps exact Value identity
- `async_generator_engine_type_error_rejection_has_intrinsic_shape` — body
calls a non-callable; front `next()` capability rejects with intrinsic
TypeError
- `async_generator_next_on_incompatible_receiver_rejects_promise` —
strengthened from asserting `UNDEFINED` to asserting TypeError
name/message/`instanceof` and matching origin

Existing green:

- `async_engine_type_error_rejection_has_intrinsic_shape`
- `async_prematerialized_rejection_keeps_identity`
- `failed_import_caught_by_dependent_is_intrinsic_type_error`
- `dynamic_import_rethrows_one_stored_failure_at_each_import_site`

## Verification

```bash
cargo test -p bamts-runtime --lib reject_promise_
cargo test -p bamts-runtime --lib async_engine_type_error_rejection_has_intrinsic_shape
cargo test -p bamts-runtime --lib async_prematerialized_rejection_keeps_identity
cargo test -p bamts-runtime --lib async_generator_engine_type_error_rejection_has_intrinsic_shape
cargo test -p bamts-runtime --lib async_generator_next_on_incompatible_receiver_rejects_promise
cargo test -p bamts-runtime --lib failed_import_caught_by_dependent_is_intrinsic_type_error
cargo test -p bamts-runtime --lib dynamic_import_rethrows_one_stored_failure_at_each_import_site
```

All listed filters: passed (0 failed).

Neighbors also green: `async_generator_throw_rejects_front_and_drains_queue`,
`async_generator_returned_promise_rejection_rejects_front`.

## Staging discipline

- Staged only `crates/bamts-runtime/src/lib.rs` and this report
(force-added under ignored `.outline/sdd/`).
- Left unrelated dirty workspace files unstaged.

## Commit

- Message: `fix(runtime): materialize promise rejection reasons`
- High-severity findings remaining for Task 14 architecture brief: **0**
(this blocking finding closed; medium/low from oracle/reviewer left for
the final findings task).

## Self-review

- Single sink; no duplicated normalizers at each call site.
- Pending-check before materialization avoids heap churn on settled no-ops.
- Identity contracts for prematerialized / Bytecode reasons preserved.
- Prior Task 9 async-function path remains green without edits.
84 changes: 84 additions & 0 deletions .outline/sdd/task-7-fix-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Task 7 audit fix report

Status: DONE (test-only)

## Verdict

Added `construct_value_preserves_engine_throw_origin`. Focused suite is 4/4 green.
No production edit.

## Gap

`nested_callback_construct_engine_type_error_is_intrinsic` raises a `construct`
TypeError inside an `Array.prototype.map` callback, so the throw crosses
`call_value`, not the runtime-constructor boundary in `construct_value`.
`construct_value`'s own `UncaughtThrow → ThrowValueOrigin` conversion was
therefore uncovered.

## Contract restored

File: `crates/bamts-runtime/src/lib.rs`

- `construct_value` maps `RuntimeErrorKind::UncaughtThrow { value, origin }` to
`EvalFailure::ThrowValueOrigin { value, origin }` (approx. lines 6724–6730).
- New unit obtains a runtime closure constructor, drives
`Machine::construct_value` directly, and asserts payload + origin exactly.

## New test

`tests::construct_value_preserves_engine_throw_origin`

- Allocates a runtime `HeapEntry::Function` whose body `Call`s non-callable
`Int32(0)`, producing engine `ThrowOrigin::TypeError { operation: "call" }`.
- Invokes `machine.construct_value(callee, &[])`.
- Asserts:

```rust
Err(EvalFailure::ThrowValueOrigin {
value: Value::UNDEFINED,
origin: ThrowOrigin::TypeError { operation: "call" },
})
```

- `operation: "call"` is deliberate: the outer boundary is construct, so a
leaked boundary error would read `"construct"`. Also asserts
`machine.frames.is_empty()`.

## Focused verification

Command:

```bash
cargo test -p bamts-runtime --lib -- \
native_callback_throw_is_caught_at_outer_call_site \
nested_callback_call_engine_type_error_is_intrinsic \
nested_callback_construct_engine_type_error_is_intrinsic \
construct_value_preserves_engine_throw_origin
```

Result:

```text
running 4 tests
test tests::construct_value_preserves_engine_throw_origin ... ok
test tests::native_callback_throw_is_caught_at_outer_call_site ... ok
test tests::nested_callback_construct_engine_type_error_is_intrinsic ... ok
test tests::nested_callback_call_engine_type_error_is_intrinsic ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 429 filtered out; finished in 0.01s
```

| Concern | Test | Result |
|---|---|---|
| Nested call engine TypeError | `nested_callback_call_engine_type_error_is_intrinsic` | ok |
| Nested construct engine TypeError | `nested_callback_construct_engine_type_error_is_intrinsic` | ok |
| Explicit thrown-value callback | `native_callback_throw_is_caught_at_outer_call_site` | ok |
| Direct `construct_value` origin | `construct_value_preserves_engine_throw_origin` | ok |

## Scope

- Test-only addition in `mod tests`.
- Existing outer-catch tests kept unchanged.
- No production edit.
- Logical diff is the new unit only (inserted after
`nested_callback_construct_engine_type_error_is_intrinsic`).
Loading