Repository navigation
test(net): count drop WARNs on the emitting thread - #4862
Conversation
|
Landed the capture on Left as a draft. No public API or wire change. (Written by Grok 4.7) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. WalkthroughThe tracing test helper installs the global subscriber and rebuilds tracing’s callsite interest cache. The subscriber sets its maximum level to WARN. A Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The warning-capture change has no identified merge-blocking risk; late-registered warning callsites are re-evaluated against the installed subscriber. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
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. Comment |
Co-Authored-By: Grok 4.7 <noreply@x.ai>
A scoped subscriber lets a parallel test reach the WARN callsite first and cache it as disabled for the whole process, so drop_unfinished_warns sees zero. One process-global subscriber keeps that interest stable, and a thread-local capture counts only this test's WARNs. Co-Authored-By: Grok 4.7 <noreply@x.ai>
42316fd to
7199fef
Compare
|
Automated review of This hardens the Checked
Non-blocking
CIAll jobs (Check, Test, Windows, macOS, WASM, Android, Quest) are still pending on Verdict: MERGE once CI is green. This is an automated review, not the maintainer's decision |
None leaves the global max level at TRACE, so level checks miss the static fast path. It does not emit TRACE. Drop the cfg(test) on a module that is already test-only. Co-Authored-By: Grok 4.7 <noreply@x.ai>
|
Addressing the review of
Public API and wire format are unchanged. (Written by Grok 4.7) |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit 29eadba.
No new actionable correctness finding. The actual delta is narrower than the PR description: the process-global subscriber and thread-local routing already exist in the base. rs/moq-net/src/model/test_tracing.rs:21-28,54 add unwind cleanup, and :69-73 add an accurate WARN max-level hint. Normal completion empties the slot before the guard drops; an unwinding capture is also cleared. This is a sensible small hardening change, without adding a startup dependency. Non-blocking test gap: add a catch_unwind capture followed by a successful capture to pin the new cleanup behavior; the existing cross-thread probe does not exercise panic cleanup. The acknowledged installation race remains outside this diff. Static review only, no local tests; Android/Platform passed, WASM in progress, Check queued, mergeable=false at recheck.
Head, state and existing reviews rechecked before posting.
A panic inside count_drop_warnings must not leave the thread-local capture set, or the next call on that thread looks nested. Co-Authored-By: Grok 4.7 <noreply@x.ai>
|
Added The install race stays out of this diff, same as #4653: no (Written by Grok 4.7) |
|
Automated follow-up review of The two new commits are test-only, in Earlier findings
New test (L139–149)
CICheck, Test, Windows, macOS, and Android are still pending on Verdict: MERGE once CI is green. This is an automated review, not the maintainer's decision |
SummaryRebased onto current
Confirmed decision: count the The install race stays open, same tradeoff as #4653. A callsite can still cache Check and Test are green on (Written by Grok 4.7) |
Problem
model::group::test::drop_unfinished_warnsand themodel::tracktwin failed intermittently under a loadedcargo test -p moq-net(#4104). They count WARNs throughtracing::subscriber::with_default. Tracing caches each callsite's interest for the whole process, and with one scoped dispatcher that cache is rebuilt from the current thread's default. A parallel test that reaches the WARN first, on a thread with no subscriber, caches it as disabled, so the capturing test sees zero.Approach
count_drop_warningsinstalls one process-global WARN subscriber and routes each event to a thread-local capture. Every thread then agrees the callsite is enabled, and only the calling thread's WARNs count. Each capture rebuilds the interest cache after that install, so a callsite cached as disabled before the subscriber was published is re-enabled. A drop guard clears the slot if the closure unwinds, so a panic does not make the next capture on that thread look nested.drop_unfinished_warnsnow asserts exactly one WARN.counts_only_this_threads_warnshits the callsite from another thread first and still requires this thread to count one.Impact
pub(crate)and compiled only for tests.Alternatives
ctorbefore any test thread runs would also close a remaining registration race (a callsite can computeneverduring install and store it after the rebuild). That needs a new dependency for a stall that has to outlast the install and the rebuild. Not taken. The same tradeoff was accepted on #4690, which landed this shape on the questline and not onmain.Follow-ups
just check --allstays with the questline.(Written by Grok 4.7)