Skip to content

refactor: Bypass codemcp.main.codemcp in tests #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

ezyang
Copy link
Owner

@ezyang ezyang commented May 6, 2025

Stack from ghstack (oldest at bottom):

We recently refactored all codemcp/tools to have uniform naming convention according to subtool. Now I want all testing code to bypass codemcp.main.codemcp and instead directly call the function in main. We mostly need to update call_tool_assert_success. For BC, let's not change the signature; instead, we'll lookup the correct module.function using the passed subtool argument, and otherwise call the function with the same kwargs that codemcp would have been called with (we also recently updated all of the subtools to have exactly the same kwargs). Make this change and then run tests.

74f6121  (Base revision)
44aa7b8  Refactor call_tool_assert_success to bypass codemcp.main.codemcp and directly call subtool functions
0420dfe  Refactor call_tool_assert_error to bypass codemcp.main.codemcp and directly call subtool functions
db323cc  Update get_chat_id to directly call init_project instead of codemcp.main.codemcp
370d10f  Snapshot before auto-test
2102f1f  Fix parameter name for init_project (using 'directory' instead of 'path')
395a8a9  Fix InitProject parameter handling to convert 'path' to 'directory'
addb355  Fix InitProject parameter handling in call_tool_assert_error
334373d  Fix RunCommand parameter handling in call_tool_assert_error
5503501  Fix RunCommand parameter handling in call_tool_assert_success
54063b6  Fix InitProject to ensure reuse_head_chat_id parameter is provided
HEAD     Fix InitProject to ensure reuse_head_chat_id parameter is provided in call_tool_assert_error

codemcp-id: 295-refactor-bypass-codemcp-main-codemcp-in-tests

[ghstack-poisoned]
ezyang added a commit that referenced this pull request May 6, 2025
We recently refactored all codemcp/tools to have uniform naming convention according to subtool. Now I want all testing code to bypass codemcp.main.codemcp and instead directly call the function in main. We mostly need to update call_tool_assert_success. For BC, let's not change the signature; instead, we'll lookup the correct module.function using the passed subtool argument, and otherwise call the function with the same kwargs that codemcp would have been called with (we also recently updated all of the subtools to have exactly the same kwargs). Make this change and then run tests.

```git-revs
74f6121  (Base revision)
44aa7b8  Refactor call_tool_assert_success to bypass codemcp.main.codemcp and directly call subtool functions
0420dfe  Refactor call_tool_assert_error to bypass codemcp.main.codemcp and directly call subtool functions
db323cc  Update get_chat_id to directly call init_project instead of codemcp.main.codemcp
370d10f  Snapshot before auto-test
2102f1f  Fix parameter name for init_project (using 'directory' instead of 'path')
395a8a9  Fix InitProject parameter handling to convert 'path' to 'directory'
addb355  Fix InitProject parameter handling in call_tool_assert_error
334373d  Fix RunCommand parameter handling in call_tool_assert_error
5503501  Fix RunCommand parameter handling in call_tool_assert_success
54063b6  Fix InitProject to ensure reuse_head_chat_id parameter is provided
HEAD     Fix InitProject to ensure reuse_head_chat_id parameter is provided in call_tool_assert_error
```

codemcp-id: 295-refactor-bypass-codemcp-main-codemcp-in-tests
ghstack-source-id: 6b71e6e
Pull-Request-resolved: #295
[ghstack-poisoned]
ezyang added a commit that referenced this pull request May 6, 2025
We recently refactored all codemcp/tools to have uniform naming convention according to subtool. Now I want all testing code to bypass codemcp.main.codemcp and instead directly call the function in main. We mostly need to update call_tool_assert_success. For BC, let's not change the signature; instead, we'll lookup the correct module.function using the passed subtool argument, and otherwise call the function with the same kwargs that codemcp would have been called with (we also recently updated all of the subtools to have exactly the same kwargs). Make this change and then run tests.

```git-revs
74f6121  (Base revision)
44aa7b8  Refactor call_tool_assert_success to bypass codemcp.main.codemcp and directly call subtool functions
0420dfe  Refactor call_tool_assert_error to bypass codemcp.main.codemcp and directly call subtool functions
db323cc  Update get_chat_id to directly call init_project instead of codemcp.main.codemcp
370d10f  Snapshot before auto-test
2102f1f  Fix parameter name for init_project (using 'directory' instead of 'path')
395a8a9  Fix InitProject parameter handling to convert 'path' to 'directory'
addb355  Fix InitProject parameter handling in call_tool_assert_error
334373d  Fix RunCommand parameter handling in call_tool_assert_error
5503501  Fix RunCommand parameter handling in call_tool_assert_success
54063b6  Fix InitProject to ensure reuse_head_chat_id parameter is provided
b0b57ee  Fix InitProject to ensure reuse_head_chat_id parameter is provided in call_tool_assert_error
4808e13  Add _dispatch_to_subtool helper method to deduplicate subtool dispatcher logic
fd771ae  Update call_tool_assert_error to use the _dispatch_to_subtool helper method
HEAD     Update call_tool_assert_success to use the _dispatch_to_subtool helper method
```

codemcp-id: 295-refactor-bypass-codemcp-main-codemcp-in-tests
ghstack-source-id: 3803302
Pull-Request-resolved: #295
[ghstack-poisoned]
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