fix(secops): ensure consistent string return types in security tools - #313
Open
dandye wants to merge 1 commit into
Open
fix(secops): ensure consistent string return types in security tools#313dandye wants to merge 1 commit into
dandye wants to merge 1 commit into
Conversation
- Ensure get_threat_intel always returns str when answer is non-string or nested dict - Fix copy-paste typo in do_update_security_alert error message - Update test_secops_mcp assertions to match str/json return types - Add unit tests for threat_intel and security alert return type serialization Fixes #161
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.
Summary
Resolves #161:
-> strreturn type contract inget_threat_intelby ensuring non-string or nested dictionary/list responses from the Gemini model are serialized withjson.dumps().do_update_security_alertexception handling ("retrieving" -> "updating").test_secops_mcp.pyto match thestr(JSON-encoded) return types ofget_security_alert_by_idanddo_update_security_alert.server/secops/tests/test_threat_intel_unit.py: 7 tests covering GeminiResponse objects, block formats, string answers, nested dictionary answers, direct string responses, unexpected response formats, and error handling.server/secops/tests/test_security_alerts_unit.py: 6 additional tests coveringget_security_alertsempty/error paths,get_security_alert_by_idsuccess/error paths, anddo_update_security_alertsuccess/error paths.Fixes #161
Verification
Hermetic Unit Tests:
Ran full test suite in
server/secops:uv run --directory server/secops --extra test pytest tests/test_security_alerts_unit.py tests/test_threat_intel_unit.py tests/test_secops_tools_unit.py tests/test_secops_parser_management_unit.pyResult:
38 passed in 1.45sLinter & Formatting:
Result: All checks passed.