Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTO1_PATCHES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Keep this list minimal to ease upstream rebases.
| improve-reflect-fallback-score | OPS-24090 | Fix | pr_agent/tools/pr_code_suggestions.py | Prevent inline suggestion spam when self-reflection fails by defaulting all suggestion scores to 0. | Not upstreamed yet. | Remove once upstream handles reflect failure without inflating scores. |
| describe-mermaid-sanitize | OPS-24090 | Fix | pr_agent/tools/pr_description.py | Strip backticks from Mermaid diagrams to avoid GitHub render failures. | Not upstreamed yet. | Remove once upstream sanitizes Mermaid diagrams or fixes prompt output. |
| jira-cloud-ticket-context | OPS-24091 | Enhancement | pr_agent/algo/utils.py, pr_agent/tickets/jira_cloud.py, pr_agent/tools/ticket_pr_compliance_check.py, pr_agent/tools/pr_reviewer.py, pr_agent/tools/pr_description.py, pr_agent/tools/pr_config.py, tests/unittest/test_convert_to_markdown.py, tests/unittest/test_jira_cloud_ticket_context.py, tests/unittest/test_pr_reviewer_ticket_note.py, tests/unittest/test_ticket_pr_compliance_check.py | Fetch Jira Cloud ticket context using PR title first and branch name only as fallback, support both basic auth and scoped-token Jira Cloud API access, ignore placeholder compliance bullets and placeholder text like `None.`, show review notes when the Jira ticket cannot be fetched, and normalize empty discovered tickets before prompt rendering. | Not upstreamed yet. | Remove once upstream supports Jira Cloud ticket context from PR metadata with title-first precedence, scoped-token auth, placeholder-safe compliance rendering, comment-level fetch-failure notes, and prompt-safe normalization for empty ticket payloads. |
| ticket-compliance-human-verification | OPS-24224 | Fix | pr_agent/algo/utils.py, tests/unittest/test_convert_to_markdown.py | Keep the ticket compliance section visible when a ticket can only be classified as requiring human verification, while leaving the section header neutral instead of forcing a compliant or non-compliant status. | Not upstreamed yet. | Remove once upstream renders human-verification-only ticket compliance entries without dropping the section or forcing a misleading compliance state. |

## Rebase checklist

Expand Down
6 changes: 4 additions & 2 deletions pr_agent/algo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def ticket_markdown_logic(emoji, markdown_text, value, gfm_supported, ticket_not
not_compliant_str = '\n'.join(not_compliant_items)
requires_further_human_verification = '\n'.join(requires_further_human_verification_items)

if not fully_compliant_items and not not_compliant_items:
if not fully_compliant_items and not not_compliant_items and not requires_further_human_verification_items:
get_logger().debug(f"Ticket compliance has no requirements",
artifact={'ticket_url': ticket_url})
continue
Expand All @@ -453,9 +453,11 @@ def ticket_markdown_logic(emoji, markdown_text, value, gfm_supported, ticket_not
ticket_compliance_level = 'PR Code Verified'
elif not_compliant_items:
ticket_compliance_level = 'Not compliant'
elif requires_further_human_verification_items:
ticket_compliance_level = 'Requires human verification'

# Store the compliance level for aggregation
if ticket_compliance_level:
if ticket_compliance_level and ticket_compliance_level != 'Requires human verification':
all_compliance_levels.append(ticket_compliance_level)

# build compliance string
Expand Down
38 changes: 38 additions & 0 deletions tests/unittest/test_convert_to_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,44 @@ def test_ticket_compliance_ignores_none_with_punctuation(self):
assert 'None.' not in result
assert 'No information provided.' not in result

def test_ticket_compliance_renders_human_verification_only_entries(self):
input_data = {'review': {
'ticket_compliance_check': [
{
'ticket_url': 'https://example.com/ticket/OPS-24224',
'ticket_requirements': '- Verify rollout in QA\n',
'fully_compliant_requirements': '',
'not_compliant_requirements': '',
'requires_further_human_verification': '- Verify rollout in QA\n',
}
]
}}

result = convert_to_markdown_v2(input_data)

assert '**🎫 Ticket compliance analysis**' in result
assert '**🎫 Ticket compliance analysis ✅**' not in result
assert '**🎫 Ticket compliance analysis ❌**' not in result
assert '**[OPS-24224](https://example.com/ticket/OPS-24224) - Requires human verification**' in result
assert 'Requires further human verification:' in result

def test_ticket_compliance_omits_placeholder_only_human_verification_entries(self):
input_data = {'review': {
'ticket_compliance_check': [
{
'ticket_url': 'https://example.com/ticket/OPS-24224',
'ticket_requirements': '',
'fully_compliant_requirements': '',
'not_compliant_requirements': '',
'requires_further_human_verification': '- No information provided.\n',
}
]
}}

result = convert_to_markdown_v2(input_data)

assert 'Ticket compliance analysis' not in result

def test_parse_requirement_items_filters_placeholder_variants(self):
items = parse_requirement_items(
'- Requirement 1\n'
Expand Down