catalogue: T4 — RequestService on the broker client: the ADR 0219 contract, privacy-pinned #1122

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

Parent

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

What to build

The broker client grows RequestService beside ClaimSubdomain/Rent (ADR 0100 port pattern): payload = community name, kind (candidate | suggestion), service slug or suggested name + optional product, optional note — nothing else, ever (the ADR 0219 privacy contract: no member data, no device facts, no addresses). Response = accept carrying the canonical requested-on date (the original date on dedupe) or a refusal with an operator-facing, human-word reason. A fake broker binding pins the contract for every downstream test; the real endpoint is companion work in the broker's own codebase.

Acceptance criteria

  • The wire payload contains exactly the pinned fields — a test fails if any new field appears (the privacy contract is executable)
  • Accept returns the canonical date; a dedupe accept returns the original date and is indistinguishable in type from a first accept
  • A refusal carries an operator-facing reason string — never a status code dressed as prose, never a stack trace
  • Unreachable/timeout surfaces as the transport error the send route maps to the one fail-loud shape
  • The fake broker scripts accept / dedupe / refuse / unreachable (FakeBroker prior art)

Blocked by

Task manifest

task: broker-request-client
implements_flow: p4-provisioning
implements_edge: "S2b-req send (transport half)"
wireframe: docs/ux/wireframes/p4-provisioning/p4-s2b-req-request-confirm.html (what-is-sent contract)
seam: brokerclient tests against the fake (founding FakeBroker prior art)
depends_on: [bootstrap:skeleton]
out_of_scope: [broker-side endpoint (broker repo), ledger, routes, UI]
needs_human_decision: []
## Parent Spec #1116 (catalogue two tiers; DDR 0220 / ADR 0219). Feature #1073. Slice `broker-request-client` in docs/slices/catalogue.yaml. ## What to build The broker client grows RequestService beside ClaimSubdomain/Rent (ADR 0100 port pattern): payload = community name, kind (candidate | suggestion), service slug or suggested name + optional product, optional note — nothing else, ever (the ADR 0219 privacy contract: no member data, no device facts, no addresses). Response = accept carrying the canonical requested-on date (the original date on dedupe) or a refusal with an operator-facing, human-word reason. A fake broker binding pins the contract for every downstream test; the real endpoint is companion work in the broker's own codebase. ## Acceptance criteria - [ ] The wire payload contains exactly the pinned fields — a test fails if any new field appears (the privacy contract is executable) - [ ] Accept returns the canonical date; a dedupe accept returns the original date and is indistinguishable in type from a first accept - [ ] A refusal carries an operator-facing reason string — never a status code dressed as prose, never a stack trace - [ ] Unreachable/timeout surfaces as the transport error the send route maps to the one fail-loud shape - [ ] The fake broker scripts accept / dedupe / refuse / unreachable (FakeBroker prior art) ## Blocked by - #23 ## Task manifest ```yaml task: broker-request-client implements_flow: p4-provisioning implements_edge: "S2b-req send (transport half)" wireframe: docs/ux/wireframes/p4-provisioning/p4-s2b-req-request-confirm.html (what-is-sent contract) seam: brokerclient tests against the fake (founding FakeBroker prior art) depends_on: [bootstrap:skeleton] out_of_scope: [broker-side endpoint (broker repo), ledger, routes, UI] needs_human_decision: [] ```

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

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

close-report for #1122 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit 860b004362 is not reachable from origin/main (not landed)
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
  • changed_files: 'internal/brokerclient/client.go' is not in the diff of the claimed commits
  • changed_files: 'internal/brokerclient/client_test.go' is not in the diff of the claimed commits
  • changed_files: 'internal/catalogue/request.go' is not in the diff of the claimed commits
  • changed_files: 'internal/catalogue/testing/fakes.go' is not in the diff of the claimed commits
  • changed_files: 'internal/catalogue/testing/fakes_test.go' is not in the diff of the claimed commits
