Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a06ed7-828d-7ca0-a8d4-0c3e5a0c4102
91 lines
3.7 KiB
Markdown
91 lines
3.7 KiB
Markdown
---
|
|
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.
|