Skip to content

docs: correct MockBuilder when() fallback guidance - #89

Merged
Bbenchaya merged 1 commit into
intuit:mainfrom
idhanth:bugfix/59-mock-builder-one-mock-per-tool
Oct 29, 2026
Merged

Bbenchaya merged 1 commit into
intuit:mainfrom
idhanth:bugfix/59-mock-builder-one-mock-per-tool

Conversation

@idhanth

@idhanth idhanth commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Checklist

🚨 Please review this repository's contribution guidelines.

  • I've read and agree to the project's contribution guidelines.
  • I'm requesting to pull a topic/feature/bugfix branch.
  • I checked that my code additions will pass code linting checks and unit tests.
  • I updated unit and integration tests (if applicable).
  • I added an [Unreleased] changelog entry for a user-visible change, or confirmed the change is exempt.
  • I'm ready to notify the team of this contribution.

Description

What does this change do and why?

Implements the docs-only fix decided in #59. In docs/guides/mock-builder.md, "Scenario Predicates with when()":

  • Removes the second registry.mock("get_pricing").returns(...) example and the paragraph saying the next registered mock is tried when the predicate doesn't match. MockToolsRegistry holds one mock per tool name, so that second registration replaces the first.
  • States that a non-matching predicate resolves no mock, and that registering the tool again replaces the mock, linking to "Notes and Limits", which already says this.
  • Points to register_data_driven with a catch-all case (no input) or fallback= for a conditional mock with a default.

README.md and docs/guides/langgraph-integration.md don't contain the same wording, so they're unchanged.

Verification:

  • Ran the new text's claims against the registry: the when() mock resolves only when the flag is set, a second registry.mock("get_pricing") replaces it, and a catch-all case and fallback= both cover unmatched input.
  • uv run sphinx-build -b html docs docs/_build/html (as in docs.yml): builds with no warnings, and both new links resolve.

Docs-only, so no code or tests change, and it's exempt from the changelog per CONTRIBUTING.

Fixes #59

🤖 Generated with Claude Code

The "Scenario Predicates with when()" section said a second registration
for the same tool acts as a fallback when the predicate doesn't match.
The registry holds one mock per tool name, so the second registration
replaces the first. Remove that example and paragraph, state the
one-mock-per-tool behavior, and point to register_data_driven with a
catch-all case or fallback= for a conditional mock with a default.

Fixes intuit#59

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Bbenchaya
Bbenchaya merged commit 7570cfe into intuit:main Oct 29, 2026
7 checks passed

This branch was successfully deployed

1 active deployment
pypi — 6093fb51 Deployed Oct 29, 2026 by Bbenchaya via Tag & Publish #52
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.

MockBuilder docs describe layered scenario-predicate mocks with a fallback, but the registry overwrites (one mock per tool)

2 participants