Skip to content

Wait on state in the host, daemon and kit tests; name the windows that remain - #525

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

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

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Refs #437

Summary

hide-host, hided, hide-kit test의 #437 allow 8개를 없앱니다. 제품 코드는 바뀌지 않았습니다.

  • 상태를 기다리게 바꾼 것
    • hided/tests/connect_stop.rs: hide stop은 daemon이 끝난 뒤에 답하므로, 10초 polling 대신 stop 직후 그 pid가 더는 시작 시각이 같은 프로세스를 가리키지 않는지 한 번 봅니다(pid 재사용에도 맞습니다).
    • hided/src/watch.rs: 파일 시스템 시계 단위를 넘기려고 20ms 자던 것을, 감시 시작 전 폴더의 수정 시각을 과거 고정값으로 두는 것으로 바꿨습니다. 같은 test에 "바뀐 경로 뒤의 변경은 감시 폴더의 것이 아니다"를 COALESCE 뒤 poll로 하나 더 봅니다.
  • 이름 붙은 polling helper로 옮긴 것(다른 프로세스나 다른 thread가 쓰는 상태라 받을 신호가 없음): connect_build.rs logged(daemon log는 답한 뒤 자기 thread에서 씀), session_activity.rs announced_helper와 ended_by(test의 child가 아닌 helper 프로세스), worktrees.rs wait_until_deleted(sweep thread의 삭제).

Review

  • 판단해 주세요 (재분류 4개): 감독 답대로 울타리를 먼저 봤고, 관찰할 상태가 없는 자리만 고유 이유로 남겼습니다. 창 길이는 그대로이고, 각 창은 지켜보는 일이 시작된 신호 뒤에만 열립니다.

    자리 새 allow 이유 왜 상태를 기다릴 수 없나 창
    hide-host/tests/save.rs a_revision_read_waits_for_a_save_in_progress_in_the_folder time for the other thread to block in the lock the save holds: nothing reports a thread waiting on a folder lock 다른 thread가 폴더 lock에서 기다리는 중이라는 것을 알리는 상태가 없습니다. 200ms 그대로, 읽는 thread가 lock 직전에 보내는 신호를 받은 뒤에만
    hide-host/tests/worktrees.rs an_entry_left_before_git_dropped_the_registration_is_kept_until_a_retry_removes_it a window in which the kept entry must not be deleted: no state reports an event that has not happened sweep은 지울 것을 반환 전에 정하고 각 삭제는 자기 thread에서 합니다. 지움 목록 반환은 test만 읽는 제품 변경이라 하지 않았습니다(감독 답). 200ms 그대로, sweep_trash가 반환한 뒤에만
    hide-host/tests/worktrees.rs a_sweep_keeps_names_no_removal_made_and_never_follows_a_linked_trash a window in which a linked trash must not be followed: no state reports an event that has not happened 위와 같습니다. 지워질 entry는 wait_until_deleted로 먼저 기다리고, 창은 그 뒤 남아야 할 것만 봅니다. 300ms 그대로, sweep_trash가 반환한 뒤에만
    hide-kit/src/tests.rs an_apply_waits_for_another_kit_changing_the_same_account a window in which the apply must not finish: no state reports an event that has not happened lock 대기는 stop flag만 묻고, apply가 거기 닿았다는 상태가 없습니다. 300ms 그대로, apply thread가 시작 신호를 보낸 뒤에만
  • 조심해서 볼 파일: hided/src/watch.rs - 수정 시각을 과거로 두는 것이 감시가 시작 시각을 읽는 방식에 기대므로, 그 읽기가 바뀌면 이 test도 같이 봐야 합니다.

  • 질문: 없음.

Evidence

  • 확인한 것 (planted defect, 각각 되돌리면 통과): (1) save가 폴더 lock을 잡지 않게 하자 save test 실패. (2) watch가 바뀐 경로를 다시 resolve하게 하자 새 COALESCE 단정이 실패. (3) hide stop이 daemon 종료를 기다리지 않고 답하게 하자 connect_stop이 실패.

  • 확인한 것: verify-cargo.sh clippy -p hide-host -p hided -p hide-kit --all-targets -D warnings, fmt, 바꾼 test 통과(macOS).

  • 부하 반복 (macOS, yes 4개 + taskpolicy -b, 수정 전과 후 binary를 번갈아 30번씩):

    test 수정 전 수정 후
    worktrees (sweep 2개) 30/30 30/30
    save 30/30 30/30
    session_activity 30/30 30/30
    hide-kit apply 30/30 30/30
    hided watch 30/30 30/30
    connect_stop 28/30 29/30
    connect_build 30/30 30/30

    connect_stop의 실패 3개(수정 전 2, 수정 후 1)는 모두 이 PR이 바꾸지 않은 run helper의 "hide's output did not end within 30 s"입니다. 수정 전후가 같은 비율이고 taskpolicy -b로 낮춘 우선순위에서 hide가 30초를 넘긴 것이라 이 PR과 무관하다고 봅니다. 그 밖에는 수정 전도 흔들리지 않아, 고친 위험은 읽기로 판단한 위험입니다(sleep 길이가 thread 시작이나 시계 단위보다 길다는 가정).

  • 확인하지 못한 것: Windows와 Linux는 CI lane으로만 봅니다. 남은 Rust tests sleep instead of waiting for a state or injecting the clock #437 allow는 이 PR만 놓고 main 51에서 43입니다.

…t remain

hide stop answers after the daemon has ended, so its test checks the pid
at once instead of polling. The watch test starts from a fixed past
modification time instead of sleeping past the file system's clock step,
and now checks that a change behind the replaced path is not reported.
The log and helper waits poll through named helpers. The folder lock,
trash sweep and account lock checks keep their windows under their own
reasons, each opened only after the work it watches has started.
@yansfil
yansfil added this pull request to the merge queue Oct 5, 2026
Merged via the queue into main with commit 8242a96 Oct 5, 2026
31 checks passed
@yansfil
yansfil deleted the test/host-waits-on-state branch October 5, 2026 15:43
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