chore: 이전 세션이 남긴 변경을 커밋한다
이번 파이프라인 작업과 무관하게 작업 트리에 남아 있던 것을 그대로 올린다. 사용자가 「전부 커밋」으로 정했고, 이번 작업과 섞이지 않게 커밋만 나눴다. 대부분은 clean-architecture-backend-template 의 그림 정본 재배치다 — final/assets/diagrams/<이름>/ 에 있던 것이 CLAUDE.md 가 적은 배치인 final/assets/<이름>/ 로 옮겨졌고 .techviz/<이름>/ 이 함께 들어왔다. 삽입 줄의 대부분(3.15M)이 그 .techviz context.json 이다. 그 밖에 ca-tmpl·document-haness 의 정리, .claude/agents/ 열한 개, writing-practitioner-guides 스킬, .playwright-mcp 세션 산출물, scripts/check-ssot-facts.py 와 그 시험이 들어 있다. 이 커밋의 내용은 내가 만든 것이 아니라 이전 세션이 남긴 것이고 검증하지 않았다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
2109f726fe
commit
ab59130196
@@ -10,13 +10,34 @@
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
# `docs/` 안에 만드는 픽스처의 접두사. 실재 프로젝트와 섞이지 않게 `zz-` 로 시작한다
|
||||
FIXTURE_PREFIX = "zz-no-contract-"
|
||||
|
||||
|
||||
def _sweep_stale_fixtures(docs: str) -> None:
|
||||
"""지난 실행이 남긴 픽스처를 치운다.
|
||||
|
||||
`finally` 는 SIGKILL 을 못 막는다. 한 번 남으면 그 폴더가 **진짜 프로젝트로
|
||||
세어져서** `verify-pipeline.py` 가 프로젝트 수를 하나 더 세고 계약이 없다고
|
||||
error 를 낸다 — 시험이 저장소를 고장 낸 것처럼 보인다. 지우는 것은 이 접두사로
|
||||
시작하는 것뿐이라 실재 프로젝트를 건드리지 않는다.
|
||||
"""
|
||||
for name in os.listdir(docs):
|
||||
if name.startswith(FIXTURE_PREFIX):
|
||||
shutil.rmtree(os.path.join(docs, name), ignore_errors=True)
|
||||
|
||||
|
||||
PY_CHECKERS = (
|
||||
"check-figure-text.py",
|
||||
"check-figure-overlap.py",
|
||||
@@ -28,6 +49,49 @@ MJS_CHECKER = os.path.join(".agents", "skills", "writing-tech-log-records",
|
||||
"scripts", "check_evidence.mjs")
|
||||
ABSENT = "no-such-project-r4-regression"
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _a_contract_with_no_records():
|
||||
"""계약은 있고 기록이 0건인 프로젝트를 만들어 준다.
|
||||
|
||||
이 상태를 살아 있는 프로젝트 이름으로 가리키면, 누가 그 프로젝트에 기록 한 편을
|
||||
쓰는 순간 시험이 깨진다. 실제로 그렇게 깨졌다. 이름이 아니라 상태가 필요한
|
||||
시험이므로 여기서 그 상태를 만든다.
|
||||
"""
|
||||
docs = os.path.join(ROOT, "docs")
|
||||
path = tempfile.mkdtemp(prefix="zz-no-records-", dir=docs)
|
||||
try:
|
||||
studio = os.path.join(path, "tech-log-studio")
|
||||
os.makedirs(studio)
|
||||
name = os.path.basename(path)
|
||||
with open(os.path.join(studio, "tech-log-tree.json"), "w", encoding="utf-8") as fh:
|
||||
json.dump({"schemaVersion": 4, "project": name, "ssot": "final/document.md",
|
||||
"topics": {}, "candidates": []}, fh)
|
||||
yield name
|
||||
finally:
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _a_project_without_a_contract():
|
||||
"""SSOT 는 있고 분해 계약이 없는 프로젝트를 만들어 준다.
|
||||
|
||||
이 상태를 실재 프로젝트 이름으로 가리키면 그 프로젝트가 저장소에서 빠지는 순간
|
||||
시험이 조용히 `skip` 으로 넘어간다. 실제로 그렇게 됐다 — `ca-tmpl` 을 지웠다.
|
||||
이름이 아니라 상태가 필요한 시험이므로 여기서 그 상태를 만든다.
|
||||
"""
|
||||
docs = os.path.join(ROOT, "docs")
|
||||
_sweep_stale_fixtures(docs)
|
||||
path = tempfile.mkdtemp(prefix=FIXTURE_PREFIX, dir=docs)
|
||||
try:
|
||||
final = os.path.join(path, "final")
|
||||
os.makedirs(final)
|
||||
with open(os.path.join(final, "document.md"), "w", encoding="utf-8") as fh:
|
||||
fh.write("# 계약 없는 프로젝트\n\n## §1 아무것도 아니다\n\n본문.\n")
|
||||
yield os.path.basename(path)
|
||||
finally:
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
|
||||
|
||||
|
||||
def _run(cmd: list[str]) -> subprocess.CompletedProcess:
|
||||
return subprocess.run(cmd, cwd=ROOT, capture_output=True, text=True, timeout=300)
|
||||
@@ -52,24 +116,20 @@ class NoTargetExitCode(unittest.TestCase):
|
||||
|
||||
def test_project_without_contract_is_not_a_target(self) -> None:
|
||||
"""계약이 없는 실재 프로젝트도 「대상이 성립하지 않는다」다."""
|
||||
base = os.path.join(ROOT, "docs", "ca-tmpl")
|
||||
if not os.path.isdir(base) or os.path.exists(os.path.join(base, "tech-log-studio")):
|
||||
self.skipTest("계약 없는 프로젝트가 이 저장소에 없다")
|
||||
for name in ("audit-records.py", "verify-tech-log-tree.py"):
|
||||
with self.subTest(checker=name):
|
||||
run = _run([sys.executable, os.path.join("scripts", name), "ca-tmpl"])
|
||||
self.assertEqual(run.returncode, 2, run.stdout + run.stderr)
|
||||
with _a_project_without_a_contract() as project:
|
||||
for name in ("audit-records.py", "verify-tech-log-tree.py"):
|
||||
with self.subTest(checker=name):
|
||||
run = _run([sys.executable, os.path.join("scripts", name), project])
|
||||
self.assertEqual(run.returncode, 2, run.stdout + run.stderr)
|
||||
|
||||
|
||||
class EmptyTargetIsNotGreen(unittest.TestCase):
|
||||
"""계약은 있고 기록이 0건인 것은 결함이 아니다. 다만 「문제 없음」이라고 쓰지 않는다."""
|
||||
|
||||
def test_zero_records_says_so(self) -> None:
|
||||
base = os.path.join(ROOT, "docs", "keycloak-session-store")
|
||||
if not os.path.isdir(base):
|
||||
self.skipTest("기록 0건 프로젝트가 이 저장소에 없다")
|
||||
run = _run([sys.executable, os.path.join("scripts", "audit-records.py"),
|
||||
"keycloak-session-store"])
|
||||
with _a_contract_with_no_records() as project:
|
||||
run = _run([sys.executable, os.path.join("scripts", "audit-records.py"),
|
||||
project])
|
||||
self.assertEqual(run.returncode, 0, run.stdout + run.stderr)
|
||||
self.assertIn("기록 0건", run.stdout)
|
||||
self.assertNotIn("문제 없음", run.stdout)
|
||||
@@ -108,16 +168,14 @@ class FileTargets(unittest.TestCase):
|
||||
class ContractlessProjectIsCounted(unittest.TestCase):
|
||||
"""계약이 없는 프로젝트가 전체 훑기의 목록에서 사라지면 안 된다 (R6).
|
||||
|
||||
`verify_projects()` 가 `docs/*/tech-log-studio` 만 훑던 동안 `ca-tmpl` 은
|
||||
`verify_projects()` 가 `docs/*/tech-log-studio` 만 훑던 동안 계약 없는 프로젝트는
|
||||
`TECH LOG TREES` 블록에 아예 안 나왔다. CLAUDE.md 는 「계약 미채택도 error」라고
|
||||
적었는데 그 error 를 셀 자리가 없었다.
|
||||
"""
|
||||
|
||||
def test_missing_contract_is_an_error(self) -> None:
|
||||
base = os.path.join(ROOT, "docs", "ca-tmpl")
|
||||
if not os.path.isdir(base) or os.path.exists(os.path.join(base, "tech-log-studio")):
|
||||
self.skipTest("계약 없는 프로젝트가 이 저장소에 없다")
|
||||
run = _run([sys.executable, os.path.join("scripts", "verify-pipeline.py")])
|
||||
with _a_project_without_a_contract():
|
||||
run = _run([sys.executable, os.path.join("scripts", "verify-pipeline.py")])
|
||||
self.assertIn("분해 계약 없음", run.stdout)
|
||||
block = run.stdout.split("TECH LOG TREES:", 1)
|
||||
self.assertEqual(len(block), 2, "TECH LOG TREES 블록이 없다")
|
||||
|
||||
Reference in New Issue
Block a user