# task-2758 — non-matching thin gate 분리 PR (matching 제거, 새 goal_id)

## ★ 회장 결정 (2026-06-17)
matching 축 4회차 종료·보류. **non-matching thin gate만 분리 구성**. C1(Step5 goal expansion 살림)·external_probe 판정분기 살림 승인. matching 로직 재도입/r5 미세수정/PR#235~238 재활용 금지. 상태 `TASK2758_NON_MATCHING_THIN_GATE_SPLIT_PR_CANDIDATE_ACTIVE_FALSE`. ACTIVE=false.

## base / branch / PR
- base = **clean origin/main `8420a763`**. fresh branch `task/task-2758`. isolated worktree. PR #235~238 재활용 금지·PR 생성 금지·branch push only(ANU가 fresh PR 통제).
- 참조(코드 발췌용) = `origin/task/task-2757+3`(fd7ce69f)의 7파일. 단 matching 부분 제거하고 가져옴.

## 수정 범위 = 기존 7파일 경계만 (새 파일/모듈 0)
dispatch/v2_13_gate.py · dispatch/control_db_guard.py · scripts/correction_budget.py · scripts/promotion_guard.py · scripts/migrate_capability_matrix_v213.py · memory/schemas/goal_contract_schema.json · tests/regression/test_v213_phase1_gate_2757.py

## 남길 기능 (non-matching)
- `goal_contract_schema.json` · `GateVerdict` enum/GATE_VERDICTS
- rollback floor: ROLLBACK_FLOOR_TABLE·COST_ORDER·_cost_rank·rollback_floor·max_rollback_cost·effective_floor (contract.rollback_floor 반영 포함)
- `correction_budget.py`(budget ledger) · `control_db_guard.py` · `promotion_guard.py` · `migrate_capability_matrix_v213.py`(migration 로직/테스트만 — §아래 matrix 보정)
- `build_escalation_packet`·ESCALATION_PACKET_FIELDS
- `classify_gate` 분기: provenance검증 / control_db(**rs.control_db_op flag만**) / promotion(**rs.promotion_self_approval flag만**) / external_probe(**rs.external_probe_required + external_probe_status flag만**) / rollback floor violation / budget / **Step5 goal expansion** / semantic residue / allowed

## ★ Step5 goal expansion (C1 — 구조화 입력만)
- `rs.touched_files`(구조화 list) vs `contract.expected_files`를 **normalize_path normalize 후 set membership 비교만** 유지.
- **diff/tool_calls 비정형 텍스트 추출 기반 matching 재도입 절대 금지.**
- `normalize_path`는 **안전버전만**: `./` 제거 · 중복 slash 축약 · OS sep→posix. **`a/`·`b/` 무조건 strip 금지 · substring matching 금지 · 소문자화 금지.**

## ★ external_probe (판정분기만)
- `rs.external_probe_required` / `rs.external_probe_status` flag 기반 verdict(EXTERNAL_PROBE_REQUIRED)만 유지. **probe daemon·key custody·external probe 구현 금지.**

## 제거/비활성화 (matching — 파일에서 삭제)
- `detect_allowlist_axis` · `_extract_touched_files` · `_glob_match` · `_match_forbidden_paths` · `_match_forbidden_ops` · `_is_word_form_op` · `_phrase_in_tokens` · matching 전용 `_normalize`/`normalize_path`의 matching 경로 (단 Step5용 안전 normalize_path는 잔존)
- `classify_gate`의 `touched_axes = detect_allowlist_axis(...)` 호출 제거 → `touched_axes = []`
- `ALLOWLIST_AXIS_CHAIR_REQUIRED` 실제 trigger 경로 제거(enum 상수는 보존 + dead-trigger 주석)
- control_db/promotion 분기의 `"control_db_write"/"promotion_approved" in touched_axes` **보조조건 제거**(rs flag 단독 판정)
- dead code 잔존 금지(Gemini 재지적 회피) — matching 함수 완전 삭제

## ★ matrix 보정 (회장 — PR diff 오염 금지)
- `automation_capability_matrix.json`(live 상태 파일)이 **7파일 밖이면 이번 PR에 포함 금지.** 이번 PR엔 **migration 로직 + 그 테스트만**. live matrix 상태 반영은 별도 운영/승인으로 분리.
- matrix split 내용(non_matching_thin_gate / matching_axis DESIGN_REVIEW_REQUIRED)은 **보고서/result.json에만 기록**, PR diff에 넣지 말 것.

## 테스트
- matching 테스트(detect_allowlist_axis·forbidden op/path·normalize strip·glob·_extract_touched_files) **제거/비활성화**.
- 유지/재구성: floor · budget · control_db · promotion · escalation · schema · migrate · provenance · **external_probe flag** · **Step5 goal expansion(rs.touched_files vs expected_files normalize set)** · semantic residue · allowed.
- 제거 후 전수 PASS 확인. py_compile PASS.

## 금지 (위반 시 STOP_REPORT)
matching 로직 재도입 · r5 미세수정 · 새 matching 모듈/새 파일 · systemd · callback/wake 확장 · external probe/ANU-Control daemon 구현 · C(event strategy) · ACTIVE=true · merge/admin override · 7파일 밖 수정(automation_capability_matrix.json live 포함 금지) · PR 생성/push to main.

## 중단 조건 (STOP_REPORT)
7파일 밖 수정 필요 · 새 파일 필요 · matching 없이 남길 기능이 안 닫힘 · credential/permission/systemd/production/callback/wake/merge 축 터치.

## 산출물 / callback
`task/task-2758` branch commit + push(PR 0). 종료 전 ANU normal callback 필수 — ANU key `c119085addb0f8b7`(self-key 금지·UTF-8 wc -c ≤3900 bytes·envelope만: task_id/branch/head/result_path/sha256/collector_role=ANU/one-line + 남긴기능/제거기능/테스트수 요약).

## allowed_resources
```yaml
allowed_resources:
  paths:
    - "dispatch/v2_13_gate.py"
    - "dispatch/control_db_guard.py"
    - "scripts/correction_budget.py"
    - "scripts/promotion_guard.py"
    - "scripts/migrate_capability_matrix_v213.py"
    - "memory/schemas/goal_contract_schema.json"
    - "tests/regression/test_v213_phase1_gate_2757.py"
  forbidden_paths: ["**/*.service","**/*.path","dispatch/anu_pickup_driver.py","dispatch/anu_result_pickup_runner.py",".github/**","memory/state/automation_capability_matrix.json"]
  commands: ["pytest","python3 -m py_compile","git"]
  merge_policy: "none"
  ttl_hours: 12
```
