Skip to content

Tests: Bound resource_monitor's charges by what a wrong charge shows - #417

Merged
Segfaultd merged 1 commit into
developfrom
fix/resource-monitor-timing-test
Nov 16, 2026
Merged

Segfaultd merged 1 commit into
developfrom
fix/resource-monitor-timing-test

Conversation

@Segfaultd

@Segfaultd Segfaultd commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

What

resource_monitor: charges each resource for its own script when one calls another failed on macOS on develop at the 42.1.0 version bump (a commit that changes only VERSION): the teller's 20 ms burn was charged 102.7 ms against a ceiling of 70. The same commit passed on macOS in the release run.

A pause of the runner lands on whichever script is running, so a fixed ceiling close to the burn measures the runner, not the attribution. Same kind of fix as #412.

  • The bank's handler burns 400 ms (was 200). A teller wrongly charged for it would show 420 ms or more; the teller is now held under 200 instead of 70.
  • The bank's fixed ceiling (< 300) is replaced by teller + bank <= the frame's wall time: charging time twice breaks that on any machine, and a runner pause cannot.
  • The slow threshold moves from 100 to 200 ms, 170 ms from every burn. An 80 ms pause would have crossed the old one too and failed tellerStats->slowReports == 0.
  • The floors are unchanged in kind: each burn lasts at least what it asks.

The test takes about 200 ms longer.

Tests

resource_monitor run three times locally on Windows: 14/14 each time. Test-only change.

Summary by CodeRabbit

  • Tests
    • Updated resource-monitor integration checks to cover longer-running audit handlers and revised timing thresholds.
    • Added checks for teller and bank charge limits and their combined duration relative to the frame time.

develop failed on macOS on the 42.1.0 version bump: the teller's
20 ms burn was charged 102.7 ms against a ceiling of 70. A pause of
the runner lands on whichever script is running, so a fixed ceiling
near the burn measures the runner.

The ceilings now sit where a wrong charge would be. The bank's
handler burns 400 ms, so a teller charged for it shows 420 or more
and is held under 200. The bank's fixed ceiling is replaced by the
two charges together not exceeding the frame they ran in, which is
what charging time twice would break on any machine. The slow
threshold moves to 200 ms, 170 from every burn: a pause of 80 would
have crossed the old one as well.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The resource monitor integration test increases the bank audit handler duration and slow threshold. It measures the frame duration when resources finish and checks the bank and teller charges against updated bounds.

Changes

Resource monitor timing test

Layer / File(s) Summary
Measure frame time and verify charges
code/tests/modules/resource_monitor_ut.h
The test increases the audit handler burn to 400 ms and the slow threshold to 200 ms. It records the finishing frame’s duration, requires at least 430 ms charged to the bank, limits the teller charge to under 200 ms, and checks that combined charges do not exceed the frame duration by more than 1 ms.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: kheartz

Merge Risk: Minimal · up to 173dc

This is a test-only change that loosens timing thresholds so the resource monitor test is less flaky on slow runners. It does not change production behavior, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the test-only change: bounding resource_monitor's charges by what a wrong charge shows. The changeset raises the burn and slow thresholds, replaces the fixed bank ceiling with a wall-t…
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.
Full details: Title check

Explanation

The title names the test-only change: bounding resource_monitor's charges by what a wrong charge shows. The changeset raises the burn and slow thresholds, replaces the fixed bank ceiling with a wall-time bound, and adds a minimum-charge check. The title is specific and accurate, and it matches the main change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit times the bank’s audit run
Four hundred milliseconds, then it’s done
The frame clock keeps the passing pace
The teller’s charge stays in its place
Bank and teller totals fit the frame
The rabbit hops away, tests green again

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 21a439b8-203a-4213-b6a7-ae42ba0c38b6
Commits

Reviewing files that changed from the base of the PR and between c77da63 and 173dc53.

Files selected for processing: 1

  • code/tests/modules/resource_monitor_ut.h

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@Segfaultd
Segfaultd merged commit 96fc0f9 into develop Nov 16, 2026
7 checks passed
@Segfaultd
Segfaultd deleted the fix/resource-monitor-timing-test branch November 16, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant