Background
#46 Phase 2 rewrites SyncProducer and SyncConsumer onto a block_on seam: the per-consumer forwarder task and the std::sync::mpsc::sync_channel disappear, and SyncConsumer blocks directly on BufferReader::recv(). That is a real behavior-carrying change to the blocking semantics users depend on.
Today's aimdb-sync test suite does not pin those semantics tightly enough to catch a regression. This issue writes that safety net against the current implementation, before the rewrite, so Phase 2 has something to prove itself against.
Task
Add tests to aimdb-sync/tests/ (or extend integration_test.rs) covering:
Keep the tests written against the public aimdb-sync API only — no reaching into internals — so they survive the Phase 2 rewrite unchanged. That constraint is the point of the issue.
Why it matters
This is the concrete form of acceptance criterion 4 on #46, landed early where it has the most value. It is also the best way to learn how the sync bridge actually works (runtime thread, forwarder tasks, channels) without changing any of it.
Verification
cargo test -p aimdb-sync
make check
Tests must be deterministic — no sleep-and-hope. Use generous timeouts for the negative cases and explicit synchronization for the positive ones.
Files
aimdb-sync/tests/integration_test.rs (or a new test file)
- Reading material:
aimdb-sync/src/{handle,producer,consumer}.rs
Background
#46 Phase 2 rewrites
SyncProducerandSyncConsumeronto ablock_onseam: the per-consumer forwarder task and thestd::sync::mpsc::sync_channeldisappear, andSyncConsumerblocks directly onBufferReader::recv(). That is a real behavior-carrying change to the blocking semantics users depend on.Today's
aimdb-synctest suite does not pin those semantics tightly enough to catch a regression. This issue writes that safety net against the current implementation, before the rewrite, so Phase 2 has something to prove itself against.Task
Add tests to
aimdb-sync/tests/(or extendintegration_test.rs) covering:get()wakes on a produce — a consumer thread blocked inget()returns the value once another thread produces, rather than spinning or missing it.get_with_timeout()actually times out — returnsSyncError::GetTimeoutwhen no value arrives within the deadline, and returns the value (not a timeout) when one arrives just inside it.try_get()is non-blocking — returns immediately when the buffer is empty, and returns the value when one is pending.get()s yield the values in order.get()when the handle is detached fails cleanly (SyncError::RuntimeShutdown) rather than hanging.Keep the tests written against the public
aimdb-syncAPI only — no reaching into internals — so they survive the Phase 2 rewrite unchanged. That constraint is the point of the issue.Why it matters
This is the concrete form of acceptance criterion 4 on #46, landed early where it has the most value. It is also the best way to learn how the sync bridge actually works (runtime thread, forwarder tasks, channels) without changing any of it.
Verification
cargo test -p aimdb-sync make checkTests must be deterministic — no sleep-and-hope. Use generous timeouts for the negative cases and explicit synchronization for the positive ones.
Files
aimdb-sync/tests/integration_test.rs(or a new test file)aimdb-sync/src/{handle,producer,consumer}.rs