Complete WP-0015: forgejo_hubs migration + closeout (T05/T07)
migrations/0007_forgejo_hubs.sql: table forgejo_hubs, auto-populated via a BEFORE INSERT trigger on phase_manifests that reads repo_hub/ repo_hub_uri straight out of the manifest JSONB (no top-level columns needed). ON CONFLICT DO NOTHING -- a hub already seen is left alone; correcting a URI is a SECURITY DEFINER governance action (correct_forgejo_hub_uri), not a plain UPDATE, matching every other governance-action pattern in this project. Thin Python wrappers added to registry.py. tests/test_forgejo_hubs.py (6 Docker-gated tests) and tests/test_reference_docs.py (13 tests, no Docker needed -- smoke-tests every real specs/policies/specs/profiles/ file, not just the two exercised incidentally by T03's Control Plane tests). All seven WP-0015 tasks done; workplan marked finished. Final suite: 94 passing offline, 183 passing under the service extras venv. No stray Docker containers left running. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
eaea89e125
commit
de308f8947
6 changed files with 419 additions and 5 deletions
|
|
@ -4,7 +4,7 @@ type: workplan
|
|||
title: "Implement Phase provenance, spec-file, and ledger UI changes"
|
||||
domain: infotech
|
||||
repo: target-revenue
|
||||
status: active
|
||||
status: finished
|
||||
owner: claude
|
||||
topic_slug: infotech
|
||||
created: "2026-08-03"
|
||||
|
|
@ -173,7 +173,7 @@ reference plus a live-JSON link when it resolves to this instance
|
|||
|
||||
```task
|
||||
id: TREV-WP-0015-T05
|
||||
status: todo
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "816f1ac2-da40-4550-8d6c-64a1a335a660"
|
||||
```
|
||||
|
|
@ -188,6 +188,31 @@ implementation (not a T02-style human gate, per the addendum) whether
|
|||
correcting a hub's URI after the fact is a `SECURITY DEFINER` governance
|
||||
action or a plain `UPDATE`, and document whichever is chosen.
|
||||
|
||||
**Result:** `migrations/0007_forgejo_hubs.sql` — the `BEFORE INSERT`
|
||||
trigger on `phase_manifests` reads `repo_hub`/`repo_hub_uri` straight out
|
||||
of the manifest JSONB (`NEW.manifest #>> '{phase,milestone_release,
|
||||
repo_hub}'`) rather than needing those as top-level table columns, since
|
||||
`phase_manifests` stores the whole manifest as one `jsonb` blob.
|
||||
`ON CONFLICT (hub_slug) DO NOTHING` — a hub already seen is left alone by
|
||||
the trigger; only a second registration under the same slug with a
|
||||
different URI would otherwise silently overwrite it, which is exactly
|
||||
the failure mode this table exists to prevent.
|
||||
|
||||
**Decided: `SECURITY DEFINER` governance action**, not a plain `UPDATE`
|
||||
— `correct_forgejo_hub_uri(hub_slug, new_uri)`, matching
|
||||
`set_extension_status()`/`revoke_credential()`. `trf_app` has no UPDATE
|
||||
grant on `forgejo_hubs` at all. Thin Python wrappers added to
|
||||
`registry.py`: `get_forgejo_hub()`, `correct_forgejo_hub_uri()` (raises
|
||||
`RegistrationError` for an unknown slug, via `psycopg.errors.
|
||||
RaiseException`).
|
||||
|
||||
New `tests/test_forgejo_hubs.py`, 6 Docker-gated tests: auto-creation on
|
||||
first registration, unknown-hub lookup, second-registration-same-hub
|
||||
does *not* overwrite, explicit correction does, correction of an unknown
|
||||
hub is rejected, and DB-level UPDATE rejection for the application role.
|
||||
Full suite: 94 passing offline (unchanged), 170 passing with Docker (up
|
||||
from 164).
|
||||
|
||||
```task
|
||||
id: TREV-WP-0015-T06
|
||||
status: done
|
||||
|
|
@ -215,7 +240,7 @@ regression test: `test_pilot_candidate_manifest_carries_real_repo_provenance`.
|
|||
|
||||
```task
|
||||
id: TREV-WP-0015-T07
|
||||
status: todo
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "39b34438-a1b1-49da-a88a-f3bec926aa89"
|
||||
```
|
||||
|
|
@ -228,3 +253,18 @@ without error. Update `README.md`'s WP-0015 row and this workplan's
|
|||
Result sections; run the full offline + Docker-gated suite; fence-count
|
||||
check before committing any workplan edit, per this project's standing
|
||||
practice.
|
||||
|
||||
**Result:** New `tests/test_reference_docs.py` — 13 tests, no Docker
|
||||
required (only needs the `service` extras venv for `markdown`/`PyYAML`),
|
||||
covering every real policy/profile file on disk, not just the two
|
||||
exercised incidentally by T03's Control Plane tests. Skips cleanly under
|
||||
plain `python3` (offline suite) when those extras aren't installed,
|
||||
matching this project's existing `pytest.importorskip` convention.
|
||||
|
||||
All seven WP-0015 tasks are now done. Final suite counts: **94 passing
|
||||
offline** (up from 84 at the start of this workplan — T01's schema tests
|
||||
and T06's backfill-regression test, unchanged since; nothing in T02–T07
|
||||
touches an offline-only code path), **183 passing under `.venv` with the
|
||||
`service` extras** (the Docker-gated total moved from 146 → 170 across
|
||||
T01–T05, plus 13 more non-Docker service-extras tests from this task). No
|
||||
stray Docker containers left running.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue