Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions quest/m1/ffi-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ Every generator on the C ABI:

## Required

- [Payloads cross as bytes](/quest/m1/ffi-export/payload-bytes.md) - a payload that is not UTF-8 crosses unchanged, where today it aborts from C, C++, and Kotlin
- [Iterator and JSON arguments the exporter can't map yet](/quest/m1/ffi-export/instance-keys.md) - `IntoIterator` as a `Vec`, and `serde_json::Value`
- [Fail CI on an instance not inferred](/quest/m1/ffi-export/inference-gate.md) - a gap in instance inference fails CI instead of sitting in the census
- [moq-clock's C names once it moves into kio](/quest/m1/ffi-export/crates.md) - `moq_now` and `moq_origin` become the clock's, after moq moves it into `kio::clock`
- [Setters for an object's pub fields](/quest/m1/ffi-export/field-setters.md) - C fills in a session's config, as Rust assigns it
- [Session config's foreign types](/quest/m1/ffi-export/foreign-types.md) - `Url`, `SocketAddr`, `PathBuf`, and `Vec<String>` cross the C ABI
- [Sessions on moq-tokio](/quest/m1/ffi-export/session-tokio.md) - bindings connect and accept with one call, the library running moq-tokio inside
- [Sessions on sans-IO QUIC](/quest/m1/ffi-export/session-quic.md) - bindings move UDP datagrams and drive the session's poll themselves
- [The recursion depth lint on moq's export](/quest/m1/ffi-export/recursion-lint.md) - `just ffi moq` builds clean before the lint becomes an error
- [C++ bindings on MSVC and Clang](/quest/m1/ffi-export/cpp.md) - the C++ header built and tested beyond GCC on Linux
- [Kotlin bindings: zero-copy payloads and the read path](/quest/m1/ffi-export/kotlin.md) - the Kotlin lends bytes without a copy, and reads at JNI's cost
- [Kotlin bindings on Android](/quest/m1/ffi-export/kotlin-android.md) - an R8 keep rule for JNI's lookups, and an emulator run in CI
20 changes: 20 additions & 0 deletions quest/m1/ffi-export/inference-gate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [XS] Fail CI on an instance not inferred

## Goal

CI fails when any crate's census reports `instance not inferred`, so a gap in the
exporter's instance inference is caught when it appears instead of sitting in a census no
one reads.

## Plan

[#188](https://github.com/kixelated/rust2/pull/188) made inference one pass before typing.
Where inference misses an instance typing reaches, typing refuses the item as
`instance not inferred`. That refusal means the exporter has a bug, not that the crate uses
something unsupported. No crate reports it today, so the check passes from the start.

- Check every census the exporter runs: the fixtures' in the merge gate, and moq's in the
job that already runs it.
- Fail with the item and its span, so the report says what to fix.

Public API: none.
21 changes: 21 additions & 0 deletions quest/m1/ffi-export/kotlin-android.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# [M] Kotlin bindings on Android

## Goal

The generated Kotlin runs on Android, not only the JVM: an app shrunk by R8 keeps the
methods JNI looks up by name, and an Android emulator run of the Kotlin tests proves it in
CI.

## Plan

Found by [#184](https://github.com/kixelated/rust2/pull/184) on 2026-10-28, which builds and
tests the Kotlin on the JVM only.

- R8 and ProGuard rename or strip `Native`'s dispatchers, which the JNI glue finds by name.
Ship a keep rule with the generated Kotlin, in the form an Android library consumes
(`consumer-rules.pro` or the AAR's `proguard.txt`), and test a minified build with it.
- The emulator run is slow: put it in the nightly workflow, not the merge gate.
- Check what the Android API levels moq targets give the Kotlin, such as the
`java.lang.ref.Cleaner` question in [the Kotlin quest](/quest/m1/ffi-export/kotlin.md).

Public API: the keep rule shipped beside the generated Kotlin.
24 changes: 24 additions & 0 deletions quest/m1/ffi-export/payload-bytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# [S] Payloads cross as bytes

## Goal

A parameter that takes bytes, such as moq's `impl Into<Bytes>` frame payloads
(`group::Producer::write_frame`), exports as bytes in the C ABI and every generator, so a
payload that is not valid UTF-8 crosses unchanged. Today it resolves to `String`: C and C++
abort on such a payload, and Kotlin's `writeFrame` takes a `String`.

## Plan

Found by [#184](https://github.com/kixelated/rust2/pull/184) on 2026-10-28. This is a
correctness bug: moq's media payloads are binary.

- Find why first. [`choose`](/ffi/src/collect.rs) puts `X` of `impl Into<X>` ahead of
`String`, so the signature moq writes, or the bound typing reads, differs from what the
rule expects.
- Fix the rule, not moq's case: any parameter whose bounds `Bytes` or `Vec<u8>` meets but
whose meaning is bytes must not narrow to `String`. A `String` choice stays only where
the bound itself is about text.
- Prove it from C, C++, and Kotlin with a payload that is not UTF-8, and report the census
before and after.

Public API: the C, C++, and Kotlin types of the affected parameters.
19 changes: 19 additions & 0 deletions quest/m1/ffi-export/recursion-lint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# [S] The recursion depth lint on moq's export

## Goal

`just ffi moq` builds with no `recursion_depth_exceeding_limit` warning, before the pinned
nightly turns that future-compat lint into a hard error and the export stops building.

## Plan

Found by [#144](https://github.com/kixelated/rust2/pull/144) on 2026-10-27: the lint fires on
`Send` checks in moq-net, moq-tokio, and the generated `moq_ffi`.

- Find which types' `Send` checks recurse that deep, and whether the generated glue makes
them deeper than moq's own code does.
- Fix the generated part here. A part in moq's own crates is moq's change, recorded in
moq's tree; a `recursion_limit` raise is a stopgap only if neither can avoid the depth.
- Fail the build on the lint once it is gone, so it does not come back.

Public API: none.
2 changes: 2 additions & 0 deletions quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The fork's feature quests folded into the [exporter](/quest/m1/ffi-export/README
- [Byte slices without objects](/quest/m2/ts-byte-views/README.md) - reading through a translated cursor allocates no object per read
- [Async in the TypeScript translator](/quest/m2/ts-async.md) - moq-net's and kio's async code translates with Rust's lazy futures
- [Shared ownership](/quest/m2/ts-shared.md) - `Arc`/`Rc`/`Weak` keep exact counts, and locks and atomics become plain values
- [Held values that name a reassigned variable](/quest/m2/ts-aliases.md) - a held place or folded value reads what Rust read, in and across loop iterations
- [Translate moq-net's model to TypeScript](/quest/m2/ts-model/README.md) - the model translates with kio, moq-clock, and moq-pattern, for moq to compare against WASM
- [Translate against the prebuilt std](/quest/m2/ts-std-build.md) - measure whether `-Zbuild-std` is still needed now that panics abort, and drop it if not
- [Waiting: Swift 6.4 in nixpkgs-unstable](/quest/m2/uniffi-swift-arm.md) - the nightly UniFFI fixtures move back to arm
- [Waiting: ubrn reads UniFFI 0.32](/quest/m2/ubrn-release.md) - the binding benchmark's browser runner pins a ubrn release, not an open PR
28 changes: 28 additions & 0 deletions quest/m2/ts-aliases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# [M] Held values that name a reassigned variable

## Goal

Wherever rust2-ts holds an expression back instead of reading it once, the held value
reads what Rust read when it was made, even after a variable it names is assigned again,
including on a later iteration of a loop. Proven by differential tests against native Rust
that reassign each name between the hold and the read, in and across loop iterations.

## Plan

Collected on 2026-10-28 from three reports of one shape:

- `stable_path` holds only the outermost object of a place, so an index inside it
(`a[i].b[j]` with `i` reassigned while the borrow lives) is read live
([#176](https://github.com/kixelated/rust2/pull/176)).
- `alias()`'s copy arm treats a held-back source local as stable, though its folded value
may name a variable assigned again ([#148](https://github.com/kixelated/rust2/pull/148)).
No miscompile was found through it, but it is #148's bug in another place.
- Values made in a loop that share one JS binding across iterations where each Rust
iteration has its own value.

Audit every place the lowering folds or holds an expression rather than fixing these one
by one: the rule is one check of which names a held value reads and whether any can be
written before the read. #148's review also asked for differential coverage of reborrows
through a reassigned reference and of indexed borrows.

Public API: the translator's output.
6 changes: 6 additions & 0 deletions quest/m2/ts-async.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ moq-net still needs, by its census from MIR at the pinned revision:
[bindings](/ts/README.md#bindings). The rest of kio's API translates from source
across crates; what it still refuses is std's.
- The edge: `rt.spawn`'s shape for callers, and cancelling a spawned task.
- `kio::Waiter::poll_future::<()>` does not normalize in moq-net's census, since `()` is
no `Future`. It is reached from `util.rs`'s `future_task` closure, itself refused as a
`Box<dyn FnMut>`, and the same call translates in the fixture
([#141](https://github.com/kixelated/rust2/pull/141),
[#183](https://github.com/kixelated/rust2/pull/183)). Find where polymorphic lowering
makes the `()`.

An async block that captures part of a variable, which THIR refused 47 times, is a
capture like any other in MIR.
Expand Down
3 changes: 3 additions & 0 deletions quest/m2/ts-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ Public API: the translator's output for moq-net's model.
- [Shared ownership](/quest/m2/ts-shared.md) - kio's waiters are `Arc`/`Weak` with observable counts, and its atomics and locks are plain values
- [Float formatting](/quest/m2/ts-model/floats.md) - `f64` formats and parses as std does
- [The rest of std the model reaches](/quest/m2/ts-model/std-rest.md) - `Vec` and `VecDeque` capacity, and `RandomState`
- [Writes through places the model still refuses](/quest/m2/ts-model/places.md) - `get_or_insert_default` through a `&mut`, and `mem::take` of a captured `&mut Vec`
- [std gaps kio reaches](/quest/m2/ts-model/kio-std.md) - `array::from_fn`, `Default` of arrays and `()`, and maps of `Option`s
- [bytes' BytesMut, Buf, and BufMut](/quest/m2/ts-model/bytes.md) - map without config, so the model's `BytesMut` binding goes
- [Async in the TypeScript translator](/quest/m2/ts-async.md) - kio's producers and consumers are futures
22 changes: 22 additions & 0 deletions quest/m2/ts-model/bytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# [M] bytes' BytesMut, Buf, and BufMut

## Goal

rust2-ts maps `bytes::BytesMut` and the `Buf` and `BufMut` traits with no config, as
[#147](https://github.com/kixelated/rust2/pull/147) maps `Bytes`, so `ts/moq/model.toml`
drops its `BytesMut` binding and moq-net's code generic over `Buf` and `BufMut` translates.
Proven by differential tests against native Rust.

## Plan

Found by #147 on 2026-10-27: the model reaches `BytesMut`, which is bound because its
`unsafe` doesn't translate, and moq-net's codec is generic over `Buf` and `BufMut`.

- Share `Bytes`'s representation where `BytesMut` freezes into one or splits off, and match
`bytes`' observable behavior: `capacity`, `reserve`'s growth, and what `split_to` and
`freeze` share.
- `Buf` and `BufMut` as generic bounds belong here; `dyn Buf` belongs to
[trait objects](/quest/m3/ts-dyn.md).
- Measure the codec on the [TS benchmark](/ts/README.md#bench) before and after.

Public API: the translator's output.
24 changes: 24 additions & 0 deletions quest/m2/ts-model/kio-std.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# [S] std gaps kio reaches

## Goal

rust2-ts translates the std that kio reaches and no other quest owns, proven by
differential tests against native Rust: `array::from_fn`, `Default` of arrays (kio's
`[Atomic<u64>; 8]::default()`) and of `()`, and a `HashMap` whose values are `Option`s
(`shared.rs`).

## Plan

Found by [#167](https://github.com/kixelated/rust2/pull/167) and
[#183](https://github.com/kixelated/rust2/pull/183). kio's `static` atomics belong to
[shared ownership](/quest/m2/ts-shared.md). Kept apart from
[the rest of std](/quest/m2/ts-model/std-rest.md), whose capacity work is a hot-path change
of its own.

- `Default` and `from_fn` of an array run element by element in index order, which an
element whose constructor has effects or panics observes.
- A map of `Option`s needs its `Option`-returning methods (`get`, `insert`, `remove`) to
tell `None` from `Some(None)`; [#134](https://github.com/kixelated/rust2/pull/134) gave
`rt.None` for that.

Public API: the translator's output.
26 changes: 26 additions & 0 deletions quest/m2/ts-model/places.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# [M] Writes through places the model still refuses

## Goal

rust2-ts translates the writes through a place that the model's census still refuses,
proven by differential tests against native Rust:

- `Option::get_or_insert_default` on an `Option` reached through a `&mut`, such as a
`&mut Option<Vec<_>>` from a match on `&mut self.fields` (moq-net's `group.rs`), and the
call it is still refused as outright (`origin.rs`).
- `mem::take` of a `&mut Vec` a closure captured (`origin.rs`), refused as "replacing the
value behind a reference".

## Plan

Found by [#168](https://github.com/kixelated/rust2/pull/168) on 2026-10-28: four
`get_or_insert_default` refusals stayed with [#149](https://github.com/kixelated/rust2/pull/149)'s
`rt.Place`s landed, and no quest owns them since #149 deleted its own.

- Both are a place the lowering can't name: a captured `&mut` is a capture of a place, not a
std gap, and `get_or_insert_default` already lowers in `call.rs` where its place guard
allows. Find what each guard refuses, and widen it only as far as the semantics stay
exact.
- Report the model's census before and after.

Public API: the translator's output.
21 changes: 21 additions & 0 deletions quest/m2/ts-std-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# [S] Translate against the prebuilt std

## Goal

Decide, by measurement, whether rust2-ts still needs `-Zbuild-std` now that it aborts on
panic ([#187](https://github.com/kixelated/rust2/pull/187)), and drop it if not, making the
translator's builds faster and simpler.

## Plan

Suggested by #187 on 2026-10-28.

- Translate the fixtures and moq's census against the prebuilt std and diff the census and
every snapshot against today's. Equal output, with the differential tests passing, is
the bar.
- The risk: the prebuilt std is built with optimizations that may inline or rewrite calls
the translator expects to see by path (std's iterators, formatting, and the calls in
`library.rs`), so its MIR may differ from what `-Zbuild-std` gives.
- Measure the build time saved.

Public API: none, unless the toolchain the driver needs changes.
8 changes: 7 additions & 1 deletion quest/m3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ generic std gap is planned here even when moq never calls it.
- [f32](/quest/m3/ts-f32.md) - `f32` and `Duration`'s `f32` methods translate as `f64` does
- [Trait objects](/quest/m3/ts-dyn.md) - `dyn Trait` and `Box<dyn Future>` translate, so a consumer neither rewrites nor binds them
- [Waiting: type-check in process with tsrs](/quest/m3/ts-tsrs.md) - rust2-ts checks bindings through tsrs instead of `tsc` once it is a stable library
- [An inclusive range folded through an adaptor](/quest/m3/ts-range-fold.md) - a `RangeInclusive` folded through `map`, `filter`, or `rev` ends in core's state
- [An inclusive range folded through an adaptor](/quest/m3/ts-range-fold.md) - a `RangeInclusive` folded through `map`, `filter`, or `rev` ends in core's state, and `by_ref` of one type-checks
- [Binding gaps](/quest/m3/ts-bind-gaps.md) - bound types as keys, unit returns checked, renamed dependencies
- [Drop order in std's folds and iterators](/quest/m3/ts-drop-order.md) - the values that drop still refused in std's folds, zips, flattens, and collects drop as std's do
- [Checks on the differential harnesses](/quest/m3/ts-harness.md) - step lists that drift, literal op bytes, and `refs`'s coverage fail a test or get cases
- [Ordering in std](/quest/m3/ts-ordering.md) - `cmp::max`/`min`, `is_sorted`, and `BinaryHeap`, and #173's cost on integers measured
- [Debug and Display of Arc and ranges](/quest/m3/ts-fmt-wrappers.md) - `Arc<T>` formats as `T`, and ranges as std's `Debug`
- [Fold a match a bool decided](/quest/m3/ts-fold-bool.md) - `if matches!` and derived `==` drop a later match's dead arms
- [Rename one instance](/quest/m3/ffi-instance-rename.md) - `rename` by an instance's path, once a consumer's clash needs it
- [Port the workflow guard to kixelated/quest](/quest/m3/quest-workflow-guard.md) - quest's environment guard parses YAML as this repository's does
20 changes: 20 additions & 0 deletions quest/m3/ffi-instance-rename.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [XS] Rename one instance

## Goal

A `rename` keyed by an instance's path, such as
`"catalog::Producer<moq_mux::catalog::hang::Extra>"`, renames that instance alone, as
`exclude` already takes an instance's path. Today `rename` takes only the generic item's
path, which renames every instance.

## Plan

Suggested by [#152](https://github.com/kixelated/rust2/pull/152) on 2026-10-27. No consumer
needs it yet: a clash between an instance and an unrelated item is fixed today by renaming
the unrelated item or the generic one. Start once a consumer's clash can't be fixed that
way.

- Prefer a naming rule that avoids the clash over a new config key, since every config key
a consumer needs is a gap; take this only if no rule does.

Public API: `ffi.toml`'s `rename` keys.
16 changes: 16 additions & 0 deletions quest/m3/quest-workflow-guard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# [S] Port the workflow guard to kixelated/quest

## Goal

kixelated/quest's `test/workflows.test.ts` parses workflows as YAML, as
[`.github/land.test.ts`](/.github/land.test.ts) does here, so an environment named through
an expression, a flow mapping, or another repository's reusable workflow can't slip past
its guard on the `land` environment.

## Plan

Found by [#137](https://github.com/kixelated/rust2/pull/137) on 2026-10-26: quest's guard
has the gaps this repository's closed. The work lands in kixelated/quest, through its own
review; this quest tracks it here and is deleted once it merges there.

Public API: none.
16 changes: 16 additions & 0 deletions quest/m3/ts-fmt-wrappers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# [S] Debug and Display of Arc and ranges

## Goal

rust2-ts formats `Arc<T>` as `T` formats with `Debug` and `Display`, and std's ranges with
`Debug`, byte for byte as std does, including format specs a range passes to its bounds.
Proven by differential tests against native Rust.

## Plan

Suggested by [#177](https://github.com/kixelated/rust2/pull/177) (`Arc`, refused for every
`T`) and [#179](https://github.com/kixelated/rust2/pull/179) (ranges) on 2026-10-27. rust2
aims to support all of std. A drained `RangeInclusive` prints `exhausted` in its `Debug`,
which [the range fold](/quest/m3/ts-range-fold.md) makes observable.

Public API: the translator's output.
16 changes: 16 additions & 0 deletions quest/m3/ts-fold-bool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# [S] Fold a match a bool decided

## Goal

rust2-ts drops the dead arms of a match that a `bool` already decided, as
[#175](https://github.com/kixelated/rust2/pull/175) does for a match an `if` or guard sits
in front of: `if matches!(s, Shape::Dot) { match s { .. } }`, and `==` of a crate enum's
derived `PartialEq`. Output only shrinks; the differential tests stay equal.

## Plan

Suggested by #175 on 2026-10-27: the `bool` joins two edges before the `if`, so folding it
means recording, in `decided.rs`'s dataflow, which variants a `bool` local holds `true`
for. Measure the size change on moq-net and the TS benchmark's bundles.

Public API: the translator's output.
20 changes: 20 additions & 0 deletions quest/m3/ts-harness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [S] Checks on the differential harnesses

## Goal

The differential harnesses can't silently test less than they claim: a test fails when the
task fixture's step list in Rust (`harness.rs`) and TypeScript (`tests/task.ts`) drift
apart, when a scripted case's literal op bytes stop picking the step or case it names, and
an audit of `lang`'s `refs` case shows which of the place lowering's branches it reaches.

## Plan

Planned on 2026-10-28. Both lists are matched by order today, so a step added to one side
only shifts every op after it, and a script written as bytes rather than by name keeps
running whatever its bytes now pick.

- Compare the lists by name in a test, rather than generating one from the other.
- The `refs` audit adds cases for the branches it misses, such as #148's review asked:
reborrows through a reassigned reference, and indexed borrows.

Public API: none.
Loading