feat. Review foot note, docker fix, pass message to reviewer , update tests
Some checks failed
ci / test (push) Failing after 16s
ci / publish (push) Has been skipped

This commit is contained in:
Space-Banane
2026-05-22 22:16:09 +02:00
parent b32bf9eb82
commit e7c7d82f84
18 changed files with 322 additions and 14 deletions

View File

@@ -23,6 +23,7 @@ def test_process_one_job_recreates_persistent_comment_when_edit_returns_404(monk
pr_number=9,
head_sha="deadbeef",
trigger_comment_id=111,
trigger_comment_body="@codex review",
requested_by="alice",
command=ParsedCommand(name="review", raw="@codex review"),
)
@@ -71,3 +72,44 @@ def test_process_one_job_recreates_persistent_comment_when_edit_returns_404(monk
assert persisted_comment_id == 990
stored_job = session.execute(select(ReviewJob).where(ReviewJob.id == job.id)).scalar_one()
assert stored_job.status.value == "succeeded"
def test_process_one_job_passes_full_trigger_message_to_runner(monkeypatch) -> None:
captured: dict[str, str] = {}
session_factory = get_session_factory()
with session_factory() as session:
enqueue_job(
session,
repo="acme/repo",
pr_number=10,
head_sha="cafebabe",
trigger_comment_id=112,
trigger_comment_body="@codex review security --full\nFocus auth/session handling.",
requested_by="alice",
command=ParsedCommand(name="review", raw="@codex review security --full", arguments=["security", "--full"]),
)
def _fake_run_review_ephemeral(_settings, *, repo: str, pr_number: int, command: ParsedCommand):
captured["raw"] = command.raw
return {"verdict": "correct", "confidence": 0.9, "summary": "ok", "findings": []}
class _FakeGiteaClient:
def __init__(self, _settings) -> None:
pass
def get_pull_request(self, _repo: str, _pr_number: int):
return SimpleNamespace(is_fork=False)
def post_issue_comment(self, _repo: str, _pr_number: int, _body: str) -> int:
return 901
def edit_issue_comment(self, _repo: str, _comment_id: int, _body: str) -> int:
return _comment_id
monkeypatch.setattr("gitea_codex_bot.workers.dispatcher.run_review_ephemeral", _fake_run_review_ephemeral)
monkeypatch.setattr("gitea_codex_bot.workers.dispatcher.GiteaClient", _FakeGiteaClient)
settings = get_settings()
processed = process_one_job(settings)
assert processed is True
assert captured["raw"] == "@codex review security --full\nFocus auth/session handling."