posta.room/v1 kind refactor + leave action + pkg/posta additions #4

Closed
arne wants to merge 0 commits from issues-1-2-3 into main
Owner

Bundles three issues (each landed as one commit):

#2 — fold posta.room.broadcast/v1 into posta.room/v1 with action discriminator

  • SPEC §14 reframed: posta.room/v1 is the room-payload kind; action: "broadcast" carries the wrapper. Per-action versioning rule documented (incompatible change to any action ⇒ bump the whole kind).
  • §13.1.1 namespace summary updated.
  • cmd/gen-vectors writes the new shape; vectors 10-room-broadcast-roundtrip and 11-room-broadcast-tampered-inner regenerated.
  • pkg/posta test runner checks both kind and action.
  • CONTEXT.md "Wrapper" definition updated.

#3 — `action: "leave"` membership opt-out

  • New SPEC §14.6. Single-purpose: receiver SHOULD remove the sender from the broadcast set, MUST persist, MUST NOT fan out, MUST NOT wrap. Membership semantics beyond non-fanout are local policy.
  • New conformance vector `12-room-leave.json`.

#1 — `pkg/posta` additions

  • `ActorDoc.Kind` (optional, max 64 chars per SPEC §5.2.2). Round-trip + over-length tests.
  • `LoadKeyFile` / `(*KeyFile).Current` / `(*KeyFile).PublishedEntries` / `(*KeyFile).Sign`. Mirrors the posta-server `keys.json` schema; read-only.
  • `NewMemoryStore(ttl)` — in-memory `MessageStore` that dedups on `(sender, id)` and sweeps on each `StoreInbound`.

Follow-up (out of scope, different repo): `posta-server/internal/keys` can now drop its local copy and import from `pkg/posta`.

Test plan

  • `go test ./...` green
  • `go build ./...` green
  • `go run ./cmd/gen-vectors` produces the 10 vectors checked in
  • posta-web /feedback room build picks up pkg/posta once tagged
Bundles three issues (each landed as one commit): ## #2 — fold `posta.room.broadcast/v1` into `posta.room/v1` with action discriminator - SPEC §14 reframed: `posta.room/v1` is the room-payload kind; `action: "broadcast"` carries the wrapper. Per-action versioning rule documented (incompatible change to any action ⇒ bump the whole kind). - §13.1.1 namespace summary updated. - `cmd/gen-vectors` writes the new shape; vectors `10-room-broadcast-roundtrip` and `11-room-broadcast-tampered-inner` regenerated. - `pkg/posta` test runner checks both `kind` and `action`. - CONTEXT.md "Wrapper" definition updated. ## #3 — \`action: \"leave\"\` membership opt-out - New SPEC §14.6. Single-purpose: receiver SHOULD remove the sender from the broadcast set, MUST persist, MUST NOT fan out, MUST NOT wrap. Membership semantics beyond non-fanout are local policy. - New conformance vector \`12-room-leave.json\`. ## #1 — \`pkg/posta\` additions - \`ActorDoc.Kind\` (optional, max 64 chars per SPEC §5.2.2). Round-trip + over-length tests. - \`LoadKeyFile\` / \`(*KeyFile).Current\` / \`(*KeyFile).PublishedEntries\` / \`(*KeyFile).Sign\`. Mirrors the posta-server \`keys.json\` schema; read-only. - \`NewMemoryStore(ttl)\` — in-memory \`MessageStore\` that dedups on \`(sender, id)\` and sweeps on each \`StoreInbound\`. **Follow-up (out of scope, different repo):** \`posta-server/internal/keys\` can now drop its local copy and import from \`pkg/posta\`. ## Test plan - [x] \`go test ./...\` green - [x] \`go build ./...\` green - [x] \`go run ./cmd/gen-vectors\` produces the 10 vectors checked in - [ ] posta-web /feedback room build picks up pkg/posta once tagged
The room wrapper kind becomes posta.room/v1 with action="broadcast",
so future room-control payloads (leave, join, kick, …) live under
the same kind via the action field instead of multiplying kind names.

Closes posta/spec#2.
A verified leave envelope is the sender's request to be removed
from the room's broadcast set. Persisted like any other envelope,
never re-broadcast.

Closes posta/spec#3.
- ActorDoc.Kind (optional, max 64 chars per SPEC §5.2.2) round-trips
  through encode/decode and is rejected when over-length.
- LoadKeyFile parses the daemon's keys.json; Current() picks the
  most-recently-created entry; Sign() is a convenience for embedders
  that hold only the file.
- NewMemoryStore returns an in-memory MessageStore that dedups on
  (sender, id) for the given TTL.

posta-server's internal/keys can now import this — out of scope for
this commit (different repo).

Closes posta/spec#1.
arne closed this pull request 2026-05-13 21:32:21 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Dependencies

No dependencies set.

Reference
posta/spec!4
No description provided.