core(reply): typed single-shot reply port — deletes Box<dyn Any> erasure (#115)#140
Merged
Conversation
… reply_channel
…t over actions
…, short summaries, no shadow
…-vs-erased reply bench
…er-path test in ADR-0002/baseline
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.
What
Rebuilds
reply(#115) as the typed, single-shot reply-channel primitive inbombay-core, following the epic #122 rigor contract. Kameo'sBox<dyn Any>Reply-trait erasure (~1,048 LOC, ~40 std impls + a derive) is deleted — a typed per-variant reply port erases nothing, so anyR: Send + 'staticis a reply.Depends on #113 (error model), now on
main.Design (spec:
docs/superpowers/specs/2026-07-05-reply-channel-primitive-design.md, ADR-0002)ReplySender<R, E = Infallible>/ReplyReceiver<R, E>/reply_channel()overtokio::sync::oneshot<Result<R, E>>— the oneshot kept an impl detail behind the wrappers (mailbox channel-seam philosophy, ADR-0001).send/send_errconsumeself→ a double-reply is a compile error (proved by acompile_faildoctest), strictly stronger than kameo's runtime "second send is a no-op".AskerGone(unit signal) — a reply to a vanished asker is un-actionable, and handing the payload back would force a mutation-dead match arm.recvmaps the oneshot outcome into core(error): rebuild from kameo reference — typed error domains #113'sAskError:Ok(Ok r)→Ok(r)·Ok(Err e)→Handler(e)· sender-dropped→Interrupted. Generic over the never-producedM, so core(request): rebuild from kameo reference — ask/tell builders #118 gets a ready-to-returnAskError<M, E>.Re-scope (recorded on #115)
DelegatedReply/ForwardedReplyare deferred to #116/#118 — in the reference they are produced only byContext::reply_sender/forward, which needActorRef+Message; shipping them now would be dead-until-later types testable only for construction (YAGNI, CLAUDE rule 4). They land wired + tested with their machinery.Tests (TDD, 4 cross-cutting categories first)
8 tests:
@bugtyped-handler-error probe, Ok-reply sequence,recv-parks-then-send-wakes (reverse ordering — the oneshot waker path the buffered-value tests skip), drop→Interruptedlifecycle (never hangs), send-to-gone-asker defensive,Infallible(tell) roundtrip, 2-thread barrier'd linearizability, and a proptest over all three handler actions; plus thecompile_faildoctest.Mutation: 0 missed (
cargo-mutantsonreply.rs). No bombay-owned atomics → loom N/A (delegated to tokio oneshot), same as #113.Benched (
benches/reply.rs)The typed port is ≈1.5× faster than kameo's
Box<dyn Any>erasure mechanism — 21.4 µs vs 32.8 µs per 1k reply roundtrips (the box-on-send + downcast-on-recv the redesign removes). Measured, recorded in ADR-0002 — the redesign's justification, substantiated rather than asserted.Gate
nix flake checkgreen. No README change — the rebuilt spine is not behind the public umbrella yet (same as #113/#114/#133); coverage recorded indocs/testing/coverage-baseline.md.