Skip to content

Fix hardcoded '???' placeholder for missing Jira issues in summarize#383

Merged
kkaarreell merged 3 commits into
mainfrom
ks_no_jira_string
Jun 30, 2026
Merged

Fix hardcoded '???' placeholder for missing Jira issues in summarize#383
kkaarreell merged 3 commits into
mainfrom
ks_no_jira_string

Conversation

@kkaarreell

@kkaarreell kkaarreell commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

The summarize code used '???' as a sentinel for failures without a Jira issue, but the rest of the codebase already uses the JIRA_NONE_ID constant ('_NO_ISSUE'). Replace all '???' occurrences with JIRA_NONE_ID to keep the summarize output consistent and prevent '???' from leaking into AI-generated summary reports.

Summary by Sourcery

Standardize handling of missing Jira IDs in summarize and AI reporting workflows by using the shared JIRA_NONE_ID constant instead of hardcoded placeholders.

Bug Fixes:

  • Prevent "???" placeholder values from appearing in summarize outputs and AI-generated summary reports when Jira IDs are missing.

Enhancements:

  • Use the shared JIRA_NONE_ID constant across summarize helpers, Jira bulk fetching, and AI system prompts to keep missing-Jira handling consistent.

@kkaarreell kkaarreell self-assigned this Jun 30, 2026
@sourcery-ai

sourcery-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Standardizes summarize workflow handling of missing Jira issues by replacing the hardcoded '???' placeholder with the shared JIRA_NONE_ID sentinel and wiring that value into the AI summary system prompt.

Sequence diagram for AI summary prompt using JIRA_NONE_ID sentinel

sequenceDiagram
    participant SummarizeCLI
    participant AiService
    participant Constants as CLIConstants

    SummarizeCLI->>AiService: query_ai_model(user_message, system_prompt=None)
    AiService->>AiService: [system_prompt is None]
    AiService->>CLIConstants: import JIRA_NONE_ID
    AiService->>AiService: SYSTEM_PROMPT.format(jira_none_id=JIRA_NONE_ID)
    AiService-->>SummarizeCLI: AI response text
Loading

File-Level Changes

Change Details Files
Use the shared JIRA_NONE_ID sentinel instead of the hardcoded '???' placeholder in summarize helpers and downstream consumers.
  • Import JIRA_NONE_ID into summarize_helpers and use it as the default issue ID when no Jira key is present in failures and in the issues mapping.
  • Update collection of Jira issue keys to ignore the JIRA_NONE_ID sentinel instead of the string '???'.
  • Update summarize_cmd JIRA bulk fetch logic to filter out JIRA_NONE_ID entries rather than hardcoded '???' values.
  • Change the AI summary system prompt text to refer to a parameterized Jira-none sentinel, and when no explicit system_prompt is passed, format SYSTEM_PROMPT with jira_none_id=JIRA_NONE_ID, importing the constant lazily.
newa/cli/summarize_helpers.py
newa/cli/commands/summarize_cmd.py
newa/services/ai_service.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In summarize_cmd.py, JIRA_NONE_ID is used in fetch_jira_issues_bulk but never imported; add the appropriate import from newa.cli.constants to avoid a NameError.
  • The AI summary template in ai_service.py now hardcodes "_NO_ISSUE" instead of referencing JIRA_NONE_ID; consider using the constant or interpolating it so the text stays consistent if the sentinel value changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `summarize_cmd.py`, `JIRA_NONE_ID` is used in `fetch_jira_issues_bulk` but never imported; add the appropriate import from `newa.cli.constants` to avoid a NameError.
- The AI summary template in `ai_service.py` now hardcodes "_NO_ISSUE" instead of referencing `JIRA_NONE_ID`; consider using the constant or interpolating it so the text stays consistent if the sentinel value changes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

The summarize code used '???' as a sentinel for failures without a Jira
issue, but the rest of the codebase already uses the JIRA_NONE_ID
constant ('_NO_ISSUE'). Replace all '???' occurrences with JIRA_NONE_ID
to keep the summarize output consistent and prevent '???' from leaking
into AI-generated summary reports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kkaarreell

Copy link
Copy Markdown
Collaborator Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In summarize_cmd.py, JIRA_NONE_ID is now referenced in fetch_jira_issues_bulk but the diff doesn't show an import for it in that module; ensure it's imported from newa.cli.constants to avoid a NameError.
  • The change to format SYSTEM_PROMPT with .format(jira_none_id=JIRA_NONE_ID) only applies when system_prompt is None; if callers pass SYSTEM_PROMPT directly they’ll still see the {jira_none_id} placeholder—consider centralizing the formatting at definition time or documenting that callers should pass a pre-formatted prompt.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `summarize_cmd.py`, `JIRA_NONE_ID` is now referenced in `fetch_jira_issues_bulk` but the diff doesn't show an import for it in that module; ensure it's imported from `newa.cli.constants` to avoid a `NameError`.
- The change to format `SYSTEM_PROMPT` with `.format(jira_none_id=JIRA_NONE_ID)` only applies when `system_prompt` is `None`; if callers pass `SYSTEM_PROMPT` directly they’ll still see the `{jira_none_id}` placeholder—consider centralizing the formatting at definition time or documenting that callers should pass a pre-formatted prompt.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

kkaarreell and others added 2 commits June 30, 2026 19:18
Failures without a linked Jira issue were showing "_NO_ISSUE" as a
prefix in both the raw report and the AI-generated summary. Filter it
out in format_launch_test_items and update the AI prompt to list such
failures directly without any ID prefix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The RP item API was returning parent items (test suites) alongside leaf
test cases, inflating counts like "To investigate" with entries not
visible in the WebUI. Adding filter.eq.hasChildren=false restricts
results to leaf items only. Also add debug logging for raw RP
statistics and individual test items to aid future troubleshooting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kkaarreell kkaarreell merged commit 38d2f25 into main Jun 30, 2026
16 checks passed
@kkaarreell kkaarreell deleted the ks_no_jira_string branch June 30, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant