Skip to content

Make the process and lock wait tests wait for the child or the waiter - #503

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

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

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Refs #437

Summary

프로세스 stop/deadline 테스트와 lock 대기 테스트 5개가 "상태가 됐겠지" 하는 시간만큼 잠들었습니다(#437 allow 5개).
이제 각 테스트가 그 상태를 직접 기다립니다. 제품 코드는 바뀌지 않았습니다.

  • hide-platform/tests/process.rs a_raised_stop...: 300ms 뒤가 아니라 sleep 자식이 pid 파일을 쓴 뒤에 stop을 올리고, 호출이 돌아온 뒤 그 pid가 없는지 봅니다.
  • hide-kit/src/process.rs 두 테스트: 손자 프로세스가 시작하자마자 pid와 시작 시각을 씁니다(rename으로 한 번에). stop 테스트는 그 이름을 본 뒤 stop을 올리고, 두 테스트 모두 2.5초를 자는 대신 그 프로세스가 끝났는지(같은 pid, 같은 시작 시각이 사라졌는지) 기다립니다.
  • hide-platform/tests/fs.rs 두 lock 테스트: lock 대기는 잡혀 있는 lock을 만날 때마다 cancelled를 묻습니다. 그 첫 질문을 "대기 중"이라는 보고로 받아서 holder를 놓고, 취소 테스트는 두 번째 질문에 "멈춰"라고 답합니다(호출 횟수 2를 단정).

Review

  • 판단해 주세요: kit의 deadline 테스트는 300ms 안에 손자가 시작했는지가 스케줄러 몫이라, 시작한 경우에만 "그룹과 함께 끝났다"를 단정합니다. 트리 전체가 끝나는지는 손자가 돈 것을 확인한 뒤 stop을 올리는 옆 테스트가 결정적으로 봅니다(같은 run_to_end 정리 경로). 이 나눔이 괜찮은지.
  • 판단해 주세요: lock 테스트의 "놓기 전에는 끝나지 않는다"는 이제 경과 시간(>= 150ms) 대신 "대기 보고를 받은 시점에 아직 안 끝났다"로 봅니다. 올바른 구현에서 거짓 실패는 없고, 일찍 끝나는 결함은 대부분 잡습니다.
  • 조심해서 볼 파일: hide-kit/src/process.rs - 손자가 테스트의 대기 한도(30초)보다 오래 자도록 바꿨습니다. 같으면 손자가 저절로 끝나 결함을 놓칩니다(아래 planted defect에서 실제로 놓쳤음).
  • 질문: Flaky test: hide-kit process::tests::a_child_past_its_deadline_is_stopped_with_its_group #476(같은 kit 테스트, Windows 첫 시도 실패)은 이 PR로 닫히지 않습니다. 실패한 단정은 오류 문구였고, run_to_end가 kill 뒤 reap을 RUN_POLL(20ms) 안에 확인하지 못하면 "could not be waited on ... cleanup unconfirmed"로 답하는 경로로 보입니다(읽기로 판단, 재현 안 됨). 이 PR은 단정이 오류 문구를 출력하게 해서 다음 실패가 원인을 말하게 합니다. reap 한도는 제품 판단이라 손대지 않았습니다.

Evidence

  • 확인한 것: planted defect - OwnedChild::kill_tree를 leader만 죽이게 임시로 바꾸자 kit 두 테스트가 "the grandchild outlived the stop/deadline"으로 실패, 되돌리면 통과(macOS).
  • 확인한 것: 부하(yes 4개 + taskpolicy -b)에서 수정 전과 후 binary를 같은 조건으로: kit 두 테스트 40/40 대 40/40, platform stop 60/60 대 60/60, fs lock 두 테스트 60/60 대 60/60.
  • 확인한 것: verify-cargo.sh clippy -p hide-kit -p hide-platform --all-targets -D warnings, fmt, 바꾼 crate의 해당 테스트 통과.
  • 확인하지 못한 것: 수정 전 흔들림은 로컬에서 재현되지 않았습니다. 이 다섯 개는 "읽기로 판단한 위험"입니다(시간이 스케줄러보다 짧으면 stop이 시작 전 자식에 걸리거나, 늦게 쓰는 손자를 놓치는 거짓 통과). Linux와 Windows는 이 PR의 CI로만 봅니다.
  • 확인하지 못한 것: 남은 Rust tests sleep instead of waiting for a state or injecting the clock #437 allow는 54개입니다.

A raised stop is now raised once the child (or the kit's grandchild) has
written its pid, the kit tests check that the grandchild is gone by its pid
and start time instead of waiting out its marker, and the lock tests use the
wait's own cancel question as the report that it is waiting.
@yansfil
yansfil added this pull request to the merge queue Oct 5, 2026
Merged via the queue into main with commit 356c5db Oct 5, 2026
31 checks passed
@yansfil
yansfil deleted the test/process-waits-on-state branch October 5, 2026 12:07
yansfil added a commit that referenced this pull request Oct 5, 2026
## Summary

`merge_group.base_sha` is main only for the first group in the queue;
every later group starts from the commit of the group queued ahead of
it.
The plan job logs and the queue refs show it: #504's group was based on
356c5db (#503's group commit, before #503 reached main), and #506's ref
is `gh-readonly-queue/main/pr-506-6d32c697...`, #505's group commit.
So a group plans its own pull request's changes on the tree the groups
ahead make, not every queued change, as #500's docs, comments and test
story said.
This corrects them and states why that is enough; the planner itself
does not change.

## Review

- **판단해 주세요**: the safety argument now in docs/TESTING.md: each group's
run checks its own lanes on a tree that already holds every group ahead,
so a lane is checked by the run of the last group that touched its
inputs, on the same inputs as the final tree; it assumes the path rules
are right, as a pull request's plan does. The queue merges a group only
when every group ahead passed (ALLGREEN), and rebuilds the groups behind
a failed one on a new base.
- **조심해서 볼 파일**: `scripts/tests/test_ci_plan.py`: the merge queue test
is renamed to
`test_a_merge_group_plans_its_own_change_on_the_groups_ahead` and builds
group commits the way the queue does (the pull request merged onto main
or onto the group ahead), including a group rebuilt on main after the
one ahead fails.

## Evidence

- **확인한 것**: plan job logs of the queue runs
[37305523083](https://github.com/modakbul-gongbang/hide/actions/runs/37305523083)
(#504, `BASE: 356c5db...`) and
[37306383723](https://github.com/modakbul-gongbang/hide/actions/runs/37306383723)
(#506, `BASE: 6d32c69...`); #506's run planned 18 lane jobs and no
macOS job, its own change only, while #505's run on 6d32c69 ran the
macOS lanes.
- **확인한 것**: `scripts/tests/test_ci_plan.py` 35 pass; `actionlint` is
clean on `pr.yml`.
- **확인하지 못한 것**: nothing runs differently, so there is no before and
after timing.
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 9, 2026
A test's own sshd chose its port by binding port 0 and letting it go, and
reported itself ready when any listener answered on that port. Another test's
sshd took the port first, the test's sshd exited with "Address already in
use", and the daemon signed in to the other server and stopped at
host_key_changed (with-hide/hide-private#210). A server is now ready only when
its own log says it listens, and one that lost the bind is started again on
another port.

The device pane asker asked the node for a credential as soon as its program
started, before the holder wrote the pane's record as running, and was
refused once with no retry (with-hide#503). The test now releases the asker after the
node's proof of the pane, and a failed wait shows the asker's screen.

The node's caller cap probe wrote its request to a connection the node had
already answered and ended (with-hide#149), and the setup renderer's receipt wait gave
up after 64 frames of a busy daemon (with-hide#294); one now only listens, the other
waits by time.

The remote hook's miss and the relay's non-binary frame (with-hide#173, with-hide#457) now say
which stage ran out and which message arrived. The remote mailbox lane can be
repeated by hand on a branch (repeat input).
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 9, 2026
Closes with-hide/hide-private#210
Closes with-hide/hide-private#503
Closes with-hide/hide-private#149
Closes with-hide/hide-private#294
Related: with-hide/hide-private#718 with-hide#719 (제품 쪽 후속), with-hide#173 (hook 시간 초과는 원인
미확정, 진단만 추가), with-hide#457 (relay, 진단만 추가), with-hide#339 with-hide#398 (WSL, 이슈에 원인과 남은 일을 적음)

## Summary

기기 연결 테스트가 가끔 실패하던 원인 넷을 고쳤습니다. 제품 코드는 바뀌지 않고 테스트 보조 코드와 CI 입구만 바뀝니다.

- with-hide#210: 테스트용 sshd가 고른 포트를 다른 테스트의 sshd가 먼저 잡아도 "준비됨"으로 통과해서, 데몬이 남의 서버에
붙고 `host_key_changed`로 끝났습니다. 이제 자기 sshd가 "listening"을 로그에 쓸 때까지 기다리고,
포트를 잃었으면 다른 포트로 다시 시작합니다.
- with-hide#503: 질문하는 프로그램이 holder가 pane 기록을 `running`으로 쓰기 전에 물어서 한 번 거절당했습니다.
테스트가 노드의 증명을 확인한 뒤에 풀어 주게 순서를 고정했습니다.
- with-hide#149: 거절 순서 문제는 `133b05fe9`가 이미 고쳤고, 남은 BrokenPipe는 상한 확인용 연결이 이미 닫힌
연결에 요청을 쓰던 테스트 경쟁이라 듣기만 하게 바꿨습니다.
- with-hide#294: 설정용 renderer가 프레임 64개에서 포기하던 것을 시간 상한으로 바꿨습니다. 이슈 본문의 첫 증상인
doorbell 시간 초과는 with-hide#173 댓글대로 10월 28일 뒤 재발이 없어, frame 상한을 고친 이 PR로 닫습니다.
- remote mailbox 레인을 브랜치에서 손으로 N번 반복할 수 있습니다: `gh workflow run
remote-mailbox.yml --ref <branch> -f repeat=10`.

## Review

- **판단해 주세요**: 반복 실행을 새 workflow가 아니라 `remote-mailbox.yml`의
`workflow_dispatch` + `repeat` 입력으로 둔 것. `test_vt_cache.py`가 vt-cache 사용
workflow 목록을 고정해서 새 파일은 정책 검사에 걸립니다.
- **조심해서 볼 파일**: `hided/tests/it/support/sshd.rs` - 준비 판정을 연결 성공에서 자기
로그의 "Server listening ... port N."으로 바꾼 곳(macOS sshd로 문구 확인).
재시작(`online(false)` 뒤 `online(true)`)은 로그가 이어 쓰이므로 spawn 뒤에 쓰인 부분만 읽고,
같은 포트를 잃으면 이유를 말하며 실패합니다. `system_ssh`에 이 경로를 확인하는 시험을 더했습니다.
- **조심해서 볼 파일**: `hided/tests/it/device_own_engine.rs` - asker가 파일이 생길
때까지 기다리는 셸 반복. 상태를 기다리는 것이고 시간을 기다리지 않습니다.
- **질문**: #173의 11월 7일 실패는 hook이 제품 예산(`INTAKE_BUDGET` 1.65초) 안에 답을 못 받은
것입니다. 부하 때문에 예산을 못 지키는 경우를 테스트가 어떻게 다룰지(병렬도를 줄일지) 정하지 못해 이번엔 진단만 넣었습니다.

- **후속 이슈**: #149의 남은 틈(노드가 연결을 닫은 뒤에 자리를 돌려주는 것)은 제품 쪽이라 #718에, #503의
제품 쪽 경쟁(holder 기록이 Running이 되기 전의 첫 `hide` 호출 거절)은 #719에 적었습니다. 테스트 쪽
원인은 이 PR이 고쳤습니다.
- 반복 실행은 `--retries 0`으로 돌아, 한 번의 실패가 job의 실패입니다.

## Evidence

- **확인한 것**: `cargo check`와 `clippy -D warnings`(hided, hide-relay 테스트)가
통과합니다. 포트 충돌 메시지(`Bind to port N on 127.0.0.1 failed: Address already in
use`)와 listening 문구는 이 Mac의 sshd에서 직접 확인했습니다.
- **확인한 것**: with-hide#210 원인은 실패한 CI 실행(42085737360)의 보관된 sshd 로그에 `Address
already in use`와 데몬의 `host_key_changed`가 함께 있는 것으로 확인했습니다.
- **확인하지 못한 것**: #503의 원인은 코드 읽기로 좁힌 것입니다(`hide-holder/src/holder.rs`의
spawn 뒤 `running` 기록 사이). 실패한 CI에는 asker 화면이 없었고, 이번 변경이 다음 실패 때 그 화면을
남깁니다.
- **확인한 것**: remote mailbox 레인(Linux)을 이 브랜치에서 `repeat=10`으로 돌려 10회 모두
통과했고(33개 x 10, 재시도 0번, `FLAKY` 줄 없음)
https://github.com/with-hide/hide/actions/runs/42386421651 에서 볼 수 있습니다.
- **확인한 것**: 재시작 경로를 고친 head 6817f7c09에서 `--retries 0`으로 다시 `repeat=10`을
돌려 10회 모두 통과했습니다(33개 x 10, `no flaky test`)
https://github.com/with-hide/hide/actions/runs/42429757957
- **확인하지 못한 것**: 고치기 전 실패율은 이슈별로 며칠에 한두 번이라 10회 통과가 재발 없음을 증명하지는 않습니다. 이
Mac에서는 레인을 돌리지 않았습니다.
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