Repository navigation
Make the core reader, watch and session tests wait on state - #520
Merged
Merged
Conversation
Reader tests join the worker or hold the read on a channel; the AI and changes readers join their worker; the session search drop test waits on the mailbox's condition variable; the worktree idle check writes a sentinel ref and asserts nothing reached the Git watch before it; the creation time test compares with the gitdir's birth time; Git-debounced waits and the remote probes poll through named helpers; the terminal reaper is production code and says so; the drain test keeps its window, opened only after the idle wait has started.
The test measured from when its own thread next ran, which can be later than the settle under load and made a correct spacing look too short.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #437
Summary
herdr-core의 #437 allow 15개(
reader,ai,changes,runtime/session_search,worktree_behavior_tests,live,remote/host)를 없앱니다. 제품 코드는 바뀌지 않았습니다.reader.rs:settle이 sleep 루프 대신 poll, 그다음join_pending()(worker가 답을 보냄), 그다음 poll로 답을 받습니다. 20ms를 자던 두 읽기는 test가 채널로 붙잡았다 놓는held_read가 되어, "첫 poll은 막히지 않는다"와 "요청이 바뀐 동안 읽기가 아직 돈다"가 매번 성립합니다.ai.rs,changes.rs: 500×2ms 루프 대신read_if_due, 그다음inner.join_pending(), 그다음read_if_due.runtime/session_search.rs: 1ms 루프 대신 Drop이stop을 세우고 깨우는 mailbox의 condition variable(wait_timeout_while)을 기다립니다.worktree_behavior_tests.rsa_watch_change_during_a_read_keeps_the_old_answer_stale: 붙잡힌 읽기를 놓은 뒤 worker를 join하고 답을 한 번 읽습니다.remote/host.rsprobe(#[ignore]): 닫힘을 Mutex 대신 채널로 받습니다.idle_and_working_tree_edits_do_not_reread_but_manual_refresh_does는 20초 동안 다시 읽지 않는지를 보던 것을, 아무 읽기도 보지 않는 ref(refs/sentinel/<name>)를 쓰고 reader의 Git watch 큐에 그게 오기 전 다른 Git 사실이 없음을 보는 것으로 바꿨습니다. watch 큐는 시스템이 알린 순서대로 경로를 쌓으므로, reader 자신의 읽기가 Git 사실을 바꿨다면 그 변경은 이미pending에 있거나 sentinel보다 앞에 있습니다. 작업 트리 편집도 같은 방식으로 봅니다. 이 test는 20초에서 1초 밑으로 줄었습니다.linked_worktrees_carry_their_creation_time_and_the_main_worktree_none의 20ms를 없애고, 각 줄의 시간이 그 worktree의.git/worktrees/<name>birth time과 같은지 봅니다(older <= newer는 그대로).next_answer(Git watch 300ms debounce),answer_after_spacing(reader spacing),queued(Gate는 대기열에 들 때 깨우지 않음),remote_snapshot_until(#[ignore]원격 probe).Review
판단해 주세요 (재분류 2개)
live.rsreap_local_terminal_childkill_tree). Rust tests sleep instead of waiting for a state or injecting the clock #437 표에 test로 잘못 들어 있었습니다.OwnedChild에 기한 있는 wait가 없고,hide-platform의run_to_end도 같은 이유로 같은 allow를 씁니다.remote/host.rsa_draining_connection_...wait_idle이 condition variable에서 기다리는 중이라는 것을 밖에서 볼 수 없습니다(감독 답 (2)).wait_idle직전에 보내는 신호를 받은 뒤에만조심해서 볼 파일:
herdr-core/src/worktree_behavior_tests.rschanges_before_sentinel- test가 reader의git_watch큐를 직접 비웁니다(같은 모듈의 비공개 필드). sentinel이 쓰이며 생기는 폴더와 lock 파일 경로는 sentinel 자신의 것으로 셉니다.질문: 없음.
Evidence
hide-hostgit_within에서--no-optional-locks를 빼자 idle test가 "the reader's own read changed a Git fact"로 3/3 실패. (2) 생성 시간을git_dir대신common_dir의 birth time으로 읽게 하자 creation time test가 3/3 실패(두 줄이 같은 값이라 옛older <= newer로는 통과했을 결함). 되돌리면 통과.verify-cargo.sh clippy -p herdr-core --all-targets -D warnings,fmt, 바꾼 모듈 test 30개 통과(macOS).yes4개 +taskpolicy -b, 수정 전과 후 binary를 번갈아 30번씩, 바꾼 test 13개를 한 번에--test-threads=4): 수정 전 29/30, 수정 후 29/30.reader::tests::a_request_that_moves_inside_the_spacing_waits_for_it_and_is_then_read(reader.rs:230)로, 이 PR이reader.settled에서 재도록 고친 경합입니다.yes4개 추가)가 겹친 시각에 worktree test 2개가 git의 15초 한도에 걸린 것입니다(git commit did not finish within 15 s, 첫 읽기 15초). 수정 전에도 같은 부하에서git init did not finish within 15 s로 실패한 적이 있는 background QoS 기아로 봅니다.