Skip to content

fix: stop double-encoding detection in case create#272

Merged
maximelb merged 2 commits intocli-v2from
cli-v2-fix-case-create-detection
Mar 30, 2026
Merged

fix: stop double-encoding detection in case create#272
maximelb merged 2 commits intocli-v2from
cli-v2-fix-case-create-detection

Conversation

@maximelb
Copy link
Copy Markdown
Contributor

Summary

  • Fix detection double-encoding bug: Cases.create_case() was calling json.dumps(detection) before passing the data 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 the extension schema declares detection as type "json", which expects an object, not a string.
  • Update mock return values: The ext-cases backend now returns case_number (integer) instead of case_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

File Change
limacharlie/sdk/cases.py Remove json.dumps() wrapper around detection dict
tests/unit/test_sdk_cases.py Update mock return value and assertion: case_id -> case_number, json.dumps(detection) -> detection
tests/unit/test_cli_case.py Update 5 mock return values: case_id -> case_number

Test 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

maximelb and others added 2 commits March 29, 2026 20:36
…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>
@maximelb maximelb requested a review from dzimine-lc March 30, 2026 03:47
@maximelb maximelb merged commit 9365005 into cli-v2 Mar 30, 2026
7 checks passed
@maximelb maximelb deleted the cli-v2-fix-case-create-detection branch March 30, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant