Skip to content

chore(lint): require a reason on every suppression and expect where unconditional - #6159

Merged
kixelated merged 31 commits into
mainfrom
quest/m0/audit-lints
Oct 23, 2026
Merged

kixelated merged 31 commits into
mainfrom
quest/m0/audit-lints

Conversation

@kixelated

@kixelated kixelated commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes the m0 run of the lint override and deprecation audit and hands it to m1.

Enforcement

  • A root [workspace.lints] enables clippy::allow_attributes_without_reason, and every workspace crate except moq-quic opts in with lints.workspace = true. Under CI's -D warnings, a suppression with no reason now fails clippy.
  • The loom check-cfg that kio and moq-net declared moved into the workspace table.
  • moq-quic keeps its own [lints.rust] and [lints.clippy] tables with quinn's lints, so they reach its benches and examples too, and repeats allow_attributes_without_reason there. Cargo can't extend the workspace table per crate.
  • Every unconditional suppression is now #[expect(..., reason = "...")], so a stale one fails as unfulfilled_lint_expectations.
  • A suppression that depends on features or targets uses cfg_attr, or stays an allow with its reason. One example is large_enum_variant on 64-bit only, because the wasm lane lints moq-net too.
  • sh/rs/model-markers.py now walks over attributes that rustfmt wraps across several lines. It recognizes one by rustfmt's shape: a )] alone at the #[ line's indent, with every line between indented deeper. The contents are never parsed, and code ending in )] or )]; can't lend its marker to the next item. Each case has a regression test.

Stale suppressions removed

  • 27 match_like_matches_macro in lite/version.rs became matches!, including four that arrived from main during this run.
  • 27 non_camel_case_types on moq-c repr(C) structs. Rustc doesn't fire it there; the enums keep it.
  • moq-quic's crate-wide cognitive_complexity and too_many_arguments were dropped. The four functions that still need too_many_arguments carry an expect.
  • type_complexity (three, via a StreamOp alias in moq-tokio).
  • is_multiple_of in Timestamp's Debug.
  • Plus stale arc_with_non_send_sync, field_reassign_with_default, disallowed_methods/disallowed_types, unused_mut, needless_lifetimes, deprecated, and pedantic allows.

Suppressions from main

moq-dev/moq#6135 landed first with more than 80 bare allow(clippy::disallowed_methods, clippy::disallowed_types), and other PRs added a few more. Each now has a reason and is an expect, except where noted:

  • Test and bench modules say they read the host clock. The disallowed_types half was dropped where nothing in the module names a disallowed type, and one attribute that covered nothing was deleted.
  • A test-only use behind features (moq-video's capture tests, moq-audio's playback tests) is a cfg_attr on those features.
  • moq-relay's idle-listener tests stay an allow, since the benchmark that includes the module compiles the tests out.
  • The device and pacing threads that std::thread::sleep moved their comment into the reason.
  • qmux, a new crate, joins the workspace lint table. Its validate_protocol expects dead_code only when no transport that calls it is enabled.

Other languages

  • TypeScript: Biome found no unused biome-ignore. Each @ts-expect-error in js/publish now names the DOM types it covers.
  • TypeScript deprecations: A one-off typescript-eslint no-deprecated sweep found js/publish's file import on mediabunny's deprecated sync track getters, which now read through the async ones. It ran on typescript 6 outside the repo, since typescript-eslint doesn't support TS 7 yet.
  • Python: ruff now selects RUF100 at the root and in demo/carla/sim, and the stale noqa directives it found are gone.
  • Clean: Go (staticcheck SA1019), Kotlin (uncached compile with no w: lines), and Dart (--fatal-infos) needed no changes.
  • Clippy fixes: the moq-auth examples and the moq-mux jitter bench failed clippy under --all-targets, so they are fixed.

Successor

  • quest/m0/audit-lints.md moved to quest/m1/audit-lints.md at the end of m1's Required. It keeps the Goal and the recurrence paragraph.
  • Its Plan now records this run's baselines and where the next run should start:
    • conditional allows
    • the macOS and Windows lanes, which clippy never runs
    • pyright's reportUnnecessaryTypeIgnoreComment
    • Swift

Relation to other PRs

  • moq-dev/moq#6145 made tool warnings fatal. This PR handles suppressions and deprecations; the two are complementary.
  • moq-dev/moq#6117 landed a bare allow(clippy::disallowed_methods) on rs/moq-net/benches/group.rs; it is now an expect with its reason.
  • moq-dev/moq#6135 landed first, so this PR gave its allows their reasons (above).

Decisions

Picked without a prompt, as the recommended option:

  • moq-quic keeps a crate-level [lints] table rather than per-target attributes, since Cargo applies a manifest table to every target and one place stays in sync.
  • An expect that one feature lane fulfills and another doesn't becomes a cfg_attr on the feature that needs it, rather than an allow.

API and wire impact

  • None. No public signature changes.
  • The from_str methods in hang, moq-auth, and moq-msf keep an expect(clippy::should_implement_trait). Switching them to FromStr is tracked by FromStr parsers.

Checks

On the merged head:

  • just check, except nix flake check, whose VM image build needs user namespaces the local host denies
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo clippy --workspace --exclude moq-net-fuzz --exclude moq-quic-fuzz --all-targets --all-features -- -D warnings, the nightly features lane
  • just rs wasm, capture, uring, quic-features, net-features, and tokio-features --all
  • cargo clippy -p moq-net --all-targets --no-default-features
  • cargo clippy -p qmux --all-targets --all-features
  • cargo clippy -p moq-video --features capture,openh264 --all-targets
  • model-markers.py and its tests

Not run:

  • macOS and Windows clippy. CI only cargo checks them, so an expect on Apple or Windows code is verified by reading only.
  • pyright's unnecessary-ignore report.

cargo clippy -p qmux --no-default-features fails on an unused MAX_FRAME_SIZE. That is pre-existing on main, and no lane runs it.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 13 commits October 20, 2026 21:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 24 feature predicates suppressed match_like_matches_macro to keep a
two-arm match. `matches!` over the old versions still lists them
explicitly and falls forward for a new one, so the suppressions go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The suppression said is_multiple_of was unstable on Rust 1.85; it is
stable since 1.87 and the workspace floor is 1.91.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three state variants spelled out OpBox<(S, Option<Result<T, E>>)> under
type_complexity allows. A StreamOp alias names it once.

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

`--all-targets` clippy failed on both: the moq-auth examples read
SystemTime::now under the crate's clock ban (Claims takes SystemTime, so
the examples expect the lint), and the jitter bench dropped a must_use
Poll.

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

typescript-eslint's no-deprecated flagged six reads of mediabunny's
deprecated synchronous track properties (rotation, display size, codec,
sample rate, channel count). They are read once while probing, before
the clock is pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RUF100 fails a noqa that no longer suppresses anything. Five were stale:
BLE001 is not a selected rule, F401 never fires on a star import, and
ruff accepts an import after sys.path.insert.

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

A [workspace.lints] table enables clippy::allow_attributes_without_reason,
and every crate opts in. kio's and moq-net's loom check-cfg moves into it;
moq-quic's quinn lints move to crate attributes, since a crate can't
extend the workspace table.

Each unconditional clippy suppression, and each always-firing rustc one
(naming, missing_docs, deprecated), is now #[expect], so it fails once
the lint stops firing. Suppressions that depend on features, targets, or
pointer width use cfg_attr or stay an allow with their reason.

Converting surfaced stale suppressions, which are removed: 27 repr(C)
naming allows in moq-c (rustc skips repr(C) structs), off-by-default
pedantic and restriction lints in moq-v4l and moq-nvenc, never-firing
large_enum_variant, too_many_arguments, type_complexity,
field_reassign_with_default, needless_lifetimes, and arc_with_non_send_sync
(moq-net, moq-flate, moq-mux), an unused_mut in moq-relay, disallowed_types
in test modules, the moq-uring clock module's ban opt-out, and a
deprecated allow on a field that is no longer deprecated. moq-quic's
crate-wide too_many_arguments and cognitive_complexity allows become four
per-function expects.

model-markers.py steps over attributes rustfmt wraps, so a marker above a
long cfg_attr still counts.

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

Copy link
Copy Markdown
Collaborator Author

Quest run complete: the m0 lint audit finished and the successor is queued in m1 Required. Opened ready for review; just check passed on the merged head. No blocking decisions. One follow-up needs a maintainer call: moving from_str to FromStr in hang, moq-auth, and moq-msf is a breaking change, recommended for the next breaking window.

(Written by Claude Opus 5.5)

@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-23T15:07:25.555326Z 5e47b6b 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.

kixelated and others added 2 commits October 21, 2026 16:00
Resolve conflicts and give main's new suppressions reasons: the async-only
dead_code allows in moq-net, the server-only poll_playable allow in moq-hls,
the group bench's disallowed_methods (now an expect), and has_drop_code's
match_like_matches_macro (now matches!).

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

Copy link
Copy Markdown
Collaborator Author

Merged origin/main and resolved the conflicts (quest/m1/README.md keeps both audits, moq-tokio/Cargo.toml keeps main's required-features plus [lints] workspace = true, and the moq-net/moq-hls hunks take main's signatures).

Main's new bare suppressions now carry reasons:

  • the async-only dead_code allows in moq-net track.rs and resume.rs
  • moq-hls poll_playable's server-only dead_code
  • moq-net/benches/group.rs's disallowed_methods, now an expect
  • has_drop_code's match_like_matches_macro, now !matches! (still defaults forward)

