Skip to content

Cancel the hide-ai fakes once their turn is running, not after a fixed time - #528

Merged
yansfil merged 1 commit into
mainfrom
test/ai-waits-on-state
Oct 5, 2026
Merged

yansfil merged 1 commit into
mainfrom
test/ai-waits-on-state

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Refs #437

Summary

hide-ai test의 #437 allow 4개를 없앱니다. 제품 코드는 바뀌지 않았습니다.

  • 취소 test 3개 (claude_cli.rs 2개, codex_app_server.rs 1개): 300ms 뒤에 취소하던 것을, fake CLI가 느린 turn에 들어가 기다리기 시작할 때 만드는 marker 파일(FAKE_STARTED_FILE, usage 읽기는 usage-started)을 본 뒤 취소하는 것으로 바꿨습니다. 그래서 매번 "돌고 있는 child를 죽인다"를 확인합니다. 이전에는 부하에서 300ms가 child 시작보다 짧으면 시작 전 취소 경로를 대신 지났습니다.
  • process_ownership.rs: fake는 thread/start에 답하기 전에 자기 child를 띄우고, owner는 그 답 뒤에야 출력하므로, child를 한 번에 읽습니다(100ms polling 제거). kill 뒤 생존 확인은 이름 붙은 polling helper survivors_after로 옮겼습니다(test의 child가 아닌 프로세스라 끝을 알리는 것이 없음).
  • marker 기다림도 다른 프로세스가 만드는 파일이라 wait_for_start, wait_for_turn polling helper입니다.

Review

  • 판단해 주세요: fixture 두 개(fake-claude.py, fake-app-server.py)가 env로 marker 경로를 받아 만듭니다. env를 쓰는 다른 FAKE_*와 같이 with_mode의 lock 안에서만 세우고 지웁니다.
  • 조심해서 볼 파일: hide-ai/tests/claude_cli.rs - marker 경로를 test마다 지우고 시작합니다. 남은 marker가 있으면 시작 전에 취소할 수 있기 때문입니다.
  • 질문: 없음.

Evidence

  • 확인한 것 (planted defect): 취소를 spawn 전에만 확인하게 하자, 바뀐 취소 test가 Cancelled 대신 Timeout으로 실패. 되돌리면 통과.
  • 확인한 것: verify-cargo.sh clippy -p hide-ai --all-targets -D warnings, fmt, hide-ai test 통과(macOS).
  • 부하 반복 (macOS, yes 4개 + taskpolicy -b, 수정 전과 후 binary를 번갈아 30번씩): claude_cli 취소 2개 30/30 대 30/30, codex_app_server 취소 30/30 대 30/30, process_ownership 30/30 대 30/30.
    • 수정 전도 흔들리지 않아, 고친 위험은 읽기로 판단한 위험입니다(300ms가 child 시작보다 길다는 가정이 깨지면 시작 전 취소 경로를 지나도 통과).
    • test binary는 fake CLI를 source tree에서 읽으므로, 이 branch를 checkout한 채로 돌렸습니다.
  • 확인하지 못한 것: Windows와 Linux는 CI lane으로만 봅니다. 남은 Rust tests sleep instead of waiting for a state or injecting the clock #437 allow는 이 PR만 놓고 main 51에서 47입니다.

…d time

The fake CLIs create a marker once a slow turn is waiting, and the cancel
tests raise the cancel only after it appears, so a running child is what
is cancelled every time. The ownership test reads the fake's child
directly, since the fake starts it before answering, and its survivor
check polls through a named helper.
@yansfil
yansfil added this pull request to the merge queue Oct 5, 2026
@yansfil
yansfil merged commit 5b231fa into main Oct 5, 2026
21 checks passed
@yansfil
yansfil deleted the test/ai-waits-on-state branch October 5, 2026 16:47
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.

1 participant