Files
summercms/.planning/phases/20-demo-instance-with-every-shared-plugin/20-02-PLAN.md
2026-10-28 18:39:49 +01:00

49 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, estimate, must_haves
phase plan type wave depends_on files_modified autonomous requirements estimate must_haves
20-demo-instance-with-every-shared-plugin 02 execute 2
20-01
../sm-demo-app/.gitmodules
../sm-demo-app/go.work
../sm-demo-app/go.mod
../sm-demo-app/go.sum
../sm-demo-app/summer.yaml
../sm-demo-app/plugins.gen.go
../sm-demo-app/plugins/golem15/oauthserver
../sm-demo-app/plugins/golem15/chat
../sm-demo-app/plugins/golem15/chatchannels
../sm-demo-app/plugins/golem15/chatbots
../sm-demo-app/plugins/golem15/chatvideo
../sm-demo-app/plugins/golem15/forum
../sm-demo-app/plugins/golem15/herald
../sm-demo-app/plugins/golem15/userfriends
../sm-demo-app/plugins/golem15/moderation
../sm-demo-app/config/golem15.chatvideo.yaml
../sm-demo-app/plugins/demo/plugin.go
../sm-demo-app/plugins/demo/config/config.yaml
../sm-demo-app/plugins/demo/chat.go
../sm-demo-app/plugins/demo/chat_api.go
../sm-demo-app/plugins/demo/chatbots.go
../sm-demo-app/plugins/demo/moderation.go
../sm-demo-app/plugins/demo/realtime_access.go
../sm-demo-app/plugins/demo/routes.go
../sm-demo-app/plugins/demo/classes/chat_context.go
../sm-demo-app/plugins/demo/classes/forum_access.go
../sm-demo-app/plugins/demo/console/seed.go
../sm-demo-app/plugins/demo/console/seed_chat.go
../sm-demo-app/plugins/demo/console/seed_forum.go
../sm-demo-app/plugins/demo/console/seed_friends.go
../sm-demo-app/plugins/demo/console/reset.go
../sm-demo-app/chat_smoke_test.go
../sm-demo-app/boot_test.go
../sm-demo-app/realtime_test.go
../sm-demo-app/deploy/centrifugo.json.example
../sm-demo-app/deploy/livekit.yaml.example
../sm-demo-app/deploy/env.example
../sm-demo-app/scripts/dev.sh
../sm-demo-app/README.md
.planning/todos/pending/2026-10-26-sm-demo-app-journal-oauthserver-pointers.md
.planning/todos/done/2026-10-26-sm-demo-app-journal-oauthserver-pointers.md
true
SC-1
D-05
D-06
D-07
D-08
D-09
D-10
D-12
D-14
D-17
D-20
D-22
D-23
tokens raw_tokens tasks confidence
320000 320000 4 low
truths artifacts key_links prohibitions
SC-1: sm-demo-app requires chat, chatchannels, chatbots, chatvideo, forum, herald, userfriends and moderation at the plan 01 tags, mounts them as submodules at plugins/golem15/<name> checked out on those tags, lists them in summer.yaml before golem15.demo, and passes TestGoModRequiresTags, TestBootAllPlugins and scripts/check-pins.sh; scripts/build.sh dev builds.
Folded todo: plugins/golem15/oauthserver sits on tag v0.1.3 (which contains b6a9586), go.mod requires sm-oauthserver-plugin v0.1.3, the change is one commit `chore: bump sm-oauthserver-plugin to v0.1.3`, and the todo file moves to .planning/todos/done with g15office task ssuyq2os set to Live.
D-06: golem15.demo registers the chat context alias demo (id 1, broadcast chat:context:1) whose members are every activated, non-deleted, non-banned user, and the alias channel (chatchannels' ChannelAlias) that resolves a seeded channel's backing conversation to the same membership with broadcast chat:channel:{id}; both require live membership.
D-07: channels exist only through demo:seed; the chatchannels access resolver answers CanManageContext false, so POST /_chatchannels/api/v1/contexts/demo/1/channels is refused for every member; a member can join and leave seeded channels and post in them.
D-08: any member can open a DM with any other member through POST /_chat/api/v1/contexts/demo/1/dm; userfriends does not gate it.
D-09: demo:seed creates persona users (no usable password) with EN and PL channel history, threads, reactions and pins, forum categories, threads and posts in EN and PL, friendships and a friend group, the demo-moderators user group and default moderation lists; a second run reports exists; demo:reset wipes every chat-family table in foreign-key order and reseeds, keeping golem15_moderation_settings and the userfriends context singleton.
D-17: a banned word or link in a chat message (create, reply, edit) or a forum thread, reply or edit is refused with 422 through the demo's listeners on events.MessageSaving and events.PostSaving calling the published moderation Filter.
D-22: members of the user group named by golem15.demo.chat.moderator_group (default demo-moderators) can delete other members' messages in channel conversations (CanModerateMessage) and manage forum posts (forum CanManage); the bootstrap reports moderator true for them; banning stays in the user admin.
D-05: chatbots lists the demo's ephemeral slash commands in GET /_chatbots/api/v1/commands and POST /_chatbots/api/v1/dispatch answers them in ephemeral mode; there is no bot persona.
D-12, D-23: config/golem15.chatvideo.yaml sets max_duration 900, max_participants 4, token_ttl 900 and screen_share false; the server does not restrict calls by conversation type (calls are limited to DMs by the UI, plan 04).
GET /_demo/api/v1/chat answers a member with {member, moderator, context, channels[], conversations[], limits} and GET /_demo/api/v1/chat/members with {members[]}; both need a JWT.
GET /api/realtime/token answers 200 for any member (guard demo.realtime-access) and 401 without a JWT; Centrifugo's committed config has the namespaces presentations, chat, user and video with the subscribe proxy; scripts/dev.sh up starts a local LiveKit on 127.0.0.1:7890 (TCP 7891, UDP 7892) with keys written to .env only (D-10 locally).
D-14: the forum resolver lets every member read and post in context demo/1 and the seeded EN and PL categories are listed by GET /_forum/api/v1/contexts/demo/1/categories.
path provides contains
../sm-demo-app/plugins/demo/classes/chat_context.go DemoContext, ChannelContext adapter, ChatAccess resolver, membership query ChatContextType
path provides contains
../sm-demo-app/plugins/demo/chat.go registerChat: registry aliases demo and channel, resolvers, limits ChannelAlias
path provides contains
../sm-demo-app/plugins/demo/chat_api.go GET /_demo/api/v1/chat and /chat/members (host bootstrap contract) /chat/members
path provides contains
../sm-demo-app/plugins/demo/moderation.go MessageSaving and PostSaving listeners calling the moderation Filter MessageSaving
path provides contains
../sm-demo-app/plugins/demo/realtime_access.go demo.realtime-access middleware demo.realtime-access
path provides contains
../sm-demo-app/plugins/demo/console/seed_chat.go persona users, channels, messages, threads, reactions, pins (EN/PL) persona
path provides contains
../sm-demo-app/deploy/livekit.yaml.example LiveKit config template: port 7890, tcp 7891, udp mux 7892, room caps udp_port: 7892
path provides contains
../sm-demo-app/chat_smoke_test.go TestDemoChatTracer, TestDemoModerationSmoke, TestSeedChatSmoke TestDemoChatTracer
from to via pattern
../sm-demo-app/plugins/demo/chat.go ../sm-demo-app/plugins/golem15/chat/contracts/registry.go reg.Add(p.ID(), chatcontracts.Registration{Alias: chanmodels.ChannelAlias, ...}) Alias: +chanmodels.ChannelAlias
from to via pattern
../sm-demo-app/plugins/demo/moderation.go ../sm-demo-app/plugins/golem15/moderation/classes/filter.go app.Lookup[*modclasses.Filter]() then Check(ctx, content) Check(ctx
from to via pattern
../sm-demo-app/plugins/demo/routes.go ../sm-demo-app/plugins/demo/realtime_access.go lighthouse.Mount UserAuth surf.Use("jwt.auth", "demo.realtime-access", bucketRealtime) demo.realtime-access
from to via pattern
../sm-demo-app/plugins/demo/console/reset.go ../sm-demo-app/plugins/demo/console/seed_chat.go resetTables lists the chat-family tables before users; runSeed reseeds them golem15_chat_messages
statement status verification
No file inside a plugin submodule is edited from sm-demo-app; shared plugin fixes go to the plugin repos (plan 01 pattern) and need a new tag. unresolved judgment
statement status verification
go.mod carries no replace directive and no pseudo-version for a golem15 module. unresolved automated
statement status verification
No LiveKit key, VAPID key or persona password appears in a committed file or in command output; .env holds them. unresolved judgment
statement status verification
Nothing is pushed in this plan (plan 05 pushes with the deploy go-ahead). unresolved judgment

Phase Goal

ROADMAP Goal (not in user-story format; no story is invented here): sm-demo-app runs every shared Golem15 plugin in one binary, and its public Nuxt site shows them working; this phase adds the chat family to the live demo from Phase 19.4.1.

This plan's slice (plan 2 of 6, wave 2, per D-20): the demo backend. After it, a registered demo member can read and post in seeded channels, DM anyone, use slash commands, read and post in the forum and manage friends through the plugins' APIs. Moderation refuses banned content, and a local LiveKit can mint calls. Nothing in the Nuxt site changes yet (plans 03 and 04).

Decisions taken in this plan (Claude's discretion, recorded)

  • Contexts (D-06): alias demo, id 1, group name "General", broadcast chat:context:1. Alias channel (chatchannels' models.ChannelAlias, legacy class models.ChannelMorphName) loads the channel by id, with broadcast chat:channel:{id}. Neither broadcast is subscribable, because AuthorizeChat admits only chat:conversation:{id}. Both implement contracts.LiveMembership (true) and contracts.MessageModerator (moderator group, non-DM conversations only), as bm does.
  • Joining a channel (RESEARCH assumption A3): the layer opens a channel with GET /_chat/api/v1/contexts/channel/{channelId}/conversation, whose GetGroupChat lazy-joins a context member. The tracer test proves it. If it does not join, the bootstrap adds the caller as participant of each joined channel with chat's AddUserToGroupChat, and the SUMMARY records which path holds.
  • Personas (discretion): four, Ada and Ben (English) and Ola and Tomek (Polish). Emails are <name>@personas.demo.invalid (RFC 2606, undeliverable). Each gets a random bcrypt hash that is never printed, so nobody can log in as a persona. Channels: general (#general), announcements (#announcements), ogolny (#ogólny, Polish). About 15 to 25 messages per language with two threads, reactions and one pin per channel. Persona Ada sends a welcome DM to the visitor account when golem15.demo.visitor.email is set.
  • Seeding writes: raw SQL in the existing seed style (insertID, exists), or a ChannelService instance built with a seed-only resolver and no bus or realtime, for the channel rows. The demo's own resolver refuses CanManageContext (RESEARCH Anti-Patterns), so it cannot seed. Forum posts store content_html from breakwater.Render, the plugin's own renderer.
  • Moderator group (D-22): user group code demo-moderators (config golem15.demo.chat.moderator_group), created by the seed with no members. demo:reset wipes memberships with the users, so moderators are reassigned after a reset.
  • Slash commands (D-05 discretion): /demo explains what the demo shows and /tour lists the site sections with their paths. Both are ephemeral, English and Polish chosen from the actor's locale when known (else English). /help is chatbots' built-in.
  • Bootstrap contract: bm's /_bm/api/v1/chat shape with general replaced by channels[]. Each channel is {id, slug, name, conversation_id, joined, unread, mentions}. vue-chat-layer documents this contract under a neutral name (plan 03).
  • Local LiveKit (D-10 locally): ports 7890/7891/7892, the same as rome (RESEARCH Pitfall 7), so dev and production configs differ only in keys and external IP. livekit_url locally is ws://127.0.0.1:7890.
  • spec-less probe fallback skipped: phase has no requirement IDs to probe (visible skip).

Artifacts this phase produces (this plan)

  • Submodules plugins/golem15/{chat,chatchannels,chatbots,chatvideo,forum,herald,userfriends,moderation}; summer.yaml entries; go.mod requires at the plan 01 tags; sm-oauthserver-plugin v0.1.3.
  • golem15.demo: classes.DemoContext, classes.ChannelContext, classes.ChatAccess, classes.ForumAccess, classes.ChatContextType = "demo", classes.ChatContextID = 1, classes.ChatBroadcastChannel = "chat:context:1", classes.ChannelBroadcastChannel(id uint) string, classes.MemberIDs; (*Plugin).registerChat; MiddlewareRealtimeAccess = "demo.realtime-access" with pact.HasMiddleware; routes GET /_demo/api/v1/chat and GET /_demo/api/v1/chat/members; slash commands /demo and /tour; seam listeners for chatevents.MessageSaving and forumevents.PostSaving.
  • Config keys: golem15.demo.chat.moderator_group (default demo-moderators), golem15.demo.chat.max_embeds (default 3); config/golem15.chatvideo.yaml (livekit_url, livekit_admin_url, max_duration: 900, max_participants: 4, token_ttl: 900, screen_share: false).
  • demo:seed steps: chat personas, chat channels and history (en), chat channels and history (pl), forum categories and threads (en, pl), friends and group, moderator group demo-moderators, moderation lists; demo:reset table list extended.
  • Deploy and dev: deploy/livekit.yaml.example, Centrifugo namespaces chat, user, video; scripts/dev.sh LiveKit start and stop (pid name livekit); env keys SUMMER_GOLEM15__CHATVIDEO__LIVEKIT_API_KEY and SUMMER_GOLEM15__CHATVIDEO__LIVEKIT_API_SECRET (names only in env.example).
  • Smoke tests: TestDemoChatTracer, TestDemoModerationSmoke, TestSeedChatSmoke (chat_smoke_test.go). Full unit tests come in plan 06.
Mount the released chat family in sm-demo-app and give it a demo host: community context, channel adapter, resolvers, bootstrap endpoints, realtime for every member, moderation wiring, slash commands, EN/PL showcase seed with reset, and a local LiveKit.

Purpose: SC-1 (builds with every shared plugin; demo:seed fills each), D-05 to D-09, D-12, D-14, D-17, D-22, D-23 on the server side, and the folded oauthserver todo. Plans 03 and 04 build the site UI on top of these endpoints. Output: commits in ../sm-demo-app (code) and one planning commit in summercms.go (the todo move). Nothing pushed.

<execution_context> @/.claude/msd-core/workflows/execute-plan.md @/.claude/msd-core/templates/summary.md </execution_context>

@.planning/phases/20-demo-instance-with-every-shared-plugin/20-CONTEXT.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-RESEARCH.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-PATTERNS.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-01-SUMMARY.md @.planning/todos/pending/2026-10-26-sm-demo-app-journal-oauthserver-pointers.md @.planning/G15OFFICE.md

Repo: ../sm-demo-app (all code edits). Read-only: the mounted plugin submodules, ../sm-bm-app/plugins/jz/bm (host analog), ../sm-bm-app/deploy/centrifugo/bm-config.json (namespace options).

Rules: no co-author tags; stage by explicit path; one feat: mount golem15.<id> <tag> commit per plugin (precedent 9451b31: submodule, .gitmodules, go.work, go.mod, go.sum, summer.yaml, plugins.gen.go, boot_test.go); planning files in their own commit in summercms.go. Other sessions (Phase 33) may have uncommitted edits in sm-demo-app or vue-demo-app: check git status --porcelain before each commit, never stage or revert files this plan did not change, and stop if a file this plan must change carries foreign edits. Verify commands run from the framework root with go -C ../sm-demo-app and scripts by path (they cd to their own root). Docker tests: if the socket is denied, run through sudo -u golem.

Host analog ../sm-bm-app/plugins/jz/bm: - chat.go: `registerChat` (HasPlugin guard, `app.Lookup[*chatcontracts.Registry]()`, `reg.Add(p.ID(), chatcontracts.Registration{Alias, Loader})`, `lagoon.OnDatabase` then `app.Lookup[*chanclasses.ChannelService]()` and `SetAccessResolver`; `installChatLimits` via `svc.SetMaxMessageBytes`). - classes/chat_context.go: assertions `chatcontracts.Context`, `MessageModerator`, `LiveMembership`, `chancontracts.AccessResolver`; methods ID, Type, ChatEnabled, GroupName, BroadcastChannel, CanActFor (`chatcontracts.DefaultCanActFor`), CanOverseeChats, CanModerateMessage, RequireLiveMembership, HasMember, Members; `ChatContextLoader`; member query joins users_groups and user_groups. - realtime_access.go: `MiddlewareRealtimeAccess`, `Middlewares() map[string]pact.Middleware`, `realtimeAccess`, `writeRealtimeGuard`. - controllers/api/chat.go: bootstrap JSON structs (member, moderator, context, general, conversations, limits; members with id, name, surname, handle, is_bot). chatchannels: `models.ChannelAlias = "channel"`, `models.ChannelMorphName`, `models.Channel{ContextType, Name, Slug, Visibility...}`; `chancontracts.AccessResolver{CanAccessContext, CanManageContext}`; `ChannelService.CreateChannel` gated by CanManageContext (channel_service.go:136); `JoinChannel` only upserts a pref row (:959). chat: `Service.GetGroupChat(ctx, actorID, alias, contextID)`, `AddUserToGroupChat(ctx, userID, alias, contextID)`, `GetConversationsForUser`, `GetAvailableDmRecipients`, `SetMaxMessageBytes`, `MaxMessageBytes`; events `MessageSaving` and `contracts.Rejection` (plan 01). forum: `forum.Plugin.SetAccessResolver`, `contracts.AccessResolver` (CanRead, CanPost, CanManage, CanManageContext), `ForumService.RegisterContext(alias, legacyPHPClass)`, events `PostSaving`, `contracts.Rejection` (plan 01). chatbots: `contracts.SlashCommand{Trigger, Description, IsAvailable, Handle}`, `classes.Ephemeral(payload)`, `(*classes.Registry).Register` (help is reserved), Registry published in chatbots' OnDatabase hook. moderation: `*classes.Filter` published at boot, `Check(ctx, text) (*Violation, error)` (plan 01). chatvideo config keys (config/config.yaml of the plugin): livekit_url, livekit_api_key, livekit_api_secret, max_duration, token_ttl, livekit_admin_url, max_participants, screen_share; env `SUMMER_GOLEM15__CHATVIDEO__*` or PHP names `LIVEKIT_*`. sm-demo-app today: plugins/demo/plugin.go (Requires, Boot calls wireRealtime), routes.go (`APIPrefix`, `mountRealtime` limited to presentations with `presentations.realtime-owner`), console/seed.go (`runSeed` step table, `created`, `insertID`, `exists`), console/reset.go (`resetTables`, children first), boot_test.go (`wantPlugins`, routed prefixes), realtime_test.go (`TestRealtimeRoutes`, `wantNamespaces`), testmain_test.go (`bootDemo`), go_mod_test.go, scripts/dev.sh (`ensure_env`, `start_centrifugo`, `claim_port`, `up`/`down`/`status`), deploy/centrifugo.json.example (namespaces array with `subscribe_proxy_enabled`). Task 1: Tracer: a registered member reads the chat bootstrap and posts in the seeded #general channel through the chat API The plan 01 SUMMARY lists the eight tags and `git ls-remote --tags git@git.golem15.com:golem15/sm-chat-plugin.git` shows the chat tag; `git -C ../sm-demo-app status --porcelain` shows nothing except ` M plugins/golem15/oauthserver`; `docker info` exits 0. ../sm-demo-app/plugins/golem15/oauthserver, ../sm-demo-app/.gitmodules, ../sm-demo-app/go.work, ../sm-demo-app/go.mod, ../sm-demo-app/go.sum, ../sm-demo-app/summer.yaml, ../sm-demo-app/plugins.gen.go, ../sm-demo-app/plugins/golem15/chat, ../sm-demo-app/plugins/golem15/chatchannels, ../sm-demo-app/plugins/demo/plugin.go, ../sm-demo-app/plugins/demo/chat.go, ../sm-demo-app/plugins/demo/classes/chat_context.go, ../sm-demo-app/plugins/demo/chat_api.go, ../sm-demo-app/plugins/demo/routes.go, ../sm-demo-app/plugins/demo/console/seed.go, ../sm-demo-app/plugins/demo/console/seed_chat.go, ../sm-demo-app/boot_test.go, ../sm-demo-app/chat_smoke_test.go, .planning/todos/pending/2026-10-26-sm-demo-app-journal-oauthserver-pointers.md, .planning/todos/done/2026-10-26-sm-demo-app-journal-oauthserver-pointers.md ../sm-demo-app/summer.yaml, go.mod, go.work, .gitmodules, plugins.gen.go, `git -C ../sm-demo-app show 9451b31 --stat` (mount commit shape), ../sm-demo-app/plugins/demo/plugin.go, routes.go, console/seed.go, ../sm-demo-app/boot_test.go, testmain_test.go, internal/demotest/postgres.go, ../sm-bm-app/plugins/jz/bm/chat.go, classes/chat_context.go, controllers/api/chat.go, ../sm-demo-app/plugins/golem15/chat/contracts/*.go and classes/writes.go (GetGroupChat, AddUserToGroupChat) after mounting, ../sm-demo-app/plugins/golem15/chatchannels/models/channel.go, classes/channel_service.go (CreateChannel, JoinChannel), contracts/*.go, ../sm-demo-app/scripts/check-pins.sh, the folded todo, .planning/G15OFFICE.md Per D-06, D-07, SC-1 and the folded todo.
  1. Folded todo first:
    • git -C ../sm-demo-app/plugins/golem15/oauthserver fetch --tags, confirm git merge-base --is-ancestor b6a9586 v0.1.3, then check out v0.1.3;
    • in ../sm-demo-app run GOWORK=off GOPRIVATE=git.golem15.com/* go get git.golem15.com/golem15/sm-oauthserver-plugin@v0.1.3 and go mod tidy;
    • commit the gitlink with go.mod and go.sum as chore: bump sm-oauthserver-plugin to v0.1.3. In summercms.go, git mv the todo to .planning/todos/done/, add a "Done in Phase 20 plan 02" line, and commit it as a planning commit. Move g15office task ssuyq2os to Live with a one-line comment, as .planning/G15OFFICE.md describes.
  2. Mount chat and chatchannels at their plan 01 tags:
    • git submodule add -b main git@git.golem15.com:golem15/sm-<name>-plugin.git plugins/golem15/<name>, then check out the tag;
    • add both to go.work use, and run GOWORK=off go get <module>@<tag> plus go mod tidy;
    • add summer.yaml entries after golem15.user (chat, then chatchannels) and before golem15.demo;
    • regenerate plugins.gen.go the way 9451b31 did (the summer build generator);
    • append the IDs to boot_test.go wantPlugins and /_chat/api/v1 and /_chatchannels/api/v1 to its routed prefixes. One feat: mount golem15.<id> <tag> commit per plugin.
  3. plugins/demo/classes/chat_context.go, ported from bm's chat_context.go:
    • constants ChatContextType "demo", ChatContextID 1, ChatGroupName "General", ChatBroadcastChannel "chat:context:1", and ChannelBroadcastChannel(id) returning "chat:channel:{id}";
    • MemberIDs(ctx, db) and IsMember(ctx, db, userID): users that are activated, have no deleted_at and are not banned (use the user plugin's own ban column; read its models);
    • DemoContext and ChannelContext implement chatcontracts.Context, MessageModerator and LiveMembership. CanModerateMessage is true only for a member of the moderator group in a non-DM conversation. RequireLiveMembership returns true;
    • ChatAccess (chancontracts.AccessResolver): CanAccessContext is true for a member when the type is "demo" and the id is 1; CanManageContext is always false (D-07);
    • keep bm's WithMembership and MemberFunc injection so tests can stub membership.
  4. plugins/demo/chat.go registerChat(app), called from Boot after wireRealtime:
    • with the HasPlugin guard, register alias demo (loader returns DemoContext for id 1 and the unknown-context error otherwise) and alias chanmodels.ChannelAlias with LegacyPHPClass: chanmodels.ChannelMorphName (loader reads the channel row by id and returns ChannelContext);
    • in lagoon.OnDatabase, install ChatAccess on the ChannelService. Requires() gains golem15.chat and golem15.chatchannels. Config keys go into plugins/demo/config/config.yaml in Task 2.
  5. console/seed_chat.go: a step chat channels and history (en) that, in this task, creates only #general in context demo/1 (channel row plus backing conversation, exactly the rows CreateChannel writes, through a seed-only resolver or raw SQL) and one welcome message from the first admin or a persona. It is idempotent by slug. Add it to the runSeed step table.
  6. plugins/demo/chat_api.go: GET /_demo/api/v1/chat behind jwt.auth and throttle:120,1, mounted from Routes. For a member it answers {member: true, moderator, context: {type: "demo", id: 1}, channels: [{id, slug, name, conversation_id, joined, unread, mentions}], conversations: [DMs as bm's chatConversationJSON], limits: {max_files, max_bytes, max_embeds}}. For a non-member it answers {member: false}. Errors use wire.WriteJSON with {"error": ...}.
  7. chat_smoke_test.go TestDemoChatTracer (Docker): bootDemo, run demo:seed, create and activate a user, then with its JWT:
    • GET /_demo/api/v1/chat shows #general with a conversation_id;
    • GET /_chat/api/v1/contexts/channel/{channelId}/conversation answers 200;
    • POST /_chat/api/v1/conversations/{conversation_id}/messages answers 201;
    • GET .../messages contains the text;
    • POST /_chatchannels/api/v1/contexts/demo/1/channels is refused (403 or 404). If the lazy join does not make the user a participant, implement the AddUserToGroupChat fallback in the bootstrap and record it.

Commit the host wiring and the test as feat: demo chat context, channel adapter and bootstrap. go -C ../sm-demo-app vet . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -short . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -run '^(TestDemoChatTracer|TestGoModRequiresTags|TestBootAllPlugins)$' -v . 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 3 && ../sm-demo-app/scripts/check-pins.sh <fails_when>Non-zero exit: vet or the short suite red; fewer than three "--- PASS" lines (a replace or pseudo-version in go.mod, a plugin not activated, a missing route prefix, the member cannot post, or the channel create was allowed); or check-pins prints a mismatch line instead of "check-pins: ok".</fails_when> <acceptance_criteria> - git -C ../sm-demo-app log --oneline -6 shows chore: bump sm-oauthserver-plugin to v0.1.3, feat: mount golem15.chat, feat: mount golem15.chatchannels and the host commit, each separate. - git -C ../sm-demo-app submodule status plugins/golem15/oauthserver plugins/golem15/chat plugins/golem15/chatchannels shows no leading + and each describes as its tag. - test -f .planning/todos/done/2026-10-26-sm-demo-app-journal-oauthserver-pointers.md && ! test -e .planning/todos/pending/2026-10-26-sm-demo-app-journal-oauthserver-pointers.md exits 0. - grep -c 'Alias: *chanmodels.ChannelAlias' ../sm-demo-app/plugins/demo/chat.go prints 1. </acceptance_criteria> A demo member can open the seeded #general channel and post in it through the shared chat API, from a build that requires every module by tag.

Task 2: The rest of the family is mounted and wired: forum, friends, slash commands, video config, herald, and moderation refusing banned content ../sm-demo-app/.gitmodules, ../sm-demo-app/go.work, ../sm-demo-app/go.mod, ../sm-demo-app/go.sum, ../sm-demo-app/summer.yaml, ../sm-demo-app/plugins.gen.go, ../sm-demo-app/plugins/golem15/chatbots, ../sm-demo-app/plugins/golem15/chatvideo, ../sm-demo-app/plugins/golem15/forum, ../sm-demo-app/plugins/golem15/herald, ../sm-demo-app/plugins/golem15/userfriends, ../sm-demo-app/plugins/golem15/moderation, ../sm-demo-app/config/golem15.chatvideo.yaml, ../sm-demo-app/plugins/demo/plugin.go, ../sm-demo-app/plugins/demo/config/config.yaml, ../sm-demo-app/plugins/demo/chat.go, ../sm-demo-app/plugins/demo/chatbots.go, ../sm-demo-app/plugins/demo/moderation.go, ../sm-demo-app/plugins/demo/classes/forum_access.go, ../sm-demo-app/boot_test.go, ../sm-demo-app/chat_smoke_test.go ../sm-demo-app/plugins/golem15/forum/README.md, boot.go, contracts/access_resolver.go, ../sm-demo-app/plugins/golem15/chatbots/README.md, contracts/slash_command.go, classes/registry.go, classes/result.go, boot.go, ../sm-demo-app/plugins/golem15/chatvideo/README.md and config/config.yaml, ../sm-demo-app/plugins/golem15/herald/README.md and config/config.yaml, ../sm-demo-app/plugins/golem15/userfriends/README.md, ../sm-demo-app/plugins/golem15/moderation/README.md and classes/filter.go, ../sm-demo-app/plugins/golem15/chat/events/events.go and contracts/rejection.go, ../sm-demo-app/plugins/golem15/forum/events/events.go and contracts/rejection.go, ../sm-demo-app/plugins/demo/chat.go (Task 1), ../sm-bm-app/plugins/jz/bm/chat.go (config key block) Per D-05, D-08, D-12, D-14, D-17, D-22, D-23, SC-1.
  1. Mount chatbots, chatvideo, forum, herald, userfriends and moderation at their plan 01 tags as in Task 1, one feat: mount golem15.<id> <tag> commit each. Order in summer.yaml: chatbots and chatvideo after chatchannels; forum, herald and userfriends after them (userfriends after chat, so it sees the chat registry at Boot); moderation; all before golem15.demo. Extend boot_test.go wantPlugins and its prefixes: /_chatbots/api/v1, /_chatvideo/api/v1, /_forum/api/v1, /_herald/api/v1, /_userfriends/api/v1 and /_demo/api/v1/chat.
  2. config/golem15.chatvideo.yaml (D-12, D-23): livekit_url "ws://127.0.0.1:7890", livekit_admin_url "http://127.0.0.1:7890", max_duration 900, max_participants 4, token_ttl 900, screen_share false. API key and secret come only from the environment. Herald gets no committed config: its keys come from .env (plan 04).
  3. plugins/demo/config/config.yaml: chat: {moderator_group: demo-moderators, max_embeds: 3}. chat.go reads them as in bm's config key block and reports the limits in the bootstrap (max_bytes from the chat service's MaxMessageBytes).
  4. Forum (D-14, D-22): classes/forum_access.go ForumAccess. CanRead and CanPost are true for a member when the context is demo/1; CanManage and CanManageContext are true for members of the moderator group. registerChat looks up *forum.Plugin and calls SetAccessResolver, and registers the context alias demo with the forum service when its API requires registration (check ListCategories on an unregistered alias).
  5. DMs (D-08): nothing to add beyond DemoContext.HasMember. Verify in the smoke test that two members open a DM with POST /_chat/api/v1/contexts/demo/1/dm.
  6. chatbots.go (D-05): /demo and /tour implement contracts.SlashCommand with IsAvailable true for any non-zero actor and Handle returning classes.Ephemeral with a short text (/tour lists /blog, /presentations, /quizzes, /subscriptions, /faq, /chat, /forum, /friends). Register them in lagoon.OnDatabase after chatbots published its Registry; a missing registry is a boot error naming the summer.yaml order.
  7. moderation.go (D-17): in Boot, app.Events.Listen[*chatevents.MessageSaving](p.ID(), ...) looks up *modclasses.Filter per event and returns chatcontracts.Rejection{Field: "content", Message: v.Message} when Check finds a violation. app.Events.Listen[*forumevents.PostSaving] checks Title (Field "title"), then Body (Field "body"), returning forumcontracts.Rejection. A Check error is returned as is (500). A missing filter is a boot error, because golem15.demo requires golem15.moderation.
  8. plugin.go Requires() lists every plugin whose tables the seed or reset writes or that the demo wires: chat, chatchannels, chatbots, chatvideo, forum, herald, userfriends, moderation, plus the existing ones. The package doc mentions the chat host.
  9. chat_smoke_test.go TestDemoModerationSmoke (Docker): seed, then set golem15_moderation_settings banned_words to "blockedword" and banned_links to "bad.example". A member's message "this has blockedword" in #general answers 422 errors.content; a forum thread titled "visit bad.example" in a seeded category answers 422 errors.title; a clean message answers 201. Also assert the DM open from step 5 and that GET /_chatbots/api/v1/commands lists demo and tour.

Commit wiring (feat: demo hosts forum, friends, slash commands and moderation) separately from the six mount commits. go -C ../sm-demo-app vet . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -short . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -run '^(TestDemoModerationSmoke|TestBootAllPlugins|TestGoModRequiresTags|TestDemoChatTracer)$' -v . 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 4 && ../sm-demo-app/scripts/check-pins.sh && ../sm-demo-app/scripts/build.sh dev <fails_when>Non-zero exit: vet or short suite red; fewer than four "--- PASS" lines (banned content stored, a plugin not activated, a prefix not routed, a go.mod rule broken); check-pins reports a mismatch; or the dev build fails.</fails_when> <acceptance_criteria> - grep -cE '^ - id: golem15\.(chat|chatchannels|chatbots|chatvideo|forum|herald|userfriends|moderation)$' ../sm-demo-app/summer.yaml prints 8. - grep -c 'max_participants: 4' ../sm-demo-app/config/golem15.chatvideo.yaml prints 1 and grep -c 'max_duration: 900' ../sm-demo-app/config/golem15.chatvideo.yaml prints 1. - grep -rn 'livekit_api_secret: *"[^"]' ../sm-demo-app/config prints nothing (no committed secret). - git -C ../sm-demo-app status --porcelain -- plugins/golem15 prints nothing (submodules clean, on tags). </acceptance_criteria> Every chat-family plugin boots in the demo with its host policy; banned words and links are refused in chat and forum; slash commands answer; video is configured with the D-12 caps.

Task 3: demo:seed fills chat, forum and friends with EN and PL showcase data, and demo:reset wipes and reseeds all of it ../sm-demo-app/plugins/demo/console/seed.go, ../sm-demo-app/plugins/demo/console/seed_chat.go, ../sm-demo-app/plugins/demo/console/seed_forum.go, ../sm-demo-app/plugins/demo/console/seed_friends.go, ../sm-demo-app/plugins/demo/console/reset.go, ../sm-demo-app/chat_smoke_test.go ../sm-demo-app/plugins/demo/console/seed.go (step table, created, insertID, exists, visitor), seed_locales.go, reset.go (resetTables order and comments), ../sm-demo-app/reset_test.go and seed_test.go, the baseline migrations of every mounted chat-family plugin (../sm-demo-app/plugins/golem15/{chat,chatchannels,chatbots,chatvideo,forum,herald,userfriends}/updates/*.go) for table names and foreign keys, ../sm-demo-app/plugins/golem15/chatchannels/models (pins, mentions, members, prefs), ../sm-demo-app/plugins/golem15/chat/models (message, reaction, thread summary), modules/breakwater/README.md, 20-RESEARCH.md (Pitfall 10, Anti-Patterns) Per D-09, D-14, D-15 (data), D-22, D-17.
  • seed_chat.go:
    • chat personas: Ada, Ben, Ola and Tomek, as decided above. Each is activated, has a random password hash that is never printed, and is skipped when the email exists.
    • chat channels and history (en): #general and #announcements, with English history from the personas, two threads (root plus 2 to 4 replies, keeping chat's thread summary rows consistent the way the service writes them), reactions on a few messages using the keys chat allows (GET /reactions catalog in the plugin), and one pin per channel in chatchannels' pins table.
    • chat channels and history (pl): #ogólny (slug ogolny) with Polish history, a thread, reactions and a pin.
    • A welcome DM from Ada to the visitor when golem15.demo.visitor.email is set (skipped otherwise).
    • Rows are written in created order with timestamps spread over the last few days. Messages are inserted directly: no realtime, no jobs, no events. Steps are idempotent by channel slug and persona email.
  • seed_forum.go forum categories and threads (en, pl): categories "General discussion" and "Show and tell" (EN) and "Rozmowy" (PL) in context demo/1, two or three threads each with replies by personas. content is Markdown and content_html comes from breakwater.Render. Idempotent by category slug.
  • seed_friends.go friends and group: accepted friendships among the personas, one pending request from Ola to the visitor when set, and a friend group "Demo crew" owned by Ada with Ben and Tomek as members. Use userfriends' tables and the context singleton id 1. Idempotent.
  • seed.go: steps moderator group demo-moderators (a user_groups row with the configured code and name "Demo moderators", no members) and moderation lists (when banned_words and banned_links are both empty, fill a short, mild default list of common spam words and one link-shortener domain; otherwise "exists"). Order the new steps after the visitor and before the roadmap decks.
  • reset.go resetTables (RESEARCH Pitfall 10), children first, all before users:
    • chatvideo participants, then sessions;
    • chat reactions, thread mutes, thread summaries, messages, participants, conversations;
    • chatchannels mentions, pins, members, prefs, user context prefs, personal categories, channels, categories;
    • forum thread reads, posts, threads, categories;
    • userfriends group bans, invites, group members, groups, friendships;
    • herald push subscriptions;
    • chatbots bot flags. Use the exact table names from the migrations. Keep golem15_moderation_settings and golem15_userfriends_contexts. Update the comment and the command description. Remove the chat-family uploads (chat attachments in system_files) the same way the reset already removes other owners' attachments, keeping resetKeptAttachments.
  • chat_smoke_test.go TestSeedChatSmoke (Docker): seed with a visitor email.
    • Three channels exist, #ogólny holds Polish text, at least one thread root has replies, at least one reaction and one pin exist, the forum has three categories with posts whose content_html is non-empty, there are at least three accepted friendships and the group "Demo crew", and the visitor has a DM.
    • A second seed run reports every new step as "exists".
    • demo:reset --force empties golem15_chat_messages before reseeding and leaves golem15_moderation_settings unchanged.

Commit feat: seed and reset the chat family (EN/PL). go -C ../sm-demo-app vet . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -run '^(TestSeedChatSmoke|TestResetKeepsPlans|TestSeedRoadmapUpsert)$' -v . 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 3 <fails_when>Non-zero exit or fewer than three "--- PASS" lines: seed not idempotent, a missing EN/PL item, a foreign-key violation in the reset order, moderation settings wiped, or the existing reset and roadmap tests broken.</fails_when> <acceptance_criteria> - grep -c 'golem15_chat_messages' ../sm-demo-app/plugins/demo/console/reset.go prints at least 1, and TestSeedChatSmoke asserts the moderation settings row is identical before and after demo:reset --force. - grep -c 'personas.demo.invalid' ../sm-demo-app/plugins/demo/console/seed_chat.go prints at least 1. - Running ../sm-demo-app/scripts/dev.sh seed twice against the local stack prints no "created" for the new steps on the second run. </acceptance_criteria> A fresh or reset demo shows lived-in EN and PL channels, threads, reactions, pins, forum threads, friendships and a friend group, and the reset job keeps it that way.

Task 4: Every member gets realtime, the layers get their members endpoint, and dev runs Centrifugo namespaces and a local LiveKit ../sm-demo-app/plugins/demo/realtime_access.go, ../sm-demo-app/plugins/demo/routes.go, ../sm-demo-app/plugins/demo/plugin.go, ../sm-demo-app/plugins/demo/chat_api.go, ../sm-demo-app/realtime_test.go, ../sm-demo-app/deploy/centrifugo.json.example, ../sm-demo-app/deploy/livekit.yaml.example, ../sm-demo-app/deploy/env.example, ../sm-demo-app/scripts/dev.sh, ../sm-demo-app/README.md ../sm-bm-app/plugins/jz/bm/realtime_access.go, ../sm-demo-app/plugins/demo/routes.go (mountRealtime), realtime.go, ../sm-demo-app/realtime_test.go (TestRealtimeRoutes, wantNamespaces, realtimeApp), ../sm-bm-app/deploy/centrifugo/bm-config.json (chat, user and video namespace options), ../sm-demo-app/deploy/centrifugo.json.example, ../sm-demo-app/scripts/dev.sh (ensure_env, start_centrifugo, claim_port, up, down, status, the usage header), ../sm-demo-app/deploy/env.example, ../sm-demo-app/README.md, ../sm-demo-app/plugins/golem15/chatvideo/README.md (keys, admin URL, TrustedMode), 20-RESEARCH.md (Pitfalls 4, 5, 7; LiveKit config block) Per D-10 (locally), D-06, SC-1.
  1. realtime_access.go: MiddlewareRealtimeAccess = "demo.realtime-access", exported through Middlewares() map[string]pact.Middleware (assert pact.HasMiddleware in plugin.go). The guard reads bouncer.User(r.Context()): no user gives 401, a database not yet published gives 503, and a user for whom classes.IsMember is true passes. Otherwise it falls back to the presentations owner guard looked up once (sync.Once) by name, as bm does. routes.go mountRealtime mounts when golem15.presentations or golem15.chat is active, with UserAuth: surf.Use("jwt.auth", MiddlewareRealtimeAccess, bucketRealtime). Update its doc comment.
  2. realtime_test.go: the token route's expected middleware becomes ["jwt.auth", "demo.realtime-access", "throttle:golem15.demo.realtime"], and wantNamespaces gains the namespaces the chat, chatvideo and user plugins register. Plan 06 adds the member/non-member cases.
  3. chat_api.go GET /_demo/api/v1/chat/members (jwt.auth, throttle:120,1) answers {members: [{id, name, surname, handle, is_bot}]} for every member except the caller, as bm's ChatMembers does (handle from the user plugin's username or a slug of the name; is_bot false). A non-member gets 403.
  4. deploy/centrifugo.json.example: add namespaces chat (presence, join_leave, force_push_join_leave, allow_presence_for_subscriber and subscribe_proxy_enabled, with the option names bm's config uses translated to this file's v6 format), user (subscribe_proxy_enabled) and video (subscribe_proxy_enabled). Run centrifugo checkconfig -c deploy/centrifugo.json.example, then diff the option names against centrifugo defaultconfig, because checkconfig misses misspelt names. Update the _comment lines.
  5. deploy/livekit.yaml.example (RESEARCH LiveKit block):
    • port 7890, bind_addresses [127.0.0.1];
    • rtc tcp_port 7891, udp_port 7892 (UDP mux only, no port-range keys), use_external_ip true and a comment that local runs set it false;
    • room max_participants 4, empty_timeout 120, departure_timeout 20;
    • keys with one placeholder pair (CHANGE_ME_KEY: CHANGE_ME_SECRET);
    • a header comment naming rome's path /srv/summercms-demo/livekit.yaml (0640 root:summercms-demo), the supervisor program plan 05 adds, and the env keys.
  6. scripts/dev.sh:
    • LIVEKIT=${LIVEKIT:-$(command -v livekit-server || true)};
    • ensure_env appends SUMMER_GOLEM15__CHATVIDEO__LIVEKIT_API_KEY and SUMMER_GOLEM15__CHATVIDEO__LIVEKIT_API_SECRET (random, umask 077, never echoed) when missing;
    • livekit_config writes logs/livekit.yaml from the example with the .env keys and use_external_ip false;
    • start_livekit claims ports 7890 and 7891, starts livekit-server --config logs/livekit.yaml under the pid name livekit with output to logs/livekit.log, waits for http://127.0.0.1:7890/ and warns and continues without video when the binary is missing;
    • up starts it after Centrifugo, down, destroy and status include livekit, and the header usage lines mention it.
  7. deploy/env.example: the two LiveKit key names with empty values and a comment. README.md: a "Chat family" section covering the mounted plugins, the contexts, the bootstrap contract of /_demo/api/v1/chat and /chat/members, the seed data, the moderator group, slash commands and local LiveKit.

Commit feat: realtime for every demo member, members endpoint, Centrifugo namespaces and local LiveKit. go -C ../sm-demo-app vet . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -short . ./plugins/demo/... && centrifugo checkconfig -c ../sm-demo-app/deploy/centrifugo.json.example && ../sm-demo-app/scripts/dev.sh up && curl -fsS http://127.0.0.1:7890/ >/dev/null && ../sm-demo-app/scripts/check-local.sh realtime <fails_when>Non-zero exit: vet or the short suite red (TestRealtimeRoutes middleware or namespaces), checkconfig refuses the Centrifugo file, dev.sh up fails to start a service, LiveKit does not answer on 127.0.0.1:7890, or check-local realtime reports a non-200 token for the visitor or a token without a JWT.</fails_when> <acceptance_criteria> - grep -c '"name": "chat"' ../sm-demo-app/deploy/centrifugo.json.example prints 1, and the same for "user" and "video". - grep -v '^\s*#' ../sm-demo-app/deploy/livekit.yaml.example | grep -cE 'port_range_(start|end)' prints 0, and grep -c 'udp_port: 7892' ../sm-demo-app/deploy/livekit.yaml.example prints 1. - With the local stack up, curl -s -o /dev/null -w '%{http_code}' -H "Authorization: Bearer $VISITOR_JWT" http://127.0.0.1:8097/api/realtime/token prints 200 (JWT from the login API). - grep -c 'LIVEKIT_API_SECRET=' ../sm-demo-app/deploy/env.example prints 1 and that line has no value after the equals sign. </acceptance_criteria> Every demo member gets a realtime token and the member list, Centrifugo knows the chat namespaces, and a local LiveKit runs with the dev stack.

<threat_model>

Trust Boundaries

Boundary Description
browser to /_demo, /_chat, /_chatchannels, /_forum, /_userfriends, /_chatbots, /_chatvideo every request untrusted; actor only from the JWT
Centrifugo subscribe proxy to Go channel names come from clients; authorizers decide
seed and reset commands to the database trusted operator commands; persona accounts must stay unusable
Go to LiveKit RoomService on loopback admin calls with the API secret

STRIDE Threat Register

Threat ID Category Component Severity Disposition Mitigation Plan
T-20-06 Elevation of privilege channel creation by members high mitigate ChatAccess.CanManageContext is always false; TestDemoChatTracer asserts POST channels is refused (D-07)
T-20-07 Information disclosure subscribing to other conversations high mitigate broadcast channels chat:context:1 and chat:channel:{id} are not subscribable (AuthorizeChat admits only chat:conversation:{id}); user:{id} only to itself (user plugin authorizer); video:session:{id} only to session participants
T-20-08 Spoofing persona accounts medium mitigate random password hashes never printed, emails under .invalid, so no login and no mail; reset wipes and recreates them
T-20-09 Elevation of privilege moderator rights medium mitigate moderator group membership only through the user admin (D-22); CanModerateMessage limited to non-DM conversations; banned users fail HasMember with live membership on
T-20-10 Tampering spam and abuse in public chat and forum high mitigate moderation listeners on both seams (TestDemoModerationSmoke), plugin buckets (chat-api, chat-dm, forum-api, video-initiate), Turnstile on register (19.4.1), reset job
T-20-11 Denial of service realtime token minting for every member low mitigate guard needs a JWT of a live member, per-user bucket golem15.demo.realtime 120/min unchanged
T-20-12 Information disclosure LiveKit and VAPID secrets high mitigate values only in .env (dev.sh writes them with umask 077, never echoed); env.example holds names; config files hold no secret (acceptance grep)
T-20-13 Denial of service stale chat-family rows after reset low mitigate reset table list in FK order covering every chat-family table; TestSeedChatSmoke checks messages are emptied
T-20-SC Tampering npm/pip/cargo installs high mitigate no package-manager install in this plan; Go modules are the project's tagged plugins from plan 01 (go.sum committed, GOPRIVATE)
</threat_model>
- Task 1: tracer test, go.mod tags, boot test, check-pins. - Task 2: moderation smoke, boot and go.mod tests, check-pins, dev build. - Task 3: seed smoke, reset and roadmap tests. - Task 4: short suite, Centrifugo checkconfig, dev stack up with LiveKit, check-local realtime.

<success_criteria> sm-demo-app builds with every shared plugin including the chat family, and demo:seed fills each with EN/PL showcase data (SC-1). The demo hosts one community where every member can chat, DM, post in the forum and befriend others, with moderation, slash commands and video configured (D-05 to D-09, D-12, D-14, D-17, D-22, D-23). </success_criteria>

Create `.planning/phases/20-demo-instance-with-every-shared-plugin/20-02-SUMMARY.md` when done: mount commits with tags, which channel join path holds (lazy join or bootstrap), persona and channel names, the reset table order, the Centrifugo option names used, and any boot warnings left by plugins (for example herald's presence gate).