@@ -72,15 +72,145 @@ enum ExecutionStatus {
7272- Enum value ` 4 ` is reserved and will not be reused.
7373- New enum value ` ERROR = 5 ` for system-level failures.
7474
75- ## SDK/ Client Migration
75+ ## How the Client Should Interpret Execution Status
7676
77- 1 . Remove any ` PartialSuccess ` handling or ` isConditionalSkip ` workarounds.
78- 2 . Treat ` SUCCESS ` as the only positive outcome. Branch skips no longer
79- produce a warning status.
80- 3 . Treat ` FAILED ` as the single status for any node-level execution failure,
81- regardless of whether some or all steps failed.
82- 4 . Treat ` ERROR ` as a system-level problem (not caused by the workflow
83- configuration itself).
77+ ### Current state (SDK still has ` PartialSuccess ` )
78+
79+ The SDK (` @avaprotocol/types ` ) still exposes four runtime statuses:
80+ ` Success ` , ` PartialSuccess ` , ` Failed ` , ` Pending ` . The backend returns
81+ ` partialSuccess ` for ** both** conditional branch skips and actual step
82+ failures, so the client must disambiguate.
83+
84+ ** Decision tree for ` PartialSuccess ` :**
85+
86+ ```
87+ status === PartialSuccess
88+ └─ steps.every(s => s.success) ?
89+ ├─ YES → conditional skip (treat as success)
90+ └─ NO → real step failure (treat as error/warning)
91+ ```
92+
93+ ** Full client interpretation table (current SDK):**
94+
95+ | ` status ` | ` steps.every(s => s.success) ` | Interpretation | UI treatment |
96+ | ------------------| -------------------------------| ------------------------| ----------------------------------------------|
97+ | ` Success ` | true | All nodes ran, all OK | Green — "Simulation completed" |
98+ | ` PartialSuccess ` | true | Branch skipped nodes | Green — "Simulation completed — Some steps skipped by condition" |
99+ | ` PartialSuccess ` | false | Real step failure(s) | Yellow — "Simulation completed with errors" |
100+ | ` Failed ` | false | All-or-nothing failure | Red — "Simulation completed with errors" |
101+ | ` Pending ` | n/a | Still running | Neutral — loading state |
102+
103+ ** Where this logic lives in Studio today:**
104+
105+ 1 . ** Simulation status label** (` components/CanvasToolbarBottom/index.tsx ` ):
106+ ``` ts
107+ const isSuccess = simulationResult ?.status === ExecutionStatus .Success ;
108+ const isFailed = simulationResult ?.status === ExecutionStatus .Failed ;
109+ const isConditionalSkip =
110+ simulationResult ?.status === ExecutionStatus .PartialSuccess &&
111+ simulationResult ?.steps ?.every ((step : StepProps ) => step .success );
112+ const hasStepErrors = ! isSuccess && ! isConditionalSkip ;
113+ ```
114+ - ` isConditionalSkip ` → green label, normal "Deploy" button
115+ - ` hasStepErrors ` → yellow/red label, "Deploy Anyway" button with caution tooltip
116+
117+ 2 . ** Simulation gate for deploy** (` app/types/simulation.ts ` ):
118+ Only ` ExecutionStatus.Success ` passes the gate. ` PartialSuccess ` (even
119+ conditional skips) currently fails the gate — this needs updating after
120+ the SDK change so that the gate also passes for ` Success ` with skipped
121+ steps.
122+
123+ 3 . ** Execution time display** (` CanvasToolbarBottom getExecutionTimeDisplay ` ):
124+ Maps status to text color: ` Success ` → green, ` PartialSuccess ` → yellow,
125+ ` Failed ` → red, ` Pending ` → yellow.
126+
127+ 4 . ** Execution history chips** (` components/workflows/StatusChips.tsx ` ):
128+ - ` Success ` → "Completed" (green check)
129+ - ` PartialSuccess ` → "Partial Success" (yellow alert)
130+ - ` Failed ` → "Has Error" (red X)
131+
132+ 5 . ** Execution modal header** (` components/workflows/ExecutionModal.tsx ` ):
133+ - ` Success ` → green "Success"
134+ - ` PartialSuccess ` → yellow "Partial Success"
135+ - ` Failed ` → red "Has Error"
136+
137+ 6 . ** Manual run callback** (` components/workflows/WorkflowControlButton.tsx ` ):
138+ Treats both ` Success ` and ` PartialSuccess ` as a successful run for
139+ the toast notification. This is the only place that already collapses
140+ the two into a single positive path.
141+
142+ ### Target state (after SDK upgrade)
143+
144+ Once the SDK ships the ` SUCCESS ` /` FAILED ` /` ERROR ` redesign:
145+
146+ | ` status ` | Interpretation | UI treatment |
147+ | -----------| -----------------------------------------| ---------------------------------------------|
148+ | ` Success ` | All executed steps passed (skips OK) | Green — "Simulation completed" |
149+ | ` Failed ` | At least one step failed | Red — "Simulation completed with errors" |
150+ | ` Error ` | System-level failure (VM crash, etc.) | Red — "Simulation failed — system error" |
151+ | ` Pending ` | Still running | Neutral — loading state |
152+
153+ ** Branch skip detection** moves from status-level to the ` steps ` array:
154+ compare ` steps.length ` against the workflow's total node count. If
155+ ` steps.length < nodeCount ` and ` status === Success ` , display an
156+ informational note like "N steps skipped by condition".
157+
158+ ### SDK/Client Migration Checklist
159+
160+ After upgrading ` @avaprotocol/types ` :
161+
162+ 1 . ** Remove ` isConditionalSkip ` workaround** in ` CanvasToolbarBottom ` — ` Success `
163+ already covers this case.
164+ 2 . ** Remove ` PartialSuccess ` branches** from ` StatusChips.tsx ` ,
165+ ` ExecutionModal.tsx ` , ` getExecutionTimeDisplay() ` .
166+ 3 . ** Add ` Error ` handling** — new status for system-level failures.
167+ Display distinctly from ` Failed ` (e.g., "System error — contact support"
168+ vs "Execution failed — check step details").
169+ 4 . ** Update simulation gate** (` app/types/simulation.ts ` ) — ` Success ` is the
170+ only passing status (same as today, but no ambiguity).
171+ 5 . ** Update ` WorkflowControlButton ` ** — remove ` PartialSuccess ` from the
172+ success path; add ` Error ` to the failure path.
173+ 6 . ** Update Storybook mocks** — replace ` ExecutionStatus.PartialSuccess `
174+ references with ` Failed ` or ` Success ` as appropriate.
175+
176+ ## SDK Changes (ava-sdk-js)
177+
178+ ** PR** : https://github.com/AvaProtocol/ava-sdk-js/pull/212
179+
180+ ### TypeScript enum update
181+
182+ ``` typescript
183+ // packages/types/src/enums.ts
184+ export enum ExecutionStatus {
185+ Unspecified = " unspecified" ,
186+ Pending = " pending" ,
187+ Success = " success" ,
188+ Failed = " failed" ,
189+ Error = " error" , // NEW — replaces PartialSuccess
190+ }
191+ ```
192+
193+ ### Backward compatibility
194+
195+ The SDK conversion functions handle legacy proto value ` 4 ` (retired
196+ ` PARTIAL_SUCCESS ` ) by mapping it to ` ExecutionStatus.Failed ` :
197+
198+ ``` typescript
199+ case ProtobufExecutionStatus .EXECUTION_STATUS_FAILED :
200+ case 4 as ProtobufExecutionStatus : // legacy PARTIAL_SUCCESS
201+ return ExecutionStatus .Failed ;
202+ ```
203+
204+ This ensures stored executions written before the migration are
205+ displayed correctly without requiring a data migration.
206+
207+ ### Test updates (18 files)
208+
209+ - All ` ExecutionStatus.PartialSuccess ` assertions replaced with
210+ ` ExecutionStatus.Failed ` (step failures) or ` ExecutionStatus.Success `
211+ (branch skips)
212+ - ` partialSuccess.test.ts ` rewritten — test names and expectations
213+ aligned with the new three-value model
84214
85215## Consequences
86216
@@ -90,3 +220,5 @@ enum ExecutionStatus {
90220- Email summaries for branch-skip workflows now show a green success
91221 badge with a note like "3 nodes skipped by Branch condition" instead
92222 of a yellow warning badge.
223+ - Legacy stored executions with proto value ` 4 ` are transparently
224+ mapped to ` Failed ` by the SDK — no data migration required.
0 commit comments