Skip to content

test(promise): replace wall-clock scaling gates with operation counts - #8059

Merged
proggeramlug merged 2 commits into
mainfrom
fix/7365-runtime-flakes
Aug 14, 2026
Merged

test(promise): replace wall-clock scaling gates with operation counts#8059
proggeramlug merged 2 commits into
mainfrom
fix/7365-runtime-flakes

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the two PromiseKeyedTable elapsed-time ratio assertions with deterministic operation-count gates
  • count the real HashMap hash/equality probes and slot-position equality comparisons through test-only transparent wrappers
  • retain raw usize/u32 keys and the existing PtrHasher path in non-test builds

Exact-main evidence

Base: ef6e111

  • settling_many_keys_is_not_quadratic failed 20/20 isolated runs on the base despite counted HashMap removals scaling linearly
  • draining_a_heavily_populated_key_ahead_of_another_is_not_quadratic passed 20/20 isolated runs but failed in one of two full-suite runs
  • sampling an extreme settling failure showed time under HashMap remove/find, while deterministic probe counts remained linear; the elapsed ratio was a scheduler/allocation proxy rather than evidence of an algorithm regression

Local validation

  • keyed_table unit module: 8 passed
  • both replacement gates: 100/100 fresh-process runs passed
  • bare_address_in_shadow_slot_survives_a_real_collection: 100/100 fresh-process runs passed
  • bare_address_in_global_slot_survives_a_real_collection: 100/100 fresh-process runs passed
  • cargo check -p perry-runtime --lib passed using an isolated target
  • cargo fmt --all --check and git diff --check passed

The repository-wide file-size check is independently red on the base because crates/perry-runtime/src/timer.rs is 2010 lines. No production behavior or version changes are included.

Related to #7365; #7445 and #7822 already fixed the historical teardown and dispatch-IC mechanisms.

Summary by CodeRabbit

  • Tests
    • Improved scalability testing with deterministic operation-based checks, making performance regressions easier to detect reliably.
    • Added coverage for indexed lookups and efficient slot relocation behavior.
  • Documentation
    • Updated the changelog to document the more consistent regression-detection approach.
  • Bug Fixes
    • Improved confidence in performance safeguards without changing production behavior.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6677689e-124d-4646-abb0-bc7656417e76

📥 Commits

Reviewing files that changed from the base of the PR and between b0f13fb and 53e958a.

📒 Files selected for processing (2)
  • changelog.d/8059-promise-keyed-operation-gates.md
  • crates/perry-runtime/src/promise/keyed_table.rs

📝 Walkthrough

Walkthrough

The promise keyed table now uses test-only operation probes for hash, equality, and slot comparisons. Timing-based scalability tests were replaced with deterministic assertions for indexed lookup, relocation, draining, and cleanup.

Changes

Promise keyed-table operation gates

Layer / File(s) Summary
Add test-only operation instrumentation
crates/perry-runtime/src/promise/keyed_table.rs
Test-only wrappers count key and slot operations while production values remain usize and u32.
Route keyed-table operations through wrappers
crates/perry-runtime/src/promise/keyed_table.rs
Index access, relocation, draining, invariant checks, and probe reset logic use the instrumented representations.
Replace timing checks with probe assertions
crates/perry-runtime/src/promise/keyed_table.rs, changelog.d/8059-promise-keyed-operation-gates.md
Scalability tests now assert deterministic operation bounds, FIFO draining, direct relocation, preserved entries, and cleanup behavior. The changelog records the change from timing ratios to operation counts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 53e95

The change replaces flaky wall-clock assertions with deterministic operation-count checks while preserving production behavior, and no actionable merge-blocking risk remains after normal checks and review.

Suggested labels: performance

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes replacing wall-clock scaling gates with deterministic operation counts.
Description check ✅ Passed The description explains the changes, motivation, related issue, and validation results, but does not use all template headings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/7365-runtime-flakes

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.

@proggeramlug
proggeramlug marked this pull request as ready for review August 14, 2026 00:07
@proggeramlug
proggeramlug merged commit a793b41 into main Aug 14, 2026
8 of 18 checks passed
@proggeramlug
proggeramlug deleted the fix/7365-runtime-flakes branch August 14, 2026 00:21
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.

1 participant