Skip to content

Add "minimal" pipeline template for trivial single-file fixes#241

Open
sethdford wants to merge 8 commits intomainfrom
feat/add-minimal-pipeline-template-for-trivia-122
Open

Add "minimal" pipeline template for trivial single-file fixes#241
sethdford wants to merge 8 commits intomainfrom
feat/add-minimal-pipeline-template-for-trivia-122

Conversation

@sethdford
Copy link
Copy Markdown
Owner

@sethdford sethdford commented Mar 9, 2026

Summary

Add "minimal" pipeline template for trivial single-file fixes

Changes

16 files changed, 12331 insertions(+), 1342 deletions(-)
8 commit(s) via shipwright pipeline (fast)

Test Results

  ▸ GET /api/db/health returns status... ✓
  ▸ GET /api/db/events returns status... ✓

WebSocket
  ▸ WebSocket connects and receives FleetState... ✓

════════════════════════════════════════════════════
  All 37 tests passed ✓
════════════════════════════════════════════════════

Developer simulation: 0 reviewer concerns pre-addressed
Architecture validation: 0 violations

Closes #122


Metric Value
Pipeline fast
Duration 1h 51m 13s
Model opus
Agents 1

Generated by shipwright pipeline

Summary by CodeRabbit

  • New Features

    • Added a new minimal pipeline template optimized for trivial projects and simple fixes with reduced iterations and disabled quality gates.
  • Improvements

    • Enhanced pipeline template selection logic to automatically recognize and apply the minimal template for projects with minimal source files and no deployment requirements.
    • Improved documentation table formatting for better readability.
  • Tests

    • Expanded test coverage for pipeline template selection and project detection scenarios.

Seth Ford and others added 8 commits March 9, 2026 06:50
- New `minimal` template: intake → build → test → PR with no quality gates,
  no intelligence, haiku model, and max 3 build iterations
- Project detection recommends `minimal` for projects with ≤5 source files
- Daemon triage selects `minimal` for score ≥90 (very simple issues)
- Updated CLAUDE.md pipeline template tables
- Added to upgrade file list for `shipwright upgrade`
- Updated tests for project-detect and daemon-triage

Closes #122

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pipeline test suite was failing when run inside a pipeline (e.g.,
via `shipwright loop`) because parent environment variables like
PIPELINE_TEMPLATE, ARTIFACTS_DIR, and SCRIPT_DIR leaked into the test
subprocess, causing it to load the wrong template and skip stages.

Fixes:
- Clear pipeline-related env vars in invoke_pipeline() before running
  the subprocess
- Handle --effort, --fallback-model, --dangerously-skip-permissions
  flags in mock claude CLI to prevent prompt corruption

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sethdford sethdford added ready-to-build Issue is ready for autonomous pipeline processing auto-patrol Created by autonomous patrol agents strategic Created by strategic intelligence agent labels Mar 9, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

A new "minimal" pipeline template is introduced for trivial single-file fixes, featuring only build and test stages. Detection logic is added to identify trivial projects and high-scoring tasks to select this template. Infrastructure, tests, and documentation are updated to support the new template throughout the system.

Changes

Cohort / File(s) Summary
Minimal Template Definition
templates/pipelines/minimal.json, scripts/sw-upgrade.sh
New minimal pipeline template file with intake, build, and test stages only (no plan, review, deploy, validate, or compound quality). Registered in upgrade system for automatic deployment.
Detection & Scoring Logic
scripts/lib/daemon-triage.sh, scripts/lib/project-detect.sh
Enhanced pipeline selection: daemon-triage now uses two-tier scoring (≥90 → minimal, ≥70 → fast); project-detect adds early trivial-project detection (≤5 files, no deployment/CI) selecting minimal with 90% confidence.
Test Coverage
scripts/sw-lib-daemon-triage-test.sh, scripts/sw-project-detect-test.sh, scripts/sw-pipeline-test.sh
New and updated test cases: high-score scenario for minimal template, trivial/minimal project detection tests, deployment use-case tests, and environment variable cleanup in test subprocess.
Documentation & Metadata
.claude/CLAUDE.md, .claude/daemon-config.json, .claude/intelligence-cache.json, .claude/loop-state.md, .claude/platform-hygiene.json
Updated documentation tables with minimal template entry, refreshed timestamps in daemon and cache configs, replaced loop state content with minimal pipeline context, and adjusted file path references in platform hygiene data.

Sequence Diagram

sequenceDiagram
    participant PR as Pull Request
    participant PD as Project Detector
    participant DT as Daemon Triage
    participant TS as Template System
    participant PE as Pipeline Executor

    PR->>PD: Analyze project characteristics
    
    alt Trivial Project (≤5 files, no CI/deploy)
        PD->>TS: Select minimal template (90% confidence)
    else Non-trivial Project
        PD->>DT: Calculate quality score
        
        alt High Score (≥90)
            DT->>TS: Select minimal template
        else Medium Score (≥70)
            DT->>TS: Select fast template
        else Low Score
            DT->>TS: Select standard/full template
        end
    end
    
    TS->>PE: Load selected template (minimal: intake+build+test)
    PE->>PE: Execute with max 3 iterations, no quality gates
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A minimal hop through the code,
Build and test on the quickest road,
No frills for typos, docs so small,
Minimal templates help us all! ✨
Trivial fixes, fast and tight,
Your pipeline now springs with delight!

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description deviates significantly from the template structure by including test results and metrics instead of following the required Summary/Changes/Test Plan/Standards Checklist format; key sections are missing or incomplete. Restructure the description to follow the template: add a concise Summary section, list key Changes with bullet points, document Test Plan with checkboxes, confirm Shipwright Standards compliance, and link the related issue clearly.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive Several changes appear tangential to the core minimal template feature: metadata updates (.claude files), environment variable cleanup in tests, mock CLI flag extensions, and platform hygiene adjustments lack clear connection to issue #122 requirements. Clarify whether changes to .claude metadata files, test environment isolation, and mock CLI flags are necessary dependencies for the minimal template feature or if they should be separated into a different PR.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title directly and clearly summarizes the main change: adding a 'minimal' pipeline template for trivial single-file fixes, which aligns perfectly with the changeset and issue #122.
Linked Issues check ✅ Passed The PR successfully implements all acceptance criteria from issue #122: the minimal template is created and configured, integrated into the system, documented in CLAUDE.md, and supports the required usage patterns.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-minimal-pipeline-template-for-trivia-122

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/loop-state.md:
- Around line 81-82: The JSON result under "Iteration 1 (2026-03-09T11:11:31Z)"
is truncated (it ends at "resu") and breaks structured parsing; open
.claude/loop-state.md, locate the Iteration 1 block header and the following
JSON blob, then either remove that incomplete JSON entry or replace it with a
fully-formed JSON result (regenerate the complete iteration object so it matches
other iterations' structure), ensuring the entry no longer ends with the partial
token "resu" and that the JSON is valid.
- Line 2: The YAML-like `goal` value is broken by unescaped double quotes around
minimal, causing the field to end early; update the `goal` entry in
.claude/loop-state.md so the embedded quotes are either escaped or the whole
value is wrapped in single quotes (e.g., goal: 'Add "minimal" pipeline template
for trivial single-file fixes') to preserve the full string.

In `@scripts/sw-pipeline-test.sh`:
- Around line 139-140: The mock CLI parser currently treats --output-format as a
valueless flag (in the case branch matching
"--print|--output-format|--dangerously-skip-permissions") so the following
"json" is left as the prompt; remove --output-format from that valueless group
and add it to the value-taking group (the branch handling
"--model|--max-turns|--effort|--fallback-model|-p") so that --output-format
causes a shift 2 like other flags that accept an argument, ensuring
"--output-format json" is consumed together.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ca2368fe-36f4-423e-947a-9761650eb3b0

📥 Commits

Reviewing files that changed from the base of the PR and between efe8e1d and 4a3594e.

⛔ Files ignored due to path filters (4)
  • .claude/loop-logs/iteration-1.log is excluded by !**/*.log
  • .claude/loop-logs/iteration-2.log is excluded by !**/*.log
  • .claude/loop-logs/tests-iter-1.log is excluded by !**/*.log
  • .claude/loop-logs/tests-iter-2.log is excluded by !**/*.log
📒 Files selected for processing (12)
  • .claude/CLAUDE.md
  • .claude/daemon-config.json
  • .claude/intelligence-cache.json
  • .claude/loop-state.md
  • .claude/platform-hygiene.json
  • scripts/lib/daemon-triage.sh
  • scripts/lib/project-detect.sh
  • scripts/sw-lib-daemon-triage-test.sh
  • scripts/sw-pipeline-test.sh
  • scripts/sw-project-detect-test.sh
  • scripts/sw-upgrade.sh
  • templates/pipelines/minimal.json

# stderr: (empty)
# exit: 0
[... full design in .claude/pipeline-artifacts/design.md]
goal: "Add "minimal" pipeline template for trivial single-file fixes
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Quote the goal value correctly.

The embedded " around minimal terminates the field early, so any parser reading goal: will only recover Add instead of the full objective.

Suggested fix
-goal: "Add "minimal" pipeline template for trivial single-file fixes
+goal: 'Add "minimal" pipeline template for trivial single-file fixes'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
goal: "Add "minimal" pipeline template for trivial single-file fixes
goal: 'Add "minimal" pipeline template for trivial single-file fixes'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/loop-state.md at line 2, The YAML-like `goal` value is broken by
unescaped double quotes around minimal, causing the field to end early; update
the `goal` entry in .claude/loop-state.md so the embedded quotes are either
escaped or the whole value is wrapped in single quotes (e.g., goal: 'Add
"minimal" pipeline template for trivial single-file fixes') to preserve the full
string.

Comment on lines +81 to +82
### Iteration 1 (2026-03-09T11:11:31Z)
{"type":"result","subtype":"success","is_error":false,"duration_ms":529352,"duration_api_ms":415316,"num_turns":65,"resu
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove or regenerate the truncated JSON log entry.

This record stops at resu, so it is no longer valid JSON. Anything consuming structured iteration results from loop-state.md will fail or silently ignore the success event.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/loop-state.md around lines 81 - 82, The JSON result under "Iteration
1 (2026-03-09T11:11:31Z)" is truncated (it ends at "resu") and breaks structured
parsing; open .claude/loop-state.md, locate the Iteration 1 block header and the
following JSON blob, then either remove that incomplete JSON entry or replace it
with a fully-formed JSON result (regenerate the complete iteration object so it
matches other iterations' structure), ensuring the entry no longer ends with the
partial token "resu" and that the JSON is valid.

Comment on lines +139 to +140
--print|--output-format|--dangerously-skip-permissions) shift ;;
--model|--max-turns|--effort|--fallback-model|-p) shift 2 ;;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect Claude CLI call sites and confirm whether --output-format is followed by a value.
rg -n -C3 --type=sh --pcre2 'claude\b|--output-format\b|-p\b|--model\b|--max-turns\b|--effort\b|--fallback-model\b' scripts .claude

Repository: sethdford/shipwright

Length of output: 50377


🏁 Script executed:

# Search specifically for claude command invocations with --output-format context
rg -n -B2 -A2 '(claude\s+.*--output-format|--output-format\s+)' scripts/*.sh | head -100

Repository: sethdford/shipwright

Length of output: 2110


🏁 Script executed:

# Look at the actual sw-pipeline.sh file to see how claude is invoked
fd -name 'sw-pipeline.sh' -type f | head -5 | xargs wc -l

Repository: sethdford/shipwright

Length of output: 313


🏁 Script executed:

# Examine the create_mock_claude function and actual invocations
rg -n -A20 'create_mock_claude' scripts/sw-pipeline-test.sh | head -80

Repository: sethdford/shipwright

Length of output: 1747


🏁 Script executed:

# Search for how --output-format is actually passed with values
rg -n '(--output-format\s+json|--output-format\s+\$)' scripts/ lib/

Repository: sethdford/shipwright

Length of output: 851


🏁 Script executed:

# Look at build_claude_flags to understand actual invocation pattern
rg -n -A10 'build_claude_flags' scripts/ lib/ | head -60

Repository: sethdford/shipwright

Length of output: 3591


🏁 Script executed:

# Confirm by examining lines around sw-loop.sh:1878 for exact invocation
sed -n '1870,1890p' scripts/sw-loop.sh

Repository: sethdford/shipwright

Length of output: 927


🏁 Script executed:

# Verify the exact invocation of claude in the real pipeline
rg -n 'claude.*-p.*PROMPT' scripts/ --type=sh | head -20

Repository: sethdford/shipwright

Length of output: 162


🏁 Script executed:

# Look at the actual argument expansion in create_mock_claude again more carefully
sed -n '132,150p' scripts/sw-pipeline-test.sh

Repository: sethdford/shipwright

Length of output: 623


🏁 Script executed:

# Check if there are other test mocks that might show the issue
rg -n -B5 -A10 'shift 2' scripts/sw-pipeline-test.sh

Repository: sethdford/shipwright

Length of output: 591


Move --output-format from valueless flags to value-taking flags in the mock CLI parser.

The real Claude CLI passes --output-format json as two arguments. The mock currently consumes only the flag with shift, leaving json to be parsed as the prompt in the next iteration. This corrupts prompt detection and invalidates E2E test outcomes.

Fix
-        --print|--output-format|--dangerously-skip-permissions) shift ;;
-        --model|--max-turns|--effort|--fallback-model|-p) shift 2 ;;
+        --print|--dangerously-skip-permissions) shift ;;
+        --output-format|--model|--max-turns|--effort|--fallback-model|-p) shift 2 ;;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
--print|--output-format|--dangerously-skip-permissions) shift ;;
--model|--max-turns|--effort|--fallback-model|-p) shift 2 ;;
--print|--dangerously-skip-permissions) shift ;;
--output-format|--model|--max-turns|--effort|--fallback-model|-p) shift 2 ;;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/sw-pipeline-test.sh` around lines 139 - 140, The mock CLI parser
currently treats --output-format as a valueless flag (in the case branch
matching "--print|--output-format|--dangerously-skip-permissions") so the
following "json" is left as the prompt; remove --output-format from that
valueless group and add it to the value-taking group (the branch handling
"--model|--max-turns|--effort|--fallback-model|-p") so that --output-format
causes a shift 2 like other flags that accept an argument, ensuring
"--output-format json" is consumed together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-patrol Created by autonomous patrol agents ready-to-build Issue is ready for autonomous pipeline processing strategic Created by strategic intelligence agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "minimal" pipeline template for trivial single-file fixes

1 participant