Implement WP-0015-T01/T04/T06: Phase provenance schema + ledger UI

Schema: phase.milestone_release gains required repo_hub/repo_hub_uri/
repo_id/repo_name; phase gains optional base_phase_id. Backfilled the
golden phase-001 fixture (placeholder values, it's synthetic) and the
three real pilot-candidate manifests with actual Forgejo repo ids
confirmed live (net-kingdom=67, vergabe-teilnahme=62,
info-tech-canon=47, all coulomb/*).

Discovered along the way: the schema change alone would have broken
the existing Control Plane registration form, since nothing collected
the four new fields. Fixed inline rather than leaving it broken
between tasks -- this also completes T04's ledger UI change (drop the
hand-typed ledger input, auto-compute /phases/{id}/ledger, add a
drill-down reference link on phase_detail.html) since both changes
touch the same form/route.

Full suite: 94 passing offline (was 84), 158 passing with Docker
(was 146).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-08-03 20:43:30 +02:00
parent 11800c7da1
commit 2a176d9961
13 changed files with 204 additions and 20 deletions

View file

@ -23,7 +23,7 @@ what to build, rather than re-deriving field shapes or rationale here.
```task
id: TREV-WP-0015-T01
status: todo
status: done
priority: high
state_hub_task_id: "cdca0ef5-a332-40e2-b165-10ffa238f413"
```
@ -39,6 +39,31 @@ the four new required fields is rejected; one with `base_phase_id`
absent validates (first Phase); one with it present and correctly
patterned validates (successive Phase).
**Result:** Schema updated exactly as specified; `validation.py` needed
no changes (`pattern`/`format`/`minimum` already sufficient). Added six
tests to `tests/test_manifest_validation.py` covering all four new
required fields and both `base_phase_id` states plus a malformed one.
Updating `examples/phase-001/manifest.json` (the fixture 13 other test
files depend on) turned out to be necessary just to keep the offline
suite green, not optional — done inline with placeholder-but-plausible
values (`repo_hub: "example-hub"`, synthetic id/name), since it's a
fictional fixture, not a real repo.
**Discovered scope gap, fixed inline rather than left broken**: the
addendum's task breakdown didn't call out that the Control Plane's
existing Phase registration form (`phase_new.html`,
`control_plane_app.py`) would stop working the moment this schema
change landed, since nothing collected the four new required fields.
Fixed as part of this task rather than leaving registration broken
between tasks — this also completes T04's registration-form half (drop
`ledger` input, auto-compute it) and adds the `base_phase_id` field,
since all three changes touch the same form/route. `phase_detail.html`'s
ledger-reference drill-down (T04's other half) is done too. Full suite:
94 passing offline (up from 84 — six new schema tests, three new
provenance-backfill tests, two new Control Plane form tests), 158
passing with Docker (up from 146).
```task
id: TREV-WP-0015-T02
status: todo
@ -77,7 +102,7 @@ wherever a policy id or extension id already appears in
```task
id: TREV-WP-0015-T04
status: todo
status: done
priority: medium
state_hub_task_id: "af660317-e732-4ad7-bd4a-86ada8602ec7"
```
@ -90,6 +115,15 @@ link/disclosure to `phase_detail.html` showing the raw reference plus a
live-data link when it resolves to this same instance. The existing
Ledger entries table is untouched.
**Result:** Done as part of T01's fix (same form/route touched by both
tasks — see T01's Result). `control_plane_app.py`'s registration route
sets `phase["ledger"] = f"/phases/{phase_id}/ledger"` before validation;
`phase_new.html` no longer has a `ledger` input at all.
`phase_detail.html` gained a `<details>` disclosure showing the raw
reference plus a live-JSON link when it resolves to this instance
(`manifest.phase.ledger.startswith('/phases/')`). Regression test:
`test_phase_new_form_has_no_ledger_input`.
```task
id: TREV-WP-0015-T05
status: todo
@ -109,7 +143,7 @@ action or a plain `UPDATE`, and document whichever is chosen.
```task
id: TREV-WP-0015-T06
status: todo
status: done
priority: medium
state_hub_task_id: "719aa6db-93d8-4eaa-ac1b-e7ee4c00bd89"
```
@ -123,6 +157,15 @@ confirmed working for `target-revenue` itself during WP-0012-T02), no
`base_phase_id` (all three are first Phases), and `ledger` set to match
what the Control Plane would now auto-compute.
**Result:** Confirmed live against `forgejo.coulomb.social` (all three
repos are `coulomb/*`, same org as `target-revenue`): `net-kingdom` id
`67`, `vergabe-teilnahme` id `62` (the actual application repo per
`history/260730-EffortCalculator-CandidateApplication.md` §3, not the
`railiance-apps` deployment repo), `info-tech-canon` id `47`. All three
manifests backfilled with real, not placeholder, ids; `ledger` set to
`/phases/{phase_id}/ledger` matching §3's auto-compute convention. New
regression test: `test_pilot_candidate_manifest_carries_real_repo_provenance`.
```task
id: TREV-WP-0015-T07
status: todo