-
Notifications
You must be signed in to change notification settings - Fork 1
Pipeline Plan 13
The plan is complete. Here's the implementation plan for pipeline dry-run mode:
Add a comprehensive --dry-run mode to shipwright pipeline start that validates the full pipeline configuration, shows what stages would execute, displays per-stage model routing and estimated cost, and exits with code 0 (valid) or non-zero (broken config). The existing --dry-run flag and DRY_RUN variable already exist (line 158, 303 of sw-pipeline.sh) but the current stub at line 5630 just prints "Dry run — no stages will execute" and returns — this plan replaces that with real logic.
Inline in sw-pipeline.sh rather than a separate module. The dry-run logic needs access to $PIPELINE_CONFIG, stage iteration, $COST_MODEL_RATES, and model routing — all already in scope. ~150 lines added.
| File | Action | Purpose |
|---|---|---|
scripts/sw-pipeline.sh |
Modify | Add dry_run_report() function; replace stub at line 5630; guard initialize_state
|
scripts/sw-pipeline-test.sh |
Modify | Expand existing test_dry_run + add 4 new dry-run test cases |
- Iterate all stages from
$PIPELINE_CONFIGusingjq - For each: show ID, enabled/disabled, gate type, model (from
.config.model // defaults.model // $MODEL), stage-specific config - Validate: JSON parse, recognized stage IDs, stage ordering
- Estimate cost per stage using
$COST_MODEL_RATES+ token heuristics (plan ~15K, build ~25K/iteration, etc.) - Return 0 if valid, 1 if broken
# Before: if [[ "$DRY_RUN" == "true" ]]; then info "Dry run — no stages will execute" return 0 fi # After: if [[ "$DRY_RUN" == "true" ]]; then dry_run_report return $? fi
- Wrap
initialize_stateand existing-pipeline check withif [[ "$DRY_RUN" != "true" ]] - Skip CI resume branch context restoration in dry-run mode
- Keep
preflight_checks,gh_init,load_pipeline_config(non-destructive, needed for display)
-
test_dry_run(modify existing): Assert "Stage Plan", "Cost Estimate", "Dry run passed" -
test_dry_run_shows_all_stages: Autonomous template → all 12 stage IDs in output -
test_dry_run_shows_cost_estimate: Dollar amounts present -
test_dry_run_invalid_config: Broken JSON → non-zero exit -
test_dry_run_no_side_effects: No state file, no artifacts, no branches
- Task 1: Add
dry_run_report()function with stage iteration and formatted output - Task 2: Add config validation logic (JSON parse, stage IDs, ordering)
- Task 3: Add per-stage cost estimation using
$COST_MODEL_RATESand token heuristics - Task 4: Replace dry-run stub at line 5630 with call to
dry_run_report - Task 5: Guard
initialize_stateand pipeline existence check withDRY_RUN != true - Task 6: Update existing
test_dry_runtest to verify new output format - Task 7: Add
test_dry_run_shows_all_stagestest case - Task 8: Add
test_dry_run_shows_cost_estimatetest case - Task 9: Add
test_dry_run_invalid_configtest case (broken JSON → non-zero exit) - Task 10: Add
test_dry_run_no_side_effectstest case - Task 11: Run full test suite (
npm test) and fix any regressions
-
Unit-level: Each test runs real
sw-pipeline.shas subprocess with mock environment - Negative testing: Malformed JSON → validates non-zero exit
- Side-effect testing: No state files, artifacts, or branches created
-
Full regression:
npm test(all 22 suites)
-
shipwright pipeline start --issue N --dry-runprints stage plan without executing - Shows: stages, models per stage, estimated iterations, estimated cost
- Validates: config loading, template selection, stage ordering
- Exit code 0 if valid, non-zero if config is broken
- No side effects (no state writes, no branches, no API calls)
- 5 dry-run tests passing + all 22 existing suites pass
- Bash 3.2 compatible