Skip to content

[Testing] Add deterministic ALSP spam-decision boundary tests - #8628

Open
janezpodhostnik wants to merge 1 commit into
masterfrom
janez/flaky-test-followup-spam-boundary
Open

[Testing] Add deterministic ALSP spam-decision boundary tests#8628
janezpodhostnik wants to merge 1 commit into
masterfrom
janez/flaky-test-followup-spam-boundary

Conversation

@janezpodhostnik

@janezpodhostnik janezpodhostnik commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #8626/#8627. The widened statistical bounds in the sync spam load tests left
the low-probability groups unable to detect an implementation that never reports
misbehavior (their lower bound is 0). This PR replaces that statistical coverage with
exact unit tests.

Changes

  • Extracted pure helpers in engine/common/synchronization/engine.go
    (behavior-preserving — same expressions, same float32 semantics):
    shouldReportProbabilistically, batchRequestMisbehaviorProbability,
    rangeRequestMisbehaviorProbability. The probabilistic decision was previously inlined
    3× and untestable deterministically (hardwired crypto RNG).
  • New deterministic table tests (engine_alsp_probability_test.go): never report at
    p=0, always at p=1, draw n=0 reports for any p>0 (the case the load tests could not
    discriminate), exact boundaries at p=0.5 and p=0.1, and the documented (n+1)/64
    scaling example values for range/batch requests.
  • Slimmed the statistical load tests to wiring smoke tests: kept only groups with
    discriminating power (p=0.0, p=0.5, p≈0.156, and the unconditional always-report
    groups); dropped the eleven low-probability groups whose bounds could not fail for a
    broken implementation. Cuts ~11,000 processed messages from the suite.

Package passes go test -race (repeated runs); lint clean.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@janezpodhostnik
janezpodhostnik requested a review from a team as a code owner July 29, 2026 15:25
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 49e785e2-a8f6-41e3-a2c8-3e233c33ab9b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@janezpodhostnik janezpodhostnik changed the title Add deterministic ALSP spam-decision boundary tests [Testing] Add deterministic ALSP spam-decision boundary tests Jul 29, 2026
@janezpodhostnik
janezpodhostnik requested a review from a team July 30, 2026 10:31
Base automatically changed from janez/flaky-test-followup-coverage to master August 3, 2026 15:26
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.

3 participants