# ADR-0002: Preserve existing actionflows during explicit updates

- Status: Accepted
- Date: 2026-09-02

## Context

New actionflow generation compiles a semantic plan into a new application. That
workflow may replace a generated draft, but applying the same lifecycle to a
user's existing actionflow would discard nodes and properties that were not
mentioned by the requested change. Existing node IDs are also referenced by
conditions, formulas, and designer state.

## Decision

Provide a separate `actionflow update` command. It must receive an exact
`appId`, read the active formal design, write a complete backup, apply only
explicit update operations, preserve IDs of existing nodes, keep the original
event trigger unchanged, save through the formal `saveDesign` endpoint as a
new version, and verify the result by formal readback.

The update defaults to the target's current enabled state. Every successful
update sends `saveNewVersion: true`; this is independent of `saveAndStart`.
Any requested event-trigger change is rejected before check/save and must be
implemented as a new actionflow. Save or readback failure is reported with the
backup path; the CLI does not silently retry by rebuilding, overwrite the
target with the backup, or delete the target.

## Consequences

- Unmentioned design content survives an update.
- Changes are auditable through the pre-update backup and operation list.
- Adding a node requires a native node shape from a real design/component
  response; the updater does not invent platform DTOs.
- A user who wants a wholly rebuilt actionflow must explicitly use `generate`
  and receive a new application instead.