Local checks on bb4c19008cc255397e22c94c374fec1ac37452c8: clippy lanes, fmt, model markers, Biome, ruff, quest, markdown, shell, taplo, and the full Rust (9409), JS, and Python suites pass. nix flake check could not build its VM image here (user namespaces denied), which is environmental. moq-cli::integration export::redundant_importers_switch_through_bufferbloat_on_lite_07 failed once under heavy host load and passed alone and in the full rerun.

Codex reviewed this head with no findings. Enabling auto-merge.

(Written by Claude Opus 5.5)

@kixelated
kixelated enabled auto-merge October 21, 2026 23:24
kixelated and others added 2 commits October 21, 2026 21:22
Brings main's new suppressions under the reason rule: the moq-archive
producer bench and moq-net scan timer become expect with a reason, and
the five large_enum_variant allows that only fire under a workspace
all-features build keep allow with a reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated added this pull request to the merge queue Oct 22, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merged origin/main twice (the second picks up moq-dev/moq#6239's GOAWAY change) and resolved the conflicts: moq-archive takes main's producer layout (the old writer/proof are gone), goaway.rs and track.rs take main's code with this PR's async-only reasons, and the quest READMEs keep both audits in m1.

Main's new bare suppressions now carry reasons:

  • moq-archive/benches/producer.rs and the moq-net subscriber scan timer: expect with a reason.
  • Five large_enum_variant allows from moq-dev/moq#6155 (moq-mux fmp4 export and muxer, moq-hls rendition and its test, moq-rtc egress): they only fire under the nightly workspace --all-features build, so they stay allow with a reason saying so, like moq-mux's catalog consumer.

Checks on 1c8a047b82d4308b13e801af96ebc5355e606259: cargo clippy --workspace --all-targets -D warnings and just check pass (9249 Rust, JS, and Python tests), except nix flake check, which can't build its VM image here (user namespaces denied). Codex reviewed the previous head with no findings; this delta is the main merge plus mechanical reasons. Auto-merge is re-enabled on this head.

(Written by Claude Opus 5.5)

@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: 1c8a047b82

ℹ️ 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 thread sh/rs/model-markers.py Outdated
Comment thread rs/moq-quic/src/lib.rs Outdated
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 22, 2026
kixelated and others added 3 commits October 22, 2026 15:24
# Conflicts:
#	quest/m0/README.md
#	quest/m0/audit-lints.md
#	quest/m1/README.md
#	rs/moq-cli/Cargo.toml
#	rs/moq-net/src/ietf/subscriber.rs
#	rs/moq-net/src/model/frame.rs
#	rs/moq-net/src/model/group.rs
#	rs/moq-net/src/model/track.rs
#	rs/moq-video/src/decode/consumer.rs
#	rs/moq-video/src/encode/producer.rs
…s on every target

- Every bare suppression that main added since the branch point (mostly the
  moq-clock test allows) now says why, and is an `expect` where unconditional.
  Lints those `expect`s never hit are dropped, and stale ones are deleted.
- qmux joins the workspace lint table.
- moq-quic gets its own `[lints]` tables again, so quinn's lints reach its
  benches and examples, plus `allow_attributes_without_reason`.
- model-markers.py steps over a wrapped attribute only when its bracket closes
  exactly on a `)]` line, so code ending in `)];` can't lend its marker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t quest

The x86_64 all-features `large_enum_variant` warnings no longer fire, and the
clippy suppression baseline now counts main's moq-clock test allows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	quest/m0/README.md
#	quest/m1/README.md
@kixelated
kixelated removed this pull request from the merge queue due to a manual request Oct 23, 2026
@kixelated
kixelated enabled auto-merge October 23, 2026 02:08
@kixelated
kixelated added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 23, 2026
kixelated and others added 2 commits October 22, 2026 22:55
# Conflicts:
#	rs/moq-net/src/model/track.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated enabled auto-merge October 23, 2026 05:56
@kixelated
kixelated added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 23, 2026
# Conflicts:
#	rs/moq-net/src/model/origin.rs
#	rs/moq-video/src/encode/producer.rs
@kixelated
kixelated added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
The wasm32 build lays FetchServe out without the gap, so an expectation
fails there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 23, 2026
kixelated and others added 2 commits October 23, 2026 07:59
# Conflicts:
#	rs/moq-relay/Cargo.toml
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated added this pull request to the merge queue Oct 23, 2026

@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: 5e47b6b997

ℹ️ 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 thread Cargo.toml
Comment on lines +122 to +124
[workspace.lints.clippy]
# Every suppression says why, so the next lint audit can judge it.
allow_attributes_without_reason = "warn"

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 Opt test-env into the workspace lint table

Checked cargo metadata for the workspace: rs/test-env is a workspace member, but its manifest is the sole member besides the deliberately custom moq-quic manifest without lints.workspace = true. Consequently this new lint is not enabled for that crate, so a future reasonless suppression there will still pass the workspace Clippy gate; opt rs/test-env/Cargo.toml into the workspace lint table as the other members are.

AGENTS.md reference: AGENTS.md:L23-L23

Useful? React with 👍 / 👎.

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