Skip to content

Rebuild the build pipeline around deterministic checks and repair - #23

Merged
adityaramkumar merged 1 commit into
mainfrom
claude/pipeline-rebuild
Oct 22, 2026
Merged

adityaramkumar merged 1 commit into
mainfrom
claude/pipeline-rebuild

Conversation

@adityaramkumar

Copy link
Copy Markdown
Owner

Why

I installed and ran the four example projects in examples/, all recorded as successful builds. Their own generated tests largely fail:

Example Generated tests passing Other problems
rest-api 69 / 92 48 tsc errors, 32 files no spec owns
fullstack-todo 53 / 87
cli-tool 54 / 81 one test file has a syntax error; the test_command found no tests
data-pipeline 34 / 65 9 files fail to import; schemas.py and schemas/ collide

docs/example-audit.md traces each failure to a root cause:

  • code corrupted by JSON escaping
  • nodes overwriting and duplicating each other's files
  • agents guessing at the import and test layout
  • no check except an LLM review, which passed all of it

What changed

Per node: plan → (implement ‖ test) → checks → [repair → checks]* → review

  • No code through JSON. Stages return <file path="…"> blocks with verbatim contents. Repair can also <delete/> a file, and any stage can mark a file <unchanged/>.
  • Agents know the project. Every prompt includes:
    • the language, the output directory as the import root, and the exact test and check commands
    • parent and dependency specs, plus the dependencies' code
    • the files other specs own
    • the node's own previous files, with traceability headers stripped
  • Deterministic checks first. In order: path escape; ownership (another spec's files, and any existing file specdiff didn't generate, are off limits); Python syntax; check_command (new, e.g. npx tsc --noEmit); test_command. The real output goes to a repair stage, up to max_retries. LLM review runs only after the checks pass.
  • Shared contract. The plan pins exact names, signatures and error messages. Code and tests are then written in parallel, so tests check the spec rather than echo the implementation.
  • Isolated failures. Each node commits as soon as it passes. A failing node rolls back on its own and only its dependents are skipped. Before, one failure discarded the whole build.
  • One provider layer. providers/ has gemini, claude, and openai_compat (OpenAI and xAI), replacing the ADK-plus-custom dual pipeline; google-adk is dropped. Unknown model prefixes are now an error instead of silently going to Gemini. The Claude provider streams with a 64K output cap and enables server-side refusal fallback on models that support it.
  • Token usage is reported per node and per build.
  • Built-in skills. Stage prompts ship in default_skills/ and can be overridden per project. specdiff skill NAME prints the effective version. init now writes a config with a working test_command instead of six prompt files.
  • Legacy compatibility. Old skill files (architect, interface, implementation, testing) are ignored with a notice. A legacy review.skill.md that asks for JSON still parses. Headers written by older versions are stripped correctly.
  • Bug found by the new tests. During a repair round, sync backed up the node's own earlier output, so rollback "restored" generated files instead of deleting them. Fixed: a path is backed up only on its first touch.
  • .gitignore's build/ and dist/ rules are anchored to the repo root. They were silently ignoring the new src/specdiff/build/ package.
  • examples/shared-skills and the per-example skill copies are removed (built-ins replace them). The example code snapshots are kept as a record.

Testing

  • pytest tests/: 197 passed. The new tests/fake_llm.py replies per (spec, stage) at the provider boundary, so the real parsing, checks, file writes and repair loop run. tests/test_runner.py runs a real pytest subprocess against the generated files, covering repair from test output, syntax and ownership failures, failure isolation, incremental <unchanged/>, preflight refusals, and interrupts.
  • ruff check / ruff format --check: clean
  • End to end: specdiff init → build (scripted model, real pytest with init's test_command) → status shows current.
  • Not yet tested against a live model. No API key is available in this environment, so prompt quality with a real model is still unverified.

Generated by Claude Code

An audit of the four example projects (docs/example-audit.md) found that
every "successful" build produced code whose own tests largely fail:
code corrupted by JSON escaping, nodes overwriting and duplicating each
other's files, agents guessing at import and test layout, and no check
besides an LLM review that passed all of it.

The pipeline is now, per node:
  plan -> (implement || test) -> checks -> [repair -> checks]* -> review

- Files are returned as <file path="..."> blocks; no code goes through
  JSON. Repair can also <delete/> files and keep them <unchanged/>.
- Every prompt carries project facts (output dir as import root, test
  and check commands), parent/dependency specs and code, the files other
  specs own, and the node's previous files with headers stripped.
- Deterministic checks run first: path escape, ownership (other specs'
  files and untracked existing files are off limits), Python syntax,
  check_command, test_command. Their real output drives repair, up to
  max_retries. Review runs only after they pass.
- Each node commits as soon as it passes; a failing node rolls back on
  its own and only its dependents are skipped.
- One provider layer (gemini, claude, openai, xai) replaces the ADK and
  custom dual pipelines; unknown model prefixes are an error instead of
  silently going to Gemini. Token usage is reported per node and build.
- Stage prompts ship as built-in skills, overridable per project;
  `specdiff skill NAME` prints one. init writes a config with a working
  test command instead of six prompt files.
- Fixes a rollback bug the new tests caught: a repair round backed up
  the node's own earlier output, so rollback restored it.
- .gitignore's build/ and dist/ are anchored to the repo root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FAykpfqqWA2GFjcC1p6FRy
@adityaramkumar
adityaramkumar merged commit d190a3e into main Oct 22, 2026
2 checks passed
@adityaramkumar
adityaramkumar deleted the claude/pipeline-rebuild branch October 22, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants