-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix(create-story): restore validate-workflow task and harden checklist execution for conditional contexts #1652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
pure-maple
wants to merge
6
commits into
bmad-code-org:main
from
pure-maple:fix/restore-validate-workflow-executor
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1b57ae9
fix(create-story): restore validate-workflow executor and conditional…
9e4e376
fix(create-story): address validator determinism and bot feedback
pure-maple d098517
fix(create-story): clarify required vars and metadata prompt flow
pure-maple 99c7883
fix(create-story): address coderabbit full-review findings
pure-maple bcb2ec5
fix(validate-workflow): clarify critical vs non-critical remediation …
pure-maple 0db123d
fix(validate): remove pass halt and add parse/report failure safeguards
pure-maple File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
| <task id="_bmad/core/tasks/validate-workflow.xml" | ||
| name="Validate Workflow Output" | ||
| description="Run a workflow checklist against a target document and produce an evidence-backed validation report"> | ||
|
|
||
| <objective>Validate a generated document against checklist requirements with deterministic variable resolution and produce an actionable pass/fail report</objective> | ||
|
|
||
| <inputs> | ||
| <input name="workflow" required="true" desc="Workflow yaml path used to resolve variables and checklist location" /> | ||
| <input name="checklist" required="false" desc="Checklist file path. Defaults to workflow.yaml validation field, then checklist.md beside workflow" /> | ||
| <input name="document" required="false" desc="Document to validate. If omitted, resolve from workflow variables only" /> | ||
| <input name="report" required="false" desc="Output report file path. Defaults to document folder validation-report-{timestamp_utc}.md" /> | ||
| </inputs> | ||
|
|
||
| <llm critical="true"> | ||
| <i>MANDATORY: Execute ALL steps in order. Do not skip any checklist item.</i> | ||
| <i>Always read COMPLETE files; do not sample with offsets.</i> | ||
| <i>If a file cannot be loaded in one read, read it in deterministic sequential chunks until full coverage is achieved and recorded.</i> | ||
| <i>Every non-N/A judgment must include concrete evidence from the document.</i> | ||
| <i>If a required path cannot be resolved, stop and ask for explicit user input.</i> | ||
| <i>Be strict and objective: no assumptions without evidence.</i> | ||
| <i>N/A is allowed only when an explicit conditional requirement is not applicable; never use N/A due to missing evidence.</i> | ||
| </llm> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <flow> | ||
| <step n="1" title="Load Workflow Context"> | ||
| <action>Load workflow yaml from input {workflow}</action> | ||
| <action>Resolve variables in this order: | ||
| 1) load config_source file if present | ||
| 2) resolve all {config_source}:key references | ||
| 3) resolve system path variables ({project-root}, {installed_path}) | ||
| 4) resolve system-generated values (date) | ||
| </action> | ||
| <action>Determine checklist path in priority order: | ||
| - explicit input {checklist} | ||
| - workflow.yaml field "validation" | ||
| - sibling file checklist.md in workflow directory | ||
| </action> | ||
| <action>Determine document path in priority order: | ||
| - explicit input {document} | ||
| - resolved variable {story_file} if present | ||
| - resolved variable {default_output_file} if present | ||
| </action> | ||
| <action if="still unresolved">Ask user: "Which document should I validate?" and WAIT</action> | ||
| <action>Normalize resolved workflow/checklist/document paths to absolute paths before loading files</action> | ||
| </step> | ||
|
|
||
| <step n="2" title="Load Checklist and Target Document" critical="true"> | ||
| <action>Load full checklist content (use chunked sequential reads only when needed for large files, and record covered ranges)</action> | ||
| <action>Load full target document content (use chunked sequential reads only when needed for large files, and record covered ranges)</action> | ||
| <action>Extract story metadata when available (epic_num, story_num, story_id, story_key, title) from filename, heading, or frontmatter</action> | ||
| <action>Parse checklist into ordered sections and atomic validation items; assign each item a stable id (section_index.item_index)</action> | ||
| <action>Compute parsed_item_count and expected_item_count (from raw checklist requirement markers such as - [ ], - [x], and requirement list lines)</action> | ||
| <action if="expected_item_count > 0 AND parsed_item_count < expected_item_count * 0.9">HALT with error: "Checklist parse divergence too large (parsed={parsed_item_count}, expected~={expected_item_count}); fix checklist formatting before validation"</action> | ||
| <action>Determine critical checks from explicit signals only: | ||
| - item-level markers: [CRITICAL], critical:true, MUST FIX | ||
| - section-level markers: headings containing CRITICAL (case-insensitive), MUST FIX, MUST-FIX, or the exact phrase "Must Fix Before Proceeding" | ||
| - XML section attributes: critical="true" or critical="yes" | ||
| - do not infer criticality from generic keywords alone | ||
| </action> | ||
| <action>Detect conditional expressions in checklist items (for example: if/when/unless + variable references)</action> | ||
| <action if="no checklist items parsed">HALT with error: "Checklist is empty or unparsable"</action> | ||
| <action if="conditional items reference metadata and metadata is missing">Ask user to provide all missing referenced metadata fields (epic_num, story_num, story_id, story_key, title/story_title) and WAIT before evaluating checklist items</action> | ||
| </step> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <step n="3" title="Validate Every Checklist Item" critical="true"> | ||
| <mandate>For every checklist item, evaluate one of: PASS, PARTIAL, FAIL, N/A</mandate> | ||
| <action>Initialize counters to zero before evaluation: | ||
| - pass_count, partial_count, fail_count, na_count | ||
| - critical_fail_count, critical_partial_count | ||
| - applicable_count, total_item_count, processed_item_count | ||
| - total_section_count, processed_section_count | ||
| </action> | ||
| <action>For each item: | ||
| - restate requirement in one short sentence | ||
| - if item contains explicit condition (for example "If story_num > 1") and condition is false, mark N/A with the exact reason | ||
| - locate explicit evidence in document (include line references when possible) | ||
| - consider implied coverage only when explicit text is absent | ||
| - assign verdict and rationale | ||
| - if PARTIAL/FAIL, describe impact and a concrete fix | ||
| - update all counters immediately after each verdict | ||
| </action> | ||
| <action>Process sections in deterministic order and increment processed_section_count after each section completes</action> | ||
| <action if="processed_section_count != total_section_count">HALT with error: "Validation incomplete: one or more checklist sections were not processed"</action> | ||
| <action if="processed_item_count != total_item_count">HALT with error: "Validation incomplete: one or more checklist items were not processed"</action> | ||
| <action>Compute applicable_count = pass_count + partial_count + fail_count</action> | ||
| <action>Compute pass_percent using applicable_count (if 0, set pass_percent=0)</action> | ||
| <action>Set gate_warning: | ||
| - "No applicable checklist items were evaluated; manual confirmation required" if applicable_count == 0 | ||
| - "N/A" otherwise | ||
| </action> | ||
| <action>Set gate decision deterministically: | ||
| - NEEDS_REVIEW if applicable_count == 0 | ||
| - FAIL if critical_fail_count > 0 | ||
| - FAIL if critical_partial_count > 0 | ||
| - FAIL if fail_count > 0 | ||
| - PASS otherwise | ||
| </action> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <critical>DO NOT SKIP ANY ITEM OR SECTION</critical> | ||
| </step> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <step n="4" title="Generate Validation Report"> | ||
| <action>Generate timestamp values: | ||
| - timestamp_utc for filenames in YYYYMMDD-HHmmss (UTC) | ||
| - generated_at_utc for report display in ISO-8601 UTC | ||
| </action> | ||
| <action>Set report path: | ||
| - use explicit input {report} when provided | ||
| - else save to target document folder as validation-report-{timestamp_utc}.md | ||
| </action> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <action>Write report with the format below</action> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <action if="report write/save fails">HALT with error: "Validation report could not be saved"</action> | ||
|
|
||
| <report-format> | ||
| # Validation Report | ||
|
|
||
| - Document: {document} | ||
| - Checklist: {checklist} | ||
| - Workflow: {workflow} | ||
| - Date: {generated_at_utc} | ||
|
|
||
| ## Summary | ||
| - Overall pass rate: {pass_count}/{applicable_count} ({pass_percent}%) | ||
| - Critical failures: {critical_fail_count} | ||
| - Critical partials: {critical_partial_count} | ||
| - Gate decision: {PASS|FAIL|NEEDS_REVIEW} | ||
| - Gate warning: {gate_warning} | ||
|
|
||
| ## Section Results | ||
| ### {Section Name} | ||
| - PASS: {count} | ||
| - PARTIAL: {count} | ||
| - FAIL: {count} | ||
| - N/A: {count} | ||
|
|
||
| For each checklist item: | ||
| - [MARK] {item} | ||
| - Evidence: {quote or line reference} | ||
| - Analysis: {why mark is correct} | ||
| - Action (if PARTIAL/FAIL): {specific remediation} | ||
|
|
||
| ## Must Fix Before Proceeding | ||
| - {all critical FAIL and critical PARTIAL items} | ||
|
|
||
| ## Should Improve | ||
| - {all non-critical FAIL and non-critical PARTIAL items} | ||
|
|
||
| ## Final Recommendation | ||
| 1. {highest-priority fix} | ||
| 2. {second-priority fix} | ||
| 3. {third-priority fix} | ||
| </report-format> | ||
| </step> | ||
|
|
||
| <step n="5" title="Return Decision and Halt"> | ||
| <action>Present concise summary with counts and gate decision</action> | ||
| <action>Provide report path</action> | ||
| <action if="critical failures exist">State clearly that workflow should not proceed until fixes are applied</action> | ||
| <action if="gate decision == PASS">Return control immediately and continue calling workflow execution</action> | ||
| <action if="gate decision == FAIL OR gate decision == NEEDS_REVIEW">HALT and wait for user direction</action> | ||
| </step> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </flow> | ||
|
|
||
| <halt-conditions> | ||
| <condition>HALT if workflow file cannot be loaded</condition> | ||
| <condition>HALT if checklist file cannot be loaded</condition> | ||
| <condition>HALT if target document cannot be determined after user prompt</condition> | ||
| <condition>HALT if any checklist section is skipped</condition> | ||
| <condition>HALT if validation report cannot be saved</condition> | ||
| </halt-conditions> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <critical-rules> | ||
| <rule>Never skip checklist items</rule> | ||
| <rule>Every PASS/PARTIAL/FAIL must have evidence</rule> | ||
| <rule>Use deterministic variable resolution before asking the user</rule> | ||
| <rule>Always save a validation report file</rule> | ||
| <rule>N/A is valid only for explicit conditional non-applicability</rule> | ||
| <rule>Criticality must come from explicit checklist markers or critical sections</rule> | ||
| </critical-rules> | ||
| </task> | ||
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.
Uh oh!
There was an error while loading. Please reload this page.