Skip to content

test: delete low-value and trivial Rust tests - #6193

Merged
kixelated merged 7 commits into
mainfrom
test-audit-rs-delete
Oct 22, 2026
Merged

kixelated merged 7 commits into
mainfrom
test-audit-rs-delete

Conversation

@kixelated

@kixelated kixelated commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

An audit of the Rust tests found tests that cost upkeep without catching anything: copies of other tests, checks of derive/clap/serde/std behavior, restated constants, asserts that cannot fail, and replays of one old bug that a stronger test already covers. Tests should be worth their weight long-term: cover edge cases, not old bugs (the guidance itself lands in moq-dev/moq#6181).

Approach

Test-only, except one no-op source change (step 4). 194 test attributes removed across 26 crates (9869 to 9675), about 2,500 lines net. Every deletion was re-checked against current main, and for duplicates the covering test was confirmed to still exist and cover it.

Four steps, committed separately:

  1. The audit's high-confidence rows (155), grouped below.
  2. A sweep of every crate for trivial tests (test: drop trivial constant and getter tests): 43 tests deleted and 9 more trimmed of literal-only asserts (Default literals in moq-relay, moq-bench, moq-mux, hang; moq-net code points, restored in step 3). Deleted: a constant or Default field equal to a literal (7, plus 2 wire code point tests now in step 3); a constructor or getter read back, or is_empty on a fresh value (9); enum-to-str or codec-string round trips of a literal table (8); clap or serde-derive-only parsing (7); asserts that restate the implementation line for line (8); duplicates found on the way (2). Kept whenever the literal comes from an independent source: spec bytes, golden vectors, the kernel header, the WAVE/JWA/HTTP specs, another crate's default, or a codec running on fixed bytes.
  3. Wire code points pinned as one spec-value table per registry (test(moq-net): pin wire code points ...): every wire code point or error code the sweep dropped is back, as a single [(name, const, spec)] table test per registry: IETF Setup Options and message parameters (ietf::tests, every extension draft value), SUBSCRIBE_NAMESPACE message types, moq-lite roles, and session and stream error codes (the existing round-trip tests now check each code against its draft value too). A same-parity renumber now fails.
  4. AudioCodecKind discriminants made explicit (fix(hang): ...): instead of keeping codec_kind_discriminants_are_stable, the enum spells out AAC = 0 through Ec3 = 7, so a kind inserted mid-list fails to compile. Same values as before.

Audit rows, by reason

  • Duplicates (most of the PR):
    • moq-tokio tests/integration/alpn.rs (25): every pinned-version handshake over QUIC and WebTransport is repeated in broadcast.rs, which also moves a frame.
    • moq-pattern (7) and moq-json diff.rs (8): case-for-case copies of the shared golden vectors (tests/pattern.json, tests/vectors.json). The one moq-pattern assertion missing from the vectors (a/b matches /a//b/) became a new vector; js/pattern passes it too.
    • moq-json snapshot/stream (8), moq-flate (3): the same case at the codec and the track level, or a weaker copy of a superset test.
    • moq-relay (3): cli_flag_overrides_toml_{stats_enabled,cluster_id} and cluster_node_round_trip repeat provenance_merge_table rows, merge_into_relay_fragment, and cluster_connect_object_form_round_trip.
    • moq-auth (6): HS256 cycle and per-algorithm key generation (the algorithm tables sign and verify with both keys), encode non-empty (sign then verify is stronger), find_key.
    • moq-mux (10), moq-video (2), hang (2), moq-msf, moq-audio, moq-rtc (2), moq-hls, moq-gst (3), moq-stats (2), moq-ffi, moq-c (2), moq-cli, moq-net: most are the same setup as a named neighbor with fewer asserts.
  • Folded into tables: moq-relay's 14 per-field cli_does_not_clobber_toml_* pins became provenance_merge_table rows, one per value shape not yet in the table (duration, Option<String/u64/bool>, enum, path, Vec<PathBuf>, URL, socket address, flattened fields, cfg-gated listen.unix and cluster.lan.app), each checking value and origin. moq-tokio's 8 test_toml_*_survives_update_from pins became one table that checks the whole config survives the re-parse. moq-auth's Display table folded into the from_str table.
  • Derive, clap, serde, std, or third-party behavior: moq-auth PartialEq/Copy/Clone/Default and serde_json errors, moq-tokio clap flag parsing (6), moq-net Ord::max (2), moq-mux Clock: Copy, hang Role: Default, moq-rtmp hmac_test3 (an RFC vector for the hmac crate), moq-transcode example arg parsing (2).
  • Constant restatements: moq-tokio RFC 8305 stagger and resolution delay, moq-relay spec name.
  • Tautologies, trivial getters, no assertions: moq-tokio connect timeout (resolve().timeout == DEFAULT_TIMEOUT), moq-rtmp identity serializers (4) plus a setter and constructor, moq-video &Surface immutability, Display, and a bitrate no-op that cannot fail on what it names, moq-mux mkv let _ = run(..), moq-net path::test_empty, kio accessors (2), moq-sock IPv4 bind, moq-cli CORS default, moq-ffi origin_lifecycle, moq-gst frame_micros_is_stateless, moq-hls config constructor.
  • Old-bug replays: moq-mux audio_fragment_does_not_absorb_a_pause (its Opus durations are filled before the boundary logic it claims to test), moq-srt reordered_frame_is_clamped_to_the_first_packet (covered through Egress by a_reorder_is_not_a_rewind).

Counts (#[..test] attributes, before to after)

crate before after crate before after
moq-tokio 620 571 hang 165 148
moq-relay 416 398 moq-mux 1578 1561
moq-json 195 179 moq-auth 238 223
moq-net 2721 2715 moq-pattern 44 37
moq-rtmp 238 231 moq-video 438 433
moq-gst 199 195 moq-hls 197 193
moq-ffi 242 238 moq-audio 332 329
moq-flate 46 43 moq-transcode 69 66
kio, moq-c, moq-cli, moq-rtc, moq-srt, moq-stats -2 each moq-bench, moq-msf, moq-nvenc, moq-sock -1 each
total 9869 9675

Impact

  • No public API or wire change (AudioCodecKind keeps the same discriminants, now explicit). One new golden vector in rs/moq-pattern/tests/pattern.json.

Alternatives / deliberately skipped

  • All medium- and low-confidence audit rows, all "keep, reframe" rows (comment rewording only), #[ignore] tests, and the moq-net stats.rs source-grep tests (maintainer call).
  • Anything about timing or sleeps, and the relay tests/cluster_*.rs files, including the Lite04 unknown-publisher triangle the audit nominates as an old-bug pin. A separate slow-test pass owns those. Files edited by moq-dev/moq#6174.
  • rs/moq-quic: quinn's tests in our hard fork.
  • moq-tokio second-tier broadcast_* same-version tests; test_cli_disable_verify_flag (pins our own default_missing = "true").
  • Rows that no longer fit on main: moq-auth test_key_from_str_invalid_json (only test of the base64url bad-input branch), moq-net fetches_serde_roundtrips (hand-mapped serde) and detached_charge_is_noop (separate no-pool path), moq-cli cors_origin_allows_specific_allowlist (can fail), moq-gst a_restarted_pad_is_no_longer_counted_as_ended (merging its assert would change the covering test's scenario). Some rows no longer exist.

Follow-ups

  • hang data_sections_stay_off_the_wire_when_empty duplicates the first assert of empty_video_and_audio_sections_omitted; outside the audit's list, left alone.

Checks

  • Head 68a396ecb (merged main): just check passes up to nix flake check, which cannot build the runner VM image in this sandbox (unshare denied; unrelated, from main). The steps after it pass when run by hand: Rust test-changed 9155 of 9156 passed, the one failure is moq-uring a_steered_group_serves_a_shared_port hitting the shared RLIMIT_MEMLOCK on this box (untouched crate, environmental); JS test-changed passes.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

@kixelated
kixelated marked this pull request as ready for review October 21, 2026 18:44
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e02307c-9c15-409a-822e-9e88a3bb3e9b
📥 Commits

Reviewing files that changed from the base of the PR and between 5e8e0c6 and 68a396e.

📒 Files selected for processing: 93
  • rs/hang/src/catalog/audio/codec.rs
  • rs/hang/src/catalog/audio/mod.rs
  • rs/hang/src/catalog/mode.rs
  • rs/hang/src/catalog/priority.rs
  • rs/hang/src/catalog/root.rs
  • rs/hang/src/catalog/text/format.rs
  • rs/hang/src/catalog/video/codec.rs
  • rs/hang/src/catalog/video/mod.rs
  • rs/hang/src/container/frame.rs
  • rs/hang/src/snapshot.rs
  • rs/hang/src/timeline.rs
  • rs/kio/src/queue.rs
  • rs/kio/src/shared.rs
  • rs/moq-audio/src/encode/encoder.rs
  • rs/moq-audio/src/encode/producer.rs
  • rs/moq-auth/src/algorithm.rs
  • rs/moq-auth/src/claims.rs
  • rs/moq-auth/src/key.rs
  • rs/moq-auth/src/set.rs
  • rs/moq-bench/src/config.rs
  • rs/moq-bench/src/host.rs
  • rs/moq-c/src/test.rs
  • rs/moq-cli/src/args.rs
  • rs/moq-cli/src/web.rs
  • rs/moq-ffi/src/ffi.rs
  • rs/moq-ffi/src/test.rs
  • rs/moq-ffi/src/video.rs
  • rs/moq-flate/src/snapshot/mod.rs
  • rs/moq-flate/src/stream/mod.rs
  • rs/moq-gst/src/sink/pad.rs
  • rs/moq-gst/src/sink/timeline.rs
  • rs/moq-gst/tests/element.rs
  • rs/moq-hls/src/error.rs
  • rs/moq-hls/src/import.rs
  • rs/moq-json/src/diff.rs
  • rs/moq-json/src/snapshot/mod.rs
  • rs/moq-json/src/stream/decoder.rs
  • rs/moq-json/src/stream/mod.rs
  • rs/moq-msf/src/lib.rs
  • rs/moq-mux/src/catalog/tracks.rs
  • rs/moq-mux/src/clock.rs
  • rs/moq-mux/src/codec/h264/mod.rs
  • rs/moq-mux/src/codec/vp9/mod.rs
  • rs/moq-mux/src/container/consumer.rs
  • rs/moq-mux/src/container/fmp4/export.rs
  • rs/moq-mux/src/container/fmp4/import_test.rs
  • rs/moq-mux/src/container/fmp4/muxer.rs
  • rs/moq-mux/src/container/mkv/import_test.rs
  • rs/moq-mux/src/container/ts/catalog.rs
  • rs/moq-mux/src/container/ts/export_test.rs
  • rs/moq-mux/src/container/ts/stats.rs
  • rs/moq-mux/src/rate.rs
  • rs/moq-mux/src/select.rs
  • rs/moq-net/src/error.rs
  • rs/moq-net/src/ietf/cluster.rs
  • rs/moq-net/src/ietf/epoch.rs
  • rs/moq-net/src/ietf/mod.rs
  • rs/moq-net/src/ietf/subscribe_namespace.rs
  • rs/moq-net/src/lite/setup.rs
  • rs/moq-net/src/model/cache.rs
  • rs/moq-net/src/model/group.rs
  • rs/moq-net/src/model/origin.rs
  • rs/moq-net/src/model/time.rs
  • rs/moq-net/src/path/mod.rs
  • rs/moq-nvenc/src/safe/session.rs
  • rs/moq-pattern/src/pattern.rs
  • rs/moq-pattern/tests/pattern.json
  • rs/moq-relay/src/auth.rs
  • rs/moq-relay/src/cluster.rs
  • rs/moq-relay/src/config.rs
  • rs/moq-rtc/src/codec/vp9.rs
  • rs/moq-rtc/src/session.rs
  • rs/moq-rtmp/src/rml/handshake/mod.rs
  • rs/moq-rtmp/src/rml/messages/types/audio_data.rs
  • rs/moq-rtmp/src/rml/messages/types/video_data.rs
  • rs/moq-rtmp/src/rml/time.rs
  • rs/moq-sock/src/bind.rs
  • rs/moq-srt/src/server.rs
  • rs/moq-stats/src/produce.rs
  • rs/moq-tokio/src/client.rs
  • rs/moq-tokio/src/connection.rs
  • rs/moq-tokio/src/listen.rs
  • rs/moq-tokio/src/quic.rs
  • rs/moq-tokio/src/server.rs
  • rs/moq-tokio/src/unix.rs
  • rs/moq-tokio/tests/integration/alpn.rs
  • rs/moq-tokio/tests/integration/main.rs
  • rs/moq-transcode/examples/transcode.rs
  • rs/moq-transcode/src/ladder.rs
  • rs/moq-video/src/convert.rs
  • rs/moq-video/src/decode/backend/openh264.rs
  • rs/moq-video/src/encode/encoder.rs
  • rs/moq-video/src/size.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T23:12:31.250189Z 68a396e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2761ce2aab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 290 to 292
assert_eq!(HOP_ID % 2, 0);
assert_eq!(RELAY_COST % 2, 0);
assert_eq!(HOP_PATH % 2, 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain assertions for the registered wire IDs

If RELAY_COST, HOP_PATH, or ROUTE_COST is accidentally changed to another value with the same parity, this reduced test and the Rust encode/decode round trips will still pass, while the draft and JavaScript peer continue using the registered IDs and interoperability breaks. Keep the literal assertions or replace them with independent golden wire bytes rather than checking only parity.

AGENTS.md reference: rs/moq-net/AGENTS.md:L3-L5

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8617fcf: every dropped wire code point is pinned again in one spec-value table per registry (ietf::tests covers HOP_ID, RELAY_COST, HOP_PATH, ROUTE_COST and the other extension values). (Written by Claude Opus 5.5)

kixelated and others added 5 commits October 21, 2026 12:00
Duplicates, derive/clap/serde restatements, constant restatements and tautologies. Per-field merge pins fold into table tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Duplicates of the shared golden vectors, cross-level duplicates, and asserts that cannot fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Duplicates, derive and third-party restatements, tautologies and old-bug replays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Constants and defaults restated as literals, constructors read back, fixed-string round trips, and asserts that restate the implementation line for line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setup Options, message parameters, message types, roles, and session and stream error codes each check every value against the draft, so a same-parity renumber fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated force-pushed the test-audit-rs-delete branch from 2761ce2 to 8617fcf Compare October 21, 2026 19:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8617fcf51e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -124,36 +124,3 @@ impl FromStr for AudioCodec {
Ok(Self::Unknown(s.to_string()))
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the discriminant regression guard

Removing codec_kind_discriminants_are_stable leaves no repository-wide assertion for this public enum's implicit as values. If a future codec kind is inserted anywhere but the end, the change compiles while silently renumbering every later variant; retain this guard or assign explicit discriminants so the required append-only invariant is enforced.

AGENTS.md reference: rs/AGENTS.md:L47-L48

Useful? React with 👍 / 👎.

@kixelated kixelated Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ac843a5: AudioCodecKind now has explicit discriminants AAC = 0 through Ec3 = 7, so the type enforces the append-only values itself. A kind inserted mid-list without a number collides with the next explicit discriminant and fails to compile. (Written by Claude Opus 5.5)

kixelated and others added 2 commits October 21, 2026 15:53
The deleted discriminant test was the only guard on the append-only
as values; explicit discriminants make the type enforce it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge summary for head 68a396ecba1c5aabf41c33d23e37e07b03cc3216:

  • Test-only cleanup: 194 low-value or duplicate Rust tests removed across 26 crates. The one source change makes AudioCodecKind discriminants explicit, with the same values as before.
  • Review: both Codex findings were fixed (wire code points pinned again in one spec table per registry in 8617fcf, explicit AudioCodecKind discriminants in ac843a5), and each has a reply. Codex gave the final head a thumbs-up with no findings.
  • CI: CodeQL passes. On main PRs, Check is skipped by design, so the merge queue runs that gate.
  • Decisions: none outstanding. The skipped audit rows and the one follow-up are listed in the description.

Enabling auto-merge.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit df45b36 Oct 22, 2026
10 checks passed
@kixelated
kixelated deleted the test-audit-rs-delete branch October 22, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant