Skip to content

Recipe route gate test: stub the recipe store with the real signatures (red on main since #19610) - #20062

Merged
danielhanchen merged 1 commit into
mainfrom
fix-recipe-store-stub-signature
Nov 27, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-recipe-store-stub-signature

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

studio/backend/tests/test_managed_account_route_gates.py::test_recipes_without_stdio_and_ui_sessions_still_save fails on main (448e211080), in (Python 3.13, m-r), for example on the #20038 staging run:

TypeError: recipe_store.<locals>.<lambda>() takes 2 positional arguments but 3 were given

#19610 (keep recipe edits made just before leaving the editor) gave storage.data_recipes_db.upsert_recipe a third parameter, also_base. The save route now passes recipe.alsoBaseUpdatedAt to it. That change is correct. The test's recipe_store fixture replaced upsert_recipe with a two-argument lambda, so the route's real call no longer fits the stub.

Fix

The fixture builds both stubs (upsert_recipe, import_legacy) with _shaped_like(real, fake):

  • Each call is bound against the real function's signature first, then handed to the fake.
  • A parameter the real function gains no longer breaks the stub.
  • A call the real function would reject, such as an extra positional argument, still fails here, because the bind raises.

Verification

  • tests/test_managed_account_route_gates.py: 13 passed. Before, on main: test_recipes_without_stdio_and_ui_sessions_still_save failed with the TypeError above.
  • The upsert_recipe stub accepts the route's three-argument call, and rejects a fourth positional argument with TypeError: too many positional arguments, as the real function does.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T22:36:06.601456Z 7b952bf Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 7b952bf476

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 33ec9d3 into main Nov 27, 2026
1 of 19 checks passed
@danielhanchen
danielhanchen deleted the fix-recipe-store-stub-signature branch November 27, 2026 22:38
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