From d467e0677e2b487a7932b7b29af3603214a9ca36 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 00:29:20 -0800 Subject: [PATCH 01/19] chore(quest): claim quest/m2/registry.md Quest-Claim: ecf7c9e0a12360fc From 554f545257b2eedfe854ccfa9f9ecd078e0129e4 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 00:38:41 -0800 Subject: [PATCH 02/19] feat(registry): spike fixture wheels and Swift binary packages --- bench/registry/README.md | 85 ++++++++++++++++ .../__pycache__/consume.cpython-314.pyc | Bin 0 -> 1227 bytes .../__pycache__/package.cpython-314.pyc | Bin 0 -> 6470 bytes bench/registry/build.sh | 16 +++ bench/registry/consume-swift.sh | 28 ++++++ bench/registry/consume.py | 15 +++ bench/registry/package.py | 95 ++++++++++++++++++ 7 files changed, 239 insertions(+) create mode 100644 bench/registry/README.md create mode 100644 bench/registry/__pycache__/consume.cpython-314.pyc create mode 100644 bench/registry/__pycache__/package.cpython-314.pyc create mode 100755 bench/registry/build.sh create mode 100755 bench/registry/consume-swift.sh create mode 100644 bench/registry/consume.py create mode 100644 bench/registry/package.py diff --git a/bench/registry/README.md b/bench/registry/README.md new file mode 100644 index 000000000..e635ca2fe --- /dev/null +++ b/bench/registry/README.md @@ -0,0 +1,85 @@ +# Registry packaging spike + +Recommendation: generate release templates for moq. A single configless publisher +cannot infer registry ownership from Cargo metadata. Shared package builders are +still useful. This spike publishes nothing and changes no binding semantics. + +`build.sh` exports the existing api fixture (including its existing exclusion file), +builds a CPython stable-ABI library, writes a wheel, and on macOS wraps a separate +C static library in an XCFramework with a Swift source package. The Swift wrapper +stays source so the consumer compiles it with its compiler; the Rust library is +binary. The XCFramework currently has only the build host's macOS slice. This is +not an iOS or universal distribution claim. + +Run from the repository root through `quest gate nix develop --command +bench/registry/build.sh`. Output is in `ffi/target/registry`. Install the wheel in a +fresh Python environment, then run `consume.py ` with that +environment's Python from outside the checkout. The consumer compares stdout +byte for byte with the fixture's native Rust transcript, then exercises futures, +ownership, integer values and calls. The wheel contains the generated module as +`api/__init__.py` and its library beside it, with a complete hashed RECORD. + +On macOS, unpack `Api.zip` beside a fresh consumer directory and run +`consume-swift.sh ` from there. The script uses SwiftPM to +resolve the package, runs the same transcript against Rust, then futures and +ownership checks. Swift 6.2 or newer and macOS 15 are required for the fixture's +executor APIs. BasicContainers is pinned to the exporter's swift-collections +revision. No registry credentials, signing keys or publishing permissions are used. + +## Scope and evidence + +The fixture is intentional: this measures packaging an existing export, not finding +an arbitrary facade in a workspace. Name, version and description come from its +Cargo manifest; the library's distinct `api` name is respected. The fixture is +`publish = false`; this spike does not upload it anywhere. Existing binding +fixtures own semantic differential tests; these consumers check that packaging +preserves the generated API and runtime loading. + +The native wheel tag only claims the build host's platform. A release needs +manylinux builds and auditwheel repair on Linux, delocate on macOS, and DLL +inspection on Windows, including transitive native dependencies. Stable ABI alone +does not establish OS portability. The generated extension requests abi3-py311, +so the wheel uses cp311-abi3 and Requires-Python >=3.11. + +macOS execution is unverified: this session's host is Linux and `ssh kixtop uname +-a` timed out. Do not delete moq's release workflows on this evidence. + +## What each registry still needs + +| Destination | Package work | Information Cargo cannot establish | +| --- | --- | --- | +| PyPI | Wheel matrix, dependency repair, name/version normalization, license metadata, sdist policy | Ownership of the distribution name and trusted-publisher registration | +| SwiftPM | macOS/iOS device/simulator slices, merged exports for cfg differences, minimum OS versions, checksummed hosted zip and release Package.swift | Artifact hosting URL and repository/tag policy; code signing identity if signing is required | +| Maven Central | AAR with classes.jar, JNI libraries per Android ABI, generated R8 rules, POM, sources/javadoc artifacts and signatures | Verified groupId namespace, publisher authorization and signing key | +| npm | A Node binding backend (not currently generated), platform packages and JS loader, TypeScript declarations | Scope/name ownership and trusted-publisher registration | +| NuGet | A C# binding backend (not currently generated), managed assembly plus RID-specific native assets | Package ID ownership, credentials and desired managed target frameworks | +| pub.dev | Generated Dart library plus native asset hooks and platform archives, pubspec and license files | Publisher authorization and the distribution/download host | +| Go | Generated cgo packages, module-relative imports and native library delivery for supported targets | Canonical module path, repository/subdirectory and release tags (including major-version suffixes) | + +Cargo's repository URL can suggest a Go module path or Maven namespace. It cannot +prove either is the publisher's intended existing identity. Cargo package names +also need not equal existing PyPI names or npm scopes. A manifest's license and +repository fields are optional; absence must produce a packaging error where the +registry requires them. Authentication setup is an external platform boundary, +not something a workflow can manufacture from a crate. + +For moq, the existing release-py-ffi, release-swift-ffi and release-swift-lib +workflows additionally encode their current names, hosting and platform policy. +Replacing those workflows requires preserving those contracts and testing moq, +not just this fixture. The quest's go condition is therefore not established; +templates are the recommended no-go outcome even if both artifact consumers pass. + +## Prior art and primary sources + +- [BoltFFI](https://github.com/boltffi/boltffi): annotation-based generation and local packaging are adjacent to this problem; do not treat it as evidence of registry ownership automation. +- [maturin](https://www.maturin.rs/distribution.html): Python distribution tooling can own wheel repair/build concerns but does not solve the other registries. +- [Wheel format](https://packaging.python.org/en/latest/specifications/binary-distribution-format/): tags, metadata and RECORD. +- [Apple binary packages](https://developer.apple.com/documentation/Xcode/distributing-binary-frameworks-as-swift-packages): XCFramework binary targets and hosted artifact checksums. +- [Maven Central requirements](https://central.sonatype.org/publish/requirements/) and [namespace registration](https://central.sonatype.org/register/namespace/). +- [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/) and [scopes](https://docs.npmjs.com/about-scopes/). +- [NuGet native assets](https://learn.microsoft.com/nuget/create-packages/native-files-in-net-packages). +- [Dart hooks](https://dart.dev/tools/hooks) and [publishing](https://dart.dev/tools/pub/publishing). +- [Go module publishing](https://go.dev/doc/modules/developing). + +Registry requirements checked on 2026-11-13. The table is a design assessment, +not a claim that any of those unimplemented publishers was exercised. diff --git a/bench/registry/__pycache__/consume.cpython-314.pyc b/bench/registry/__pycache__/consume.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aeb2bcad38fea8e9fe803df840169f2fb010c320 GIT binary patch literal 1227 zcmZWo&u`pB6dtd4?Om_!4Ji^^ni5B)DsIzMpokv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 000000000..046d0fb2b --- /dev/null +++ b/bench/registry/build.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Export once, build packages, and retain the native oracle with the consumer scripts. +set -euo pipefail +export PATH="${RUST2_TS_TOOLCHAIN:?run in nix develop}/bin:$PATH" +cd "$(dirname "$0")/../.." +just ffi run --config fixtures/api/ffi.toml --manifest-path fixtures/api/Cargo.toml --out target/registry-export -- --features doubled +cargo build --locked --release --manifest-path ffi/target/registry-export/Cargo.toml --features python +python3 bench/registry/package.py wheel +cargo run --quiet --locked --manifest-path ffi/Cargo.toml --package api-fixture --example transcript --features doubled >ffi/target/registry/native.txt +cp ffi/tests/api.py ffi/target/registry/consumer.py +if [[ $(uname) == Darwin ]]; then + # Build separately so Python symbols cannot enter the Swift library. + cargo build --locked --release --manifest-path ffi/target/registry-export/Cargo.toml --no-default-features + python3 bench/registry/package.py swift + cp ffi/tests/api.swift ffi/target/registry/consumer.swift +fi diff --git a/bench/registry/consume-swift.sh b/bench/registry/consume-swift.sh new file mode 100755 index 000000000..fad99042c --- /dev/null +++ b/bench/registry/consume-swift.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Build a new executable package whose only library dependency is the artifact. +set -euo pipefail +artifacts=$(cd "$1" && pwd) +mkdir consumer +cd consumer +mkdir -p Sources/Check +cp "$artifacts/consumer.swift" Sources/Check/check.swift +cat >Package.swift <<'SWIFT' +// swift-tools-version: 6.2 +import PackageDescription +let package = Package( + name: "Check", platforms: [.macOS(.v15)], + dependencies: [ + .package(path: "../Api"), + .package(url: "https://github.com/apple/swift-collections", revision: "f96b909e1a9e469620bc5037c1e24e00153f376f") + ], + targets: [.executableTarget(name: "Check", dependencies: [ + .product(name: "Api", package: "Api"), + .product(name: "BasicContainers", package: "swift-collections") + ])] +) +SWIFT +swift build -c release +.build/release/Check >actual.txt +cmp "$artifacts/native.txt" actual.txt +.build/release/Check futures +.build/release/Check owned diff --git a/bench/registry/consume.py b/bench/registry/consume.py new file mode 100644 index 000000000..308355428 --- /dev/null +++ b/bench/registry/consume.py @@ -0,0 +1,15 @@ +"""Run an installed wheel from an isolated consumer directory against native Rust.""" +from pathlib import Path +import subprocess +import sys + +artifacts = Path(sys.argv[1]).resolve() +python = Path(sys.executable) +for case in [None, "futures", "owned", "values", "calls"]: + command = [str(python), "-I", "-X", "dev", "-W", "error", str(artifacts / "consumer.py")] + if case: + command.append(case) + output = subprocess.run(command, check=True, capture_output=True) + if case is None and output.stdout != (artifacts / "native.txt").read_bytes(): + raise SystemExit("installed wheel differs from native Rust") +print("installed wheel: transcript matches Rust; futures, ownership, values and calls pass") diff --git a/bench/registry/package.py b/bench/registry/package.py new file mode 100644 index 000000000..ceacf9216 --- /dev/null +++ b/bench/registry/package.py @@ -0,0 +1,95 @@ +"""Package the api fixture's export without changing the Rust or generated API.""" + +import base64 +import csv +import hashlib +import io +from pathlib import Path +import shutil +import subprocess +import sys +import sysconfig +import tomllib +import zipfile + +ROOT = Path(__file__).resolve().parents[2] +EXPORT = ROOT / "ffi/target/registry-export" +OUT = ROOT / "ffi/target/registry" +COLLECTIONS = "f96b909e1a9e469620bc5037c1e24e00153f376f" + + +def run(*args, **kwargs): + """Fail the package build when any tool fails.""" + return subprocess.run(args, check=True, **kwargs) + + +def wheel(): + """Write a native wheel with hashes for every installed file.""" + manifest = tomllib.loads((ROOT / "ffi/fixtures/api/Cargo.toml").read_text()) + version = manifest["package"]["version"] + # Native tags deliberately make no manylinux or older macOS compatibility claim. + platform = sysconfig.get_platform().replace("-", "_").replace(".", "_") + tag = f"cp311-abi3-{platform}" + info = f"api_fixture-{version}.dist-info" + library = {"linux": "libapi.so", "darwin": "libapi.dylib"}[sys.platform] + files = { + "api/__init__.py": (EXPORT / "python/api.py").read_bytes(), + f"api/{library}": (EXPORT / "target/release" / library).read_bytes(), + f"{info}/METADATA": ( + f"Metadata-Version: 2.1\nName: api-fixture\nVersion: {version}\n" + f"Summary: {manifest['package']['description']}\nRequires-Python: >=3.11\n\n" + ).encode(), + f"{info}/WHEEL": ( + f"Wheel-Version: 1.0\nGenerator: rust2-registry-spike\n" + f"Root-Is-Purelib: false\nTag: {tag}\n" + ).encode(), + } + record = io.StringIO(newline="") + writer = csv.writer(record) + for name, data in files.items(): + digest = base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b"=").decode() + writer.writerow([name, f"sha256={digest}", len(data)]) + writer.writerow([f"{info}/RECORD", "", ""]) + files[f"{info}/RECORD"] = record.getvalue().encode() + with zipfile.ZipFile(OUT / f"api_fixture-{version}-{tag}.whl", "w", zipfile.ZIP_DEFLATED) as archive: + for name, data in files.items(): + archive.writestr(name, data) + + +def swift(): + """Wrap the host's C static library in an XCFramework and Swift source package.""" + if sys.platform != "darwin": + raise SystemExit("XCFramework packaging requires Apple's xcodebuild on macOS") + package = OUT / "Api" + package.mkdir() + headers = OUT / "headers" + headers.mkdir() + shutil.copy(EXPORT / "include/api.h", headers) + shutil.copy(EXPORT / "swift/api_atomics.h", headers) + modulemap = (EXPORT / "swift/module.modulemap").read_text().replace("../include/api.h", "api.h") + (headers / "module.modulemap").write_text(modulemap) + run("xcodebuild", "-create-xcframework", "-library", str(EXPORT / "target/release/libapi.a"), + "-headers", str(headers), "-output", str(package / "ApiFFI.xcframework")) + sources = package / "Sources/Api" + sources.mkdir(parents=True) + shutil.copy(EXPORT / "swift/api.swift", sources) + (package / "Package.swift").write_text('''// swift-tools-version: 6.2 +import PackageDescription +let package = Package( + name: "Api", + platforms: [.macOS(.v15)], + products: [.library(name: "Api", targets: ["Api"])], + dependencies: [.package(url: "https://github.com/apple/swift-collections", revision: "''' + COLLECTIONS + '''")], + targets: [ + .binaryTarget(name: "ApiFFI", path: "ApiFFI.xcframework"), + .target(name: "Api", dependencies: ["ApiFFI", .product(name: "BasicContainers", package: "swift-collections")]) + ] +) +''') + # Consumers receive only the package, script and native reference transcript. + shutil.make_archive(str(OUT / "Api"), "zip", OUT, "Api") + + +if __name__ == "__main__": + OUT.mkdir(parents=True, exist_ok=True) + {"wheel": wheel, "swift": swift}[sys.argv[1]]() From 990407d8452329b287b63000e27d5d7b9616c360 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 00:38:46 -0800 Subject: [PATCH 03/19] chore(registry): remove Python bytecode artifacts --- .../registry/__pycache__/consume.cpython-314.pyc | Bin 1227 -> 0 bytes .../registry/__pycache__/package.cpython-314.pyc | Bin 6470 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 bench/registry/__pycache__/consume.cpython-314.pyc delete mode 100644 bench/registry/__pycache__/package.cpython-314.pyc diff --git a/bench/registry/__pycache__/consume.cpython-314.pyc b/bench/registry/__pycache__/consume.cpython-314.pyc deleted file mode 100644 index aeb2bcad38fea8e9fe803df840169f2fb010c320..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1227 zcmZWo&u`pB6dtd4?Om_!4Ji^^ni5B)DsIzMpokv@^-z+Q2q{=jQIJ|^HEYlAT6k@1 zX1vL6IV=(fS`G;ZL^#1Q+~p%NhyZ~97H_}Zd}sB^KiobX<+1hbHvxb?umJ^Yz!sK-PjWOjo!Yr2k&44LPxDT0 z1~_?3IgCFv)`Z#D4>w?*v!%n*M(fdee!QXbm~GB!FFY01_nz?H87po&xG+NJEo z7VW%Uuq9g_`enN~o7KW8GSr+*RYy597Vstkm;#P!op@Q%QL>n6;E2}L%LuNn+9m!d z@1@tt2dy{?;`S8ybOivXVi`mCbCV<6<)fKdr=B|=Zn7JBe;t74i0>xno16i*nq}1z zO5hFP9OFJM^G);aoC0R0_nDo91`G{9Boqb#@{IKsLV?l1QG4hoQ2;4-yHQAzHo}JI zW8~5ZcMaHtX_yg0>UWS~Cxp(K0?S*Fww8Oj^Gp2wf{7mLaATDf5XKSil{2QfxO>ga zv4Yz|?w3q=VN4T@YEeStg!YsX>m1#ny|-S>&hr}$gvlt&Bl5kK7mybXieX4x?8nq- zL&~+tFwqZI1)ybG$)JAxS;Pk&6gnBIy#Ahq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I93gAGNq60yv%8<|W}O^eTpp^(ZeO9GaH+xI#pdaEo;w(W6ULfkrfx3PM#3t=??` zOqK-2GO;i>H#M;|yKrw&v2L*IT)2V?J%oU=vM`O9&DC#7A;@RV#!g z=)4a9;ylDCfJKse^7y02d)vpP`<1;p+wwu)9?Y78uk5b9sUNIoZkGtlllhP4zqf#T zW`B^Z?;)rscmM3}kBs~7g0uIq=a?9LrFCUndm)#C;R|CRmRzO7)tSk-d>LT3J$aM$V8 zS8(md8-`R})as0K_n8b?l zY1y6m^Y0ePjvU#MC*4J|Cr9=i;svrVLzK+6th2vh?#~!YMk;ITE*QHr`jY)x#`2|6 zhmU+ob>f~cZ{cqI#_LHOBdojfvA(55kWXemn%#>YEM;boi9WQ7+}{0tE=ycESp543 YfBWE&{ksoe5(6)ZA%NUOt7^{w1K16hy8r+H From 55abf273663734ee8377f3d395710cf6fc312ac0 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 00:51:47 -0800 Subject: [PATCH 04/19] feat(registry): add reusable artifact and consumer workflow --- .github/workflows/registry.yml | 76 ++++++++++++++++++++++++++++++++++ bench/registry/README.md | 15 +++++++ quest/m2/registry.md | 13 ++++++ 3 files changed, 104 insertions(+) create mode 100644 .github/workflows/registry.yml diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml new file mode 100644 index 000000000..ca32a788d --- /dev/null +++ b/.github/workflows/registry.yml @@ -0,0 +1,76 @@ +name: Registry packaging spike + +on: + workflow_call: + workflow_dispatch: + +permissions: + contents: read + +jobs: + package: + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-24.04-arm + private: '["self-hosted", "Linux", "ARM64"]' + - runner: macos-26 + private: '["self-hosted", "macOS", "ARM64"]' + runs-on: ${{ fromJSON(github.event.repository.private && matrix.private || format('["{0}"]', matrix.runner)) }} + steps: + # Fixed spike input: consumers need only a workflow call, no source or settings. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: kixel-ai/rust2 + ref: 990407d8452329b287b63000e27d5d7b9616c360 + persist-credentials: false + - uses: ./.github/actions/nix + - name: Build fixture packages + run: nix develop --command bench/registry/build.sh + - name: Include standalone verifiers + run: | + cp bench/registry/consume.py ffi/target/registry/verify.py + cp bench/registry/consume-swift.sh ffi/target/registry/verify-swift.sh + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: registry-${{ matrix.runner }} + if-no-files-found: error + path: | + ffi/target/registry/*.whl + ffi/target/registry/*.zip + ffi/target/registry/*.py + ffi/target/registry/*.swift + ffi/target/registry/*.sh + ffi/target/registry/native.txt + + consumer: + needs: package + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-24.04-arm + private: '["self-hosted", "Linux", "ARM64"]' + - runner: macos-26 + private: '["self-hosted", "macOS", "ARM64"]' + runs-on: ${{ fromJSON(github.event.repository.private && matrix.private || format('["{0}"]', matrix.runner)) }} + steps: + # No checkout, Rust toolchain, exporter, source paths or PYTHONPATH. + - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5 + with: + name: registry-${{ matrix.runner }} + path: artifacts + - name: Install and run wheel + run: | + python3 -m venv env + env/bin/python -m pip install --no-index --no-deps artifacts/*.whl + mkdir clean + cd clean + ../env/bin/python -I ../artifacts/verify.py ../artifacts + - name: Install and run Swift package + if: runner.os == 'macOS' + run: | + cd artifacts + unzip Api.zip + bash verify-swift.sh . diff --git a/bench/registry/README.md b/bench/registry/README.md index e635ca2fe..228230403 100644 --- a/bench/registry/README.md +++ b/bench/registry/README.md @@ -83,3 +83,18 @@ templates are the recommended no-go outcome even if both artifact consumers pass Registry requirements checked on 2026-11-13. The table is a design assessment, not a claim that any of those unimplemented publishers was exercised. + +## Reusable workflow + +`.github/workflows/registry.yml` is callable with no inputs or secrets. It builds +this fixed fixture on Linux arm64 and macOS arm64 and passes only artifacts to +fresh consumer jobs. A caller needs just a job with +`uses: kixel-ai/rust2/.github/workflows/registry.yml@`. +The workflow pins the fixture, exporter and packaging scripts together to an +immutable rust2 revision, independently of the caller's checkout. It is a spike +runner, not a publisher of the caller's crate. Private callers select self-hosted +runners with OS/architecture labels. Public callers use hosted runners. + +These two targets overlap crabx's planned matrix. The pipeline quest has not +landed a shared matrix to reuse. Extending this to stock crates requires facade +discovery and packaging of moq's existing identity; neither is claimed here. diff --git a/quest/m2/registry.md b/quest/m2/registry.md index 403018ff7..b8df068a4 100644 --- a/quest/m2/registry.md +++ b/quest/m2/registry.md @@ -11,6 +11,19 @@ fixture's script. It says what the full version would take for the other registr ## Plan +Implementation in progress: [packaging spike](/bench/registry/README.md) and +`.github/workflows/registry.yml` build the api fixture into native wheels and a +host-only macOS XCFramework with a Swift source package. Keep this quest until +the installed-wheel differential consumer and the macOS SwiftPM consumer have +both run successfully. The Linux host cannot execute xcodebuild, and kixtop was +unreachable on 2026-11-13. The workflow has not been executed in this session. +The report recommends templates because registry namespace ownership cannot be +inferred from Cargo metadata; it does not claim moq's workflows can be deleted. + +Remaining: exercise the reusable call and both clean artifact consumers, record +the actual results, then finish the report and delete this quest. Do not publish +the fixture or infer successful packaging from lint alone. + Decided with the maintainer on 2026-11-12, in the quest audit: ✅ a spike, in m2, with moq as its consumer. moq carries about 13 `release-*-ffi` and `release-*-lib` [workflows](https://github.com/moq-dev/moq/tree/main/.github/workflows) to do this by From 2a9e89ef93e419c1c14dccddb75596ad76de435c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 01:04:34 -0800 Subject: [PATCH 05/19] fix(registry): retain Cargo shim and use conservative macOS tags --- bench/registry/build.sh | 2 +- bench/registry/package.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bench/registry/build.sh b/bench/registry/build.sh index 046d0fb2b..d1bfb06bf 100755 --- a/bench/registry/build.sh +++ b/bench/registry/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Export once, build packages, and retain the native oracle with the consumer scripts. set -euo pipefail -export PATH="${RUST2_TS_TOOLCHAIN:?run in nix develop}/bin:$PATH" +export PATH="${RUST2_CARGO_SHIM:+$RUST2_CARGO_SHIM:}${RUST2_TS_TOOLCHAIN:?run in nix develop}/bin:$PATH" cd "$(dirname "$0")/../.." just ffi run --config fixtures/api/ffi.toml --manifest-path fixtures/api/Cargo.toml --out target/registry-export -- --features doubled cargo build --locked --release --manifest-path ffi/target/registry-export/Cargo.toml --features python diff --git a/bench/registry/package.py b/bench/registry/package.py index ceacf9216..fda4a270c 100644 --- a/bench/registry/package.py +++ b/bench/registry/package.py @@ -4,6 +4,7 @@ import csv import hashlib import io +import platform as host_platform from pathlib import Path import shutil import subprocess @@ -29,6 +30,9 @@ def wheel(): version = manifest["package"]["version"] # Native tags deliberately make no manylinux or older macOS compatibility claim. platform = sysconfig.get_platform().replace("-", "_").replace(".", "_") + if sys.platform == "darwin": + major, minor, *_ = host_platform.mac_ver()[0].split(".") + platform = f"macosx_{major}_{minor}_{host_platform.machine()}" tag = f"cp311-abi3-{platform}" info = f"api_fixture-{version}.dist-info" library = {"linux": "libapi.so", "darwin": "libapi.dylib"}[sys.platform] From 4e0e24d32780ccd3f414b475b81b0c16635693b6 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 01:04:48 -0800 Subject: [PATCH 06/19] chore(registry): pin workflow to corrected package builders --- .github/workflows/registry.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index ca32a788d..e71d514f1 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: kixel-ai/rust2 - ref: 990407d8452329b287b63000e27d5d7b9616c360 + ref: 2a9e89ef93e419c1c14dccddb75596ad76de435c persist-credentials: false - uses: ./.github/actions/nix - name: Build fixture packages From 818ce3bf9fc0b062b2e2817e43ea7c144cbf24db Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 01:24:47 -0800 Subject: [PATCH 07/19] fix(registry): package the fixture complete target API and record Linux proof --- bench/registry/README.md | 14 ++++++++++++++ bench/registry/build.sh | 3 ++- bench/registry/consume.py | 8 ++++++-- quest/m2/registry.md | 7 ++++--- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/bench/registry/README.md b/bench/registry/README.md index 228230403..50210ead4 100644 --- a/bench/registry/README.md +++ b/bench/registry/README.md @@ -41,6 +41,20 @@ inspection on Windows, including transitive native dependencies. Stable ABI alon does not establish OS portability. The generated extension requests abi3-py311, so the wheel uses cp311-abi3 and Requires-Python >=3.11. +Linux x86_64 execution passed on 2026-11-13 with CPython 3.14.10: the built +`api_fixture-0.0.0-cp311-abi3-linux_x86_64.whl` installed into a fresh uv-created +virtual environment with no index or dependencies. Running from a clean directory +with `-I` matched the native Rust transcript byte for byte and passed futures, +ownership, values and calls. A separate ZIP inspection checked RECORD coverage, +file sizes and SHA-256 hashes. The full `quest gate nix develop --command just ci` +passed, including the exporter's existing Python and Swift differential tests. + +The export includes host and wasm32 API descriptions, as the existing fixture +suite does: its values test checks that wasm32-only calls are refused on the host. +Only the host native library is packaged. Initial export attempts exposed missing +CACHEDIR.TAG markers in imported local build artifacts; restoring those markers +allowed the unchanged exporter to run. No cache tools or checks were disabled. + macOS execution is unverified: this session's host is Linux and `ssh kixtop uname -a` timed out. Do not delete moq's release workflows on this evidence. diff --git a/bench/registry/build.sh b/bench/registry/build.sh index d1bfb06bf..35e2c9109 100755 --- a/bench/registry/build.sh +++ b/bench/registry/build.sh @@ -3,7 +3,8 @@ set -euo pipefail export PATH="${RUST2_CARGO_SHIM:+$RUST2_CARGO_SHIM:}${RUST2_TS_TOOLCHAIN:?run in nix develop}/bin:$PATH" cd "$(dirname "$0")/../.." -just ffi run --config fixtures/api/ffi.toml --manifest-path fixtures/api/Cargo.toml --out target/registry-export -- --features doubled +host=$(rustc -vV | sed -n 's/^host: //p') +just ffi run --target "$host" --target wasm32-unknown-unknown --config fixtures/api/ffi.toml --manifest-path fixtures/api/Cargo.toml --out target/registry-export -- --features doubled cargo build --locked --release --manifest-path ffi/target/registry-export/Cargo.toml --features python python3 bench/registry/package.py wheel cargo run --quiet --locked --manifest-path ffi/Cargo.toml --package api-fixture --example transcript --features doubled >ffi/target/registry/native.txt diff --git a/bench/registry/consume.py b/bench/registry/consume.py index 308355428..db359e3a4 100644 --- a/bench/registry/consume.py +++ b/bench/registry/consume.py @@ -1,15 +1,19 @@ """Run an installed wheel from an isolated consumer directory against native Rust.""" from pathlib import Path +import os import subprocess import sys artifacts = Path(sys.argv[1]).resolve() -python = Path(sys.executable) +python = Path(os.path.abspath(sys.executable)) for case in [None, "futures", "owned", "values", "calls"]: command = [str(python), "-I", "-X", "dev", "-W", "error", str(artifacts / "consumer.py")] if case: command.append(case) - output = subprocess.run(command, check=True, capture_output=True) + output = subprocess.run(command, capture_output=True) + if output.returncode: + sys.stderr.buffer.write(output.stderr) + raise SystemExit(output.returncode) if case is None and output.stdout != (artifacts / "native.txt").read_bytes(): raise SystemExit("installed wheel differs from native Rust") print("installed wheel: transcript matches Rust; futures, ownership, values and calls pass") diff --git a/quest/m2/registry.md b/quest/m2/registry.md index b8df068a4..2d8502c1c 100644 --- a/quest/m2/registry.md +++ b/quest/m2/registry.md @@ -14,13 +14,14 @@ fixture's script. It says what the full version would take for the other registr Implementation in progress: [packaging spike](/bench/registry/README.md) and `.github/workflows/registry.yml` build the api fixture into native wheels and a host-only macOS XCFramework with a Swift source package. Keep this quest until -the installed-wheel differential consumer and the macOS SwiftPM consumer have -both run successfully. The Linux host cannot execute xcodebuild, and kixtop was +the macOS SwiftPM consumer has run successfully. The Linux x86_64 wheel +consumer passed on CPython 3.14.10, including the native transcript and futures, +ownership, values and calls. The Linux host cannot execute xcodebuild, and kixtop was unreachable on 2026-11-13. The workflow has not been executed in this session. The report recommends templates because registry namespace ownership cannot be inferred from Cargo metadata; it does not claim moq's workflows can be deleted. -Remaining: exercise the reusable call and both clean artifact consumers, record +Remaining: exercise the reusable call and macOS clean artifact consumer, record the actual results, then finish the report and delete this quest. Do not publish the fixture or infer successful packaging from lint alone. From 9c078c01b906f7cd8a4062bc21a684315c0a6caa Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 01:24:57 -0800 Subject: [PATCH 08/19] chore(registry): pin workflow to validated fixture export --- .github/workflows/registry.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index e71d514f1..513281204 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: kixel-ai/rust2 - ref: 2a9e89ef93e419c1c14dccddb75596ad76de435c + ref: 818ce3bf9fc0b062b2e2817e43ea7c144cbf24db persist-credentials: false - uses: ./.github/actions/nix - name: Build fixture packages From 78592ce4f145a8fe64f584aa9e4fbb3950aecafb Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 01:34:15 -0800 Subject: [PATCH 09/19] fix(registry): address platform packaging and consumer review findings --- .github/workflows/nightly.yml | 4 +++ .github/workflows/registry.yml | 7 ++++- bench/registry/README.md | 13 ++++++++- bench/registry/build.sh | 1 + bench/registry/consume-swift.sh | 18 ++++++++----- bench/registry/package.py | 47 +++++++++++++++++++++++++++++---- 6 files changed, 77 insertions(+), 13 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 8d79a734f..20fa65f83 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -17,6 +17,10 @@ concurrency: cancel-in-progress: true jobs: + registry-spike: + name: Registry package consumers + uses: ./.github/workflows/registry.yml + # The full check over every module, catching what a merge group's diff-scoped # `just ci` let into main. gate: diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index 513281204..3c0ff2af6 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -55,12 +55,17 @@ jobs: - runner: macos-26 private: '["self-hosted", "macOS", "ARM64"]' runs-on: ${{ fromJSON(github.event.repository.private && matrix.private || format('["{0}"]', matrix.runner)) }} + env: + SPIKE_ROOT: ${{ github.workspace }}/.tmp/registry-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.runner }} + defaults: + run: + working-directory: ${{ env.SPIKE_ROOT }} steps: # No checkout, Rust toolchain, exporter, source paths or PYTHONPATH. - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5 with: name: registry-${{ matrix.runner }} - path: artifacts + path: ${{ env.SPIKE_ROOT }}/artifacts - name: Install and run wheel run: | python3 -m venv env diff --git a/bench/registry/README.md b/bench/registry/README.md index 50210ead4..5511c3fc9 100644 --- a/bench/registry/README.md +++ b/bench/registry/README.md @@ -35,7 +35,11 @@ Cargo manifest; the library's distinct `api` name is respected. The fixture is fixtures own semantic differential tests; these consumers check that packaging preserves the generated API and runtime loading. -The native wheel tag only claims the build host's platform. A release needs +The native wheel tag only claims the build host's platform. Linux packaging removes +RUNPATH and checks that the only dependencies are glibc, its loader and libgcc_s, +with no symbol newer than Ubuntu 24.04's glibc 2.39. Anything else fails packaging. +This is checked on each actual architecture; it is not a manylinux claim. macOS +uses a major_0 tag (the form pip accepts on macOS 11+) and the host architecture. A release needs manylinux builds and auditwheel repair on Linux, delocate on macOS, and DLL inspection on Windows, including transitive native dependencies. Stable ABI alone does not establish OS portability. The generated extension requests abi3-py311, @@ -95,6 +99,13 @@ templates are the recommended no-go outcome even if both artifact consumers pass - [Dart hooks](https://dart.dev/tools/hooks) and [publishing](https://dart.dev/tools/pub/publishing). - [Go module publishing](https://go.dev/doc/modules/developing). +The nightly workflow calls the same reusable workflow, outside the merge gate. +Consumer workspaces are unique per run attempt, including on self-hosted runners. +Builders replace their own generated output; Swift consumers create a fresh package +beside the artifact regardless of the invoking directory. Rust's reported native +link libraries become SwiftPM linker settings; unrecognized flags fail packaging. +The collections revision is read from ffi/justfile and carried inside the package. + Registry requirements checked on 2026-11-13. The table is a design assessment, not a claim that any of those unimplemented publishers was exercised. diff --git a/bench/registry/build.sh b/bench/registry/build.sh index 35e2c9109..f440388a9 100755 --- a/bench/registry/build.sh +++ b/bench/registry/build.sh @@ -3,6 +3,7 @@ set -euo pipefail export PATH="${RUST2_CARGO_SHIM:+$RUST2_CARGO_SHIM:}${RUST2_TS_TOOLCHAIN:?run in nix develop}/bin:$PATH" cd "$(dirname "$0")/../.." +rm -rf ffi/target/registry host=$(rustc -vV | sed -n 's/^host: //p') just ffi run --target "$host" --target wasm32-unknown-unknown --config fixtures/api/ffi.toml --manifest-path fixtures/api/Cargo.toml --out target/registry-export -- --features doubled cargo build --locked --release --manifest-path ffi/target/registry-export/Cargo.toml --features python diff --git a/bench/registry/consume-swift.sh b/bench/registry/consume-swift.sh index fad99042c..8083fabac 100755 --- a/bench/registry/consume-swift.sh +++ b/bench/registry/consume-swift.sh @@ -2,25 +2,31 @@ # Build a new executable package whose only library dependency is the artifact. set -euo pipefail artifacts=$(cd "$1" && pwd) -mkdir consumer -cd consumer +cd "$artifacts" +consumer=$(mktemp -d consumer.XXXXXXXX) +cd "$consumer" mkdir -p Sources/Check cp "$artifacts/consumer.swift" Sources/Check/check.swift -cat >Package.swift <<'SWIFT' -// swift-tools-version: 6.2 +python3 - <<'PYTHON' +from pathlib import Path +import re +revision = Path('../Api/collections-revision.txt').read_text().strip() +assert re.fullmatch(r'[a-f0-9]{40}', revision) +Path('Package.swift').write_text('''// swift-tools-version: 6.2 import PackageDescription let package = Package( name: "Check", platforms: [.macOS(.v15)], dependencies: [ .package(path: "../Api"), - .package(url: "https://github.com/apple/swift-collections", revision: "f96b909e1a9e469620bc5037c1e24e00153f376f") + .package(url: "https://github.com/apple/swift-collections", revision: "''' + revision + '''") ], targets: [.executableTarget(name: "Check", dependencies: [ .product(name: "Api", package: "Api"), .product(name: "BasicContainers", package: "swift-collections") ])] ) -SWIFT +''') +PYTHON swift build -c release .build/release/Check >actual.txt cmp "$artifacts/native.txt" actual.txt diff --git a/bench/registry/package.py b/bench/registry/package.py index fda4a270c..4e9215089 100644 --- a/bench/registry/package.py +++ b/bench/registry/package.py @@ -4,6 +4,9 @@ import csv import hashlib import io +import json +import re +import shlex import platform as host_platform from pathlib import Path import shutil @@ -16,7 +19,7 @@ ROOT = Path(__file__).resolve().parents[2] EXPORT = ROOT / "ffi/target/registry-export" OUT = ROOT / "ffi/target/registry" -COLLECTIONS = "f96b909e1a9e469620bc5037c1e24e00153f376f" +COLLECTIONS = re.search(r'swift_collections_rev := "([a-f0-9]{40})"', (ROOT / "ffi/justfile").read_text()).group(1) def run(*args, **kwargs): @@ -31,14 +34,29 @@ def wheel(): # Native tags deliberately make no manylinux or older macOS compatibility claim. platform = sysconfig.get_platform().replace("-", "_").replace(".", "_") if sys.platform == "darwin": - major, minor, *_ = host_platform.mac_ver()[0].split(".") - platform = f"macosx_{major}_{minor}_{host_platform.machine()}" + major, *_ = host_platform.mac_ver()[0].split(".") + platform = f"macosx_{major}_0_{host_platform.machine()}" tag = f"cp311-abi3-{platform}" info = f"api_fixture-{version}.dist-info" library = {"linux": "libapi.so", "darwin": "libapi.dylib"}[sys.platform] + binary = EXPORT / "target/release" / library + if sys.platform == "linux": + binary_copy = OUT / library + shutil.copyfile(binary, binary_copy) + run("patchelf", "--remove-rpath", str(binary_copy)) + dynamic = run("readelf", "-d", str(binary_copy), capture_output=True, text=True).stdout + needed = set(re.findall(r"Shared library: \[(.*?)\]", dynamic)) + allowed = {"libgcc_s.so.1", "libc.so.6", "ld-linux-x86-64.so.2", "ld-linux-aarch64.so.1"} + if needed - allowed or "RPATH" in dynamic or "RUNPATH" in dynamic: + raise SystemExit(f"unpackaged native dependencies: {dynamic}") + versions = run("readelf", "--version-info", str(binary_copy), capture_output=True, text=True).stdout + glibc = [tuple(map(int, v.split("."))) for v in re.findall(r"GLIBC_([0-9.]+)", versions)] + if not glibc or max(glibc) > (2, 39): + raise SystemExit("wheel requires glibc newer than the Ubuntu 24.04 consumer") + binary = binary_copy files = { "api/__init__.py": (EXPORT / "python/api.py").read_bytes(), - f"api/{library}": (EXPORT / "target/release" / library).read_bytes(), + f"api/{library}": binary.read_bytes(), f"{info}/METADATA": ( f"Metadata-Version: 2.1\nName: api-fixture\nVersion: {version}\n" f"Summary: {manifest['package']['description']}\nRequires-Python: >=3.11\n\n" @@ -65,8 +83,12 @@ def swift(): if sys.platform != "darwin": raise SystemExit("XCFramework packaging requires Apple's xcodebuild on macOS") package = OUT / "Api" + if package.exists(): + shutil.rmtree(package) package.mkdir() headers = OUT / "headers" + if headers.exists(): + shutil.rmtree(headers) headers.mkdir() shutil.copy(EXPORT / "include/api.h", headers) shutil.copy(EXPORT / "swift/api_atomics.h", headers) @@ -77,6 +99,21 @@ def swift(): sources = package / "Sources/Api" sources.mkdir(parents=True) shutil.copy(EXPORT / "swift/api.swift", sources) + built = run("cargo", "rustc", "--locked", "--release", "--manifest-path", str(EXPORT / "Cargo.toml"), + "--lib", "--", "--print=native-static-libs", capture_output=True, text=True) + notes = re.findall(r"note: native-static-libs: (.*)", built.stderr) + if len(notes) != 1: + raise SystemExit(f"rustc did not report native link libraries: {built.stderr}") + flags = iter(shlex.split(notes[0])) + settings = [] + for flag in flags: + if flag.startswith("-l"): + settings.append(f".linkedLibrary({json.dumps(flag[2:])})") + elif flag == "-framework": + settings.append(f".linkedFramework({json.dumps(next(flags))})") + else: + raise SystemExit(f"unsupported native linker flag: {flag}") + (package / "collections-revision.txt").write_text(COLLECTIONS + "\n") (package / "Package.swift").write_text('''// swift-tools-version: 6.2 import PackageDescription let package = Package( @@ -86,7 +123,7 @@ def swift(): dependencies: [.package(url: "https://github.com/apple/swift-collections", revision: "''' + COLLECTIONS + '''")], targets: [ .binaryTarget(name: "ApiFFI", path: "ApiFFI.xcframework"), - .target(name: "Api", dependencies: ["ApiFFI", .product(name: "BasicContainers", package: "swift-collections")]) + .target(name: "Api", dependencies: ["ApiFFI", .product(name: "BasicContainers", package: "swift-collections")], linkerSettings: [''' + ", ".join(settings) + ''']) ] ) ''') From 6f0d2092b87e5f76d980cb599ff059c05496fa64 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 01:34:33 -0800 Subject: [PATCH 10/19] chore(registry): pin reviewed platform packaging fixes --- .github/workflows/registry.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index 3c0ff2af6..10ad6eea4 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: kixel-ai/rust2 - ref: 818ce3bf9fc0b062b2e2817e43ea7c144cbf24db + ref: 78592ce4f145a8fe64f584aa9e4fbb3950aecafb persist-credentials: false - uses: ./.github/actions/nix - name: Build fixture packages From 6b7179e21d768b604de18fba1da781978750a049 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 01:35:58 -0800 Subject: [PATCH 11/19] fix(registry): test triggering revisions and clean consumer workspaces --- .github/workflows/registry.yml | 6 +++++- bench/registry/README.md | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index 10ad6eea4..2021cfef8 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: kixel-ai/rust2 - ref: 78592ce4f145a8fe64f584aa9e4fbb3950aecafb + ref: ${{ github.repository == 'kixel-ai/rust2' && github.sha || '78592ce4f145a8fe64f584aa9e4fbb3950aecafb' }} persist-credentials: false - uses: ./.github/actions/nix - name: Build fixture packages @@ -79,3 +79,7 @@ jobs: cd artifacts unzip Api.zip bash verify-swift.sh . + - name: Remove consumer workspace + if: always() + working-directory: ${{ github.workspace }} + run: rm -rf "$SPIKE_ROOT" diff --git a/bench/registry/README.md b/bench/registry/README.md index 5511c3fc9..dbf2514be 100644 --- a/bench/registry/README.md +++ b/bench/registry/README.md @@ -100,7 +100,8 @@ templates are the recommended no-go outcome even if both artifact consumers pass - [Go module publishing](https://go.dev/doc/modules/developing). The nightly workflow calls the same reusable workflow, outside the merge gate. -Consumer workspaces are unique per run attempt, including on self-hosted runners. +Consumer workspaces are unique per run attempt and removed in an always-run +cleanup step, including on self-hosted runners. Builders replace their own generated output; Swift consumers create a fresh package beside the artifact regardless of the invoking directory. Rust's reported native link libraries become SwiftPM linker settings; unrecognized flags fail packaging. @@ -115,8 +116,9 @@ not a claim that any of those unimplemented publishers was exercised. this fixed fixture on Linux arm64 and macOS arm64 and passes only artifacts to fresh consumer jobs. A caller needs just a job with `uses: kixel-ai/rust2/.github/workflows/registry.yml@`. -The workflow pins the fixture, exporter and packaging scripts together to an -immutable rust2 revision, independently of the caller's checkout. It is a spike +External calls pin the fixture, exporter and packaging scripts together to an +immutable rust2 revision, independently of the caller's checkout. Calls within +rust2 test the triggering commit so nightly catches changes on main. It is a spike runner, not a publisher of the caller's crate. Private callers select self-hosted runners with OS/architecture labels. Public callers use hosted runners. From 901f7baae79bb6d59690e18ee411f3a8c6209c7c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 12:54:30 -0800 Subject: [PATCH 12/19] fix(registry): validate macOS packages with the installed Xcode SDK --- bench/registry/README.md | 21 +++++++++++++++++++-- bench/registry/build.sh | 7 +++++++ ffi/tests/api.swift | 2 +- quest/m2/registry.md | 21 ++++++++++++++++----- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/bench/registry/README.md b/bench/registry/README.md index dbf2514be..173b1f2b0 100644 --- a/bench/registry/README.md +++ b/bench/registry/README.md @@ -59,8 +59,25 @@ Only the host native library is packaged. Initial export attempts exposed missin CACHEDIR.TAG markers in imported local build artifacts; restoring those markers allowed the unchanged exporter to run. No cache tools or checks were disabled. -macOS execution is unverified: this session's host is Linux and `ssh kixtop uname --a` timed out. Do not delete moq's release workflows on this evidence. +macOS 26.6.2 arm64 execution passed on kixtop on 2026-11-16, with Xcode 26.6 and +Apple Swift 6.3.3. In an isolated checkout, `nix develop --command quest gate +bench/registry/build.sh` built `Api.zip`. From a fresh artifact directory containing +only the ZIP, native transcript, Swift consumer and verifier, `unzip -q Api.zip` +and `quest gate bash verify-swift.sh .` built a release SwiftPM consumer outside +Nix with Apple's compiler. The transcript matched byte for byte, followed by +`futures ok` and `owned ok`. Both transcripts had SHA-256 +`d1ea7b364eb0cb42e2d770e81afc033b7e3f6b9edbaec87d5c7065f7ff6cef17`. +`plutil -p Api/ApiFFI.xcframework/Info.plist` and `lipo -info +Api/ApiFFI.xcframework/macos-arm64/libapi.a` independently confirmed one macOS arm64 +slice. + +This execution found two issues: Nix's SDK bundle lacked `libz.tbd` and could not +serve as Xcode's developer directory, so the macOS builder selects the installed +Xcode and its SDK explicitly. The fixture's duration-conversion closure needed an +explicit `@Sendable` type for the consumer's Swift 6 language mode. Both failures +were reproduced before the fixes and the complete Mac validation passed afterward. +The GitHub reusable invocation remains unexecuted. Do not delete moq's release +workflows on this evidence. ## What each registry still needs diff --git a/bench/registry/build.sh b/bench/registry/build.sh index f440388a9..d8599808d 100755 --- a/bench/registry/build.sh +++ b/bench/registry/build.sh @@ -2,6 +2,13 @@ # Export once, build packages, and retain the native oracle with the consumer scripts. set -euo pipefail export PATH="${RUST2_CARGO_SHIM:+$RUST2_CARGO_SHIM:}${RUST2_TS_TOOLCHAIN:?run in nix develop}/bin:$PATH" +if [[ $(uname) == Darwin ]]; then + # Nix selects an SDK bundle; this build needs the installed Xcode and its full SDK. + export DEVELOPER_DIR + DEVELOPER_DIR=$(env -u DEVELOPER_DIR /usr/bin/xcode-select -p) + export SDKROOT + SDKROOT=$(env -u SDKROOT /usr/bin/xcrun --sdk macosx --show-sdk-path) +fi cd "$(dirname "$0")/../.." rm -rf ffi/target/registry host=$(rustc -vV | sed -n 's/^host: //p') diff --git a/ffi/tests/api.swift b/ffi/tests/api.swift index b218f56c7..e86344e7c 100644 --- a/ffi/tests/api.swift +++ b/ffi/tests/api.swift @@ -711,7 +711,7 @@ func script() { let jsonSections = sections(sectionPairs) print("sections \(listed(jsonSections) { "\($0._0) \($0._1.toText())" })") // An instant only Rust makes, which each call copies out of its handle, and compares. - let millis = { (d: Swift.Duration) in d.components.seconds * 1000 + d.components.attoseconds / 1_000_000_000_000_000 } + let millis: @Sendable (Swift.Duration) -> Int64 = { d in d.components.seconds * 1000 + d.components.attoseconds / 1_000_000_000_000_000 } let began = now() let ended = later(began, .milliseconds(1500)) print("instants \(millis(since(ended, began))) \(millis(since(began, ended))) \(began == later(began, .zero)) \(began == ended)") diff --git a/quest/m2/registry.md b/quest/m2/registry.md index 2d8502c1c..c3d826e4d 100644 --- a/quest/m2/registry.md +++ b/quest/m2/registry.md @@ -14,15 +14,18 @@ fixture's script. It says what the full version would take for the other registr Implementation in progress: [packaging spike](/bench/registry/README.md) and `.github/workflows/registry.yml` build the api fixture into native wheels and a host-only macOS XCFramework with a Swift source package. Keep this quest until -the macOS SwiftPM consumer has run successfully. The Linux x86_64 wheel +the reusable invocation has run successfully. The Linux x86_64 wheel consumer passed on CPython 3.14.10, including the native transcript and futures, -ownership, values and calls. The Linux host cannot execute xcodebuild, and kixtop was -unreachable on 2026-11-13. The workflow has not been executed in this session. +ownership, values and calls. On 2026-11-16, kixtop built the macOS arm64 +XCFramework with Xcode 26.6, and a clean SwiftPM consumer with Apple Swift 6.3.3 +matched the native transcript byte for byte and passed futures and ownership. +The [report](/bench/registry/README.md) records the commands and the two fixes +this execution required. The GitHub workflow has not been executed. The report recommends templates because registry namespace ownership cannot be inferred from Cargo metadata; it does not claim moq's workflows can be deleted. -Remaining: exercise the reusable call and macOS clean artifact consumer, record -the actual results, then finish the report and delete this quest. Do not publish +Remaining: exercise the reusable call, record the actual results, settle the +report's recommendation, then finish the report and delete this quest. Do not publish the fixture or infer successful packaging from lint alone. Decided with the maintainer on 2026-11-12, in the quest audit: ✅ a spike, in m2, with moq @@ -48,6 +51,14 @@ these registries. Public API: none; the report proposes one. +## Waiting + +- Maintainer: accept the report's no-go conclusion and pursue release templates with + shared builders, or continue investigating a configless publisher. Recommend + templates: Cargo metadata cannot establish the existing registry identities or + hosting policy. This is a direction decision; an agent can collect evidence but + cannot choose the maintainer's release strategy. + ## Related - [crabx](/quest/m2/crabx/README.md) - the same opt-in workflow, for binaries From 8b7af48d5822a37d070467485cc152651eb0c05f Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 13:36:05 -0800 Subject: [PATCH 13/19] fix(registry): align package consumers with the current fixture APIs --- bench/registry/README.md | 26 +++++++++++++++++--------- bench/registry/build.sh | 2 +- ffi/tests/api.swift | 4 ++-- quest/m2/registry.md | 2 +- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/bench/registry/README.md b/bench/registry/README.md index 173b1f2b0..378ee8bb7 100644 --- a/bench/registry/README.md +++ b/bench/registry/README.md @@ -53,7 +53,7 @@ ownership, values and calls. A separate ZIP inspection checked RECORD coverage, file sizes and SHA-256 hashes. The full `quest gate nix develop --command just ci` passed, including the exporter's existing Python and Swift differential tests. -The export includes host and wasm32 API descriptions, as the existing fixture +The export includes host and wasm32-wasip1 API descriptions, as the existing fixture suite does: its values test checks that wasm32-only calls are refused on the host. Only the host native library is packaged. Initial export attempts exposed missing CACHEDIR.TAG markers in imported local build artifacts; restoring those markers @@ -63,19 +63,27 @@ macOS 26.6.2 arm64 execution passed on kixtop on 2026-11-16, with Xcode 26.6 and Apple Swift 6.3.3. In an isolated checkout, `nix develop --command quest gate bench/registry/build.sh` built `Api.zip`. From a fresh artifact directory containing only the ZIP, native transcript, Swift consumer and verifier, `unzip -q Api.zip` -and `quest gate bash verify-swift.sh .` built a release SwiftPM consumer outside -Nix with Apple's compiler. The transcript matched byte for byte, followed by +and the verifier built a release SwiftPM consumer with Apple's compiler. It ran +through `nix develop --command quest gate env -i HOME=/Users/kixelated +PATH=/usr/bin:/bin:/usr/sbin:/sbin /bin/bash /verify-swift.sh +`, so the consumer inherited only the host home and Apple +toolchain search path. The transcript matched byte for byte, followed by `futures ok` and `owned ok`. Both transcripts had SHA-256 -`d1ea7b364eb0cb42e2d770e81afc033b7e3f6b9edbaec87d5c7065f7ff6cef17`. +`729ffddcec8928c564d29fd1ee3c4fc34ccaecf18900d34be63c4e6fd0a50714`. `plutil -p Api/ApiFFI.xcframework/Info.plist` and `lipo -info Api/ApiFFI.xcframework/macos-arm64/libapi.a` independently confirmed one macOS arm64 slice. -This execution found two issues: Nix's SDK bundle lacked `libz.tbd` and could not -serve as Xcode's developer directory, so the macOS builder selects the installed -Xcode and its SDK explicitly. The fixture's duration-conversion closure needed an -explicit `@Sendable` type for the consumer's Swift 6 language mode. Both failures -were reproduced before the fixes and the complete Mac validation passed afterward. +The macOS builder selects the installed Xcode and its SDK explicitly: Nix's SDK +bundle lacks `libz.tbd` and cannot serve as Xcode's developer directory. The current +spike exports the same WASI target as the fixture suite, so target availability +agrees, and the Swift fixture avoids shadowing its `debug()` helper in Swift 6. +The original external-call pin, commit `901f7baa`, also passed Mac validation; that +older fixture needs an explicit `@Sendable` type on its duration-conversion helper. +After merging main to resolve the fixture conflict, the current source passed +again with the transcript hash above. Apple Swift still warns about a pointer +capture in the fixture's separate shared-call stress test; the consumer exercises +the transcript, futures and ownership, not that stress test. The GitHub reusable invocation remains unexecuted. Do not delete moq's release workflows on this evidence. diff --git a/bench/registry/build.sh b/bench/registry/build.sh index d8599808d..582fab688 100755 --- a/bench/registry/build.sh +++ b/bench/registry/build.sh @@ -12,7 +12,7 @@ fi cd "$(dirname "$0")/../.." rm -rf ffi/target/registry host=$(rustc -vV | sed -n 's/^host: //p') -just ffi run --target "$host" --target wasm32-unknown-unknown --config fixtures/api/ffi.toml --manifest-path fixtures/api/Cargo.toml --out target/registry-export -- --features doubled +just ffi run --target "$host" --target wasm32-wasip1 --config fixtures/api/ffi.toml --manifest-path fixtures/api/Cargo.toml --out target/registry-export -- --features doubled cargo build --locked --release --manifest-path ffi/target/registry-export/Cargo.toml --features python python3 bench/registry/package.py wheel cargo run --quiet --locked --manifest-path ffi/Cargo.toml --package api-fixture --example transcript --features doubled >ffi/target/registry/native.txt diff --git a/ffi/tests/api.swift b/ffi/tests/api.swift index 55bdc3c18..26b6d75de 100644 --- a/ffi/tests/api.swift +++ b/ffi/tests/api.swift @@ -1054,8 +1054,8 @@ func script() { check(refused("NonZero(_:)") { _ = try NonZero(0) }, "a zero makes no NonZero") check(Set([try! NonZero(-1), try! NonZero(-1), try! NonZero(.min)]).count == 2, "a set of NonZero") check(try! NonZero(.min) < NonZero(1), "a NonZero compares as its integer") - let debug: any CustomDebugStringConvertible = nonZeros() - check(debug.debugDescription == describeNonZeros(nonZeros()), "a record of NonZero is Debug") + let debuggable: any CustomDebugStringConvertible = nonZeros() + check(debuggable.debugDescription == describeNonZeros(nonZeros()), "a record of NonZero is Debug") targets() } diff --git a/quest/m2/registry.md b/quest/m2/registry.md index c3d826e4d..fb62605c0 100644 --- a/quest/m2/registry.md +++ b/quest/m2/registry.md @@ -19,7 +19,7 @@ consumer passed on CPython 3.14.10, including the native transcript and futures, ownership, values and calls. On 2026-11-16, kixtop built the macOS arm64 XCFramework with Xcode 26.6, and a clean SwiftPM consumer with Apple Swift 6.3.3 matched the native transcript byte for byte and passed futures and ownership. -The [report](/bench/registry/README.md) records the commands and the two fixes +The [report](/bench/registry/README.md) records the commands and the fixes this execution required. The GitHub workflow has not been executed. The report recommends templates because registry namespace ownership cannot be inferred from Cargo metadata; it does not claim moq's workflows can be deleted. From 5adc9ba70d92298d6f26554fa0f2a4942ad2b02d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 13:36:06 -0800 Subject: [PATCH 14/19] fix(crabx): catch supervisor signals before spawning the binary --- crabx/npm/crabx.js | 3 ++- crabx/test_release.py | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/crabx/npm/crabx.js b/crabx/npm/crabx.js index b77814410..e7969ba56 100644 --- a/crabx/npm/crabx.js +++ b/crabx/npm/crabx.js @@ -67,7 +67,6 @@ function main() { // Runs crabx as a child and exits as it did. function spawnAndWait(file, args) { - const child = spawn(file, args, { stdio: "inherit" }); // A terminal's Ctrl-C and Ctrl-\ already reach the whole foreground group, crabx included, // so this process only waits for crabx to exit. A supervisor's signals reach only this one. const ignore = () => {}; @@ -78,6 +77,8 @@ function spawnAndWait(file, args) { ? { SIGINT: ignore } : { SIGINT: ignore, SIGQUIT: ignore, SIGTERM: forward, SIGHUP: forward }; for (const [signal, handler] of Object.entries(handlers)) process.on(signal, handler); + // The child can run before spawn returns, so catch supervisor signals before starting it. + const child = spawn(file, args, { stdio: "inherit" }); child.on("error", (error) => fail(`cannot run ${file}: ${error.message}`)); child.on("exit", (code, signal) => { if (signal) { diff --git a/crabx/test_release.py b/crabx/test_release.py index bb2b36037..0895b80b9 100644 --- a/crabx/test_release.py +++ b/crabx/test_release.py @@ -238,6 +238,27 @@ def test_missing_platform_package_fails_loudly(self): self.assertEqual(result.returncode, 1) self.assertIn("is not installed; reinstall crabx without omitting optional dependencies", result.stderr) + def test_signal_during_spawn_reaches_the_binary(self): + self.binary("exit 7\n") + # Deliver a real signal while spawn returns its child, before the launcher can + # take its next step. The stand-in child exits only once it receives that signal. + self.old_node.write_text('''process.execve = undefined; +const { EventEmitter } = require("node:events"); +require("node:child_process").spawn = () => { + const child = new EventEmitter(); + child.kill = (signal) => { + process.stdout.write(`forwarded ${signal}\\n`); + child.emit("exit", 7, null); + return true; + }; + setImmediate(() => {}); + process.kill(process.pid, "SIGTERM"); + return child; +}; +''') + result = self.launch("old node") + self.assertEqual((result.returncode, result.stdout, result.stderr), (7, "forwarded SIGTERM\n", "")) + @unittest.skipIf(sys.platform == "win32", "install.sh is for Unix") class Install(unittest.TestCase): From 9677e99aa85fe24ac40bff9596a0ee8bc2bec438 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 14:15:33 -0800 Subject: [PATCH 15/19] Record registry no-go and exercise reusable packages from Check --- .github/workflows/check.yml | 4 +++ .github/workflows/nightly.yml | 2 +- quest/m2/registry.md | 22 +++++++--------- quest/m2/release-templates.md | 49 +++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 quest/m2/release-templates.md diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index ef479ba6a..45e2b033e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -12,6 +12,10 @@ concurrency: cancel-in-progress: true jobs: + registry-spike: + name: Registry package consumers + uses: ./.github/workflows/registry.yml + check: name: Check runs-on: ubuntu-24.04-arm diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 949bc4e26..d16194342 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -424,7 +424,7 @@ jobs: # schedule, which runs main, gets the write token: a dispatch can run any branch. report: name: Report - needs: [gate, ts, bench, ffi-api, ffi, ffi-sanitize, ffi-cpp, ffi-android, ffi-bench, census] + needs: [registry-spike, gate, ts, bench, ffi-api, ffi, ffi-sanitize, ffi-cpp, ffi-android, ffi-bench, census] if: ${{ !cancelled() && github.event_name == 'schedule' }} runs-on: ubuntu-24.04 timeout-minutes: 5 diff --git a/quest/m2/registry.md b/quest/m2/registry.md index fb62605c0..25ad5f451 100644 --- a/quest/m2/registry.md +++ b/quest/m2/registry.md @@ -21,13 +21,19 @@ XCFramework with Xcode 26.6, and a clean SwiftPM consumer with Apple Swift 6.3.3 matched the native transcript byte for byte and passed futures and ownership. The [report](/bench/registry/README.md) records the commands and the fixes this execution required. The GitHub workflow has not been executed. -The report recommends templates because registry namespace ownership cannot be -inferred from Cargo metadata; it does not claim moq's workflows can be deleted. +The maintainer accepted release templates with shared builders because registry +namespace ownership cannot be inferred from Cargo metadata; it does not claim moq's workflows can be deleted. -Remaining: exercise the reusable call, record the actual results, settle the -report's recommendation, then finish the report and delete this quest. Do not publish +Remaining: exercise the reusable call, record the actual results, finish the report and delete this quest. Do not publish the fixture or infer successful packaging from lint alone. +Decided with the maintainer on 2026-11-16 ([decision](https://github.com/kixel-ai/rust2/pull/761#issuecomment-6930429582)): +✅ accept the no-go and build release templates with shared builders (rejected: +keep investigating a configless publisher; stop the spike with no full version). +Cargo metadata cannot establish registry identities or hosting policy. The full +version is [release templates](/quest/m2/release-templates.md); it is outside this +fixture-packaging spike. + Decided with the maintainer on 2026-11-12, in the quest audit: ✅ a spike, in m2, with moq as its consumer. moq carries about 13 `release-*-ffi` and `release-*-lib` [workflows](https://github.com/moq-dev/moq/tree/main/.github/workflows) to do this by @@ -51,14 +57,6 @@ these registries. Public API: none; the report proposes one. -## Waiting - -- Maintainer: accept the report's no-go conclusion and pursue release templates with - shared builders, or continue investigating a configless publisher. Recommend - templates: Cargo metadata cannot establish the existing registry identities or - hosting policy. This is a direction decision; an agent can collect evidence but - cannot choose the maintainer's release strategy. - ## Related - [crabx](/quest/m2/crabx/README.md) - the same opt-in workflow, for binaries diff --git a/quest/m2/release-templates.md b/quest/m2/release-templates.md new file mode 100644 index 000000000..ab30d0d31 --- /dev/null +++ b/quest/m2/release-templates.md @@ -0,0 +1,49 @@ +# [L] Release templates with shared binding package builders + +## Goal + +Generate release workflow templates backed by shared package builders, using moq's +existing Python and Swift binding releases as the first consumer. A repository can +adopt the generated workflows without changing its stock Rust crates or existing +registry identities, artifact URLs, supported targets, or minimum platform versions. +Clean consumer jobs install the built packages and compare their behavior with +native Rust before any publication. + +## Plan + +Decided with the maintainer on 2026-11-16 in the +[packaging spike](https://github.com/kixel-ai/rust2/pull/761#issuecomment-6930429582): +✅ release templates with shared builders (rejected: keep investigating a +configless publisher; stop the spike with no full version). Registry ownership +and hosting policy are platform boundaries Cargo metadata cannot establish. + +- Start from the [spike report](/bench/registry/README.md), then inspect moq's + `release-py-ffi`, `release-swift-ffi`, and `release-swift-lib` workflows. Preserve + their current public contracts; the fixture spike did not validate moq packaging. +- Keep registry identities and publishing authorization visible in the generated + repository-owned workflow. Derive crate facts from Cargo metadata; do not add + exporter annotations or a separate packaging configuration file. +- Share artifact construction and verification, with immutable builder revisions. + Reuse crabx's platform matrix where the targets match. Keep publication separate + from read-only build and consumer jobs, behind the repository's release policy. +- Python: build the supported wheel matrix, inspect and repair native dependencies, + preserve stable-ABI claims, and validate installation outside the source checkout. +- Swift: package the macOS/iOS device/simulator slices moq actually ships, merge + target API differences, preserve deployment targets, and generate hosted ZIP + checksums and the release Package.swift. Validate a clean SwiftPM consumer. +- Exercise the generated workflows on moq's source and compare installed packages + with native Rust. Replace moq's handwritten Python and Swift packaging logic only + after those consumers pass; this quest does not authorize a production publish. +- Document how the same builder/template boundary extends to Maven, npm, NuGet, + pub.dev, and Go, using the report's constraints. Missing binding backends are + unsupported, never a silently incomplete package. Backend implementation and + other registry publishers are outside this Python/Swift migration. + +## Hosts + +- linux - portable Python wheel construction and clean consumers +- macos - Apple slices and SwiftPM consumers + +## Related + +- [crabx](/quest/m2/crabx/README.md) - reusable build matrices for Rust binaries From 13710f7b7f1dcc649fa5cdabff348b497bc835ff Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 14:37:08 -0800 Subject: [PATCH 16/19] fix(registry): link macOS wheels against Apple system libraries --- bench/registry/README.md | 19 ++++++++++++++++--- bench/registry/build.sh | 3 +++ bench/registry/package.py | 12 ++++++++++++ quest/m2/registry.md | 7 ++++++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/bench/registry/README.md b/bench/registry/README.md index 378ee8bb7..e7dbb8bf6 100644 --- a/bench/registry/README.md +++ b/bench/registry/README.md @@ -1,9 +1,15 @@ # Registry packaging spike -Recommendation: generate release templates for moq. A single configless publisher +Accepted direction: generate release templates for moq. A single configless publisher cannot infer registry ownership from Cargo metadata. Shared package builders are still useful. This spike publishes nothing and changes no binding semantics. +The maintainer [accepted the no-go on 2026-11-16](https://github.com/kixel-ai/rust2/pull/761#issuecomment-6930429582): +release templates with shared builders are the full version (rejected: keep +investigating a configless publisher; stop the spike with no full version). +The [follow-up quest](/quest/m2/release-templates.md) starts with moq's existing +Python and Swift releases and preserves their identities and platform policy. + `build.sh` exports the existing api fixture (including its existing exclusion file), builds a CPython stable-ABI library, writes a wheel, and on macOS wraps a separate C static library in an XCFramework with a Swift source package. The Swift wrapper @@ -84,8 +90,15 @@ After merging main to resolve the fixture conflict, the current source passed again with the transcript hash above. Apple Swift still warns about a pointer capture in the fixture's separate shared-call stress test; the consumer exercises the transcript, futures and ownership, not that stress test. -The GitHub reusable invocation remains unexecuted. Do not delete moq's release -workflows on this evidence. +The first GitHub reusable invocation, +[run 43968322384](https://github.com/kixel-ai/rust2/actions/runs/43968322384), +built both platforms and passed the clean Linux consumer. The macOS wheel +installed but could not import: Nix's linker wrapper embedded a Nix-store +libiconv dependency absent from the consumer runner. The builder now uses +Apple's linker, and macOS wheel packaging inspects `otool -L` and refuses any +dependency outside system libraries and frameworks. Its dylib ID is relative. +This fix still needs a successful GitHub consumer run. Do not delete moq's +release workflows on this evidence. ## What each registry still needs diff --git a/bench/registry/build.sh b/bench/registry/build.sh index 582fab688..b040576ab 100755 --- a/bench/registry/build.sh +++ b/bench/registry/build.sh @@ -8,6 +8,9 @@ if [[ $(uname) == Darwin ]]; then DEVELOPER_DIR=$(env -u DEVELOPER_DIR /usr/bin/xcode-select -p) export SDKROOT SDKROOT=$(env -u SDKROOT /usr/bin/xcrun --sdk macosx --show-sdk-path) + # Nix's linker wrapper injects store libraries unavailable to wheel consumers. + export CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/usr/bin/clang + export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=/usr/bin/clang fi cd "$(dirname "$0")/../.." rm -rf ffi/target/registry diff --git a/bench/registry/package.py b/bench/registry/package.py index 4e9215089..b90951543 100644 --- a/bench/registry/package.py +++ b/bench/registry/package.py @@ -54,6 +54,18 @@ def wheel(): if not glibc or max(glibc) > (2, 39): raise SystemExit("wheel requires glibc newer than the Ubuntu 24.04 consumer") binary = binary_copy + elif sys.platform == "darwin": + binary_copy = OUT / library + shutil.copyfile(binary, binary_copy) + run("/usr/bin/install_name_tool", "-id", f"@rpath/{library}", str(binary_copy)) + dynamic = run("/usr/bin/otool", "-L", str(binary_copy), capture_output=True, text=True).stdout + needed = {line.strip().split(" (", 1)[0] for line in dynamic.splitlines()[1:]} + external = {name for name in needed if name != f"@rpath/{library}" + and not name.startswith(("/usr/lib/", "/System/Library/Frameworks/"))} + if external: + raise SystemExit(f"unpackaged native dependencies: {dynamic}") + print(dynamic, end="") + binary = binary_copy files = { "api/__init__.py": (EXPORT / "python/api.py").read_bytes(), f"api/{library}": binary.read_bytes(), diff --git a/quest/m2/registry.md b/quest/m2/registry.md index 25ad5f451..a8e902382 100644 --- a/quest/m2/registry.md +++ b/quest/m2/registry.md @@ -20,7 +20,12 @@ ownership, values and calls. On 2026-11-16, kixtop built the macOS arm64 XCFramework with Xcode 26.6, and a clean SwiftPM consumer with Apple Swift 6.3.3 matched the native transcript byte for byte and passed futures and ownership. The [report](/bench/registry/README.md) records the commands and the fixes -this execution required. The GitHub workflow has not been executed. +this execution required. GitHub Actions run +[43968322384](https://github.com/kixel-ai/rust2/actions/runs/43968322384) +built both packages and passed the clean Linux consumer. The Mac wheel import +failed on a Nix-store libiconv dependency. The builder now selects Apple's linker, +and wheel packaging rejects non-system dylib dependencies; rerun both consumers +to validate the fix. The maintainer accepted release templates with shared builders because registry namespace ownership cannot be inferred from Cargo metadata; it does not claim moq's workflows can be deleted. From 663f8d0cfee9506ef91d5a7add54a61300c2ee96 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 14:58:48 -0800 Subject: [PATCH 17/19] docs(registry): finish spike with Actions consumer evidence --- .github/workflows/registry.yml | 2 +- bench/registry/README.md | 42 +++++++++++++++++++-- quest/m2/README.md | 4 +- quest/m2/registry.md | 67 ---------------------------------- 4 files changed, 42 insertions(+), 73 deletions(-) delete mode 100644 quest/m2/registry.md diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index 838934896..d4c369f08 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: kixel-ai/rust2 - ref: ${{ github.repository == 'kixel-ai/rust2' && github.sha || '901f7baae79bb6d59690e18ee411f3a8c6209c7c' }} + ref: ${{ github.repository == 'kixel-ai/rust2' && github.sha || '13710f7b7f1dcc649fa5cdabff348b497bc835ff' }} persist-credentials: false - uses: ./.github/actions/nix - name: Build fixture packages diff --git a/bench/registry/README.md b/bench/registry/README.md index e7dbb8bf6..e14b5c400 100644 --- a/bench/registry/README.md +++ b/bench/registry/README.md @@ -84,7 +84,7 @@ The macOS builder selects the installed Xcode and its SDK explicitly: Nix's SDK bundle lacks `libz.tbd` and cannot serve as Xcode's developer directory. The current spike exports the same WASI target as the fixture suite, so target availability agrees, and the Swift fixture avoids shadowing its `debug()` helper in Swift 6. -The original external-call pin, commit `901f7baa`, also passed Mac validation; that +The original external-call pin, commit `901f7baa`, also passed Swift validation; that older fixture needs an explicit `@Sendable` type on its duration-conversion helper. After merging main to resolve the fixture conflict, the current source passed again with the transcript hash above. Apple Swift still warns about a pointer @@ -97,8 +97,44 @@ installed but could not import: Nix's linker wrapper embedded a Nix-store libiconv dependency absent from the consumer runner. The builder now uses Apple's linker, and macOS wheel packaging inspects `otool -L` and refuses any dependency outside system libraries and frameworks. Its dylib ID is relative. -This fix still needs a successful GitHub consumer run. Do not delete moq's -release workflows on this evidence. +The next GitHub invocation passed both artifact consumers, as recorded below. +Do not delete moq's release workflows on this evidence. + +## GitHub invocation and artifact handoff + +On 2026-11-16, ran `gh workflow run check.yml --repo kixel-ai/rust2 --ref +quest/m2/registry`. The registered manual Check workflow called +`./.github/workflows/registry.yml` at +`13710f7b7f1dcc649fa5cdabff348b497bc835ff` in +[run 43971814703](https://github.com/kixel-ai/rust2/actions/runs/43971814703). +Direct dispatch of `registry.yml` returned 404 because that new workflow was not +yet registered on the default branch. The manual caller also runs the existing +full Check job; nightly's report now includes the reusable job's result. + +Both builders passed and uploaded `registry-ubuntu-24.04-arm` and +`registry-macos-26`. Separate jobs downloaded these artifacts without checkout, +Nix, Rust, exporter or source paths. They created a venv, installed the wheel +with `pip install --no-index --no-deps artifacts/*.whl`, and ran the copied +verifier with Python's `-I` from a clean directory. +[Linux arm64](https://github.com/kixel-ai/rust2/actions/runs/43971814703/job/133671565856) +and [macOS arm64](https://github.com/kixel-ai/rust2/actions/runs/43971814703/job/133671565931) +each printed `installed wheel: transcript matches Rust; futures, ownership, +values and calls pass`. The macOS 26.7.2 consumer then unpacked `Api.zip` and ran +`bash verify-swift.sh .`: SwiftPM's release build passed, its transcript matched +Rust byte for byte, then `futures ok` and `owned ok` passed. Both consumer jobs +removed their workspaces successfully. + +The Mac builder's independent `otool -L` check reported only the relative dylib +ID, `/usr/lib/libiconv.2.dylib` and `/usr/lib/libSystem.B.dylib`. The external-call +fixture pin now uses this validated revision, including the Apple linker fix. +Downloaded both uploaded artifacts with `gh run download 43971814703 --repo +kixel-ai/rust2 --dir .tmp/registry-verified-artifacts`: independent ZIP inspection +verified both wheels' complete RECORD coverage, sizes and SHA-256 hashes, and +the XCFramework plist described exactly one macOS arm64 slice. Both packaged +native transcripts had SHA-256 +`729ffddcec8928c564d29fd1ee3c4fc34ccaecf18900d34be63c4e6fd0a50714`. +This completes the fixture-packaging spike and establishes the artifact handoff, +not a configless publisher or moq release migration. ## What each registry still needs diff --git a/quest/m2/README.md b/quest/m2/README.md index 93a7d7b97..3adfe64f5 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -5,8 +5,8 @@ Research work with a named consumer that is not waiting on it yet: rust2-wasm, moq's browser route, the TypeScript translator that has to beat it, [crabx](/quest/m2/crabx/README.md), which runs moq's CLIs without a Rust toolchain, and -[registry publishing](/quest/m2/registry.md), which would replace moq's binding release -workflows. +[release templates](/quest/m2/release-templates.md), which would share moq's binding +package builders while preserving its registry and platform policy. ## Plan diff --git a/quest/m2/registry.md b/quest/m2/registry.md deleted file mode 100644 index a8e902382..000000000 --- a/quest/m2/registry.md +++ /dev/null @@ -1,67 +0,0 @@ -# [M] Spike: publish bindings to every registry from one workflow - -## Goal - -A report, from a working spike: one configless reusable workflow turns -[rust2-ffi](/ffi/README.md)'s export of the api fixture into Python wheels and an -XCFramework with a `Package.swift`, and a clean consumer job installs each and runs the -fixture's script. It says what the full version would take for the other registries -(an AAR on Maven, npm, NuGet, pub.dev, and a Go module), and whether any needs settings -`Cargo.toml` cannot supply. - -## Plan - -Implementation in progress: [packaging spike](/bench/registry/README.md) and -`.github/workflows/registry.yml` build the api fixture into native wheels and a -host-only macOS XCFramework with a Swift source package. Keep this quest until -the reusable invocation has run successfully. The Linux x86_64 wheel -consumer passed on CPython 3.14.10, including the native transcript and futures, -ownership, values and calls. On 2026-11-16, kixtop built the macOS arm64 -XCFramework with Xcode 26.6, and a clean SwiftPM consumer with Apple Swift 6.3.3 -matched the native transcript byte for byte and passed futures and ownership. -The [report](/bench/registry/README.md) records the commands and the fixes -this execution required. GitHub Actions run -[43968322384](https://github.com/kixel-ai/rust2/actions/runs/43968322384) -built both packages and passed the clean Linux consumer. The Mac wheel import -failed on a Nix-store libiconv dependency. The builder now selects Apple's linker, -and wheel packaging rejects non-system dylib dependencies; rerun both consumers -to validate the fix. -The maintainer accepted release templates with shared builders because registry -namespace ownership cannot be inferred from Cargo metadata; it does not claim moq's workflows can be deleted. - -Remaining: exercise the reusable call, record the actual results, finish the report and delete this quest. Do not publish -the fixture or infer successful packaging from lint alone. - -Decided with the maintainer on 2026-11-16 ([decision](https://github.com/kixel-ai/rust2/pull/761#issuecomment-6930429582)): -✅ accept the no-go and build release templates with shared builders (rejected: -keep investigating a configless publisher; stop the spike with no full version). -Cargo metadata cannot establish registry identities or hosting policy. The full -version is [release templates](/quest/m2/release-templates.md); it is outside this -fixture-packaging spike. - -Decided with the maintainer on 2026-11-12, in the quest audit: ✅ a spike, in m2, with moq -as its consumer. moq carries about 13 `release-*-ffi` and `release-*-lib` -[workflows](https://github.com/moq-dev/moq/tree/main/.github/workflows) to do this by -hand, and the audit's survey found no tool that publishes one Rust library to all of -these registries. - -- Prior art, and why it falls short: [BoltFFI](https://github.com/boltffi/boltffi)'s - `pack all` is closest (XCFramework, wheels, npm, NuGet) but needs annotations, builds - local artifacts only, and emits jniLibs rather than an AAR; - [maturin](https://www.maturin.rs/distribution.html) covers PyPI only; cargo-swift, - cargo-xcframework, cargo-ndk, and napi-rs each cover one ecosystem. -- It shares [crabx](/quest/m2/crabx/README.md)'s shape: a workflow a repository opts - into, building each target in its own CI. Reuse its target matrix where the targets - match. -- Go: both packages install and run with nothing in the consumer's repository but the - workflow call, and moq's Python and Swift release workflows would become deletable. - No-go: a registry needs per-project settings, such as signing identities or a - namespace, that no manifest carries; then the report recommends templates instead. -- The spike publishes nothing: it builds the packages and installs them from the job's - artifacts. - -Public API: none; the report proposes one. - -## Related - -- [crabx](/quest/m2/crabx/README.md) - the same opt-in workflow, for binaries From 31f4aa2c31cc07f7de4639687717b3f7d3b78d12 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 15:10:23 -0800 Subject: [PATCH 18/19] fix(registry): bound jobs and preserve consumer failure evidence --- .github/workflows/registry.yml | 2 ++ bench/registry/consume.py | 10 ++++++++-- bench/registry/package.py | 11 +++++++---- crabx/test_release.py | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index d4c369f08..5656f2209 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -9,6 +9,7 @@ permissions: jobs: package: + timeout-minutes: 30 strategy: fail-fast: false matrix: @@ -46,6 +47,7 @@ jobs: consumer: needs: package + timeout-minutes: 15 strategy: fail-fast: false matrix: diff --git a/bench/registry/consume.py b/bench/registry/consume.py index db359e3a4..fc14626cf 100644 --- a/bench/registry/consume.py +++ b/bench/registry/consume.py @@ -1,5 +1,6 @@ """Run an installed wheel from an isolated consumer directory against native Rust.""" from pathlib import Path +import difflib import os import subprocess import sys @@ -14,6 +15,11 @@ if output.returncode: sys.stderr.buffer.write(output.stderr) raise SystemExit(output.returncode) - if case is None and output.stdout != (artifacts / "native.txt").read_bytes(): - raise SystemExit("installed wheel differs from native Rust") + if case is None: + native = (artifacts / "native.txt").read_bytes() + if output.stdout != native: + sys.stderr.buffer.writelines(difflib.diff_bytes( + difflib.unified_diff, native.splitlines(keepends=True), + output.stdout.splitlines(keepends=True), fromfile=b"native Rust", tofile=b"installed wheel")) + raise SystemExit("installed wheel differs from native Rust") print("installed wheel: transcript matches Rust; futures, ownership, values and calls pass") diff --git a/bench/registry/package.py b/bench/registry/package.py index b90951543..6080034df 100644 --- a/bench/registry/package.py +++ b/bench/registry/package.py @@ -19,7 +19,6 @@ ROOT = Path(__file__).resolve().parents[2] EXPORT = ROOT / "ffi/target/registry-export" OUT = ROOT / "ffi/target/registry" -COLLECTIONS = re.search(r'swift_collections_rev := "([a-f0-9]{40})"', (ROOT / "ffi/justfile").read_text()).group(1) def run(*args, **kwargs): @@ -46,7 +45,7 @@ def wheel(): run("patchelf", "--remove-rpath", str(binary_copy)) dynamic = run("readelf", "-d", str(binary_copy), capture_output=True, text=True).stdout needed = set(re.findall(r"Shared library: \[(.*?)\]", dynamic)) - allowed = {"libgcc_s.so.1", "libc.so.6", "ld-linux-x86-64.so.2", "ld-linux-aarch64.so.1"} + allowed = {"libgcc_s.so.1", "libc.so.6", "libm.so.6", "ld-linux-x86-64.so.2", "ld-linux-aarch64.so.1"} if needed - allowed or "RPATH" in dynamic or "RUNPATH" in dynamic: raise SystemExit(f"unpackaged native dependencies: {dynamic}") versions = run("readelf", "--version-info", str(binary_copy), capture_output=True, text=True).stdout @@ -94,6 +93,10 @@ def swift(): """Wrap the host's C static library in an XCFramework and Swift source package.""" if sys.platform != "darwin": raise SystemExit("XCFramework packaging requires Apple's xcodebuild on macOS") + revision = re.search(r'swift_collections_rev := "([a-f0-9]{40})"', (ROOT / "ffi/justfile").read_text()) + if revision is None: + raise SystemExit("ffi/justfile must name an immutable swift_collections_rev") + collections = revision.group(1) package = OUT / "Api" if package.exists(): shutil.rmtree(package) @@ -125,14 +128,14 @@ def swift(): settings.append(f".linkedFramework({json.dumps(next(flags))})") else: raise SystemExit(f"unsupported native linker flag: {flag}") - (package / "collections-revision.txt").write_text(COLLECTIONS + "\n") + (package / "collections-revision.txt").write_text(collections + "\n") (package / "Package.swift").write_text('''// swift-tools-version: 6.2 import PackageDescription let package = Package( name: "Api", platforms: [.macOS(.v15)], products: [.library(name: "Api", targets: ["Api"])], - dependencies: [.package(url: "https://github.com/apple/swift-collections", revision: "''' + COLLECTIONS + '''")], + dependencies: [.package(url: "https://github.com/apple/swift-collections", revision: "''' + collections + '''")], targets: [ .binaryTarget(name: "ApiFFI", path: "ApiFFI.xcframework"), .target(name: "Api", dependencies: ["ApiFFI", .product(name: "BasicContainers", package: "swift-collections")], linkerSettings: [''' + ", ".join(settings) + ''']) diff --git a/crabx/test_release.py b/crabx/test_release.py index 0895b80b9..3d4974ba4 100644 --- a/crabx/test_release.py +++ b/crabx/test_release.py @@ -251,6 +251,7 @@ def test_signal_during_spawn_reaches_the_binary(self): child.emit("exit", 7, null); return true; }; + // Keep one event-loop turn alive so Node dispatches the pending OS signal. setImmediate(() => {}); process.kill(process.pid, "SIGTERM"); return child; From 8d942c3477176729d4861297cc041c8e3b4ebb19 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 15:48:20 -0800 Subject: [PATCH 19/19] fix(registry): align download-artifact pin with shared workflows --- .github/workflows/registry.yml | 2 +- quest/m2/release-templates.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index 5656f2209..fe007448f 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -64,7 +64,7 @@ jobs: working-directory: ${{ env.SPIKE_ROOT }} steps: # No checkout, Rust toolchain, exporter, source paths or PYTHONPATH. - - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: registry-${{ matrix.runner }} path: ${{ env.SPIKE_ROOT }}/artifacts diff --git a/quest/m2/release-templates.md b/quest/m2/release-templates.md index ab30d0d31..d401226f2 100644 --- a/quest/m2/release-templates.md +++ b/quest/m2/release-templates.md @@ -11,6 +11,9 @@ native Rust before any publication. ## Plan +Decided with the maintainer on 2026-11-16 at the packaging spike's merge pick: +✅ keep this follow-up unchanged (rejected: drop it). + Decided with the maintainer on 2026-11-16 in the [packaging spike](https://github.com/kixel-ai/rust2/pull/761#issuecomment-6930429582): ✅ release templates with shared builders (rejected: keep investigating a