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

44 KiB
Raw Blame History

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 06 execute 6
20-01
20-02
20-03
20-04
20-05
../sm-moderation-plugin/classes/filter_test.go
../sm-moderation-plugin/models/settings_test.go
../sm-moderation-plugin/plugin_test.go
../sm-chat-plugin/saving_test.go
../sm-forum-plugin/saving_test.go
../sm-demo-app/moderation_test.go
../sm-demo-app/chat_test.go
../sm-demo-app/video_test.go
../sm-demo-app/seed_chat_test.go
../sm-demo-app/reset_test.go
../sm-demo-app/realtime_test.go
../sm-demo-app/boot_test.go
../sm-demo-app/plugins/demo/classes/chat_context_test.go
../sm-demo-app/plugins/demo/chatbots_test.go
../sm-demo-app/scripts/check-chat.cjs
../sm-demo-app/scripts/check-local.sh
../sm-demo-app/scripts/check-all.sh
../sm-demo-app/README.md
../vue-chat-layer/vitest.config.ts
../vue-chat-layer/app/lib/chatEvents.test.ts
../vue-chat-layer/app/lib/chatFormat.test.ts
../vue-chat-layer/app/lib/chatText.test.ts
../vue-chat-layer/app/lib/chatUnread.test.ts
../vue-chat-layer/app/lib/realtime.test.ts
../vue-chat-layer/app/lib/linkEmbeds.test.ts
../vue-chat-layer/tests/client.test.ts
../vue-chat-layer/tests/store.test.ts
../vue-chatvideo-layer/tests/callMachine.test.ts
../vue-chatvideo-layer/tests/videoClient.test.ts
../vue-chatvideo-layer/tests/useCall.test.ts
../vue-forum-layer/tests/client.test.ts
../vue-userfriends-layer/tests/client.test.ts
../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts
../sm-demo-app/vue-demo-app/app/utils/communityAuth.test.ts
../sm-demo-app/vue-demo-app/app/plugins/auth.ts
../sm-demo-app/vue-demo-app/app/lib/realtime.test.ts
false
SC-1
SC-2
SC-3
SC-4
D-01
D-02
D-04
D-05
D-06
D-07
D-08
D-09
D-11
D-12
D-13
D-14
D-15
D-17
D-18
D-20
D-21
D-22
D-23
tokens raw_tokens tasks confidence
360000 360000 8 low
truths artifacts key_links prohibitions
SC-4: every behaviour row of 20-VALIDATION.md has a passing automated test under the name it lists, in the repository it lists; the new code of plans 01 to 05 is covered by unit tests in this last plan (project rule).
D-18: TestMessageSaving* (sm-chat-plugin) and TestPostSaving* (sm-forum-plugin) pin: no listener gives byte-identical responses and stored rows; a rejecting listener on create, reply, ReplyTo and edit (chat) and thread, reply and edit (forum) gives 422 under the Rejection's field, writes and changes nothing, fires no post-save event and publishes nothing; a non-Rejection listener error keeps the 500 path; the existing php_method_map and golden tests pass unedited.
D-17: TestMatch*, TestParseList and TestFilterCheck* (sm-moderation-plugin) pin case-insensitive word and phrase matching with Unicode letter boundaries (Polish letters, digits, underscores), host, subdomain, www and scheme-less link matching, URL-prefix entries, the disabled switch, the recompile-on-change cache, the list limits in BeforeValidate and the locale fallback of the message; TestDemoModeration pins the demo wiring end to end through HTTP.
D-06, D-07, D-08, D-22: TestDemoChatContext*, TestDemoChannelAdapter, TestDemoChannelsSeededOnly, TestDemoChatBootstrap, TestDemoChatMembers, TestDemoDMs and TestDemoModeratorDelete pin membership (banned and deleted users excluded with live membership), the channel alias, refused channel creation, the bootstrap and members JSON shapes, DMs between any members, and moderator deletion limited to channel conversations.
D-11, D-12, D-23: TestDemoVideoStart pins that a DM call starts with a token and livekit_url against a fake RoomService and that the server does not refuse by conversation type (calls are limited to DMs by the UI); the vue-chat-layer tests pin that the conversation-actions slot renders only for DMs.
D-05: TestDemoCommands pins the catalog entries demo and tour and their ephemeral dispatch; the layer tests pin the command picker's dispatch path.
D-09: TestSeedChat pins EN and PL channels, threads, reactions, pins, forum categories and posts, friendships and the group, and idempotency; TestResetKeepsPlans pins that every chat-family table is emptied and reseeded and that moderation settings survive.
D-01, D-02, D-04: bm's chatEvents, chatFormat, chatText, chatUnread and realtime tests run under vitest in vue-chat-layer with only import paths changed, next to new tests for the multi-channel store, threads, pins, link embeds, the client's refresh-and-retry and the anonymous no-bootstrap path.
D-13, D-14, D-15, D-21: the chatvideo machine and useCall (mocked livekit-client Room) tests, and the forum and friends client tests pass under their layers' test scripts.
SC-2: locally, scripts/check-local.sh chatlive callmedia passes: two browsers see each other's channel message live, and a DM call shows each side a playing remote video with fake media through the local LiveKit.
SC-2, SC-3: scripts/check-all.sh (including check-live against https://demo.summercms.io) prints check-all: ok, and the user confirms a two-browser chat and a DM call on the live demo.
path provides contains
../sm-moderation-plugin/classes/filter_test.go TestMatch*, TestParseList, TestFilterCheck* TestMatch
path provides contains
../sm-chat-plugin/saving_test.go TestMessageSaving* TestMessageSaving
path provides contains
../sm-forum-plugin/saving_test.go TestPostSaving* TestPostSaving
path provides contains
../sm-demo-app/chat_test.go TestDemoChat*, TestDemoChannelsSeededOnly, TestDemoDMs, TestDemoModeratorDelete, TestDemoCommands TestDemoChannelsSeededOnly
path provides contains
../sm-demo-app/video_test.go TestDemoVideoStart with a fake RoomService TestDemoVideoStart
path provides contains
../sm-demo-app/scripts/check-chat.cjs two-browser realtime and DM call checks use-fake-device-for-media-stream
path provides contains
../vue-chat-layer/tests/store.test.ts multi-channel store, threads, pins, commands describe
from to via pattern
../sm-demo-app/scripts/check-all.sh ../sm-demo-app/scripts/check-live.sh the gate runs every suite, the layers and the chat-family plugins, then check-live check-live.sh
from to via pattern
../sm-demo-app/scripts/check-local.sh ../sm-demo-app/scripts/check-chat.cjs check_chatlive and check_callmedia run the Playwright script with two contexts check-chat.cjs
from to via pattern
../sm-demo-app/moderation_test.go ../sm-demo-app/plugins/demo/moderation.go HTTP send with a banned word answers 422 through the demo listener and the moderation Filter 422
statement status verification
Tests use no real secret, no production database and no network service except the Docker Postgres, the local dev stack and in-process fakes. unresolved judgment
statement status verification
No production behaviour changes in this plan except fixes for bugs the tests expose, within Task 7's fix budget (small, no feature, schema or contract change, at most one patch tag per repository and one redeploy), each in its own commit, named in the SUMMARY, and released through the Task 6 checkpoint; the app-wiring extraction in vue-demo-app is behaviour-preserving. unresolved judgment
statement status verification
Test-only commits in plugin and layer repositories get no tag; nothing is pushed before the Task 6 go-ahead. unresolved judgment

Phase Goal

ROADMAP Goal (not in user-story format; no story is invented here): SC-4 says the new code has unit tests, delivered in the phase's last plan. The live demo shows the chat family working.

This plan's slice (plan 6 of 6, wave 6, per D-20 and the project rule that unit tests are the last plan): unit tests for everything plans 01 to 05 built, in Go, the four layers and the site, then a local two-browser chat and call check and the live verification, ending with the user's look at the live demo.

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

  • Where tests live:
    • plugin seam tests next to the plan 01 smoke tests;
    • the demo's database tests in the root package (they compile every plugin through PluginIDs and the shared Postgres harness, as 19.4.1 did), with pure demo classes tested in plugins/demo/classes;
    • bm's chat tests next to the ported sources in vue-chat-layer/app/lib (copied with only import paths changed, the 19.4.1 vue-demo-app pattern), new layer tests in tests/.
  • Fake LiveKit: TestDemoVideoStart points golem15.chatvideo.livekit_admin_url at an httptest server answering the Twirp RoomService calls Start makes (CreateRoom, and ListParticipants if used), so chatvideo's real code path runs without a LiveKit.
  • useCall test: livekit-client is replaced with vi.mock of a minimal Room (connect, disconnect, localParticipant setters, event emitter). The real SDK is exercised by check-chat.cjs against the local LiveKit with fake media.
  • Site tests: the hook factories in vue-demo-app's app/plugins/auth.ts (token, refresh and unauthorized for chat; token getters; the friends directory mapping) move unchanged into app/utils/communityAuth.ts, so vitest can test them without Nuxt.
  • spec-less probe fallback skipped: phase has no requirement IDs to probe (visible skip).

Artifacts this phase produces (this plan)

  • Go tests:
    • sm-moderation-plugin TestMatchWords, TestMatchLinks, TestParseList, TestFilterCheckCache, TestFilterCheckDisabled, TestSettingsLimits, TestBootPublishesFilter;
    • sm-chat-plugin TestMessageSavingNoListener, TestMessageSavingRejects, TestMessageSavingOtherError;
    • sm-forum-plugin TestPostSavingNoListener, TestPostSavingRejects;
    • sm-demo-app TestDemoModeration, TestDemoChatContext*, TestDemoChannelAdapter, TestDemoChannelsSeededOnly, TestDemoChatBootstrap, TestDemoChatMembers, TestDemoDMs, TestDemoModeratorDelete, TestDemoCommands, TestDemoVideoStart, TestSeedChat, extended TestResetKeepsPlans, TestRealtimeRoutes, TestRealtimeMemberToken, TestBootAllPlugins.
  • Layer tests: vue-chat-layer (ported bm tests plus store.test.ts, client.test.ts, linkEmbeds.test.ts), vue-chatvideo-layer (callMachine, videoClient, useCall), vue-forum-layer and vue-userfriends-layer client tests.
  • Site: app/utils/communityAuth.ts with its test.
  • Scripts: check-chat.cjs modes --two (realtime) and --call (fake media); check-local checks chatlive and callmedia; check-all.sh steps for the chat-family plugins and the four layers.
Cover the phase's new code with unit tests, prove two-browser chat and DM calls locally, and verify the live demo with the user.

Purpose: SC-4 (unit tests in the last plan) and the live proof of SC-2 and SC-3 for every decision the phase implemented. Output: test commits in eight Go and five frontend repositories, script commits in sm-demo-app, pushes after the go-ahead, and the user's sign-off on the live demo.

<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-VALIDATION.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-RESEARCH.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-01-SUMMARY.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-02-SUMMARY.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-03-SUMMARY.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-04-SUMMARY.md @.planning/phases/20-demo-instance-with-every-shared-plugin/20-05-SUMMARY.md

Repos: ../sm-moderation-plugin, ../sm-chat-plugin, ../sm-forum-plugin, ../sm-demo-app (root tests, plugins/demo, scripts), ../sm-demo-app/vue-demo-app, ../vue-chat-layer, ../vue-chatvideo-layer, ../vue-forum-layer, ../vue-userfriends-layer. bm test sources (read-only): ../sm-bm-app/frontend/src/lib/{chatEvents,chatFormat,chatText,chatUnread,realtime}.test.ts and stores/chat.test.ts.

Rules: no co-author tags; stage by explicit path; Docker tests skip under -short and the TestMain calls flag.Parse and testing.Short (CLAUDE.md); if the Docker socket is denied, run through sudo -u golem; production code changes only for bugs the tests expose and only within the fix budget in Task 7 (own commit each, named in the SUMMARY; anything larger becomes a todo and decimal-phase candidate); nothing is pushed before Task 6.

sm-demo-app test harness: testmain_test.go `bootDemo(t, environ, set) *demotest.Demo`; internal/demotest (App, DB, Options{PluginIDs, Environ, Set}); existing tests TestGoModRequiresTags, TestBootAllPlugins (wantPlugins), TestRealtimeRoutes (realtimeApp, realtimeRoutes, wantNamespaces), TestResetKeepsPlans, TestSeedRoadmapUpsert; smoke tests from plan 02: TestDemoChatTracer, TestDemoModerationSmoke, TestSeedChatSmoke (chat_smoke_test.go). Plugin harnesses: chat bootWeb, frontendToken, call, conversation, count, memory (lighthouse MemoryDriver publications); forum bootWeb, call, count; plan 01 smoke tests TestMessageSavingTracer, TestPostSavingTracer, TestFilterSmoke. Demo classes (plan 02): DemoContext, ChannelContext, ChatAccess, ForumAccess with WithMembership and MemberFunc injection; chat_api.go bootstrap and members; chatbots.go demo and tour; moderation.go listeners; realtime_access.go guard. Layers (plans 03 and 04): vue-chat-layer createChatClient, useChat, linkify, registerEmbedRenderer, onUserEvent, slots; vue-chatvideo-layer callMachine (initialCallState, transition), createVideoClient, videoSessionChannel, useCall; createForumClient; createFriendsClient. Scripts: check-local.sh (visitor_jwt, throwaway registration helper, ALL_CHECKS, NODE_PATH="$(npm root -g)" for Playwright scripts), check-chat.cjs (plan 03 single-browser), check-all.sh (steps, "check-all: ok"). Task 1: Tracer: one banned word travels from the admin settings through the filter, the demo listener and the chat seam to a 422 in a member's request, under test `docker info` exits 0; the plan 05 SUMMARY exists. ../sm-moderation-plugin/classes/filter_test.go, ../sm-demo-app/moderation_test.go ../sm-moderation-plugin/classes/filter.go and filter_smoke_test.go, ../sm-demo-app/plugins/demo/moderation.go, ../sm-demo-app/chat_smoke_test.go (TestDemoModerationSmoke), ../sm-demo-app/testmain_test.go, 20-VALIDATION.md (D-17 rows) Per D-17, D-18, SC-4. - sm-moderation-plugin classes/filter_test.go, table tests for the pure functions: - TestMatchWords: case-insensitive; a word inside a longer word does not match; phrases; Polish letters on both sides of a boundary (for example "żółw" against "żółwik" and "żółw!"); digits and underscores count as word characters; QuoteMeta'd specials such as "c++". - TestMatchLinks: a host entry matches the bare domain, www., http and https URLs, subdomains, upper case and trailing paths; "notbad.example" does not match "bad.example"; a URL-prefix entry matches only below its path. - TestParseList: trims, lowercases, drops empty lines and duplicates. - sm-demo-app moderation_test.go `TestDemoModeration` (Docker), end to end through HTTP: - after demo:seed, update golem15_moderation_settings with banned_words "blockedword" and banned_links "bad.example"; - a member's message, reply and edit containing either answer 422 with errors.content, and the message count does not change; - a forum thread title answers 422 errors.title and a reply body 422 errors.body; - after changing the list to another word without restarting, the old word is accepted (cache refresh); - with enabled false, everything is accepted.

Commit per repository (test: ...). go -C ../sm-moderation-plugin test -count=1 ./... && go -C ../sm-demo-app test -count=1 -run '^TestDemoModeration$' -v . 2>&1 | grep -q -- '^--- PASS: TestDemoModeration' <fails_when>Non-zero exit from the moderation suite (a boundary, host or cache case wrong), or no "--- PASS: TestDemoModeration" line (skipped without Docker, banned content stored, or a list change not picked up).</fails_when> <acceptance_criteria> - grep -c '^func TestMatch' ../sm-moderation-plugin/classes/filter_test.go prints at least 2. - grep -c 'żółw' ../sm-moderation-plugin/classes/filter_test.go prints at least 1. </acceptance_criteria> The D-17/D-18 chain is pinned from the settings row to the HTTP answer.

Task 2: Seam and moderation plugin unit tests: parity without a listener, refusals on every write path ../sm-chat-plugin/saving_test.go, ../sm-forum-plugin/saving_test.go, ../sm-moderation-plugin/models/settings_test.go, ../sm-moderation-plugin/plugin_test.go ../sm-chat-plugin/saving_smoke_test.go, http_tracer_test.go, harness_test.go (memory driver), classes/attachments.go (ReplyTo), ../sm-forum-plugin/saving_smoke_test.go, http_tracer_test.go, ../sm-moderation-plugin/models/settings.go, plugin.go, updates/*.go, ../sm-sitemap-plugin/models/definition_test.go (settings test style) Per D-18, D-17. - sm-chat-plugin saving_test.go: - TestMessageSavingNoListener: the same send, reply, edit and ReplyTo requests answer the same status and body keys as before the seam, and MessageCreated and MessageUpdated still fire; - TestMessageSavingRejects: table over send, reply (POST replies), ReplyTo (service) and edit. Each gives 422 under the Rejection field (and "content" when the field is empty), no row inserted or changed, no MessageCreated or MessageUpdated fired (a counting listener), and no publication on the memory driver; - TestMessageSavingOtherError: a plain error from a listener gives 500 with the generic body and nothing stored; - the event carries Op, ConversationID, ActorID, RootID, MessageID and the trimmed Content. - sm-forum-plugin saving_test.go: TestPostSavingNoListener and TestPostSavingRejects over thread, reply and edit (field title or body, nothing stored, content_html unchanged on a refused edit, Op values). - sm-moderation-plugin: - models/settings_test.go TestSettingsLimits: too many entries, too long entries and a bad link entry refused with their lang keys; valid lists saved; - plugin_test.go TestBootPublishesFilter (Docker, with the sitemap-style harness): migrations create the singleton row, Boot publishes *classes.Filter, and Check on a clean text gives nil. Keep php_method_map_test.go and golden_test.go untouched in both content plugins. Commit per repository. go -C ../sm-chat-plugin test -count=1 ./... && go -C ../sm-forum-plugin test -count=1 ./... && go -C ../sm-moderation-plugin test -count=1 ./... && go -C ../sm-chat-plugin test -count=1 -run '^TestMessageSaving' -v . 2>&1 | grep -c -- '^--- PASS: TestMessageSaving' | grep -qvx '[0-2]' Non-zero exit from any of the three suites (parity broken, a write path that bypasses the seam, an event fired after a refusal), or fewer than three passing TestMessageSaving* lines (tests skipped without Docker). - `git -C ../sm-chat-plugin diff HEAD~1 --stat -- php_method_map_test.go golden_test.go` and the same in ../sm-forum-plugin print nothing. - `grep -c 'ReplyTo' ../sm-chat-plugin/saving_test.go` prints at least 1. The seams' contract (silent without listeners, total refusal with one) and the moderation plugin's settings and boot are pinned. Task 3: Demo host unit tests: context, adapter, bootstrap, DMs, moderator delete, commands, video start, realtime, seed and reset ../sm-demo-app/plugins/demo/classes/chat_context_test.go, ../sm-demo-app/plugins/demo/chatbots_test.go, ../sm-demo-app/chat_test.go, ../sm-demo-app/video_test.go, ../sm-demo-app/seed_chat_test.go, ../sm-demo-app/reset_test.go, ../sm-demo-app/realtime_test.go, ../sm-demo-app/boot_test.go ../sm-demo-app/plugins/demo/{chat.go,chat_api.go,chatbots.go,moderation.go,realtime_access.go,routes.go,classes/chat_context.go,classes/forum_access.go,console/seed_chat.go,console/seed_forum.go,console/seed_friends.go,console/reset.go}, ../sm-demo-app/{chat_smoke_test.go,demo_api_test.go,realtime_test.go,reset_test.go,seed_test.go,boot_test.go,testmain_test.go}, ../sm-demo-app/plugins/golem15/chatvideo/classes/livekit.go (RoomAPI, NewProductionRooms, FakeRooms) and boot.go, ../sm-bm-app/realtime_test.go, 20-VALIDATION.md Per D-05, D-06, D-07, D-08, D-09, D-11, D-12, D-22, D-23, SC-1. - plugins/demo/classes/chat_context_test.go (pure, with WithMembership and MemberFunc stubs): constants, BroadcastChannel never empty for either alias, CanModerateMessage only for moderator-group members in non-DM conversations, RequireLiveMembership true, ChatAccess CanManageContext always false and CanAccessContext only for demo/1 members, ForumAccess read, post and manage rules. - plugins/demo/chatbots_test.go: TestDemoCommands. Triggers demo and tour, IsAvailable false for actor 0, Handle returns an ephemeral result whose text lists the site paths. - chat_test.go (Docker), with a seeded demo and members created in the test: - TestDemoChatContextMembership: a banned user and a deleted user are not members; a member banned after joining loses access at the next request (live membership); - TestDemoChannelAdapter: the conversation of each seeded channel resolves through the channel alias; - TestDemoChannelsSeededOnly: POST channels is refused, join and leave work; - TestDemoChatBootstrap: the JSON keys and types of /_demo/api/v1/chat for a member, {member: false} for a non-member, 401 without a JWT; - TestDemoChatMembers: excludes the caller and personas count as members; - TestDemoDMs: any two members open a DM, and opening it again returns the same id; - TestDemoModeratorDelete: a moderator-group member deletes another member's channel message (200) but not a DM message of others (404); a plain member gets 404; - TestDemoCommands over HTTP: GET /_chatbots/api/v1/commands lists demo and tour; POST dispatch "/demo" answers mode ephemeral; "/nope" answers 422 errors.input. - video_test.go (Docker) TestDemoVideoStart: an httptest server answers the Twirp RoomService calls chatvideo's RoomAPI makes, with livekit_admin_url pointing at it and test keys in the environment. POST /_chatvideo/api/v1/conversations/{dm}/video/start answers 2xx with token and livekit_url, the token's claims grant the room for that user, and a second start returns the same session. A start in a seeded channel conversation is not refused by type (D-23 UI-only); assert the status the plugin gives with the channel's participant count and max_participants 4, and record it. - realtime_test.go: TestRealtimeRoutes keeps the middleware list from plan 02. New TestRealtimeMemberToken (Docker): a member's JWT gives 200 with a token, a banned user's gives 403 (or the guard's documented status), no JWT gives 401. - seed_chat_test.go TestSeedChat: exact counts per EN and PL channel, threads with replies and summary rows consistent, reactions, pins, three forum categories with content_html, friendships, the group, the visitor's DM and pending request when the visitor is set, the moderator group, and idempotency (every new step reports exists on the second run). - reset_test.go: TestResetKeepsPlans also asserts that every chat-family table named in resetTables is empty after the wipe and repopulated after the reseed, and that golem15_moderation_settings and the userfriends context row are unchanged. - boot_test.go: the chat-family route prefixes, and jwt.auth on GET /_demo/api/v1/chat and /chat/members. Commit `test: demo chat family`. go -C ../sm-demo-app vet . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -run '^(TestDemoChannelsSeededOnly|TestDemoVideoStart|TestSeedChat|TestResetKeepsPlans|TestRealtimeMemberToken)$' -v . 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 5 Non-zero exit or a FAIL line from the full app suite, or fewer than five "--- PASS" lines for the named tests (skipped without Docker, a refused channel create that succeeds, a video start error against the fake RoomService, a seed count mismatch, or a reset leaving chat rows). - `grep -c '^func Test' ../sm-demo-app/chat_test.go` prints at least 7. - `go -C ../sm-demo-app test -count=1 -short . ./plugins/demo/...` passes without Docker. Every demo host decision of the phase is pinned by a unit or database test. Task 4: Layer and site unit tests: bm's chat tests on the layer, new store and client tests, the call machine and the app wiring ../vue-chat-layer/vitest.config.ts, ../vue-chat-layer/app/lib/chatEvents.test.ts, ../vue-chat-layer/app/lib/chatFormat.test.ts, ../vue-chat-layer/app/lib/chatText.test.ts, ../vue-chat-layer/app/lib/chatUnread.test.ts, ../vue-chat-layer/app/lib/realtime.test.ts, ../vue-chat-layer/app/lib/linkEmbeds.test.ts, ../vue-chat-layer/tests/client.test.ts, ../vue-chat-layer/tests/store.test.ts, ../vue-chatvideo-layer/tests/callMachine.test.ts, ../vue-chatvideo-layer/tests/videoClient.test.ts, ../vue-chatvideo-layer/tests/useCall.test.ts, ../vue-forum-layer/tests/client.test.ts, ../vue-userfriends-layer/tests/client.test.ts, ../sm-demo-app/vue-demo-app/app/utils/communityAuth.ts, ../sm-demo-app/vue-demo-app/app/utils/communityAuth.test.ts, ../sm-demo-app/vue-demo-app/app/plugins/auth.ts, ../sm-demo-app/vue-demo-app/app/lib/realtime.test.ts ../sm-bm-app/frontend/src/lib/{chatEvents,chatFormat,chatText,chatUnread,realtime}.test.ts and stores/chat.test.ts, ../sm-bm-app/frontend/vite.config.ts (its test block), ../vue-chat-layer/app/lib/*.ts, app/composables/useChat.ts, tests/smoke.test.ts, ../vue-chatvideo-layer/app/lib/*.ts and app/composables/useCall.ts, ../vue-forum-layer/app/utils/forumClient.ts, ../vue-userfriends-layer/app/utils/friendsClient.ts, ../sm-demo-app/vue-demo-app/app/plugins/auth.ts, vitest.config.ts, app/lib/realtime.test.ts Per D-01, D-02, D-04, D-05, D-13, D-14, D-15, D-21, D-23. - vue-chat-layer: - vitest.config.ts includes app/**/*.test.ts and tests/**/*.test.ts in the node environment, with aliases so bm's tests run with only import paths changed; - copy bm's chatEvents, chatFormat, chatText, chatUnread and realtime tests next to the ports; - linkEmbeds.test.ts: linkify escapes, only http(s), rel and target set, the registry order, max_embeds; - client.test.ts: every endpoint's URL and method, 401 refresh-and-retry once, unauthorized after a failed refresh, the 422 mapping, multipart upload; - store.test.ts (bm's chat.test.ts rewritten for the useState composable, with a fake client and a fake realtime): - the bootstrap fills channels and DMs; an empty hostApiBase starts nothing; a non-member bootstrap starts nothing (D-04); - opening a channel lazy-joins; a realtime message increments unread in other conversations and appends in the open one; - thread replies and counts, pins load, reactions toggle; - a "/" input dispatches instead of posting and the ephemeral answer stays local (D-05); - polling starts when realtime is unavailable; - onUserEvent receives a video:* event the store does not handle; - the conversation-actions slot renders only for DMs (mount ChatHeader with @vue/test-utils only if it is already in the workspace lockfiles, else test the computed visibility helper the header uses). - vue-chatvideo-layer: - callMachine.test.ts: every transition, including failure reasons; - videoClient.test.ts: URLs, auth, videoSessionChannel; - useCall.test.ts: vi.mock livekit-client with a fake Room; start, connect, a remote track event adds a tile, mute and camera toggles call the local participant, leave disconnects and posts leave, an ended event on the session channel ends the call, and a 422 start fails with the too-many reason. - vue-forum-layer and vue-userfriends-layer: extend the client tests to every method and error mapping. - vue-demo-app: move the hook factories from app/plugins/auth.ts unchanged into app/utils/communityAuth.ts (`createChatAuth`, `tokenGetter`, `friendsDirectory`). auth.ts imports them. communityAuth.test.ts covers the token read, refresh storing the new token, unauthorized clearing the cookie, and the directory mapping. app/lib/realtime.test.ts still passes through the re-export. Commit per repository (`test: ...`; the vue-demo-app extraction as `refactor: community auth hooks into app/utils` before its test commit). pnpm --dir ../vue-chat-layer test && pnpm --dir ../vue-chatvideo-layer test && pnpm --dir ../vue-forum-layer test && pnpm --dir ../vue-userfriends-layer test && pnpm --dir ../sm-demo-app/vue-demo-app test && pnpm --dir ../sm-demo-app/vue-demo-app run build Non-zero exit from any layer's test script, the vue-demo-app vitest suite, or the app build after the hook extraction. - `ls ../vue-chat-layer/app/lib/*.test.ts | wc -l` prints at least 6. - `diff <(sed -n '/^describe/,$p' ../sm-bm-app/frontend/src/lib/chatText.test.ts) <(sed -n '/^describe/,$p' ../vue-chat-layer/app/lib/chatText.test.ts)` prints nothing (only imports differ). - `grep -c "vi.mock('livekit-client'" ../vue-chatvideo-layer/tests/useCall.test.ts` prints 1. - `grep -c 'from .*communityAuth' ../sm-demo-app/vue-demo-app/app/plugins/auth.ts` prints 1. The four layers and the site's wiring are covered by unit tests, with bm's chat tests running unchanged on the port. Task 5: Two browsers locally: live channel messages and a DM call with fake media, and the phase gate in check-all `../sm-demo-app/scripts/dev.sh up` runs with LiveKit on 127.0.0.1:7890; the global Playwright resolves (`NODE_PATH="$(npm root -g)" node -e "require('playwright')"` exits 0). ../sm-demo-app/scripts/check-chat.cjs, ../sm-demo-app/scripts/check-local.sh, ../sm-demo-app/scripts/check-all.sh, ../sm-demo-app/README.md ../sm-demo-app/scripts/check-chat.cjs (plan 03), check-remote.cjs, lib/browser.cjs, check-local.sh (visitor_jwt, throwaway registration helper, check_remote), check-all.sh (steps and plugin dirs), README.md (checks section) Per SC-2, D-11, D-13, D-23. - check-chat.cjs: add `--two` and `--call` modes. Each launches Chromium with `--use-fake-ui-for-media-stream` and `--use-fake-device-for-media-stream` and opens two contexts with two JWTs (DEMO_JWT and DEMO_JWT2). - `--two`: both open /chat#general; A sends a unique text; B sees it within 10 s without reload; B reacts and A sees the reaction; B types and A sees the typing indicator. - `--call`: A opens a DM with B (POST /_chat/api/v1/contexts/demo/1/dm through page.request with A's token) and opens it on /chat. The DM header shows the call button and no call button shows in #general (D-23). A clicks it; B's page shows the incoming prompt within 10 s and accepts. Both call pages reach the connected state and each shows one remote tile whose video element has videoWidth above 0 within 20 s. A mutes and B sees the muted marker if the tile shows one. Both leave and the session ends (GET status). - Print `check-chat: ok two` or `check-chat: ok call`. - check-local.sh: `check_chatlive` and `check_callmedia` take the visitor JWT and a throwaway user's JWT, run the script in the matching mode, and join ALL_CHECKS and the header list. - check-all.sh, new steps after the existing plugin suites: - `go test ./...` in ../sm-chat-plugin, ../sm-forum-plugin and ../sm-moderation-plugin, and `go test -short ./...` in chatchannels, chatbots, chatvideo, herald and userfriends (directories overridable by env, as USER_PLUGIN_DIR is); - `pnpm test` in the four layer checkouts (overridable); - the local browser step runs `check-local.sh chatlive callmedia` alongside back and remote. Update the header comment and README's checks section. Commit `test: two-browser chat and call checks; phase gate covers the chat family`. ../sm-demo-app/scripts/check-local.sh chat chatlive callmedia forum friends call herald tour realtime remote The last line is not "check-local: ok ..." listing the checks; a "check-local: chatlive failed" or "callmedia failed" line (message not delivered live, no incoming prompt, no remote video within 20 s, or a call button in a channel) or any other named check failing. - `grep -c 'use-fake-device-for-media-stream' ../sm-demo-app/scripts/check-chat.cjs` prints at least 1. - `grep -cE 'chatlive|callmedia' ../sm-demo-app/scripts/check-local.sh` prints at least 4. - `grep -c 'sm-moderation-plugin' ../sm-demo-app/scripts/check-all.sh` prints at least 1. Two-browser realtime chat and a DM video call are proven automatically on the local stack, and the phase gate runs every new suite. Task 6: Go-ahead to push the test commits (and to release fixes if the tests found bugs) Claude's table: per repository the unpushed commits (`git log origin/..HEAD --oneline`), which are test-only and which are fixes; for each fix, the proposed patch tag (next free number from the remote) and the pin bumps and redeploy it needs (plan 05 runbook); failures outside Task 7's fix budget are listed as todos, not as fixes - The user chose one option and it is recorded in the SUMMARY. Push the test commits, and tag and redeploy fixes if there are any? Test-only commits get no tag (19.4.1 precedent). A production fix in a shared plugin or layer needs a new patch tag (one-way), a go.mod or package.json pin bump in the demo and a redeploy through DEPLOY.md; the table lists each case. If there are no fixes, this only pushes. Push (and release the listed fixes) Tests are on origin; any fix reaches the live demo before the final check. Fix tags are permanent. Push test commits only No new tags. Listed fixes stay local and the live demo keeps the bug. Hold Nothing leaves this machine. check-all's suites still run locally, but origin lacks the tests. Reply "push", "push-tests-only" or "hold". Task 7: Push, release any fixes, and run the phase gate against the live demo Only when fixes are released: their patch tags are cached by module proxies and lockfiles. Task 6 answered "push" or "push-tests-only". ../sm-demo-app/README.md The Task 6 table and answer, ../sm-demo-app/DEPLOY.md (Release, Verify) Per SC-2, SC-3, SC-4. - Push the test commits of every repository (plugins and layers first, then vue-demo-app, then sm-demo-app). - For "push" with fixes, in one release batch: - tag each fixed plugin or layer with the next patch (annotated, on the verified HEAD) and push; - bump the demo's go.mod (GOWORK=off go get) or package.json pins in one `chore: bump to ` commit each; - push vue-demo-app before the sm-demo-app pointer bump; - release on rome through DEPLOY.md. - Run `scripts/check-all.sh --local` (every suite, the browser checks, check-live). Fix a failure only within the fix budget below, then run it again. Do not loop past the budget. - Fix budget. It bounds the whole plan: fixes made in Tasks 1 to 5, in this task and for the Task 8 findings. - Source: a fix is allowed only for a failure found by this plan's own tests or checks (Tasks 1 to 5, check-all, check-live, the Task 8 UAT). - Size: each fix is small. It adds no feature, changes no schema or migration, and changes no API route, payload, event, config key, hook, prop or other published contract. - Release: at most one new patch tag per affected repository and at most one redeploy on rome in this plan. Every in-budget fix goes into that one release batch. Under "push-tests-only", fixes are committed but not tagged or deployed, and each one is recorded as a todo. - After the release: a fix that needs no tag or redeploy (a check script or a test in sm-demo-app) is still allowed if it is small. Anything that needs a second tag of the same repository or a second redeploy is outside the budget. - Outside the budget: do not fix it in this plan. Record it as a todo in `.planning/todos/pending/` with its g15office task (`.planning/G15OFFICE.md` rules). List it in the SUMMARY as a decimal-phase candidate (for example `/msd-phase --insert 20.1`). Leave the check-all result as it is, and stop at Task 8's checkpoint with the open failures listed for the user. - Record in README's checks section what the gate now covers. ../sm-demo-app/scripts/check-all.sh --local 2>&1 | tail -1 | grep -qx 'check-all: ok' The last line is not "check-all: ok" (a suite, the release build, check-pins, smoke, check-deploy, a browser check or check-live failed; the failing step is named in its own "check-all: failed" line). A failure outside the fix budget keeps this red: it is recorded as a todo and the plan stops at Task 8 instead of fixing further. - For each repository touched in this plan, `git ls-remote origin` shows the default branch at the local HEAD (or the SUMMARY records the "hold" answer). - Any fix tag equals its pushed HEAD and the demo pins it (`check-pins.sh` prints `check-pins: ok`). - The fix budget held. The SUMMARY lists every production fix with its commit and the failure that found it, every tag created in this plan (no repository twice), and at most one DEPLOY.md release. `git -C show --stat ` for each listed fix touches no migration (`updates/`) and no parity test file (`php_method_map_test.go`, `golden_test.go`). - Either the last line of check-all is `check-all: ok`, or every remaining failure is recorded as a todo in `.planning/todos/pending/` with a `g15office:` ID and named as a decimal-phase candidate in the SUMMARY, and execution stopped at Task 8 with those failures shown to the user. Every test is on origin, every in-budget fix is live, and the phase gate is green against the live demo, or each remaining failure is recorded as a todo and decimal-phase candidate for the user at Task 8. Task 8: The user checks chat and a DM video call on the live demo with two browsers The Task 7 check-all output, ../sm-demo-app/DEPLOY.md (Verify), 20-VALIDATION.md (Manual-Only Verifications) - The user replied "approved". Or each issue they listed was fixed within Task 7's fix budget (released in the plan's one release batch only if it is still unused, check-live green again) and the user approved. Or the issues outside the budget are recorded as todos and decimal-phase candidates in the SUMMARY and the user approved closing the plan with them open. https://demo.summercms.io with chat (channels, DMs, threads, pins, reactions, attachments, slash commands, floating panel), forum, friends and DM video calls through the demo's own LiveKit, moderation of banned words and links, EN and PL, and the tour cards. Anonymous visitors get register prompts on /chat and /forum. 1. Browser A: log in as the visitor (DEMO_VISITOR_EMAIL; the password is SUMMER_GOLEM15__DEMO__VISITOR__PASSWORD in /srv/summercms-demo/.env on rome). Browser B (another profile or device on a different network if possible, for example a phone on mobile data): register a new account. 2. Both open /chat, then #general. Send a message from A and see it arrive in B without reloading. Reply in a thread, react, and pin if allowed. Type "/demo" and see the answer only in your own window. 3. Add a banned word in the admin (log in at /smbackend with the admin credentials in /root/summercms-demo-admin.txt on rome, Settings › Moderation), then send a message containing it: it is refused with a message. Remove the word again. 4. From A, open a DM with B's account and press the call button (it must not appear in #general). In B, accept the prompt. Both see and hear each other; mute, toggle the camera, then leave. 5. Check /forum and /friends as a member and anonymously (register prompt), the floating chat panel on /blog, and the Polish language switch. Reply "approved", or describe what is wrong.

