feat: review_only input and an enumeration check in the monthly prompt
tests / unittest (push) Successful in 23s
tests / unittest (push) Successful in 23s
review_only names listed documents the drafter may read but not edit. They stay in stage 1, are listed separately in the prompt, and a change to one fails the run like a change outside docs. Each entry must match a docs pattern. The monthly prompt now makes checking every list and count in the top-level documents against the repository the drafter's main job. Mode-specific text moves to prompts/mode-pr.md and prompts/mode-monthly.md; the pr text is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f39409e62c
commit
9dea56ce98
15 files changed
+223
-29
No files matched your search
@@ -6,6 +6,7 @@ from docs_review.inputs import (
|
||||
matches_any,
|
||||
normalize_drafter,
|
||||
parse_inputs,
|
||||
split_review_only,
|
||||
unmatched_patterns,
|
||||
)
|
||||
from tests.helpers import tmp_tree
|
||||
@@ -64,6 +65,27 @@ class ParseInputsTest(unittest.TestCase):
|
||||
self.assertIsNone(i.tracking_issue)
|
||||
self.assertIsNone(i.doc_guide)
|
||||
|
||||
def test_review_only_defaults_to_empty(self):
|
||||
self.assertEqual(parse_inputs({"INPUT_DOCS": "a.md"}).review_only, ())
|
||||
|
||||
def test_review_only_entries_within_docs(self):
|
||||
i = parse_inputs({"INPUT_DOCS": "README.md\ndocs/*.md\npm/**/*.md",
|
||||
"INPUT_REVIEW_ONLY": " docs/vision.md \n\nREADME.md\npm/v*.md\n"})
|
||||
self.assertEqual(i.review_only, ("docs/vision.md", "README.md", "pm/v*.md"))
|
||||
|
||||
def test_review_only_entry_outside_docs_raises(self):
|
||||
for entry in ("other/vision.md", "docs/sub/vision.md", "*.md"):
|
||||
with self.assertRaisesRegex(ValueError, f"review_only.*{entry.replace('*', '[*]')}"):
|
||||
parse_inputs({"INPUT_DOCS": "README.md\ndocs/*.md",
|
||||
"INPUT_REVIEW_ONLY": f"docs/a.md\n{entry}"})
|
||||
|
||||
def test_split_review_only(self):
|
||||
editable, read_only = split_review_only(
|
||||
("README.md", "docs/a.md", "docs/vision.md"), ("docs/v*.md",))
|
||||
self.assertEqual(editable, ("README.md", "docs/a.md"))
|
||||
self.assertEqual(read_only, ("docs/vision.md",))
|
||||
self.assertEqual(split_review_only(("a.md",), ()), (("a.md",), ()))
|
||||
|
||||
def test_non_integer_tracking_issue_raises(self):
|
||||
with self.assertRaisesRegex(ValueError, "tracking_issue"):
|
||||
parse_inputs({"INPUT_DOCS": "a.md", "INPUT_TRACKING_ISSUE": "abc"})
|
||||
|
||||
Reference in new issue
Block a user