From 8da4eb80d18f77542de88e50a24c7fe506f16433 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 13 Nov 2026 17:01:31 -0800 Subject: [PATCH 1/2] chore(quest): claim quest/m0/ffi-moq-gate.md Quest-Claim: 2c34cd962363b39b From fd1b828221dbdba07c00f8548b3d0a182c181861 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 13 Nov 2026 17:30:58 -0800 Subject: [PATCH 2/2] wip --- ffi/README.md | 1 + ffi/justfile | 23 +++++++++++++++++++++-- quest/m0/ffi-moq-gate.md | 24 ------------------------ quest/m0/ffi-test-builds.md | 5 ++++- sh/dispatch.sh | 6 +++++- 5 files changed, 31 insertions(+), 28 deletions(-) delete mode 100644 quest/m0/ffi-moq-gate.md diff --git a/ffi/README.md b/ffi/README.md index 8e37471a2..a56985326 100644 --- a/ffi/README.md +++ b/ffi/README.md @@ -996,6 +996,7 @@ rather than in the crate. ```bash just ffi test # export the fixtures, build them, and drive api from C, C++, Kotlin, Python, Swift, Go, and Dart just ffi moq # export moq's crates at the pinned revision, build them, and run moq/moq.c, moq/moq.cpp, moq/moq.kt, moq/moq.py, moq/moq.swift, moq/moq.go, and moq/moq.dart +just ffi moq-c # the same export, built in debug, running only moq/moq.c: `just ci`'s check on moq just ffi moq-cpp # the same export, running only moq/moq.cpp just ffi moq-swift # the same export, running only moq/moq.swift just ffi census # census each into target/census diff --git a/ffi/justfile b/ffi/justfile index 66c030afe..8b2437b4e 100644 --- a/ffi/justfile +++ b/ffi/justfile @@ -274,13 +274,32 @@ dart-program dir main: "$sdk/bin/dartaotruntime" "$sdk/bin/snapshots/gen_kernel_aot.dart.snapshot" --platform "$sdk/lib/_internal/vm_platform_strong.dill" \ --packages "$dir/.dart_tool/package_config.json" --native-assets "$dir/native_assets.yaml" -o "$dir/main.dill" "$dir/main.dart" +# Export moq's crates' C ABI as `just ffi moq` does, build it in debug, and run only moq/moq.c against it: `just ci`'s check that the export still serves moq, from the pinned moq revision or a checkout. +moq-c checkout="": (moq-write checkout) + #!/usr/bin/env bash + set -euo pipefail + out=target/export/moq + # The lint moq-export denies, and the native libraries; only the static library, which + # the C program links, with the glue of every language but Python's, whose symbols + # would leave the link undefined. + export RUSTFLAGS="-D recursion_depth_exceeding_limit --print=native-static-libs" + cargo rustc --locked --quiet --manifest-path "$out/Cargo.toml" --lib --crate-type staticlib --features kotlin,dart 2>&1 | tee target/moq-c-build.log + sed -n 's/^note: native-static-libs: //p' target/moq-c-build.log > target/moq-c-native + read -ra native < target/moq-c-native + cc -std=c11 -pedantic -Wall -Wextra -Werror -I "$out/include" moq/moq.c "$out/target/debug/libmoq.a" "${native[@]}" -o target/moq-c-test + target/moq-c-test + +# Export moq's crates' C ABI into target/export/moq, unbuilt. +[private] +moq-write checkout="": (standin checkout) + cargo run --locked --quiet -- --config moq/ffi.toml --manifest-path target/moq-ffi/Cargo.toml --out target/export/moq + # Export moq's crates' C ABI into target/export/moq and build it, with the libraries a program linking it needs besides in target/moq-native. [private] -moq-export checkout="": (standin checkout) +moq-export checkout="": (moq-write checkout) #!/usr/bin/env bash set -euo pipefail out=target/export/moq - cargo run --locked --quiet -- --config moq/ffi.toml --manifest-path target/moq-ffi/Cargo.toml --out "$out" # A later nightly makes this future-compat lint a hard error; fail on it in moq's crates # and the glue now, while the pin can still move. rustc prints the native libraries. export RUSTFLAGS="-D recursion_depth_exceeding_limit --print=native-static-libs" diff --git a/quest/m0/ffi-moq-gate.md b/quest/m0/ffi-moq-gate.md deleted file mode 100644 index 3b2e6f55c..000000000 --- a/quest/m0/ffi-moq-gate.md +++ /dev/null @@ -1,24 +0,0 @@ -# [M] The moq export gates exporter merges - -## Goal - -A change to [rust2-ffi](/ffi/README.md) cannot merge while it breaks moq's export: the -`ffi` module of `just ci` runs a cut-down `just ffi moq`, as the `ts` module already runs -`just ts moq` before its tests (`sh/dispatch.sh`'s `test_ts`). The PR says how long it -adds to the gate, warm and cold. - -## Plan - -Decided with the maintainer on 2026-11-12, in the quest audit: ✅ in m0. Today the -exporter's check on its first consumer runs only nightly, where it was red on 2026-11-12, -while the experiment's runs on every merge. - -- The nightly's full export step takes about 13m40s, too slow for the gate. Find the - cheapest step that still fails on a real break. Recommended: export the stand-in facade - to C, `cargo check` the generated crate, and compile the header and `ffi/moq/moq.c` - against it without linking the library. The other languages' `ffi/moq/moq.*` stay - nightly. -- Measure on the queue runner before choosing, and report the gate's time with and - without it. - -Public API: none. diff --git a/quest/m0/ffi-test-builds.md b/quest/m0/ffi-test-builds.md index 60d66b559..3b875b078 100644 --- a/quest/m0/ffi-test-builds.md +++ b/quest/m0/ffi-test-builds.md @@ -66,6 +66,10 @@ Expect to merge in `fixtures.rs` and the test programs with the same cases. A content key includes their edits to the test sources, so neither makes a cached program stale. +`just ci`'s `just ffi moq-c` (moq's export, built in debug, and `moq/moq.c` run against +it) should take the same skip: on a warm gate it spends 7-44s rebuilding the glue the +export rewrites and about 10s linking it. + Out of scope: warming the queue's or a land fixer's `target`, which kixel-ai/dotfiles owns; a cold run, which builds everything once as today. @@ -73,5 +77,4 @@ Public API: none; the exporter may stop rewriting unchanged files. ## Related -- [The moq export gates exporter merges](/quest/m0/ffi-moq-gate.md) - adds moq's export and C test to the gate, which the same skip should cover - [Failed checks raise](/quest/m1/ffi-export/checks-raise.md) - rewrites the same test programs and fixture cases diff --git a/sh/dispatch.sh b/sh/dispatch.sh index 55bb6f2b7..e65817470 100755 --- a/sh/dispatch.sh +++ b/sh/dispatch.sh @@ -111,7 +111,11 @@ test_lint() { python3 -I .github/crabx/test_pipeline.py; } test_sh() { python3 -I sh/dispatch.test.py; } test_crabx() { just crabx test; } test_driver() { just driver test; } -test_ffi() { just ffi test; } +# moq's export at the pin, cut down to C, before the slower test build. +test_ffi() { + just ffi moq-c + just ffi test +} test_go() { just go test; } # moq-net's translation at the pin, its first consumer, before the slower test build. test_ts() {