catalogue: T5 — the catalogue read: one GET, both tiers, running-where, request states #1123

Closed
opened 2026-09-01 20:49:50 +00:00 by ben · 3 comments
Owner

Parent

Spec #1116 (catalogue two tiers; DDR 0220 / ADR 0219). Feature #1073. Slice catalogue-read-route in docs/slices/catalogue.yaml.

What to build

One catalogue read on the control API beside the P4 family: both tiers with categories and display facts, per-service running-where composed from fleet state ("running on karaka · second copy on tōtara", or the plain not-running reason), request states from the ledger, and the community's suggestions list. This is the ONE read every dashboard surface renders from (slice-map ruling: the S2 picker joins it by slug — the assessment route is untouched).

Acceptance criteria

  • The response carries every installable service with category/description/glyph/logo-ref, and every candidate distinctly typed — a consumer cannot confuse the tiers
  • A service running on nodes names them; one not running carries its honest state; composition failure for one service degrades that entry, never the read (bounded fan-out prior art)
  • A requested candidate carries its requested-on date; suggestions list with dates
  • The existing assessment/selection/impact/deploy routes are byte-identical (contract tests re-run green)
  • Unauthenticated and wrong-token callers are refused (controlapi contract-test prior art)

Blocked by

  • #1120 (catalogue-candidate-tier)
  • #1121 (service-request-ledger)
  • #73

Task manifest

task: catalogue-read-route
implements_flow: p4-provisioning
implements_edge: "S2b render source; S2 dress source (join by slug)"
wireframe: docs/ux/wireframes/p4-provisioning/p4-s2b-browse-catalogue.html
seam: controlapi HTTP seam (provision route-test prior art)
depends_on: [catalogue:catalogue-candidate-tier, catalogue:service-request-ledger, provisioning:provision-active-and-partial]
out_of_scope: [send route, UI, arrival stamping]
needs_human_decision: []
## Parent Spec #1116 (catalogue two tiers; DDR 0220 / ADR 0219). Feature #1073. Slice `catalogue-read-route` in docs/slices/catalogue.yaml. ## What to build One catalogue read on the control API beside the P4 family: both tiers with categories and display facts, per-service running-where composed from fleet state ("running on karaka · second copy on tōtara", or the plain not-running reason), request states from the ledger, and the community's suggestions list. This is the ONE read every dashboard surface renders from (slice-map ruling: the S2 picker joins it by slug — the assessment route is untouched). ## Acceptance criteria - [ ] The response carries every installable service with category/description/glyph/logo-ref, and every candidate distinctly typed — a consumer cannot confuse the tiers - [ ] A service running on nodes names them; one not running carries its honest state; composition failure for one service degrades that entry, never the read (bounded fan-out prior art) - [ ] A requested candidate carries its requested-on date; suggestions list with dates - [ ] The existing assessment/selection/impact/deploy routes are byte-identical (contract tests re-run green) - [ ] Unauthenticated and wrong-token callers are refused (controlapi contract-test prior art) ## Blocked by - #1120 (catalogue-candidate-tier) - #1121 (service-request-ledger) - #73 ## Task manifest ```yaml task: catalogue-read-route implements_flow: p4-provisioning implements_edge: "S2b render source; S2 dress source (join by slug)" wireframe: docs/ux/wireframes/p4-provisioning/p4-s2b-browse-catalogue.html seam: controlapi HTTP seam (provision route-test prior art) depends_on: [catalogue:catalogue-candidate-tier, catalogue:service-request-ledger, provisioning:provision-active-and-partial] out_of_scope: [send route, UI, arrival stamping] needs_human_decision: [] ```

swarm-claim host=matou-dev-server-01 run=16123
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=16123 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1123 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1123,
  "status": "success",
  "commits": [
    "9f5eaa59"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/controlapi/catalogue.go",
    "internal/controlapi/catalogue_read_integration_test.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/controlapi/ ./internal/catalogue/... ./internal/servicerequest/ ./internal/fleetstate/ -count=1",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go test ./internal/controlapi/ -run 'TestProvision|TestCatalogue' -count=1",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go vet ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go build ./...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The response carries every installable service with category/description/glyph/logo-ref, and every candidate distinctly typed — a consumer cannot confuse the tiers": "internal/controlapi/catalogue.go: CatalogueView splits Installable []InstallableEntry vs Candidates []CandidateEntry (distinct types, distinct arrays); InstallableEntry carries Category/Description/Glyph/Logo + Product/ProductURL. Proven by TestCatalogueRead_BothTiersDressedWithLiveFacts (installable count == catalogue.Services(); candidate count == catalogue.Candidates(); files display facts asserted).",
    "A service running on nodes names them; one not running carries its honest state; composition failure for one service degrades that entry, never the read (bounded fan-out prior art)": "installableEntry composes running_where per service (Running+Nodes name the nodes; not-running = 'not running yet'); a RunningOn error sets Degraded + an honest line and never fails the read. Proven by TestCatalogueRead_BothTiersDressedWithLiveFacts (files named on karaka+tōtara, code 'not running yet') and TestCatalogueRead_OneServiceFaults_DegradesEntryNotRead (files degraded, read 200, chat composed cleanly).",
    "A requested candidate carries its requested-on date; suggestions list with dates": "candidateEntry joins ledger.Requested(slug) → Requested+RequestedOn; suggestionEntries lists ledger.Suggestions with RequestedOn. Proven by TestCatalogueRead_BothTiersDressedWithLiveFacts (passwords requested on 2026-08-12, knowledge-base not requested, one suggestion with its date).",
    "The existing assessment/selection/impact/deploy routes are byte-identical (contract tests re-run green)": "provision.go untouched; TestProvision* re-run green (see tests entry running 'TestProvision|TestCatalogue').",
    "Unauthenticated and wrong-token callers are refused (controlapi contract-test prior art)": "catalogueAuthed refuses with 401 before any composition (operatorAuthed prior art; CookieSessionResolver resolves a forged cookie to no session). Proven by TestCatalogueRead_RefusesUnauthenticatedAndWrongToken (no-cookie 401, garbage-cookie 401)."
  },
  "summary": "GET /api/v1/catalogue returns both catalogue tiers dressed with display facts, per-service running-where composed from fleet state with bounded per-entry degradation, candidate request states + suggestions from the ledger, and refuses unauthenticated/wrong-token callers.",
  "blockers": []
}
**close-report** for #1123 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1123, "status": "success", "commits": [ "9f5eaa59" ], "changed_files": [ "STATUS.md", "internal/controlapi/catalogue.go", "internal/controlapi/catalogue_read_integration_test.go" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/controlapi/ ./internal/catalogue/... ./internal/servicerequest/ ./internal/fleetstate/ -count=1", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go test ./internal/controlapi/ -run 'TestProvision|TestCatalogue' -count=1", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go vet ./internal/controlapi/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go build ./...", "exit_code": 0 } ], "criteria": { "The response carries every installable service with category/description/glyph/logo-ref, and every candidate distinctly typed — a consumer cannot confuse the tiers": "internal/controlapi/catalogue.go: CatalogueView splits Installable []InstallableEntry vs Candidates []CandidateEntry (distinct types, distinct arrays); InstallableEntry carries Category/Description/Glyph/Logo + Product/ProductURL. Proven by TestCatalogueRead_BothTiersDressedWithLiveFacts (installable count == catalogue.Services(); candidate count == catalogue.Candidates(); files display facts asserted).", "A service running on nodes names them; one not running carries its honest state; composition failure for one service degrades that entry, never the read (bounded fan-out prior art)": "installableEntry composes running_where per service (Running+Nodes name the nodes; not-running = 'not running yet'); a RunningOn error sets Degraded + an honest line and never fails the read. Proven by TestCatalogueRead_BothTiersDressedWithLiveFacts (files named on karaka+tōtara, code 'not running yet') and TestCatalogueRead_OneServiceFaults_DegradesEntryNotRead (files degraded, read 200, chat composed cleanly).", "A requested candidate carries its requested-on date; suggestions list with dates": "candidateEntry joins ledger.Requested(slug) → Requested+RequestedOn; suggestionEntries lists ledger.Suggestions with RequestedOn. Proven by TestCatalogueRead_BothTiersDressedWithLiveFacts (passwords requested on 2026-08-12, knowledge-base not requested, one suggestion with its date).", "The existing assessment/selection/impact/deploy routes are byte-identical (contract tests re-run green)": "provision.go untouched; TestProvision* re-run green (see tests entry running 'TestProvision|TestCatalogue').", "Unauthenticated and wrong-token callers are refused (controlapi contract-test prior art)": "catalogueAuthed refuses with 401 before any composition (operatorAuthed prior art; CookieSessionResolver resolves a forged cookie to no session). Proven by TestCatalogueRead_RefusesUnauthenticatedAndWrongToken (no-cookie 401, garbage-cookie 401)." }, "summary": "GET /api/v1/catalogue returns both catalogue tiers dressed with display facts, per-service running-where composed from fleet state with bounded per-entry degradation, candidate request states + suggestions from the ledger, and refuses unauthenticated/wrong-token callers.", "blockers": [] } ``` </details>
Author
Owner

Session flag (ADR 0174, evidence only): running_where is inert in production, and its acceptance criterion is not met on a real community. Raising it now rather than letting the read be believed.

This landed a few hours after #1134 was filed, so the gap was genuinely invisible to whoever built it — but the two collide directly.

