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 |
|
|
true |
|
|
|
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", broadcastchat:context:1. Aliaschannel(chatchannels'models.ChannelAlias, legacy classmodels.ChannelMorphName) loads the channel by id, with broadcastchat:channel:{id}. Neither broadcast is subscribable, because AuthorizeChat admits onlychat:conversation:{id}. Both implementcontracts.LiveMembership(true) andcontracts.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'sAddUserToGroupChat, 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 frombreakwater.Render, the plugin's own renderer. - Moderator group (D-22): user group code
demo-moderators(configgolem15.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):
/demoexplains what the demo shows and/tourlists the site sections with their paths. Both are ephemeral, English and Polish chosen from the actor's locale when known (else English)./helpis chatbots' built-in. - Bootstrap contract: bm's
/_bm/api/v1/chatshape withgeneralreplaced bychannels[]. 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_urllocally isws://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"withpact.HasMiddleware; routesGET /_demo/api/v1/chatandGET /_demo/api/v1/chat/members; slash commands/demoand/tour; seam listeners forchatevents.MessageSavingandforumevents.PostSaving. - Config keys:
golem15.demo.chat.moderator_group(defaultdemo-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 namespaceschat,user,video;scripts/dev.shLiveKit start and stop (pid namelivekit); env keysSUMMER_GOLEM15__CHATVIDEO__LIVEKIT_API_KEYandSUMMER_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.
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>
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.
- Folded todo first:
git -C ../sm-demo-app/plugins/golem15/oauthserver fetch --tags, confirmgit 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.3andgo 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 mvthe 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.
- 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 runGOWORK=off go get <module>@<tag>plusgo 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/v1and/_chatchannels/api/v1to its routed prefixes. Onefeat: mount golem15.<id> <tag>commit per plugin.
- 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)andIsMember(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
WithMembershipandMemberFuncinjection so tests can stub membership.
- constants ChatContextType "demo", ChatContextID 1, ChatGroupName "General", ChatBroadcastChannel "chat:context:1", and
- 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.ChannelAliaswithLegacyPHPClass: 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.
- with the HasPlugin guard, register alias demo (loader returns DemoContext for id 1 and the unknown-context error otherwise) and alias
- 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. - plugins/demo/chat_api.go:
GET /_demo/api/v1/chatbehindjwt.authandthrottle: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 usewire.WriteJSONwith{"error": ...}. - 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.
- 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. - 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).
- 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). - 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.Pluginand calls SetAccessResolver, and registers the context alias demo with the forum service when its API requires registration (check ListCategories on an unregistered alias). - 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.
- chatbots.go (D-05):
/demoand/tourimplement 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. - moderation.go (D-17): in Boot,
app.Events.Listen[*chatevents.MessageSaving](p.ID(), ...)looks up*modclasses.Filterper event and returnschatcontracts.Rejection{Field: "content", Message: v.Message}when Check finds a violation.app.Events.Listen[*forumevents.PostSaving]checks Title (Field "title"), then Body (Field "body"), returningforumcontracts.Rejection. A Check error is returned as is (500). A missing filter is a boot error, because golem15.demo requires golem15.moderation. - 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.
- 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.
- 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 frombreakwater.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) andmoderation 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 beforeusers:- 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.
- realtime_access.go:
MiddlewareRealtimeAccess = "demo.realtime-access", exported throughMiddlewares() map[string]pact.Middleware(assert pact.HasMiddleware in plugin.go). The guard readsbouncer.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, withUserAuth: surf.Use("jwt.auth", MiddlewareRealtimeAccess, bucketRealtime). Update its doc comment. - 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.
- 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. - 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) andvideo(subscribe_proxy_enabled). Runcentrifugo checkconfig -c deploy/centrifugo.json.example, then diff the option names againstcentrifugo defaultconfig, because checkconfig misses misspelt names. Update the _comment lines. - 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.
- 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_configwrites logs/livekit.yaml from the example with the .env keys and use_external_ip false;start_livekitclaims ports 7890 and 7891, startslivekit-server --config logs/livekit.yamlunder 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.
- 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> |
<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).