state-hub/workplans/STATE-WP-0087-bounded-repository-collection-projection.md
tegwick 3578dc2f32 fix: bound repository collection identity projection
Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a06ed7-828d-7ca0-a8d4-0c3e5a0c4102
2026-09-05 02:03:52 +02:00

3.7 KiB

id type title domain repo status owner topic_slug created updated origin origin_ref quality_dor quality_dor_at quality_dor_by quality_dor_note quality_dod quality_dod_at quality_dod_by quality_dod_note reviewed_at reviewed_against_commit
STATE-WP-0087 workplan Bound the repository collection projection infotech state-hub finished codex infotech 2026-09-04 2026-09-05 intake:01a06e0c-3feb-7920-a6f2-961b03dc170d STATE-WP-0081 DoR-Ok 2026-09-04 codex 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. DoD-Ok 2026-09-05 codex 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. 2026-09-05 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

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

  • Collection identity projection does not issue queries per repository.
  • Canonical, alias, and pre-backfill compatibility responses are preserved.
  • Focused and repository router tests pass.
  • 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.py102 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.