fleetCatalogueRead.RunningOn (internal/controlapi/catalogue.go:287-298) composes running-where from per-device assignments:

for _, d := range c.fleet.Devices() {
    for _, s := range d.Services {
        if s.Service == slug { nodes = append(nodes, d.Name); break }

#1134 proves d.Services is always empty in production. configRepoInventory.Placement() (control-plane/cmd/control-plane/whole_composition.go:745-751) constructs every fleetstate.PlacedNode with ID/Name/Role/Identity and no Services field, and there is nowhere to read assignments from — a member-device placement deliberately bypasses Config.AttachService under the anti-phantom rule (#351/#428). Its own comment at :726-728 says richer placement "rides the catalogue slices that grow the inventory" — i.e. this ticket.

So on a real community the read returns Running: false, Nodes: [], RunningWhere: "not running yet" for every service, including ones demonstrably running. The #854 drive has just proven Files serving from a member device end to end (files-door and oidc-login both green) on a fleet whose projection reports that device as holding nothing.

Two details that make this worse than a missing feature:

  1. It is a confident wrong answer, not an honest unknown. Degraded fires only when the fleet read errors (:193-196). An always-empty Services is not an error, so the entry reports "not running yet" with full confidence. Clause 2's isolation ("never claiming running") protects against the wrong direction here — the failure mode in production is claiming not running.

  2. The tests cannot catch it. catalogue_read_integration_test.go:30 injects fakeCatalogueRead.RunningOn, so the HTTP seam is proven against a fake while the production composer — the half that touches d.Services — is never exercised against a realistic projection. Green tests, inert production. Same shape as #871 (a gate that could not fail) and #1096/#1100 (a key that never differs); this arc has now produced eight of these.

Not proposing a fix here — the fix is #1134's, and #1134's mechanism (where per-node assignments live) is a design decision that is Ben's, not a worker's. What this ticket needs is to know its acceptance criterion "A service running on nodes names them" is currently unmet in production, so it is not treated as delivered.

Suggested: a blocker edge from #1134 onto this, and a test that drives the real fleetCatalogueRead against a projection built the way production builds one — which would have failed today, and will be the thing that proves #1134 when it lands.

Cross-referenced on #1134.

**Session flag (ADR 0174, evidence only): `running_where` is inert in production, and its acceptance criterion is not met on a real community. Raising it now rather than letting the read be believed.** This landed a few hours after #1134 was filed, so the gap was genuinely invisible to whoever built it — but the two collide directly. `fleetCatalogueRead.RunningOn` (`internal/controlapi/catalogue.go:287-298`) composes running-where from per-device assignments: ```go for _, d := range c.fleet.Devices() { for _, s := range d.Services { if s.Service == slug { nodes = append(nodes, d.Name); break } ``` **#1134 proves `d.Services` is always empty in production.** `configRepoInventory.Placement()` (`control-plane/cmd/control-plane/whole_composition.go:745-751`) constructs every `fleetstate.PlacedNode` with `ID`/`Name`/`Role`/`Identity` and no `Services` field, and there is nowhere to read assignments from — a member-device placement deliberately bypasses `Config.AttachService` under the anti-phantom rule (#351/#428). Its own comment at `:726-728` says richer placement *"rides the catalogue slices that grow the inventory"* — i.e. this ticket. So on a real community the read returns `Running: false`, `Nodes: []`, `RunningWhere: "not running yet"` for **every service**, including ones demonstrably running. The #854 drive has just proven Files serving from a member device end to end (`files-door` and `oidc-login` both green) on a fleet whose projection reports that device as holding nothing. Two details that make this worse than a missing feature: 1. **It is a confident wrong answer, not an honest unknown.** `Degraded` fires only when the fleet read *errors* (`:193-196`). An always-empty `Services` is not an error, so the entry reports "not running yet" with full confidence. Clause 2's isolation ("never claiming running") protects against the wrong direction here — the failure mode in production is claiming *not* running. 2. **The tests cannot catch it.** `catalogue_read_integration_test.go:30` injects `fakeCatalogueRead.RunningOn`, so the HTTP seam is proven against a fake while the production composer — the half that touches `d.Services` — is never exercised against a realistic projection. Green tests, inert production. Same shape as #871 (a gate that could not fail) and #1096/#1100 (a key that never differs); this arc has now produced eight of these. **Not proposing a fix here** — the fix is #1134's, and #1134's mechanism (where per-node assignments live) is a design decision that is Ben's, not a worker's. What this ticket needs is to know its acceptance criterion *"A service running on nodes names them"* is currently unmet in production, so it is not treated as delivered. Suggested: a blocker edge from #1134 onto this, and a test that drives the real `fleetCatalogueRead` against a projection built the way production builds one — which would have failed today, and will be the thing that proves #1134 when it lands. Cross-referenced on #1134.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1123
No description provided.