Skip to content

Add worker hooks for deterministic tests#66

Merged
leynos merged 24 commits intomainfrom
codex/refactor-worker-tests-to-use-hooks
Aug 19, 2025
Merged

Add worker hooks for deterministic tests#66
leynos merged 24 commits intomainfrom
codex/refactor-worker-tests-to-use-hooks

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Aug 17, 2025

Summary

  • expose WorkerHooks to signal queue progress
  • allow graceful worker shutdown via watch channel
  • rewrite worker tests to wait for hooks instead of polling

Testing

  • make fmt
  • make lint
  • make test
  • make test-cov (fails: cargo-llvm-cov not found)
  • make markdownlint
  • make nixie

https://chatgpt.com/codex/tasks/task_e_68a200c0fcbc8322aa6fc670ade46141

Summary by Sourcery

Add WorkerHooks for observable worker lifecycle events and integrate graceful shutdown support, refactor run_worker and daemon wiring accordingly, and update tests to use hooks for deterministic synchronization.

New Features:

  • Introduce WorkerHooks struct with optional Notify hooks (enqueued, idle, drained) for deterministic test synchronization
  • Enable graceful worker shutdown via a watch channel

Enhancements:

  • Refactor run_worker and run_listener to accept a shutdown channel and WorkerHooks, and integrate select-based shutdown logic
  • Update daemon main and design documentation to wire up the shutdown channel and default WorkerHooks

Documentation:

  • Update design docs to reflect the new run_worker signature and shutdown/hooks usage

Tests:

  • Rewrite worker tests to await WorkerHooks notifications using Notify and timeout instead of polling utilities
  • Remove polling-based test utilities and related teardown logic

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant