You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: the destructive-home test guard only recognises single-line rmSync(getConfigDir()) #4705
tests/ci-workflows/test-home-guard.test.ts exists because a test once deleted the real OpenCodex home. The source scan it performs recognises only same-line forms — rmSync(getConfigDir()) and const x = getConfigDir().
Multiline calls, let aliases, helper wrappers, fs.rmSync(...), and the sibling resolvers getConfigPath() and usageLogPath() all pass it. A future test could reintroduce the exact incident while CI stays green.
The specific quota test that caused the original incident is correctly fixed (tests/usage/quota-reset-seen-store.test.ts:39-46,111-119 creates and pins a temporary home and deletes only that), and no other committed test currently deletes the real home. This is about the guard, not a live defect.
Reproduction
Read the source scan in tests/ci-workflows/test-home-guard.test.ts:552.
Write a test that resolves the home through a let alias or a helper wrapper and deletes it, or that splits the call across lines.
The guard does not flag it.
Suggested fix: use an AST scan instead of line matching, or require destructive tests to delete only paths handed out by an ownership-tracking fixture, with adversarial false-negative cases in the guard's own tests.
이 이슈는 파괴적 home 삭제를 막는 테스트 가드가 한 줄 패턴만 본다는 한계 보고다. tip의 tests/ci-workflows/test-home-guard.test.ts 약 552행대는 rmSync|rmdirSync|unlinkSync|...가 같은 줄에서 getConfigDir()를 받거나, const x = getConfigDir()로 묶인 이름만 추적한다. let 별칭, 헬퍼 래퍼, 여러 줄 호출, fs.rmSync, 형제 getConfigPath()/usageLogPath()는 통과한다. 주석이 말하는 2026-09-15 실홈 삭제 사고의 재발을, 형태만 바꾸면 CI가 못 잡을 수 있다.
좋은 소식은 당시 원인 테스트(tests/usage/quota-reset-seen-store.test.ts)는 임시 home을 핀하고 그것만 지운다. 지금 tip에 실홈을 지우는 커밋된 테스트는 없다. 이슈도 ‘가드의 구멍이지 현재 라이브 결함은 아니다’라고 정확히 적었다. #4681 home guard invariant와 맞닿은 후속이다.
고치려면 줄 정규식 대신 AST 스캔을 쓰거나, 파괴 테스트가 ownership-tracking fixture가 준 경로만 지우게 강제하고, 가드 자체에 의도적 거짓음성 케이스를 넣어야 한다.
라인 tests/ci-workflows/test-home-guard.test.ts ~552 - same-line/const 패턴만 탐지.
경로 getConfigPath/usageLogPath - 가드가 형제 resolver를 보지 않음.
경로 tests/usage/quota-reset-seen-store.test.ts - 원사고 테스트는 이미 올바르게 핀됨.
경로 가드 테스트 - adversarial false-negative fixture가 약함.
메인테이너의 판단이 필요한 지점
AST 스캔 vs fixture-only 삭제 계약 중 무엇으로 강화할지.
fs.rmSync·다줄 호출을 얼마나 깊게 볼지.
형제 path resolver까지 같은 가드에 넣을지.
너의 추천
받아라. 우선 다줄/let/helper 거짓음성 픽스처를 가드 테스트에 넣고, 탐지기를 그 픽스처가 빨개지도록 올린다. 런타임 핫픽스는 아니다.
Activity
lidge-jun commentedon Sep 15, 2026
리뷰 · 우선순위 65 / 80
이 이슈는 파괴적 home 삭제를 막는 테스트 가드가 한 줄 패턴만 본다는 한계 보고다. tip의
tests/ci-workflows/test-home-guard.test.ts약 552행대는rmSync|rmdirSync|unlinkSync|...가 같은 줄에서getConfigDir()를 받거나,const x = getConfigDir()로 묶인 이름만 추적한다.let별칭, 헬퍼 래퍼, 여러 줄 호출,fs.rmSync, 형제getConfigPath()/usageLogPath()는 통과한다. 주석이 말하는 2026-09-15 실홈 삭제 사고의 재발을, 형태만 바꾸면 CI가 못 잡을 수 있다.좋은 소식은 당시 원인 테스트(
tests/usage/quota-reset-seen-store.test.ts)는 임시 home을 핀하고 그것만 지운다. 지금 tip에 실홈을 지우는 커밋된 테스트는 없다. 이슈도 ‘가드의 구멍이지 현재 라이브 결함은 아니다’라고 정확히 적었다. #4681 home guard invariant와 맞닿은 후속이다.고치려면 줄 정규식 대신 AST 스캔을 쓰거나, 파괴 테스트가 ownership-tracking fixture가 준 경로만 지우게 강제하고, 가드 자체에 의도적 거짓음성 케이스를 넣어야 한다.
라인
tests/ci-workflows/test-home-guard.test.ts~552 - same-line/const 패턴만 탐지.경로
getConfigPath/usageLogPath- 가드가 형제 resolver를 보지 않음.경로
tests/usage/quota-reset-seen-store.test.ts- 원사고 테스트는 이미 올바르게 핀됨.경로 가드 테스트 - adversarial false-negative fixture가 약함.
메인테이너의 판단이 필요한 지점
fs.rmSync·다줄 호출을 얼마나 깊게 볼지.너의 추천
받아라. 우선 다줄/
let/helper 거짓음성 픽스처를 가드 테스트에 넣고, 탐지기를 그 픽스처가 빨개지도록 올린다. 런타임 핫픽스는 아니다.이 댓글은 grok-bot이 작성했습니다
Merge dev into the destructive-home guard layer (#4705) [skip ci]
Merge pull request #4747 from lidge-jun/codex/rg1-destructive-home-guard
lidge-jun commentedon Sep 16, 2026
Landed via #4747 at 0c4d63a
lidge-jun commentedon Sep 16, 2026
Landed via #4747 at dc6bcda
fix(tests): refuse removals that reach a protected home (lidge-jun#4705…
fix(tests): refuse removals that reach a protected home (lidge-jun#4705…
Merge dev into the destructive-home guard layer (lidge-jun#4705) [ski…
Merge pull request lidge-jun#4747 from lidge-jun/codex/rg1-destructiv…