docs(31): research drift since 2026-11-13

This commit is contained in:
Jakub Zych
2026-11-22 11:01:09 +01:00
parent e41af40dc2
commit 854e198a29

View File

@@ -1,6 +1,6 @@
# Phase 31: Chat polish against WavePath clients - Research
**Researched:** 2026-11-13
**Researched:** 2026-11-13 (drift re-check 2026-11-22: see "Drift since 2026-11-13"; statements made false by the drift carry an inline `[DRIFT 2026-11-22: …]` mark)
**Domain:** PHP-to-Go API parity (tide record and replay), WinterCMS community plugins, Centrifugo, LiveKit, web push
**Confidence:** MEDIUM (code facts are HIGH; everything that needs a running PHP stack is not observed, because this research started no server)
@@ -84,16 +84,270 @@ No requirement IDs are mapped to this phase (the roadmap says TBD). The four suc
## Summary
The corpus is **194 routes** in `routes.php` plus 2 realtime routes of the websockets plugin (196 tracked). 177 are called by the clients, 17 are not. `wavepath-mcp` calls none of them: its ten calls all go to `/api/v1/diary`, `practices`, `trainings`, `stats`, `me` and `state`, which D-09 leaves out. The corpus is recorded from two clients (the SPA with its service worker, and `hubot-wavepath`), not three.
The corpus is **194 routes** in `routes.php` plus 2 realtime routes of the websockets plugin (196 tracked). 177 are called by the clients, 17 are not. `[DRIFT 2026-11-22: at the HEAD snapshot 216 + 2 = 218 tracked, 199 called, 17 not; counts are now derived at recording time, see Drift D2 and D13]` `wavepath-mcp` calls none of them: its ten calls all go to `/api/v1/diary`, `practices`, `trainings`, `stats`, `me` and `state`, which D-09 leaves out. The corpus is recorded from two clients (the SPA with its service worker, and `hubot-wavepath`), not three.
"Thin aliases" understates the work. The `/_wave` handlers in PHP are host controllers that call the shared plugins and then merge a large host layer on top: 10.8k lines of community controllers, about 4.4k lines of host services, 1.5k lines of guest code, 1.1k of notification code and 0.7k of video service. The seven Go plugins cover the plugin half (models, services, access seams) well. The app plugin has to port the host half, about 19k lines of PHP including comments, with around 15 host tables. Fonoteka's 154 routes took three phases (12, 13, 14). This phase is the same order of size and should be split into decimal phases.
`tide` covers the mechanics, but ten gaps block a green replay of this corpus. Three are hard blockers: relative-time strings (`created_at_human`) are compared exactly, broadcast goldens are recorded one step per CLI run, and upstream sidecars cannot hold LiveKit or web-push calls (per-request signed `Authorization`, encrypted or binary bodies). All ten can be closed with generic additions that name no application.
Of the old freeze, only chat moved (`943b712..fbfbcf9`, two commits). The other six shared plugins are pinned at exactly the P19 and P19.1 commits. The `wavepath` plugin was never frozen before, so its whole community surface is new port work.
Of the old freeze, only chat moved (`943b712..fbfbcf9`, two commits). The other six shared plugins are pinned at exactly the P19 and P19.1 commits. `[DRIFT 2026-11-22: chat moved on to fdde2e6 and chatchannels to 1e3cb74; see Drift D1 and D8]` The `wavepath` plugin was never frozen before, so its whole community surface is new port work.
**Primary recommendation:** split into three decimal phases (corpus and harness, messaging, satellites and close-out), close the tide gaps first, record the whole corpus from an isolated MariaDB-backed PHP instance in one unattended run, then port by controller family until the manifest has zero pending.
## Drift since 2026-11-13 (re-checked 2026-11-22)
WavePath moved while no plan ran: the superproject is 986 commits ahead of `7c517191`, the `wavepath` plugin 175 commits ahead of `a08ed0a`. This section says what the 11 plans must absorb. It does not rewrite the sections below; where the drift makes a statement below false, that statement carries an inline `[DRIFT 2026-11-22: …]` mark pointing here.
**Freeze rule (session decision, extends D-12).** The plans stop hardcoding WavePath commits and route counts. Plan 31-05 resolves `wavepath.org` HEAD and every submodule pin when the recording starts and writes them into `manifest.reference`; the route inventory is derived from `routes.php` at that commit by the corpus parser. **Every number in this section is a reference snapshot taken on 2026-11-22, not a new pin.** It tells the planner which classes of change the plans must be ready for, and gives the values a dry run on 2026-11-22 should reproduce.
How this was checked: the same parser approach as the original count (a tokenizer that drops comments and strings, tracks `Route::group` frames by brace depth, and reads each `Route::<verb>(` statement up to its `;` with its `->middleware()` and `->withoutMiddleware()` calls), run over `git show a08ed0a:routes.php` and `git show HEAD:routes.php`. At `a08ed0a` it reproduces the original numbers exactly (273 `Route::` verbs, 194 under the D-09 prefixes), so the HEAD numbers are comparable `[SHELL: python3 -I routes_parse.py < <(git -C …/plugins/golem15/wavepath show a08ed0a:routes.php) → "old 273 194"; same over HEAD → "new 323 216"]`. The parser script lives only in the session scratchpad; plan 31-04's `check_corpus.go` is the real implementation.
### Drift D1: reference snapshot of the pins
Superproject HEAD `56710579f66fe155c3f9cd75bfbd5b4b8f2994e8` ("docs(quick-261121-q61): read state propagates across open sessions", 2026-11-21). The superproject has no modified tracked file (only untracked planning files), every submodule is checked out exactly at its pin (no `+` line in `git submodule status`), and the working trees of `chat`, `chatchannels`, `wavepath`, `user`, `oauthserver`, `vue-wavepath-app` and `hubot-wavepath` are clean `[SHELL: git -C /media/nvme/dev/jz/wavepath.org submodule status; git -C <sub> status --porcelain | wc -l → 0]`. The two "working tree behind its pin" findings of 2026-11-13 (chat at `943b712`, journal at `3fa3bf7`) no longer hold; Pitfall 5 stays relevant as a check.
| Gitlink | Pin at `7c517191` | Pin at HEAD (snapshot) | Moved? |
|---------|------------------|------------------------|--------|
| `plugins/golem15/wavepath` | `a08ed0a34d1a` | `d918ef65585e` | yes, 175 commits |
| `plugins/golem15/chat` | `fbfbcf98e339` | `fdde2e6f09a9` | yes, 5 commits (D3) |
| `plugins/golem15/chatchannels` | `b92fb42a1492` | `1e3cb744bac1` | yes, 4 commits (D3) |
| `plugins/golem15/user` | `d4f779b4633f` | `562aea6be5b3` | yes, 20 commits (D3) |
| `plugins/golem15/oauthserver` | `9beac91fae3a` | `348097ba05d1` | yes, 10 commits (D3) |
| `plugins/golem15/journal` | `92c237a5670c` | `3fa3bf75baa9` | yes (not in the corpus; boots) |
| `plugins/golem15/mattermostimport` | `2cc1a14e1c35` | `0abf6a4344eb` | yes, 41 commits. **Not new**: it was already pinned at the old commit. No routes, no corpus effect |
| `plugins/wavepath/gifs` | absent | `63bae3038297` | **new** |
| `plugins/wavepath/xcapture` | absent | `3d6252d967c7` | **new** |
| `wavepath-plugin-sdk` | absent | `af0e222a5a3d` | **new** (npm package `@wavepath/plugin-sdk` 1.2.0, not loaded by PHP) |
| `vue-wavepath-app` | `5d4541bfbe20` | `5d11c09f89a3` | yes, 469 commits |
| `chatbots`, `chatvideo`, `forum`, `herald`, `userfriends`, `websockets` | — | — | unchanged |
| `hubot-wavepath` `b54586939953`, `wavepath-mcp` `28c6539c77cf` | — | — | unchanged |
`[SHELL: git ls-tree 7c517191 / HEAD over plugins/golem15/ plugins/wavepath/ and the client gitlinks, joined]`. HEAD lists 35 gitlinks in total (desktop and Android clients included) `[SHELL: git ls-tree -r HEAD | awk '$2=="commit"']`. The export in plan 31-03 already walks every gitlink recursively, so it picks the new ones up; the fixed repository lists in 31-03 and 31-05 do not (see D13).
### Drift D2: route inventory at the snapshot
| | `a08ed0a` | HEAD (snapshot) |
|---|---:|---:|
| `Route::` verbs in `routes.php` | 273 | 323 |
| `routes.php` lines | 1087 | 1286 |
| Routes under the D-09 prefixes | 194 | **216** |
| Plus the two realtime routes (websockets, unchanged) | 196 | **218 tracked** |
| Called by a client | 177 | **199** (SPA 195, `hubot-wavepath` 4) |
| Called by no client (D-19) | 17 | **17** (same list) |
| Foundation slice (D-16) | 36 | **36** (34 routes plus 2 realtime; no foundation route added or removed) |
| Pending after Phase 31 | 160 | **182** |
No corpus route was removed. 22 were added, 13 existing ones changed only their throttle (method, path and action unchanged). Per prefix (old → HEAD): `community/groups` 108 → 115, `community/dm` 16 → 23, `community/threads` 1 → 4, `community/forums` 16 → 17, `community/drafts` 0 → 3, `community/calls` 0 → 1; every other prefix is unchanged `[SHELL: parser, per-prefix Counter]`.
Group frames at HEAD (line numbers moved; the route table below cites `a08ed0a` lines): guest `['prefix' => '/_wave/api/v1/guest', 'middleware' => ['bindings']]` at L353-381; JWT API at L383-1137; bot `/api/v1` with `throttle:wave-api-bot` at L1220-1254; `/hooks` at L1271-1277. A new group with prefix `/_wave/api/v1` and middleware `['wave.browser.json', 'wave.cookie.bearer', 'jwt.auth', 'bindings', 'throttle:wave-api']` at L339-346 holds only `security/devices/*`, outside D-09 `[SHELL: grep -n '^Route::group' routes.php; sed -n 335-360p]`. The corpus parser must filter by path prefix first, so this second `/_wave/api/v1` frame cannot leak into the corpus.
Uncalled routes: a partial re-check of the SPA API modules found no new call site for any of the 17 (forum category rename, reorder and delete; channel categories POST/PUT/DELETE, channel `GET {channelId}` (the SPA only `PUT`s it, `api/channelApi.ts:421-425`), restore, mute and unmute (still wrappers over `notify-pref`, `api/channelApi.ts:319-322`); the five notes compatibility routes; webhook ingest; webhook icon) `[SHELL: grep over vue-wavepath-app/src/api/*.ts at 5d11c09]`. The D-07 coverage map stays the final word.
### Drift D3: the 22 new corpus routes and their slice
All 22 sit in the JWT group (`jwt.auth`, cookie JWT) and all have an SPA call site, so all are client-called.
| # | Route (below `/_wave/api/v1/`) | PHP action | Throttle | HEAD line | SPA call site | Slice |
|---|---|---|---|---|---|---|
| 1 | `GET community/groups/{id}/messages/{messageId}/reactions` | `CommunityChatController::listReactors` | `wave-chat-read` (replaces `wave-api`) | L762 | `api/groupChatApi.ts:81` | 31.1 (reactions) |
| 2 | `GET community/dm/{convId}/messages/{messageId}/reactions` | `CommunityDmController::listReactors` | `wave-chat-read` (replaces) | L857 | `api/dmApi.ts:146` | 31.1 |
| 3 | `GET community/groups/{id}/channels/{channelId}/messages/{messageId}/reactions` | `CommunityChannelController::listReactors` | `wave-chat-read` (replaces) | L1047 | `api/channelApi.ts:217` | 31.1 |
| 4 | `GET community/forums/{groupId}/posts/{postId}/reactions` | `CommunityForumController::listReactors` | `wave-chat-read` (replaces) | L937 | `api/forumApi.ts:89` | 31.2 (forums) |
| 5 | `POST community/dm/{convId}/call` | `CommunityDmCallController::start` | `wave-dm-call` (stacked on `wave-api`) | L817 | `api/dmCallApi.ts:11` | 31.2 (video) |
| 6 | `POST community/dm/{convId}/call/accept` | `…::accept` | `wave-api` | L818 | `api/dmCallApi.ts:14` | 31.2 |
| 7 | `POST community/dm/{convId}/call/decline` | `…::decline` | `wave-api` | L819 | `api/dmCallApi.ts:17` | 31.2 |
| 8 | `POST community/dm/{convId}/call/hangup` | `…::hangup` | `wave-api` | L820 | `api/dmCallApi.ts:20` | 31.2 |
| 9 | `POST community/dm/{convId}/call/rejoin` | `…::rejoin` | `wave-api` | L821 | `api/dmCallApi.ts:23` | 31.2 |
| 10 | `GET community/dm/{convId}/call` | `…::status` | `wave-chat-read` (replaces) | L822 | `api/dmCallApi.ts:26` | 31.2 |
| 11 | `GET community/calls/incoming` | `…::incoming` | `wave-chat-read` (replaces) | L823 | `api/dmCallApi.ts:29` | 31.2 |
| 12 | `GET community/threads/counts` | `CommunityThreadController::counts` | `wave-chat-read` (replaces) | L834 | `api/threadApi.ts:142` | 31.1 (threads) |
| 13 | `GET community/groups/{id}/threads/summary` | `…::summary` | `wave-chat-read` (replaces) | L835 | `api/threadApi.ts:152` | 31.1 |
| 14 | `PUT community/groups/{id}/threads/read-all` | `…::readAll` | `wave-api` | L836 | `api/threadApi.ts:163` | 31.1 |
| 15 | `GET community/groups/{id}/threads` | `…::index` | `wave-chat-read` (replaces) | L837 | `api/threadApi.ts:158` | 31.1 |
| 16 | `PUT community/threads/{rootId}/read` | `…::read` | `wave-api` | L838 | `api/threadApi.ts:145` | 31.1 |
| 17 | `PUT community/threads/{rootId}/unread` | `…::unread` | `wave-api` | L839 | `api/threadApi.ts:148` | 31.1 |
| 18 | `PUT community/drafts/{convId}` | `CommunityDraftController::upsert` | `wave-draft-write` (replaces) | L844 | `api/draftApi.ts:72` | 31.1 (composer state) |
| 19 | `DELETE community/drafts/{convId}` | `…::destroy` | `wave-draft-write` (replaces) | L845 | `api/draftApi.ts:77` | 31.1 |
| 20 | `GET community/drafts/{convId}` | `…::show` | `wave-chat-read` (replaces) | L846 | `api/draftApi.ts:83` | 31.1 |
| 21 | `GET community/groups/{id}/drafts/count` | `…::count` | `wave-chat-read` (replaces) | L847 | `api/draftApi.ts:90` | 31.1 |
| 22 | `GET community/groups/{id}/drafts` | `…::index` | `wave-chat-read` (replaces) | L848 | `api/draftApi.ts:97` | 31.1 |
Rows 5 to 22 are `[VERIFIED: /media/nvme/dev/jz/wavepath.org/plugins/golem15/wavepath/routes.php:815-848, 856-857]`, for example `Route::post('community/dm/{convId}/call', …->start($r, $convId))->where('convId', '[0-9]+')->middleware('throttle:wave-dm-call');` (L817) and `Route::put('community/drafts/{convId}', …->upsert($r, $convId))->where('convId', '[0-9]+')->withoutMiddleware('throttle:wave-api')->middleware('throttle:wave-draft-write');` (L844). Rows 1, 3, 4 and the SPA call sites are `[SHELL: parser output; grep -n over vue-wavepath-app/src/api/]`.
Per slice: **Phase 31 foundation +0 routes**, **31.1 +14** (3 reactor lists, 6 threads, 5 drafts), **31.2 +8** (7 DM call routes in the video bundle, 1 forum reactor list in the forums bundle). Old 160 pending + 14 + 8 = 182.
### Drift D4: the 13 existing corpus routes whose throttle changed
Each now carries `->withoutMiddleware('throttle:wave-api')->middleware('throttle:<bucket>')`; method, path and action are unchanged `[SHELL: parser, routes present at both commits with a different middleware set]`.
| Route | New bucket | HEAD line | Slice |
|---|---|---|---|
| `GET community/groups/{id}/attachments/{messageId}/unfurl/{kind}` | `wave-media` | L748 | 31.1 (31.1 D-09) |
| `GET community/groups/{id}/attachments/{messageId}/webhook-icon` | `wave-media` | L756 | 31.1 (31.1 D-09) |
| `GET community/dm/{convId}/messages` | `wave-chat-read` | L805 | 31.1 |
| `GET community/dm/{convId}/messages/{messageId}/replies` | `wave-chat-read` | L863 | 31.1 |
| `GET community/dm/{convId}/messages/{messageId}/unfurl-image/{kind}` | `wave-media` | L866 | 31.1 |
| `GET community/groups/{id}/channels/{channelId}/members` | `wave-chat-read` | L986 | 31.1 |
| `GET community/groups/{id}/channels/{channelId}/messages` | `wave-chat-read` | L991 | 31.1 |
| `GET community/groups/{id}/channels/{channelId}/commands` | `wave-chat-read` | L1000 | 31.1 |
| `GET community/dm/{convId}/commands` | `wave-chat-read` | L1004 | 31.1 |
| `GET community/groups/{id}/channels/{channelId}/video` | `wave-chat-read` | L1016 | 31.2 (video) |
| `GET community/groups/{id}/channels/{channelId}/messages/{messageId}/replies` | `wave-chat-read` | L1057 | 31.1 |
| `GET community/groups/{id}/channels/{channelId}/pins` | `wave-chat-read` | L1069 | 31.1 |
| `GET community/groups/{id}/channels/{channelId}/messages/{messageId}/unfurl-image/{kind}` | `wave-media` | L1079 | 31.1 |
None is a foundation route.
### Drift D5: non-community additions are outside D-09
28 new routes outside the corpus `[SHELL: parser, added non-corpus routes]`: `/_wave/api/v1/auth/2fa/{verify,recovery,webauthn/options,webauthn/verify,config}`, `auth/passkey/{options,verify}`, `auth/device/{initiate,poll,redeem}` (auth group, outside D-09 like `auth/login`); `/_wave/api/v1/security/2fa/*` (12 routes) and `security/devices/{describe,authorize,deny}`; `/_wave/api/v1/web-extensions` and `web-extensions/errors`; `GET /_wave/web-extensions/{code}/{version}/{file}` (public bundle bytes, bucket `wave-web-ext-asset`). None lies under a D-09 prefix. The SPA calls several of them on load (`web-extensions`, `security/2fa/status`); the coverage map reports and excludes them, as 31-05 Task 2 already says.
The two new plugins:
- `plugins/wavepath/gifs` has no `routes.php`; it declares a web extension whose `config.key` is `config('wavepath.gifs::klipy_token', '')` and an `inlineMedia` rule for `static.klipy.com`; KLIPY is called from the browser, not from PHP `[SHELL: sed -n 80-105p plugins/wavepath/gifs/Plugin.php]`. The inline-media rule reaches the corpus only through `UnfurlService` (link cards for KLIPY URLs), which is 31.2 unfurl work; keep KLIPY URLs out of scenario messages.
- `plugins/wavepath/xcapture` registers `/_wave/api/v1/xcapture/messages/{messageId}/capture` (POST, DELETE) and `xcapture/web-actions/{capture,remove}`: four routes outside D-09. It also extends `Golem15\Chat\Models\Message` with `model.afterCreate` and `model.afterUpdate` observers that dispatch a `CaptureJob` on the `xcapture` connection (built from the redis connection, set only when absent) for messages holding an X status URL; after a capture, `RealtimeNotifier` dispatches `edited.chat.message` on `chat:conversation:{id}` `[SHELL: sed -n 49-121p xcapture/Plugin.php; grep in classes/host/MessageObserver.php, RealtimeNotifier.php, jobs/CaptureJob.php:49-50]`. Only messages matching `Detector::URL_RE` (x.com, twitter.com and mirrors, `/status/\d+`) trigger it, and the observer catches and logs every failure. Consequence: no X or Twitter status URL may appear in scenario messages or spec bodies; otherwise a send would dispatch to Redis (absent in the stack) and could add an `edited` publication to a golden.
- `mattermostimport` adds no routes; it has a user `model.afterDelete` listener only.
### Drift D6: rate buckets, ten becomes fourteen
Four new buckets reach corpus routes `[VERIFIED: /media/nvme/dev/jz/wavepath.org/plugins/golem15/wavepath/routes.php:90-124]`:
| Bucket | Definition (verbatim) | Mode | Corpus routes | Requests for the 429 case |
|---|---|---|---:|---:|
| `wave-chat-read` | `Limit::perMinute(600)->by($request->user()?->id ?: $request->ip())` (L90-92) | replaces `wave-api` | 21 | 601 |
| `wave-dm-call` | `Limit::perMinute(10)->by('dm-call:' . (optional($request->user())->id ?: $request->ip()))` (L95-97) | stacked on `wave-api` | 1 | 11 |
| `wave-draft-write` | `Limit::perMinute(120)->by($request->user()?->id ?: $request->ip())` (L106-108) | replaces `wave-api` | 2 | 121 |
| `wave-media` | `Limit::perMinute(1200)->by($request->user()?->id ?: $request->ip())` (L122-124) | replaces `wave-api` | 4 | 1201 |
The `wave-api` definition is unchanged (`Limit::perMinute(240)->by($request->user()?->id ?: $request->ip())`, L66-75); its comment now says chat reads "no longer ride this bucket — they ride wave-chat-read below (Phase 105, D-07/D-22)". Effective buckets over the 216 routes at the snapshot: `wave-api` 174, `wave-chat-read` 21, `call-guest-session` 7, `community-join` 4, `wave-media` 4, `wave-api-bot` 4, `call-guest-entry` 2, `presence-state` 2, `wave-draft-write` 2, `call-guest-resolve` 1, `call-guest-send` 1, `call-link` 1, `wave-dm-call` 1, `wave-webhook` 1 `[SHELL: parser, throttles minus withoutMiddleware]`. `wave-api-token`, `wave-web-ext-errors`, `wave-web-ext-asset` and the user plugin's `2fa-verify` and `device-*` limiters reach no corpus route.
What the plans must absorb:
- **D-11 needs 14 429 cases, not ten.** The four new ones are keyed by user (or by `dm-call:` plus user), so the scenario needs four more `rl-*` identities.
- **31-01's `repeat` cap of 1000 is too low**: the `wave-media` case needs 1201 requests in one minute. Raise the cap (for example to 2000) or derive the bound from the bucket table; this is still generic.
- "Replace" is a route-table property, not a surf feature: the Go app plugin must simply not attach the `wave-api` throttle to the 27 routes that replace it. surf buckets are per route (`surf.Bucket`, `FixedWindowLimiter.RegisterBucket` in `modules/surf/limiter.go:21-65`) `[SHELL]`; whether a group-level throttle can be dropped per route was not checked and is not needed if the app does not use a group-level throttle `[ASSUMED]`.
- The corpus parser must apply `->withoutMiddleware(...)` when it computes a route's buckets; the fonoteka parser the plans copy reads only `Route::group` middleware and `->middleware(...)` (31-PATTERNS "PHP route parser").
- A 429 case for `wave-api` must use a route that still rides `wave-api` (174 do). Pitfall 4 is somewhat eased: chat reads no longer drain the 240/min bucket during a recording run.
### Drift D7: the foundation slice (plans 31-06 and 31-07)
No foundation route was added, removed or re-throttled. `CommunityMemberController`, `CommunityInviteController` and `CommunityFriendsController` have no diff since `a08ed0a`; `CommunityGroupController` does (+22 lines), and the group lifecycle changed in its host service `[SHELL: git diff --stat a08ed0a..HEAD -- controllers/api classes Plugin.php updates models middleware jobs console]`.
1. **`GET community/groups` writes.** `index` now calls `PublicChannelParticipation::selfHeal((int) $g->id, (int) $user->id);` for every group before serializing it `[VERIFIED: …/wavepath/controllers/api/CommunityGroupController.php:54-63]`. `selfHeal` is `self::tryEnsure($groupId, [$userId], now());` and inserts missing `golem15_chat_participants` rows (insert-or-ignore, existing rows keep their read marker; bots, non-members and users who left are skipped) `[SHELL: sed -n 1-60p, 158-161p classes/chat/PublicChannelParticipation.php]`. The channel list does the same (`CommunityChannelController.php:104`, 31.1). Consequences: the Go port of the groups index writes participant rows too; the scenario must say whether its participant rows are already "healed" (otherwise the first GET of a recording run changes state that later cases read); and the D-10 "writing case" classification cannot be by HTTP method alone: a GET with a database write needs an explicit (possibly empty) broadcast golden.
2. **Every group summary has two more fields and a CRT branch.** `serializeGroupSummary` now returns `'thread_unread_count' => (int) $threadRollup['unread']` and `'thread_mention_count' => (int) $threadRollup['mentions']`, and computes `unread_count` with `->unreadCountForContext($actor, FriendGroup::class, (int) $group->id, (bool) $actor->collapsed_threads)` `[VERIFIED: CommunityGroupController.php:343-347, 355-357, 372-373]`. The summary is embedded in the index and in the store, show, update and join responses (calls at L62, 274, 287, 308, 321, and the detail at L384) `[SHELL: grep -n serializeGroupSummary]`. `ThreadInboxService::groupRollupFor` returns `['unread' => 0, 'mentions' => 0]` unless `$user->collapsed_threads` `[SHELL: sed -n 197-206p classes/threads/ThreadInboxService.php]`; `collapsed_threads` defaults to `false` (`$table->boolean('collapsed_threads')->default(false)`, `updates/add_collapsed_threads_to_users.php:33`) `[SHELL]`.
- For a non-CRT actor the two fields are `0` and `unread_count` uses today's query, so the foundation port only adds two zero fields.
- For a CRT actor `unread_count` counts roots only (D8, chat and chatchannels `rootsOnly`) and the rollup reads the Phase 113 thread read state (`ThreadInboxService` 538 lines, `ThreadReadState` 499 lines over `golem15_wavepath_thread_subscriptions` with the new `last_read_at`).
- **Decision for the planner and the user:** either (a) the scenario has a CRT identity and its group-list case is recorded in Phase 31, which pulls the roots-only counts (two additive shared-plugin releases) and a read model of the thread subscriptions into 31-07, or (b) every foundation case uses a non-CRT identity and the CRT group-list case is recorded with the threads routes, so `GET community/groups` gets a second, 31.1-owned case set. tide's status is per route, so (b) means `GET community/groups` stays `pending` until 31.1 unless the CRT cases live on a separate manifest entry. Recommendation: (a) if 31.1 D-08 is reopened (see D14), (b) otherwise; record the CRT case either way, because the SPA exposes the toggle (`PATCH community/prefs`).
3. **Group lifecycle: a joining member now joins every visible public channel.** `enrollMember` (called by `onMemberJoined`) ends with `\Golem15\WavePath\Classes\Chat\PublicChannelParticipation::tryEnsure((int) $group->id, [(int) $user->id], now());`, after the existing group chat, `#general` and `is_default` enrolment; its comment: "every OTHER public channel is visible to the new member too, so they participate in it as well (unread, mentions, read marker, live feed). Marker = now" `[VERIFIED: …/wavepath/classes/services/CommunityChatService.php:309-364]`. 31-07 Task 2's `MemberJoined` listener must do this too (insert participant rows with `last_read_at = now`, skip bots), and the lifecycle smoke test should assert it.
4. **Wiring is unchanged, only shifted.** The seam bindings and lifecycle hooks in `Plugin.php` have no diff; they now sit at: `wave` authorizer L195, context adapters L209 and L220, forum resolver L233, channel resolver L245, bot auth L258, herald profile and presence gate L273 and L277, endpoint guard L289, `/kick` L327, notification dispatch L411-412, group wind-down L438, new-group seed L487-499, member auto-join L514-524, `golem15.user.deleting` listeners L596, L605, L615 `[SHELL: grep -n over HEAD Plugin.php]`. New in `Plugin.php` and relevant later: the thread-reply read observer on `Message` afterCreate (L627-660, 31.1), the drafts and threads purge listeners on `golem15.user.deleting` (31.1), and `config(['golem15.oauthserver::oauthserver.resolve_user_jwt_only' => true]);` (L694, see D8).
5. **Access resolver and realtime: no behaviour change.** `WaveChannelAccessResolver` changed only its doc comment (members may create public channels through `MemberPublicChannelCreator`, a 31.1 channel concern) `[SHELL: git diff …/WaveChannelAccessResolver.php]`. `websockets` is at the same pin and `WaveGroupChannelAuthorizer` has no diff, so the realtime token and subscribe routes and the `wave` and presence authorizers are as researched.
### Drift D8: shared-plugin deltas under D-12 and where each lands
| PHP delta | What changed | Go sibling | Plan |
|---|---|---|---|
| chat `a6a3e04` (v1.4.0) "optional message priority column + sendMessage param" | Nullable `priority` column (`add_priority_to_messages_table.php`); constants `const PRIORITY_STANDARD = 'standard';`, `const PRIORITY_IMPORTANT = 'important';`, `const PRIORITY_URGENT = 'urgent';` `[VERIFIED: …/chat/models/Message.php:32-40]`; `toApiArray` always emits `'priority' => in_array($this->priority, self::PRIORITIES, true) ? $this->priority : self::PRIORITY_STANDARD` `[VERIFIED: Message.php:246-248]`; `sendMessage(…, ?int $rootId = null, ?string $priority = null)`, root-only, invalid value throws `ApplicationException` `[SHELL: git diff fbfbcf9..fdde2e6 -- classes/ChatService.php]`. WavePath validates `'priority' => 'nullable|string|in:' . implode(',', Message::PRIORITIES)` on group, DM and channel sends and sets `priority` to standard on tombstones `[SHELL: grep -n priority controllers/api/*.php]` | `sm-chat-plugin`: additive migration, `SendInput.Priority`, serializer field. This is a **published field addition** on `/_chat/api/v1` (D-14 gate; additive, no rename) | 31.1. Phase 31 only records it (31-05 journeys: important and urgent sends, a reply with a priority, an invalid value for the 422) and lists the column in `scenario-deferred.txt` (31-04) |
| chat `fdde2e6` "additive rootsOnly flag on Conversation::scopeWithUnreadCount" | `scopeWithUnreadCount($query, int $userId, bool $rootsOnly = false)`; only the roots-only path adds `$sub->whereNull('golem15_chat_messages.root_id');` `[VERIFIED: …/chat/models/Conversation.php:168-189]` | `sm-chat-plugin`: an additive roots-only unread count (new function or option; do not change an exported signature, `sm-bm-app` and `sm-demo-app` call these) | 31-07 if D7 option (a), else 31.1 |
| chat `84f8bfe` "emit the created fan-out only after a message's attachments are attached" | `deferCreatedFanout()` before `save()` when files are attached, `flushCreatedFanout()` in a `finally` after the attach loop `[SHELL: git diff … -- models/Message.php classes/ChatService.php]` | Go already claims attachments before it emits: inside one transaction `tx.Create(msg)`, then `s.claimAttachments(ctx, tx, senderID, msg.ID, attachmentIDs)`, then `MessageCreated`, then `s.EmitChatMessage(ctx, tx, conversationID, senderID, msg)` `[VERIFIED: sm-chat-plugin/classes/service.go:337-357]`. Probably no port; the attachment-send broadcast golden decides | 31.1 (assert only) |
| chatchannels `1e3cb74` "additive rootsOnly on ChannelService unread/mention counts" | `unreadCountForContext(User $actor, string $contextType, int $contextId, bool $rootsOnly = false): int` `[VERIFIED: …/chatchannels/classes/ChannelService.php:861]`; same flag on `mentionCountFor` and `mentionCountForContext`, which join `golem15_chat_messages` only on the roots-only path `[SHELL: git diff b92fb42..1e3cb74]` | `sm-chatchannels-plugin` (`UnreadCountForContext`, `MentionCountFor`, `MentionCountForContext` at `classes/channel_service.go:1015, 1462, 1479` have no such flag) `[SHELL]`: additive variant, D-14 gate | 31-07 if D7 option (a), else 31.1 |
| chatchannels `2c67918`, `449a061` | Live search index honours `shouldBeSearchable`; chatchannels registers Laravel Scout itself and declares `laravel/scout` and `typesense/typesense-php` in a new `composer.json` | `sm-chatchannels-plugin` indexer | 31.2 (search). No effect on the Phase 31 stack while it runs `SCOUT_DRIVER=null` |
| user (20 commits, v3.5.0 to v3.6.0) | TOTP replay guard, WebAuthn options, passwordless passkey JWT API, step-up, 2FA mail templates, PKCE device-flow redeem; new columns on `two_factor_methods` and the device-auth table `[SHELL: git log, git diff --stat d4f779b..562aea6]` | `sm-user-plugin` | **Nothing in Phases 31, 31.1, 31.2**: every route is outside D-09 and no corpus table changed. A later WavePath auth phase ports it. 2FA is `'two_factor_mode' => 'optional'` (`wavepath/updates/seed_two_factor_settings.php:45`) `[SHELL]`, so scenario users without a factor log in as before |
| oauthserver `348097b` "opt-in JWT-only identity for /oauth/authorize" | New config key `'resolve_user_jwt_only' => (bool) env('OAUTHSERVER_RESOLVE_USER_JWT_ONLY', false)`: true means "the JWT `token` cookie ONLY. A request carrying just a Winter session is treated as signed out and handed to `login_url`" `[VERIFIED: …/oauthserver/config/oauthserver.php:43-57]`; WavePath turns it on in boot (`Plugin.php:694`) | `sm-oauthserver-plugin` is already JWT-only; its `jwt_only_test.go` ports `AuthorizeResolveUserJwtOnlyTest` and says "The Go plugin has no Winter session and no such flag" `[SHELL: head -40 jwt_only_test.go]` | 31-08: no Go change expected. PHP now behaves like Go for a session-only request, which can only remove differences. Record at the oauthserver pin resolved at recording time; `deviations.yaml` has no session-related entry to drop `[SHELL: grep]` |
| wavepath (app plugin, D-12 "into the app plugin") | Foundation: D7. Messaging: threads section, drafts, reactor lists, `priority`, `thread_state` on root rows, `after_id` delta fetches with `has_more`, `draft` in list responses, `read.changed` on `user:{id}` after a channel or DM read (`ReadStateSignal::EVENT = 'read.changed'`, payload keys `kind`, `conversation_id`, `group_id`, `channel_id`) `[VERIFIED: …/wavepath/classes/chat/ReadStateSignal.php:24, 52-57]`, `thread.changed`, `draft.changed` and `prefs.changed` on `user:{id}`. Satellites: DM calls, `CallNotifier` +199 lines, webhook posts from a dedicated sender account (`golem15_wavepath_webhooks.sender_user_id`), push copy in the recipient's `users.preferred_locale` and urgent-priority emphasis in `WaveHeraldProfile`, unfurl inline-media and YouTube oEmbed titles | `sm-wavepath-app` | 31-07 (D7); 31.1; 31.2 |
### Drift D9: scenario and fixtures (plan 31-04)
New host tables and columns since `a08ed0a` (`updates/version.yaml` v1.22.0 to v1.29.0) `[SHELL: git diff a08ed0a..HEAD -- updates/version.yaml]`:
| Table or column | Shape | Scenario needs | Go seeder |
|---|---|---|---|
| `golem15_wavepath_composer_drafts` | `user_id`, `conversation_id`, `root_id` default `0` ("0 = main composer (never NULL)"), `text` nullable ("NULL = tombstone"), `reply_to_id`, `client_updated_at` unsigned big int ("epoch ms, LWW clock"), unique `(user_id, conversation_id, root_id)` `[VERIFIED: …/wavepath/updates/create_composer_drafts_table.php:24-38]` | a main-composer draft, a thread draft, a tombstone, a draft in a channel the actor can no longer read | deferred, 31.1 |
| `golem15_wavepath_dm_calls` | `call_type` enum `['audio', 'video']`, `state` enum `['ringing', 'active', 'ended']`, `outcome` enum `['answered', 'declined', 'busy', 'cancelled', 'timeout']` nullable, `ring_expires_at`, `answered_at`, `ended_at`, unique `video_session_id` `[VERIFIED: …/wavepath/updates/create_dm_calls_table.php:17-35]` | the DM pair with no call, a ringing call (accept, decline), an active call (hangup, rejoin), an ended call | deferred, 31.2 |
| `golem15_wavepath_thread_subscriptions.last_read_at` (+ index `wp_thread_subs_user_muted_idx`), with a one-time backfill | per-thread follow and read marker | followed threads with and without unread replies, a muted thread | deferred, 31.1 (or 31 with D7 option (a)) |
| `golem15_wavepath_webhooks.sender_user_id` (nullable FK) | the webhook's own sender account | the scenario webhook with its sender user | deferred, 31.2 |
| `golem15_chat_messages.priority` (shared chat table) | nullable `string(16)` | one `important` and one `urgent` root message | deferred until `sm-chat-plugin` has the migration (31.1) |
| `users.collapsed_threads` (existing host column) | boolean, default false | one CRT identity (see D7) | as decided in D7 |
| `users.preferred_locale` (user plugin, exists on both sides: `sm-user-plugin/models/user.go:32`) | push and mail copy locale; null means Polish | set it explicitly for push recipients so push payloads are deterministic | seed in 31-04 |
| `golem15_chat_participants` | v1.22.0 backfill: every member participates in every public channel they can see | seed the rows the backfill and self-heal would write (D7 item 1) | seed in 31-04 |
Rate-limit identities: four more (`wave-chat-read`, `wave-media`, `wave-draft-write`, `wave-dm-call`), so 31-04's "`jwt:rl-` at least 8" becomes at least 12 at the snapshot. Keep X/Twitter status URLs and KLIPY URLs out of every message (D5).
### Drift D10: tide (plans 31-01 and 31-02)
- **T-10, repeat cap:** see D6 (1201 requests for `wave-media`).
- **T-11 (new gap): numeric clocks.** `maskDate` accepts only a Carbon `+00:00` string or null; any other value is a diff: `Diff{Path: path, Expected: "Carbon +00:00 string or null", Actual: formatValue(val)}` `[SHELL: sed -n 112-126p modules/tide/normalize.go]`. New PHP output breaks this: draft responses carry `'updated_at' => (int) $row->client_updated_at` (epoch ms) `[SHELL: ComposerDraftService.php:74, 190]`, so every draft case fails even PHP self-replay; draft responses also carry `'server_time_ms' => $service->nowMs()` (`(int) floor(microtime(true) * 1000)`) `[SHELL: CommunityDraftController.php:75, 117, 146; ComposerDraftService.php:32-35]`, compared exactly today; `thread.changed` publications carry `'last_read_at' => $lastReadAt` as an epoch integer `[SHELL: ThreadReadState.php:330-342, 450-453]`. HTTP thread responses use `toIso8601String()` (`ThreadReadState.php:445-448`), which the existing mask handles `[ASSUMED: the +00:00 form matches carbonOffsetRe]`. Generic addition for 31-01 (responses) and 31-02 (payload-wide masks, T-3): a numeric-epoch mode for `*_at` keys and a mask for "now" clock keys such as `*_ms` (by key suffix or a `NormalizeRule` mask mode), named without the application.
- **Writing-case classification (T-2):** D7 item 1 shows a GET that writes; the "every writing case has a broadcast sidecar" check in 31-05 should classify by method plus a manifest flag, not by method alone.
- New publications on `user:{id}` (`read.changed`, `thread.changed`, `draft.changed`, `prefs.changed`, DM call events through `CentrifugoClient::publishToUser`) are on namespaces T-3 already covers; their payloads carry `group_id`, `channel_id`, `root_id` and `conversation_id`, which the variable-driven id rule handles once ids are deterministic.
### Drift D11: recording clients (plan 31-05)
- `vue-wavepath-app` moved 469 commits; `hubot-wavepath` and `wavepath-mcp` did not. D-17 holds: still two recording clients.
- New journeys the proxy sessions must drive: the priority picker (`components/chat/MessagePriorityPicker.vue`, sends from `stores/channelChatStore.ts`), the Threads section (counts, summary, list, read, unread, read-all), server-synced drafts (debounced PUT and DELETE, read from three devices), who-reacted lists, DM calls (start, accept, decline, hangup, rejoin, status, the `calls/incoming` poll), and the CRT toggle `[SHELL: grep over vue-wavepath-app/src]`.
- Instant channel switching (Phase 105) prefetches in the background with `after_id` deltas, so a session produces many near-duplicate GETs; the dedupe rule of 31-05 Task 2 matters more.
- Out-of-corpus requests on every load now include `web-extensions` and `security/2fa/status`; the coverage map excludes them.
- `config/cors.php` now has `'exposed_headers' => ['Retry-After']` `[SHELL: git diff 7c517191..HEAD -- config/cors.php]`. If a recorded case carries an `Origin` header, the Go app needs `http.cors.exposed_headers: [Retry-After]` (surf supports the key, `modules/surf/cors.go:21`) `[SHELL]`; T-7's recorded header list decides whether it is compared.
### Drift D12: the local PHP stack (plan 31-03)
| Need | Finding | Action |
|---|---|---|
| PHP version | `gifs` and `xcapture` require `php >=8.4`; local PHP is 8.5.11 `[SHELL: composer.json require; php -r]` | none |
| Composer packages | `vendor/` already holds `laravel/scout v10.25.0`, `typesense/typesense-php v4.9.3`, `lbuchs/webauthn v2.2.0`, `pragmarx/google2fa v8.0.3`, `chrome-php/chrome` `[SHELL: vendor/composer/installed.json]`; `composer.lock` is not tracked | none (no install, as the plans require) |
| New env names | `.env.example` adds `WAVE_DRAFT_EXPIRY_DAYS=30` and `KLIPY_TOKEN=` `[SHELL: git diff 7c517191..HEAD -- .env.example]`; xcapture reads `X_CAPTURE_BEARER_TOKEN`, `CHROMIUM_PATH`, `X_CAPTURE_YTDLP_PATH`, `X_CAPTURE_FFMPEG_PATH` `[SHELL: xcapture/config/config.php]` | add `KLIPY_TOKEN=` (empty) and `X_CAPTURE_BEARER_TOKEN=` (empty) to the overlay so no developer value leaks in; the draft expiry default is fine |
| Redis | the `xcapture` queue connection merges `queue.connections.redis` and ignores `QUEUE_CONNECTION` | none, as long as no message holds an X status URL (D5); the stack check could refuse a scenario or spec that contains one |
| LiveKit, push | DM calls go through the same chatvideo LiveKit config; `CallNotifier` sends incoming-call push through herald | same upstream scripts; add DM-call answers |
| Delayed job | `ExpireDmRingJob::dispatch($fresh->id)->delay(now()->addSeconds(DmCall::RING_SECONDS));` (`DmCallService.php:612`); the job's comment: "Under the sync queue the delay is ignored, so expireIfDue no-ops until ring_expires_at has passed" `[SHELL: jobs/ExpireDmRingJob.php:13-14]` | none; a ringing call survives a sync-queue recording |
| OAuth | `resolve_user_jwt_only` is set in boot, not by env | none |
| Search | chatchannels now registers Scout itself (no dependency on journal); 31-03 exports `SCOUT_DRIVER=null` | see D14 for the Typesense question |
| Web-extension pins | `wave:web-pin` is a deploy step; unpinned bundles only hide plugin UI in the SPA | none for the API corpus; note it in the proxy-mode runbook |
### Drift D13: hardcoded values in the plans
Each place below hardcodes a WavePath commit, a route count, a bucket count or a fixed repository list. Under the freeze rule they become derived values: the commits come from the pins 31-05 resolves at recording start; route counts from the snapshot the parser writes (`T = len(snapshot)`, foundation `F = len(foundation-routes.txt)`, pending after Phase 31 `= T - F`); the bucket count from the parsed throttles; the uncalled count from the coverage map. Gate lines then compare `recorded R/T ported P pending N foundation-pending G` against those derived values, for example `R == T`, `P == F`, `N == T - F`, `G == 0`.
| File:line | Hardcoded value | Snapshot value 2026-11-22 |
|---|---|---|
| 31-01:45, 31-02:44, 31-03:45, 31-04:45, 31-05:45, 31-06:45, 31-07:45, 31-08:36, 31-09:34, 31-10:45, 31-11:43 | phase-goal line "196-route … 36-route … exactly 160 routes pending" | 218 / 36 / 182; reword without numbers |
| 31-01:101, 31-01:108, 31-01:147 | `repeat: 1001` is a validation error; "above 1000 is refused"; threat row "bounded at 1000" | must allow 1201 (D6) |
| 31-01:104 | "the ten rate-bucket cases" | 14 |
| 31-03:71 | precondition `cat-file -t 7c517191879cada7bb50ac05f474f3ac02ad4b98` and chat `fbfbcf98e3392269c6e98801270669dc5d845b3b` | resolve HEAD and pins instead |
| 31-03:78 | `pins.env` from `git ls-tree 7c517191…`; fixed list of 15 repositories; "must agree with the research table" | derive from `git ls-tree -r <resolved HEAD>` (35 gitlinks at the snapshot, including `plugins/wavepath/gifs`, `plugins/wavepath/xcapture`, `wavepath-plugin-sdk`); `pins.env` is written by a `pin` step that 31-05 re-runs |
| 31-03:119, 31-03:210 (T-31-13) | `check` compares `.parity-export` with `pins.env` | keep, but `pins.env` must be the resolved one |
| 31-04:31, 31-04:36, 31-04:48, 31-04:112, 31-04:172 | "196 pending-route manifest" | derived |
| 31-04:80 | "one user per rate bucket for the ten 429 cases" | 14 buckets |
| 31-04:89 | "the rows the 17 uncalled routes need" | 17 at the snapshot; take the list from the coverage map |
| 31-04:104 | "`jwt:rl-` … prints at least 8" | at least 12 |
| 31-04:114 | `git … show a08ed0a34d1af72314a3453bb25593c6a1660056:routes.php` | the resolved wavepath pin |
| 31-04:116, 31-04:131, 31-04:132 | checker prints `routes 196` | `routes <T>` |
| 31-04:124 | "constants for the 194 routes of the route file and the 196 expected ids" | no constants; count from the parsed file and compare with the snapshot (31-PATTERNS:678 copies fonoteka's "snapshot count equals the constant" check: drop that constant) |
| 31-04:125 | snapshot "from the route file at `a08ed0a` (digest and the 196 ids)"; "all 196 routes"; "36 foundation-slice route ids" | resolved pin; derived counts; 36 still right at the snapshot |
| 31-04:126 | "assert the manifest has 196 routes" | manifest ids == snapshot ids |
| 31-04:127, 31-04:133 | gate line `recorded R/196 … pending 196 foundation-pending 36` | `R/T … pending T … foundation-pending F` |
| 31-04:137, 31-04:138 | `grep -c '^ - id: '` prints 196; `foundation-routes.txt` has 36 lines | derived; 36 still right |
| 31-05:31, 31-05:36, 31-05:48, 31-05:70, 31-05:103, 31-05:124, 31-05:133, 31-05:146, 31-05:151, 31-05:183 | "196 routes" | derived |
| 31-05:115, 31-05:125 | "177 client-called route ids and 17 no-client route ids" | 199 and 17 at the snapshot; derive from the coverage map and require `called + uncalled == T - 2` |
| 31-05:116 | "exactly ten 429 cases" | one per parsed bucket (14) |
| 31-05:127, 31-05:129, 31-05:172 (T-31-17) | "the 17 uncalled routes"; "exactly the decided 17 hand-written routes" | the coverage map's uncalled list |
| 31-05:130 | `manifest.reference` from a fixed list (superproject, wavepath, user, chat, chatchannels, chatbots, chatvideo, forum, herald, userfriends, websockets, oauthserver, journal); also says the pins are "produced by 31-02", but 31-03 produces them | every gitlink the export used, plus the superproject, resolved at recording start; fix the plan reference to 31-03 |
| 31-05:135, 31-05:137, 31-05:141 | `recorded 196/196 ported 0 pending 196 foundation-pending 36` | derived |
| 31-07:71 | "34 non-realtime foundation routes" | 34 at the snapshot; derive from `foundation-routes.txt` minus the realtime ids |
| 31-07:82, 31-07:84, 31-07:87 | `recorded 196/196 ported 36 pending 160 foundation-pending 0`; "160 later-phase routes" | derived (218 / 36 / 182 at the snapshot) |
| 31-11:31, 31-11:68, 31-11:132, 31-11:141, 31-11:148, 31-11:152 | `196/196`, `ported 36`, `pending 160` | derived |
| 31-VALIDATION:48 | "160 routes explicitly pending for Phases 31.1/31.2" | derived (182 at the snapshot) |
Not WavePath pins and therefore fine as they are: `git diff 2acf8e4` in 31-01 (a `summercms.go` baseline), "recorded 1/1" in the 31-03 tracer, the ten OIDC flows in 31-08 (the plugin runbook's list), and the AUTO_INCREMENT step `10000000` in 31-04.
### Drift D14: does the 31 / 31.1 / 31.2 split still hold?
Yes. No new route lands in the foundation slice, and every new route fits an existing bundle. The sizes move:
- **Phase 31:** same 36 routes, slightly more work in 31-07 (two summary fields, participation self-heal on `GET community/groups`, the public-channel enrolment on member join), plus the CRT decision in D7. The recording (31-05) grows by 22 routes and four 429 cases; tide grows by T-11 and a higher repeat cap.
- **Phase 31.1:** +14 routes and roughly 3.4k lines of new or changed PHP host code: threads (controller +240, `ThreadInboxService` 538, `ThreadReadState` 499, `ThreadStateDecorator` 110, `ThreadAccessGate` 77, `ThreadFollowBackfill` 238), drafts (controller 309, `ComposerDraftService` 467), channel controller +404, DM controller +226, the `priority` release in `sm-chat-plugin` and the roots-only releases in chat and chatchannels `[SHELL: git diff --stat a08ed0a..HEAD]`. Expect one more plan.
- **Phase 31.2:** +8 routes and roughly 1.3k lines for DM calls (controller 211, `DmCallService` 735, model, job, command, `CallNotifier` +199), plus webhook sender accounts, localized push and the unfurl changes (+345).
Notes for the other phases' contexts (reported here; those files are not edited):
1. **31.1 D-08 ("Map thread mute onto chat `ThreadMute`. Do not keep a separate host `ThreadSubscription` table for mute") is under strain.** Since Phase 113 the host `golem15_wavepath_thread_subscriptions` row carries follow, mute and a per-thread `last_read_at`, and six new routes plus the group summary (D7) read it. The Go `ThreadMute` model has `UserID`, `RootID` and `IsMuted` only (`sm-chat-plugin/models/thread_mute.go:7-16`) `[SHELL]`. Mapping follow and read state onto it means a shared-plugin schema change (a D-14 release); keeping a host table contradicts D-08. Re-discuss before 31.1 planning; the answer also decides D7's option.
2. **31.1 D-07 (reactions onto chat reactions)** now also has to serve the paginated who-reacted lists (rows 1 to 3 of D3, `ReactorPage` in the SPA). The chat plugin's summary shape carries `user_ids`, so this is probably an app-side decoration, but check pagination and ordering against the recording.
3. **31.2 bundle 3 (video and guests)** gains the seven DM-call routes, `golem15_wavepath_dm_calls` and the incoming-call push; bundle 4 (forums) gains the forum who-reacted list.
4. **31.2 D-03 (Typesense on both sides for search)** does not match 31-03, which records with `SCOUT_DRIVER=null`. Either 31-05 records the search cases against a Typesense container, or 31.2 re-records them. This gap existed before the drift; chatchannels registering Scout itself removes one obstacle (no journal dependency).
## Architectural Responsibility Map
| Capability | Primary Tier | Secondary Tier | Rationale |
@@ -111,6 +365,8 @@ Of the old freeze, only chat moved (`943b712..fbfbcf9`, two commits). The other
### Recording commit and pins
`[DRIFT 2026-11-22: this table is the 2026-11-13 snapshot and no longer the recording commit. Pins are resolved when 31-05 starts recording (freeze rule); today's snapshot and the moved pins are in Drift D1. The working trees of chat and journal are now at their pins]`
| Repo | Commit | Notes |
|------|--------|-------|
| `wavepath.org` (superproject) | `7c517191879cada7bb50ac05f474f3ac02ad4b98` | "Bump chat, journal, pgstripe", 2026-11-13. Working tree has uncommitted `.planning/config.json` and two submodule checkouts behind their pins (`chat`, `journal`) |
@@ -134,7 +390,7 @@ Source: `git -C /media/nvme/dev/jz/wavepath.org rev-parse HEAD`, `git ls-tree HE
### Count
194 routes under the D-09 prefixes, out of 273 `Route::` verbs in the file. `[VERIFIED: /media/nvme/dev/jz/wavepath.org/plugins/golem15/wavepath/routes.php:221-249, 515-937, 1021-1055, 1072-1078]` (read in full; counted with a parser over `git show a08ed0a:routes.php`).
194 routes under the D-09 prefixes, out of 273 `Route::` verbs in the file. `[DRIFT 2026-11-22: 216 of 323 at the HEAD snapshot; groups 115, dm 23, forums 17, threads 4, new drafts 3 and calls 1; see Drift D2. Line numbers in this section and in the route table are at a08ed0a]` `[VERIFIED: /media/nvme/dev/jz/wavepath.org/plugins/golem15/wavepath/routes.php:221-249, 515-937, 1021-1055, 1072-1078]` (read in full; counted with a parser over `git show a08ed0a:routes.php`).
| Prefix | Routes | Auth group (manifest name suggested) |
|--------|-------:|--------------------------------------|
@@ -156,7 +412,7 @@ Source: `git -C /media/nvme/dev/jz/wavepath.org rev-parse HEAD`, `git ls-tree HE
| `/hooks` | 1 | `webhook` (URL token is the only credential) |
| **Total** | **194** | |
Two extra tracked routes for D-10, outside `routes.php` (the fonoteka corpus tracks the same pair as "realtime" extras): `GET /api/realtime/token` and `POST /api/realtime/subscribe` (websockets plugin; lighthouse serves the same default paths `[SHELL: modules/lighthouse/README.md:231-232]`). **196 tracked routes.**
Two extra tracked routes for D-10, outside `routes.php` (the fonoteka corpus tracks the same pair as "realtime" extras): `GET /api/realtime/token` and `POST /api/realtime/subscribe` (websockets plugin; lighthouse serves the same default paths `[SHELL: modules/lighthouse/README.md:231-232]`). **196 tracked routes.** `[DRIFT 2026-11-22: 218 at the snapshot]`
Group middleware, quoted from the file:
- guest: `['prefix' => '/_wave/api/v1/guest', 'middleware' => ['bindings']]` (line 222). No `throttle:wave-api` on this group.
@@ -181,7 +437,7 @@ Group middleware, quoted from the file:
| `wave-api-bot` | 300/min | `bot:` + token id, else IP | 301 |
| `wave-webhook` | 60/min | `wh:` + webhook id, else `wh-ip:` + IP | 61 |
Ten buckets, so ten 429 cases (D-11). `wave-api-token` (60/min) belongs to the human token routes, which are outside the corpus. Stacked buckets on top of `wave-api`: `community-join` on 4 routes, `presence-state` on 2, `call-link` on 1, `call-guest-entry` on 1.
Ten buckets, so ten 429 cases (D-11). `[DRIFT 2026-11-22: fourteen at the snapshot; wave-chat-read, wave-dm-call, wave-draft-write and wave-media are new, three of them replace wave-api on their routes; see Drift D6]` `wave-api-token` (60/min) belongs to the human token routes, which are outside the corpus. Stacked buckets on top of `wave-api`: `community-join` on 4 routes, `presence-state` on 2, `call-link` on 1, `call-guest-entry` on 1.
Name collision to resolve at plan time: the Go plugins already define buckets named `community-join` (sm-userfriends-plugin, 10/min) and `call-link` (sm-chatvideo-plugin, 10/min) `[SHELL: sm-userfriends-plugin/routes.go:22,85; sm-chatvideo-plugin/routes.go:24,63]`. The app plugin either reuses them or registers its own names; if surf bucket names are global, two definitions of one name will conflict `[ASSUMED]`.
@@ -406,7 +662,7 @@ Method: every `.ts`, `.vue` and `sw.js` under `vue-wavepath-app/src` (tests excl
| 16 | `POST /hooks/{token}` | Called by outside webhook posters only; the SPA only displays the URL |
| 17 | `GET community/groups/{id}/attachments/{messageId}/webhook-icon` | No client builds this URL. The server emits it as `sender_avatar` of a webhook message, and the browser loads it as an image, so it does appear in a proxy session once the scenario has a webhook message |
Called: 173 by the SPA (the `PATCH push/subscription` call is in `src/sw.js:136`), 4 by `hubot-wavepath` (`src/rest.mjs`). `wavepath-mcp`: zero `[SHELL: wavepath-mcp/src/client.ts:56-111]`.
Called: 173 by the SPA (the `PATCH push/subscription` call is in `src/sw.js:136`), 4 by `hubot-wavepath` (`src/rest.mjs`). `[DRIFT 2026-11-22: the SPA calls all 22 new routes, so 195 by the SPA and 199 in total; the 17 below are unchanged; see Drift D2, D3]` `wavepath-mcp`: zero `[SHELL: wavepath-mcp/src/client.ts:56-111]`.
D-11 gives uncalled routes no "client path" cases, but D-15 still requires every corpus route `ported` with passing cases. For these 17 the cases are the denial and validation cases plus one hand-written success case each. Confirm with the user that hand-written success cases are acceptable for uncalled routes, or drop them from the corpus (see Open Questions).
@@ -441,6 +697,8 @@ Generic rule that follows from the code: the `/_wave` handlers cannot reuse the
`[VERIFIED: /media/nvme/dev/jz/wavepath.org/plugins/golem15/wavepath/Plugin.php:160-558]`
`[DRIFT 2026-11-22: the wiring has no diff but its lines moved (L195-631 at the snapshot), and the member auto-join body now also enrolls the member in every visible public channel; see Drift D7 items 3 and 4]`
| Seam | PHP wiring | Go counterpart |
|------|------------|----------------|
| `wave` channel authorizer | `->register('wave', WaveGroupChannelAuthorizer::class)` (165-166) | `lighthouse.Registry.Register("wave", …)` |
@@ -470,7 +728,7 @@ The PHP host extends the shared user table (`collapsed_threads`, `is_full_member
| Plugin | Old freeze | Pin now | Delta |
|--------|-----------|---------|-------|
| chat | `943b712` | `fbfbcf9` | 2 commits: `75b98b0` "stream attachment responses with Range support", `fbfbcf9` "zero Content-Length on 416 range responses". Files: `classes/AttachmentStreamer.php` (+181), `classes/AttachmentResponse.php` (+41), `controllers/api/ChatApiController.php` (13 lines), `routes.php` (2 lines), `tests/unit/AttachmentStreamerTest.php` (+204) |
| chatchannels, chatbots, chatvideo, forum, herald, userfriends | as P19 and P19.1 | unchanged | **No delta.** Nothing to port in these six for D-12 |
| chatchannels, chatbots, chatvideo, forum, herald, userfriends | as P19 and P19.1 | unchanged | **No delta.** Nothing to port in these six for D-12 `[DRIFT 2026-11-22: chatchannels moved b92fb42..1e3cb74 (rootsOnly counts, Scout registration); chat moved fbfbcf9..fdde2e6 (priority, rootsOnly unread, created fan-out after attachments); see Drift D8]` |
| wavepath | never frozen | `a08ed0a` | Whole community surface. Notable recent work: guest calls (99.1, 2026-10-12, 14 commits), unclaimed-import flags on roster, counts, push and presence (99-05, 2026-10-13), group `community_mode` (`34ba3ff`, 2026-10-15), bot reach (`a08ed0a`, 2026-11-13: `BotConversationReach.php` +130, `BotRestController.php`, `meta.group_ids` for adapter discovery) |
| hubot-wavepath | — | `b545869` | 2026-11-13: "instant conversation discovery + answer post-join messages" |
@@ -511,7 +769,7 @@ Port into sm-chat-plugin as an exported streamer in `classes` that the plugin's
| T-7 | **Recorded and compared response headers are fixed lists** without `Accept-Ranges`, `Content-Range`, `Content-Length`, `Last-Modified`, `Retry-After`, `X-RateLimit-*` | `[VERIFIED: modules/tide/record.go:125-140]`, `[VERIFIED: modules/tide/diff.go:35-60]` | Per-route or per-step extra recorded headers, so the Range cases (206, 416) and the 429 cases assert their headers |
| T-8 | **Proxy rules accept two client names.** `ClientNuxt = "nuxt"`, `ClientMCP = "mcp"`, anything else is an error | `[VERIFIED: modules/tide/rules.go:14-16, 60-65]` | Accept any non-empty client label (the SPA can use `nuxt` today; the bot cannot) |
| T-9 | **The fake Centrifugo is static.** Presence always answers `{"result":{"presence":{}}}`; `unsubscribe` is answered but not recorded; any other API method is 404. PHP calls `publish`, `broadcast`, `unsubscribe` and `presence` `[SHELL: websockets/classes/CentrifugoClient.php:101-275]` | `[VERIFIED: modules/tide/centrifugo.go:60-101]` | Optional recording of `unsubscribe` calls (kick, ban, leave sever sockets), and scriptable presence answers so a "recipient online, no push" case can be recorded. Without this, every recorded push decision sees everyone offline |
| T-10 | **No repeat for 429 cases.** A manifest case is one request. The ten bucket cases need 6 to 301 requests inside one minute | `[VERIFIED: manifest.go:382-424]` | A `repeat` count on a spec step (only the last response is kept), or generated multi-step flows. A repeat is cheaper and keeps fixtures small |
| T-10 | **No repeat for 429 cases.** A manifest case is one request. The ten bucket cases need 6 to 301 requests inside one minute `[DRIFT 2026-11-22: fourteen cases, up to 1201 requests (wave-media); see Drift D6. A further gap T-11, numeric clocks, is in Drift D10]` | `[VERIFIED: manifest.go:382-424]` | A `repeat` count on a spec step (only the last response is kept), or generated multi-step flows. A repeat is cheaper and keeps fixtures small |
Not a gap: there is no path rewrite and none is needed (D-01).
@@ -593,8 +851,8 @@ sm-wavepath-app/
│ └── jobs/, console/
├── parity/
│ ├── README.md
│ ├── manifest.yaml # 196 routes, auth groups, freeze commits
│ ├── routes.snapshot # digest of routes.php at a08ed0a
│ ├── manifest.yaml # 196 routes, auth groups, freeze commits [DRIFT 2026-11-22: count derived at recording, 218 at the snapshot]
│ ├── routes.snapshot # digest of routes.php at a08ed0a [DRIFT 2026-11-22: at the wavepath pin resolved by 31-05]
│ ├── capture-rules.yaml
│ ├── accepted-differences.yaml # D-13, signed entries
│ ├── scenario.md # the one scenario, both seeders follow it
@@ -800,6 +1058,7 @@ Fonoteka records each stateful case from a fresh reset. For 196 routes use a dat
### Pitfall 5: the working tree is not the pinned commit
**What goes wrong:** recording chat at `943b712` when the freeze says `fbfbcf9`.
**How to avoid:** the stack script compares `git submodule status` with the pins and refuses on a `+` line; the manifest stores the pins.
`[DRIFT 2026-11-22: on the snapshot every submodule is at its pin (chat at fdde2e6); the check stays, against the pins resolved at recording start]`
### Pitfall 6: presence is always empty in the recorder
**What goes wrong:** every push decision is recorded as "offline", and the presence snapshot is always empty.
@@ -886,10 +1145,10 @@ Honest estimate, in plans of the size this project usually runs (one large plan
| B. App skeleton, PHP stack script, scenario on both sides, manifest of 196 routes | New repo, submodules, `php_parity.sh`, `wavepath_reset.php`, fixture plugin, `check_corpus.go` | 1 |
| C. Proxy sessions, spec flows, full PHP recording (fixtures, broadcast sidecars, upstream scripts and sidecars), PHP self-replay green | Playwright journeys, bot session, hand-written denial, 422 and 429 cases | 1 to 2 |
| D. Foundation slice: envelope, cookie actor, buckets, user columns, contexts, resolvers, `wave` and presence authorizers, realtime routes, groups, members, invites, join, friends, group lifecycle | about 36 routes, about 1.5k PHP lines of controllers plus seams | 1 |
| E. Messaging: row decorator, group chat, channels, DM, threads, commands, host reactions, emoji, prefs, attachments with the Range delta, pins | about 80 routes, about 6k PHP lines | 2 |
| E. Messaging: row decorator, group chat, channels, DM, threads, commands, host reactions, emoji, prefs, attachments with the Range delta, pins | about 80 routes, about 6k PHP lines `[DRIFT 2026-11-22: +14 routes (threads, drafts, reactor lists) and about 3.4k more PHP lines; see Drift D14]` | 2 |
| F. Presence, status, notifications and push, unfurl, webhooks, bot REST with the token guard, search | about 25 routes, about 4k PHP lines | 1 to 2 |
| G. Video and guests with LiveKit sidecars | 29 routes, about 3.5k PHP lines | 1 to 2 |
| H. Forums and shared notes (with the minimal diary model) | 32 routes, about 1.5k PHP lines | 1 |
| G. Video and guests with LiveKit sidecars | 29 routes, about 3.5k PHP lines `[DRIFT 2026-11-22: +7 DM-call routes, about 1.3k more lines]` | 1 to 2 |
| H. Forums and shared notes (with the minimal diary model) | 32 routes, about 1.5k PHP lines `[DRIFT 2026-11-22: +1 forum reactor list]` | 1 |
| I. Shared-plugin parity fixes, releases, consumer gate, changelog posts | recurring; one closing pass | 1 |
| J. Folded todos: OIDC recording, slash fix, three moderation seams | three repos plus the demo and a layer | 1 |
| K. Gate script, accepted-differences sign-off, security review, unit tests | last plan | 1 |
@@ -901,7 +1160,7 @@ That is three phases by this project's lean-planning rule. Earlier phases reache
| Phase | Scope | Closes when |
|-------|-------|-------------|
| **31 Corpus and harness** | A, B, C, D, plus J (the OIDC recording needs only the PHP stack; slash and moderation are independent) and its own unit-test plan | tide gaps closed; all 196 routes recorded with broadcast and upstream sidecars; PHP self-replay green; the foundation slice `ported`; the gate script exists and reports the pending count |
| **31 Corpus and harness** | A, B, C, D, plus J (the OIDC recording needs only the PHP stack; slash and moderation are independent) and its own unit-test plan | tide gaps closed; all 196 routes recorded with broadcast and upstream sidecars `[DRIFT 2026-11-22: every route of the inventory derived at recording, 218 at the snapshot]`; PHP self-replay green; the foundation slice `ported`; the gate script exists and reports the pending count |
| **31.1 Messaging** | E, the chat Range release with the consumer gate, unit tests | all group chat, channel, DM, thread, command, reaction and emoji routes `ported` |
| **31.2 Satellites and close-out** | F, G, H, I, K | D-15: zero pending, every golden asserted, signed accepted differences, bm and demo green, security review done |
@@ -927,10 +1186,15 @@ Dependencies between areas: A before C (recording needs T-1, T-2, T-6, T-7, T-10
| A12 | `community_mode` and other host columns live in `wavepath/updates/` and extend shared tables | Gap map | More companion migrations than expected |
| A13 | Denial statuses in the example manifest (401, 404) | Code Examples | None; the recording defines them |
| A14 | `GroupService` in PHP userfriends has `attachImage` and custom invite codes live on `GroupInvite` | Gap map | The gap sits in the app plugin instead of sm-userfriends-plugin |
| A15 | (drift) The Go app can give the 27 "replace" routes their own bucket simply by not attaching `wave-api`; no surf change is needed | Drift D6 | If the app mounts a group-level throttle, surf needs a per-route exclusion |
| A16 | (drift) `toIso8601String()` output of the thread endpoints matches tide's Carbon `+00:00` pattern | Drift D10 | T-11 also has to cover the thread HTTP responses |
| A17 | (drift) The Go chat reactions shape (`user_ids`) is enough to serve the paginated who-reacted lists | Drift D14 note 2 | 31.1 D-07 needs a shared-plugin read API |
## Open Questions (RESOLVED)
1. **(RESOLVED — D-16) Split into 31, 31.1, 31.2?** Yes. Phase 31 records all 196 routes and ports only the 36-route foundation. Phase 31.1 ports messaging and Range support; Phase 31.2 ports satellites and closes at zero total pending.
1. **(RESOLVED — D-16) Split into 31, 31.1, 31.2?** Yes. Phase 31 records all 196 routes and ports only the 36-route foundation. Phase 31.1 ports messaging and Range support; Phase 31.2 ports satellites and closes at zero total pending. `[DRIFT 2026-11-22: the split holds; 218 routes and still 36 foundation at the snapshot; see Drift D14 for size changes and the 31.1 D-08 note]`
12. **(OPEN, from the drift) CRT identity in the foundation cases.** Record the collapsed-threads group list in Phase 31 (pulls roots-only counts and the thread read model into 31-07) or with the threads routes in 31.1. See Drift D7 item 2 and D14 note 1.
13. **(OPEN, from the drift) Typesense for the search cases.** 31.2 D-03 wants Typesense-backed recordings; 31-03 records with `SCOUT_DRIVER=null`. See Drift D14 note 4.
2. **(RESOLVED — D-17) `wavepath-mcp` has no route in the corpus.** Record only `vue-wavepath-app` and `hubot-wavepath`; the D-09 corpus boundary stays unchanged.
3. **(RESOLVED — D-18) Shared notes need the diary.** Keep the routes and scenario rows; Phase 31.2 adds the minimal provisional `DiaryEntry` read model.
4. **(RESOLVED — D-19) The 17 uncalled routes.** Keep all 17 with hand-written success, denial and validation cases.
@@ -962,7 +1226,7 @@ See "PHP stack from outside the checkout" for the table. Summary: PHP 8.5.11, Co
| SC-1 | Every corpus route is recorded from PHP | corpus check | `go run ./parity/check_corpus.go --manifest parity/manifest.yaml --routes <routes.php> --require-recorded --check-secrets` | no, Wave 0 |
| SC-1 | PHP self-replay is green | manual-run script (needs the PHP stack) | `summer parity:replay --manifest … --self-check true` | no, Wave 0 |
| SC-1 | Go replays every ported route; pending never passes | integration | `go test ./parity -run TestParityCorpus` | no, Wave 0 |
| SC-1 | Foundation pending is zero at Phase 31 close; 160 routes remain pending for 31.1/31.2 (D-16) | gate | `scripts/check-parity.sh` | no, Wave 0 |
| SC-1 | Foundation pending is zero at Phase 31 close; 160 routes remain pending for 31.1/31.2 (D-16) `[DRIFT 2026-11-22: total minus foundation, derived; 182 at the snapshot]` | gate | `scripts/check-parity.sh` | no, Wave 0 |
| SC-2 | Publications of each writing case match the golden | integration | `go test ./parity -run TestBroadcasts` | no, Wave 0 |
| SC-2 | Channel authorization routes replay | integration | `go test ./parity -run 'TestParityCorpus/.*realtime'` | no, Wave 0 |
| D-11 | Vendor calls match the sidecars | integration | `go test ./parity -run TestUpstreamSidecarsAreReplayed` | no, Wave 0 |
@@ -1067,3 +1331,5 @@ No web source was used. The research-plan seam was not run: every question was a
**Research date:** 2026-11-13
**Valid until:** 2026-11-27 for the pins and working-tree states (the WavePath repo is active and another agent works in it); 30 days for the tide and plugin analysis.
**Drift re-check:** 2026-11-22 against `wavepath.org` `56710579`, `wavepath` `d918ef6`, `chat` `fdde2e6`, `chatchannels` `1e3cb74`, `user` `562aea6`, `oauthserver` `348097b`, `vue-wavepath-app` `5d11c09` (a reference snapshot, not a pin; see "Drift since 2026-11-13"). Confidence of the drift section: HIGH for route, bucket and pin facts (parser reproduces the original counts at `a08ed0a`; key ranges read in full); MEDIUM for the slice assignment and sizing; the uncalled-route re-check is partial. No web source was used.