Skip to content

Make the core runtime tests wait through one named helper - #512

Merged
yansfil merged 3 commits into
mainfrom
test/runtime-waits-on-state
Oct 5, 2026
Merged

yansfil merged 3 commits into
mainfrom
test/runtime-waits-on-state

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Refs #437

Summary

herdr-core/src/runtime/tests/의 #437 allow 13개를 없앱니다. 제품 변경은 진단 하나입니다(아래 file.open_dropped).

  • home.rs에만 있던 wait(shared, what, ready)와 wait_for(what, ready)를 부모 모듈 runtime/tests.rs로 옮겨 runtime 테스트 모듈 모두가 씁니다(새 helper가 아니라 이동). view_areas 3개, device_catalog 2개, project_sessions 2개, terminal 2개, documents 1개가 테스트 안에 따로 쓰던 polling 루프를 이것으로 바꿨습니다. device_catalog의 나머지 하나는 같은 파일의 next_request를 씁니다.
  • 시간이 상태를 대신하던 2개:
    • documents.rs a_device_read_that_lands_after_the_device_was_removed_opens_nothing: 200ms 대신, 늦게 온 읽기 답이 버려졌다는 진단 file.open_dropped를 기존 diagnostic_count로 기다린 뒤 탭이 없음을 봅니다. ingest_document_open이 바뀌었거나(새 요청) 장치와 함께 잊힌 요청의 답을 버리는 자리에 push_diagnostic("file.open_dropped", ...)를 더했습니다. 메시지는 file.open_requested가 남긴 generation만 담고 경로나 내용은 담지 않습니다.
    • home.rs a_link_change_missed_while_the_helper_reconnects...: 200ms 대신, 20번의 쓰기가 요청한 helper 연결 한 번이 끝났다(device_host_connecting이 false)는 상태를 기다린 뒤 "아무것도 닿지 않았다"를 봅니다.

Review

  • 판단해 주세요: file.open_dropped는 다른 push_diagnostic 종류처럼 snapshot의 최근 진단 목록에 들어가므로 Settings > General의 진단 목록(최근 8개)과 Copy diagnostics에도 보입니다. 알림이나 배너는 아닙니다. 버려지는 답은 장치 제거나 같은 탭의 새 open 뒤에만 생겨서 드뭅니다. 이 kind를 이름으로 적은 guide는 없습니다(file.open_requested도 없음).
  • 조심해서 볼 파일: herdr-core/src/runtime/documents.rs ingest_document_open - 반환값과 순서는 그대로이고, 버리는 분기에 진단 한 줄만 더했습니다. 처음엔 weak count로 worker 끝을 봤으나, 호출자가 볼 수 없는 내부 수명이라 관찰 가능한 결과(진단)로 바꿨습니다.
  • 조심해서 볼 파일: herdr-core/src/runtime/tests.rs - 옮긴 helper의 한도는 10초(home.rs 그대로)라서, 5초 한도로 쓰던 inline 루프보다 hang guard가 깁니다. 단정은 같습니다.

Evidence

  • 확인한 것: planted defect - forget_device_opens가 snapshot의 opening만 비우고 요청은 남기게 바꾸자 stale read 테스트가 file.open_dropped를 기다리다 실패, 되돌리면 통과(진단 commit 뒤 다시 확인).
  • 확인한 것: 진단 commit 뒤 runtime:: 671개 통과(macOS), clippy -D warnings 통과.
  • 확인한 것: 부하(yes 4개 + taskpolicy -b)에서 수정 전과 후 binary로 바꾼 13개를 한 번에: 40/40 대 40/40(매 회 13개 실행 확인).
  • 확인한 것: 진단 commit 뒤 a_device_read_that_lands_after_the_device_was_removed_opens_nothing만 같은 부하에서 수정 전과 후 binary를 번갈아 30번씩: 30/30 대 30/30.
  • 확인한 것: verify-cargo.sh clippy -p herdr-core --all-targets -D warnings, fmt, 바꾼 6개 모듈 136개 통과(macOS).
  • 확인하지 못한 것: 수정 전 흔들림은 재현되지 않았습니다. 11개는 이미 상태를 묻는 루프였고(이름 붙은 helper로 옮김), 2개(200ms)는 "읽기로 판단한 위험"입니다: 늦게 오는 결함을 놓치는 거짓 통과 쪽.
  • 확인하지 못한 것: 남은 Rust tests sleep instead of waiting for a state or injecting the clock #437 allow는 이 PR만 놓고 46개입니다.

The runtime test modules share the wait and wait_for helpers that were
home.rs's own, instead of loops written inline in each test. The stale
device read waits for the open's workers to hand their answers over, and
the missed home link waits for the helper's connect attempt to end, instead
of 200 ms each.
… test

The read answer that comes back after its request was replaced or
forgotten with its device is now a file.open_dropped diagnostic carrying
the open's generation. The device removal test waits for it instead of
counting the runtime's weak references, which no caller can observe.
@yansfil
yansfil added this pull request to the merge queue Oct 5, 2026
Merged via the queue into main with commit e1dea65 Oct 5, 2026
28 checks passed
@yansfil
yansfil deleted the test/runtime-waits-on-state branch October 5, 2026 15:26
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