feat(automation): wire card_label_added + comment_added triggers#67
Merged
Conversation
Both triggers shipped in the DSL with v1 (ADR 0010) but their client emitters were deferred. This lands them: - Card drawer fires `card_label_added` when a label is *attached* (not on removal) and `comment_added` after a comment posts. Two new callback props (onLabelAdded / onCommentAdded) bubble up to board-client's emitAutomationTrigger. - Rule builder gains an "Only when this label is added" condition selector for card_label_added (scoped to a labelId); the rule summary resolves the label name. Stale "wired in a follow-up" note removed. - Documented the no-cascade invariant in the executor: actions hit the REST API directly and never re-enter the emitting path, so a set_label action can't loop back into a card_label_added rule (ADR 0010 §Risks). Tests: automation-evaluator gains a card_label_added block (match / no-match / unconditioned) and a comment_added block (match / wrong-trigger) — 13 cases total. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Moritz Kohm <moritz.kohm@gmail.com> Signed-off-by: Musiker15 <info@musiker15.de>
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.
Summary
card_label_addedandcomment_addedhave been in the automation DSL since v1 (ADR 0010) but their client emitters were deferred. This wires them up — the second item from the v0.2.0-beta Deferred automation list.Changes
card-drawer.tsx): two new callback props —onLabelAdded(cardId, labelId)fires when a label is attached (not on removal),onCommentAdded(cardId, commentId)fires after a comment posts successfully.board-client.tsx): passes those callbacks intoemitAutomationTrigger, so both flow through the existingevaluateAll→executeAllpath. Stale "v1 only emits card_created/card_moved" comment updated.automation-panel.tsx): new "Only when this label is added" condition selector forcard_label_added(scoped to alabelId); the rule summary resolves the label name; removed the stale "wired in a follow-up PR" note.executor.ts): documented the no-cascade invariant — actions hit the REST API directly and never re-enter the drawer's emitting path, so an automationset_labelaction cannot loop back into acard_label_addedrule (the loop risk flagged in ADR 0010 §Risks stays closed).Loop safety
ADR 0010 §Risks flagged "
set_labeltriggerscard_label_added" as a potential cascade. It's structurally impossible here: only manual drawer interactions emit triggers; the executor calls the API directly. Verified by reading the executor — every action is a directpostJson/patchJson, none route throughtoggleLabel/postComment. Documented inline so a future change can't silently reintroduce the loop.Tests
tests/unit/automation-evaluator.test.ts— +3 cases (card_label_added: match / no-match / unconditioned; comment_added: match / wrong-trigger). 13 cases total.pnpm typecheck+pnpm lintclean.Test plan
urgentis added → move to Triage column", attach the label from the card drawer, confirm the card movesdiscussed", post a comment, confirm the label appearsset_labelautomation action does NOT re-trigger acard_label_addedrule (no infinite loop)🤖 Generated with Claude Code