envelope
{
  "issue": 1122,
  "status": "success",
  "commits": [
    "860b004362351a8f694b3682135f2f0428dceda8"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/brokerclient/client.go",
    "internal/brokerclient/client_test.go",
    "internal/catalogue/request.go",
    "internal/catalogue/testing/fakes.go",
    "internal/catalogue/testing/fakes_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/brokerclient/... ./internal/catalogue/...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/brokerclient/... ./internal/catalogue/...",
      "exit_code": 0
    },
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go build -tags dev ./...",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/brokerclient/ internal/catalogue/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The wire payload contains exactly the pinned fields — a test fails if any new field appears (the privacy contract is executable)": "brokerclient.serviceRequestWire is the exact field set (community/kind/slug/name/product/note); TestClient_RequestService_WirePayloadIsExactlyPinned asserts the marshalled key set equals exactly the pinned universe and reds on any extra key, and TestClient_RequestService_CandidateOmitsSuggestionFields pins a candidate to slug-only (no name/product/note) — internal/brokerclient/client_test.go",
    "Accept returns the canonical date; a dedupe accept returns the original date and is indistinguishable in type from a first accept": "RequestService decodes {requested_on} into ServiceRequestResult with no first-vs-dedupe flag; TestClient_RequestService_AcceptCarriesCanonicalDate + TestClient_RequestService_DedupeAcceptIsIndistinguishable prove the dedupe date rides the identical type — internal/brokerclient/client.go / client_test.go",
    "A refusal carries an operator-facing reason string — never a status code dressed as prose, never a stack trace": "non-2xx {reason} maps to *catalogue.RequestRefused{Reason}; a non-2xx WITHOUT a reason stays a plain transport error (requestRefusalReason); TestClient_RequestService_RefusalCarriesOperatorReason + TestClient_RequestService_BareStatusIsNotARefusal — internal/brokerclient/client.go / client_test.go",
    "Unreachable/timeout surfaces as the transport error the send route maps to the one fail-loud shape": "a failed round-trip returns a wrapped transport error (never a RequestRefused); TestClient_RequestService_UnreachableIsTransportError — internal/brokerclient/client.go / client_test.go",
    "The fake broker scripts accept / dedupe / refuse / unreachable (FakeBroker prior art)": "cataloguetesting.FakeBroker (modelled on founding FakeBroker) scripts all four legs plus dedupe-by-community+kind+subject and cancelled-context-sends-nothing; TestFakeBroker_* — internal/catalogue/testing/fakes.go / fakes_test.go"
  },
  "summary": "Added RequestService to the broker client — the ADR 0219 privacy-pinned catalogue Service-request transport (port + types in internal/catalogue, production impl on brokerclient.Client, a scripted cataloguetesting.FakeBroker), with contract tests pinning the exact wire payload, canonical/dedupe dates, operator-facing refusals and unreachable transport errors.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1122 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit 860b004362351a8f694b3682135f2f0428dceda8 is not reachable from origin/main (not landed) - changed_files: 'STATUS.md' is not in the diff of the claimed commits - changed_files: 'internal/brokerclient/client.go' is not in the diff of the claimed commits - changed_files: 'internal/brokerclient/client_test.go' is not in the diff of the claimed commits - changed_files: 'internal/catalogue/request.go' is not in the diff of the claimed commits - changed_files: 'internal/catalogue/testing/fakes.go' is not in the diff of the claimed commits - changed_files: 'internal/catalogue/testing/fakes_test.go' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 1122, "status": "success", "commits": [ "860b004362351a8f694b3682135f2f0428dceda8" ], "changed_files": [ "STATUS.md", "internal/brokerclient/client.go", "internal/brokerclient/client_test.go", "internal/catalogue/request.go", "internal/catalogue/testing/fakes.go", "internal/catalogue/testing/fakes_test.go" ], "tests": [ { "command": "go test ./internal/brokerclient/... ./internal/catalogue/...", "exit_code": 0 }, { "command": "go vet ./internal/brokerclient/... ./internal/catalogue/...", "exit_code": 0 }, { "command": "go build ./...", "exit_code": 0 }, { "command": "go build -tags dev ./...", "exit_code": 0 }, { "command": "gofmt -l internal/brokerclient/ internal/catalogue/", "exit_code": 0 } ], "criteria": { "The wire payload contains exactly the pinned fields — a test fails if any new field appears (the privacy contract is executable)": "brokerclient.serviceRequestWire is the exact field set (community/kind/slug/name/product/note); TestClient_RequestService_WirePayloadIsExactlyPinned asserts the marshalled key set equals exactly the pinned universe and reds on any extra key, and TestClient_RequestService_CandidateOmitsSuggestionFields pins a candidate to slug-only (no name/product/note) — internal/brokerclient/client_test.go", "Accept returns the canonical date; a dedupe accept returns the original date and is indistinguishable in type from a first accept": "RequestService decodes {requested_on} into ServiceRequestResult with no first-vs-dedupe flag; TestClient_RequestService_AcceptCarriesCanonicalDate + TestClient_RequestService_DedupeAcceptIsIndistinguishable prove the dedupe date rides the identical type — internal/brokerclient/client.go / client_test.go", "A refusal carries an operator-facing reason string — never a status code dressed as prose, never a stack trace": "non-2xx {reason} maps to *catalogue.RequestRefused{Reason}; a non-2xx WITHOUT a reason stays a plain transport error (requestRefusalReason); TestClient_RequestService_RefusalCarriesOperatorReason + TestClient_RequestService_BareStatusIsNotARefusal — internal/brokerclient/client.go / client_test.go", "Unreachable/timeout surfaces as the transport error the send route maps to the one fail-loud shape": "a failed round-trip returns a wrapped transport error (never a RequestRefused); TestClient_RequestService_UnreachableIsTransportError — internal/brokerclient/client.go / client_test.go", "The fake broker scripts accept / dedupe / refuse / unreachable (FakeBroker prior art)": "cataloguetesting.FakeBroker (modelled on founding FakeBroker) scripts all four legs plus dedupe-by-community+kind+subject and cancelled-context-sends-nothing; TestFakeBroker_* — internal/catalogue/testing/fakes.go / fakes_test.go" }, "summary": "Added RequestService to the broker client — the ADR 0219 privacy-pinned catalogue Service-request transport (port + types in internal/catalogue, production impl on brokerclient.Client, a scripted cataloguetesting.FakeBroker), with contract tests pinning the exact wire payload, canonical/dedupe dates, operator-facing refusals and unreachable transport errors.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>

close-report for #1122 — status success

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

envelope
{
  "issue": 1122,
  "status": "success",
  "commits": [
    "860b004362351a8f694b3682135f2f0428dceda8"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/brokerclient/client.go",
    "internal/brokerclient/client_test.go",
    "internal/catalogue/request.go",
    "internal/catalogue/testing/fakes.go",
    "internal/catalogue/testing/fakes_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/brokerclient/... ./internal/catalogue/...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/brokerclient/... ./internal/catalogue/...",
      "exit_code": 0
    },
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go build -tags dev ./...",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/brokerclient/ internal/catalogue/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The wire payload contains exactly the pinned fields — a test fails if any new field appears (the privacy contract is executable)": "brokerclient.serviceRequestWire is the exact field set (community/kind/slug/name/product/note); TestClient_RequestService_WirePayloadIsExactlyPinned asserts the marshalled key set equals exactly the pinned universe and reds on any extra key, and TestClient_RequestService_CandidateOmitsSuggestionFields pins a candidate to slug-only (no name/product/note) — internal/brokerclient/client_test.go",
    "Accept returns the canonical date; a dedupe accept returns the original date and is indistinguishable in type from a first accept": "RequestService decodes {requested_on} into ServiceRequestResult with no first-vs-dedupe flag; TestClient_RequestService_AcceptCarriesCanonicalDate + TestClient_RequestService_DedupeAcceptIsIndistinguishable prove the dedupe date rides the identical type — internal/brokerclient/client.go / client_test.go",
    "A refusal carries an operator-facing reason string — never a status code dressed as prose, never a stack trace": "non-2xx {reason} maps to *catalogue.RequestRefused{Reason}; a non-2xx WITHOUT a reason stays a plain transport error (requestRefusalReason); TestClient_RequestService_RefusalCarriesOperatorReason + TestClient_RequestService_BareStatusIsNotARefusal — internal/brokerclient/client.go / client_test.go",
    "Unreachable/timeout surfaces as the transport error the send route maps to the one fail-loud shape": "a failed round-trip returns a wrapped transport error (never a RequestRefused); TestClient_RequestService_UnreachableIsTransportError — internal/brokerclient/client.go / client_test.go",
    "The fake broker scripts accept / dedupe / refuse / unreachable (FakeBroker prior art)": "cataloguetesting.FakeBroker (modelled on founding FakeBroker) scripts all four legs plus dedupe-by-community+kind+subject and cancelled-context-sends-nothing; TestFakeBroker_* — internal/catalogue/testing/fakes.go / fakes_test.go"
  },
  "summary": "Added RequestService to the broker client — the ADR 0219 privacy-pinned catalogue Service-request transport (port + types in internal/catalogue, production impl on brokerclient.Client, a scripted cataloguetesting.FakeBroker), with contract tests pinning the exact wire payload, canonical/dedupe dates, operator-facing refusals and unreachable transport errors.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1122 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1122, "status": "success", "commits": [ "860b004362351a8f694b3682135f2f0428dceda8" ], "changed_files": [ "STATUS.md", "internal/brokerclient/client.go", "internal/brokerclient/client_test.go", "internal/catalogue/request.go", "internal/catalogue/testing/fakes.go", "internal/catalogue/testing/fakes_test.go" ], "tests": [ { "command": "go test ./internal/brokerclient/... ./internal/catalogue/...", "exit_code": 0 }, { "command": "go vet ./internal/brokerclient/... ./internal/catalogue/...", "exit_code": 0 }, { "command": "go build ./...", "exit_code": 0 }, { "command": "go build -tags dev ./...", "exit_code": 0 }, { "command": "gofmt -l internal/brokerclient/ internal/catalogue/", "exit_code": 0 } ], "criteria": { "The wire payload contains exactly the pinned fields — a test fails if any new field appears (the privacy contract is executable)": "brokerclient.serviceRequestWire is the exact field set (community/kind/slug/name/product/note); TestClient_RequestService_WirePayloadIsExactlyPinned asserts the marshalled key set equals exactly the pinned universe and reds on any extra key, and TestClient_RequestService_CandidateOmitsSuggestionFields pins a candidate to slug-only (no name/product/note) — internal/brokerclient/client_test.go", "Accept returns the canonical date; a dedupe accept returns the original date and is indistinguishable in type from a first accept": "RequestService decodes {requested_on} into ServiceRequestResult with no first-vs-dedupe flag; TestClient_RequestService_AcceptCarriesCanonicalDate + TestClient_RequestService_DedupeAcceptIsIndistinguishable prove the dedupe date rides the identical type — internal/brokerclient/client.go / client_test.go", "A refusal carries an operator-facing reason string — never a status code dressed as prose, never a stack trace": "non-2xx {reason} maps to *catalogue.RequestRefused{Reason}; a non-2xx WITHOUT a reason stays a plain transport error (requestRefusalReason); TestClient_RequestService_RefusalCarriesOperatorReason + TestClient_RequestService_BareStatusIsNotARefusal — internal/brokerclient/client.go / client_test.go", "Unreachable/timeout surfaces as the transport error the send route maps to the one fail-loud shape": "a failed round-trip returns a wrapped transport error (never a RequestRefused); TestClient_RequestService_UnreachableIsTransportError — internal/brokerclient/client.go / client_test.go", "The fake broker scripts accept / dedupe / refuse / unreachable (FakeBroker prior art)": "cataloguetesting.FakeBroker (modelled on founding FakeBroker) scripts all four legs plus dedupe-by-community+kind+subject and cancelled-context-sends-nothing; TestFakeBroker_* — internal/catalogue/testing/fakes.go / fakes_test.go" }, "summary": "Added RequestService to the broker client — the ADR 0219 privacy-pinned catalogue Service-request transport (port + types in internal/catalogue, production impl on brokerclient.Client, a scripted cataloguetesting.FakeBroker), with contract tests pinning the exact wire payload, canonical/dedupe dates, operator-facing refusals and unreachable transport errors.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
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#1122
No description provided.