Skip to content

[Squad] Randomize previously-disabled SpinQuic settings to improve coverage - #6204

Open
Gaurav Singh (gaurav2699) wants to merge 7 commits into
mainfrom
user/gaurasingh/spinquic-settings-coverage
Open

[Squad] Randomize previously-disabled SpinQuic settings to improve coverage#6204
Gaurav Singh (gaurav2699) wants to merge 7 commits into
mainfrom
user/gaurasingh/spinquic-settings-coverage

Conversation

@gaurav2699

@gaurav2699 Gaurav Singh (gaurav2699) commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

SpinQuicRandomizeSettings left many settings unexercised:

  • 8 boolean settings used GetRandom((uint8_t)1) (== value % 1 == 0, always disabled); changed to GetRandom((uint8_t)2) so they toggle.
  • Re-enabled 26 commented-out numeric setting cases to exercise settings.c validation/apply/reject branches.
  • Added SendBufferingEnabled and NetStatsEventEnabled randomization.
  • EncryptionOffloadAllowed left disabled: random-enabling it on a started connection trips CXPLAT_FRE_ASSERT(FALSE) at connection.c:7742.

Testing

Do any existing tests cover this change? Are new tests needed?

Documentation

Is there any documentation impact for this change?

SpinQuicRandomizeSettings left many settings unexercised:
- 8 boolean settings used GetRandom((uint8_t)1) (== value % 1 == 0,
  always disabled); changed to GetRandom((uint8_t)2) so they toggle.
- Re-enabled 26 commented-out numeric setting cases to exercise
  settings.c validation/apply/reject branches.
- Added SendBufferingEnabled and NetStatsEventEnabled randomization.
- EncryptionOffloadAllowed left disabled: random-enabling it on a
  started connection trips CXPLAT_FRE_ASSERT(FALSE) at connection.c:7742
  (false-positive spin failure, not a real bug).

Only the SpinQuic test tool changes; no production code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gaurav2699
Gaurav Singh (gaurav2699) requested a review from a team as a code owner August 7, 2026 17:54
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.05%. Comparing base (e0f55b5) to head (d988871).
⚠️ Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6204      +/-   ##
==========================================
- Coverage   86.02%   85.05%   -0.97%     
==========================================
  Files          60       60              
  Lines       18984    18989       +5     
==========================================
- Hits        16331    16152     -179     
- Misses       2653     2837     +184     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Condense the EncryptionOffloadAllowed pinning note to two lines.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gaurav2699 Gaurav Singh (gaurav2699) changed the title Randomize previously-disabled SpinQuic settings to improve coverage [Squad] Randomize previously-disabled SpinQuic settings to improve coverage Aug 11, 2026
Comment thread src/tools/spin/spinquic.cpp

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please make the CI is green and run the spin test multiple times in a loop both locally and in the CI to catch issues before we merge this.

Bounded GetRandom(UpperBound) returns value % UpperBound, so passing
UINTxx_MAX can never yield the maximum value, and on the non-fuzz path
rand() % (int)UINT32_MAX degenerates to 0. That left the boundary most
likely to expose off-by-one/wraparound bugs in settings validation
untested. Add a full-width GetRandom<T>() overload (and a no-modulo
TryGetRandomFull) and use it for the UINTxx_MAX-bounded settings cases
and the stream/connection param randomizers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d1480271-874a-495f-a1d6-9baa5795b616
Comment thread src/tools/spin/spinquic.cpp Outdated
Addresses review feedback: give the descriptive suffix to the bounded
variant rather than an unclear "Full" suffix on the simpler unbounded one.
TryGetRandomFull becomes the plain TryGetRandom.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d1480271-874a-495f-a1d6-9baa5795b616
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.

2 participants