feat: Enhance review prompt with detailed instructions and placeholders for empty sections
This commit is contained in:
@@ -57,6 +57,27 @@ def test_build_prompt_includes_trigger_message() -> None:
|
||||
assert "Trigger message: @codex review security\nPlease focus auth." in prompt
|
||||
|
||||
|
||||
def test_build_prompt_uses_empty_placeholders_and_no_network_instruction() -> None:
|
||||
pr = type("PR", (), {"html_url": "https://gitea.example/pr/1"})()
|
||||
command = ParsedCommand(name="review", raw="@codex review")
|
||||
diff_context = {"truncated": False, "changed_files": [], "diff": ""}
|
||||
repo_cfg = RepoReviewConfig()
|
||||
|
||||
prompt = _build_prompt(
|
||||
pr,
|
||||
command,
|
||||
diff_context,
|
||||
repo_cfg,
|
||||
changed_file_contents="",
|
||||
test_output=None,
|
||||
)
|
||||
|
||||
assert "You do not have internet/network access. Do not try to fetch URLs." in prompt
|
||||
assert "Never claim that PR content is inaccessible or missing if these sections are present." in prompt
|
||||
assert "Changed files:\n(none)" in prompt
|
||||
assert "Unified diff:\n(empty)" in prompt
|
||||
|
||||
|
||||
def test_prepare_review_prompt_applies_repo_default_mode_when_command_mode_not_explicit(monkeypatch, tmp_path) -> None:
|
||||
repo_dir = tmp_path / "repo"
|
||||
repo_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user