Skip to content

fix: omit raw diff when annotated content present#203

Merged
blak0p merged 1 commit into
mainfrom
fix-redundant-raw-diff-in-diffresultjson
Jun 30, 2026
Merged

fix: omit raw diff when annotated content present#203
blak0p merged 1 commit into
mainfrom
fix-redundant-raw-diff-in-diffresultjson

Conversation

@blak0p

@blak0p blak0p commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Closes #200

Summary

  • Removes redundant diff field from JSON when annotated is present
  • Annotated diff is a superset (raw content + AST labels), so raw diff is pure duplication
  • Saves ~2x tokens per diff response for LLM consumers

Changes

File Change
internal/delivery/mcp/shared/helpers.go Emit diff only when Annotated is empty
internal/delivery/mcp/shared/diff_result_test.go Assert diff is absent when annotated present

Test Plan

  • go test ./internal/delivery/mcp/shared/... — all pass
  • go test ./internal/delivery/mcp/core/... — all pass
  • TestDiffResultJSON_AnnotatedPresent verifies diff is omitted
  • TestDiffResultJSON_AnnotatedEmpty verifies diff is still present

WHY
Including both `diff` and `annotated` fields resulted in data duplication since annotated output is a superset of the raw diff.

WHAT
* Updated DiffResultJSON to exclude `diff` key when `Annotated` is non-empty.
* Adjusted tests to verify absence of `diff` field during annotated serialization.
@blak0p blak0p added the type:bug Bug fix label Jun 30, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@blak0p blak0p merged commit 2dc22a0 into main Jun 30, 2026
6 checks passed
@blak0p blak0p deleted the fix-redundant-raw-diff-in-diffresultjson branch June 30, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: DiffResultJSON emits redundant raw diff when annotated diff is present

1 participant