fix: bound repository collection identity projection

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a06ed7-828d-7ca0-a8d4-0c3e5a0c4102
This commit is contained in:
tegwick 2026-09-05 02:03:52 +02:00
parent 4cef58cd98
commit 3578dc2f32
10 changed files with 3331 additions and 9 deletions

View file

@ -8,7 +8,7 @@ status: blocked
owner: codex
topic_slug: infotech
created: "2026-08-09"
updated: "2026-08-31"
updated: "2026-09-05"
parent_project: prj-state-hub-retirement
parent_workplan: SHR-WP-0001
related:
@ -529,6 +529,13 @@ the two workstream mutations have 14/30 and 15/30 quiet days. A future review
must recapture central-primary evidence and apply the existing volume ladder;
calendar passage alone is not retirement evidence.
**Repository review 2026-09-05.** Reviewed the four existing daily captures
`docs/evidence/legacy-meter-weekly-review-20260901.json` through
`legacy-meter-weekly-review-20260904.json`: each reports 6 retired interfaces,
9 legacy interfaces, and zero retirement candidates. These captures corroborate
the existing hold; no additional retirement is justified. T04/T05/T06 remain
`wait` with their existing owner and quiet-window dependencies.
## Stabilization window and archive prep
```task

View file

@ -0,0 +1,91 @@
---
id: STATE-WP-0087
type: workplan
title: "Bound the repository collection projection"
domain: infotech
repo: state-hub
status: finished
owner: codex
topic_slug: infotech
created: "2026-09-04"
updated: "2026-09-05"
origin: "intake:01a06e0c-3feb-7920-a6f2-961b03dc170d"
origin_ref: STATE-WP-0081
quality_dor: DoR-Ok
quality_dor_at: "2026-09-04"
quality_dor_by: codex
quality_dor_note: >-
The live 131-repository collection exceeds 15 seconds and the implementation
reveals per-repository identity queries. Scope, owner, dependency-free patch,
and query-bound regression signal are explicit.
quality_dod: DoD-Ok
quality_dod_at: "2026-09-05"
quality_dod_by: codex
quality_dod_note: >-
Bulk identity projection and domain-loading bounds are covered by 102 passing
repository/router regressions. Production-shaped PostgreSQL timing and SQL
counts are recorded in docs/evidence/repository-collection-projection-20260905.md.
reviewed_at: "2026-09-05"
reviewed_against_commit: "4cef58c"
---
# Bound the repository collection projection
## Goal
Make `GET /repos/` complete with a database-query count that does not grow with
the number of repositories, while preserving its existing list response and
alias metadata. This promotes residual intake
`01a06e0c-3feb-7920-a6f2-961b03dc170d` from `STATE-WP-0081`.
Scope includes the repository collection query, identity/alias projection, and
focused regression tests. Pagination and changes to the public response shape
are out of scope because removing the N+1 projection makes the existing fleet
read bounded without a collection-contract migration. Dependencies: none.
## Bulk-project repository identities
```task
id: STATE-WP-0087-T01
status: done
priority: high
quality_dor: DoR-Ok
quality_dor_at: "2026-09-04"
quality_dor_by: codex
```
Load canonical and alias slug records once for the collection, construct the
existing identity response from that bulk result, and suppress unrelated eager
relationships. Preserve compatibility for repositories created before the slug
registry backfill. Done when focused API tests prove alias fidelity and a
constant repository-slug query count, and the full repository router suite is
green.
## Acceptance
- [x] Collection identity projection does not issue queries per repository.
- [x] Canonical, alias, and pre-backfill compatibility responses are preserved.
- [x] Focused and repository router tests pass.
- [x] Live or production-shaped timing evidence is recorded.
## Completion — 2026-09-05
Reviewed and completed the pending collection patch. The collection performs one
repository/domain SELECT and one registry SELECT; a domain filter adds one
scalar domain-ID SELECT. Suppressing eager domain relationships also prevents
unrelated topics, goals, repositories, and rename history from being loaded.
The response shape, aliases, pre-backfill behavior, conflict responses, and
classification filters are preserved.
Validation: `uv run pytest -q tests/test_repository_collection_projection.py
tests/test_routers_core.py tests/test_repository_alias_routing.py
tests/test_repository_rename_api.py tests/test_repository_rename_persistence.py
tests/test_sbom_nexus_compat.py` — **102 passed in 129.14s**. `git diff --check`
also passed. Production-shaped timing evidence:
`docs/evidence/repository-collection-projection-20260905.md` (4, 131, and 501
repositories; constant two/three SELECTs without/with a domain filter).
No implementation residuals. This closes the scope promoted from intake
`01a06e0c-3feb-7920-a6f2-961b03dc170d`. Deployment is outside this source-change
workplan; the timing evidence uses the local test database, not the running
central service. The separate retirement and HA workplans retain their gates.