[test-improver] Improve tests for config package#6371
Merged
lpcox merged 1 commit intoMay 24, 2026
Conversation
Add three new test cases to config_core_test.go that exercise previously uncovered branches in validateToolResponseFilters when called via LoadFromFile (TOML path): - TestLoadFromFile_ToolResponseFilter_EmptyToolName: verifies that an empty quoted key in the tool_response_filters table returns an error containing 'empty tool name'. - TestLoadFromFile_ToolResponseFilter_InvalidJqExpression: verifies that a syntactically invalid jq expression is rejected with an error containing 'invalid jq expression'. - TestLoadFromFile_ToolResponseFilter_WhitespaceOnlyValue: verifies that a whitespace-only filter value is rejected with 'must not be empty'. These tests bring validateToolResponseFilters coverage from 85.7% to 92.9% and overall config package coverage from 95.1% to 95.3%. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the robustness of the internal/config package’s TOML loading tests by adding negative test cases that exercise previously uncovered validation branches for tool_response_filters when configs are loaded via LoadFromFile.
Changes:
- Add a TOML test case that ensures an empty quoted tool name key is rejected.
- Add a TOML test case that ensures syntactically invalid jq expressions are rejected.
- Add a TOML test case that ensures whitespace-only filter values are rejected as empty.
Show a summary per file
| File | Description |
|---|---|
internal/config/config_core_test.go |
Adds new LoadFromFile-path tests covering validateToolResponseFilters error branches for empty tool names, invalid jq, and empty/whitespace filters. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
This was referenced May 24, 2026
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.
Test Improvements: config_core_test.go
File Analyzed
internal/config/config_core_test.gointernal/configImprovements Made
Increased Coverage
Added three test cases that exercise previously uncovered branches in
validateToolResponseFiltersvia the TOMLLoadFromFilepath:TestLoadFromFile_ToolResponseFilter_EmptyToolName— covers thestrings.TrimSpace(toolName) == ""guard (line 127–128 ofvalidation.go), triggered by an empty quoted TOML key ("" = ".result").TestLoadFromFile_ToolResponseFilter_InvalidJqExpression— covers thegojq.Parseerror path (line 136–137), triggered by a syntactically broken jq expression ("map(").TestLoadFromFile_ToolResponseFilter_WhitespaceOnlyValue— covers the whitespace-only filter guard (line 131–132), triggered by a filter value consisting only of spaces.Previous Coverage (
validateToolResponseFilters): 85.7%New Coverage (
validateToolResponseFilters): 92.9%Improvement: +7.2%
Overall config package: 95.1% → 95.3% (+0.2%)
Why These Tests Were Missing
The existing
TestLoadFromFile_ToolResponseFiltersonly tested the happy path (valid jq filter). The error paths were tested viavalidateStandardServerConfiginvalidation_test.go, but the TOML path (LoadFromFile→validateToolResponseFilters) had no coverage for these branches.Test Execution
All new tests pass:
Note:
TestBufferRetryLogic/module_has_no_memoryininternal/guardis a pre-existing failure unrelated to these changes (nil pointer dereference in wazero wasm memory).Generated by Test Improver Workflow
Focuses on better patterns, increased coverage, and more stable tests