feat(FN-4367): add structured JSON verdict output for prompt-mode workflow steps

- Add verdict (PASS/FAIL) field to core WorkflowStepResult type
- Add parseWorkflowStepOutput() engine helper for json-workflow-verdict blocks
- Update executeWorkflowStep to extract structured verdict/notes from output
- Persist verdict and notes in runWorkflowSteps result entries
- Update agent prompt Feedback Format to require JSON verdict block
- Update WS-006 (Frontend UX Design) template prompt with structured fast-bail
- Add WorkflowResultsTab verdict badge and notes rendering with CSS
- Add 11 engine tests for verdict parsing edge cases
- Add 6 dashboard tests for verdict/notes rendering
- Create replace-ws006-prompt.mjs migration script for existing DBs
- Add changeset for @runfusion/fusion patch

Fusion-Task-Id: FN-4367
Fusion-Task-Lineage: adbfac60-5cfe-4ae9-9706-1094dfe7d676
This commit is contained in:
gsxdsm
2026-05-14 08:36:57 -07:00
parent 44f486f167
commit db78679758
8 changed files with 572 additions and 46 deletions

View File

@@ -388,6 +388,8 @@ export interface WorkflowStepResult {
status: "passed" | "failed" | "advisory_failure" | "skipped" | "pending";
/** Output from the workflow step agent (findings, errors, etc.) */
output?: string;
/** Machine-readable verdict from the workflow step agent. */
verdict?: "PASS" | "FAIL";
/** Optional non-blocking notes for advisory findings surfaced in task detail UI. */
notes?: string;
/** ISO-8601 timestamp when the step started */
@@ -613,31 +615,48 @@ Note: Refs (@e1, @e2) are invalidated after page navigation. Re-snapshot after c
toolMode: "readonly",
prompt: `You are a UX design reviewer. Verify frontend changes maintain visual polish and consistency with existing UI patterns and design tokens.
FAST-BAIL RULE (check this FIRST):
- The task harness gives you a "Diff Scope" listing the files this task actually changed.
- If that list contains NO frontend/UI files (no .tsx/.jsx/.ts/.js component files, no .css/.scss/.sass/.styl, no .html/.vue/.svelte/.astro, no design-token/theme files), respond IMMEDIATELY with a single short line such as "No UI changes in scope — approved." and STOP.
- Do NOT explore the worktree looking for related-looking UI code to critique. If this task didn't change a UI file, your review is a no-op by definition.
## Step 1: Scope Check (MANDATORY FIRST)
Otherwise, restrict your review to the UI files actually present in the diff scope.
The task harness provides a "Diff Scope" listing files this task actually changed.
Design System Review (only for UI files in the diff scope):
1. **Visual Hierarchy** — Check that the changes maintain consistent heading levels, content flow, and information architecture
2. **Spacing and Typography** — Verify consistent spacing (margins, padding, gaps) and typography scale usage
3. **Color and Token Consistency** — Check that CSS custom properties and design tokens are used correctly; no hardcoded color values that bypass the design system
4. **Component Reuse** — Verify existing UI components are reused instead of creating one-off styling; identify any duplication that could be refactored
5. **Responsive Behavior** — Check that layouts adapt properly across viewport sizes and maintain usability on mobile
6. **Fit with Design Language** — Verify the visual style matches existing patterns (border radius, shadows, transitions, icon style, etc.)
If the Diff Scope contains ZERO frontend/UI files (no .tsx/.jsx/.ts/.js component files, no .css/.scss/.sass/.styl, no .html/.vue/.svelte/.astro, no design-token/theme files), output ONLY:
Files to Review (only those that appear in the Diff Scope):
- Modified UI components (React, Vue, Angular, HTML)
- CSS/SCSS/styled-component files
- Design token or theme configuration files
\`\`\`json-workflow-verdict
{"verdict":"PASS","notes":"No UI changes in scope — approved."}
\`\`\`
Output Requirements:
- If design is consistent and polished (or there are no UI files in scope): respond with a brief approval line and stop.
- If issues found: start your response with "REQUEST REVISION" and describe each finding with specific file paths and suggested corrections.
- Prioritize issues by impact: layout breaks > visual inconsistency > style preferences.
- Do NOT spend time on stylistic nits when no real issues exist.`,
Then STOP. Do not browse the worktree. Do not read any files.
If there ARE frontend/UI files in scope, proceed to Step 2.
## Step 2: Design Review
Restrict your review to ONLY the UI files in the diff scope.
Check:
1. **Visual Hierarchy** — heading levels, content flow, information architecture
2. **Spacing and Typography** — consistent margins, padding, gaps, type scale
3. **Color and Token Consistency** — CSS custom properties and design tokens used; no hardcoded colors
4. **Component Reuse** — existing components reused; no one-off styling or duplication
5. **Responsive Behavior** — layouts adapt across viewports
6. **Fit with Design Language** — border radius, shadows, transitions, icon style match patterns
## Output Format
End your response with a JSON verdict block:
For clean reviews:
\`\`\`json-workflow-verdict
{"verdict":"PASS","notes":"<1-2 sentence summary>"}
\`\`\`
For issues requiring code changes:
\`\`\`json-workflow-verdict
{"verdict":"FAIL","notes":"<specific files and what needs to change>"}
\`\`\`
Prioritize: layout breaks > visual inconsistency > style preferences.
Do NOT spend time on nits when no real issues exist.`,
},
];