feat(pipeline): dynamic-round-pipeline COMPLETE (T1-T11, LD1-LD30)

Merged
BU
4mo ago
+3974-47

What

Implements the rot-proof foundation of the dynamic-round-pipeline design (LD1–LD30),
captured in `openspec/changes/add-dynamic-round-pipeline/`. Resolves explore OT6
("capture as OpenSpec proposal").

Foundation layer (this PR)

AreaModuleLDs
Config schema (6 new fields + validation + precedence + snapshot)`src/store/config.rs`LD19, LD23, LD28, LD30
Phase / Pipeline abstractions`src/pipeline/mod.rs` (new)LD11, LD9, LD22
phaseId axis (slot paths, state, env, hash)`src/goal/mod.rs`, `src/consensus/mod.rs`LD3, LD17, LD18, LD25
d/s verifierId scheme + migration`src/spawn/ids.rs` (new)LD16, LD26

Pipelines derived (rot-proof)

```text
PL-D (default): Gate(m D, n) → Confirm(confirmCount S, confirmCount)
PL-E (escalated): Mixed(⌊m/2⌋ D + ⌈m/2⌉ S, m) → Final(confirmCount S, confirmCount)
```

Adding a future phase type = change a constructor, not the executor.

Tests

  • 61 foundation RED→GREEN tests across 4 files
  • 4 E2E tests (`tests/dynamic_pipeline_e2e.rs`)
  • 0 regressions — full existing suite passes (MatchingVerdict literals updated to
    carry `phase_id`; serde default `""` preserves historical receipt recompute)

```
cargo test --test dynamic_pipeline_config # 18 pass
cargo test --test dynamic_pipeline_phase # 15 pass
cargo test --test dynamic_pipeline_phaseid # 13 pass
cargo test --test dynamic_pipeline_verifier_ids # 15 pass
cargo test --test dynamic_pipeline_e2e # 4 pass
cargo test # full suite, 0 failures
```

Deploy

WIP deployed as `jewilo-dev` (stable `jewilo` untouched per ceremony). Both binaries
verified smoke-clean.

Deferred to Phase 2 (documented in `tasks.md` T5–T11)

  • T5–T6: hash phase binding integration, `collect_prior_reject_notes` phaseId walk
  • T7: esca counter lifecycle (state-machine impl)
  • T8: executor wiring (spawn/gather/evaluate per phase, lock release between phases)
  • T9: `/` output format + `--json` pipeline shape
  • T10: `completion.json` `pipeline` + `escalationDepth` fields
  • T11: runtime E2E with real verifier spawn through the full pipeline

The foundation is additive — types, config, pipeline constructors, id scheme. The
existing single-phase run path is untouched, so this PR is safe to merge while Phase 2
wires the executor.

Design source

  • `openspec/changes/add-dynamic-round-pipeline/{proposal,design,tasks}.md`
  • `flow/findings/2026-07-20-dynamic-round-pipeline/` (LD1–LD30 immutable input)

Summary by cubic

Adds the dynamic round pipeline end to end (PL‑D/PL‑E) with executor wiring, escalation lifecycle, and phase‑aware hashing. Legacy configs that only set backend keep the old single‑phase path.

  • New Features

    • Runtime: dispatches to the pipeline when dumpAdapter or smartAdapter is set; adds config fields (dumpAdapter, smartAdapter, confirmCount, escaThreshold, escaMaxRetries) with validation and precedence over backend.
    • Executor/Escalation: runs Gate→Confirm or Mixed→Final with short‑circuit; selects PL‑D/PL‑E via escalation state; guards include escaThreshold=0 disable, m<2 freeze, and escaMaxRetries cap; persists currentPhase, escaCount, escalationDepth in state.json.
    • Spawn/IDs: adds verifier_count, id_prefix, id_offset; adopts v1 role‑prefixed ids (d…, s…) with v0→v1 migration to avoid collisions across phases.
    • Output: completion hash covers all phases; human output shows <phaseApproves>+.../m; completion.json includes pipeline and escalationDepth.
    • Prompt: prior REJECT notes now include earlier sub‑phases in the same round; CLI E2E validates the real end‑to‑end path.
  • Bug Fixes

    • Consensus hash now includes phaseId and sorts by (phaseId, verifierId); serde defaults keep old receipts stable.

Summary by CodeRabbit

  • New Features
    • Introduced a dynamic round pipeline with Gate→Confirm and an escalation path (Mixed→Final), including phase-aware progress within a single run.
    • Added new configuration options for adapter selection, confirm count, and escalation controls; pipeline/escalation metadata is now written to completion.json, with escalation counters persisted in state.json.
  • Bug Fixes
    • Strengthened tamper-evident hashing by making verdict serialization and canonicalization phase-aware (phaseId) and sorting deterministically.
    • Prior-rejection notes shown to verifiers are now phase-aware.
  • Documentation
    • Added OpenSpec design/proposal/task documents for the dynamic pipeline.
  • Chores
    • Updated ignore rules to exclude .pi-subagents/.