feat(campaign): govern attachment reuse
This commit is contained in:
@@ -92,6 +92,43 @@ def test_attachment_block_cannot_be_overridden_by_review_decision() -> None:
|
||||
assert decisions == []
|
||||
|
||||
|
||||
def test_attachment_reuse_review_requires_reason_and_captures_policy() -> None:
|
||||
job = _job(
|
||||
issues=[{
|
||||
"code": "duplicate_attachment_reuse",
|
||||
"behavior": "ask",
|
||||
"source": "attachments:reuse_policy",
|
||||
"details": {
|
||||
"file_fingerprint": "f" * 64,
|
||||
"policy": {"action": "review", "allow_within": "none"},
|
||||
},
|
||||
}]
|
||||
)
|
||||
|
||||
with pytest.raises(CampaignPersistenceError, match="require an explicit reason"):
|
||||
_normalize_review_issue_decisions(
|
||||
[job],
|
||||
[],
|
||||
user_id="reviewer-1",
|
||||
build_token="build-1",
|
||||
)
|
||||
|
||||
decisions = _normalize_review_issue_decisions(
|
||||
[job],
|
||||
[{
|
||||
"job_id": job.id,
|
||||
"decision": "accept",
|
||||
"reason": "The shared statutory notice is intentionally identical.",
|
||||
}],
|
||||
user_id="reviewer-1",
|
||||
build_token="build-1",
|
||||
)
|
||||
|
||||
assert decisions[0]["issue_codes"] == ["duplicate_attachment_reuse"]
|
||||
assert decisions[0]["reason"] == "The shared statutory notice is intentionally identical."
|
||||
assert len(decisions[0]["issue_fingerprint"]) == 64
|
||||
|
||||
|
||||
def _job(*, issues: list[dict[str, object]]) -> SimpleNamespace:
|
||||
return SimpleNamespace(
|
||||
id="job-1",
|
||||
|
||||
Reference in New Issue
Block a user