Skip to content

fix(menu-tier): close gap 3 for destructive sequences - #1072

Merged
devseunggwan merged 2 commits into
mainfrom
issue-974-fix-menu-tier-gap3
Aug 22, 2026
Merged

devseunggwan merged 2 commits into
mainfrom
issue-974-fix-menu-tier-gap3

Conversation

@devseunggwan

@devseunggwan devseunggwan commented Aug 22, 2026 •

Copy link
Copy Markdown
Owner

무엇이 바뀌나

승인 메뉴의 "안전한" 선택지가 사실은 삭제를 품고 있을 때, 지금까지 침묵하던 자리에서 advisory 가 뜹니다.

잔여가 실재합니다 — 재현부터 했습니다

이슈 본문은 gap 3 을 "재현하지 않았다" 고 명시했고, PR #1016 은 이 잔여를 d9 픽스처로 현재(결함 있는) 동작 그대로 고정해 두었습니다. 그래서 고치기 전에 오늘 코드에서 재현되는지부터 확인했습니다.

같은 두 옵션 메뉴 하나를 수정 전후 impl.py 에 각각 먹였습니다.

$ mk "Dry-run then delete the customer table" "Delete the customer table" | python3 <수정 전>/impl.py
  (빈 출력, rc=0)

$ mk "Dry-run then delete the customer table" "Delete the customer table" | python3 <수정 후>/impl.py
  [advisory] AskUserQuestion approval menu offers no non-mutating tier. ...

빈 출력이 프로브 실패가 아님을 보이는 양성 대조 — 같은 구조에 prod 만 넣으면 수정 전에도 발화합니다. 즉 훅은 살아 있었고, 이 형태만 빠져나갔습니다.

Dry-run then delete the customer table 은 절이 두 개입니다. safe 모드는 첫 절만 덮고 delete 는 무조건 실행되는데, _is_low_blast 는 low-blast 토큰 하나만 보고 이걸 안전한 선택지로 셌습니다.

어떻게 고쳤나 — 넓은 수정은 이미 기각된 적이 있습니다

PR #1016 은 "safe MODE 토큰 + 아무 mutation 동사 ⇒ non-low-blast" 라는 넓은 규칙을 만들어서 측정하고 기각했습니다. 이 훅이 메뉴에 담기를 바라는 바로 그 단일절 dry-run 대안 4건에 오발화했기 때문입니다.

그래서 파괴적 동사(delete / drop / truncate / 삭제)로만 범위를 좁힌 Tier 1e 를 넣었습니다. 공유 표면을 지칭하는 파괴적 동사가 연결어(then / " 후 ") 뒤에 오고 같은 옵션에 safe-MODE 토큰이 있으면 low-blast 판정을 취소합니다.

한국어 연결어는 맨 후 가 아니라 양쪽에 공백을 둔 " 후 " 입니다 — 맨 글자는 이후·최후·후보·오후 의 부분 문자열이라, 조사 "후" 로 홀로 설 때만 걸리게 했습니다. 영문 쪽이 이미 쓰는 lookaround 와 같은 규율입니다.

기각됐던 4건이 여전히 침묵하는지 재측정했습니다

가정하지 않고 실제로 돌렸습니다.

["Deploy now", "Dry-run the deploy"]                        → 침묵
["Merge now", "Simulate the merge"]                         → 침묵
["Send the announcement", "Report-only pass on the send"]   → 침묵
["지금 배포", "배포 드라이런"]                                → 침묵

넷 다 파괴적 동사를 쓰지 않아 좁힌 규칙에 닿지 않습니다. 새 판별식 자체에 대한 거짓양성 대조 2건도 함께 넣었습니다 — Dry-run then delete the test fixture 는 local-artifact 베토로, 연결어 없는 Delete now / Dry-run the delete 는 연결어 부재로 각각 침묵합니다.

검증

$ bash tests/hooks/advisory-nudge/test_menu_mutation_tier.sh
PASS=113 FAIL=0

$ python3 scripts/check-plugin-manifests.py
plugin-manifest check OK

$ python3 -m ruff check hooks/advisory-nudge/menu-mutation-tier-advisory/impl.py
All checks passed!

$ shellcheck tests/hooks/advisory-nudge/test_menu_mutation_tier.sh
(출력 없음 = clean)

기존 110건을 전수 재확인했고, 잔여 3건이 advisory×2 + strict-block×1 로 바뀌었습니다.

의도적으로 남긴 경계

Dry-run then merge the PR 처럼 파괴적이지 않은 동사의 연쇄는 그대로 침묵합니다. 넓히면 위의 기각된 4건이 되살아나기 때문이고, spec.md 의 Tier 1e 절에 새 gap 이 아니라 명시된 범위 경계로 적었습니다.

이 이슈의 작업 3건 중 (1)·(2) 는 PR #1016 이 이미 닫았고, 이 PR 이 마지막 (3) 을 닫습니다.

Pre-commit verified: bash tests/hooks/advisory-nudge/test_menu_mutation_tier.sh → PASS 113 / FAIL 0, python3 scripts/check-plugin-manifests.py → plugin-manifest check OK, ruff check → All checks passed!, shellcheck → clean
Caller chain verified: _has_sequential_destructive_mutation 은 menu-mutation-tier-advisory/impl.py 모듈 내부 심볼이며 그 디렉터리 밖 소비자가 0건입니다 (grep -rn "_has_sequential_destructive_mutation" → impl.py 외 없음). _is_low_blast 의 시그니처는 무변경이라 기존 호출부가 그대로입니다. 매니페스트 등록은 기존 그대로입니다.

Closes #974

Summary by CodeRabbit

  • Bug Fixes

    • Improved advisories for menu options that combine a safe-mode action with a subsequent destructive action targeting shared resources.
    • Added support for detecting these sequential patterns in English and Korean.
    • Preserved safe alternatives and avoided alerts for non-destructive actions, local-only artifacts, read-only follow-ups, or destructive actions properly covered by safe mode.
  • Documentation

    • Documented the updated destructive-action detection rules and remaining limitations.

이슈 #974 gap 3(PR #966 codex 라운드-1 세 번째 지적)를 닫는다. PR #1016은
이 잔여(`Dry-run then delete the customer table` / `Delete the customer
table`가 두 모드 모두 침묵)를 재현하고 넓은 수정(safe MODE + 아무 mutation
동사나 ⇒ non-low-blast)을 만들었다가 `Deploy now` / `Dry-run the deploy`,
`Merge now` / `Simulate the merge`, `Send the announcement` /
`Report-only pass on the send`, `지금 배포` / `배포 드라이런` — 이 훅이
메뉴에 담기를 바라는 정확한 단일절 dry-run 대안 4건에서 오발화해 기각하고,
d9 픽스처로 현재(결함 있는) 동작을 고정했다.

재현 확인(현재 impl.py, 수정 전):
  $ python3 impl.py < gap3.json   # Dry-run then delete the customer table
  (침묵, rc=0)                    # / Delete the customer table
  $ python3 impl.py < gap3ctrl.json  # 동일 구조 + prod
  [advisory] ...                  # (advisory 발화, strict rc=2) — 잔여가 실재함을 증명

파괴적 동사(delete/drop/truncate/삭제)로 범위를 좁힌 Tier 1e를 추가했다 —
같은 옵션 안에서 safe-MODE 토큰과 공유 표면을 지칭하는 파괴적 동사가
연결어(`then` / ` 후 `)로 이어지면 두 번째 절이 무조건 실행되는 것으로 보고
low-blast 판정을 취소한다. PR #1016이 기각한 4건 반례는 전부
deploy/merge/send를 쓰고 파괴적 동사를 쓰지 않아 좁힌 규칙에 걸리지 않는다
— 4건 모두 재측정해 여전히 침묵함을 확인했다. `merge`/`deploy`/`send` 등
나머지 Tier 1b 동사는 의도적으로 Tier 1e 밖에 남긴다.

수정 후 재현:
  $ python3 impl.py < gap3.json
  [advisory] ... rc=0 (advisory)
  $ PRAXIS_MENU_MUTATION_TIER_STRICT=1 python3 impl.py < gap3.json
  BLOCKED: ... rc=2

거짓양성 대조(신규 판별식 자체에 대한):
  - `Dry-run then delete the test fixture` — LOCAL_ARTIFACT 베토로 침묵 유지
  - `Delete now` / `Dry-run the delete` (연결어 없음) — 침묵 유지

테스트: tests/hooks/advisory-nudge/test_menu_mutation_tier.sh PASS=113
FAIL=0 (기존 110건 전수 재확인, 잔여 3건 → advisory×2+strict-block×1로
치환, 반례 4건 재측정 유지, 신규 거짓양성 대조 2건 추가).
python3 scripts/check-plugin-manifests.py → "plugin-manifest check OK".
shellcheck tests/hooks/advisory-nudge/test_menu_mutation_tier.sh → clean.

Refs #974

Confidence: medium
Not-tested: runtime firing inside Claude Code; Korean coverage is synthetic; shellcheck ran clean but no live-session traffic validation of the new discriminator
@devseunggwan devseunggwan self-assigned this Aug 22, 2026
@coderabbitai

coderabbitai Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 938c1cd2-df37-4586-914d-2e37229881c9

📥 Commits

Reviewing files that changed from the base of the PR and between 53edd02 and 30319ac.

📒 Files selected for processing (3)
  • hooks/advisory-nudge/menu-mutation-tier-advisory/impl.py
  • hooks/advisory-nudge/menu-mutation-tier-advisory/spec.md
  • tests/hooks/advisory-nudge/test_menu_mutation_tier.sh

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The advisory detects destructive mutations in sequential clauses after safe-mode tokens. It supports English and Korean connectors, preserves safe alternatives, documents Tier 1e behavior, and adds positive, negative, strict-mode, and reverse-order tests.

Changes

Sequential destructive mutation advisory

Layer / File(s) Summary
Sequential destructive mutation rule
hooks/advisory-nudge/menu-mutation-tier-advisory/impl.py, hooks/advisory-nudge/menu-mutation-tier-advisory/spec.md
The implementation detects ungated delete, drop, truncate, and 삭제 actions after supported sequence connectors on shared surfaces. The specification documents Tier 1e behavior and remaining limitations.
Positive and counter-case coverage
tests/hooks/advisory-nudge/test_menu_mutation_tier.sh
Tests cover English and Korean sequential actions, strict mode, reverse clause order, existing high-blast behavior, non-destructive verbs, local artifacts, missing connectors, and read-only follow-up clauses.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 30319

This PR adds advisory detection for approval-menu options that combine a safe-mode phrase with a subsequent destructive action, with targeted regression coverage and passing checks; no actionable merge-blocking risk remains beyond normal review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the menu-tier fix and the destructive-sequence gap addressed by the changes.
Linked Issues check ✅ Passed The implementation, specification, and tests address Gap 3 in issue #974 by detecting destructive sequences while preserving required exclusions and controls.
Out of Scope Changes check ✅ Passed The changes are limited to Gap 3 implementation, documentation, and tests described in issue #974.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-974-fix-menu-tier-gap3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Codex P1 (PR #1072). 앞 커밋의 Tier 1e 는 연결어·파괴적 동사·공유
표면이 한 옵션에 함께 있기만 하면 탈락시켰다. 그래서
`Dry-run the delete operation, then inspect the customer table` —
삭제가 dry-run 의 목적어이고 뒷절은 조회뿐인 안전한 옵션 — 까지
탈락해, strict 모드가 정상 메뉴를 차단했다. 훅의 목적과 정반대다.

연결어로 절을 쪼개고, low-blast 토큰이 없는 절에 파괴적 동사가
있을 때만 탈락시킨다. 순서 특례가 사라진다 —
`Delete the table, then dry-run to confirm` 은 첫 절에서 걸린다.

수정 전 오차단 재현: 위 입력이 default advisory / strict rc=2.
수정 후 침묵하고, gap 3 두 형태와 역순은 계속 발화한다.
PR #1016 이 기각한 반례 4건과 기존 대조군 2건도 재측정해 침묵 유지.

테스트 115/115 (회귀 fixture 2건 추가: P1 입력, 역순).

Confidence: high
Not-tested: 런타임 발화; 한국어 커버리지는 합성 입력
Session-Id: 986b3ff6-861d-4339-9c8a-4442f03ed2df
@devseunggwan
devseunggwan merged commit 58a2afa into main Aug 22, 2026
10 checks passed
@devseunggwan
devseunggwan deleted the issue-974-fix-menu-tier-gap3 branch August 22, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(hooks): close menu tier advisory vocabulary coverage gaps

1 participant