eda: carry originating task identity on DispatchInput (gap-2 prereq) #446
Notifications
Due Date
No due date set.
Depends on
Reference: sam/archie#446
Reference in new issue
Block a user
Prerequisite for the t2db.17 idempotency resolution. DispatchInput (internal/domain/eda/playbook/playbook.go:187) is {Labels, Kind, Event} with no task identity, so a playbook run cannot derive an event_id for a playbook_dispatches ledger key. Thread the originating task's identity (store.Task.ID, or the TaskEnvelope idempotency key that produced it). IMPORTANT: there is NO production caller of Store.Dispatch today -- DispatchInput is only constructed in tests -- so confirm which identity is actually available at the real Dispatch call site before fixing the field type; do not assume store.Task.ID is available at label/kind classification time (it is not: pollNATS/classify produces the envelope before any task row exists, so the TaskEnvelope.IdempotencyKey string is the identity available there).
Design
Add an identity field to DispatchInput, populated by the (currently nonexistent) production caller. Decide field type against the discovery-path evidence: pollNATS (internal/daemon/daemon.go:844) and the webhook receiver (receiver.go:243) both compute kind/labels from a TaskEnvelope BEFORE any store.Task row exists, and TaskEnvelope.IdempotencyKey() returns 'archie:owner/repo/number' -- so a string identity (the idempotency key) is the available, stable value at the dispatch point, not a store.Task.ID int64. Add a test proving DispatchInput carries it end to end; wire the real production caller only when the coordinator lands.
Acceptance criteria
DispatchInput carries the originating task's identity (typed as decided against evidence). A test demonstrates the identity is present on the input and reaches the key-derivation path. No production dispatch caller is wired in this ticket (none exists today). task check passes.
Close reason
Verified landed: DispatchInput.TaskID carries the originating task identity, with a test at playbook_test.go:360.
Imported from beads
archie-core-t2db.22· GitHub #732 · type task · priority P2 · created 2026-09-04 · closed 2026-09-11