Skip to content

Keep the doorbell tests' passes the only doorbell - #841

Merged
yansfil merged 1 commit into
mainfrom
fix/flaky-doorbell
Oct 8, 2026
Merged

yansfil merged 1 commit into
mainfrom
fix/flaky-doorbell

Conversation

@yansfil

@yansfil yansfil commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Closes #809
Closes #814
Closes #831

Summary

  • doorbell 테스트는 Doorbell::pass를 정한 시각에 직접 돌리고 Herdr에 묻고 입력한 횟수를 셉니다.
  • 그런데 Worker::spawn이 실제 doorbell도 함께 띄워, 같은 runtime과 fake Herdr에 실제 시계로 250 ms마다 pass를 돌렸습니다.
  • 테스트가 첫 250 ms를 넘기면 그 doorbell의 질문이나 bell이 섞였습니다(bell 2번, agent.get 1번 더).
  • Worker::store는 ledger store만 띄우고, Worker::spawn은 store에 doorbell과 watch producer를 더한 것입니다. 제품 경로는 그대로 spawn입니다.
  • doorbell 테스트는 store만 띄우므로 테스트의 pass가 유일한 doorbell입니다. assertion은 하나도 바꾸지 않았습니다.

Review

  • 조심해서 볼 파일: herdr-core/src/delivery/worker.rs - 제품 worker의 thread 구성. producer 둘과 종료 순서(Drop)는 그대로입니다.

Evidence

  • 확인한 것: 테스트 네 곳에 600 ms 멈춤을 넣으면 main worker에서 CI와 같은 실패가 결정적으로 납니다(15 != 14, 2 != 1, 3 != 1, 11개 중 4개 실패).
  • 확인한 것: 같은 멈춤을 넣은 채로 이 변경에서는 doorbell 테스트 11개가 모두 통과합니다. 멈춤은 커밋에 없습니다.
  • 확인한 것: verify-cargo.sh lint, test-scoped 통과(herdr-core lib 1817개 포함).
  • 확인하지 못한 것: Linux CI 러너에서의 반복 실행은 이 PR의 CI가 처음입니다.

The doorbell tests drive Doorbell::pass at chosen times and count what
Herdr was asked and typed, but Worker::spawn also started the
production doorbell, which passes every 250 ms on the real clock
against the same runtime and fake Herdr. A test that ran past its first
250 ms on a slower runner saw that doorbell's question or bell as well
(issues 809, 814, 831: two bells, one extra agent.get).

Worker::store now starts the ledger store alone, and Worker::spawn is
the store plus its doorbell and watch producers, as the core runs it.
The doorbell tests start the store, so their passes are the only ones.

Closes #809
Closes #814
Closes #831
@yansfil
yansfil merged commit 550bb3d into main Oct 8, 2026
20 checks passed
@yansfil
yansfil deleted the fix/flaky-doorbell branch October 8, 2026 23:14
yansfil added a commit that referenced this pull request Oct 8, 2026
Closes #798
Closes #802

## Summary

- #841 이후 doorbell 테스트는 doorbell·watch loop 없이 delivery store만 띄웁니다.
#802도 같은 원인이었고 #841로 고쳐졌습니다.
- 그 상태를 지키는 장치가 없었습니다. producer가 다시 붙으면 느린 러너에서 가끔 질문이나 bell이 하나 더 생기는
것으로만 드러납니다.
- fixture가 띄운 worker에 timed producer가 없음을 assert합니다. 두 번째 poller가 돌아오면
doorbell 테스트가 이유와 함께 한꺼번에 실패합니다.

## Evidence

- **확인한 것**: fixture를 `Worker::spawn`으로 되돌리면 fixture를 쓰는 5개가 모두 `a
second doorbell would race the test's passes`로 실패합니다. `Worker::store`에서는
11개 모두 통과합니다.
- **확인한 것**: #802의 테스트는 #841 PR 검증 때 600 ms 멈춤을 넣은 main worker에서 CI와 같은
`2 != 1`로 실패했고, #841에서는 통과했습니다.
- **확인한 것**: doorbell 테스트 11개를 로컬 macOS에서 부하 없이 200번 연속 실행해 모두 통과했습니다.
- **확인한 것**: `verify-cargo.sh lint` 통과.
- **확인하지 못한 것**: 부하를 건 반복 실행은 하지 않았습니다(공유 머신에 인위적 부하를 걸지 않음). 시간 의존 경로가
없어져 부하와 무관하다는 근거는 위의 멈춤 재현입니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment