Skip to content

Commit 8dc0a48

Browse files
committed
추가: simulate 공개 계약 폐쇄를 frozen manifest 기계 가드로 동결한다
실측된 결함: 계약 폐쇄 6모듈에 import 한 줄만 추가돼도 39k LoC initiative 스택이 조용히 공개 표면으로 승격되는데 아무 테스트도 못 잡았다. guard/rules.py 에 SIMULATE_CONTRACT_CLOSURE(6)·SIMULATE_OPERATIONAL_SURFACE(4, 월간 기대격자 cron 체인) frozen manifest 와 checkSimulateContractClosure 2중 검사(외부 유출 + 폐쇄 고정점, lazy·동적 포함) 추가. architecture 상주 테스트 3건(운영 manifest와 cron 스크립트 import 양방향 대조 포함). 위반 주입 음성 검증으로 검출 실측. 승격·삭제는 manifest 수정으로만 가능하다. 원장: 처분 프레임 종결 기록. architecture 전체 101 passed.
1 parent d3f69d1 commit 8dc0a48

3 files changed

Lines changed: 129 additions & 4 deletions

File tree

‎mainPlan/v1-readiness-review/01-verdict-ledger.md‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ Guard는 현재 레이어의 source를 동결한 뒤 한 번 실행한다. Guard
5656
architecture 1). `479d1ab0f` 에서 CI Fast·Full·CodeQL 전부 그린 실측.
5757
- dependabot: #100(pyarrow)·#101(mcp) 머지, #94(pillow)·#95(dompurify)는 dependabot
5858
자체 판단으로 폐기(이미 최신). 사람 PR #72 는 후속 부재로 안내 코멘트 후 닫음.
59-
- 대기 중 운영자 결정: **simulate 미도달 39k LoC(80모듈, 95%) 처분** (배선/삭제/격리).
60-
결함 9건은 이 스택 안의 잠복 부채로 재분류됨.
59+
- simulate 미도달 스택: **처분 결정 불요로 종결** (2026-08-04, 3-에이전트 토론 + 운영자
60+
문답). 스택은 scenario-simulator initiative 건설 현장으로 존치, 존폐는 initiative
61+
로드맵 시점의 결정. 계약 폐쇄는 frozen manifest 기계 가드로 동결
62+
(`api.simulateContractClosure`). 결함 9건은 initiative 재개 게이트(수리 전 공개 배선
63+
금지)로 결박된 잠복 부채.
6164
- 남은 부채(별건): realdata-plan corpProfile 준비 누락(CI 전용 경로), registry 죽은 툴
6265
2종(GroundingCheck·PickStoryTemplate), 반도체 집중도 공통 회계연도 60% 표본 미달 관찰.
6366
- 금지: 함수나 파일 하나만 끝내고 완료 보고, 하위 상태를 성공으로 승격,
@@ -3323,10 +3326,22 @@ rSquared 가 1.0 이 된다(입구 가드 `minOrigins < max(2, width)` 는 등
33233326
단 이 9건은 공개 표면에서 닿지 않으므로 사용자에게 나가는 오답이 아니라 잠복 부채다.
33243327

33253328
**판정: simulate 공개 계약 표면(entry·run·sheet·registry·transfer)은 결정론·honest-gap·
3326-
fail-closed 를 실측으로 통과했다. 미도달 39k LoC 의 처분(공개 계약으로 배선 / 삭제 /
3327-
명시적 비계약 격리)은 범위·존립 결정이므로 운영자 판단 대기다.** 처분이 정해지기 전까지
3329+
fail-closed 를 실측으로 통과했다.** 처분이 정해지기 전까지
33283330
이 스택의 결함 9건은 수리 대상이 아니라 처분 대상의 속성으로 기록한다.
33293331

3332+
**처분 종결 (2026-08-04 추기).** 3-에이전트 토론(계약 아키텍트·이니셔티브 심사역·유지비
3333+
회의론자)과 운영자 문답으로 "처분"이라는 프레임 자체를 폐기했다. 결정할 것이 없다:
3334+
스택은 활성 initiative(scenario-simulator)의 건설 현장이고 그 존폐는 initiative 로드맵
3335+
시점의 결정이며, 라이브 기대격자 체인 4모듈은 expectation-grid 소속의 승인된 운영
3336+
표면이다. 지금 실행할 유일한 것은 공개 호출계약의 기계 동결이었고 실장했다:
3337+
`guard/rules.py` 의 frozen manifest 2개(`SIMULATE_CONTRACT_CLOSURE` 6모듈,
3338+
`SIMULATE_OPERATIONAL_SURFACE` 4모듈)와 `checkSimulateContractClosure` 2중 검사
3339+
(외부 유출 + 폐쇄 고정점, lazy·동적 포함), `tests/architecture/
3340+
test_simulate_public_closure.py` 상주(운영 manifest ↔ cron 스크립트 import 양방향 대조
3341+
포함). 위반 주입 음성 검증으로 가드가 실제로 잡음을 실측했다. 이제 승격·삭제는 manifest
3342+
수정(=의도적 계약 검토)으로만 가능하다. 부대 규정: 이 스택의 pytest green 은 제품 검증으로
3343+
계상하지 않는다. 결함 9건 수리는 initiative 재개 시 단계 0 이며 수리 전 공개 배선 금지.
3344+
33303345
### ai/mcp 엔진 판정 (2026-08-04)
33313346

33323347
L4 최종 판정(8/2)이 후속으로 미룬 항목과 스테일 기재를 실측으로 정리했다.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""simulate 공개 계약 폐쇄의 얇은 Guard Index 접점.
2+
3+
공개 호출계약 강행규칙(CLAUDE.md)의 simulate 판: 계약 표면은 frozen manifest
4+
(guard.rules.SIMULATE_CONTRACT_CLOSURE) 6모듈로 고정되고, 나머지 스택은
5+
scenario-simulator initiative 자산이라 import 한 줄로도 공개 표면이 될 수 없다.
6+
승격·삭제는 manifest 수정(=의도적 계약 검토)으로만 한다.
7+
"""
8+
9+
from __future__ import annotations
10+
11+
import sys
12+
from pathlib import Path
13+
14+
REPO_ROOT = Path(__file__).resolve().parents[2]
15+
AUDIT_ROOT = REPO_ROOT / "tests" / "audit"
16+
if str(AUDIT_ROOT) not in sys.path:
17+
sys.path.insert(0, str(AUDIT_ROOT))
18+
19+
from guard.indexer import buildIndex # noqa: E402
20+
from guard.rules import ( # noqa: E402
21+
SIMULATE_CONTRACT_CLOSURE,
22+
SIMULATE_OPERATIONAL_SURFACE,
23+
checkSimulateContractClosure,
24+
)
25+
26+
27+
def test_simulate_contract_closure_is_fixed_point() -> None:
28+
"""계약 6모듈 밖 simulate 하위 모듈은 어떤 src 경로에서도 도달할 수 없어야 한다."""
29+
assert checkSimulateContractClosure(buildIndex(REPO_ROOT)) == []
30+
31+
32+
def test_manifests_are_disjoint_and_minimal() -> None:
33+
"""계약 폐쇄와 운영 표면은 겹치지 않고, 폐쇄는 실측된 6모듈 그대로여야 한다."""
34+
assert SIMULATE_CONTRACT_CLOSURE.isdisjoint(SIMULATE_OPERATIONAL_SURFACE)
35+
assert len(SIMULATE_CONTRACT_CLOSURE) == 6
36+
37+
38+
def test_operational_surface_matches_cron_script_imports() -> None:
39+
"""운영 manifest 는 월간 cron 스크립트의 실제 simulate import 와 일치해야 한다.
40+
41+
manifest 만 넓히거나 cron 만 바뀌는 stale 사고를 양방향으로 잡는다.
42+
"""
43+
import ast
44+
45+
script = REPO_ROOT / ".github" / "scripts" / "sync" / "buildExpectations.py"
46+
tree = ast.parse(script.read_text(encoding="utf-8"))
47+
imported: set[str] = set()
48+
for node in ast.walk(tree):
49+
if isinstance(node, ast.ImportFrom) and node.module and node.module.startswith("dartlab.simulate."):
50+
imported.add(node.module)
51+
# dataStore 는 expectationLedger 경유 전이 소비라 직접 import 목록에는 없어도 된다.
52+
assert imported <= SIMULATE_OPERATIONAL_SURFACE
53+
assert "dartlab.simulate.expectationCycle" in imported

‎tests/audit/guard/rules.py‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,29 @@
2929
"src/dartlab/providers/dart/company.py": "dart",
3030
"src/dartlab/providers/edgar/company.py": "edgar",
3131
}
32+
# simulate 공개 계약 폐쇄 frozen manifest. `simulate/__init__.py` import 에서 자동 도출하지
33+
# 않는다: 자동이면 import 한 줄 추가로 폐쇄가 넓어져 가드 목적이 무효가 된다. 이 목록의
34+
# 변경 = 의도적 계약 검토다(FROZEN_PROVIDER_COMPANY_SURFACE 선례). 실측(2026-08-04):
35+
# 공개 표면 전이 폐쇄는 86모듈 중 이 6개뿐이고, 나머지는 scenario-simulator initiative
36+
# 자산이라 import 한 줄로 39k LoC 가 조용히 공개 표면이 되는 사고를 오늘은 아무 테스트도
37+
# 못 잡았다.
38+
SIMULATE_CONTRACT_CLOSURE = {
39+
"dartlab.simulate",
40+
"dartlab.simulate.entry",
41+
"dartlab.simulate.registry",
42+
"dartlab.simulate.run",
43+
"dartlab.simulate.sheet",
44+
"dartlab.simulate.transfer",
45+
}
46+
# 계약 밖 승인된 운영 표면: `.github/scripts/sync/buildExpectations.py` 월간 cron 이
47+
# 소비하는 기대격자 체인(handbook architecture/analysisProducts.md 가 제품 구조로 기술).
48+
# src 안 소비자는 없어야 하며, 이 목록은 cron 스크립트 쪽 import 와 함께 갱신한다.
49+
SIMULATE_OPERATIONAL_SURFACE = {
50+
"dartlab.simulate.dataStore",
51+
"dartlab.simulate.estimateStatements",
52+
"dartlab.simulate.expectationCycle",
53+
"dartlab.simulate.expectationLedger",
54+
}
3255
FROZEN_PROVIDER_COMPANY_SURFACE = {
3356
"dart": {
3457
"analysis",
@@ -460,6 +483,40 @@ def checkProviderCompanyFile(path: Path, providerName: str) -> list[Violation]:
460483
return violations
461484

462485

486+
def checkSimulateContractClosure(records: list[ModuleRecord]) -> list[Violation]:
487+
"""simulate 공개 계약 폐쇄를 frozen manifest 로 고정한다.
488+
489+
검사 1(외부 유출): simulate 밖 src 모듈이 폐쇄·운영 manifest 밖의
490+
``dartlab.simulate.*`` 하위 모듈을 import 하면 위반. kind·phase 무관(lazy·동적 포함).
491+
검사 2(폐쇄 고정점): 폐쇄 6모듈 자신이 manifest 밖 simulate 모듈을 import 해도 위반.
492+
``run.py`` 에 import 한 줄이 추가되는 순간 39k LoC 가 공개 전이 표면으로 소리 없이
493+
승격되는 사고를 막는다. 승격·삭제는 manifest 수정(=의도적 계약 검토)으로만 가능하다.
494+
"""
495+
allowed = SIMULATE_CONTRACT_CLOSURE | SIMULATE_OPERATIONAL_SURFACE
496+
violations: list[Violation] = []
497+
for record in records:
498+
insideClosure = record.module in SIMULATE_CONTRACT_CLOSURE
499+
outsideSimulate = record.topPackage != "simulate"
500+
if not (insideClosure or outsideSimulate):
501+
continue
502+
for importRecord in record.imports:
503+
module = importRecord.module
504+
if not module.startswith("dartlab.simulate.") or module in allowed:
505+
continue
506+
kind = "closure-fixed-point" if insideClosure else "outside-leak"
507+
violations.append(
508+
makeViolation(
509+
"api.simulateContractClosure",
510+
record.path,
511+
importRecord.line,
512+
f"{record.module} imports non-contract {module}",
513+
importKind=kind,
514+
subject=module,
515+
)
516+
)
517+
return violations
518+
519+
463520
def makeViolation(
464521
rule: str,
465522
path: str,

0 commit comments

Comments
 (0)