docs(31): add recording foundation todo and test plans
This commit is contained in:
@@ -0,0 +1,273 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 03
|
||||
type: execute
|
||||
wave: 2
|
||||
depends_on: [31-01, 31-02]
|
||||
files_modified:
|
||||
- ../sm-wavepath-app/parity/manifest.yaml
|
||||
- ../sm-wavepath-app/parity/capture-rules.yaml
|
||||
- ../sm-wavepath-app/parity/capture_clients.mjs
|
||||
- ../sm-wavepath-app/parity/record_corpus.sh
|
||||
- ../sm-wavepath-app/parity/presence.yaml
|
||||
- ../sm-wavepath-app/parity/accepted-differences.yaml
|
||||
- ../sm-wavepath-app/parity/README.md
|
||||
- ../sm-wavepath-app/parity/fixtures/routes/
|
||||
- ../sm-wavepath-app/parity/upstream/scripts/
|
||||
- ../sm-wavepath-app/parity/upstream/helpers/
|
||||
- ../sm-wavepath-app/parity/parity_test.go
|
||||
- ../sm-wavepath-app/parity/broadcast_test.go
|
||||
- ../sm-wavepath-app/parity/upstream_replay_test.go
|
||||
- ../sm-wavepath-app/scripts/parity-stack.sh
|
||||
- ../sm-wavepath-app/scripts/check-parity.sh
|
||||
autonomous: true
|
||||
requirements: [SC-1, SC-2, D-06, D-07, D-09, D-10, D-11, D-12, D-13, D-17, D-19, D-20, D-21]
|
||||
estimate:
|
||||
tokens: 360000
|
||||
raw_tokens: 360000
|
||||
tasks: 3
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "D-07 and D-17: one proxy session of vue-wavepath-app and one of hubot-wavepath produce committed client flows; wavepath-mcp is not run because it calls no route in the D-09 corpus."
|
||||
- "D-09 and D-19: all 196 routes are recorded from PHP. The 177 client-called routes inherit their real request shapes from proxy sessions; each of the 17 no-client routes has a hand-written success spec plus the denial and validation cases that apply."
|
||||
- "D-11: every route carries the client cases, one denial per access rule, UI-triggerable 422 cases and one 429 case per named bucket; cases start from a restored scenario and do not leak rate-limit or database state."
|
||||
- "D-10: every writing case has an x.broadcasts.yaml sidecar containing every PHP publication on every namespace; a writing case with no publication has an explicit empty golden, so an omitted side effect cannot masquerade as no side effect."
|
||||
- "D-11: every LiveKit, web-push, unfurl, webhook-icon and Turnstile request caused by a case has an upstream sidecar and is asserted; no recording request can reach a real vendor."
|
||||
- "D-12: manifest.reference freezes the WavePath superproject and pinned submodule commits used for the recording."
|
||||
- "SC-1: replay of all 196 fixtures against the same PHP export is green with zero failing and zero unrecorded cases; the unattended recording command can reproduce it."
|
||||
- "D-13: accepted-differences.yaml exists but is empty after PHP self-replay; it cannot suppress a difference without a route, case, reason and sign-off field."
|
||||
artifacts:
|
||||
- path: "../sm-wavepath-app/parity/manifest.yaml"
|
||||
provides: "196 recorded routes and the D-12 reference map"
|
||||
contains: "reference:"
|
||||
- path: "../sm-wavepath-app/parity/capture_clients.mjs"
|
||||
provides: "read-only SPA and bot proxy sessions"
|
||||
contains: "hubot"
|
||||
- path: "../sm-wavepath-app/parity/record_corpus.sh"
|
||||
provides: "one unattended record and self-replay entry point"
|
||||
contains: "parity:record"
|
||||
- path: "../sm-wavepath-app/parity/accepted-differences.yaml"
|
||||
provides: "fail-closed D-13 exception ledger"
|
||||
contains: "differences:"
|
||||
- path: "../sm-wavepath-app/parity/broadcast_test.go"
|
||||
provides: "orphan and completeness checks for per-case broadcast sidecars"
|
||||
contains: "TestBroadcastSidecarsAreComplete"
|
||||
- path: "../sm-wavepath-app/parity/upstream_replay_test.go"
|
||||
provides: "vendor sidecar completeness and replay"
|
||||
contains: "TestUpstreamSidecarsAreReplayed"
|
||||
key_links:
|
||||
- from: "../sm-wavepath-app/parity/capture_clients.mjs"
|
||||
to: "../sm-wavepath-app/parity/fixtures/clients/"
|
||||
via: "summer parity:proxy sessions are converted into request-only specs"
|
||||
pattern: "parity:proxy"
|
||||
- from: "../sm-wavepath-app/parity/record_corpus.sh"
|
||||
to: "../sm-wavepath-app/parity/manifest.yaml"
|
||||
via: "manifest recording uses the case hook, recorder, upstream scripts, presence table and vars store"
|
||||
pattern: "case-hook"
|
||||
- from: "../sm-wavepath-app/parity/parity_test.go"
|
||||
to: "../sm-wavepath-app/parity/fixtures/routes/"
|
||||
via: "every pending or ported case loads a PHP fixture; pending is counted, never passed"
|
||||
pattern: "StatusPending"
|
||||
prohibitions:
|
||||
- statement: "No request is hand-authored for a client-called success path after the proxy has observed it; the proxy request is the contract."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "No write, checkout, install or commit occurs inside /media/nvme/dev/jz/wavepath.org."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "No real vendor endpoint or credential is used; record mode remains fail-closed on the loopback upstream proxy."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "No Phase 31.1 messaging or Phase 31.2 satellite route is marked ported here."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
ROADMAP Goal (not in user-story format; no story is invented here): WavePath's community traffic is recorded from the PHP backend with `tide` and replayed against a Go app. This phase delivers the harness and the corpus: the `tide` additions, the `sm-wavepath-app` skeleton, the local PHP stack and scenario, the full PHP recording, and the foundation slice ported and green.
|
||||
|
||||
This plan's slice (plan 3 of 6, wave 2): record the entire reference corpus before porting it. The tracer proves one writing route from proxy observation through a PHP fixture, broadcast sidecar, PHP self-replay and corpus checks; expansion applies that path to all client-called routes and then to the 17 hand-written success cases.
|
||||
|
||||
spec-less probe fallback skipped: Phase 31 has no mapped requirement IDs; SC and D identifiers are the phase-local acceptance set.
|
||||
|
||||
<objective>
|
||||
Record the complete 196-route PHP corpus, including all publications and vendor calls, and prove it self-replays against the exact PHP revisions in manifest.reference.
|
||||
|
||||
Purpose: the PHP backend is the executable contract. Foundation and later phases must fix Go against committed observations rather than inferred response shapes.
|
||||
Output: proxy-derived and hand-written specs, 196 recorded route fixtures, per-case broadcast and upstream sidecars, an empty fail-closed exception ledger, and a reproducible green PHP self-replay.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@~/.claude/msd-core/workflows/execute-plan.md
|
||||
@~/.claude/msd-core/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-CONTEXT.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-RESEARCH.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-PATTERNS.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-01-SUMMARY.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-02-SUMMARY.md
|
||||
|
||||
Repo: `../sm-wavepath-app`. Read-only inputs: the pinned PHP export built by 31-02 and the three client source trees under `/media/nvme/dev/jz/wavepath.org`.
|
||||
|
||||
Rules that bind this plan:
|
||||
- D-07: proxy once, then replay committed specs unattended. Do not keep browser or bot interaction as a permanent recording requirement.
|
||||
- D-17: only `vue-wavepath-app` and `hubot-wavepath` are recording clients for this corpus.
|
||||
- D-19: all 17 uncalled routes stay in the corpus with hand-written success, denial and validation cases.
|
||||
- Every stateful case invokes `parity/case_hook.sh`; every 429 case uses its own scenario identity or guest session and `repeat`.
|
||||
- `manifest.reference` uses the exact revisions exported by 31-02. A pin mismatch stops recording.
|
||||
- A fixture body is never edited to make replay pass. Re-record the case or fix a capture/normalization rule.
|
||||
- Files under `parity/fixtures/routes/` and sidecars are generated by tide, not hand-written. Request-only specs and upstream answer scripts are hand-authored where named below.
|
||||
- No push, tag or deploy. Stage by explicit path. Do not stage the oauthserver `go.work` or other sessions' changes.
|
||||
|
||||
<interfaces>
|
||||
Read 31-01-SUMMARY for the final signatures and flags. Expected contracts from 31-01:
|
||||
- `tide.Manifest.Reference`, `tide.RouteCase.Repeat`, `tide.BroadcastPath`, `tide.UpstreamPath`.
|
||||
- `summer parity:record --manifest ... --broadcasts true --upstream-script ... --case-hook ... --wait ...`.
|
||||
- Per-case files `<fixture>.broadcasts.yaml` and `<fixture>.upstream.yaml`.
|
||||
- `response.cookie`, extra response-header modes, scriptable presence and minted upstream credentials.
|
||||
Expected contracts from 31-02:
|
||||
- 196-route `manifest.yaml`, `routes.snapshot`, `foundation-routes.txt`.
|
||||
- `scripts/parity-stack.sh` modes `readonly` and `record`, instance `corpus`.
|
||||
- `parity/php_parity.sh snapshot|restore`, executable `case_hook.sh`, scenario vars and `check_corpus.go`.
|
||||
- Gate flags `--allow-unrecorded` and `--allow-pending-foundation`.
|
||||
</interfaces>
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="tracer">
|
||||
<name>Task 1: Tracer: one client writing route records its response, every publication and every vendor call, then self-replays green</name>
|
||||
<precondition>31-01 and 31-02 summaries exist; `scripts/parity-stack.sh selftest` passes; the manifest has 196 routes and the tracer route is still pending.</precondition>
|
||||
<files>../sm-wavepath-app/parity/capture-rules.yaml, ../sm-wavepath-app/parity/capture_clients.mjs, ../sm-wavepath-app/parity/record_corpus.sh, ../sm-wavepath-app/parity/presence.yaml, ../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/fixtures/clients/, ../sm-wavepath-app/parity/fixtures/routes/, ../sm-wavepath-app/parity/upstream/scripts/, ../sm-wavepath-app/parity/README.md, ../sm-wavepath-app/scripts/parity-stack.sh</files>
|
||||
<read_first>../sm-wavepath-app/parity/README.md, manifest.yaml, scenario.md, scenario.vars.keys, capture-rules.yaml if present, scripts/parity-stack.sh, parity/php_parity.sh, parity/case_hook.sh, 31-01-SUMMARY.md, 31-02-SUMMARY.md, modules/tide/README.md sections for proxy, manifest recording, broadcasts and upstream scripts, ../fonoteka.go/parity/capture_clients.mjs, ../fonoteka.go/parity/capture-rules.yaml, /media/nvme/dev/jz/wavepath.org/vue-wavepath-app/src/stores/channelChatStore.ts and the API module for the selected writing route, /media/nvme/dev/jz/wavepath.org/hubot-wavepath/src/rest.mjs</read_first>
|
||||
<action>Per D-07, D-10, D-11, D-17, D-20 and D-21.
|
||||
1. Choose one writing route called by the SPA whose seeded path is short and deterministic; prefer a friendship request or a group update rather than a messaging route reserved for 31.1. Run the SPA through `summer parity:proxy` against the `corpus` PHP instance and capture the exact method, path, headers and body. The script resolves Playwright from the existing client tree and writes nothing there. It starts client processes with environment variables only and tracks and terminates every child.
|
||||
2. `capture-rules.yaml`: client labels `nuxt` and `hubot`; keep only contract headers; capture server-minted ids/codes/cookies into the mode-0600 vars store; scrub every credential. Add route-specific captures only where the request-only spec cannot carry them. Keep Cookie but never its value.
|
||||
3. Convert the observed tracer session into a committed request-only spec and merge its success plus D-11 denial/422 cases into the manifest. Use a fresh scenario identity for a rate-bucket case if the selected route has a named secondary bucket.
|
||||
4. Add the smallest upstream script needed by the route. When no vendor call is expected, the attached proxy remains empty and fails on any unexpected call. Add `presence.yaml` with `olive` online so the online branch is deterministic.
|
||||
5. `record_corpus.sh`: fail-closed wrapper around stack check, pin/reference check, `summer parity:record` with the manifest, vars, `--broadcasts true`, recorder and proxy loopback addresses, upstream script, presence table, case hook and wait; then `summer parity:replay --self-check true --require-recorded false`. It accepts a route/case selector for the tracer and no selector for the full run. It never evaluates env files as shell.
|
||||
6. Record the tracer. Require its fixture and, because it writes, its broadcast sidecar. Require an upstream sidecar exactly when the reference made a vendor call. Re-run against PHP and require zero diffs. Document the command and generated files in `parity/README.md`.
|
||||
7. Commit request/spec/script changes separately from generated fixtures: `feat(parity): capture one community writing route`; `test(parity): record the community tracer from PHP`.</action>
|
||||
<verify>
|
||||
<automated>OUT="$(cd ../sm-wavepath-app && parity/record_corpus.sh --tracer --self-replay 2>&1)" && printf '%s\n' "$OUT" | grep -qE 'failing 0 unrecorded 0' && printf '%s\n' "$OUT" | grep -q 'broadcast'</automated>
|
||||
<fails_when>Non-zero exit, no `failing 0 unrecorded 0` line, or no broadcast evidence: the stack or pin check refused, the observed request did not record, a publication differed, an unexpected vendor call escaped the script, or self-replay was not executed.</fails_when>
|
||||
<automated>cd ../sm-wavepath-app && go run ./parity/check_corpus.go --manifest parity/manifest.yaml --snapshot parity/routes.snapshot --allow-incomplete --check-secrets --foundation parity/foundation-routes.txt</automated>
|
||||
<fails_when>Non-zero exit: the tracer changed the route inventory, wrote a live secret, used an invalid fixture name, or marked a pending route as passed.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- The tracer's request method, path, request headers and body are byte-for-byte derived from a proxy session, not reconstructed from controller code.
|
||||
- Its success fixture exists and contains no JWT, session cookie, bot token, webhook token or vendor credential.
|
||||
- Its `.broadcasts.yaml` exists and contains all publications emitted before the settle interval ended; deleting one publication makes self-replay fail.
|
||||
- `git -C /media/nvme/dev/jz/wavepath.org status --porcelain` is not run or changed by the scripts; script source contains no checkout, stash, fetch, pull, install or commit command.
|
||||
</acceptance_criteria>
|
||||
<done>One real writing path is observed from a real client, recorded with all side effects and self-replays green from committed files.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Expand proxy-derived specs and case depth across every route the SPA and bot call</name>
|
||||
<precondition>The tracer self-replay is green and both clients resolve their existing dependencies without an install.</precondition>
|
||||
<files>../sm-wavepath-app/parity/capture_clients.mjs, ../sm-wavepath-app/parity/capture-rules.yaml, ../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/fixtures/clients/, ../sm-wavepath-app/parity/upstream/scripts/, ../sm-wavepath-app/parity/upstream/helpers/, ../sm-wavepath-app/parity/presence.yaml, ../sm-wavepath-app/parity/README.md</files>
|
||||
<read_first>Task 1 outputs, 31-RESEARCH.md "Route table", "Rate buckets in the corpus", "Routes that none of the three clients calls", "Upstream vendors", /media/nvme/dev/jz/wavepath.org/vue-wavepath-app/src/ request call sites including src/sw.js, /media/nvme/dev/jz/wavepath.org/hubot-wavepath/src/rest.mjs, the pinned PHP route file and controller validation rules through read-only `git show`, modules/tide/README.md minted credentials and body comparers</read_first>
|
||||
<action>Per D-07, D-09, D-10, D-11 and D-17.
|
||||
1. Drive named, deterministic SPA journeys over the seeded scenario: group administration, membership and invite paths; chat/channel/DM/thread/commands; reactions, emoji, prefs, pins and attachments; presence/status; forum; notes; push; video and guest. Drive the bot's four REST paths with its seeded token. Capture request sessions only; do not use `wavepath-mcp`.
|
||||
2. Build a coverage map from every proxy request to one of the 196 manifest ids. Deduplicate the same route shape while preserving materially different client bodies and headers. A request outside D-09 is reported and excluded; a D-09 client-called route with no captured request stops the task.
|
||||
3. For each captured route add the observed client cases and D-11 depth: unauthenticated, non-member/forbidden or not-found per access rule, UI-triggerable 422, and exactly one repeated 429 case per named rate bucket across the corpus. Do not invent statuses or envelopes; record them.
|
||||
4. Add script answers for LiveKit Twirp, web-push, unfurl HTML/images, webhook icons and Turnstile. Helpers may decode protobuf or decrypt push payloads using scenario test keys and register a tide body comparer. If push decryption proves impossible (research A6), compare endpoint, headers, non-empty body and request count and record the limitation in README; do not accept arbitrary empty bodies.
|
||||
5. Prove pinned requests stay inside the upstream proxy before running the broad recording: a planted public hostname resolves to a test address, the proxy sees the original host, and a closed proxy makes the PHP request fail. Keep scenario text free of URLs except explicit unfurl cases.
|
||||
6. Write client flow provenance into README: client commit, session name, manifest routes covered, and excluded out-of-corpus requests. Commit specs and scripts; generated fixtures remain for Task 3.</action>
|
||||
<verify>
|
||||
<automated>cd ../sm-wavepath-app && node parity/capture_clients.mjs --check-deps && node parity/capture_clients.mjs --check-coverage --manifest parity/manifest.yaml</automated>
|
||||
<fails_when>Non-zero exit: existing client dependencies cannot be resolved, a client-called D-09 route lacks a captured request, a session maps to an unknown route, or wavepath-mcp appears as a corpus client.</fails_when>
|
||||
<automated>cd ../sm-wavepath-app && parity/record_corpus.sh --check-upstream-confinement</automated>
|
||||
<fails_when>Non-zero exit: a pinned PHP request bypasses the loopback proxy, loses its host name, accepts a closed proxy, or a script answer does not match the vendor request.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- Coverage output reports 177 client-called route ids and 17 no-client route ids.
|
||||
- The manifest contains exactly ten 429 cases, one for each named bucket, with the required repeat count.
|
||||
- Client source trees have no modified or untracked file caused by capture.
|
||||
- Every upstream script host is a test/public vendor hostname from the pinned PHP code; no private, production credential or developer endpoint is present.
|
||||
</acceptance_criteria>
|
||||
<done>Every client-called corpus route has a proxy-derived request contract and complete denial, validation and rate-limit depth ready for unattended recording.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 3: Add the 17 hand-written success specs, record all 196 routes and freeze a green PHP self-replay</name>
|
||||
<precondition>Task 2 reports exactly 177 client-called and 17 no-client routes, and the stack's pin check matches the reference revisions.</precondition>
|
||||
<files>../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/fixtures/routes/, ../sm-wavepath-app/parity/upstream/scripts/, ../sm-wavepath-app/parity/accepted-differences.yaml, ../sm-wavepath-app/parity/parity_test.go, ../sm-wavepath-app/parity/broadcast_test.go, ../sm-wavepath-app/parity/upstream_replay_test.go, ../sm-wavepath-app/parity/README.md, ../sm-wavepath-app/scripts/check-parity.sh</files>
|
||||
<read_first>Task 2 coverage output, 31-CONTEXT.md D-12/D-13/D-19, 31-RESEARCH.md table of 17 uncalled routes, pinned controllers and validation rules through read-only `git show`, ../fonoteka.go/parity/broadcast_goldens_test.go, ../fonoteka.go/parity/upstream_replay_test.go, ../sm-oauthserver-plugin/testdata/parity/deviations.yaml</read_first>
|
||||
<action>Per D-06, D-09, D-10, D-11, D-12, D-13 and D-19.
|
||||
1. Add one request-only success spec for each of the 17 no-client routes: three forum category operations; nine channel category/show/restore/mute operations; five note compatibility routes; webhook ingest; webhook icon (use the exact final list from the coverage map—if the research table's grouping count differs, the route ids, not prose arithmetic, win). Derive bodies from the pinned controller validation rules and scenario rows, then record PHP's actual result. Add denial and validation cases where applicable.
|
||||
2. Fill `manifest.reference` from the `.parity-export`/pins produced by 31-02: superproject plus wavepath, user, chat, chatchannels, chatbots, chatvideo, forum, herald, userfriends, websockets, oauthserver and journal commits. The recording wrapper refuses any mismatch.
|
||||
3. Create `accepted-differences.yaml` version 1 with an empty `differences` list and schema comments requiring id, route, case, path, reason, security rationale and sign-off. The replay loader rejects an entry without all fields; no entry is needed for PHP self-replay.
|
||||
4. Run the full unattended recording from a fresh snapshot. For every writing case require a broadcast sidecar, including an explicit empty golden when the PHP reference emits none. For every case require either the expected upstream sidecar or proof that no upstream call occurred. Capture all generated ids/codes/cookies in the vars store and scan again before commit.
|
||||
5. Extend parity checks: `TestBroadcastSidecarsAreComplete` rejects an orphan sidecar, a writing case without a golden and an unexpected publication; `TestUpstreamSidecarsAreReplayed` rejects orphans and unexpected calls; `TestPHPFixturesComplete` requires all 196 routes and all cases recorded. Keep all routes pending—the corpus is recorded, not ported.
|
||||
6. Run PHP self-replay across all fixtures and sidecars. Re-record a nondeterministic case only after fixing its capture/normalization/spec; never edit the expected response. Update README with duration, counts, revisions and the one-command rerun. Commit generated corpus in reviewable groups without mixing code changes.
|
||||
7. Tighten `scripts/check-parity.sh`: without `--allow-unrecorded`, corpus completeness is mandatory; with `--allow-pending-foundation`, the still-pending foundation is the only allowed incompleteness. It prints `recorded 196/196 ported 0 pending 196 foundation-pending 36` at this point.</action>
|
||||
<verify>
|
||||
<automated>cd ../sm-wavepath-app && parity/record_corpus.sh --self-replay 2>&1 | tee "${TMPDIR:-/tmp}/wavepath-self-replay.log" && grep -qE 'recorded 196/196.*failing 0.*unrecorded 0' "${TMPDIR:-/tmp}/wavepath-self-replay.log"</automated>
|
||||
<fails_when>Non-zero exit or missing summary: any route/case is unrecorded, a response/header/publication/vendor call differs, a reference pin differs, a sidecar is absent or orphaned, or a secret scan fails.</fails_when>
|
||||
<automated>cd ../sm-wavepath-app && go run ./parity/check_corpus.go --manifest parity/manifest.yaml --snapshot parity/routes.snapshot --require-recorded --require-clients --check-secrets --foundation parity/foundation-routes.txt && go test -count=1 -run '^(TestPHPFixturesComplete|TestBroadcastSidecarsAreComplete|TestUpstreamSidecarsAreReplayed)$' -v ./parity 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 3</automated>
|
||||
<fails_when>Non-zero exit, corpus checker refusal, or fewer than three PASS lines: route/client coverage is incomplete, a secret exists, or fixture/broadcast/upstream completeness is not proven.</fails_when>
|
||||
<automated>OUT="$(../sm-wavepath-app/scripts/check-parity.sh --allow-pending-foundation 2>&1)" && printf '%s\n' "$OUT" | grep -qx 'check-parity: recorded 196/196 ported 0 pending 196 foundation-pending 36'</automated>
|
||||
<fails_when>Non-zero exit or exact summary absent: the fail-closed gate did not run all corpus, replay and consumer stages or accepted an unrecorded case.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- `manifest.reference` equals the export pins and has no abbreviated commit.
|
||||
- Exactly 196 manifest route entries have recorded fixtures; exactly 17 are marked with hand-written provenance, and none of those 17 lacks a success case.
|
||||
- Every writing case has a broadcast sidecar, including an explicit zero-publication golden; every sidecar belongs to one manifest case.
|
||||
- `accepted-differences.yaml` has zero entries.
|
||||
- Every route remains `pending`; neither Phase 31.1 nor 31.2 implementation is pulled into this plan.
|
||||
</acceptance_criteria>
|
||||
<done>The committed corpus is a complete, secret-free observation of all 196 PHP routes at frozen commits, with publications and vendor calls, and it self-replays green unattended.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| real clients to recording proxy | untrusted requests, cookies and tokens become committed request specs |
|
||||
| PHP reference to committed corpus | response secrets, publications and vendor credentials cross into files |
|
||||
| PHP process to external network | sync jobs can contact LiveKit, push, unfurl, icons and Turnstile |
|
||||
| recorded expectation to parity verdict | missing sidecars or broad normalization could hide contract drift |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| T-31-14 | Information disclosure | proxy sessions and generated fixtures | high | mitigate | mode-0600 vars store, tide capture and scrub rules, second `check_corpus --check-secrets` scan, exact secret-shape tests, and client source trees remain read-only |
|
||||
| T-31-15 | Information disclosure | sync PHP jobs reaching real vendors | high | mitigate | stack refuses record mode unless the loopback upstream proxy listens; confinement test proves pinned requests traverse it and a closed proxy fails |
|
||||
| T-31-16 | Tampering | recording wrong PHP revisions | high | mitigate | manifest.reference is populated from the export pins; stack check compares full commits and refuses before recording |
|
||||
| T-31-17 | Repudiation | hand-written cases presented as client traffic | medium | mitigate | per-route provenance marks `proxy:nuxt`, `proxy:hubot` or `hand-written:D-19`; coverage check requires exactly the decided 17 hand-written routes |
|
||||
| T-31-18 | Tampering | missing publications or vendor calls treated as success | high | mitigate | explicit broadcast golden for every writing case, empty fake for cases without upstream sidecars, orphan/completeness tests and PHP self-replay |
|
||||
| T-31-19 | Denial of service | repeated 429 cases and broad client journeys | medium | mitigate | bounded tide repeat, dedicated identities, snapshot restore per case, loopback-only services and child-process cleanup |
|
||||
| T-31-SC | Tampering | npm/pip/cargo installs | high | mitigate | no install runs; capture resolves dependencies from the existing read-only client trees and `--check-deps` fails otherwise |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
- Tracer: one client writing route records response, publications and vendor calls and self-replays.
|
||||
- Expansion: exactly 177 proxy-derived routes plus 17 D-19 hand-written routes; complete D-11 depth and ten 429 cases.
|
||||
- Full corpus: 196/196 recorded, PHP self-replay failing 0/unrecorded 0, no secrets, no orphan sidecars, all routes still pending.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
All 196 routes are recorded at the D-12 revisions; the two real clients supply every client-called request; the 17 no-client routes have decided hand-written cases; every writing case's publications and every vendor call are asserted; PHP self-replay and the fail-closed corpus gate are green.
|
||||
</success_criteria>
|
||||
|
||||
## Artifacts this phase produces
|
||||
|
||||
- Recording scripts: `parity/capture_clients.mjs`, `parity/record_corpus.sh`, capture rules and presence table.
|
||||
- Corpus: 196 route fixtures plus per-case `.broadcasts.yaml` and `.upstream.yaml` sidecars.
|
||||
- Contract freeze: `manifest.reference`.
|
||||
- Provenance and exception policy: client coverage map in the manifest/README; empty `accepted-differences.yaml`.
|
||||
- Tests: `TestPHPFixturesComplete`, `TestBroadcastSidecarsAreComplete`, `TestUpstreamSidecarsAreReplayed`.
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-03-SUMMARY.md` when done: recording commits and duration; exact reference map; client route counts; the 17 hand-written route ids; fixture/case/broadcast/upstream counts; ten rate-bucket cases; PHP self-replay and gate summaries; any research assumptions A3-A6 resolved by the run.
|
||||
</output>
|
||||
@@ -0,0 +1,270 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 04
|
||||
type: execute
|
||||
wave: 3
|
||||
depends_on: [31-03]
|
||||
files_modified:
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/plugin.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/routes.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/buckets.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/chat.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/realtime.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/lifecycle.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/response.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/actor.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/groups.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/members.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/invites.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/join.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/friends.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/classes/context.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/classes/channel_access.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/classes/forum_access.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/classes/authorizer.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/updates/
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/README.md
|
||||
- ../sm-wavepath-app/parity/manifest.yaml
|
||||
- ../sm-wavepath-app/parity/parity_test.go
|
||||
- ../sm-wavepath-app/parity/broadcast_test.go
|
||||
- ../sm-wavepath-app/parity/foundation_smoke_test.go
|
||||
- ../sm-wavepath-app/scripts/check-parity.sh
|
||||
autonomous: true
|
||||
requirements: [SC-1, SC-2, SC-3, D-01, D-03, D-10, D-11, D-13, D-14, D-16, D-21]
|
||||
estimate:
|
||||
tokens: 390000
|
||||
raw_tokens: 390000
|
||||
tasks: 3
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "Tracer-first: one recorded foundation writing route replays green against Go with the exact PHP envelope and all PHP publications before any route family is expanded."
|
||||
- "D-01 and D-03: Go serves the recorded /_wave paths unchanged from the app plugin; handlers call shared plugin services and emit WavePath's envelope rather than mounting shared api handlers."
|
||||
- "The foundation's 36 recorded routes—groups, members, invites, join, friends and the two realtime routes—are status ported and every case replays green; no other route is marked ported."
|
||||
- "Cookie JWT authentication, ten named/stacked rate buckets, group and channel contexts, channel and forum access resolvers, the wave and presence authorizers and realtime routes match the fixtures."
|
||||
- "Group creation creates its chat and default channel; member joins update the host services; group deletion ends video and deletes forum context in the same transaction or rolls back."
|
||||
- "D-10: every foundation writing case matches its full broadcast golden, including publications on wave, presence:, chat, video and user namespaces."
|
||||
- "D-13: safe access behavior wins over an unsafe PHP behavior only through a fully described accepted-differences entry; otherwise exact PHP parity is mandatory."
|
||||
- "The gate runs without --allow-pending-foundation and prints foundation-pending 0 while reporting the remaining non-foundation routes pending."
|
||||
artifacts:
|
||||
- path: "../sm-wavepath-app/plugins/golem15/wavepath/api/response.go"
|
||||
provides: "typed PHP-compatible success and error envelopes"
|
||||
contains: "VALIDATION_FAILED"
|
||||
- path: "../sm-wavepath-app/plugins/golem15/wavepath/routes.go"
|
||||
provides: "the 36 unchanged recorded paths and middleware stacks"
|
||||
contains: "/_wave/api/v1/community"
|
||||
- path: "../sm-wavepath-app/plugins/golem15/wavepath/classes/authorizer.go"
|
||||
provides: "wave and presence channel authorization"
|
||||
contains: "AuthorizeWave"
|
||||
- path: "../sm-wavepath-app/plugins/golem15/wavepath/lifecycle.go"
|
||||
provides: "transactional group lifecycle wiring"
|
||||
contains: "GroupCreated"
|
||||
- path: "../sm-wavepath-app/parity/foundation_smoke_test.go"
|
||||
provides: "one-route tracer and route-inventory smoke proof"
|
||||
contains: "TestFoundationTracer"
|
||||
key_links:
|
||||
- from: "../sm-wavepath-app/plugins/golem15/wavepath/routes.go"
|
||||
to: "../sm-wavepath-app/plugins/golem15/wavepath/api/"
|
||||
via: "recorded /_wave routes call host handlers behind jwt.auth and stacked surf buckets"
|
||||
pattern: "api\\."
|
||||
- from: "../sm-wavepath-app/plugins/golem15/wavepath/chat.go"
|
||||
to: "../sm-wavepath-app/plugins/golem15/wavepath/classes/"
|
||||
via: "Boot registers the channel context and installs deny-by-default channel/forum resolvers after the database is published"
|
||||
pattern: "SetAccessResolver"
|
||||
- from: "../sm-wavepath-app/parity/manifest.yaml"
|
||||
to: "../sm-wavepath-app/parity/parity_test.go"
|
||||
via: "only foundation ids are ported and replayed strictly with sidecars"
|
||||
pattern: "status: ported"
|
||||
prohibitions:
|
||||
- statement: "Do not mount the shared plugins' HTTP handlers; their envelopes are different."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "Do not register a second friendgroup context alias or duplicate community-join/call-link buckets."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "No Phase 31.1 messaging or Phase 31.2 satellite route is marked ported."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "No shared-plugin serializer is changed merely to shape a WavePath response; host decoration stays in the app plugin."
|
||||
status: unresolved
|
||||
verification: judgment
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
ROADMAP Goal (not in user-story format; no story is invented here): WavePath's community traffic is recorded from the PHP backend with `tide` and replayed against a Go app. This phase delivers the harness and the corpus: the `tide` additions, the `sm-wavepath-app` skeleton, the local PHP stack and scenario, the full PHP recording, and the foundation slice ported and green.
|
||||
|
||||
This plan's slice (plan 4 of 6, wave 3): port the 36-route foundation against the corpus. The tracer is one writing route through authentication, middleware, a shared service, the WavePath envelope, persistence and broadcast comparison. Expansion adds the remaining group/member/invite/join/friend paths and then contexts, authorization, realtime and lifecycle.
|
||||
|
||||
spec-less probe fallback skipped: Phase 31 has no mapped requirement IDs; SC and D identifiers are the phase-local acceptance set.
|
||||
|
||||
<objective>
|
||||
Make the foundation slice green against the recorded PHP corpus: envelope, cookie actor, rate buckets, contexts, resolvers, realtime authorization, groups, members, invites, join, friends and group lifecycle.
|
||||
|
||||
Purpose: these paths establish the host/plugin boundary and access-control model reused by messaging and satellite phases.
|
||||
Output: production app-plugin handlers and wiring, host companion migrations, exactly 36 ported manifest routes, broadcast assertions and a foundation-green fail-closed gate.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@~/.claude/msd-core/workflows/execute-plan.md
|
||||
@~/.claude/msd-core/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-CONTEXT.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-RESEARCH.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-PATTERNS.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-02-SUMMARY.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-03-SUMMARY.md
|
||||
|
||||
Repo: `../sm-wavepath-app`. Shared plugins are dependencies and service providers; do not edit them unless a recorded foundation behavior proves a missing generic service seam. Such a finding is a source-audit stop, not an improvised shared API change.
|
||||
|
||||
Rules that bind this plan:
|
||||
- Recorded fixtures decide method, status, key presence, null/empty shape, headers and error collapse.
|
||||
- `wire.WriteJSON` and typed structs preserve key order and Laravel-compatible bytes. Unexpected failures use `wire.WriteOpaque500`.
|
||||
- Actor comes from `bouncer.User` after `jwt.auth`; the user plugin already reads the `token` cookie (D-21).
|
||||
- Database/services are looked up at call time. A missing dependency fails boot or answers 503; access resolvers deny on missing database/error.
|
||||
- PATTERNS F-1/F-2/F-3: reuse userfriends' `community-join`; do not add the existing friendgroup alias; register `wave` once; read lighthouse channel parsing before implementing presence.
|
||||
- Deny by default; gate a parent context before loading nested ids. Match PHP's 403/404 behavior from each recorded denial case.
|
||||
- Earlier plans carry smoke tests. Table-driven unit coverage remains 31-06.
|
||||
|
||||
<interfaces>
|
||||
- `sm-userfriends-plugin/classes.GroupService` and `FriendshipService` methods listed in 31-RESEARCH Gap map.
|
||||
- `sm-userfriends-plugin/events`: `GroupCreated`, `GroupDeleted`, `MemberJoined`, `MemberLeft`, each carrying `Tx`.
|
||||
- `chatcontracts.Registry` already contains `userfriendsclasses.FriendGroupAlias`; host adds only `chanmodels.ChannelAlias`.
|
||||
- `ChannelService.SetAccessResolver`, `ForumService.SetAccessResolver`, `lighthouse.Registry.Register`, `lighthouse.Mount`.
|
||||
- WavePath success envelope `{"data":...}`; failure envelope fields `error`, `message`, `code`, optional `errors`, with recorded codes such as `VALIDATION_FAILED`, `NOT_FOUND`, `FORBIDDEN`.
|
||||
</interfaces>
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="tracer">
|
||||
<name>Task 1: Tracer: one foundation write crosses cookie auth, WavePath envelope, shared service, database and broadcast golden</name>
|
||||
<precondition>31-03 gate reports recorded 196/196 and the selected route is pending with its broadcast sidecar.</precondition>
|
||||
<files>../sm-wavepath-app/plugins/golem15/wavepath/plugin.go, ../sm-wavepath-app/plugins/golem15/wavepath/routes.go, ../sm-wavepath-app/plugins/golem15/wavepath/buckets.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/response.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/actor.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/groups.go, ../sm-wavepath-app/plugins/golem15/wavepath/updates/, ../sm-wavepath-app/plugins/golem15/wavepath/README.md, ../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/foundation_smoke_test.go</files>
|
||||
<read_first>31-03-SUMMARY.md, the selected route fixture and broadcast sidecar, pinned PHP controller method and ApiResponse through read-only git show, ../sm-userfriends-plugin/routes.go, api/groups.go, api/auth.go, api/errors.go, classes/group_service.go, models/group.go, modules/wire/README.md, modules/surf/limiter.go, PATTERNS "response.go", "actor.go", "buckets.go and routes.go"</read_first>
|
||||
<action>Per D-01, D-03, D-10, D-11 and D-21.
|
||||
1. Select one recorded foundation write with a deterministic publication; prefer group update if group creation's lifecycle is too broad for a tracer. Red first: `TestFoundationTracer` seeds the scenario, sends the exact fixture request with `Cookie: token=...`, replays through `app.Handler`, and compares response plus the case broadcast sidecar. Confirm it fails because no route exists.
|
||||
2. `api/response.go`: typed success and error envelopes matching the fixture, validation map and exact error code/status mapping. `api/actor.go`: frontend principal helper, path uint parsing, JSON decode/body limit and service lookup. Do not add another auth guard.
|
||||
3. `buckets.go`: register app-prefixed foundation buckets only (`wave-api` 240/min, `presence-state` 30/min); reuse `userfriends.JoinBucket` for `community-join`. Keys are user id else trusted client IP. `routes.go`: mount the recorded `/_wave` path behind `jwt.auth`, `throttle:wave-api` and its secondary bucket where applicable.
|
||||
4. Implement the selected handler over `GroupService`, with a host response struct rather than the shared plugin's API view where keys differ. Add only companion columns/tables the recorded route needs, through migrations—never AutoMigrate.
|
||||
5. Mark only the selected route ported. Replay every case and publication; fix implementation, never fixture. Document the app-plugin host-handler pattern in its README.
|
||||
6. Commit: `feat(wavepath): port the foundation parity tracer`.</action>
|
||||
<verify>
|
||||
<automated>go -C ../sm-wavepath-app vet ./plugins/golem15/wavepath/... ./parity/... && go -C ../sm-wavepath-app test -count=1 -run '^TestFoundationTracer$' -v ./parity 2>&1 | grep -q -- '^--- PASS: TestFoundationTracer'</automated>
|
||||
<fails_when>Non-zero exit or PASS line absent: code does not vet, the route is not mounted, cookie auth/envelope/persistence differs, a publication differs, or the test filter matched nothing.</fails_when>
|
||||
<automated>go -C ../sm-wavepath-app test -count=1 -run 'TestParityCorpus/.+foundation-tracer' -v ./parity 2>&1 | grep -q -- '^--- PASS:'</automated>
|
||||
<fails_when>Non-zero exit or no PASS line: the actual manifest case remains pending, fails replay, or the test name is not tied to the route.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- The tracer route is the sole newly ported manifest route and every one of its cases passes.
|
||||
- Its writing case matches the complete PHP broadcast golden.
|
||||
- The app plugin imports the shared service package but not a shared `api` package.
|
||||
- No duplicate bucket or friendgroup alias is registered.
|
||||
</acceptance_criteria>
|
||||
<done>A real foundation write works end to end against the frozen PHP contract, including its publication.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Port groups, members, invites, join and friends with recorded denials and rate buckets</name>
|
||||
<precondition>The foundation tracer route and its broadcast golden are green.</precondition>
|
||||
<files>../sm-wavepath-app/plugins/golem15/wavepath/routes.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/response.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/actor.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/groups.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/members.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/invites.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/join.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/friends.go, ../sm-wavepath-app/plugins/golem15/wavepath/updates/, ../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/foundation_smoke_test.go</files>
|
||||
<read_first>All foundation route fixtures and broadcast sidecars, pinned CommunityGroupController, CommunityMemberController, CommunityInviteController and CommunityFriendsController, PHP models/migrations for host fields, ../sm-userfriends-plugin/classes/group_service.go, friendship_service.go, models and API handlers, ../sm-chatbots-plugin models/services for BotFlag, 31-RESEARCH "Groups, join, members, invites" and "Friends"</read_first>
|
||||
<action>Per D-03, D-11, D-13 and D-16.
|
||||
1. Add routes one recorded vertical family at a time, each immediately usable: groups (list/create/show/update/delete/image/open join and preview), members (list/add/banned/leave/kick/ban/unban/promote/demote/transfer/bot flag), invites (show/mint/rotate/custom/revoke), friends (list/incoming/sent/request/accept/reject/cancel/unfriend).
|
||||
2. Call `GroupService` and `FriendshipService` for generic operations. Implement host-only fields and operations in the app plugin: image attachment, custom invite code, `community_mode`, unclaimed-import and bot/status decoration. If a generic service method is missing, keep host logic app-side over its models/transaction unless the service must preserve an invariant; do not alter a shared API shape.
|
||||
3. Define typed request and response structs from fixtures. Preserve nil versus empty arrays, conditional keys, avatar/status decorations and exact status codes. Validation happens before writes and errors map to the recorded WavePath envelope.
|
||||
4. Enforce parent-first scoping for every group/user/invite/friend id. Cross-group or non-member ids produce the same answer as a missing id wherever the fixture does. Auth-group crossover tests remain red if a bot/guest credential reaches a cookie route.
|
||||
5. Apply `wave-api` on all routes and stack `community-join` on the four recorded join/request routes. Reset limiter state per parity case. The 241/11 repeats must reach the recorded 429 and headers.
|
||||
6. After each family, mark only that family's routes ported and run its corpus subtests plus broadcast comparisons. Finish with all 34 non-realtime foundation routes ported.
|
||||
7. Commit by user capability: `feat(wavepath): port community groups and membership`; `feat(wavepath): port invites and join`; `feat(wavepath): port community friends`.</action>
|
||||
<verify>
|
||||
<automated>go -C ../sm-wavepath-app vet ./plugins/golem15/wavepath/... && go -C ../sm-wavepath-app test -count=1 -run 'TestParityCorpus/.+(groups|join|friends)' -v ./parity 2>&1 | tee "${TMPDIR:-/tmp}/foundation-families.log" && ! grep -q -- '^--- FAIL:' "${TMPDIR:-/tmp}/foundation-families.log" && grep -q -- '^--- PASS:' "${TMPDIR:-/tmp}/foundation-families.log"</automated>
|
||||
<fails_when>Non-zero exit, any FAIL line, or no PASS line: a family route/case differs, access scoping fails, rate-limit state leaks, or no matching manifest tests ran.</fails_when>
|
||||
<automated>cd ../sm-wavepath-app && go run ./parity/check_corpus.go --manifest parity/manifest.yaml --snapshot parity/routes.snapshot --require-recorded --check-secrets --foundation parity/foundation-routes.txt 2>&1 | grep -q 'foundation 36 pending 2'</automated>
|
||||
<fails_when>Non-zero exit or expected count absent: a non-realtime foundation route remains pending, a non-foundation route was marked ported, or the manifest/fixtures fail validation.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- Exactly 34 foundation route ids are ported; only the two realtime ids remain pending.
|
||||
- Every recorded unauthenticated, non-member, cross-group, validation and 429 case passes.
|
||||
- List responses use empty arrays where PHP did; optional keys are omitted or null exactly as fixtures show.
|
||||
- No generic plugin response type is used as the WavePath response contract.
|
||||
</acceptance_criteria>
|
||||
<done>A member can manage groups, members and invites, join a group and manage friendships through unchanged /_wave paths with PHP-compatible responses and denials.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 3: Wire contexts, resolvers, wave/presence authorization, realtime routes and transactional group lifecycle; close the foundation gate</name>
|
||||
<precondition>The 34 group/member/invite/join/friend routes are green and only two foundation route ids remain pending.</precondition>
|
||||
<files>../sm-wavepath-app/plugins/golem15/wavepath/plugin.go, ../sm-wavepath-app/plugins/golem15/wavepath/chat.go, ../sm-wavepath-app/plugins/golem15/wavepath/realtime.go, ../sm-wavepath-app/plugins/golem15/wavepath/lifecycle.go, ../sm-wavepath-app/plugins/golem15/wavepath/classes/context.go, ../sm-wavepath-app/plugins/golem15/wavepath/classes/channel_access.go, ../sm-wavepath-app/plugins/golem15/wavepath/classes/forum_access.go, ../sm-wavepath-app/plugins/golem15/wavepath/classes/authorizer.go, ../sm-wavepath-app/plugins/golem15/wavepath/README.md, ../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/parity_test.go, ../sm-wavepath-app/parity/broadcast_test.go, ../sm-wavepath-app/parity/foundation_smoke_test.go, ../sm-wavepath-app/scripts/check-parity.sh</files>
|
||||
<read_first>The two realtime fixtures and all lifecycle-causing route broadcast sidecars, modules/lighthouse/channel.go and registry.go, ../sm-chat-plugin/classes/authorizer.go and boot registration, ../sm-demo-app/plugins/demo/chat.go, realtime.go, classes/chat_context.go, forum_access.go, ../sm-bm-app/plugins/jz/bm/classes/chat_context.go, ../sm-userfriends-plugin/events/events.go and group_service.go fire order, ../sm-chatvideo-plugin/boot.go listener pattern, pinned PHP Plugin.php lifecycle and authorizer ranges, PATTERNS F-2/F-3 and sections "chat.go", "authorizer.go", "lifecycle.go"</read_first>
|
||||
<action>Per D-03 and D-10.
|
||||
1. `classes/context.go`: host group context implementation over userfriends membership/roles, with non-empty broadcast channel; use `userfriendsclasses.FriendGroupAlias`. `chat.go`: add only `chanmodels.ChannelAlias`; install channel and forum access resolvers inside `lagoon.OnDatabase`. Resolver errors and absent DB deny.
|
||||
2. `classes/authorizer.go`: constructors over an injected membership check and a runtime DB lookup. Parse exactly the recorded `wave:group:{id}` and `presence:wave:group:{id}` forms after reading lighthouse namespace selection. Return the exact `info` and capabilities from subscribe fixtures; malformed, non-member and cross-group channels deny without leaking existence. Register `wave` exactly once.
|
||||
3. `realtime.go`: build lighthouse service/user lookup and mount token and subscribe routes at the recorded defaults. Token uses cookie JWT and its recorded cache/error behavior; subscribe is server-to-server/proxy authenticated as lighthouse requires and is not throttled by a shared client IP bucket.
|
||||
4. `lifecycle.go`: listeners on GroupCreated, MemberJoined/Left and GroupDeleted. Work on `ev.Tx`; returned errors roll back. Create group chat and adopt `general` exactly once; member join updates services idempotently; delete ends active video and removes forum context and related host rows. Preserve event order from PHP and avoid duplicate work when GroupCreated is followed by owner MemberJoined.
|
||||
5. Mark the two realtime routes ported and replay all 36 routes plus all lifecycle broadcasts. `TestFoundationRouteInventorySmoke` proves exactly the ids in `foundation-routes.txt` are ported; `TestFoundationLifecycleSmoke` performs create/member/delete and asserts rows and publications.
|
||||
6. Run `scripts/check-parity.sh` without `--allow-pending-foundation`; keep the non-foundation pending count visible. Update README with host seams, namespace/channel forms and lifecycle transaction semantics.
|
||||
7. Commit: `feat(wavepath): wire community contexts and realtime authorization`; `feat(wavepath): wire group lifecycle`; `test(parity): close the foundation gate`.</action>
|
||||
<verify>
|
||||
<automated>go -C ../sm-wavepath-app vet . ./app/... ./parity/... ./plugins/golem15/wavepath/... && go -C ../sm-wavepath-app test -count=1 -run '^(TestFoundationRouteInventorySmoke|TestFoundationLifecycleSmoke|TestParityCorpus)$' -v ./parity 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 3</automated>
|
||||
<fails_when>Non-zero exit or fewer than three PASS lines: route inventory, lifecycle transaction/publications, or strict corpus replay failed; a Docker skip also fails the count.</fails_when>
|
||||
<automated>OUT="$(../sm-wavepath-app/scripts/check-parity.sh 2>&1)" && printf '%s\n' "$OUT" | grep -qE '^check-parity: recorded 196/196 ported 36 pending 160 foundation-pending 0$'</automated>
|
||||
<fails_when>Non-zero exit or exact summary absent: a foundation route remains pending/failing, a non-foundation route was ported, a sidecar differs, a required test skipped, Docker was unavailable, or a consumer gate failed.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- Exactly 36 manifest routes are ported and equal `foundation-routes.txt`; 160 remain pending.
|
||||
- Both realtime routes pass success and denial fixtures; malformed/cross-group channels disclose no membership.
|
||||
- Create/member/delete lifecycle writes and publications equal PHP and are rollback-safe.
|
||||
- Gate runs with neither `--allow-unrecorded` nor `--allow-pending-foundation`.
|
||||
</acceptance_criteria>
|
||||
<done>The complete foundation slice replays green against Go, broadcasts included, and the fail-closed gate reports foundation-pending 0.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| cookie-authenticated client to /_wave handlers | untrusted ids, bodies and cookies select group-scoped records and mutations |
|
||||
| app plugin to shared plugin services | host envelopes and access rules wrap generic service operations |
|
||||
| Centrifugo subscribe proxy to authorizers | untrusted channel names request realtime access |
|
||||
| userfriends events to lifecycle side effects | one transaction creates/deletes chat, channels, video and forum state |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| T-31-20 | Elevation of privilege | auth-group crossover on /_wave and realtime routes | high | mitigate | route groups use only jwt.auth for member routes; fixtures test guest/bot/invalid credentials; actor rejects backend/zero principals |
|
||||
| T-31-21 | Information disclosure | group/member/invite/friend IDOR | high | mitigate | parent-first scope checks, membership/role gate before nested lookup, recorded 403/404 collapse and cross-group denial cases |
|
||||
| T-31-22 | Elevation of privilege | wave/presence channel authorization | high | mitigate | strict channel parser, runtime membership check, deny on DB/error/malformed input, exact success/denial subscribe fixtures |
|
||||
| T-31-23 | Denial of service | route and join/presence buckets | medium | mitigate | global bucket ownership checked, named buckets reused instead of duplicated, stacked limits and recorded 429 repeat cases |
|
||||
| T-31-24 | Tampering | partial group lifecycle | high | mitigate | listeners use ev.Tx and return errors; create/delete side effects and rollback behavior tested with broadcasts |
|
||||
| T-31-25 | Spoofing | app host serializer diverges from shared service state | medium | mitigate | handlers derive state from services/models and strict fixture replay; typed structs prevent accidental generic API envelopes |
|
||||
| T-31-SC | Tampering | npm/pip/cargo installs | high | mitigate | no package install or new dependency in this plan |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
- Tracer proves cookie auth → host handler → shared service → DB → PHP envelope → publication.
|
||||
- Family expansion proves 34 group/member/invite/join/friend routes and all denial/validation/rate cases.
|
||||
- Realtime/lifecycle expansion proves exactly 36 foundation routes ported, lifecycle broadcasts and `foundation-pending 0`.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
The 36-route foundation set and no other route is ported; every case and publication matches PHP; contexts, resolvers and authorizers deny safely; lifecycle side effects are transactional; `scripts/check-parity.sh` runs without `--allow-pending-foundation` and reports 36 ported, 160 pending.
|
||||
</success_criteria>
|
||||
|
||||
## Artifacts this phase produces
|
||||
|
||||
- App-plugin foundation API: response/actor helpers and group, member, invite, join and friend handlers.
|
||||
- Host wiring: channel/group contexts, channel/forum resolvers, wave/presence authorizers, lighthouse routes and lifecycle listeners.
|
||||
- Companion migrations for host-only foundation fields/tables.
|
||||
- Smoke tests: `TestFoundationTracer`, `TestFoundationRouteInventorySmoke`, `TestFoundationLifecycleSmoke`.
|
||||
- Manifest state: exactly 36 foundation routes `ported`.
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-04-SUMMARY.md` when done: commits; exact 36 route ids; host models/migrations; envelope structs; bucket names and owners; channel forms and authorizer result shape; lifecycle event order; accepted differences, if any; final gate summary.
|
||||
</output>
|
||||
@@ -0,0 +1,288 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 05
|
||||
type: execute
|
||||
wave: 2
|
||||
depends_on: [31-02]
|
||||
coupling_justified:
|
||||
- "31-04: this plan may execute beside the foundation port because it does not edit sm-wavepath-app's app plugin or manifest. It only consumes the isolated `oidc` parity instance furnished by 31-02."
|
||||
files_modified:
|
||||
- ../sm-oauthserver-plugin/testdata/parity/flows/
|
||||
- ../sm-oauthserver-plugin/testdata/parity/seed.json
|
||||
- ../sm-oauthserver-plugin/testdata/parity/winter-export.jsonl
|
||||
- ../sm-oauthserver-plugin/testdata/parity/id_token_shape.json
|
||||
- ../sm-oauthserver-plugin/testdata/parity/README.md
|
||||
- ../vue-chat-layer/app/composables/useChat.ts
|
||||
- ../vue-chat-layer/tests/store.test.ts
|
||||
- ../vue-chat-layer/README.md
|
||||
- ../sm-chat-plugin/events/events.go
|
||||
- ../sm-chat-plugin/classes/service.go
|
||||
- ../sm-chat-plugin/saving_test.go
|
||||
- ../sm-chat-plugin/README.md
|
||||
- ../sm-userfriends-plugin/events/events.go
|
||||
- ../sm-userfriends-plugin/contracts/rejection.go
|
||||
- ../sm-userfriends-plugin/classes/group_service.go
|
||||
- ../sm-userfriends-plugin/api/errors.go
|
||||
- ../sm-userfriends-plugin/saving_test.go
|
||||
- ../sm-userfriends-plugin/README.md
|
||||
- ../sm-user-plugin/classes/events.go
|
||||
- ../sm-user-plugin/contracts/rejection.go
|
||||
- ../sm-user-plugin/controllers/registration.go
|
||||
- ../sm-user-plugin/controllers/api_controller.go
|
||||
- ../sm-user-plugin/controllers/users_admin_controller.go
|
||||
- ../sm-user-plugin/saving_test.go
|
||||
- ../sm-user-plugin/README.md
|
||||
- ../sm-demo-app/plugins/demo/moderation.go
|
||||
- ../sm-demo-app/plugins/demo/plugin.go
|
||||
- ../sm-demo-app/moderation_test.go
|
||||
- ../sm-demo-app/go.mod
|
||||
- ../sm-demo-app/go.sum
|
||||
- ../sm-demo-app/plugins/golem15/chat
|
||||
- ../sm-demo-app/plugins/golem15/user
|
||||
- ../sm-demo-app/plugins/golem15/userfriends
|
||||
- ../sm-bm-app/plugins/golem15/chat
|
||||
autonomous: true
|
||||
requirements: [SC-3, SC-4, D-08, D-14, D-20, D-22, TODO-OIDC, TODO-SLASH, TODO-MODERATION]
|
||||
estimate:
|
||||
tokens: 300000
|
||||
raw_tokens: 300000
|
||||
tasks: 3
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "The ten PHP OIDC flows are recorded in their required order against the isolated `oidc` instance, contain no Set-Cookie or live secret, and `PHASE194_REQUIRE_PARITY=1` makes both parity tests pass."
|
||||
- "D-22: a known slash trigger dispatches; unknown slash text is refused locally and keeps the draft; `//text` posts `/text`; bare `/` and slash text on a surface with an empty loaded command catalog follow the recorded WavePath behavior."
|
||||
- "The chat saving event exposes claimed attachment filenames; userfriends fires GroupSaving before create/update; the user plugin fires Saving before registration/profile/admin writes. With no listener, each plugin's behavior is unchanged."
|
||||
- "The demo moderation listener filters user profile names, friend-group name/description and attachment filenames and maps a refusal to the owning plugin's existing 422 field shape."
|
||||
- "D-14: all three plugin changes are additive, their READMEs document the seams, sm-bm-app and sm-demo-app build and pass against the commits before any tag; no tag or push happens without user go-ahead."
|
||||
artifacts:
|
||||
- path: "../sm-oauthserver-plugin/testdata/parity/flows/"
|
||||
provides: "ten recorded PHP OIDC parity flows"
|
||||
contains: "discovery.yaml"
|
||||
- path: "../vue-chat-layer/app/composables/useChat.ts"
|
||||
provides: "catalog-aware slash routing and // escape"
|
||||
contains: "commands"
|
||||
- path: "../sm-chat-plugin/events/events.go"
|
||||
provides: "attachment filenames on MessageSaving"
|
||||
contains: "Attachment"
|
||||
- path: "../sm-userfriends-plugin/events/events.go"
|
||||
provides: "GroupSaving event"
|
||||
contains: "GroupSaving"
|
||||
- path: "../sm-user-plugin/classes/events.go"
|
||||
provides: "user Saving event"
|
||||
contains: "Saving"
|
||||
- path: "../sm-demo-app/plugins/demo/moderation.go"
|
||||
provides: "listeners for all new moderation surfaces"
|
||||
contains: "GroupSaving"
|
||||
key_links:
|
||||
- from: "../sm-wavepath-app/parity/php_parity.sh"
|
||||
to: "../sm-oauthserver-plugin/testdata/parity/flows/"
|
||||
via: "PARITY_INSTANCE=oidc seeds a parity user/client and records the runbook's ten flows"
|
||||
pattern: "oidc"
|
||||
- from: "../vue-chat-layer/app/composables/useChat.ts"
|
||||
to: "the loaded command catalog"
|
||||
via: "first-token membership decides local refusal versus dispatch"
|
||||
pattern: "trigger"
|
||||
- from: "../sm-demo-app/plugins/demo/moderation.go"
|
||||
to: "the three additive saving events"
|
||||
via: "festival listeners return each owning plugin's Rejection"
|
||||
pattern: "Listen"
|
||||
prohibitions:
|
||||
- statement: "OIDC recording never stages or overwrites the other session's sm-oauthserver-plugin/go.work change."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "Unknown slash text is not posted as ordinary text; only the explicit // escape posts it."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "No saving seam changes behavior when there is no listener."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "No plugin tag, push or changelog post without user go-ahead."
|
||||
status: unresolved
|
||||
verification: judgment
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
ROADMAP Goal (not in user-story format; no story is invented here): WavePath's community traffic is recorded from the PHP backend with `tide` and replayed against a Go app. This phase delivers the harness and the corpus: the `tide` additions, the `sm-wavepath-app` skeleton, the local PHP stack and scenario, the full PHP recording, and the foundation slice ported and green.
|
||||
|
||||
This plan's slice (plan 5 of 6, wave 2, file-independent of 31-04): close the three folded todos. Each task is its own vertical user capability: a real OIDC corpus that must pass the existing Go harness; slash text that is either deliberately dispatched/refused/escaped; and moderation from a write attempt through an additive event to a 422.
|
||||
|
||||
spec-less probe fallback skipped: Phase 31 has no mapped requirement IDs; SC, D and TODO identifiers are the phase-local acceptance set.
|
||||
|
||||
<objective>
|
||||
Record the missing PHP OIDC reference, make slash handling match D-22, and add moderation seams for profile/group names and attachment filenames without changing behavior for hosts that do not install listeners.
|
||||
|
||||
Purpose: these pending tasks share the Phase 31 PHP stack and chat-family release gate and should not remain hidden behind the corpus work.
|
||||
Output: a green OIDC parity corpus, catalog-aware slash behavior in vue-chat-layer, three documented additive plugin seams and demo moderation coverage.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@~/.claude/msd-core/workflows/execute-plan.md
|
||||
@~/.claude/msd-core/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-CONTEXT.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-RESEARCH.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-PATTERNS.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-02-SUMMARY.md
|
||||
|
||||
Repos: `../sm-oauthserver-plugin`, `../vue-chat-layer`, `../sm-chat-plugin`, `../sm-userfriends-plugin`, `../sm-user-plugin`, `../sm-demo-app`, and the local consumer pointer in `../sm-bm-app`.
|
||||
|
||||
Rules that bind this plan:
|
||||
- OIDC follows its runbook exactly: ten flows in order, no `--rules`, private vars file mode 0600, remove Set-Cookie, hashes only in the export.
|
||||
- D-22 supersedes the older todo wording: unknown slash text is refused locally and draft retained; `//` is the text escape.
|
||||
- Saving events fire after access/required-field checks and before a transaction/write. A listener error aborts the write. Rejection is a value and maps to 422.
|
||||
- User plugin changes are additive. Core behavior with no listener is byte-compatible.
|
||||
- Plugin first; consumer pointers after. Before any release, bm and demo are tested at the candidate commits. Pushing/tagging/changelog require explicit go-ahead and are not assumed by this autonomous plan.
|
||||
- Stage every repository by explicit path. Leave unrelated dirty files and oauthserver `go.work` untouched.
|
||||
|
||||
<interfaces>
|
||||
- OIDC runbook completion command: `PHASE194_REQUIRE_PARITY=1 go test -count=1 -run '^(TestPHPParityReplay|TestIDTokenShapeParity)$' -v ./...`.
|
||||
- vue-chat-layer state: `commands: ChatCommand[] | null`, `loadCommands`, `runCommand`, composer draft `d.text`.
|
||||
- Existing event exemplar: `chatevents.MessageSaving`; `chatcontracts.Rejection`; API `errors.As`.
|
||||
- New user/group rejection types follow the same value semantics in their owning `contracts` packages.
|
||||
</interfaces>
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="tracer">
|
||||
<name>Task 1: Record the ten PHP OIDC flows on the isolated oidc instance and make the existing parity harness mandatory-green</name>
|
||||
<precondition>31-02's stack supports `PARITY_INSTANCE=oidc`; the pinned oauthserver commit is present; `../sm-oauthserver-plugin/testdata/parity/README.md` lists the ten flows and the plugin's unrelated go.work change is left unstaged.</precondition>
|
||||
<files>../sm-oauthserver-plugin/testdata/parity/flows/, ../sm-oauthserver-plugin/testdata/parity/seed.json, ../sm-oauthserver-plugin/testdata/parity/winter-export.jsonl, ../sm-oauthserver-plugin/testdata/parity/id_token_shape.json, ../sm-oauthserver-plugin/testdata/parity/README.md</files>
|
||||
<read_first>../sm-oauthserver-plugin/testdata/parity/README.md (whole file), parity_test.go tests TestPHPParityReplay and TestIDTokenShapeParity, scripts/winter-export.sql, all ten existing request-only flows, 31-02-SUMMARY.md instance/port contract, ../sm-wavepath-app/parity/php_parity.sh and scripts/parity-stack.sh, pinned PHP oauthserver models and migrations through the parity export</read_first>
|
||||
<action>Per the folded OIDC todo, D-08 and D-20.
|
||||
1. Start `PARITY_INSTANCE=oidc` with its isolated database/export/ports. Seed one activated parity user and the `Parity RP` client (`https://rp.example.test/callback`, openid/profile/email, active, non-development, no prior consent), and mint the user's session token into `~/.config/summercms/parity-oauthserver.vars` with mode 0600. Add no committed secret.
|
||||
2. Record, in this exact order and stopping on first failure: discovery, jwks, authorize_errors, login_handoff, consent_allow, consent_silent, token_errors, userinfo_errors, consent_deny, authorizations. Invoke `summer parity:record --spec FLOW --output FLOW --target BASE --vars PRIVATE --update true`; do not pass `--rules`.
|
||||
3. Remove every Set-Cookie entry from recorded responses. Generate `seed.json`, `winter-export.jsonl` through the runbook's MariaDB export (hashes, not plaintext secrets), and `id_token_shape.json`. Reject a real hostname, token, client secret, authorization code or cookie in any committed file.
|
||||
4. Run the two mandatory parity tests. Resolve only observed documented differences through the existing deviation mechanism; do not broaden masks. Update the runbook with the automated `oidc` instance steps and exact green output.
|
||||
5. Commit only testdata paths: `test(oauthserver): record PHP OIDC parity against WavePath`.</action>
|
||||
<verify>
|
||||
<automated>PHASE194_REQUIRE_PARITY=1 go -C ../sm-oauthserver-plugin test -count=1 -run '^(TestPHPParityReplay|TestIDTokenShapeParity)$' -v ./... 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 2</automated>
|
||||
<fails_when>Non-zero exit or fewer than two PASS lines: a flow is absent/drifted, id-token shape differs, parity is still optional/skipped, or the filter matched nothing.</fails_when>
|
||||
<automated>test "$(stat -c %a ~/.config/summercms/parity-oauthserver.vars)" = 600 && ! rg -n 'Set-Cookie|eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.|client_secret"?\\s*:' ../sm-oauthserver-plugin/testdata/parity/flows ../sm-oauthserver-plugin/testdata/parity/seed.json ../sm-oauthserver-plugin/testdata/parity/winter-export.jsonl</automated>
|
||||
<fails_when>Non-zero exit: private vars permissions are wrong or a cookie/JWT/client secret appears in committed parity artifacts.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- All ten named flow files contain recorded responses and retain their request specs.
|
||||
- No flow contains Set-Cookie; export values are hashes only.
|
||||
- `git -C ../sm-oauthserver-plugin diff -- go.work` is exactly the pre-existing other-session diff and is not staged.
|
||||
- Both mandatory parity tests pass without a skip.
|
||||
</acceptance_criteria>
|
||||
<done>PHP OIDC behavior is a committed, secret-free reference corpus and the existing Go provider passes it under the mandatory parity flag.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 2: Match WavePath slash behavior: known dispatch, local unknown refusal with draft retained, and // text escape</name>
|
||||
<files>../vue-chat-layer/app/composables/useChat.ts, ../vue-chat-layer/tests/store.test.ts, ../vue-chat-layer/README.md</files>
|
||||
<read_first>31-CONTEXT.md D-22, 31-RESEARCH.md "Slash text that names no command", ../vue-chat-layer/app/composables/useChat.ts send/runCommand/loadCommands and command state, ../vue-chat-layer/tests/store.test.ts existing slash cases and fake API, /media/nvme/dev/jz/wavepath.org/vue-wavepath-app/src/stores/channelChatStore.ts slash branch and MessageComposer handling (read-only)</read_first>
|
||||
<behavior>
|
||||
- Known `/demo arg` with catalog trigger `demo` calls dispatch once, does not call message send and clears the draft on success.
|
||||
- Unknown `/nope arg` with a loaded non-empty catalog calls neither dispatch nor message send, adds the local unknown-command hint and keeps the exact draft.
|
||||
- `//r/golang is great` calls ordinary message send with `/r/golang is great`, never dispatches, and clears the draft only on send success.
|
||||
- Bare `/` follows ordinary send; when the loaded catalog is empty, slash text follows WavePath's ordinary-send branch; while catalog is null, load it before deciding and do not race a send against the lookup.
|
||||
</behavior>
|
||||
<action>Per D-22.
|
||||
1. Red first: replace the old server-422 unknown-command expectation with the behavior block. Assert exact draft, dispatch/send call counts, arguments and ephemeral hint. Add the `//`, bare slash, empty catalog and null/loading cases.
|
||||
2. In `send`, handle `//` before command dispatch: remove exactly one leading slash and pass the remainder through the normal text-send path. Do not mutate the draft until that send succeeds.
|
||||
3. For one-leading-slash content with a non-empty trigger token, ensure the catalog is loaded. Compare the first token after `/` case-normalized in the same manner as existing command triggers. A known trigger calls `runCommand`; an unknown trigger pushes the existing local error row/hint, returns false and leaves `d.text` untouched. A bare `/` is not a trigger.
|
||||
4. Preserve the WavePath empty-catalog behavior documented in D-22/research: on a surface whose loaded catalog is empty, slash text uses ordinary message send. Do not silently post unknown slash text when a catalog exists.
|
||||
5. Update the layer README's command behavior and `//` escape. Commit: `fix(chat-layer): match WavePath slash command handling`.</action>
|
||||
<verify>
|
||||
<automated>pnpm --dir ../vue-chat-layer test -- --run 2>&1 | tee "${TMPDIR:-/tmp}/vue-chat-layer-test.log" && ! grep -qE '(^|[^0-9])([1-9][0-9]*) failed' "${TMPDIR:-/tmp}/vue-chat-layer-test.log"</automated>
|
||||
<fails_when>Non-zero exit or failed-test count: known/unknown/escape behavior differs, draft handling regressed, or another layer test failed.</fails_when>
|
||||
<automated>pnpm --dir ../vue-chat-layer run build:playground</automated>
|
||||
<fails_when>Non-zero exit: the composable's changed types or runtime imports do not build in the layer playground.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- Unknown `/nope` with a loaded catalog invokes neither API dispatch nor message send and preserves the draft.
|
||||
- `//text` sends `/text` through the ordinary path.
|
||||
- No backend or shared Go plugin changes for slash handling.
|
||||
- README describes all four branches: known, unknown, escape, bare/empty catalog.
|
||||
</acceptance_criteria>
|
||||
<done>A user can deliberately post slash-prefixed text with //, while accidental unknown commands are refused locally exactly as WavePath specifies.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 3: Add additive user/group/filename saving seams and moderate them in the demo without changing listener-free behavior</name>
|
||||
<files>../sm-chat-plugin/events/events.go, ../sm-chat-plugin/classes/service.go, ../sm-chat-plugin/saving_test.go, ../sm-chat-plugin/README.md, ../sm-userfriends-plugin/events/events.go, ../sm-userfriends-plugin/contracts/rejection.go, ../sm-userfriends-plugin/classes/group_service.go, ../sm-userfriends-plugin/api/errors.go, ../sm-userfriends-plugin/saving_test.go, ../sm-userfriends-plugin/README.md, ../sm-user-plugin/classes/events.go, ../sm-user-plugin/contracts/rejection.go, ../sm-user-plugin/controllers/registration.go, ../sm-user-plugin/controllers/api_controller.go, ../sm-user-plugin/controllers/users_admin_controller.go, ../sm-user-plugin/saving_test.go, ../sm-user-plugin/README.md, ../sm-demo-app/plugins/demo/moderation.go, ../sm-demo-app/plugins/demo/plugin.go, ../sm-demo-app/moderation_test.go, ../sm-demo-app/go.mod, ../sm-demo-app/go.sum, ../sm-demo-app/plugins/golem15/chat, ../sm-demo-app/plugins/golem15/user, ../sm-demo-app/plugins/golem15/userfriends, ../sm-bm-app/plugins/golem15/chat</files>
|
||||
<read_first>31-PATTERNS.md "Folded todo: saving seams", ../sm-chat-plugin/events/events.go, classes/service.go attachment claim flow, classes/writes.go edit fire, contracts/rejection.go, api/errors.go, saving_test.go; ../sm-forum-plugin/events/events.go and classes/forum_service.go saving event; ../sm-userfriends-plugin/events/events.go, classes/group_service.go create/update/fire, api/errors.go; ../sm-user-plugin/classes/events.go, controllers registration/api/admin write paths and validation writers; ../sm-demo-app/plugins/demo/moderation.go, plugin.go and moderation_test.go; module READMEs</read_first>
|
||||
<behavior>
|
||||
- Chat: MessageSaving on create carries the filenames of attachment ids being claimed; no attachments yields an empty slice; rejection field `attachments` returns 422 and stores neither message nor claims; no listener preserves current response and storage.
|
||||
- Userfriends: GroupSaving fires for create and update after access/required checks but before transaction/write, with op, actor, group id, name and description; Rejection maps to a 422 field; no listener preserves current behavior.
|
||||
- User: Saving fires before frontend registration/profile update and backend-admin create/update with operation, actor where known, user id, name and surname; Rejection maps to each path's existing 422 field; no listener preserves current behavior.
|
||||
- Demo: banned content in profile name/surname, group name/description or any claimed attachment filename produces the owning API's 422 and leaves storage unchanged.
|
||||
</behavior>
|
||||
<action>Per the moderation folded todo and D-14.
|
||||
1. Red first in each plugin: table-driven smoke cases from the behavior block, including no-listener compatibility, owning Rejection, plain listener error (500/rollback), event ordering and no post-save event after refusal.
|
||||
2. Chat: add `AttachmentFilenames []string` (or the final neutral plural name) to `MessageSaving`. In `SendMessageWith`, resolve pending attachment rows owned by the actor and collect basename/original names after validation but before firing; do not claim them yet. Existing listeners see the zero value. Edit events carry no attachment names.
|
||||
3. Userfriends: add operation constants and `GroupSaving` in `events`, plus value `contracts.Rejection`. Extend the service fire type switch; fire create/update after permission and required checks and before transaction/write. Map Rejection in `api/errors.go`, defaulting an empty field to `name`.
|
||||
4. User: add `SavingEvent`, operation constants, `FireSavingEvent`, and value Rejection. Fire from frontend registration, profile update and backend-admin create/update after request validation and authorization but before persistence. Include proposed name/surname values, not mutable model pointers. Map a rejection through each handler's existing validation writer.
|
||||
5. Update all three READMEs in their API-reference/event sections. These are additive exported APIs; no behavior changes without a listener.
|
||||
6. Demo: register listeners only when each plugin is active. Filter profile fields and group fields with `Filter.Check`; filter each filename and reject field `attachments` on the first refusal. Update plugin/package comments and extend `moderation_test.go` over real HTTP paths with unchanged row counts.
|
||||
7. Commit plugin changes independently. Point bm/demo submodules locally at candidate commits. Run bm and demo gates before any requested tag. If the user has separately authorized release, push/tag each plugin, post its changelog, then commit consumer pointers separately; otherwise stop at clean local commits and record release-ready hashes.</action>
|
||||
<verify>
|
||||
<automated>for r in sm-chat-plugin sm-userfriends-plugin sm-user-plugin; do go -C ../$r vet ./... && go -C ../$r test -count=1 -short ./... || exit 1; done && go -C ../sm-chat-plugin test -count=1 -run '^TestMessageSaving' -v . 2>&1 | grep -q -- '^--- PASS:' && go -C ../sm-userfriends-plugin test -count=1 -run '^TestGroupSaving' -v . 2>&1 | grep -q -- '^--- PASS:' && go -C ../sm-user-plugin test -count=1 -run '^TestSaving' -v . 2>&1 | grep -q -- '^--- PASS:'</automated>
|
||||
<fails_when>Non-zero exit or a PASS line absent: a plugin does not vet/test, listener-free behavior changed, a rejection writes data, or a named saving test did not run.</fails_when>
|
||||
<automated>go -C ../sm-demo-app vet . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -run '^TestDemoModeration' -v . 2>&1 | grep -q -- '^--- PASS: TestDemoModeration' && go -C ../sm-bm-app build ./... && go -C ../sm-bm-app test -count=1 -run '^(TestChatMounted|TestRealtimeDefaultDriver|TestRealtimeRoutes|TestRealtimeConfigDefaults|TestRemoteKeyOverride)$' -v . 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 5</automated>
|
||||
<fails_when>Non-zero exit, demo moderation PASS absent, or bm prints fewer than five PASS lines: the listeners do not reject through HTTP, a consumer fails at candidate commits, or required bm tests did not run.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- Each plugin has a no-listener compatibility assertion and a refusal-no-write assertion.
|
||||
- Existing MessageSaving listeners compile unchanged.
|
||||
- User saving covers frontend and backend-admin writes; group saving covers create/update; filename saving covers claims on message create.
|
||||
- READMEs name only exported identifiers that exist.
|
||||
- No tag/push/changelog occurs without explicit authorization.
|
||||
</acceptance_criteria>
|
||||
<done>Hosts can moderate all requested names and filenames through additive pre-save events, and the demo proves refusals while unlistened plugins remain compatible.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| PHP OIDC provider to committed fixtures | auth codes, cookies, tokens and client secrets must not enter git |
|
||||
| composer input to chat API | slash parsing decides command execution versus message creation |
|
||||
| untrusted names/filenames to persistent models | moderation runs before user, group, message and file-claim writes |
|
||||
| shared-plugin commits to consumers | additive APIs still must compile and behave in bm/demo |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| T-31-26 | Information disclosure | OIDC recorded flows/export | high | mitigate | private mode-0600 vars, Set-Cookie removal, hashes-only export, token/secret scan and mandatory parity tests |
|
||||
| T-31-27 | Tampering | OIDC masks hiding a real difference | medium | mitigate | fixed ordered runbook, no `--rules`, existing narrow deviations only and strict `PHASE194_REQUIRE_PARITY=1` |
|
||||
| T-31-28 | Elevation of privilege | slash text dispatched as an unintended command | medium | mitigate | loaded-catalog first-token match; unknown triggers never call dispatch; explicit tests for dispatch/send call counts |
|
||||
| T-31-29 | Tampering | `//` escape altering more than one slash | low | accept | deterministic one-character removal is directly covered; remaining risk is cosmetic user input, not authorization |
|
||||
| T-31-30 | Tampering | moderation event fires after persistence | high | mitigate | fire after checks and before transaction/write; refusal and plain-error tests assert unchanged row/claim counts |
|
||||
| T-31-31 | Denial of service | listener recursion or mutable event payload | medium | mitigate | immutable proposed scalar fields/slices, one pre-save fire per operation, no model save from the framework seam |
|
||||
| T-31-32 | Spoofing | consumer gate tests wrong plugin revision | high | mitigate | local submodule pointers are set to exact candidate commits before bm/demo build/tests; release hashes recorded |
|
||||
| T-31-SC | Tampering | npm/pip/cargo installs | high | mitigate | no new package; pnpm runs existing scripts without install and Go dependencies are unchanged |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
- OIDC: ten ordered flows, mandatory PHP replay and id-token shape tests, no committed secrets.
|
||||
- Slash: Vitest and playground build for known, unknown, escape, bare, empty and loading catalog branches.
|
||||
- Moderation: three plugin suites plus demo HTTP refusal tests and bm compatibility at exact commits.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
The OIDC parity TODO is closed with mandatory green tests; vue-chat-layer implements D-22 exactly; user, group and attachment-filename moderation is available through additive documented seams; demo and bm remain green at candidate commits.
|
||||
</success_criteria>
|
||||
|
||||
## Artifacts this phase produces
|
||||
|
||||
- OIDC: ten recorded flows, `seed.json`, `winter-export.jsonl`, `id_token_shape.json`.
|
||||
- Layer behavior: catalog-aware slash dispatch/refusal and `//` escape.
|
||||
- Plugin APIs: chat attachment filenames on `MessageSaving`; userfriends `GroupSaving` plus Rejection; user `SavingEvent` plus Rejection.
|
||||
- Demo listeners and HTTP moderation coverage.
|
||||
- Release-ready plugin commit hashes (tags/pushes only if separately authorized).
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-05-SUMMARY.md` when done: OIDC instance/flow hashes and test output; slash branch behavior and layer commit; final event type/field names and firing paths; plugin/demo/bm commits and test evidence; release/tag status; unrelated dirty files left untouched.
|
||||
</output>
|
||||
@@ -0,0 +1,285 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 06
|
||||
type: execute
|
||||
wave: 4
|
||||
depends_on: [31-01, 31-02, 31-03, 31-04, 31-05]
|
||||
files_modified:
|
||||
- modules/tide/normalize_test.go
|
||||
- modules/tide/centrifugo_test.go
|
||||
- modules/tide/centrifugo_golden_test.go
|
||||
- modules/tide/manifest_test.go
|
||||
- modules/tide/upstream_test.go
|
||||
- modules/tide/variables_test.go
|
||||
- modules/tide/headers_test.go
|
||||
- modules/tide/rules_test.go
|
||||
- modules/tide/fixture_test.go
|
||||
- cmd/summer/parity_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/response_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/groups_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/members_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/invites_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/friends_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/classes/context_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/classes/authorizer_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/lifecycle_test.go
|
||||
- ../sm-wavepath-app/parity/check_corpus_test.go
|
||||
- ../sm-wavepath-app/parity/parity_test.go
|
||||
- ../sm-wavepath-app/parity/broadcast_test.go
|
||||
- ../sm-wavepath-app/parity/upstream_replay_test.go
|
||||
- ../sm-wavepath-app/parity/gate_test.go
|
||||
- ../sm-wavepath-app/scripts/check-parity.sh
|
||||
- ../sm-chat-plugin/saving_test.go
|
||||
- ../sm-userfriends-plugin/saving_test.go
|
||||
- ../sm-user-plugin/saving_test.go
|
||||
- ../sm-demo-app/moderation_test.go
|
||||
- ../vue-chat-layer/tests/store.test.ts
|
||||
autonomous: true
|
||||
requirements: [SC-1, SC-2, SC-3, SC-4, D-01, D-03, D-06, D-09, D-10, D-11, D-13, D-14, D-16, D-22]
|
||||
estimate:
|
||||
tokens: 300000
|
||||
raw_tokens: 300000
|
||||
tasks: 3
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "Every generic tide addition from 31-01 has table-driven positive, malformed, compatibility and fail-closed coverage; old fixture/manifest/sidecar forms still load."
|
||||
- "Every foundation handler family has unit coverage for success, validation, unauthenticated, role/access denial, nested-id scoping, nil/empty serialization and service/internal failure."
|
||||
- "Contexts, resolvers, wave/presence authorizers and group lifecycle have injected-check/transaction tests, including malformed channels, cross-group ids, rollback and idempotency."
|
||||
- "The parity checker and gate have mutation tests proving they fail on zero/skipped tests, unrecorded cases, pending foundation ids, orphan/missing broadcast or upstream sidecars, secret residue, wrong reference commits and a consumer failure."
|
||||
- "The three folded todos retain focused regression coverage, including no-listener plugin compatibility and the six slash branches."
|
||||
- "The complete phase gate is green with 196/196 recorded, 36 ported, 160 pending and foundation-pending 0; framework docs checker, vet and all short suites are green."
|
||||
artifacts:
|
||||
- path: "modules/tide/manifest_test.go"
|
||||
provides: "table-driven per-case recording, repeat/reference and compatibility coverage"
|
||||
contains: "TestManifest"
|
||||
- path: "../sm-wavepath-app/plugins/golem15/wavepath/classes/authorizer_test.go"
|
||||
provides: "wave and presence authorization matrix"
|
||||
contains: "TestAuthorize"
|
||||
- path: "../sm-wavepath-app/parity/check_corpus_test.go"
|
||||
provides: "corpus checker mutation matrix"
|
||||
contains: "TestCheckCorpus"
|
||||
- path: "../sm-wavepath-app/parity/gate_test.go"
|
||||
provides: "fail-closed shell-gate detector tests"
|
||||
contains: "TestGate"
|
||||
key_links:
|
||||
- from: "../sm-wavepath-app/scripts/check-parity.sh"
|
||||
to: "../sm-wavepath-app/parity/gate_test.go"
|
||||
via: "testable detector functions or planted outputs prove every green condition"
|
||||
pattern: "self-test"
|
||||
- from: "../sm-wavepath-app/parity/parity_test.go"
|
||||
to: "../sm-wavepath-app/parity/manifest.yaml"
|
||||
via: "strict replay counts only ported routes and requires all fixtures/sidecars"
|
||||
pattern: "ported"
|
||||
- from: "cmd/summer/parity_test.go"
|
||||
to: "modules/tide/"
|
||||
via: "CLI tests exercise final flag wiring into manifest record/replay"
|
||||
pattern: "case-hook"
|
||||
prohibitions:
|
||||
- statement: "This final plan adds no new production capability; a failing test that reveals a production bug gets the smallest fix plus an explicit note in the summary."
|
||||
status: unresolved
|
||||
verification: judgment
|
||||
- statement: "No Docker-backed test skips silently in the full gate; `-short` is the only allowed skip mode."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
- statement: "No pending route is counted as passing and no allow flag is used for the foundation gate."
|
||||
status: unresolved
|
||||
verification: automated
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
ROADMAP Goal (not in user-story format; no story is invented here): WavePath's community traffic is recorded from the PHP backend with `tide` and replayed against a Go app. This phase delivers the harness and the corpus: the `tide` additions, the `sm-wavepath-app` skeleton, the local PHP stack and scenario, the full PHP recording, and the foundation slice ported and green.
|
||||
|
||||
This plan's slice (plan 6 of 6, wave 4, unit tests last): convert the earlier smoke proofs into table-driven regression coverage and prove the complete fail-closed phase gate. The leading tracer is a mutation test of one recorded foundation case through response, broadcast, upstream and gate verdict; expansions cover tide, handler/access/lifecycle matrices and folded-todo regressions.
|
||||
|
||||
spec-less probe fallback skipped: Phase 31 has no mapped requirement IDs; SC and D identifiers are the phase-local acceptance set.
|
||||
|
||||
<objective>
|
||||
Deliver the phase's unit-test plan last: comprehensive table-driven coverage for tide additions, the foundation app plugin and parity harness/checkers, plus the folded-todo regressions and final gate/docs evidence.
|
||||
|
||||
Purpose: smoke tests prove paths exist; this plan proves malformed inputs, denials, compatibility and fail-closed behavior cannot regress.
|
||||
Output: focused test matrices across touched repos and a green foundation phase gate with docs verification.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@~/.claude/msd-core/workflows/execute-plan.md
|
||||
@~/.claude/msd-core/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-CONTEXT.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-RESEARCH.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-PATTERNS.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-VALIDATION.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-01-SUMMARY.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-02-SUMMARY.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-03-SUMMARY.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-04-SUMMARY.md
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-05-SUMMARY.md
|
||||
|
||||
Rules that bind this plan:
|
||||
- Unit tests are the final plan. Prefer table-driven tests in existing files; smoke tests from earlier plans remain as integration sentinels.
|
||||
- Tests assert observable behavior, not implementation details. For parity, mutate a copy in a temp directory; never mutate committed fixtures.
|
||||
- Docker tests call `flag.Parse()` and skip only under `testing.Short()`. A missing Docker daemon in a full run is a failure.
|
||||
- Every filtered command proves named tests ran by matching PASS lines or exact counts.
|
||||
- Run sibling repositories with `go -C`; stage by explicit path; leave unrelated dirty work alone.
|
||||
- If a test reveals a bug, add the smallest production fix in its owning earlier-plan file, rerun that repository and document the deviation from the test-only file list.
|
||||
|
||||
<interfaces>
|
||||
Use final names/signatures from all five summaries, not draft names in PLAN files. Preserve test naming already required by `scripts/check-parity.sh`.
|
||||
</interfaces>
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="tracer">
|
||||
<name>Task 1: Tracer test: mutate one foundation case at each side-effect boundary and prove replay and the gate fail closed</name>
|
||||
<precondition>31-04's gate summary is `recorded 196/196 ported 36 pending 160 foundation-pending 0` and 31-05's repo suites are green.</precondition>
|
||||
<files>../sm-wavepath-app/parity/parity_test.go, ../sm-wavepath-app/parity/broadcast_test.go, ../sm-wavepath-app/parity/upstream_replay_test.go, ../sm-wavepath-app/parity/gate_test.go, ../sm-wavepath-app/scripts/check-parity.sh</files>
|
||||
<read_first>31-03-SUMMARY.md fixture/sidecar counts, 31-04-SUMMARY.md tracer route and gate output, parity_test.go, broadcast_test.go, upstream_replay_test.go, scripts/check-parity.sh, ../fonoteka.go/parity/parity_test.go negative subtests, scripts/check-phase19.1.sh self-test detector pattern</read_first>
|
||||
<action>Per D-10, D-11, D-13 and D-16.
|
||||
1. Add `TestFoundationParityFailClosed` using a temp copy of the tracer fixture and sidecars. Table cases: response status/body mutation, removed broadcast, extra broadcast, changed broadcast body, removed expected upstream call, extra upstream sidecar/call, route set back to pending, missing seed hook and a planted accepted-difference without sign-off. Each mutation must produce a non-empty error naming route and case; the untouched control passes.
|
||||
2. Add `TestGateFailClosed` around extracted/testable detector functions or `scripts/check-parity.sh --self-test`: planted go-test JSON for fail, skip, zero tests and missing required name; checker output with unrecorded case, foundation pending, wrong counts/reference, secret residue; consumer command failure. Each is refused.
|
||||
3. Keep the real gate script's behavior unchanged except for factoring detector helpers and adding checks that mutation tests expose. No allow flag in its normal path.
|
||||
4. Commit: `test(parity): prove foundation replay and gate fail closed`.</action>
|
||||
<verify>
|
||||
<automated>go -C ../sm-wavepath-app test -count=1 -run '^(TestFoundationParityFailClosed|TestGateFailClosed)$' -v ./parity 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 2</automated>
|
||||
<fails_when>Non-zero exit or fewer than two PASS lines: an altered response/sidecar/manifest/gate signal was accepted, the untouched control failed, or a named test did not run.</fails_when>
|
||||
<automated>../sm-wavepath-app/scripts/check-parity.sh --self-test 2>&1 | grep -q 'self-test: ok'</automated>
|
||||
<fails_when>Non-zero exit or marker absent: at least one planted false-green condition is not rejected by the executable gate.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- Every table mutation fails for the intended reason and names the route/case or gate stage.
|
||||
- Committed fixtures and sidecars remain byte-identical; all mutation happens in a temp directory.
|
||||
- The untouched control traverses response, broadcast and upstream checks and passes.
|
||||
</acceptance_criteria>
|
||||
<done>A single end-to-end foundation case proves that no missing or altered observable can produce a green parity or gate verdict.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 2: Complete table-driven tide, foundation handler, resolver, authorizer, lifecycle and corpus-checker coverage</name>
|
||||
<files>modules/tide/normalize_test.go, modules/tide/centrifugo_test.go, modules/tide/centrifugo_golden_test.go, modules/tide/manifest_test.go, modules/tide/upstream_test.go, modules/tide/variables_test.go, modules/tide/headers_test.go, modules/tide/rules_test.go, modules/tide/fixture_test.go, cmd/summer/parity_test.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/response_test.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/groups_test.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/members_test.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/invites_test.go, ../sm-wavepath-app/plugins/golem15/wavepath/api/friends_test.go, ../sm-wavepath-app/plugins/golem15/wavepath/classes/context_test.go, ../sm-wavepath-app/plugins/golem15/wavepath/classes/authorizer_test.go, ../sm-wavepath-app/plugins/golem15/wavepath/lifecycle_test.go, ../sm-wavepath-app/parity/check_corpus_test.go</files>
|
||||
<read_first>31-01-SUMMARY.md final tide APIs, every tide smoke test and adjacent existing unit tests, cmd/summer/parity_test.go, 31-04-SUMMARY.md final handler/type/route names, app-plugin production files, all foundation recorded denial/validation fixtures, parity/check_corpus.go and fonoteka's checker tests</read_first>
|
||||
<behavior>
|
||||
- Tide T-1..T-10 and Reference: valid, malformed, disabled/absent/default, strict YAML round-trip and old-format compatibility cases.
|
||||
- Tide security: undeclared credentials/cookies refused; wrong JWT scheme/claims rejected; body comparer scoped by host/content type; case hook has no shell interpolation; listeners require loopback; repeat bound enforced.
|
||||
- Foundation handlers: each family has success, malformed JSON, missing actor, role denial, missing/cross-group nested id, validation rejection, nil service/database and unexpected error; exact status, envelope and row-count effects.
|
||||
- Authorizers/resolvers: malformed channel/context, zero user, absent/error DB, non-member/member/role cases and exact allowed info/capabilities.
|
||||
- Lifecycle: create is idempotent, owner MemberJoined does not duplicate default channel, member leave/join behavior, delete cleanup, child failure rolls back all changes.
|
||||
- Corpus checker: route/snapshot/auth mismatch, missing fixture, wrong ported status, missing/orphan broadcast/upstream, every secret pattern, wrong reference commit, missing D-19 provenance and wrong foundation set.
|
||||
</behavior>
|
||||
<action>Per SC-4.
|
||||
1. Replace or extend the 31-01 smoke coverage with table-driven tests in the canonical tide test files. Cover all final exported options and strict loaders/writers; load representative pre-Phase-31 fixtures/manifests/sidecars to prove backward compatibility.
|
||||
2. Add CLI tests that parse the final record/replay flags, reject their use outside manifest mode, reject non-loopback listeners and non-executable case hooks, and prove hook ids are environment data rather than shell input.
|
||||
3. Add app-plugin unit matrices with injected services/checks and `httptest`. Use real fixture snippets for exact envelope/key/null behavior, but keep database integration in the existing parity tests.
|
||||
4. Add resolver/authorizer pure tables and lifecycle transaction tests over testcontainers or the app's test DB. Assert rows and event/publication calls before and after rollback.
|
||||
5. Extend `check_corpus_test.go` with temp manifests/sidecars for every behavior row. Include all secret forms: JWT, wave token, cookie, invite/webhook/call-link code and minted vendor credential.
|
||||
6. Commit framework tests separately from app tests: `test(tide): cover Phase 31 recording additions`; `test(wavepath): cover foundation handlers and access`; `test(parity): cover corpus checker failures`.</action>
|
||||
<verify>
|
||||
<automated>go vet ./modules/tide/ ./cmd/summer/ && go test -count=1 -short ./modules/tide/ ./cmd/summer/ && go test -count=1 -run '^(TestRelative|TestManifest|TestUpstream|TestCookie|TestExtraHeaders|TestClient|TestRepeat|TestCentrifugo)' -v ./modules/tide/ 2>&1 | tee "${TMPDIR:-/tmp}/tide-unit.log" && grep -q -- '^--- PASS:' "${TMPDIR:-/tmp}/tide-unit.log" && ! grep -q -- '^--- FAIL:' "${TMPDIR:-/tmp}/tide-unit.log"</automated>
|
||||
<fails_when>Non-zero exit, no PASS line or any FAIL line: tide/cmd tests do not compile, a compatibility/security/edge table fails, or the filter matched nothing.</fails_when>
|
||||
<automated>go -C ../sm-wavepath-app vet ./plugins/golem15/wavepath/... ./parity/... && go -C ../sm-wavepath-app test -count=1 -run '^(Test(Response|Groups|Members|Invites|Friends|Context|Authorize|Lifecycle|CheckCorpus))' -v ./plugins/golem15/wavepath/... ./parity 2>&1 | tee "${TMPDIR:-/tmp}/wavepath-unit.log" && grep -q -- '^--- PASS:' "${TMPDIR:-/tmp}/wavepath-unit.log" && ! grep -q -- '^--- FAIL:' "${TMPDIR:-/tmp}/wavepath-unit.log"</automated>
|
||||
<fails_when>Non-zero exit, no PASS line or any FAIL line: handler/access/lifecycle/checker unit matrices fail, Docker-backed lifecycle setup fails, or named tests did not run.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- Every behavior bullet has at least one named table row and failure output names the row.
|
||||
- Old tide fixture/manifest/upstream files from before Phase 31 load unchanged.
|
||||
- Every high threat T-31-01..T-31-32 that belongs to tide/foundation/checkers has a direct regression test or gate mutation.
|
||||
- Production changes, if any bug is found, are minimal and listed in the summary.
|
||||
</acceptance_criteria>
|
||||
<done>The generic recording toolkit, foundation app plugin and parity checkers have deterministic positive, edge, compatibility and fail-closed unit coverage.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 3: Run folded-todo regressions, full foundation gate, consumer suites and framework docs checks</name>
|
||||
<files>../sm-chat-plugin/saving_test.go, ../sm-userfriends-plugin/saving_test.go, ../sm-user-plugin/saving_test.go, ../sm-demo-app/moderation_test.go, ../vue-chat-layer/tests/store.test.ts, ../sm-wavepath-app/scripts/check-parity.sh</files>
|
||||
<read_first>31-05-SUMMARY.md final event/field names and commits, saving tests in all three plugins, demo moderation tests, layer slash tests, 31-VALIDATION.md, project CLAUDE.md commands, scripts/check-parity.sh required test list</read_first>
|
||||
<action>Per SC-3, SC-4, D-14 and D-22.
|
||||
1. Expand the three saving test files into tables for every fire path, operation, field default, listener-free control, owning Rejection, plain error and no-write/no-post-event behavior. Expand demo moderation to each requested field and filename position.
|
||||
2. Keep the slash test matrix explicit for known, unknown, `//`, bare `/`, empty loaded catalog and null/loading catalog; run the full layer suite and playground build.
|
||||
3. Run each touched plugin's full short suite, demo's root/plugin suite and bm's build/required tests at the exact candidate commits recorded in 31-05.
|
||||
4. Run `scripts/check-parity.sh` with no allow flags. It must execute corpus completeness, strict ported replay, broadcasts, upstream, foundation, consumers and self-tests and print exactly `recorded 196/196 ported 36 pending 160 foundation-pending 0`.
|
||||
5. Run framework vet/short tests and both docs checks. Confirm the framework diff contains no consuming-application name and module docs match final tide identifiers/flags.
|
||||
6. Update `31-VALIDATION.md` status through the validation workflow when execution reaches its sign-off; do not raw-edit STATE.md. Post the Phase 31 g15office progress comment through the configured integration.
|
||||
7. Commit test-only expansions per repository. Planning/code commits remain separate.</action>
|
||||
<verify>
|
||||
<automated>for r in sm-chat-plugin sm-userfriends-plugin sm-user-plugin; do go -C ../$r vet ./... && go -C ../$r test -count=1 -short ./... || exit 1; done && go -C ../sm-demo-app vet . ./plugins/demo/... && go -C ../sm-demo-app test -count=1 -short . ./plugins/demo/... && go -C ../sm-bm-app build ./... && go -C ../sm-bm-app test -count=1 -run '^(TestChatMounted|TestRealtimeDefaultDriver|TestRealtimeRoutes|TestRealtimeConfigDefaults|TestRemoteKeyOverride)$' .</automated>
|
||||
<fails_when>Non-zero exit: a saving seam, demo listener or existing consumer behavior fails at the candidate commits, or a required bm test fails.</fails_when>
|
||||
<automated>pnpm --dir ../vue-chat-layer test -- --run && pnpm --dir ../vue-chat-layer run build:playground</automated>
|
||||
<fails_when>Non-zero exit: any slash regression or existing layer test fails, or the playground does not build.</fails_when>
|
||||
<automated>OUT="$(../sm-wavepath-app/scripts/check-parity.sh 2>&1)" && printf '%s\n' "$OUT" | grep -qx 'check-parity: recorded 196/196 ported 36 pending 160 foundation-pending 0'</automated>
|
||||
<fails_when>Non-zero exit or exact summary absent: a corpus/golden/upstream/foundation/consumer/self-test stage failed, a required test skipped, Docker was unavailable, or an allow flag was needed.</fails_when>
|
||||
<automated>go vet ./... && go test -count=1 -short ./... && go run ./cmd/summer docs:build --check 2>&1 | grep -q 'no problems found' && go test -count=1 -run '^TestDocsTree$' -v ./cmd/summer 2>&1 | grep -q -- '^--- PASS: TestDocsTree'</automated>
|
||||
<fails_when>Non-zero exit: framework vet/short tests fail, docs drift or name an absent identifier/command, or TestDocsTree did not run and pass.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- All folded-todo regression tables pass, including no-listener controls.
|
||||
- Full gate uses no allow flag and prints the exact 196/36/160/0 counts.
|
||||
- Framework docs build/check and TestDocsTree pass; no consuming app name was added to framework source/docs/tests.
|
||||
- Each touched repository is clean for files owned by this phase; unrelated changes remain unstaged.
|
||||
</acceptance_criteria>
|
||||
<done>Phase 31's unit suites, consumers, foundation gate and documentation checks are green, with remaining 160 routes explicitly pending for Phases 31.1 and 31.2.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| test output to release verdict | skipped/zero/missing tests must not look green |
|
||||
| temp mutations to committed corpus | negative tests must not alter the reference fixtures |
|
||||
| plugin candidate commits to consumers | tests must exercise exact revisions, not workspace fallbacks |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| T-31-33 | Spoofing | gate passes on zero, skipped or missing tests | high | mitigate | planted go-test JSON detector matrix, exact required test names and PASS/count checks |
|
||||
| T-31-34 | Tampering | negative tests modify committed corpus | high | mitigate | copy fixture/manifest/sidecar trees to t.TempDir; clean-tree and hash checks after mutation suite |
|
||||
| T-31-35 | Repudiation | untested threat mitigations | medium | mitigate | map high threats to named unit/gate cases and record command evidence in summary |
|
||||
| T-31-36 | Spoofing | consumer tests resolve wrong plugin commit | high | mitigate | assert submodule HEAD equals 31-05 candidate hash before bm/demo tests |
|
||||
| T-31-37 | Denial of service | Docker failure represented as skip | medium | mitigate | TestMain skips only under testing.Short; full gate treats unavailable Docker and skipped required names as failure |
|
||||
| T-31-SC | Tampering | npm/pip/cargo installs | high | mitigate | tests use existing dependencies; no install or manifest change |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
- Tracer mutation suite proves one foundation case and gate fail on every observable boundary.
|
||||
- Tide/foundation/checker tables cover normal, malformed, compatibility, denial and rollback behavior.
|
||||
- Folded regressions, consumers, complete foundation gate, framework vet/short tests and docs checks all pass.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
All Phase 31 code has last-plan unit coverage; fail-closed mutations are proven; the exact gate summary is 196 recorded, 36 ported, 160 pending, foundation-pending 0; bm/demo/layer/plugin suites and framework docs checks are green.
|
||||
</success_criteria>
|
||||
|
||||
## Multi-Source Coverage Audit
|
||||
|
||||
| SOURCE | ID | Feature/requirement | Plan | Status | Notes |
|
||||
|--------|----|---------------------|------|--------|-------|
|
||||
| GOAL | — | tide additions, app skeleton, PHP stack/scenario, full recording, foundation green | 31-01..31-04 | COVERED | 31-05 folded todos; 31-06 tests |
|
||||
| REQ | — | ROADMAP requirements are TBD | — | EXCLUDED | phase-local SC-1..SC-4 used, as decided in research |
|
||||
| CONTEXT | D-01..D-05 | unchanged paths, app repo, host logic, scenario, no Phase 30 | 31-02, 31-04 | COVERED | |
|
||||
| CONTEXT | D-06..D-11 | unattended proxy/spec recording, isolated stack, 196 routes, broadcasts, case depth/upstreams | 31-01..31-03 | COVERED | cutover re-record remains deferred |
|
||||
| CONTEXT | D-12..D-15 | freeze, quirks/security differences, consumer gate, fail-closed gate | 31-01, 31-03, 31-04, 31-06 | COVERED | zero pending is explicitly Phase 31.2 per D-16 |
|
||||
| CONTEXT | D-16..D-22 | phase split, two clients, notes retained later, 17 cases, checkout isolation, cookie JWT, slash behavior | 31-02, 31-03, 31-05 | COVERED | notes port is Phase 31.2; recording is Phase 31 |
|
||||
| RESEARCH | T-1..T-10 | generic tide gaps | 31-01, 31-06 | COVERED | |
|
||||
| RESEARCH | — | 196 route inventory, 17 uncalled, ten rate buckets and five upstream vendor classes | 31-02, 31-03 | COVERED | |
|
||||
| RESEARCH | — | foundation envelope/services/contexts/resolvers/authorizers/lifecycle | 31-04, 31-06 | COVERED | |
|
||||
| RESEARCH | — | OIDC, slash and moderation folded todos | 31-05, 31-06 | COVERED | |
|
||||
| CONTEXT | deferred | cutover re-record, rest of backend/import, desktop clients, manual Go client session | none | EXCLUDED | explicitly deferred |
|
||||
| CONTEXT | 31.1/31.2 | messaging and satellites implementation, Range release, zero pending/security review | none | EXCLUDED | separate phases by D-16 |
|
||||
|
||||
## Artifacts this phase produces
|
||||
|
||||
- Table-driven tide and CLI coverage for all Phase 31 additions.
|
||||
- Foundation handler, context/resolver/authorizer and lifecycle unit suites.
|
||||
- Corpus checker and gate mutation suites.
|
||||
- Expanded moderation and slash regressions.
|
||||
- Final machine evidence for the foundation gate and docs checker.
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-06-SUMMARY.md` when done: commits by repo; named test matrices and threat mapping; production bugs found/fixed; all verification commands and exact gate counts; consumer commit assertions; docs result; remaining 160 pending routes explicitly assigned to 31.1/31.2; g15office/validation status.
|
||||
</output>
|
||||
Reference in New Issue
Block a user