# task-2757+1 — v2.13 thin gate r2 bounded HIGH fix (expected_files 7파일 내부만)

## ★ 회장 결정 (r2 bounded fix 승인 — 2026-06-17)
PR #235 Gemini inline **HIGH 11 + Medium 8** = thin gate 핵심 기능을 실제 우회시키는 결함 → 범위 확장 아닌 **goal-enabling correction**. **expected_files 7파일 내부에서만** 1회 fix. 상태 `PR235_TASK2757_R2_BOUNDED_HIGH_FIX_APPROVED_ACTIVE_FALSE`. ACTIVE=false.

## base / 산출
- base = clean origin/main `8420a763`. fresh branch `task/task-2757+1`. 참조 = `origin/task/task-2757-r1`(35be24cf) 7파일.
- **PR 생성 금지**(ANU replacement PR 통제)·branch push only. **isolated worktree 진행**.

## 수정 범위 = 기존 7파일 내부만 (새 모듈/파일 추가 금지)
`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`

## HIGH 11 대응 (각각 테스트 명시)
1. **classify_gate가 contract rollback_floor 무시** → contract.rollback_floor를 floor table max에 반영(reported/table/contract 중 max).
2. **control_db_op rollback floor 과소평가** → runtime_state.control_db_op=True 시 floor=HIGH 이상 강제.
3. **promotion_self_approval rollback floor 과소평가** → promotion APPROVED 전환 시 floor=IRREVERSIBLE.
4. **_is_sqlite_write DDL/REPLACE 키워드 누락** → insert/update/delete + **REPLACE/CREATE/ALTER/DROP/TRUNCATE** 추가(대소문자 무관).
5. **_is_control_table_write 탐지 누락** → control table(bots/promotions/ledger) + REPLACE/DDL 우회 방어.
6~9. **하드코딩 절대경로 `/home/jay/workspace`** → 동적 resolve(module-level `_ROOT = os.environ.get('ANU_WORKSPACE') or git rev-parse --show-toplevel or os.getcwd()` 등). default arg에 하드코딩 금지.
10. **비원자적 파일 쓰기(matrix/ledger)** → atomic write(tmp write+flush+fsync+os.replace).
11. **forbidden op / haystack `fp in haystack` case-sensitive** → **case-insensitive** + 공백/형식 우회 방어(정규화 후 비교).

## Medium 8 처리
HIGH와 같은 축(token=/status=/curl 공백 정규식 우회·하드코딩 경로·non-atomic write)이면 **HIGH와 함께 닫음**. 별도 축이면 보고 후 보류(추가 fix 0).

## 테스트
HIGH 11 각각 대응 regression + Medium 공백/형식 우회 케이스. 기존 92 test 유지/확장. 예: rollback_floor contract 반영 / control_db_op·promotion floor / DDL·REPLACE·대문자 sqlite 탐지 / 동적 경로(ANU_WORKSPACE 주입) / atomic write 중단 시뮬 / case-insensitive forbidden(대문자·공백) 차단.

## 금지 (위반 시 STOP_REPORT)
expected_files 7개 밖 수정 · 새 모듈/파일 추가 · daemon/socket/API/external probe/key custody/DB permission/systemd 구현 · callback/wake launch · C(event strategy) 착수 · PR 생성/merge/push to main · unrelated cleanup · Gemini 빌미 scope 확장 · credential/permission/systemd/production/callback/wake/merge 축 터치 · ACTIVE=true.

## 중단 조건 (STOP_REPORT)
7파일 밖 수정 필요 · 새 파일 필요 · HIGH 다른 축 신규 발생 · 동일 축 수정 후 HIGH 반복(구조 재설계 필요).

## 산출물 / callback
`task/task-2757+1` branch commit + push (PR 0). ANU normal callback(ANU key `c119085addb0f8b7`·self-key 금지·UTF-8 ≤3900 bytes). 완료보고에 **HIGH 11 대응표 + Medium 8 처리표 + 추가테스트 수** 명시.

## 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/**"
  commands: ["pytest","python3 -m py_compile","git"]
  merge_policy: "none"
  ttl_hours: 12
```
