Skip to content

fix: add network tolerance to sync performance assertion#339

Merged
AniketDev7 merged 1 commit intodevelopmentfrom
fix/sync-performance-assertion-tolerance
Mar 4, 2026
Merged

fix: add network tolerance to sync performance assertion#339
AniketDev7 merged 1 commit intodevelopmentfrom
fix/sync-performance-assertion-tolerance

Conversation

@AniketDev7
Copy link
Contributor

Problem:

  • The test "should compare initial vs delta sync performance" was failing intermittently due to network variability
  • Assertion expected deltaTime <= initialTime (strict)
  • In practice, small syncs (<100ms) have high variance from network latency
  • Example failure: initialTime=41ms, deltaTime=74ms (both fast, but failed)

Solution:

  • Added hybrid tolerance: max(initialTime * 2, 100ms)
  • Allows 2x tolerance OR 100ms absolute threshold (whichever is larger)
  • Accounts for network variability while catching real performance regressions

Impact:

  • Makes test more resilient to network conditions
  • Still catches meaningful performance degradation
  • Prevents false negatives from minor timing fluctuations

Problem:
- The test "should compare initial vs delta sync performance" was failing
  intermittently due to network variability
- Assertion expected deltaTime <= initialTime (strict)
- In practice, small syncs (<100ms) have high variance from network latency
- Example failure: initialTime=41ms, deltaTime=74ms (both fast, but failed)

Solution:
- Added hybrid tolerance: max(initialTime * 2, 100ms)
- Allows 2x tolerance OR 100ms absolute threshold (whichever is larger)
- Accounts for network variability while catching real performance regressions

Impact:
- Makes test more resilient to network conditions
- Still catches meaningful performance degradation
- Prevents false negatives from minor timing fluctuations
@AniketDev7 AniketDev7 requested a review from a team as a code owner March 4, 2026 12:39
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 99.32% 877/883
🟢 Branches 97.23% 281/289
🟢 Functions 97.95% 191/195
🟢 Lines 99.4% 832/837

Test suite run success

653 tests passing in 31 suites.

Report generated by 🧪jest coverage report action from 79648d9

@AniketDev7 AniketDev7 merged commit 507f495 into development Mar 4, 2026
11 checks passed
@AniketDev7 AniketDev7 deleted the fix/sync-performance-assertion-tolerance branch March 4, 2026 12:54
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