fix: surface routing-rule trigger as leading external event#1008
Conversation
When a routing rule creates a task, the timeline now emits the triggering external event first, before the Created lifecycle event, so it appears the same way it does when an event wakes an existing task (the attach path). The create path previously recorded the trigger only as a link event after the Created event, leaving the Events lane empty and burying the cause of the task below the lifecycle event it triggered. The timeline now reads External -> Created -> Link -> Instruction.
|
@icholy-bot the text/description for the created link doesn't need to do double-duty anymore. We should update that to just be the PR info. |
…title The created task's subscription link used the event description as its title and pointed at the triggering comment URL, doing double-duty as the trigger's label. Now that the external trigger event carries that description, point the link at the canonical resource (the issue/PR) and drop the title so it surfaces the resource itself.
|
Good call — updated in 6eb8007. The created subscription link no longer carries the event description as its title (that text now lives on the external trigger event). The link now points at the canonical resource (the issue/PR, via So the split is now clean: the external event is the specific trigger (comment URL + description + body), and the link is the subscription to the underlying issue/PR. Let me know if you'd rather the link carry a human-readable title (e.g. |
Address review: the subscription link should keep input.URL (the triggering comment/event URL), not the canonical resource key. Only drop the redundant title, which now lives on the external trigger event.
Fixes #1007.
When a routing rule creates a task, the triggering event now appears as the first event in the timeline — as a rich external event, the same way it does when an event wakes an existing task (the
attachpath) — and it precedes theCreatedlifecycle event it triggered.Before
The create path recorded the trigger only as a link event, emitted after the
Createdlifecycle event:This left the "Events" lane empty (no external event) and buried the cause of the task below the lifecycle event it caused.
After
The create path now emits an
ExternalPayloadevent first, carrying the webhook description/URL/data, matching the wake path:The subscribed link row (
task_links) and its link event are still created for subscription/Links-lane purposes — only the leading external trigger event is added.Changes
internal/eventrouter/eventrouter.go: emit the external trigger event before theCreatedlifecycle event in thecreatepath.internal/eventrouter/eventrouter_test.go: assert the newExternal -> Created -> Link -> Instructionordering and that the external event carries the webhook payload.go test ./internal/eventrouter/passes.