검사: 관문이 어느 대상에 돌았는지 보고, 필수 내용 검사를 전체 훑기에 넣는다

R5 — 원장은 관문의 명령과 종료 코드를 적는데 **그 명령이 어느 대상에 돌았는지는 아무도
안 봤다.** 다른 프로젝트에 돌려 받은 exit 0 을 적어도 통과로 셌다. `_wrong_target()` 이
`docs/<이름>/` 경로와 명령 인자의 프로젝트 이름 둘 다 본다.

  정상 원장 넷            새 error 0 (B 의 document-haness 원장 PASS · warn 3)
  프로젝트 인자를 바꾼 원장  FAIL 「관문이 다른 대상에 돌았다」
  기록 경로를 바꾼 원장     FAIL

**유효 범위를 docstring 에 적었다** — 「다른 프로젝트」만 본다. 같은 프로젝트의 다른 기록에
돌린 관문은 안 잡는다. 기록 단위까지 보려면 관문마다 대상 단위를 계약이 먼저 정해야 한다.

R12 — `check-required-content.py` 를 `OUTPUT_CHECKS` 에 더한다. B-003 이 병합돼 이제 된다.
세 상태 표를 지키는 것을 확인했다 — `ca-tmpl` exit 2 · `keycloak-session-store` exit 0 ·
없는 프로젝트 exit 2.

`OUTPUT CHECKS` 의 error 가 5 → 7 이 된다. **부채가 늘어난 것이 아니라 세는 자리가 늘었다** —
`ca-tmpl` 에 계약이 없다는 한 사실이 `check_evidence` · `check-required-content` ·
`TECH LOG TREES` 세 곳에서 셈된다. 같은 사실을 세 번 세지 않는다.

회귀 `scripts/tests/test_run_target.py` 2건 (123 → 125). **「정상 원장은 그대로 통과한다」
대조를 함께 넣는다** — 무조건 거절로 성공률을 올리는 것이 R-003 이 든 실패다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wp9jNbePAmWc5jQwCYhK9v
This commit is contained in:
DongHyeonka
2026-09-10 11:36:45 +09:00
co-authored by Claude Opus 5
parent 5472751894
commit 14afe94d76
3 changed files with 121 additions and 2 deletions
+38
View File
@@ -70,6 +70,38 @@ MEASUREMENT_GATES = ("style_profile.mjs",)
ORDER = ["S1", "S2", "S3", "S4", "S5", "S6", "S7"]
def _known_projects() -> set[str]:
docs = os.path.join(ROOT, "docs")
if not os.path.isdir(docs):
return set()
return {d for d in os.listdir(docs)
if os.path.isdir(os.path.join(docs, d)) and not d.startswith(("_", "."))}
def _wrong_target(cmd: str, project: str, known: set[str]) -> str | None:
"""이 관문이 **다른 프로젝트**에 돌지 않았는지 본다 (R5).
원장은 관문의 명령 문자열과 종료 코드를 적는다. 그런데 그 명령이 어느 대상에 돌았는지는
아무도 안 봤다 — 다른 프로젝트에 돌려 exit 0 을 받아 적어도 통과로 셌다.
`docs/<이름>/` 경로와 명령 인자로 오는 프로젝트 이름 둘 다 본다.
**유효 범위 — 「다른 프로젝트」만 본다.** 같은 프로젝트 안의 **다른 기록**에 돌린 관문은
안 잡는다. `docs/<프로젝트>/` 가 같으면 통과한다. 기록 단위까지 보려면 원장의 `record` 와
대조해야 하고, 그러면 프로젝트 단위로 도는 관문(`verify-tech-log-tree.py <프로젝트>`)이
전부 걸리므로 관문마다 대상 단위를 따로 적어야 한다. 그것은 이 검사기가 아니라 계약이
먼저 정할 일이다.
"""
for m in re.finditer(r"docs/([A-Za-z0-9_.+-]+)/", cmd):
if m.group(1) != project:
return f"docs/{m.group(1)}/"
for other in known:
if other == project:
continue
if re.search(rf"(?<![\w/.-]){re.escape(other)}(?![\w/.-])", cmd):
return other
return None
def _norm(text: str) -> str:
"""공백을 하나로 접는다. 인용을 줄바꿈까지 똑같이 옮기라고 요구하지 않는다."""
return re.sub(r"\s+", " ", text).strip()
@@ -168,6 +200,7 @@ def verify(path: str) -> Report:
rep.error("원장에 칸이 없다", key)
project = run.get("project") or ""
rep.facts["project"] = project or ""
known_projects = _known_projects()
stages = {s.get("id"): s for s in run.get("stages") or []}
missing = [sid for sid in ORDER if sid not in stages]
@@ -228,6 +261,11 @@ def verify(path: str) -> Report:
gates = st.get("gates") or []
cmds = " ; ".join(str(g.get("cmd") or "") for g in gates)
for g in gates:
other = _wrong_target(str(g.get("cmd") or ""), project, known_projects)
if other:
rep.error("관문이 다른 대상에 돌았다",
f"{where}{str(g.get('cmd'))[:60]}{other} (원장은 {project})")
for token in spec["gates"]:
if token not in cmds:
rep.error("관문이 빠졌다", f"{where}{token}")