Skip to content

feat(webapp): make a trigger a real node in the editor - #530

Merged
LeadcodeDev merged 2 commits into
mainfrom
feature/automation-triggers-ws4
Sep 17, 2026
Merged

LeadcodeDev merged 2 commits into
mainfrom
feature/automation-triggers-ws4

Conversation

@LeadcodeDev

@LeadcodeDev LeadcodeDev commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

WS4 of #521. Stacked on #529 (WS2) — review that one first; this PR's diff will shrink to its own commit once WS2 merges.

What changed

The canvas invented its trigger. buildInitialNodes created one node at a hard-coded __trigger__ id from two workflow-level props, and buildInitialEdges invented an edge to every root. Nothing about it came from the graph, so a workflow could hold exactly one trigger, and it could never be moved, deleted, or told apart from another.

Triggers are now drawn from graph.triggers — one node each, at its own graph-local id, positioned from the layout, draggable and deletable, with the same card, selection ring, error badge and + handle a connector node has. buildLayout records their position, which it used to discard. Nothing is invented any more, so TRIGGER_NODE_ID and the three helpers that built the fiction are gone.

Configuration moved from the workflow to the node. The panel edits one trigger and reports through onChange; it has no save button of its own, because a trigger is saved with the graph exactly like a connector's config. The context menu offers "Ajouter un déclencheur" in place of "Configurer le déclencheur" — the part of the original context-menu request (#520) that was never delivered.

A gap this closed on the way

projectGraphErrors routed errors by connector_id alone. The five GraphError variants that name a trigger — InertTrigger, EmptyEventTrigger, UnknownEventName, EdgeIntoTrigger, BranchedTriggerEdge — therefore landed in the graph-level banner instead of on the node at fault, which is precisely what #525 asks for. The backend has emitted trigger_id since WS1; the editor now reads it.

This was found because a test was written against the real pipeline and left failing rather than weakened to pass.

Two consequences worth naming

run-now-feature read the subscribed event names from the /trigger route that WS2 deletes. It now derives them from the graph's triggers.

The workflow list loses its "Déclenchement" column. It said "Manuel" or "Sur événement" — a label that cannot describe a workflow holding several triggers of different kinds — and the list response carries no graph to summarise. Restoring a summary needs a new API field, so it is a change of its own rather than a passenger on this one. The two tests asserting that column were deleted rather than contorted, since their intent is superseded.

