# task-2716+3 — PR #162 same-PR bounded fix 1회 (회장 인가, dev4)

- **팀**: dev4-team (비슈누)
- **PR**: #162, head `430c58df` (branch task/task-2716-clean-dev4)
- **★ 작업 위치**: `/home/jay/.cokacdir/workspace/wt-2716-clean`. 시작 시 `git fetch origin && git merge --ff-only origin/task/task-2716-clean-dev4`(=430c58df) 후 작업. /home/jay/workspace(오염) 금지. 새 worktree 금지.
- **분류**: 회장 인가 same-PR bounded fix 1회. task-2717과 혼입 금지(별도 트랙).
- **validity 확인 완료(ANU read-only)**: 4건 전부 valid, dismiss 0.

## 수정 4건 (회장 수정 원칙 내 최소수정)

### 1. scripts/finish-task.sh:563 — HIGH (TASK_FILE word splitting)
`${TASK_FILE:+--task-md "$TASK_FILE"}` 미인용 확장 → TASK_FILE 공백 시 word splitting.
- **fix**: word splitting 방지 **최소 bash-safe 처리만**(예: 조건 분기로 `[ -n "$TASK_FILE" ] && set -- --task-md "$TASK_FILE"` 식 배열/인용 안전화, 또는 동등 안전 패턴). behavior(가드 호출 결과) 불변.

### 2. scripts/harness/v36/pr_diff_hygiene_guard.py — MED (fnmatch deterministic)
`fnmatch()` → OS별 case 정책. **Linux 프로덕션은 이미 case-sensitive**이나 deterministic/portable화.
- **fix**: 해당 매칭을 **`fnmatchcase`** 로 교체(deterministic). 매칭 의미(정밀도) 불변, case 결정성만 명시화. trailing-slash broad allowlist 변경 0.

### 3. pr_diff_hygiene_guard.py:191 — MED (header regex h1~h3만)
`(?=\n#{1,3} |\Z)` → h4~h6 헤더를 블록 경계로 미인식.
- **fix**: `#{1,6}` 로 확장(h1~h6 모두 경계 인식). §Affected Files 수집 확대 아님 — 경계 인식만.

### 4. pr_diff_hygiene_guard.py:194 — MED (inline comment 오인)
list item 인라인 주석(`- file.py  # 설명`)을 경로 일부로 오인.
- **fix**: 토큰에서 **인라인 주석(`#` 이후) strip**(YAML 안전 범위). 경로만 추출. parser behavior 확대 금지(주석 제거만).

## 수정 원칙/금지 (회장 verbatim)
- trailing slash broad allowlist 변경 금지 · §Affected Files 수집 regex/parser 확대 금지 · CI workflow 수정 금지 · callback/evidence/memory artifact PR diff 포함 금지 · task-2717 혼입 금지 · replacement PR 금지 · force push/rebase 금지 · finish-task 반복 호출 금지.

## 허용 파일 (이 3개만)
scripts/finish-task.sh · scripts/harness/v36/pr_diff_hygiene_guard.py · tests/harness/test_v36_pr_diff_hygiene_guard.py

## 검증 (전부 PASS)
- `bash -n scripts/finish-task.sh`
- pr_diff_hygiene_guard 관련 regression 전체 PASS
- 신규 regression 4: word splitting(공백 TASK_FILE) / fnmatchcase deterministic / h4~h6 header 경계 / inline comment stripping
- `git diff --name-only origin/main...HEAD` = expected_files only · forbidden 0 · artifact 0 · CI workflow 0

## push (★ dev4 push 금지 — ANU 수행)
dev bot token 부재 → 로컬 commit 까지만. push 는 **ANU 독립 재검증 후 OWNER PAT FF push**.

## HARD_STOP (회장 verbatim)
이번 fix push 후 OWNER /gemini fresh trigger → **새 valid finding 또 나오면 자동수정 금지 → HARD_STOP 으로 회장 보고.** (LOOP_BOUNDARY 다음 단계)

## 완료 시 ANU normal callback (ANU key c119085addb0f8b7, self-key 금지)
envelope: task_id=task-2716+3 / new_commit_sha / files_changed / bash_n / regression_result / expected_files_only / ci_workflow_untouched / schedule_id / collector_role=ANU / self_key_used=false. ★schedule_id 생성까지. stale envelope 재사용 0. 상세 report 1개. (단 self-collector 재발 시 ANU NON_AUTHORITATIVE 처리 후 독립검증)
