Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Conversation

@whitdog47
Copy link
Contributor

@whitdog47 whitdog47 commented Jul 2, 2025

This PR enhances the JSON cleanup logic by switching from simple string replaces to a regex-based approach that tolerates whitespace around Markdown code fences.

@whitdog47 whitdog47 requested a review from Copilot July 2, 2025 20:55
@whitdog47 whitdog47 self-assigned this Jul 2, 2025
@whitdog47 whitdog47 added the bug Something isn't working label Jul 2, 2025

This comment was marked as outdated.

whitdog47 and others added 2 commits July 2, 2025 14:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: David Whittaker <84562015+whitdog47@users.noreply.github.com>
@whitdog47 whitdog47 requested a review from Copilot July 2, 2025 21:04

This comment was marked as outdated.

@whitdog47 whitdog47 requested a review from Copilot July 2, 2025 21:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR switches JSON cleanup from manual string operations to a regex-based helper that tolerates extra whitespace around Markdown fences.

  • Added clean_json_markdown with a single regex to strip code fences and optional language specifiers.
  • Replaced inline fence-stripping logic in generate_case_signal_summary and get_tag_recommendations with the new helper.
Comments suppressed due to low confidence (2)

src/dispatch/ai/service.py:105

  • Add unit tests for clean_json_markdown to verify it correctly handles various whitespace scenarios, optional language tags, and escaped newline sequences.
def clean_json_markdown(json_string: str) -> str:

src/dispatch/ai/service.py:567

  • The previous logic also replaced escaped newlines and flattened whitespace before validation. Ensure model_validate_json can handle raw output without those steps or reintroduce necessary newline/whitespace cleanup.
        return TagRecommendationResponse.model_validate_json(clean_json_markdown(result))

@whitdog47 whitdog47 closed this Jul 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants