Repository navigation
Give flaky performance-benchmark thresholds real margin - #2235
Conversation
Two thresholds were tight enough to only pass reliably on an idle machine: performance.test.ts asserted sub-microsecond Map lookups against a 1us threshold that measurement noise alone could exceed, and architecture-benchmarks.test.ts's bulkStructural coverage-mode budget (50ms) had no headroom over normal (not just idle) machine load, observed failing at 63ms. Raise both with margin, following the existing PERF_THRESHOLDS/budget() pattern, and document why the new numbers still catch a real regression. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014gZjK3rMbXHaA46JgmYbtx
Code Review SummaryNet positive, low-risk fix that does what issue #2233 asked for: it replaces noise-level absolute thresholds with reasoned ones and documents the reasoning inline, following the existing Scope is exactly two test files, one commit, no production code touched — appropriately atomic for a threshold-tuning fix. Requirements Validation (issue #2233 acceptance criteria)
FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
VerdictApprove. This is a well-reasoned, appropriately scoped fix — thresholds are justified with actual measurements and comments explain why, not just what, matching the issue's explicit ask to avoid "loosening until it passes." The one open item (thin headroom on |
malibio
left a comment
There was a problem hiding this comment.
Reviewed — Approve. See full findings in the comment above. Net positive; no critical issues; one non-blocking margin-thinness note on bulkStructural.
The prior coverage-mode budget (70ms) had only ~11% margin over the 63ms failure that motivated this fix — a single data point isn't a reliable ceiling. Bump the fast-mode base to 40ms (80ms under coverage) for ~27% margin while staying well under a real regression bound (<3.5x the uninstrumented baseline). Addresses reviewer feedback from PR #2235 review. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014gZjK3rMbXHaA46JgmYbtx
Addressed Review FeedbackThe review came back APPROVE with no Critical or Important findings. Per project policy, ran Addressed:
Skipped (with reasoning):
Re-verified both test files pass individually, together, and under Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The only change was widening a numeric safety margin further in the same direction and for the same reason the original review already evaluated and approved — no new logic, no architectural change, no new risk surface. All other feedback was correctly triaged as non-blocking suggestions and either applied or explained. |
Summary
performance.test.ts's registry-lookup tests assertedavgTime < 0.001ms(1 microsecond) on averagedMap.get()/Map.has()calls — a threshold that timer resolution, GC pauses, and JIT warmup jitter alone can exceed with no actual regression. Raised to 10 microseconds (get/has) and 20 microseconds (getAllPatterns, which converts Map to Array), documented inline.architecture-benchmarks.test.ts'sbulkStructuralthreshold (fast mode) was25msbase ×COVERAGE_OVERHEAD_FACTOR = 2=50msunder coverage, observed failing at63mson a normally-loaded (not idle) machine. Raised the fast-mode base to35ms(→70msunder coverage), giving real margin over normal-load measurements while keeping a same-order-of-magnitude bound. Full mode is untouched.ARCHITECTURE_TARGETS/PERF_THRESHOLDSsplit pattern (issue-mandated) rather than just loosening numbers without documenting why.Closes #2233.
Test plan
bun run testbaseline: 227 files / 4794 tests passed--coverage, individually and together — pass with real margin (e.g. bulkStructural measured 23ms against a 70ms coverage-mode budget)bun run test:allrun twice back-to-back, no flakiness on either previously-flaky assertionbun run quality:fix— no lint/format issues, no unrelated file changes🤖 Generated with Claude Code
https://claude.ai/code/session_014gZjK3rMbXHaA46JgmYbtx