catalogue: chat-port — the chat service ships its full port (Mattermost) #224

Closed
opened 2026-07-31 03:16:40 +00:00 by ben · 1 comment
Owner

Parent

Arc seed #223 (split confirmed by Ben, 2026-07-30) — the chat catalogue service ships its port. Template: the files-port ticket #220.

What's true today

chat (Mattermost) is a slug of intent in internal/catalogue/catalogue.go — no NixOS module, no reconciler, no health check anywhere in the tree. Under ADR 0112 it can no longer activate vacuously: until this port lands, assigning it names a "no health check declared" fault.

What to build

The ADR 0062 three parts, following #220's proven template: (1) the declarative module (daemon + secrets via clan vars) rendered through the clan adapter (ADR 0102); (2) the out-of-band reconciler where the module can't declare it (the Garage/S13 pattern); (3) a health check that proves real function, registered in the shared registry. Plus the port-declared contract parts as they apply: ingress fragment + client-protocol exempt paths (ADR 0074), disable-credentials verb (ADR 0074), offboard fates (ADR 0075), role mappings (ADR 0076), dataset/backup contract (ADR 0080). Hostname derives from the one authority (ADR 0113: chat.<apex>). The compiled svc:mattermost brand artifact (declared-lossy render) gets consumed — coverage's partial becomes demonstrably true.

Acceptance criteria

  • Given a device assigned chat, When the deploy completes, Then the service runs, its real check passes, and only then does it activate and publish (ADR 0112)
  • Given the front door, When a member browses chat.<apex>, Then forward_auth + the komiti matrix govern entry and declared exempt paths pass (ADRs 0074/0076)
  • Given the member orbit, When suspend/offboard runs, Then this port's verbs really converge the service (ADRs 0074/0075)

Task manifest

task: catalogue:chat-port
implements_seam: "the chat port's full contract (ADR 0062 + the port-declared parts)"
interface: "a real, health-gated, front-doored Mattermost the orbit drives"
seam: "a clan-lab smoke per the smoke-* precedent"
acceptance:
  - given: chat assigned; when: deploy completes; then: running, gated, governed
depends_on: [catalogue:files-port]
out_of_scope: [other services' ports]
needs_human_decision: []
## Parent Arc seed #223 (split confirmed by Ben, 2026-07-30) — the `chat` catalogue service ships its port. Template: the files-port ticket #220. ## What's true today `chat` (Mattermost) is a slug of intent in `internal/catalogue/catalogue.go` — no NixOS module, no reconciler, no health check anywhere in the tree. Under ADR 0112 it can no longer activate vacuously: until this port lands, assigning it names a "no health check declared" fault. ## What to build The ADR 0062 three parts, following #220's proven template: (1) the declarative module (daemon + secrets via clan vars) rendered through the clan adapter (ADR 0102); (2) the out-of-band reconciler where the module can't declare it (the Garage/S13 pattern); (3) a health check that proves real function, registered in the shared registry. Plus the port-declared contract parts as they apply: ingress fragment + client-protocol exempt paths (ADR 0074), disable-credentials verb (ADR 0074), offboard fates (ADR 0075), role mappings (ADR 0076), dataset/backup contract (ADR 0080). Hostname derives from the one authority (ADR 0113: `chat.<apex>`). The compiled `svc:mattermost` brand artifact (declared-lossy render) gets consumed — coverage's `partial` becomes demonstrably true. ## Acceptance criteria - [ ] Given a device assigned `chat`, When the deploy completes, Then the service runs, its real check passes, and only then does it activate and publish (ADR 0112) - [ ] Given the front door, When a member browses `chat.<apex>`, Then forward_auth + the komiti matrix govern entry and declared exempt paths pass (ADRs 0074/0076) - [ ] Given the member orbit, When suspend/offboard runs, Then this port's verbs really converge the service (ADRs 0074/0075) ## Task manifest ```yaml task: catalogue:chat-port implements_seam: "the chat port's full contract (ADR 0062 + the port-declared parts)" interface: "a real, health-gated, front-doored Mattermost the orbit drives" seam: "a clan-lab smoke per the smoke-* precedent" acceptance: - given: chat assigned; when: deploy completes; then: running, gated, governed depends_on: [catalogue:files-port] out_of_scope: [other services' ports] needs_human_decision: [] ```
Author
Owner

Shipped in 502ee72 (on origin/main): the chat service ships its full ADR 0062 port core (Mattermost), on the files/code-port template.

Part 1 (module): internal/clan/chat.go RenderChat emits chat.nix — services.mattermost on the ruled host, mesh-bound (wt0) with no public port (the front door fronts it, ADR 0074); SSO client secret + admin password ride clan vars while the DB rides no secret (Postgres peer auth over the socket — the Mattermost module has no password-file option); open sign-up closed + SSO auto-provision to one community account (arch 05).

Part 2 (store + out-of-band): Postgres local + Mattermost dataDir as the declared Chat dataset (ADR 0080); three idempotent mmctl --local oneshots — mattermost-sso (reconcile the community SSO source vs kanidm OAuth2 endpoints), mattermost-admin (bootstrap the admin identity the reconciler drives, ADR 0062 part 2), mattermost-brand (consume the compiled svc:mattermost declared-lossy kit onto the live instance — coverage partial demonstrably true).

Attach: chat_attach.go AttachChat derives chat.<apex> from the one hostname authority (ADR 0113), node-only, idempotent, missing-apex refused.

Orbit: internal/chatsvc — a real memberorbit.ServicePort (Service=chat) over Mattermost REST API (token login): hold/release deactivate/reactivate (the REST API + clients bypass the browser gate, so a suspend must converge Mattermost; Mattermost has a single deactivation state, so hold/archive share it and the orbit ledger owns terminality), archive kept-in-place, reassign refused (fate archive), Data reports team count; front-door-only mapping; wired behind derivedChatURL and .Expect-ed.

Health: chatHealthCheck probes /api/v4/system/ping (status OK — real function, ADR 0062/0061), registered in the shared registry so the gate activates chat only on a real pass (provision_chat_health_test.go).

Front-door: ChatExemptPaths (/api/v4/*) bypass the browser gate while direct browser entry stays behind forward_auth (ADR 0074) — seam-tested.

AC coverage: AC1 → provision_chat_health_test.go (activates only on a real ping pass; a failing probe withholds activation). AC2 → chat_frontdoor_test.go (exempt paths bypass, non-client entry gated) + front-door-only role mapping. AC3 → chatsvc contract tests (hold/release/archive/offboard-fate converge real state).

Seam-tested throughout; go build/vet/test + golangci-lint green. Deferred (scope split, the prior-ports precedent): the clan-lab smoke (assign chat → deploy → health-pass → sign in/post) and the member portal claim UI.

Shipped in `502ee72` (on origin/main): the chat service ships its full ADR 0062 port core (Mattermost), on the files/code-port template. **Part 1 (module):** `internal/clan/chat.go` `RenderChat` emits `chat.nix` — `services.mattermost` on the ruled host, mesh-bound (wt0) with no public port (the front door fronts it, ADR 0074); SSO client secret + admin password ride clan vars while the DB rides no secret (Postgres peer auth over the socket — the Mattermost module has no password-file option); open sign-up closed + SSO auto-provision to one community account (arch 05). **Part 2 (store + out-of-band):** Postgres local + Mattermost `dataDir` as the declared Chat dataset (ADR 0080); three idempotent `mmctl --local` oneshots — `mattermost-sso` (reconcile the community SSO source vs kanidm OAuth2 endpoints), `mattermost-admin` (bootstrap the admin identity the reconciler drives, ADR 0062 part 2), `mattermost-brand` (consume the compiled `svc:mattermost` declared-lossy kit onto the live instance — coverage `partial` demonstrably true). **Attach:** `chat_attach.go` `AttachChat` derives `chat.<apex>` from the one hostname authority (ADR 0113), node-only, idempotent, missing-apex refused. **Orbit:** `internal/chatsvc` — a real `memberorbit.ServicePort` (Service=chat) over Mattermost REST API (token login): hold/release deactivate/reactivate (the REST API + clients bypass the browser gate, so a suspend must converge Mattermost; Mattermost has a single deactivation state, so hold/archive share it and the orbit ledger owns terminality), archive kept-in-place, reassign refused (fate archive), Data reports team count; front-door-only mapping; wired behind `derivedChatURL` and `.Expect`-ed. **Health:** `chatHealthCheck` probes `/api/v4/system/ping` (status OK — real function, ADR 0062/0061), registered in the shared registry so the gate activates chat only on a real pass (`provision_chat_health_test.go`). **Front-door:** `ChatExemptPaths` (`/api/v4/*`) bypass the browser gate while direct browser entry stays behind forward_auth (ADR 0074) — seam-tested. **AC coverage:** AC1 → `provision_chat_health_test.go` (activates only on a real ping pass; a failing probe withholds activation). AC2 → `chat_frontdoor_test.go` (exempt paths bypass, non-client entry gated) + front-door-only role mapping. AC3 → `chatsvc` contract tests (hold/release/archive/offboard-fate converge real state). Seam-tested throughout; `go build/vet/test` + golangci-lint green. Deferred (scope split, the prior-ports precedent): the clan-lab smoke (assign chat → deploy → health-pass → sign in/post) and the member portal claim UI.
ben closed this issue 2026-08-01 06:22:41 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#224
No description provided.