feat: add the Deliverable dependency graph and Ledger
Increment 3 of .scratch/solution-architect-agent/spec.md, test-first. - app/execution/deliverables.py: four Phases, nine Deliverables and their Dependencies declared once, plus per-kind contracts (required headings, attachments) checked by check_submission. - app/execution/ledger.py: pure Ledger enforcing both acceptance thresholds, Phase Approvals (including pre-approved mode and change requests), Revision cascade with withdrawn Approvals, the revision cap with escalation and user override, attempt numbers that reject stale submissions, an ordered event log, and dict round-tripping. - 37 new tests; full suite 102 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -530,3 +530,42 @@ Slowest tests: eval benchmark 7.3 s, then 3–4.5 s each for the orchestrator, e
|
||||
|
||||
**Still to check**
|
||||
- The default model ids (`gemini/gemini-2.5-pro`, `gemini/gemini-2.5-flash`) come from the spec and haven't been checked against models currently available. Confirm them in increment 5, when LiteLLM is wired.
|
||||
|
||||
### 2026-09-15 · Increment 3: Deliverables and Ledger
|
||||
|
||||
**Done (test-first)**
|
||||
- `app/execution/deliverables.py`: `PhaseId`, `PHASE_ORDER`, `DeliverableKind`, `DeliverableSpec`, `DEPENDENCY_GRAPH` (the table above), `deliverables_in`, and `check_submission(kind, content, attachments) -> missing`.
|
||||
- `app/execution/ledger.py`: a pure `Ledger`.
|
||||
- Queries: `ready_work`, `phases_ready_for_approval`, `dependencies_met`, `can_finish`.
|
||||
- Work: `start`, `submit`, `release`.
|
||||
- Approvals: `request_approval`, `approve`, `request_changes`.
|
||||
- Revisions: `reopen`.
|
||||
- Persistence: `to_dict` / `from_dict`.
|
||||
- Tests:
|
||||
- `tests/execution/test_deliverables.py`: 12 tests.
|
||||
- `tests/execution/test_ledger.py`: 25 tests.
|
||||
- Full suite: **102 passed**. `ruff` and `mypy` are clean.
|
||||
- **Checking the tests bite.** I broke each of these in the code on purpose, and in each case at least one test failed:
|
||||
- cross-Phase dependencies accepting *submitted*
|
||||
- no cascade on reopen
|
||||
- the revision cap off by one
|
||||
- pre-approved mode not granting approval
|
||||
|
||||
A fifth mutation, `release` not bumping the attempt, survived. It showed the extra increments were dead code, so I removed them. Attempts now change only in `start`, and a test covers a late submission from a superseded attempt.
|
||||
|
||||
**Added to or tightened from the spec text**
|
||||
- **Attempts.** `start` returns an attempt number per Deliverable, and `submit`/`release` must present the current one. This protects against late results from Specialists running in parallel after their work was released or reset by a Revision. The spec had no such token.
|
||||
- **More event types.** Beyond the spec's list: `started`, `released`, `reset` (a dependent that went back to pending) and `approval_withdrawn`.
|
||||
- **Return values.** `reopen` returns `ReopenResult(reset, withdrawn_approvals, escalation)`. `reset` lists only Deliverables whose status actually changed. Invalid requests raise `LedgerRefusal` and change nothing, and at the cap `reopen` records `escalated` and changes nothing. `override_cap=True` covers the user deciding to revise past the cap.
|
||||
- **Changes on approval.** `request_changes(phase, feedback)` returns the Phase to `open` and records the feedback, but doesn't reopen Deliverables itself. The Orchestrator reopens the specific ones with `reopen`.
|
||||
- **Dependent feedback.** A dependent that is reset gets a feedback note (`Dependency X was revised: <reason>`), so its next Specialist run knows why.
|
||||
- **Single source for progress.** The Ledger owns each Deliverable's status, attempts, revisions and feedback. The Execution state (increment 4) holds only content and attachments, not the `feedback[]`/`revisions` fields the spec's state sketch showed.
|
||||
- **Contracts,** matched against headings after stripping numbering, case and trailing punctuation, by exact match or a space-separated suffix. That way "4.1. Google Cloud products and features mapping" satisfies "Products and features mapping", but "Non-functional requirements" doesn't satisfy "Functional requirements".
|
||||
- `requirements`: functional and non-functional requirements, current state, dependencies.
|
||||
- `product_selection`: products and features mapping.
|
||||
- `design_recommendations`: the 6 pillar headings.
|
||||
- `deployment_guidance`: prerequisites and step-by-step instructions, plus attachments `terraform/main.tf` and `terraform/variables.tf`.
|
||||
- `validation_results`: deployment dry-run, architecture and policy analysis.
|
||||
- `solution_guide`: the template's 8 top-level sections.
|
||||
- `architecture_diagram`: attachment `architecture.mmd`.
|
||||
- `technical_decomposition` and `architecture_description`: non-empty content only.
|
||||
|
||||
Reference in New Issue
Block a user