Skip to content

Commit 53d63ac

Browse files
Pigbibicodex
andcommitted
chore: allow legacy dependency manifest removal
Co-Authored-By: Codex <noreply@openai.com>
1 parent 343bd4e commit 53d63ac

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

scripts/gate_codex_app_review.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def compile_patterns(policy: dict[str, Any]) -> list[re.Pattern[str]]:
9292

9393
# ─── static guard ────────────────────────────────────────────────────────────
9494

95+
ALLOWED_REMOVED_FILES = {"constraints.txt", "requirements.txt"}
96+
9597
_SENSITIVE = re.compile(
9698
r'(?:api[_\s]?key|secret|password|token|credential|private[_\s]?key)\s*[:=]\s*["\']'
9799
r'(?!\$\{\{|{{|example|placeholder|test|your[-_\s]|xxx|TODO|CHANGEME)[^"\']{12,}["\']',
@@ -128,7 +130,8 @@ def check_metadata(files: list[dict[str, Any]], policy: dict[str, Any]) -> list[
128130
for f in files:
129131
fn = f.get("filename", "?")
130132
st = (f.get("status") or "").lower().strip()
131-
if st == "removed": issues.append(f"**File deleted**: `{fn}` — verify intentional")
133+
if st == "removed" and fn not in ALLOWED_REMOVED_FILES:
134+
issues.append(f"**File deleted**: `{fn}` — verify intentional")
132135
elif st == "renamed": issues.append(f"**File renamed**: `{f.get('previous_filename', '?')}` → `{fn}`")
133136
if len(files) > mx_f:
134137
issues.append(f"**Too many files**: {len(files)} changed (limit {mx_f})")
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from __future__ import annotations
2+
3+
from scripts.gate_codex_app_review import check_metadata
4+
5+
6+
def test_metadata_allows_removing_legacy_dependency_manifests() -> None:
7+
files = [
8+
{"filename": "requirements.txt", "status": "removed"},
9+
{"filename": "constraints.txt", "status": "removed"},
10+
]
11+
12+
assert check_metadata(files, {}) == []
13+
14+
15+
def test_metadata_still_blocks_other_deleted_files() -> None:
16+
files = [{"filename": "main.py", "status": "removed"}]
17+
18+
assert check_metadata(files, {}) == ["**File deleted**: `main.py` — verify intentional"]

0 commit comments

Comments
 (0)