feat. append structured details to markdown comment in format_result_comment
All checks were successful
ci / test (push) Successful in 59s
ci / publish (push) Successful in 1m35s

This commit is contained in:
Space-Banane
2026-05-27 22:54:27 +02:00
parent 2482c9911f
commit fdd3819ff8
2 changed files with 61 additions and 6 deletions

View File

@@ -3,19 +3,33 @@ from __future__ import annotations
from gitea_codex_bot.services.review_format import format_result_comment
def test_format_result_comment_uses_markdown_comment_verbatim_with_marker() -> None:
def test_format_result_comment_appends_structured_details_to_markdown_comment() -> None:
body = format_result_comment(
"abc1234",
{
"verdict": "correct",
"verdict": "has_issues",
"confidence": 0.9,
"summary": "ignored when markdown_comment exists",
"findings": [],
"markdown_comment": "## Codex Review\n\nAll good.\n\nNo issues found.",
"summary": "2 issues detected.",
"findings": [
{
"severity": "high",
"file": "src/app.py",
"line_start": 20,
"line_end": 22,
"title": "Unsafe command execution",
"body": "User input is passed directly into shell=True.",
"suggestion": "Use a fixed argument list and avoid shell=True.",
}
],
"markdown_comment": "## Codex Review\n\nShort agent message only.",
},
)
assert body.startswith("<!-- codex-review:head_sha=abc1234 -->\n## Codex Review")
assert "All good.\n\nNo issues found." in body
assert "Short agent message only." in body
assert "### Structured Findings" in body
assert "2 issues detected." in body
assert "`src/app.py:20-22` (high)" in body
assert "Unsafe command execution" in body
def test_format_result_comment_replaces_existing_marker() -> None: