catalogue: T3 — the service-request ledger: one jsonstore document, recorded on accept only #1121

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

Parent

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

What to build

A new module owning the community's request ledger as one single-writer jsonstore document (ADR 0050; member/rescue-ledger prior art): service slug → requested-on date, plus sent suggestions (name, optional product, date). The ledger is community-wide truth — every operator reads the same state. Nothing writes it except the accept path (ADR 0219).

Acceptance criteria

  • First run with no document reads as empty — no error, no file created until the first accept
  • Recording a request persists slug + date; load-mutate-save round-trips; the schema guard rejects a future-versioned document plainly
  • Recording a suggestion persists name, optional product and date; suggestions list in sent order
  • Re-recording an already-requested slug keeps the ORIGINAL date (dedupe truth lives here too)
  • There is no delete/decline mutation — the API surface cannot express one

Blocked by

Task manifest

task: service-request-ledger
implements_flow: p4-provisioning
implements_edge: "S2b requested-state (record half)"
wireframe: docs/ux/wireframes/p4-provisioning/p4-s2b-browse-catalogue.html (requested-on contract)
seam: jsonstore document tests (member/rescue ledger prior art)
depends_on: [bootstrap:skeleton]
out_of_scope: [broker call, routes, UI]
needs_human_decision: []
## Parent Spec #1116 (catalogue two tiers; DDR 0220 / ADR 0219). Feature #1073. Slice `service-request-ledger` in docs/slices/catalogue.yaml. ## What to build A new module owning the community's request ledger as one single-writer jsonstore document (ADR 0050; member/rescue-ledger prior art): service slug → requested-on date, plus sent suggestions (name, optional product, date). The ledger is community-wide truth — every operator reads the same state. Nothing writes it except the accept path (ADR 0219). ## Acceptance criteria - [ ] First run with no document reads as empty — no error, no file created until the first accept - [ ] Recording a request persists slug + date; load-mutate-save round-trips; the schema guard rejects a future-versioned document plainly - [ ] Recording a suggestion persists name, optional product and date; suggestions list in sent order - [ ] Re-recording an already-requested slug keeps the ORIGINAL date (dedupe truth lives here too) - [ ] There is no delete/decline mutation — the API surface cannot express one ## Blocked by - #23 ## Task manifest ```yaml task: service-request-ledger implements_flow: p4-provisioning implements_edge: "S2b requested-state (record half)" wireframe: docs/ux/wireframes/p4-provisioning/p4-s2b-browse-catalogue.html (requested-on contract) seam: jsonstore document tests (member/rescue ledger prior art) depends_on: [bootstrap:skeleton] out_of_scope: [broker call, routes, UI] needs_human_decision: [] ```

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

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

close-report for #1121 — status success

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

envelope
{
  "issue": 1121,
  "status": "success",
  "commits": [
    "0e00c4ff"
  ],
  "changed_files": [
    "internal/servicerequest/ledger.go",
    "internal/servicerequest/ledger_test.go",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/servicerequest/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go build ./...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c gofmt -l internal/servicerequest/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go vet ./internal/servicerequest/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "First run with no document reads as empty — no error, no file created until the first accept": "TestFileLedger_EmptyFirstRun (ledger_test.go): Load of an absent path returns a zero state and no error, and os.Stat asserts no file exists — jsonstore.File.Load never creates a file; only Save (on accept) does.",
    "Recording a request persists slug + date; load-mutate-save round-trips; the schema guard rejects a future-versioned document plainly": "TestFileLedger_RecordRequestRoundTrips (load-mutate-save over a shared File path, restart reads slug+date back) + TestFileLedger_RefusesFutureSchema (SchemaVersion+1 document -> errors.Is ErrSchemaNewer; corrupt document refused too), guard is checkSchema in ledger.go.",
    "Recording a suggestion persists name, optional product and date; suggestions list in sent order": "TestRecordSuggestion_OrderAndOptionalProduct: three suggestions land in sent order, product kept when present, empty product omitted from JSON (json:\"product,omitempty\"), date preserved.",
    "Re-recording an already-requested slug keeps the ORIGINAL date (dedupe truth lives here too)": "TestRecordRequest_DedupeKeepsOriginalDate: second RecordRequest for the same slug adds no row and keeps the first date — RecordRequest short-circuits on Requested(slug).",
    "There is no delete/decline mutation — the API surface cannot express one": "TestNoDeleteOrDeclineMutation: reflective scan of *LedgerState, *MemoryLedger, *FileLedger and the Ledger interface reds on any delete/decline/remove/withdraw/revoke/clear/drop/reject/cancel method name; the Ledger port is Load/Save only and jsonstore is wrapped (not embedded) so its Delete never leaks."
  },
  "summary": "New internal/servicerequest module owns the community's single-writer request ledger (slug->requested-on date + suggestions), recorded on accept only, with schema guard, slug dedupe keeping the original date, and no delete/decline surface.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1121 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1121, "status": "success", "commits": [ "0e00c4ff" ], "changed_files": [ "internal/servicerequest/ledger.go", "internal/servicerequest/ledger_test.go", "STATUS.md" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/servicerequest/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go build ./...", "exit_code": 0 }, { "command": "nix develop .#go-ci -c gofmt -l internal/servicerequest/", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go vet ./internal/servicerequest/", "exit_code": 0 } ], "criteria": { "First run with no document reads as empty — no error, no file created until the first accept": "TestFileLedger_EmptyFirstRun (ledger_test.go): Load of an absent path returns a zero state and no error, and os.Stat asserts no file exists — jsonstore.File.Load never creates a file; only Save (on accept) does.", "Recording a request persists slug + date; load-mutate-save round-trips; the schema guard rejects a future-versioned document plainly": "TestFileLedger_RecordRequestRoundTrips (load-mutate-save over a shared File path, restart reads slug+date back) + TestFileLedger_RefusesFutureSchema (SchemaVersion+1 document -> errors.Is ErrSchemaNewer; corrupt document refused too), guard is checkSchema in ledger.go.", "Recording a suggestion persists name, optional product and date; suggestions list in sent order": "TestRecordSuggestion_OrderAndOptionalProduct: three suggestions land in sent order, product kept when present, empty product omitted from JSON (json:\"product,omitempty\"), date preserved.", "Re-recording an already-requested slug keeps the ORIGINAL date (dedupe truth lives here too)": "TestRecordRequest_DedupeKeepsOriginalDate: second RecordRequest for the same slug adds no row and keeps the first date — RecordRequest short-circuits on Requested(slug).", "There is no delete/decline mutation — the API surface cannot express one": "TestNoDeleteOrDeclineMutation: reflective scan of *LedgerState, *MemoryLedger, *FileLedger and the Ledger interface reds on any delete/decline/remove/withdraw/revoke/clear/drop/reject/cancel method name; the Ledger port is Load/Save only and jsonstore is wrapped (not embedded) so its Delete never leaks." }, "summary": "New internal/servicerequest module owns the community's single-writer request ledger (slug->requested-on date + suggestions), recorded on accept only, with schema guard, slug dedupe keeping the original date, and no delete/decline surface.", "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#1121
No description provided.