Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions quest/m0/ci/platform-cross-lint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# [M] The merge gate lints macOS and Windows code from Linux

## Goal

`just ci`, which the merge queue runs on its Linux runner, runs clippy on the
changed Rust crates and their dependents for macOS and Windows targets, so a
platform-gated compile error or unfulfilled lint expectation fails the queue
instead of the nightly macOS and Windows lanes after it lands. Tests stay on
Linux, and real macOS and Windows runners stay out of the gate.

## Plan

From moq-dev/quest's 2026-11-18 mistake audit
([moq-dev/quest#786](https://github.com/moq-dev/quest/pull/786)): 10 runtime
escapes came from Linux-only behavior or platform-gated code that only the
nightly lanes, or no lane, exercised. Six of them were `just check` failures
on macOS, fixed by [moq-dev/moq#8538](https://github.com/moq-dev/moq/pull/8538).
Two of those were unfulfilled `#[expect]`s that only a macOS build saw, one of
them a clippy lint.

Decided 2026-11-19 (maintainer):

- ✅ A cheap cross-target check from Linux in the merge gate (rejected: real
macOS and Windows runners in the gate; drop). The pick of
[moq-dev/quest#786](https://github.com/moq-dev/quest/pull/786).
- ✅ clippy, not `cargo check` (rejected: `cargo check`). Unfulfilled clippy
expectations are part of the class, and clippy costs about what check does.
Scope is not part of that choice. It stays: changed crates plus dependents.

Recommended:

- Reuse `sh/rs/select.sh`'s `platform` selection and flags (moq-gst excluded,
the cli's device features on). Today it runs `cargo check` on native hosts
through `just rs windows`/`macos`. The gate's run lints with
`--target` instead.
- Targets: `aarch64-apple-darwin`, and `x86_64-pc-windows-msvc`, the target
`release-binary.yml` ships. The [code audit](/quest/m3/audit-code.md) already
ran clippy for macOS and `x86_64-pc-windows-gnu` from Linux with a
rust-overlay toolchain and `zig cc` for build scripts. Use the gnu target
only if msvc's SDK cannot come from Nix, and say why in the PR.
- A crate whose build script cannot cross-build fails loud. If it must be
left out, exclude it by name with the reason beside the exclusion, as
moq-gst is today; the nightly native lanes still cover it.
- Measure what it adds to a queue run, both a typical diff and a moq-net
edit. Put the measurements in the PR, as the [CI epic](/quest/m0/ci/README.md)
asks of a change that slows the gate.
- Show it catching a known break, such as reverting one of #8538's
`#[expect]` fixes.
- Once it gates, delete the code audit's step that runs the cross-target
clippy by hand. Also update `CONTRIBUTING.md`'s advice to dispatch
`platform.yml` for cfg-gated code, which then only needs dispatching to
run tests.

## Related

- [Code audit](/quest/m3/audit-code.md) - runs the same cross-target clippy by hand today
54 changes: 54 additions & 0 deletions quest/m0/ci/rust-test-reads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# [M] Rust tests run when a file they read outside rs changes

## Goal

A change to any file a Rust test or build reads selects the Rust work that
reads it in `just check` and `just ci`, the way a change to the test does. One
check keeps it so: a new Rust read of a path the `rs` scope in
`sh/dispatch.sh` misses fails `just check`, naming the path. Today such a
change skips the Rust tests, so a broken read lands.

## Plan

Caused by [moq-dev/moq#8459](https://github.com/moq-dev/moq/pull/8459),
fixed by [moq-dev/moq#8486](https://github.com/moq-dev/moq/pull/8486): a new
`test/**.toml` broke a relay test that parses it, and the gate had scoped the
Rust tests out. #8486 moved the file but left the scope as it was. The
2026-11-11 and 2026-11-18 mistake audits in moq-dev/quest
([moq-dev/quest#641](https://github.com/moq-dev/quest/pull/641),
[moq-dev/quest#786](https://github.com/moq-dev/quest/pull/786)) both kept it.

Decided 2026-11-19 (maintainer): ✅ each read either moves into its crate or
is covered by widening the `rs` scope, with no hand-kept list of what a crate
reads (rejected: each crate declaring its outside reads in `Cargo.toml`;
moving every read in-crate as the only option).

Reads outside `rs/` that the `rs` scope misses today, found by grepping
`CARGO_MANIFEST_DIR` joins and `include_*!` paths:

- `test/receive-credit/sender.ts`, `test/max-age/client.ts`,
`test/stream-limits/client.ts`, `test/relay-fill/relay.ts`, and
`test/datagram-tracks/client.ts`, which moq-tokio's and moq-uring's
integration tests run.
- `doc/concept/audio-jitter/{stretch,comfort}/*.json`, which moq-audio
includes.
- moq-relay's `repository_configs_load`, which loads every tracked TOML
under `demo/relay`, `packaging`, and `test`.

Recommended:

- Move a file into its crate when only Rust reads it. Widen the scope for a
file that lives where it does for another reason, such as a TS script the
JS side also checks, or a config a deployment ships. A widened path selects
the whole workspace, since nothing else maps it to a crate. Narrow each
widened pattern to the files read, such as `test/**.toml` rather than
`test/`, and give the PR a count of how often those paths changed in recent
history. That count is the gate's cost.
- `sh/rs/select.sh`'s seed from `nix/modules/moq-relay.nix` to moq-relay is
the same kind of hand-kept mapping, so fold it into the same rule.
- The check finds the outside paths a Rust source names, whether through
`CARGO_MANIFEST_DIR` or an `include_*!` path, and fails when the `rs` scope
does not match one. `sh/rs/select.test.py` already checks that the scope
covers targets outside their crate; extend that rather than add a script.
- Show that the check fails on #8459's shape, a new `test/**.toml`, before the
fix, and passes after.