Fix PR comments
- User
Fix PR comments
Assistant
Let me find the PR and its comments.
Assistant
Good. Two PR comments from greptile, both P2:
- Panicking assertions in mock methods — Replace
assert_eq!in mock async methods with error returns to avoid swallowed panics in Axum handlers. - Missing test for
_session_keyoverride precedence — Add a test that passes both_session_keyandsessionKeyto verify internal override wins.
Let me read the relevant files.
- Panicking assertions in mock methods — Replace
Assistant
Now I need to find
resolve_session_key_from_paramsto understand the precedence logic for the second comment.Assistant
Now let me read the full
resolve_session_key_from_paramsfunction to understand the precedence logic.Assistant
Now I have full context. Let me also look at the test file structure around line 1121 to see how tests are organized and what
MockDispatchlooks like.Assistant
Good. Now I have everything I need. Let me make both fixes:
Fix 1: Replace
assert_eq!with error returns in the mock methods ingraphql_chat_binding.rsFix 2: Add a test for_session_keyoverride precedence inintegration.rsAssistant
Now add the
_session_keyoverride precedence test. Let me check where to best place it — right after thechat_history_query_forwards_session_keytest.Assistant
Now I need to understand how the GraphQL schema handles
_session_key— it's an internal override, so it wouldn't come through the GraphQL schema directly. The comment is about theresolve_session_key_from_paramsfunction incrates/chat/src/lib.rs. Let me check if there are existing tests for that function.Assistant
The
resolve_session_key_from_paramsis a method on the chat service, not directly testable from the GraphQL integration tests. The GraphQL tests useMockDispatchwhich records calls — the precedence logic lives incrates/chat. Let me check where the best place would be to add this test. The PR comment says the test should verify the_session_keytakes priority. Since_session_keyis an internal param injected by runtime callers (not exposed in GraphQL), the right place for this test is incrates/chat's own tests.Let me check for existing unit tests in chat.
Assistant
The chat tests are fairly complex integration tests. The
resolve_session_key_from_paramsis a method onLiveChatServicewhich requires full setup. Since the PR comment is about the GraphQL integration test file, and the precedence is actually about the chat service level, I think the best approach is to add a unit test right incrates/chat/src/lib.rsfor the resolution logic. But that method requires&self(the full LiveChatService). Let me look at how the existing tests set up a LiveChatService.Assistant
Let me look at how LiveChatService is created in the tests.
Assistant
Now I see the pattern. There are already tests for
sessionKeyvs_conn_idprecedence. I need to add one for_session_keyvssessionKeyprecedence. Thehistoryapproach is the simplest — it just reads from the session store.Assistant
Now I'll add the test for
_session_keyoverride precedence right afterhistory_prefers_public_session_key_over_connection_active_session.Assistant
Now let me compile and run the affected tests.
Assistant
Now let me test the httpd test too.
Assistant
Both tests pass. Let me also run the format check on the modified files.
Assistant
All clean. Let me verify the final state of the changes.
Assistant
Two PR comments addressed:
-
graphql_chat_binding.rs— Replacedassert_eq!insend,history, andactivemock methods with conditional error returns. This prevents panics from being swallowed by Axum's handler panic-catching, giving clearer test failure messages. -
chat/src/lib.rs— Addedhistory_internal_session_key_overrides_public_session_keytest that passes both_session_keyandsessionKeyand asserts the internal override wins, covering the precedence logic documented inresolve_session_key_from_params.
-
Assistant
The push needs a YubiKey tap for SSH authentication. Please tap your YubiKey and I'll retry.
Assistant
Push failed — please tap your YubiKey and let me know when ready to retry.