feat(harness): add structural workflow guard gates

This commit is contained in:
2026-10-10 01:04:29 +00:00
parent ac3cfdaeb9
commit 3dce776298
8 changed files with 1038 additions and 0 deletions
@@ -153,6 +153,8 @@ Discovery가 `신규 작성` 또는 `수정`으로 판정한 문서만 작성한
### 7. Test-first 구현
[공통 workflow guard 계약](../../../../operations/repository-cache.md#shared-workflow-guard-gates)을 baseline 조사·첫 편집·독립 검토·결과 채택 단계에 적용한다. 첫 편집 전에 테스트 ID/skip/expected-failure와 영향을 받는 기존 API·CLI·상태·cleanup 의미를 기록하고 `check-tests --input JSON` 및 `check-contracts --input JSON`으로 검증한다. 읽기 전용 worker 시작 전에 `python3 <harness-root>/harness/lib/workflow_guard.py snapshot --repo-root ROOT --paths-json INPUT --output SNAPSHOT`으로 immutable protected scope를 고정하고, 결과 채택 전에 `compare-source --repo-root ROOT --before SNAPSHOT --paths-json INPUT`을 실행한다. 쓰기 worker의 승인된 편집은 실제 diff로 검토하며 최종 독립 검토 중에는 보호 범위 mutator를 실행하지 않는다. 기록은 제품 checkout 밖 정본 verification run에 보존한다. 변경된 테스트의 의미 보존과 named finding의 실제 RED/GREEN 원인은 main agent가 확인한다. 필요한 gate·근거가 미해결이면 완료로 판정하지 않는다.
1. Acceptance matrix에서 변경 전 실패해야 하는 정상, 실패, 경계와 보안 test를 먼저 추가한다.
- Test file과 test function 이름은 추적 번호가 아니라 안정적인 기능·동작·불변조건을 표현한다. Issue, PR, review, comment 번호나 일시적인 finding ID를 이름에 넣지 않는다. 추적성은 acceptance matrix, commit, PR과 evidence metadata에 기록한다.
2. 새 test가 의도한 이유로 실패하는지 실행해 확인한다. 환경 오류나 잘못된 fixture 실패를 RED evidence로 사용하지 않는다.
@@ -71,6 +71,8 @@ Repository file을 수정하기 전에 다음을 모두 검증한다.
## Snapshot과 finding matrix
첫 write 전에 canonical collection의 test inventory와 영향을 받는 API·CLI·필드·상태·cleanup 의미를 snapshot/finding matrix에 연결하고 [공통 workflow guard 계약](../../../../operations/repository-cache.md#shared-workflow-guard-gates)을 적용한다. `python3 <harness-root>/harness/lib/workflow_guard.py check-tests --input JSON`과 `check-contracts --input JSON`을 결과 채택 전에 실행한다. RED/GREEN records must be named: 각 유효한 finding은 current test ID와 실제 실행 기록에 결합하며 환경/import 오류나 반증된 지적에 가짜 RED를 만들지 않는다. 읽기 전용 검토에는 위임 전 source snapshot과 채택 전 비교를 요구하고, 승인된 쓰기 worker의 편집에는 diff·의미 검토를 적용한다. 기록은 제품 checkout 밖 정본 verification run에 보존하며 helper schema·증거를 검증한다. gate failure는 운영 근거 무효이지 자동 제품 결함이 아니다.
첫 write 전에 다음 immutable snapshot을 보존한다.
- Issue title, body, state, `updated_at`, labels, assignees, milestone, 전체 comments와 body SHA-256
@@ -38,6 +38,8 @@ Bootstrap 이후 code review는 canonical [Repository cache 운영 지침](../..
## 리뷰 관점
읽기 전용 위임과 최종 결과 채택에는 [공통 workflow guard 계약](../../../../operations/repository-cache.md#shared-workflow-guard-gates)을 적용한다. 사용이 허용된 source에서 위임 전 보호 범위를 snapshot하고 채택 전 compare-source를 완료한다. 최종 독립 검토 중 보호 범위 mutator를 병렬 실행하지 않는다. `check-tests --input JSON`으로 기존 ID·status·finding 연결을 확인하고 변경된 assertion·fixture·mock의 의미 검출력을 직접 검토한다. API·CLI·필드·상태·cleanup 보존과 실제 public-response 관찰을 대조한다. 기록은 제품 checkout 밖 허용된 정본 artifact에 보존하고 시작 baseline 누락·source drift이면 PASS를 채택하거나 자동 복구하지 않는다. 운영 근거 실패와 제품 finding을 구분한다.
- **정확성·회귀:** 조건 분기, 경계값, 상태 전이, 데이터 처리와 기존 호출자에 대한 부작용.
- **보안:** 인증·인가, 입력 검증, injection·경로 탈출, secret 노출, cookie·origin·proxy trust와 fail-closed/no-call/no-write 경계.
- **동시성·복구:** race, 원자성, 잠금 순서, timeout·retry·중복 처리, 부분 실패와 자원 정리.
@@ -71,6 +71,8 @@ Issue comment·body·title·state·label·assignee·milestone, repository file,
## Acceptance matrix
Verdict 확정 전에 immutable provider/Git blob·contract·PR snapshot에 결합된 complete baseline inventory를 [공통 workflow guard 계약](../../../../operations/repository-cache.md#shared-workflow-guard-gates)과 대조하고 `python3 <harness-root>/harness/lib/workflow_guard.py check-contracts --input JSON`을 실행한다. 기존 의미는 실제 current 항목·검증 근거에 대응하며 의도적 변경에는 승인 근거가 필요하다. 미확인 관찰·missing·ambiguous를 개수나 승인 문자열로 통과시키지 않는다. API·CLI·필드·상태·cleanup 의미까지 확인하되 새 제품 요구사항을 만들지 않는다. Gate failure invalidates workflow evidence: 운영 근거 무효와 제품 계약 위반을 분리한다. 기존 provider/blob source binding, evidence 경로/schema, moving implementation checkout 사용 금지와 제품 독립 실행 제한은 그대로이며 local snapshot helper가 그 권한을 확대하지 않는다.
Discovery의 포함 범위, 제외 범위, 제약 조건, 확정된 결정과 `문서 영향 및 산출물`에서 판정 가능한 항목을 추출한다. 각 항목을 다음 필드로 기록한다.
```text