<threat_model>

Trust Boundaries

Boundary Description
test harnesses to Docker Postgres and local services test data only, no production systems
browser checks to the local and live demo throwaway accounts, the visitor credentials from .env
build machine to origin and rome (fix releases only) tags and releases after the go-ahead

STRIDE Threat Register

Threat ID Category Component Severity Disposition Mitigation Plan
T-20-35 Information disclosure credentials in tests and check output medium mitigate tests use generated users and test keys; check scripts read the visitor password from .env and never print it; the live UAT names the .env key, not the value
T-20-36 Tampering regressions hiding behind skipped tests medium mitigate verify commands count "--- PASS" lines so a Docker-less skip fails the gate; check-all runs full (non-short) suites
T-20-37 Denial of service throwaway accounts on the live demo low accept the live check registers no accounts (check-live is read-only); the human UAT creates one, removed by the reset job
T-20-SC Tampering npm/pip/cargo installs high mitigate no new package: tests use vitest 3.2.7 and the existing workspace pins; @vue/test-utils only if already in a lockfile (otherwise the helper is tested directly); Playwright is the existing global install
</threat_model>
- Task 1: moderation suite and TestDemoModeration. - Task 2: chat, forum and moderation suites with Docker; parity tests unedited. - Task 3: sm-demo-app full suite plus the named database tests. - Task 4: four layer suites, vue-demo-app vitest and build. - Task 5: check-local with the two-browser chat and call checks. - Task 6: push and fix-release decision recorded. - Task 7: check-all --local prints check-all: ok against the live demo. - Task 8: the user approves the live demo.

<success_criteria> SC-4: the phase's new code is unit-tested in its last plan. SC-2 and SC-3 are proven live, automatically through check-all and check-live and by the user through a two-browser chat and a DM video call on https://demo.summercms.io. </success_criteria>

Create `.planning/phases/20-demo-instance-with-every-shared-plugin/20-06-SUMMARY.md` when done: the test names per repository, bugs found and fixed (commits and tags), what TestDemoVideoStart recorded for a channel start, the check-all output, both checkpoint answers and the user's UAT notes.