Skip to content

test(app): remove real reconciliation cooldown waits - #1923

Merged
JAORMX merged 1 commit into
mainfrom
fix/mcp-reconciler-test-timers
Sep 25, 2026
Merged

JAORMX merged 1 commit into
mainfrom
fix/mcp-reconciler-test-timers

Conversation

@JAORMX

@JAORMX JAORMX commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Use the existing mcpReconcilerOptions.after dependency-injection seam to remove real one-second cooldown waits from three reconciliation result tests:

  • TestMCPSourceReconciliation_Scenario1_OrderedSourcesLKGAndEmpty
  • TestMCPSourceReconciliation_Scenario1_ProductionTriggerMatrix
  • TestMCPSourceReconciliation_StatusPublishesOnlyActiveCandidateInventory

A test-only helper checks the requested cooldown duration and supplies a fresh, buffered, already-fired timer channel. The production loop still consumes its cooldown channel; no production code or polling interval changes.

The ToolHive polling channel and jitter-bound assertions remain manually controlled. Dedicated notification-storm and deferred-runtime-drain tests retain their held timers, so cooldown enforcement is still exercised. All existing assertions are preserved.

Measured benefit

Same targeted selection, forced uncached with -count=1, measured with go test -json:

Test Before After
Ordered sources / last-known-good / empty 2.00 s <0.01 s
Production trigger matrix 6.07 s 0.04 s
Active candidate inventory publication 8.07 s <0.01 s
Selected package run 16.612 s 0.109 s

This is measured test execution time, not a command-count estimate or a whole-suite speedup claim.

Verification

  • Full internal/app package passed (54.684 s in this run).
  • Changed tests plus TestMCPReconcilerNotificationStormCooldown and TestDeferredRuntimeDrainAutomaticallyReconcilesAndPublishes passed 20 repetitions under -race.
  • Mutation check: deliberately publishing Stale=false made all four inventory failure variants fail; the production mutation was reverted before the final package run.
  • Independent review found no blockers.
  • git diff --check passed.

Scope and readiness

Routine: test-only use of an existing injected timer dependency. No production behavior, interfaces, assertions, or documentation changes.

Draft because repository-wide final lint/test/race gates have not been run for this candidate. The scoped checks above are complete; aggregate pre-ready verification is not claimed.

Remove real cooldown waits from reconciliation result tests while retaining manually controlled polling and cooldown-enforcement coverage.

Co-Authored-By: mecatl <[email protected]>
@JAORMX
JAORMX marked this pull request as ready for review September 25, 2026 11:08
@JAORMX
JAORMX merged commit c8d1c32 into main Sep 25, 2026
64 checks passed
@JAORMX
JAORMX deleted the fix/mcp-reconciler-test-timers branch September 25, 2026 11:09
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Sep 25, 2026
2 tasks
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