From 7139a3e41a03d365d19629dfab07135b0cf3c237 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 10 Nov 2026 01:14:08 -0800 Subject: [PATCH 1/3] chore(quest): claim quest/m1/ffi-doc-trim.md Quest-Claim: 0fee2621d9701296 From 28b8a85bf1260f04d9300c35764879ad58acc9d1 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 10 Nov 2026 01:54:15 -0800 Subject: [PATCH 2/3] ci(ffi): trim the shared FFI doc to rules and drop legacy per-language triggers Co-Authored-By: Claude Opus 5.5 --- .github/ffi.md | 306 ++++-------------------- .github/workflows/release-go.yml | 5 +- .github/workflows/release-swift-lib.yml | 5 +- quest/m1/README.md | 1 - quest/m1/ffi-doc-trim.md | 20 -- quest/m3/cpp-ffi-reuse.md | 2 +- sh/gh/ffi.py | 8 +- sh/gh/ffi.test.py | 8 +- 8 files changed, 57 insertions(+), 298 deletions(-) delete mode 100644 quest/m1/ffi-doc-trim.md diff --git a/.github/ffi.md b/.github/ffi.md index 9040799eed3..cc49c5e7a48 100644 --- a/.github/ffi.md +++ b/.github/ffi.md @@ -1,264 +1,52 @@ # Shared FFI releases -`release-shared-ffi.yml` owns the existing `moq-ffi-v*` tag trigger for Go, -Kotlin and Swift. Nightly calls the same coordinator without publisher secrets. -It builds nine distinct default-feature targets, replacing fourteen native -builds across those packages. Dart retains its own eleven default-feature -targets, a superset that adds `x86_64-apple-darwin` and `x86_64-apple-ios`; -Python retains its wheel builds and Python-specific environment. - -C++ retains source builds as its default and independent `cpp-v*` release tags. -Nightly packages reuse the coordinator's validated same-run native archives. -The [historical C++ comparison](#c-comparison) records differing archive hashes, -including native versus cross-built ARM Linux inputs. The -[current installed-consumer proof](#current-installed-consumer-proof) separately -validates the prebuilt path on all four C++ hosts. Pinned C++ release reuse -still awaits real published default-feature assets and validation of their -exact version and checksum pins. - -The shared build uploads `default-lib-`. Binding jobs read the built -Linux library with `just rs package-ffi --bindings-only --library PATH`, so -binding generation does not compile moq-ffi again. Package workflows select -only their own targets, retain language binding names and package outputs, -and keep their existing publisher steps and credentials. Manual calls remain -standalone. Go's PR dry-run also remains standalone. - -A target failure must not suppress a package that does not consume that target. -The build matrix and binding matrix do not fail fast; packaging still runs -after a failed shared job and refuses missing artifacts. The wrapper workflows -accept only the existing trusted owner/push/tag inputs. Their read-only -preflight checks the completed coordinator's own language publisher and jobs, -so a failed Android build does not prevent a successful Go wrapper release. -The [jobs API](https://docs.github.com/en/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run) -query includes all attempts and uses each job's latest execution. A publisher -counts only if it ran in the triggering attempt: a partial rerun copies earlier -successes with their original start time, and their wrappers already ran when -that attempt completed. Rerunning only Kotlin on an old tag therefore cannot -re-cut the Go wrapper from old sources after a newer tag published, while a -rerun publisher still releases its wrapper. Missing publisher names or an API -error fail loudly. No publication is polled. -The legacy per-language workflow names remain accepted: a tag cut from a -`release` that predates the coordinator still runs the per-language workflows. +`release-shared-ffi.yml` (Release FFI) owns the `moq-ffi-v*` tag trigger for +Go, Kotlin and Swift. Nightly calls the same coordinator without publisher +secrets. It builds each default-feature target once and uploads +`default-lib-`; binding jobs read the built Linux library with +`just rs package-ffi --bindings-only --library PATH` instead of compiling +moq-ffi again. Package workflows select only their own targets and keep their +own binding names, outputs, publisher steps and credentials. Manual calls and +Go's PR dry-run stay standalone. Dart keeps its own superset of targets; Python +keeps its own wheel builds. Sharing produces the same native code as per-language +builds ([#5549](https://github.com/moq-dev/moq/pull/5549)). + +## Failure isolation + +- A target failure must not suppress a package that does not consume it. The + build and binding matrices do not fail fast; packaging refuses missing + artifacts. +- Wrapper workflows (`release-go.yml`, `release-swift-lib.yml`) accept only the + trusted owner/push/tag inputs. Their preflight asks the + [jobs API](https://docs.github.com/en/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run) + whether the coordinator's own language publisher succeeded, so another + language's failure does not block them. +- A publisher counts only if it ran in the triggering attempt. A partial rerun + copies earlier successes with their original start time, so rerunning one + language on an old tag cannot re-cut another's wrapper from old sources + ([#5573](https://github.com/moq-dev/moq/pull/5573)). +- Missing publisher names or an API error fail loudly. No publication is polled. `sh/size/release.py` reads shared native libraries under the existing Go size history keys and excludes Android/iOS libraries already counted inside their -language packages. Package artifact names and size comparisons stay stable. - -## Evidence and validation - -[The sampled Nightly](https://github.com/moq-dev/moq/actions/runs/38564590314) -contains fourteen default-feature native builds. Downloaded library payloads -from all nine uploads for duplicated targets confirm: - -| Target | Consumers | Comparison | -| --- | --- | --- | -| x86\_64-unknown-linux-gnu | Go, Kotlin | static and shared libraries have identical SHA-256 hashes | -| aarch64-unknown-linux-gnu | Go, Kotlin | static and shared libraries have identical SHA-256 hashes | -| aarch64-apple-darwin | Go, Kotlin, Swift | static and shared libraries have identical SHA-256 hashes | -| x86\_64-pc-windows-msvc | Go, Kotlin | import library identical; DLL and static library differ only in timestamps and DLL debug GUID | - -The Windows DLL has 23 differing bytes, all in PE/COFF timestamps, debug-directory -timestamps and the CodeView GUID. The static archive has 85 differing bytes, -all in COFF timestamps. Zeroing those metadata fields makes both payloads -byte-identical; no executable code or binding metadata differs. The source -build command is the same target/default-feature Cargo invocation for every -consumer. Sharing preserves the same native code and library files. - -`just gh test` runs local fixtures for artifact subsets, stable size keys, -build-free binding generation, independent language outcomes, failed API -queries and workflow guards. `just gh check` validates workflow syntax and -alert coverage. - -[The first Nightly after landing](https://github.com/moq-dev/moq/actions/runs/38897397428) -measured the saving against the sample: - -| Jobs | Sampled | Shared | -| --- | --- | --- | -| Default-feature native builds | 14 jobs, 186 runner-minutes | 9 jobs, 116 runner-minutes | -| Binding generation | 3 jobs, 40 runner-minutes | 3 jobs, 19 runner-minutes | - -That is about 90 runner-minutes saved per run. Binding generation now waits for -every native build, since it reads the Linux library; Go's binding job spends -most of its 12 minutes compiling `uniffi-bindgen-go`. The Go, Kotlin and Swift -packagers each selected their own targets from the shared artifacts and passed. - -## C++ comparison - -This comparison uses the sampled 2026-10-14 Nightly linked above, at -`0d9e9ff78857003b305f11ebf07095af4c3cdd87`. Compare each `moq-cpp-` -artifact's installed static library with `go-lib-`; those Go libraries -are the default-feature inputs already proved equivalent to Kotlin and Swift. -Preserve this source revision when reproducing the comparison, rather than -mixing artifacts from different runs or rebuilding today's bindings. - -Both paths build `moq-ffi` with default `audio` and `video` features, -`--locked`, and the release profile: fat LTO, one codegen unit, and debuginfo -stripped for `moq-ffi`. The toolchain action installed stable Rust 1.99.0, -but the repository's `rust-toolchain.toml` selects Rust 1.98.1 (`48a229cea`) -for the actual Cargo builds on both paths. C++ invokes -`cargo build --locked --package moq-ffi --release` through -CMake; in this sampled revision, the shared candidate adds `--target ` through -`rs/moq-ffi/build.sh`. C++ is always a native host build. Only the shared ARM -Linux candidate crosses from an x86 Linux host. - -Current native packaging omits `--target`, matching the C++ invocation. The -table and debug-path differences below describe the older sampled invocation; -only cross-builds still pass an explicit target. - -| Target | C++ host | Shared candidate host | Native archive comparison | -| --- | --- | --- | --- | -| x86\_64-unknown-linux-gnu | Ubuntu 24.04, image 20261004.327.1 | Same image and architecture | 772 common objects byte-identical; one differently named Rust LTO object | -| aarch64-unknown-linux-gnu | Ubuntu 24.04 ARM, image 20261012.149.1 | Ubuntu 24.04 x86, image 20261004.327.1, GCC cross toolchain | 879 common objects byte-identical; one differently named Rust LTO object | -| aarch64-apple-darwin | macOS 26 ARM, image 20260907.0351.1 | Same image and architecture | 847 common objects byte-identical; one differently named Rust LTO object | -| x86\_64-pc-windows-msvc | Windows 2025 VS2026, image 20260925.250.1 | Same image and architecture | 6,077 members each, preserving duplicate basenames; timestamps, debug paths and six assembly code sections differ, plus one differently named Rust LTO object | - -The Linux native and cross compilers are GCC 13.3.0. Both runners use Ubuntu -24.04; the ARM cross sysroot is Ubuntu's `libc6-dev-arm64-cross`. The sampled -shared ARM cdylib requires up to GLIBC\_2.38 and GLIBCXX\_3.4. The installed C++ -archive carries unversioned imports, so its glibc minimum cannot be read as a -linked executable's version requirement. Its native objects are nevertheless -byte-identical to the cross build, and the two Linux archive pairs have the -same sets of non-Rust undefined symbols. This rules out a native dependency -change in this sample, without proving an older-distro runtime baseline. - -The Windows C++ job identifies MSVC 19.51.36260.0; both jobs use the same -runner image. A sampled AWS-LC object requests `MSVCRT` and `OLDNAMES` in both -archives, preserving the release CRT. Preserving duplicate archive member -names gives 6,077 members per archive; the earlier 665 count was distinct -basename keys. Of 6,076 matched members, 5,685 are identical, 43 differ only -in timestamps, and 342 differ only in debug/discarded sections and their -associated auxiliary symbols, timestamps and offsets. Their `.debug$S` -records contain `target\release\build` versus -`target\x86_64-pc-windows-msvc\release\build` paths. - -Six OpenH264 assembly members have executable `.text` differences: `dct.o`, -`downsample_bilinear.o`, `matrix_transpose.o`, `mb_copy.o`, `mc_luma.o`, and -the second `vaa.o`. For `matrix_transpose.o`, `mb_copy.o`, and the second -`vaa.o`, normalized instruction listings match after accounting for -CDQE versus MOVSXD sign extension and alignment padding. The other three -remain unproven. The C++ job installed NASM 3.2.0; the shared assembler's -version was not logged, so a tool-version cause is plausible, not established. - -On each Linux target, all 427 `.text.uniffi_*` and 295 -`.rodata.UNIFFI_META*` payloads match. Their relocations and internal symbols -differ, so equal section payloads do not prove linked equivalence. None of -the four Rust fat-LTO objects has a complete executable-code equivalence -proof. No incompatible ABI difference has been established; installed -consumers must still execute against the actual selected prebuilt libraries. - -Static-library SHA-256 hashes, C++ first and shared candidate second: - -```text -x86_64-unknown-linux-gnu -f786f40bd739a7cf97471549bcb30f05f25c35acc14d0b2f826c34a80c9e9505 -d663534420b8bea820388c058a01b590eafc2531b8fe72961cdf1afe7ac630bc -aarch64-unknown-linux-gnu -09e0ea5e0ddfd72d4799febba21a22f4d83de4c2b16a08ffa58e9fbfa5ad4f1e -7fcd57f6c4a52332828daf0e6f2d64c9a81082a13df20da023ac3c1d0124577f -aarch64-apple-darwin -1c05406ca3bb8f13f45a9760b5e7eaf5e3fd7eddfeb72f6fa220cd4fb61c74ad -39eaa5f69770ecf6c20dedad43d10891e66a46984cdae3639875cad4235d78fa -x86_64-pc-windows-msvc -6cbbe795ebc6bf992f62ffc4dac98befac2b3f07f523c757f2c9848f395d4ffe -617eb2d358d17af2efe590d0185212fb15aec46e5f4d31318d884155dfe06b86 -``` - -Using the pinned `uniffi-bindgen-cpp` version -`v0.11.0-kixelated.4+v0.32.2` and this revision's `cpp/moq/uniffi.toml`, -all four candidates generate exactly the installed C++ bindings: `moq.hpp`, -`moq.cpp`, `moq_scaffolding.hpp`, and `uniffi_expected.hpp`. Linux and macOS -static archives are readable directly; Windows requires the shared candidate's -DLL because this generator cannot read its static archive's long member names. -Compare generated `moq.cpp` with the installed `include/moq/ffi/moq.cpp`, not -the separate handwritten `share/moq-cpp/moq.cpp` wrapper. - -The sampled revision's C++17 consumer probe passed on Linux x86 after linking -the installed headers and wrapper source against the shared candidate static -library. That manual experiment used the Nix development toolchain. ARM Linux, -macOS and Windows consumers were not run with that historical sample; it alone -did not justify reuse. The current-source proof below tests all four hosts -without claiming byte-for-byte executable equivalence. - -### Current installed-consumer proof - -The [2026-10-16 focused dry-run](https://github.com/moq-dev/moq/actions/runs/38969347067) -passed at implementation commit `cbbcf9b2c92aa88c5550d9175adcc317f8137f4a`. -All four shared default-feature release builds passed, followed by installed -C++17 and C++23 consumers on Linux x86, Linux ARM, macOS ARM and Windows MSVC. -Both C++23 forms ran their coroutine probes. Unix also passed pkg-config -consumers and compiled the documented examples. Each job then archived, -verified and extracted its checked input and produced its final C++ package. -The consumer and package jobs did not rebuild moq-ffi with Cargo. Release and -OBS publication jobs were skipped. - -This validates the same-run prebuilt path for that coherent source, generator -and configuration on those runners. No published release pin has been tested, -and this does not establish an older Linux runtime baseline. Documentation-only -evidence updates after that implementation commit do not change the tested code. - -### Release input decision - -`cpp-v*` and `moq-ffi-v*` remain separate release lifecycles. The shared build's -default-feature static libraries are Actions artifacts, which expire; an old -C++ release must not depend on those artifacts still existing. Current -`moq-ffi-v*` releases publish Dart's minimal-feature shared libraries and Swift -packages, not standalone default-feature static libraries for all four C++ -targets. The minimal-feature assets cannot replace these candidates. - -The maintainer approved an explicit `cpp/moq/FFI_VERSION` pin selecting -checksummed default-feature assets on the corresponding `moq-ffi-v*` release. -`FFI_SHA256.json` pins every selected archive by its complete filename and -SHA-256. There is no newest-release lookup. The pin is intentionally unset: -existing releases lack this four-target asset contract. Source builds remain -the default until a real release publishes all four validated assets and a -subsequent pin change supplies their exact hashes. A malformed pin, missing -asset, wrong hash, wrong feature/profile, or incompatible target fails. - -### Native input and release gates - -`MOQ_FFI_DIR` in CMake and `--ffi-dir DIR` in `just cpp package` select an -extracted default-feature native input. Its manifest names the FFI version, -source commit, target, feature set and profile; it carries the static library, -metadata cdylib and native linker inputs together. CMake generates bindings -from that cdylib without invoking Cargo. Direct directories are explicit local -or same-run inputs; release downloads additionally require the checked-in hash. -Without an explicit directory, `just cpp package` fetches exactly the pinned -release input. The pin selects package-release inputs; direct CMake builds and -`just cpp check` build the current checkout unless `MOQ_FFI_DIR` or `--ffi-dir` -is explicitly supplied. A failed selected release fetch never builds source. - -The shared coordinator downloads its four exact `default-lib-` -artifacts on Ubuntu x86, Ubuntu 24.04 ARM, macOS ARM and Windows MSVC. Each runs -`just cpp check --ffi-dir DIR`: install the package, then build and execute the -existing C++17 and C++23 consumers, including the standard set on the consumer -target, with exceptions/RTTI disabled. Unix also tests installed pkg-config -linking and compiles the documented examples. No prebuilt error invokes Cargo. -The cross-built ARM input therefore executes on an ARM host. This checks that -runner's baseline only; it does not establish an older Linux runtime baseline. - -Only after all four consumers succeed can the tag coordinator publish -`moq-ffi-default--.tar.gz` and one `.sha256` per archive. -The publisher refuses changed bytes under an existing asset name and never -clobbers assets. These names are separate from Dart's minimal-feature assets. -A first publication is an external condition for selecting a release pin; -this change creates no release or tag. After publication, validate the actual -pinned downloads through the same four-host consumer path before activation. - -A branch-only `release-cpp.yml` dispatch with `prebuilt-test=true` builds just -these four shared targets and exercises the prebuilt package and installed -consumers without publishing. Nightly waits for the shared coordinator, then -packages each target from its -`cpp-native-` artifact, which exists only after that target's installed -consumers succeed. It verifies the archive sidecar and manifest before CMake -uses it, with no source fallback. An unrelated coordinator failure does not -suppress a successful C++ target. Tag releases refuse same-run inputs and keep -the explicit release pin path. `just cpp check` and `just gh test` also -cover hash refusal, -archive traversal/symlink refusal, reproducible packaging, publication refusal, -and CMake's build-free prebuilt path with malformed-input fixtures. - -PR #5727 independently changes the generator and overlaps the C++ checks and -release workflow. Today's matrix validates this checkout's coherent generator -and config. If that PR lands before this change or the selected release, rerun -the same gates on the final checkout. The old sampled binding matches alone -do not validate a new generator. +language packages. `just gh test` covers these rules with local fixtures. + +## C++ + +C++ builds from source by default and keeps independent `cpp-v*` tags. +`MOQ_FFI_DIR` (CMake) or `--ffi-dir DIR` (`just cpp package`) selects an +extracted default-feature native input whose manifest names its version, +commit, target, features and profile; CMake then generates bindings without +Cargo. `cpp/moq/FFI_VERSION` pins a `moq-ffi-v*` release and `FFI_SHA256.json` +pins each archive's hash. The pin stays unset until a release publishes all four +validated assets. A malformed pin, missing asset, wrong hash, wrong +feature/profile or incompatible target fails; a failed fetch never falls back to +source. + +The coordinator runs `just cpp check --ffi-dir DIR` on Linux x86, Linux ARM, +macOS ARM and Windows MSVC. Only after all four installed consumers pass may a +tag publish `moq-ffi-default--.tar.gz` with a `.sha256` each; +the publisher never clobbers or changes an existing asset. Nightly packages C++ +from these same-run `cpp-native-` artifacts; tag releases refuse +same-run inputs and use the pin. Archive comparisons and the four-host consumer +proof are in [#5740](https://github.com/moq-dev/moq/pull/5740). diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 88341e9797e..0a8f98c53b3 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -30,7 +30,7 @@ on: # Publishes only a protected release tag at the run's commit; see # "Require a release tag at the run's commit". workflow_run: # zizmor: ignore[dangerous-triggers] - workflows: ["Release FFI", "Release Go FFI"] + workflows: ["Release FFI"] types: - completed @@ -53,8 +53,7 @@ jobs: if: >- github.repository_owner == 'moq-dev' && (github.event_name == 'push' || - ((github.event.workflow_run.name == 'Release FFI' || github.event.workflow_run.conclusion == 'success') && - github.event.workflow_run.event == 'push' && + (github.event.workflow_run.event == 'push' && github.event.workflow_run.head_repository.full_name == github.repository && startsWith(github.event.workflow_run.head_branch, 'moq-ffi-v'))) permissions: diff --git a/.github/workflows/release-swift-lib.yml b/.github/workflows/release-swift-lib.yml index 32a74fab50f..7068b3cf0e6 100644 --- a/.github/workflows/release-swift-lib.yml +++ b/.github/workflows/release-swift-lib.yml @@ -31,7 +31,7 @@ on: # Publishes only a protected release tag at the run's commit; see # "Require a release tag at the run's commit". workflow_run: # zizmor: ignore[dangerous-triggers] - workflows: ["Release FFI", "Release Swift FFI"] + workflows: ["Release FFI"] types: - completed @@ -54,8 +54,7 @@ jobs: if: >- github.repository_owner == 'moq-dev' && (github.event_name != 'workflow_run' || - ((github.event.workflow_run.name == 'Release FFI' || github.event.workflow_run.conclusion == 'success') && - github.event.workflow_run.event == 'push' && + (github.event.workflow_run.event == 'push' && github.event.workflow_run.head_repository.full_name == github.repository && startsWith(github.event.workflow_run.head_branch, 'moq-ffi-v'))) permissions: diff --git a/quest/m1/README.md b/quest/m1/README.md index f578c647594..270bfff476d 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -47,7 +47,6 @@ moves what remains of them once their claims merge. - [Unused crates, scripts, and files are deleted](/quest/m1/unused-code.md) - moq-room, the moq-native tombstone, demo/throttle, sh/dart/publish.sh, demo/web's Solid deps, and unpublished packages' release notes go - [The recurring audits are fewer and carry plans, not results](/quest/m1/audit-merge.md) - m3's 13 audits become about five, each a Goal plus a short check-first list - [The CARLA bridge builds outside the root workspace](/quest/m1/carla-workspace.md) - workspace builds stop compiling the demo bridge -- [.github/ffi.md holds rules, not evidence](/quest/m1/ffi-doc-trim.md) - the FFI release doc drops one-off measurements for links to their PRs - [Draft publishing keeps the upload and drops changelog rewriting](/quest/m1/drafts-publish-trim.md) - `sh/drafts/publish.sh` and its test shrink to the datatracker upload - [rs/AGENTS.md's time-test rule matches the tree](/quest/m1/test-time-rule.md) - the rule names `#[kio::test]`, which about 4,900 tests use, and is stated once diff --git a/quest/m1/ffi-doc-trim.md b/quest/m1/ffi-doc-trim.md deleted file mode 100644 index f878de7ea0f..00000000000 --- a/quest/m1/ffi-doc-trim.md +++ /dev/null @@ -1,20 +0,0 @@ -# [S] .github/ffi.md holds rules, not evidence - -## Goal - -`.github/ffi.md` states the FFI release layout and its rules in about a -sixth of its 264 lines. The one-off evidence moves out: SHA comparisons, -runner image versions, OpenH264 assembly differences, and runner-minute -tables belong to the PRs that measured them. - -## Plan - -Planned 2026-11-09 (maintainer, /quest-plan from the deletion audit). -Decided: ✅ trim (rejected: leave as is). - -Link the PR for any evidence a rule still rests on. Drop the temporary rule -that accepts legacy per-language workflow names for a tag cut from a -`release` older than the coordinator once `release` carries the -coordinator; if it does not yet, keep that rule and say when it goes. - -Public API: none. Wire: none. diff --git a/quest/m3/cpp-ffi-reuse.md b/quest/m3/cpp-ffi-reuse.md index bdf5a550238..7c542787ebd 100644 --- a/quest/m3/cpp-ffi-reuse.md +++ b/quest/m3/cpp-ffi-reuse.md @@ -32,7 +32,7 @@ and doc samples. All four jobs then verified/extracted their checked archives and produced C++ packages. Later commits change only documentation and the tag-only release-creation notes, which that dry-run does not exercise. -The [FFI build evidence](/.github/ffi.md#c-comparison) separates historical +The [FFI build evidence](https://github.com/moq-dev/moq/pull/5740) separates historical archive/metadata comparisons from this current executable consumer proof. Historical Windows assembly and Rust LTO comparisons do not prove complete byte-for-byte code equivalence. The current four-host consumers have passed; diff --git a/sh/gh/ffi.py b/sh/gh/ffi.py index c715fdb3aca..07d9f1cc200 100644 --- a/sh/gh/ffi.py +++ b/sh/gh/ffi.py @@ -87,16 +87,12 @@ def published(jobs, language, started): def completed(language): - group, _ = LANGUAGES[language] - # Existing direct triggers and the old per-language workflow retain their - # own gates. Only the shared coordinator needs per-language attribution. + # Direct triggers retain their own gates. Only the shared coordinator needs + # per-language attribution. if os.environ["GITHUB_EVENT_NAME"] != "workflow_run": output("ready", "true") return name = os.environ["UPSTREAM_NAME"] - if name == group: - output("ready", "true") - return if name != "Release FFI": raise ValueError(f"unexpected upstream workflow: {name}") run = os.environ["UPSTREAM_RUN_ID"] diff --git a/sh/gh/ffi.test.py b/sh/gh/ffi.test.py index 5521e741cb5..4b6e67a4cd9 100644 --- a/sh/gh/ffi.test.py +++ b/sh/gh/ffi.test.py @@ -173,11 +173,9 @@ def test_missing_publisher_and_api_error_fail_loudly(self): self.env["GH_FAIL"] = "1" self.run_helper("completed", "swift", success=False) - def test_direct_and_legacy_triggers_need_no_api(self): - for event, name in [("push", ""), ("workflow_run", "Release Go FFI")]: - (self.root / "output").unlink(missing_ok=True) - self.env.update(GITHUB_EVENT_NAME=event, UPSTREAM_NAME=name) - self.assertEqual(self.run_helper("completed", "go"), "ready=true\n") + def test_direct_trigger_needs_no_api(self): + self.env.update(GITHUB_EVENT_NAME="push", UPSTREAM_NAME="") + self.assertEqual(self.run_helper("completed", "go"), "ready=true\n") self.assertFalse((self.root / "queried").exists()) def test_native_and_cross_builds_stage_the_selected_artifacts(self): From a89cb93144e86487a6c0fd92f4727fd839a66afa Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Tue, 10 Nov 2026 08:05:53 -0800 Subject: [PATCH 3/3] ci(ffi): fix wrapper gate test and clarify C++ pin rules Co-Authored-By: Claude Opus 5.5 --- .github/ffi.md | 5 +++-- sh/gh/ffi.test.ts | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ffi.md b/.github/ffi.md index cc49c5e7a48..7d54ac5ce43 100644 --- a/.github/ffi.md +++ b/.github/ffi.md @@ -39,7 +39,8 @@ extracted default-feature native input whose manifest names its version, commit, target, features and profile; CMake then generates bindings without Cargo. `cpp/moq/FFI_VERSION` pins a `moq-ffi-v*` release and `FFI_SHA256.json` pins each archive's hash. The pin stays unset until a release publishes all four -validated assets. A malformed pin, missing asset, wrong hash, wrong +validated assets, and is set only after those downloads pass the same four-host +consumer check; publication checks same-run inputs, not the downloads. A malformed pin, missing asset, wrong hash, wrong feature/profile or incompatible target fails; a failed fetch never falls back to source. @@ -48,5 +49,5 @@ macOS ARM and Windows MSVC. Only after all four installed consumers pass may a tag publish `moq-ffi-default--.tar.gz` with a `.sha256` each; the publisher never clobbers or changes an existing asset. Nightly packages C++ from these same-run `cpp-native-` artifacts; tag releases refuse -same-run inputs and use the pin. Archive comparisons and the four-host consumer +same-run inputs, using the pin when set and building from source otherwise. Archive comparisons and the four-host consumer proof are in [#5740](https://github.com/moq-dev/moq/pull/5740). diff --git a/sh/gh/ffi.test.ts b/sh/gh/ffi.test.ts index 44cada245b8..359732a79c8 100644 --- a/sh/gh/ffi.test.ts +++ b/sh/gh/ffi.test.ts @@ -53,14 +53,13 @@ test("wrapper gates preserve trusted tag inputs and inspect only their publisher ["swift-lib", "swift", "build"], ]) { const wrapper = await read(`release-${file}`); - expect(wrapper.on.workflow_run?.workflows).toContain("Release FFI"); + expect(wrapper.on.workflow_run?.workflows).toEqual(["Release FFI"]); expect(wrapper.permissions).toEqual({ contents: "read" }); const gate = wrapper.jobs["ffi-release"]; expect(gate.permissions).toEqual({ contents: "read", actions: "read" }); expect(gate.if).toContain("github.repository_owner == 'moq-dev'"); expect(gate.if).toContain("github.event.workflow_run.event == 'push'"); expect(gate.if).toContain("startsWith(github.event.workflow_run.head_branch, 'moq-ffi-v')"); - expect(gate.if).toContain("github.event.workflow_run.name == 'Release FFI'"); expect(gate.steps?.[0]?.with?.ref).toBe("${{ github.sha }}"); expect(gate.steps?.at(-1)?.run).toBe(`just gh ffi completed ${language}`); expect(gate.steps?.at(-1)?.env?.UPSTREAM_RUN_STARTED_AT).toBe(