Skip to content

Bound the cooldown tests' wall clock by a budget, not by 100ms - #107

Merged
M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:fix/cooldown-test-wall-clock
Oct 15, 2026
Merged

M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:fix/cooldown-test-wall-clock

Conversation

@M3gA-Mind

Copy link
Copy Markdown
Contributor

Summary

registry::sources::official has two cooldown tests: a_stalled_search_skips_the_network_for_the_cooldown and a_cooling_down_search_answers_from_cached_server_details. Both asserted that a search made during the cooldown finished in under 100ms, which is the same as the search budget that search would otherwise wait out. On a shared macOS runner the first test took 119.5ms (tinymcp#105, job 116436420086), while its real proof, state.requests() == after_first ("nothing was sent"), passed. The 100ms bound can't tell a waited budget apart from scheduler noise.

Both tests now use a 1s search budget (COOLDOWN_SEARCH_BUDGET) and bound the cooled-down call at half of it, with a comment explaining why. A call that waited out the budget still fails the assertion, and no idle call comes near 500ms. The request count remains the proof that nothing was sent. The first test's expected RegistryTimeout.timeout follows the new budget.

Related issue

None. The failure is a flaky test on main, surfaced on #105.

API or behavior changes

None. Only tests change. Each of the two tests takes about 0.9s longer, because its first, stalled search now waits 1s instead of 100ms.

Validation

Not run locally: fmt --check as a separate step, clippy, build and test. By our fleet's policy, CI is the gate, and this PR relies on module-ci for those. Commands actually run:

  • cargo fmt --all. Ran it and committed the result.
  • cargo clippy --all-targets --all-features -- -D warnings (CI)
  • cargo build --all-targets --all-features (CI)
  • cargo test --all-features (CI)

Tests

The two tests above are updated. Nothing is untested: neither test is relaxed in what it proves, since the request-count assertion is unchanged and the wall-clock bound still catches a call that waits out the budget.

Documentation

The reason is recorded in a doc comment on COOLDOWN_SEARCH_BUDGET.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 223bc064-e7c3-424b-8a0a-66e75159dd96
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@tinysweeper

tinysweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 5 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Ready for maintainer review
Priority: none
Reviewed head: 86860297f468
Updated: 2026-10-15T13:44:49Z

Review snapshot

Change surface Files Review signal Count
Production 0 Active findings 0
Tests 1 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

None.

How this fits together

flowchart LR
  n0["...search_answers_from_cached_server_details<br/>changed"]:::changed
  n1["...search_skips_the_network_for_the_cooldown<br/>changed"]:::changed
  n2["cursors"]:::impacted
  n3["auth_at"]:::impacted
  n4["store"]:::impacted
  n5["switchable_registry"]:::impacted
  n6["set"]:::impacted
  n0 -->|calls| n2
  n0 -->|tests| n2
  n0 -->|calls| n3
  n0 -->|tests| n3
  n0 -->|calls| n5
  n0 -->|tests| n5
  n0 -->|calls| n6
  n0 -->|tests| n6
  n1 -->|calls| n2
  n1 -->|tests| n2
  n1 -->|calls| n3
  n1 -->|tests| n3
  n1 -->|calls| n4
  n1 -->|tests| n4
  n1 -->|calls| n5
  n1 -->|tests| n5
  n1 -->|calls| n6
  n1 -->|tests| n6
  n6 -->|calls| n4
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change is a test-only refactor: it introduces `COOLDOWN_SEARCH_BUDGET` (1s) and `cooling_adapter()` and switches two cooldown timing tests from a 100ms search budget to a 1s one, adjusting the wall-clock bound to half the budget and the asserted timeout to the new value. The assertions remain consistent with `budgets_with_cooldown` (browse shortened to 200ms, cooldown 60s) and with the `RegistryTimeout { timeout }` field carrying the search budget, so nothing looks misbehaved. I found no reportable defect. _The code index is behind this pull request (indexed at `76472ce70beb`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This change only adds test helpers (`cooling_adapter`, `COOLDOWN_SEARCH_BUDGET`) and tightens two timing assertions in the official registry adapter's test module; no production code, no untrusted input path, and no repository rule is violated. Safe to merge. _The code index is behind this pull request (indexed at `76472ce70beb`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This is a test-only change that replaces an arbitrary 100 ms wall-clock bound and the matching hardcoded timeout assertion in two cooldown tests with a dedicated 1 s search budget (`cooling_adapter`), keeping the request-count assertion that actually proves no network call was made. The assertions still pin real behaviour (the typed `RegistryTimeout` carries the configured budget, and the cooling-down call returns in under half the budget), so nothing here can regress silently, and no other test was left dangling on the old budget. No defects found. _The code index is behind this pull request (indexed at `76472ce70beb`), so retrieved context may be out of date._

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This is a test-only change that replaces two cooldown tests' 100ms wall-clock bound with a bound derived from a longer 1s search budget (`COOLDOWN_SEARCH_BUDGET / 2`), while keeping the request-count assertion that proves nothing was sent, and updates the expected `RegistryTimeout.timeout` accordingly. The description matches the diff: both helpers (`cooling_adapter`, `COOLDOWN_SEARCH_BUDGET`) are introduced as described, both tests are updated, and the doc comment on the constant records the rationale. I found no defect: the new helper correctly builds the adapter via `budgets_with_cooldown`, the timeout expectation is consistent with the new budget, and no test contract is relaxed. _The code index is behind this pull request (indexed at `76472ce70beb`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.000738
  • Tokens: 141496 input · 9203 output · 28416 cached · 174 embedding
Head State Pass summary
76472ce70beb ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-15T13:24:08Z)
86860297f468 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-15T13:44:49Z)

tinysweeper 0.1.2

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

             $0.0002 · 94,047 in / 2,490 out · 18,304 cached (19%) · ladder/vectors-oai3, deepseek-v4.1-flash · 174 embedded
critique:    $0.0000 · 34,149 in / 465 out   · 4,352 cached (13%)  · deepseek-v4.1-flash
security:    $0.0000 · 15,589 in / 83 out    · 1,920 cached (12%)  · deepseek-v4.1-flash
tests:       $0.0000 · 14,288 in / 165 out   · 3,072 cached (22%)  · deepseek-v4.1-flash
description: $0.0001 · 27,354 in / 796 out   · 8,960 cached (33%)  · deepseek-v4.1-flash

a_stalled_search_skips_the_network_for_the_cooldown asserted the
cooled-down search finished in under 100ms, which is also the search
budget it would otherwise wait. On a shared macOS runner it took 119.5ms
(job 116436420086) while its real proof, that no request was sent,
passed. The same bound sat in
a_cooling_down_search_answers_from_cached_server_details.

Give both tests a 1s search budget and bound the cooled-down call at half
of it: still failing if the adapter waits out the budget, far from
scheduler noise. The request count stays the proof that nothing was sent.
@M3gA-Mind
M3gA-Mind force-pushed the fix/cooldown-test-wall-clock branch from 76472ce to 8686029 Compare October 15, 2026 13:41
@M3gA-Mind
M3gA-Mind merged commit ac180a8 into tinyhumansai:main Oct 15, 2026
20 checks passed
@M3gA-Mind M3gA-Mind mentioned this pull request Oct 15, 2026
4 of 8 tasks
M3gA-Mind added a commit to M3gA-Mind/tinymcp that referenced this pull request Oct 15, 2026
Ships tinyhumansai#105 (the pure tool-UI rules move into tinymcp-bus, contract 1.25)
and tinyhumansai#107. Workspace version and the two lockfile entries only, as in the
0.18.5 release.

Part of tinyhumansai/openhuman#7868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant