Repository navigation
ci: Rust tests run when a file they read outside rs changes - #9271
Conversation
Quest-Claim: 89eb59e90651f0f6
sh/rs/reads.sh lists every path a Rust source reads outside its crate. select.sh seeds the reading crate from it, replacing the hand-kept NixOS module seed, and select.test.py holds dispatch's rs scope to cover every read outside rs/, run by `just gh check` on every diff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
ℹ️ No critical issues — one rough edge in the read lister's heuristic.
Approach: sound. It derives the crate-to-read mapping from the sources and uses it for both seeding and the scope check, so the hand-kept nix seed goes away and a new outside read fails just gh check in the PR that adds it.
Reviewed changes
I reviewed the full diff, ran sh/rs/reads.sh against the branch, checked the relay's new :(glob) listing, and ran sh/rs/select.test.py. The new tests pass. The three failures are from the sandbox: just is missing and clippy can't run.
sh/rs/reads.sh: lists outside-crate reads frominclude_*!,#[path], and../literals in files that mentionCARGO_MANIFEST_DIR. Its output covers every read the PR description names.sh/rs/select.sh: turns each read glob into a regex and seeds the reading crate when a changed path matches. This replaces the hard-codednix/modules/moq-relay.nixseed and fixes thebenches/sessiongap.sh/dispatch.sh: thersscope gains narrow patterns for the TOML configs, the relay unit, the Bun scripts, the jitter corpora, and the e2ee vectors.sh/rs/select.test.py:test_dispatch_scope_covers_rust_readsprobes each read outsiders/against the scope, andtest_a_read_selects_its_readercovers the seeds.- Rust literal rewrites: run from
rs/moq-relay,git ls-files ':(glob)../../{demo/relay,packaging,test}/**/*.toml'returns the same 26 files the old root listing plus extension filter did. Thebun()andcase()rewrites don't change behavior.
claude-opus-5-5 | 𝕏
reads.sh prints each read's source file and line, so a `../` string that is no path, in a file that mentions CARGO_MANIFEST_DIR, fails the scope check with a message pointing at that literal. The file-wide rule stays: narrowing it to one statement would miss a read built across statements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the last review, the read lister now records where each read comes from. I ran sh/rs/reads.sh on the branch, and every line ends in a plausible file:line, such as rs/moq-relay/src/config.rs:1115 for test/**/*.toml.
sh/rs/reads.shnames each read's source: it prints<crate dir> <glob> <file>:<line>, and a header comment explains why theCARGO_MANIFEST_DIRrule covers the whole file.sh/rs/select.shtakes the glob as the second field: it parses the new three-field format and still keys only on crate and glob.test_dispatch_scope_covers_rust_readscites the source: both failure messages name the source line and say to keep a non-path../literal out of such files. This answers the earlier finding about false reads, and that thread is resolved.
claude-opus-5-5 | 𝕏

Finishes quest/m0/ci/rust-test-reads.md.
Problem
When a PR changed a file that a Rust test reads from outside
rs/, the gate skipped that test. moq-dev/moq#8459 added atest/**.tomlthat broke moq-relay'srepository_configs_load, and the gate had scoped Rust out. Thersscope insh/dispatch.shlisted only the NixOS module, andsh/rs/select.shmapped that one path to moq-relay by hand. Grepping found more reads the scope misses than the quest listed: moq-net's Bun scripts (test/interop/*.ts), moq-e2ee's vectors (drafts/moq-e2ee-01-wip.json), moq-mux's clock corpus, and the relay's packaged systemd unit.Approach
sh/rs/reads.shlists every path a Rust source underrs/reads outside its crate, as<crate dir> <glob> <file>:<line>, the last naming the literal behind the read. It counts three kinds of literal: aninclude_*!or#[path]literal (resolved from its file), and a literal that climbs out with../in a file that usesCARGO_MANIFEST_DIR(resolved from the crate). A format interpolation such as{name}counts as one path segment. A#[path]to amod.rscovers its whole directory. It takes about 0.3 s, using only grep and jq.sh/rs/select.shseeds the reading crate whenever a changed path matches one of its reads, then walks to dependents as before. This replaces the hand-written NixOS seed and needs no list of reads to maintain. It also fixes an existing gap insiders/: a change tors/moq-net/benches/session/used to select moq-net alone, although moq-relay's bench includes that module.rsscope insh/dispatch.shgrows narrow patterns for the reads outsiders/:(demo/relay|packaging|test)/**.toml, the relay's unit,test/interop/*.ts, the fivetest/*/…tsscripts moq-tokio and moq-uring run,doc/concept/audio-jitter/**.json, and the e2ee vectors.SelectTest.test_dispatch_scope_covers_rust_readsinsh/rs/select.test.pyprobes each read outsiders/against the scope. A plain read probes its file. A directory read probes a new file inside it. A glob probes a new file wherever a wildcard leaves room, such astest/added.tomlandtest/added/added.toml. On failure it names the crate and the path.just gh check, which gates every diff, runs it, so a new read fails in the PR that adds it. A read of the whole repository fails too.repository_configs_loadlists:(glob)../../{demo/relay,packaging,test}/**/*.tomlfrom its crate, where it used to list everything from the repo root.bun()takes a script stem and appends.ts.case()joins one{name}.jsonpath.js/e2ee, and the configs and unit ship in packages.Impact
No public API or wire change. CI only: the gate now runs Rust for changes to the paths above. Across main's last 1000 first-parent commits (2026-11-07 to 2026-11-20), 39 touched a widened path. 12 of those (1.2%) did not already select Rust, and #8459 is one of the 12. Those 12 run only the reading crate and its dependents, not the whole workspace. A change to
test/interop/*.tsreaches moq-net and so selects almost all of it.Alternatives
reads.shat query time instead of checking a literal pattern. Rejected: the pattern can stay narrower than a read, for example.tomlonly undertest/, and the maintainer's decision was to widen the scope and check it.test/interop/*.tsimportingjs/net. The JS lane tests those packages.test/interop/clients/rust/. They are moq-cli examples that only the interop harness runs.Decisions
Made without asking, for review:
reads.sh(the quest's recommendation).just gh checkon every diff, which adds about 1 s.../literal in a file that mentionsCARGO_MANIFEST_DIRstill counts as a read file-wide, andreads.shnow prints each read'sfile:line, which the scope check's failure names, with a hint to keep a non-path literal out of such files. ✅ attribute file-wide reads (rejected: count only literals in the statement that mentionsCARGO_MANIFEST_DIR, which would silently miss a read built across statements, as moq-relay's config test does today; rejected: drop reads that match no tracked file, which still keeps"../../.."and misses a glob that matches nothing yet). Answers Pullfrog's finding.Caused by
rsscope never covered reads outsiders/other than the NixOS module. The gap surfaced in moq-dev/moq#8459, and moq-dev/moq#8486 moved the fixture without fixing the scope.Validation
test/added/relay.tomland nothing else changed, the oldsh/dispatch.sh check HEAD --queryprintedrust=falseand the new one printsrust=true.select.shselects moq-relay (plus moq-cli). With a bogus key in that file,repository_configs_loadfails.test/dropped from the new TOML pattern, it fails withrs/moq-relay reads test/**/*.toml, which sh/dispatch.sh's rs scope misses. With main's relay test restored, it fails withrs/moq-relay reads the whole repository. It passes on the branch.select.shon single paths:doc/concept/audio-jitter/outage.jsonselects moq-audio,test/interop/varint.tsselects moq-net,test/max-age/client.tsselects moq-tokio, andrs/moq-net/benches/session/added.rsselects moq-relay.test/interop/clients/js/added.ts, a docreference.ts, andREADME.mdselect nothing. The newtest_a_read_selects_its_readercovers the same cases.python3 sh/rs/select.test.py(27 tests),python3 sh/dispatch-query.test.py(42), andsh/gh/test-inventory.pypass.cargo nextest run -p moq-net -p moq-relay --libpasses 3810 tests. The moq-audio jitter corpus tests and moq-net's Bun interop tests pass. shfmt, shellcheck, ruff, cargo fmt, andquest checkare clean.just ci. Changingsh/dispatch.shturns it into the whole repository's suite, which the merge queue runs anyway.Follow-ups
None.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, low effort (iterate, M, arm B)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with high effort)
Review
Rewritten by
quest reviewafter each round.Head: 33c1158
Base: origin/main at 36a5c1a
Risk: medium,
The Rust merge-gate selection changes could skip required checks or select unnecessary work for contributors building on main; the changes preserve published APIs and wire formats and are fully undone by a revert.Classified: medium by Codex, gpt-6.1-sol, low effort, session
01a1fc7e-5263-7a63-8edf-7e96f67a9b11Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1fbb8-68c6-79d1-9a2d-0b0dd17f67f4, round 2Score: 10/10,
The incremental change adds source locations and updates both consumers consistently, with no actionable defects found by code inspection; builds and tests were not run as instructed.Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none