From 1bf2a6b1465dc51dd387320a1e910e10b0a566a5 Mon Sep 17 00:00:00 2001 From: OoO Date: Wed, 13 May 2026 16:22:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=88=E4=BD=8F=E6=A8=A1=E7=B5=84=E5=8C=96?= =?UTF-8?q?=E7=9B=A4=E9=BB=9E=E8=A1=8C=E6=95=B8=E6=96=B0=E9=AE=AE=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_modularization_governance.py | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/test_modularization_governance.py b/tests/test_modularization_governance.py index af39636..7be14bc 100644 --- a/tests/test_modularization_governance.py +++ b/tests/test_modularization_governance.py @@ -1,3 +1,4 @@ +import re from pathlib import Path @@ -41,6 +42,34 @@ def test_large_python_modules_are_tracked_in_modularization_inventory(): assert missing == [] +def test_modularization_inventory_line_counts_are_current_enough(): + inventory = INVENTORY.read_text(encoding="utf-8") + inventory_counts = { + match.group("path"): int(match.group("lines")) + for match in re.finditer( + r"^\|\s*(?P\d+)\s*\|\s*`(?P[^`]+)`\s*\|", + inventory, + re.MULTILINE, + ) + } + large_modules = { + path: lines + for path, lines in _python_line_counts() + if lines >= 800 + } + + stale = [] + for path, current_lines in sorted(large_modules.items()): + recorded_lines = inventory_counts.get(path) + if recorded_lines is None: + continue + allowed_drift = max(50, int(current_lines * 0.1)) + if abs(recorded_lines - current_lines) > allowed_drift: + stale.append(f"{path}: recorded={recorded_lines}, current={current_lines}") + + assert stale == [] + + def test_modularization_governance_is_indexed_for_codex_sessions(): agents = (ROOT / "AGENTS.md").read_text(encoding="utf-8") constitution = (ROOT / "CONSTITUTION.md").read_text(encoding="utf-8")