feat(agent): add StrictContextMock test double for unified Context#1015
Draft
wolo-lab wants to merge 1 commit into
Draft
feat(agent): add StrictContextMock test double for unified Context#1015wolo-lab wants to merge 1 commit into
wolo-lab wants to merge 1 commit into
Conversation
After the context unification, the unified Context interface gained many methods. Out-of-tree consumers that hand-implement tool.Context (e.g. a fakeToolContext in tests) break whenever the interface grows, since Go requires every method to be present. StrictContextMock implements the full Context surface so it can be embedded in a test fake; embedders keep compiling as Context grows. ADK methods panic with "not implemented" (a loud failure on unexpected calls), while the context.Context methods (Deadline/Done/Err/Value) delegate to the wrapped Ctx. This complements the existing ContextMock, which returns zero values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After the context unification, the unified Context interface gained many methods. Out-of-tree consumers that hand-implement tool.Context (e.g. a fakeToolContext in tests) break whenever the interface grows, since Go requires every method to be present.
StrictContextMock implements the full Context surface so it can be embedded in a test fake; embedders keep compiling as Context grows. ADK methods panic with "not implemented" (a loud failure on unexpected calls), while the context.Context methods (Deadline/Done/Err/Value) delegate to the wrapped Ctx. This complements the existing ContextMock, which returns zero values.