Acceptance (#525)

  • A second trigger can be added, configured and wired to its own connector.
  • A trigger can be deleted, and its edges go with it.
  • A trigger wired to nothing is refused on save, and the message lands on that trigger.
  • A manual and an event trigger coexist and read differently on the canvas.
  • The old workflow-level trigger panel is gone, with nothing left calling its hooks.

Verification

pnpm check clean, 544 files
pnpm vitest run 1819 passed, 0 failed
pnpm exec tsc --noEmit 28 errors, identical set to main's baseline
pnpm build clean

Closes #525

Follow-up from running it (second commit)

Two things made the node look real without behaving like one, both found by using the editor rather than by a test.

A trigger could not be wired by hand — the line vanished on release. isBranchDeclared refused every connection whose source was a trigger. That was correct while the canvas invented those edges and no user could draw them; it is wrong the moment a trigger is a node you add unwired. It now refuses only a branched edge leaving a trigger, which is the rule the domain actually states (BranchedTriggerEdge). Connector-to-connector was never affected — pinned by a new test alongside, so the distinction is recorded rather than assumed.

A trigger's kind is now chosen when adding it, not afterwards in its panel. Treating "manual or events" as a setting was the wrong model: it is what the node is. A connector picks its kind at creation and never changes it; a trigger is no different. The context menu offers "Manuel" and "Sur événement(s)" as two ways to add one, and the panel drops its mode tabs — it configures the events of an events trigger, and a manual trigger has nothing to configure, so adding one opens no panel at all.

The three panel tests covering mode switching were deleted rather than rewritten: their subject no longer exists.

Re-verified after both: pnpm check clean, 1819 frontend tests pass, tsc at main's 28-error baseline, build clean. Four unrelated failures in the full sweep (hr, planning, quotes) were load-induced timeouts on a loaded machine — all pass when re-run alone.

@LeadcodeDev LeadcodeDev added enhancement New feature or request mvp Périmètre MVP area:frontend Frontend React (webapp) labels Sep 17, 2026
@LeadcodeDev LeadcodeDev self-assigned this Sep 17, 2026
@codspeed

codspeed Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Congrats! CodSpeed is installed 🎉

🆕 11 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks


Open in CodSpeed

@LeadcodeDev
LeadcodeDev added this pull request to stack #531 September 17, 2026 08:03
Base automatically changed from feature/automation-triggers-ws2 to main September 17, 2026 08:03
The canvas invented its trigger. `buildInitialNodes` created one node at a
hard-coded `__trigger__` id from two workflow-level props, and
`buildInitialEdges` invented an edge to every root. Nothing about it came
from the graph, so a workflow could hold exactly one trigger and it could
never be moved, deleted, or told apart from another.

Triggers are now drawn from `graph.triggers`: one node each, at its own
graph-local id, positioned from the layout, draggable, deletable, with the
same card, selection ring, error badge and `+` handle a connector node has.
`buildLayout` records their position, which it used to discard. Nothing is
invented any more, so `TRIGGER_NODE_ID` and the three helpers that built the
fiction are gone.

Configuration moved from the workflow to the node. The panel edits one
trigger and reports through `onChange`; it has no save button of its own,
because a trigger is saved with the graph exactly like a connector's config.
The pane context menu offers "Ajouter un déclencheur" in place of
"Configurer le déclencheur", and `useWorkflowTrigger`/`useSetWorkflowTrigger`
are deleted along with the route constant they called.

`projectGraphErrors` routed errors by `connector_id` alone, so the five
`GraphError` variants that name a trigger instead — `InertTrigger`,
`EmptyEventTrigger`, `UnknownEventName`, `EdgeIntoTrigger`,
`BranchedTriggerEdge` — landed in the graph-level banner rather than on the
node at fault. The backend has emitted `trigger_id` since WS1; the editor
now reads it.

Two consequences worth naming. `run-now-feature` read the subscribed event
names from the deleted `/trigger` route and now derives them from the
graph's triggers. And the workflow list loses its "Déclenchement" column:
it said "Manuel" or "Sur événement", which cannot describe a workflow
holding several triggers of different kinds, and the list response carries
no graph to summarise. Restoring a summary needs a new API field and is a
change of its own.

Closes #525
Refs #521
…dding it

Two things made the trigger node look real without behaving like one.

Dragging a connection from a trigger to a connector dropped the line on
release. `isBranchDeclared` refused every connection whose source was a
trigger — correct while the canvas invented those edges and the user could
never draw them, wrong the moment a trigger became a node you add unwired.
It now refuses only a *branched* edge leaving a trigger, which is the rule
the domain actually states (`BranchedTriggerEdge`); a plain one is what
wires the graph. Connector-to-connector was never affected, which the new
test pins alongside.

A trigger's kind was picked after the fact, in its configuration panel.
That treated "manual or events" as a setting, when it is what the node is
— a connector chooses its kind at creation and never changes it, and a
trigger is no different. The context menu now offers "Manuel" and "Sur
événement(s)" as two ways to add one, and the panel drops its mode tabs:
it configures the events of an events trigger, and a manual trigger has
nothing to configure, so adding one opens no panel at all.

The three panel tests covering mode switching are deleted rather than
rewritten — their subject no longer exists.
@LeadcodeDev
LeadcodeDev force-pushed the feature/automation-triggers-ws4 branch from e46a293 to 8cc4eee Compare September 17, 2026 08:03
@github-project-automation github-project-automation Bot moved this to Todo in mestier Sep 17, 2026
@LeadcodeDev
LeadcodeDev merged commit 681bd4b into main Sep 17, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in mestier Sep 17, 2026
@LeadcodeDev
LeadcodeDev deleted the feature/automation-triggers-ws4 branch September 17, 2026 08:21
@NathaelB

Copy link
Copy Markdown
Contributor

🚀 Preview deployed: https://pr-530.mestier.fr

Synced revision <no value>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Frontend React (webapp) enhancement New feature or request mvp Périmètre MVP

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(automation): WS4 — triggers become real nodes in the editor

2 participants