fix: stop double-encoding detection in case create#272
Merged
Conversation
…turns The detection field was being JSON-serialized with json.dumps() before being passed to the extension request. Since the gzdata encoding already JSON-serializes the full data dict, this produced a JSON string instead of an object. The LC backend silently dropped the field because schema type "json" expects an object, not a string. Also update test mock return values from case_id to case_number to match the current ext-cases backend response format. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace --id with --case-number across all case CLI commands (get, export, update, add-note, tag set/add/remove) to prevent confusion with case_id (UUID). No backward compat alias needed since case management is a new feature. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Cases.create_case()was callingjson.dumps(detection)before passing the data to the extension request. Since thegzdataencoding already JSON-serializes the full data dict, this produced a JSON string ("{ ... }") instead of an object ({ ... }). The LC backend silently dropped the field because the extension schema declares detection as type"json", which expects an object, not a string.case_number(integer) instead ofcase_id(UUID string) in create responses, to prevent AI callers from confusing the internal UUID with the user-facing integer case number. Updated 5 CLI test mocks and 1 SDK test mock + assertion accordingly.Changes
limacharlie/sdk/cases.pyjson.dumps()wrapper around detection dicttests/unit/test_sdk_cases.pycase_id->case_number,json.dumps(detection)->detectiontests/unit/test_cli_case.pycase_id->case_numberTest plan
python -m pytest tests/unit/test_sdk_cases.py tests/unit/test_cli_case.py -v-- all 159 tests pass🤖 Generated with Claude Code