fix(31): reslice plans after checker feedback
This commit is contained in:
@@ -1594,10 +1594,34 @@ Plans:
|
||||
4. Behaviour stays neutral to the other consumers of these plugins: `sm-bm-app` and `sm-demo-app` build and pass their tests with the released plugin versions (31 D-14). Framework READMEs and docs still name no application.
|
||||
5. The new code has unit tests, delivered in the phase's last plan.
|
||||
|
||||
**Plans:** 0 plans
|
||||
**Plans:** 11 plans
|
||||
|
||||
Plans:
|
||||
- [ ] TBD (run /msd-plan-phase 31 to break down)
|
||||
|
||||
**Wave 1**
|
||||
- [ ] 31-01-PLAN.md — Tide core data contracts: relative masks, cookies, headers, labels, repeat and manifest reference
|
||||
- [ ] 31-03-PLAN.md — `sm-wavepath-app` skeleton and fail-closed isolated PHP parity stack
|
||||
- [ ] 31-09-PLAN.md — Folded `vue-chat-layer` slash-command parity fix
|
||||
- [ ] 31-10-PLAN.md — Folded additive moderation seams for users, friend groups and attachment filenames
|
||||
|
||||
**Wave 2**
|
||||
- [ ] 31-02-PLAN.md — Tide per-case broadcast/upstream sidecars, minted credentials, body comparers and CLI wiring
|
||||
- [ ] 31-08-PLAN.md — Folded OIDC PHP parity recording in `sm-oauthserver-plugin`
|
||||
|
||||
**Wave 3**
|
||||
- [ ] 31-04-PLAN.md — Scenario on both sides, 196 pending-route manifest, corpus checker, harness and fail-closed gate
|
||||
|
||||
**Wave 4**
|
||||
- [ ] 31-05-PLAN.md — Full 196-route PHP recording with client provenance, publications, upstreams and green self-replay
|
||||
|
||||
**Wave 5**
|
||||
- [ ] 31-06-PLAN.md — Foundation infrastructure: envelope, actor, buckets, contexts, resolvers, authorizers and realtime
|
||||
|
||||
**Wave 6**
|
||||
- [ ] 31-07-PLAN.md — Foundation handlers and lifecycle green: groups, members, invites, join, friends and phase gate
|
||||
|
||||
**Wave 7**
|
||||
- [ ] 31-11-PLAN.md — Unit tests last: tide, app foundation, parity/gate and folded-todo regression matrices
|
||||
|
||||
### Phase 31.1: WavePath messaging parity (INSERTED)
|
||||
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 01
|
||||
type: execute
|
||||
wave: 1
|
||||
depends_on: []
|
||||
files_modified:
|
||||
- modules/tide/normalize.go
|
||||
- modules/tide/variables.go
|
||||
- modules/tide/record.go
|
||||
- modules/tide/replay.go
|
||||
- modules/tide/diff.go
|
||||
- modules/tide/rules.go
|
||||
- modules/tide/flow.go
|
||||
- modules/tide/fixture.go
|
||||
- modules/tide/manifest.go
|
||||
- modules/tide/rules_test.go
|
||||
- modules/tide/relative_smoke_test.go
|
||||
- modules/tide/additions_smoke_test.go
|
||||
- modules/tide/README.md
|
||||
- docs/services/parity-testing.md
|
||||
autonomous: true
|
||||
requirements: [SC-4, D-06, D-11, D-12]
|
||||
estimate:
|
||||
tokens: 150000
|
||||
raw_tokens: 150000
|
||||
tasks: 2
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "Tide core data contracts: relative masks, cookies, headers, labels, repeat and manifest reference is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
artifacts:
|
||||
- path: "modules/tide/normalize.go"
|
||||
provides: "Tide core data contracts: relative masks, cookies, headers, labels, repeat and manifest reference"
|
||||
key_links:
|
||||
- from: "modules/tide/normalize.go"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<objective>
|
||||
Tide core data contracts: relative masks, cookies, headers, labels, repeat and manifest reference.
|
||||
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</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
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="tracer">
|
||||
<name>Task 1: Tracer: a relative-time string recorded from a reference server replays against a port on another day (tide gap T-1), documented</name>
|
||||
<precondition>`go test -count=1 -short ./modules/tide/` passes and `go run ./cmd/summer docs:build --check` prints `docs:build: no problems found` before the change.</precondition>
|
||||
<files>modules/tide/normalize.go, modules/tide/relative_smoke_test.go, modules/tide/README.md, docs/services/parity-testing.md</files>
|
||||
<read_first>modules/tide/normalize.go (whole file: maskLeaf, maskDate, isDateKey, disabledPath, the mask constants), modules/tide/normalize_phase13_test.go (the table style and neutral names), modules/tide/roundtrip_test.go (how a test records with RecordFlow against httptest and replays with ReplayFlow), modules/tide/README.md (Features "Replay and diff", API reference), docs/services/parity-testing.md (the masking sentences in "Flows" and "The parity commands"), 31-PATTERNS.md "tide T-1"</read_first>
|
||||
<action>Per D-11 (every message row of the corpus carries a relative-time string) and SC-4.
|
||||
1. Red first: write `modules/tide/relative_smoke_test.go` (package `tide`) with `TestRelativeTimeMaskSmoke`. A "reference" `httptest` server answers a JSON body holding an id, a title and a key `updated_at_human` with the value `3 weeks ago`. Record a one-step flow with `RecordFlow`, save it with `SaveFlow`, load it with `LoadFlow`, and replay it with `ReplayFlow` against three "port" servers: one answering `5 weeks ago` (expect no diff), one answering the number 7 at that key (expect exactly one `Diff` whose path ends in that key), and one answering `5 weeks ago` while the step carries a normalize rule disabling that key (expect one `Diff`). Run it and see it fail.
|
||||
2. `normalize.go`: add a predicate for keys ending in `_human` next to `isDateKey`, and a mask function in the style of `maskDate`: `nil` stays `nil`; a non-empty string becomes a fixed mask token (add a constant next to the date mask token, value `{{relative}}`); anything else (a non-string, an empty string) appends a `Diff` naming the expected shape and returns the value unchanged. Call it from `maskLeaf` after the `disabledPath` check and before the id branch. A mask never hides a wrong shape.
|
||||
3. `modules/tide/README.md`: in Features "Replay and diff", add one sentence: keys ending in `_human` are relative-time strings compared by shape, and a step can switch the mask off with a `normalize` rule. `docs/services/parity-testing.md`: the same fact where masking of IDs and timestamps is described, with a neutral example.
|
||||
4. Commit: `feat(tide): compare relative-time strings by shape`.</action>
|
||||
<verify>
|
||||
<automated>go vet ./modules/tide/ && go test -count=1 -short ./modules/tide/ && go test -count=1 -run '^TestRelativeTimeMaskSmoke$' -v ./modules/tide/ 2>&1 | grep -q -- '^--- PASS: TestRelativeTimeMaskSmoke'</automated>
|
||||
<fails_when>Non-zero exit: vet or an existing tide test fails, or the `--- PASS: TestRelativeTimeMaskSmoke` line is absent (the test failed, or the filter matched nothing and go printed "no tests to run").</fails_when>
|
||||
<automated>go run ./cmd/summer docs:build --check 2>&1 | grep -q 'no problems found'</automated>
|
||||
<fails_when>Non-zero exit: the docs checker printed a problem list instead of `docs:build: no problems found`.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- `grep -c '_human' modules/tide/normalize.go` prints at least 1 and `grep -c '_human' modules/tide/README.md` prints at least 1.
|
||||
- `go test -count=1 -run '^TestRelativeTimeMaskSmoke$' -v ./modules/tide/` prints `--- PASS: TestRelativeTimeMaskSmoke`.
|
||||
- `D="$(git diff 2acf8e4 -- modules/tide docs cmd/summer/parity.go)" && printf '%s\n' "$D" | grep '^+' | grep -ciE 'wavepath|_wave/|wave_guest|hubot|fonoteka'` prints 0 (the diff is captured first, so a failing git is not read as a clean result).
|
||||
- `git diff --stat 2acf8e4 -- go.mod go.sum` prints nothing.
|
||||
</acceptance_criteria>
|
||||
<done>A fixture whose rows say "3 weeks ago" replays against a backend that says "5 weeks ago", a wrong shape still fails, and the README and the docs page say so.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 4: Cookie captures, extra response headers, any client label, repeated requests and the manifest's reference revisions (tide gaps T-6, T-7, T-8, T-10; D-12)</name>
|
||||
<files>modules/tide/variables.go, modules/tide/record.go, modules/tide/replay.go, modules/tide/diff.go, modules/tide/rules.go, modules/tide/rules_test.go, modules/tide/flow.go, modules/tide/fixture.go, modules/tide/manifest.go, modules/tide/additions_smoke_test.go, modules/tide/README.md, docs/services/parity-testing.md, docs/console/utilities.md</files>
|
||||
<read_first>modules/tide/variables.go (lines 20-40 the scrub patterns, 265-350 extractCapture, 685-750 the two uses of cookieRe), modules/tide/rules.go (lines 14-16, 50-65, 137-141 filterHeaders joining Set-Cookie with a newline), modules/tide/rules_test.go (lines 54-56), modules/tide/record.go (lines 17-60 the RecordFlow loop, 118-140), modules/tide/replay.go (the step loop and line 109), modules/tide/diff.go (lines 35-80), modules/tide/flow.go (Step, Request, CaptureRule), modules/tide/fixture.go (lines 48, 135-166: the strict loader and writeStep, writeRequest), modules/tide/manifest.go (Manifest, RouteCase, recordRoute's Step literal, mergeHeaders, caseRequest), modules/tide/headers_test.go, modules/tide/capture_test.go (the capture test style), modules/tide/proxy.go (where the client label becomes a directory name), modules/tide/README.md (Features "Capture rules", the Manifest rows), docs/services/parity-testing.md (the capture-source sentence in "The parity commands"), 31-PATTERNS.md "tide T-6" to "tide T-10" and finding F-9</read_first>
|
||||
<behavior>
|
||||
- `TestCookieCaptureSmoke` (T-6): a response with two Set-Cookie headers; a rule `from: response.cookie`, `name: session_ref` captures that cookie's value into the store; a missing cookie is the error "missing response cookie session_ref"; the saved fixture holds the placeholder and not the value, in the Set-Cookie header and in a later request's Cookie header; a JWT-shaped value in a cookie of any name that no rule captured refuses the write.
|
||||
- `TestExtraHeadersSmoke` (T-7): a case with `headers: {Retry-After: present, X-RateLimit-Limit: exact}` records both headers; replay passes when Retry-After differs but is non-empty and X-RateLimit-Limit is equal; it reports `header.X-Ratelimit-Limit` when that value differs and `header.Retry-After` when it is missing; a header that is in no list is not recorded.
|
||||
- `TestClientLabelSmoke` (T-8): rules with client `bot` and `web-app` load; `nuxt` and `mcp` still load; an empty label, a label with a slash, a dot or an upper-case letter is refused.
|
||||
- `TestRepeatSmoke` (T-10): a case with `repeat: 3` against a server that answers 200 twice and then 429 records one response with status 429 and the server saw three requests; replay sends three and compares the last; `repeat: 0` and an absent field mean one request; `repeat: 1001` is a validation error; a flow with `repeat` saved and loaded keeps the value.
|
||||
- `TestManifestReferenceSmoke` (D-12): a manifest with a `reference` map of two entries parses and `Manifest.Reference` holds them; a manifest without it parses; an unknown top-level key is still refused.
|
||||
</behavior>
|
||||
<action>Per D-11 (the guest cookie credential, the ten rate-bucket cases, Range and rate-limit headers), D-07 and D-17 (a recording client that is neither of the two existing labels) and D-12.
|
||||
1. T-6, `variables.go`: add the capture source `response.cookie` to `extractCapture`: parse the recorded `Set-Cookie` value (several cookies are joined with a newline by `filterHeaders`) and return the value of the cookie named `rule.Name`; error text in the style of the other sources. Replace the single-name cookie pattern in the scrubber: detect `name=value` pairs in `Cookie` and `Set-Cookie` headers for any cookie name, mask a value that equals a vars entry with that variable's placeholder, redact in logs as before, and refuse a token-shaped value that is not masked, whatever the cookie is called.
|
||||
2. T-7, `record.go`, `diff.go`, `replay.go`: `keepResponseHeaders` takes the step and also keeps every header named in `Step.Headers`. `compareHeaders` reads the map values as a mode: empty or `exact` compares the value, `present` requires a non-empty value on both sides; any other mode is a validation error when the flow or manifest is loaded.
|
||||
3. T-8, `rules.go`: accept any client label matching lower-case letters, digits, hyphen and underscore, 1 to 32 characters, starting with a letter or digit. Keep `ClientNuxt` and `ClientMCP`. Update `rules_test.go:54-56` in the same commit (F-8): the label that used to fail now loads, and the refused shapes are tested instead.
|
||||
4. T-10, `flow.go`, `fixture.go`, `manifest.go`, `record.go`, `replay.go`: add `Repeat int` (yaml `repeat,omitempty`) to `Step` and to `RouteCase`; `recordRoute` copies it into the step. `RecordFlow` and the replay loop send the request that many times in a row (0 and 1 mean once; above 1000 is refused at validation) and keep, capture from and compare only the last response. Add the field to `writeStep` so a saved flow loads again (F-9).
|
||||
5. D-12, `manifest.go`: add `Reference map[string]string` (yaml `reference,omitempty`) to `Manifest`, documented as the source revisions of the reference backend the corpus was recorded from (repository name to commit). `ValidateManifest` refuses an empty name or an empty revision.
|
||||
6. `additions_smoke_test.go`: the behavior block.
|
||||
7. `modules/tide/README.md`: Features "Capture rules" (the cookie source), "Replay and diff" (header modes), "Manifests" (repeat, reference), the client label rule; API reference rows where a described type gained a field. `docs/services/parity-testing.md`: the capture-source list gains `response.cookie`; one paragraph each for extra headers and for repeat. `docs/console/utilities.md` only if a described flag or behaviour changed.
|
||||
8. Before the commit run `go vet ./... && go test -count=1 -short ./...` once for the whole repo and record the result (a failure outside tide, cmd/summer and docs is reported, not fixed). Commit: `feat(tide): cookie captures, extra headers, client labels, repeat and manifest reference`. Then post the g15office comment on task `hgol7otp`.</action>
|
||||
<verify>
|
||||
<automated>go vet ./modules/tide/ ./cmd/summer/ && go test -count=1 -short ./modules/tide/ ./cmd/summer/ && go test -count=1 -run '^(TestCookieCaptureSmoke|TestExtraHeadersSmoke|TestClientLabelSmoke|TestRepeatSmoke|TestManifestReferenceSmoke)$' -v ./modules/tide/ 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 5</automated>
|
||||
<fails_when>Non-zero exit: vet fails, an existing tide or cmd/summer test fails (a fixture or manifest written before this plan no longer loads, the round-trip test breaks), or fewer than five `--- PASS: Test` lines are printed.</fails_when>
|
||||
<automated>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: the docs checker reports a problem, or the `--- PASS: TestDocsTree` line is absent.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- `grep -c '"response.cookie"' modules/tide/variables.go` prints at least 1, and `TestCookieCaptureSmoke` passes with a cookie name that tide's source does not mention.
|
||||
- `grep -c 'yaml:"repeat,omitempty"' modules/tide/flow.go modules/tide/manifest.go | awk -F: '{s+=$2} END {print s}'` prints 2 and `grep -c 'yaml:"reference,omitempty"' modules/tide/manifest.go` prints 1.
|
||||
- `go test -count=1 -run '^TestRoundTrip' -v ./modules/tide/ 2>&1 | grep -c '^--- FAIL'` prints 0.
|
||||
- `D="$(git diff 2acf8e4 -- modules/tide docs cmd/summer/parity.go)" && printf '%s\n' "$D" | grep '^+' | grep -ciE 'wavepath|_wave/|wave_guest|hubot|fonoteka'` prints 0 (the diff is captured first, so a failing git is not read as a clean result).
|
||||
- `git diff --stat 2acf8e4 -- go.mod go.sum` prints nothing.
|
||||
- `git status --porcelain -- modules/tide cmd/summer/parity.go cmd/summer/parity_test.go docs/services/parity-testing.md docs/console/utilities.md` prints nothing (everything committed).
|
||||
</acceptance_criteria>
|
||||
<done>A corpus can log in with a cookie that exists only in Set-Cookie, assert rate-limit and range headers, be recorded by a client with any label, hit a rate bucket in one case, and name the commits it was recorded from.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| T-31-01 | Information disclosure | upstream sidecars with minted credentials (T-4) | high | mitigate | a credential is rewritten only for a declared host, header and scheme; the token itself is never written, only the listed claims; `WriteUpstream` keeps refusing every other unmasked credential; `TestMintedCredentialSmoke` asserts the sidecar holds no JWT-shaped string and that an undeclared host is still refused |
|
||||
| T-31-02 | Information disclosure | cookie values in fixtures (T-6) | high | mitigate | captured cookie values go to the mode-0600 vars store; the scrubber masks any cookie value equal to a vars entry and refuses a token-shaped cookie value under any name; `TestCookieCaptureSmoke` |
|
||||
| T-31-06 | Denial of service | `repeat` and `--wait` | low | mitigate | `repeat` is bounded at 1000 and validated on load; `--wait` is a bounded duration and listeners are loopback only |
|
||||
| T-31-SC | Tampering | npm/pip/cargo installs | high | mitigate | no package install; use existing dependencies and explicit lockfiles |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
Tide core data contracts: relative masks, cookies, headers, labels, repeat and manifest reference is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-01-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
@@ -0,0 +1,163 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 02
|
||||
type: execute
|
||||
wave: 2
|
||||
depends_on: [31-01]
|
||||
files_modified:
|
||||
- modules/tide/centrifugo.go
|
||||
- modules/tide/centrifugo_golden.go
|
||||
- modules/tide/manifest.go
|
||||
- modules/tide/upstream.go
|
||||
- modules/tide/upstream_proxy.go
|
||||
- modules/tide/centrifugo_test.go
|
||||
- modules/tide/sidecar_smoke_test.go
|
||||
- modules/tide/upstream_smoke_test.go
|
||||
- cmd/summer/parity.go
|
||||
- cmd/summer/parity_test.go
|
||||
- modules/tide/README.md
|
||||
- docs/services/parity-testing.md
|
||||
- docs/console/utilities.md
|
||||
autonomous: true
|
||||
requirements: [SC-2, SC-4, D-06, D-10, D-11]
|
||||
estimate:
|
||||
tokens: 180000
|
||||
raw_tokens: 180000
|
||||
tasks: 2
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "Tide per-case broadcast/upstream sidecars, minted credentials, body comparers and CLI wiring is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
artifacts:
|
||||
- path: "modules/tide/centrifugo.go"
|
||||
provides: "Tide per-case broadcast/upstream sidecars, minted credentials, body comparers and CLI wiring"
|
||||
key_links:
|
||||
- from: "modules/tide/centrifugo.go"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<objective>
|
||||
Tide per-case broadcast/upstream sidecars, minted credentials, body comparers and CLI wiring.
|
||||
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</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
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 2: One manifest run records a broadcast sidecar and an upstream sidecar for every case, with a reset hook before each (tide gaps T-2, T-3, T-9)</name>
|
||||
<files>modules/tide/manifest.go, modules/tide/centrifugo.go, modules/tide/centrifugo_golden.go, modules/tide/upstream_proxy.go, modules/tide/centrifugo_test.go, modules/tide/sidecar_smoke_test.go, cmd/summer/parity.go, cmd/summer/parity_test.go, modules/tide/README.md, docs/services/parity-testing.md, docs/console/utilities.md</files>
|
||||
<read_first>modules/tide/manifest.go (ManifestConfig, RecordManifest, recordRoute, caseFixturePath, ReplayManifest and its per-case loop), modules/tide/centrifugo.go (whole file), modules/tide/centrifugo_golden.go (whole file, and the doc comment of NormalizePublications that lists every rule), modules/tide/upstream_proxy.go (UpstreamProxy, NewUpstreamProxy, scripted, Flush, ListenAndServe), modules/tide/upstream.go (UpstreamPath, WriteUpstream), modules/tide/centrifugo_test.go (lines 17-68: postJSON, the assertions F-8 names), modules/tide/normalize_phase13_test.go (lines 53-60), cmd/summer/parity.go (parityRecordCommand, parityReplayCommand, runParityUpstream, the flag lists), cmd/summer/parity_test.go, modules/tide/README.md (API reference rows for the recorder, goldens and the proxy; "CLI commands"), docs/services/parity-testing.md ("Broadcast goldens", "Upstream exchanges"), docs/console/utilities.md (the parity flag table), 31-PATTERNS.md "tide T-2", "tide T-3", "tide T-9", ../fonoteka.go/parity/broadcast_goldens_test.go (lines 210-241, the unordered comparison this plan generalises; read only)</read_first>
|
||||
<behavior>
|
||||
- `TestManifestCaseSidecarsSmoke`: a reference `httptest` server whose POST route publishes one message to the in-process recorder and calls one HTTPS vendor URL through the in-process upstream proxy, and whose GET route does neither. `RecordManifest` over a two-route manifest with `Recorder`, `Upstream` and `BeforeCase` set writes: both fixtures; `BroadcastPath(postFixture)` holding one publication; `UpstreamPath(postFixture)` holding one exchange; no sidecar of either kind for the GET case. The hook was called once per case, in order, with that route and case. `ReplayManifest` in self-check mode with the recorder attached passes, and fails with a publication diff after the sidecar on disk is edited.
|
||||
- `TestBroadcastPayloadMaskSmoke` (T-3): two publications whose payload holds `edited_at` and `read_at` at depth 2 and 3 with different Carbon dates, and a `created_at_human` with different strings, normalise equal; a date written with a `Z` suffix where the golden has a Carbon offset stays visible as a diff.
|
||||
- `TestRecorderPresenceAndUnsubscribeSmoke` (T-9): with `RecordUnsubscribe` set, an unsubscribe call is recorded as a `Publication`; with a presence table for one channel, a presence call for that channel answers one client entry per listed user id and another channel answers the empty result; with neither option the behaviour of the existing tests is unchanged.
|
||||
- `DiffPublicationsUnordered` returns no diff for the same publications in another order and a diff when one body differs.
|
||||
</behavior>
|
||||
<action>Per D-10 (a golden for every writing case), D-11 (vendor calls as sidecars) and D-06 (unattended).
|
||||
1. `centrifugo_golden.go`: add `BroadcastPath(fixturePath string) string` (maps `x.yaml` or `x.yml` to `x.broadcasts.yaml`, mirroring `UpstreamPath`). Add `DiffPublicationsUnordered(expected, actual []Publication) []Diff` (both sides sorted by normalised body, then `DiffPublications`). Add `DiffCaseBroadcasts(fixturePath string, pubs []Publication, store *Store, unordered bool) ([]Diff, error)`: loads the golden at `BroadcastPath(fixturePath)` (a missing file means a golden with zero publications), normalises `pubs` with `NormalizePublications` and diffs. T-3: in `normalizer.walk`, mask every string value under `$.data.payload.` whose key ends in `_at` and that matches the Carbon offset form or an ISO-8601 form, at any depth, and mask keys ending in `_human` under the payload with the Task 1 rule. Keep the id rule as it is (an id becomes a placeholder only when it equals a captured `id:*` variable). Update the doc comment of `NormalizePublications`.
|
||||
2. `centrifugo.go` (T-9): add two fields to `CentrifugoRecorderOptions`: `RecordUnsubscribe bool` (an `/unsubscribe` call is stored as a `Publication` like a publish) and `Presence map[string][]string` (channel name to user ids; a `/presence` call for a listed channel answers a `result.presence` object with one synthetic client entry per user id, each carrying `client` and `user`; other channels answer the empty result as today). Defaults keep today's behaviour.
|
||||
3. `upstream_proxy.go`: add `(*UpstreamProxy).Begin(out string) error` (sets the sidecar path of the next `Flush`, clears the recorded exchanges and errors, and makes every script entry available again; for a non-empty `out` the CA directory and the vars file must be outside its directory, as `NewUpstreamProxy` checks for `Out`; an empty `out` resets the proxy and sets no path) and `(*UpstreamProxy).Recorded() int`. `NewUpstreamProxy` accepts an empty `Out` when the proxy is driven through `Begin`; `Flush` with no path set is an error.
|
||||
4. `manifest.go`: add `type CaseHook func(ctx context.Context, route Route, c RouteCase) error` and four `ManifestConfig` fields: `BeforeCase CaseHook`, `Recorder *CentrifugoRecorder`, `BroadcastSettle time.Duration`, `Upstream *UpstreamProxy`. In `recordRoute`, per case: call `BeforeCase` (an error aborts the run and names the case); `Recorder.Reset()`; `Upstream.Begin(UpstreamPath(dest))`; `RecordFlow`; wait `BroadcastSettle` (default `DefaultBroadcastSettle`); when the recorder holds publications, normalise them, refuse a body containing the API key (as `RecordBroadcasts` does) and write a `BroadcastGolden` named after the case to `BroadcastPath(dest)`; when it holds none, write no sidecar and, under `Update`, remove a stale one; `Upstream.Flush()` only when `Recorded()` is above zero, else remove a stale sidecar under `Update`. In `ReplayManifest`, per case: `BeforeCase`, `Recorder.Reset()`, `Upstream.Begin("")` (on replay the proxy answers from its script and nothing is flushed), replay, settle, and when `Recorder` is set compare with `DiffCaseBroadcasts` (unordered); a publication diff makes the case failing.
|
||||
5. `cmd/summer/parity.go`: on `parity:record` and `parity:replay`, manifest mode only (each is an error without `--manifest`): `--broadcasts` (true/false: attach a recorder), `--centrifugo-listen` (default `tide.DefaultCentrifugoListen`), `--api-key` (default `$PARITY_CENTRIFUGO_API_KEY`), `--settle` (default `tide.DefaultBroadcastSettle`), `--presence` (a YAML file with one key `channels`, mapping a channel name to a list of user ids; names and ids are expanded with the vars store when the file is loaded), `--record-unsubscribe` (true/false), `--upstream-script` (attach an upstream proxy in script mode), `--upstream-listen` (default `tide.DefaultUpstreamProxyListen`), `--ca-dir`, `--case-hook` (path to an executable file, run directly with no shell before each case, with the environment variables `PARITY_ROUTE_ID`, `PARITY_CASE_ID` and `PARITY_SEED_HOOK`; a missing or non-executable file is refused at start, a non-zero exit aborts the run), `--wait` (a Go duration: after the listeners are bound, wait up to this long for `--target` to accept TCP connections before the first request; default 0). Every listen address must be loopback. The command prints the CA certificate path when a proxy is attached. Update the help text and the examples of both commands.
|
||||
6. `centrifugo_test.go`: keep the existing assertions for the default options and add the option cases (F-8). `sidecar_smoke_test.go`: the behavior block. `cmd/summer/parity_test.go`: a help-output check that `parity:record` lists `--case-hook`, `--broadcasts` and `--upstream-script`, and that `--broadcasts true` without `--manifest` is an error.
|
||||
7. `modules/tide/README.md`: Features (per-case sidecars; presence and unsubscribe options; payload-wide masks), API reference rows for `tide.BroadcastPath`, `tide.DiffCaseBroadcasts`, `tide.DiffPublicationsUnordered`, `tide.CaseHook`, `tide.ManifestConfig` and the two new proxy methods, and the changed description of `tide.NormalizePublications`; "CLI commands": a manifest-mode example with the new flags (neutral paths). `docs/services/parity-testing.md`: "Broadcast goldens" gains the per-case sidecar workflow and "Upstream exchanges" the per-case recording. `docs/console/utilities.md`: the flag lists of `parity:record` and `parity:replay`.
|
||||
8. Commit: `feat(tide): per-case broadcast and upstream sidecars in manifest recording`.</action>
|
||||
<verify>
|
||||
<automated>go vet ./modules/tide/ ./cmd/summer/ && go test -count=1 -short ./modules/tide/ ./cmd/summer/ && go test -count=1 -run '^(TestManifestCaseSidecarsSmoke|TestBroadcastPayloadMaskSmoke|TestRecorderPresenceAndUnsubscribeSmoke)$' -v ./modules/tide/ 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 3</automated>
|
||||
<fails_when>Non-zero exit: vet fails, an existing tide or cmd/summer test fails (including the F-8 assertions and TestDocsTree), or fewer than three `--- PASS: Test` lines are printed for the three named smoke tests.</fails_when>
|
||||
<automated>go run ./cmd/summer docs:build --check 2>&1 | grep -q 'no problems found'</automated>
|
||||
<fails_when>Non-zero exit: the docs checker reports an identifier, link, anchor or command name that does not exist.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- `grep -c 'func BroadcastPath' modules/tide/centrifugo_golden.go` prints 1 and `grep -c 'BeforeCase' modules/tide/manifest.go` prints at least 2.
|
||||
- `go run ./cmd/summer help parity:record 2>&1 | grep -c -- 'case-hook'` prints at least 1.
|
||||
- `grep -c 'case-hook' docs/console/utilities.md` prints at least 1 and `grep -c 'tide.BroadcastPath' modules/tide/README.md` prints at least 1.
|
||||
- `go test -count=1 -run '^TestCentrifugoRecorder' -v ./modules/tide/ 2>&1 | grep -c '^--- FAIL'` prints 0.
|
||||
- `D="$(git diff 2acf8e4 -- modules/tide docs cmd/summer/parity.go)" && printf '%s\n' "$D" | grep '^+' | grep -ciE 'wavepath|_wave/|wave_guest|hubot|fonoteka'` prints 0 (the diff is captured first, so a failing git is not read as a clean result).
|
||||
</acceptance_criteria>
|
||||
<done>A porter can record a whole manifest with one command and get, next to every fixture, the publications and vendor calls that case caused, each case starting from a reset state; replaying against the reference backend proves the goldens are reproducible.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 3: Upstream sidecars hold signed and encrypted vendor calls (tide gaps T-4, T-5)</name>
|
||||
<files>modules/tide/upstream.go, modules/tide/upstream_proxy.go, modules/tide/upstream_smoke_test.go, modules/tide/README.md, docs/services/parity-testing.md</files>
|
||||
<read_first>modules/tide/upstream.go (whole file: UpstreamCompareHeaders at 118-128, binaryScalar at 84-116, NewUpstreamFake at 195, RoundTrip at 200-229, compare at 252, WriteUpstream at 573, the credential refusal at 635-638 and fullyMasked and credentialResidueRe at 655-666), modules/tide/upstream_proxy.go (loadUpstreamScript, UpstreamScript, how a recorded request is built around lines 420-450), modules/tide/upstream_test.go (lines 16-60: upstreamTestSidecar, upstreamCall and its send helper, the neutral host), modules/tide/testdata/upstream/post_json.upstream.yaml, modules/tide/README.md (the Upstream rows and the security rules under "CLI commands"), docs/services/parity-testing.md ("Upstream exchanges", "Recording through the proxy", "Replaying offline"), 31-PATTERNS.md "tide T-4, T-5", ../fonoteka.go/parity/upstream_replay_test.go (lines 50-55: the existing callers of NewUpstreamFake whose signature must not change; read only)</read_first>
|
||||
<behavior>
|
||||
- `TestMintedCredentialSmoke`: an upstream script declares a minted credential for host `api.example.test`, header `Authorization`, scheme `Bearer`, claims `iss` and `video`. The proxy records a request carrying a bearer JWT. The written sidecar holds no JWT-shaped string; the header value is the scheme followed by a placeholder; the two claims are recorded. The fake accepts a replayed request with a different token whose `iss` and `video` claims match, and reports a problem when `iss` differs or the scheme differs. A request with a bearer token to a host that is not declared still refuses the write with the existing error.
|
||||
- The same for a header value in the form scheme word, a `t=` parameter holding a JWT and a `k=` parameter holding a key that is in the vars store: the token becomes the placeholder and the key is masked by its variable.
|
||||
- `TestUpstreamBodyComparerSmoke`: a fake with a comparer registered for a content type receives the expected and the actual body bytes and its returned problems fail `Verify`; with `OpaqueBody` registered, two different non-empty bodies pass and an empty body fails; with no comparer the existing JSON and byte comparison is unchanged.
|
||||
</behavior>
|
||||
<action>Per D-11 (LiveKit and web-push calls are recorded and asserted) and threat T-31-01.
|
||||
1. T-4 in `upstream.go` and `upstream_proxy.go`: add `type MintedCredential struct` with fields `Host` (exact, or with a leading `*.` wildcard), `Header`, `Scheme` (the auth scheme word) and `Claims []string` (JWT claim names compared by value on replay; `exp`, `iat`, `nbf` and `jti` are never compared and are refused in the list). `UpstreamScript` gains a top-level `minted` list, and `UpstreamProxyConfig` gains `Minted []MintedCredential` for callers that build the config in code. When the proxy records a request whose host and header match a declaration and whose value starts with the declared scheme, the first JWT-shaped token in the value is replaced by a fixed placeholder (`{{minted}}`), and the exchange's request records the declaration that matched and the values of the listed claims (decoded from the token's payload without verifying the signature). Add the fields to the sidecar structs, the YAML writer and the strict loader. `WriteUpstream` keeps refusing any credential header that is neither masked by a vars entry nor rewritten by a declaration; do not relax `fullyMasked` for anything else. The fake's `compare`: for a request recorded with a minted declaration, the actual header must have the same scheme and, when claims were recorded, the same claim values; the placeholder is never compared as text.
|
||||
2. T-5 in `upstream.go`: add `type UpstreamBodyComparer func(expected, actual []byte, contentType string) []string`, `type UpstreamBodyMatch struct` with `Host` (exact or `*.` wildcard, optional) and `ContentType` (prefix, optional; at least one of the two is required), `(*UpstreamFake).SetBodyComparer(match UpstreamBodyMatch, cmp UpstreamBodyComparer)`, and `OpaqueBody` (an `UpstreamBodyComparer` that reports a problem only when exactly one side is empty). `compare` consults the first matching comparer for the body only; headers, method and URL are compared as before. Keep the signature of `NewUpstreamFake`.
|
||||
3. `upstream_smoke_test.go`: the behavior block, with the builder style and neutral host of `upstream_test.go`.
|
||||
4. `modules/tide/README.md`: Features and API reference rows for `tide.MintedCredential`, `tide.UpstreamBodyComparer`, `tide.UpstreamBodyMatch`, `tide.OpaqueBody` and the new method on `tide.UpstreamFake`; the security rules gain one sentence: a credential is written only as a variable placeholder or, when declared as minted, as a scheme and a placeholder. `docs/services/parity-testing.md`: "Upstream exchanges" explains minted credentials and body comparers with a neutral vendor.
|
||||
5. Commit: `feat(tide): minted credentials and body comparers for upstream sidecars`.</action>
|
||||
<verify>
|
||||
<automated>go vet ./modules/tide/ && go test -count=1 -short ./modules/tide/ ./cmd/summer/ && go test -count=1 -run '^(TestMintedCredentialSmoke|TestUpstreamBodyComparerSmoke)$' -v ./modules/tide/ 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 2</automated>
|
||||
<fails_when>Non-zero exit: vet fails, an existing upstream test fails (the default credential refusal changed, or an old sidecar no longer loads), or fewer than two `--- PASS: Test` lines are printed.</fails_when>
|
||||
<automated>go run ./cmd/summer docs:build --check 2>&1 | grep -q 'no problems found'</automated>
|
||||
<fails_when>Non-zero exit: the docs checker reports a problem.</fails_when>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- `grep -c 'type MintedCredential struct' modules/tide/upstream.go modules/tide/upstream_proxy.go | awk -F: '{s+=$2} END {print s}'` prints 1.
|
||||
- `grep -c 'func (f \*UpstreamFake) SetBodyComparer' modules/tide/upstream.go` prints 1 and `grep -c 'func NewUpstreamFake(s UpstreamSidecar, store \*Store) \*UpstreamFake' modules/tide/upstream.go` prints 1.
|
||||
- `go test -count=1 -run '^TestUpstream' -v ./modules/tide/ 2>&1 | grep -c '^--- FAIL'` prints 0.
|
||||
- `grep -c 'tide.MintedCredential' modules/tide/README.md` prints at least 1.
|
||||
</acceptance_criteria>
|
||||
<done>A vendor call signed with a fresh token, or carrying an encrypted body, can be recorded without a secret in the sidecar and asserted on replay by scheme, claims and an application-supplied body comparer.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| T-31-03 | Elevation of privilege | `--case-hook` executes a program | medium | mitigate | the flag takes a path to an executable file and runs it directly with no shell; route and case ids are passed as environment variables, never interpolated into a command line; a missing or non-executable file is refused at start |
|
||||
| T-31-04 | Spoofing | masks and opaque comparers hiding real differences | medium | mitigate | every mask is shape-checked and emits a `Diff` on a wrong shape; the opaque comparer and every body comparer are opt-in per host or content type; a step can disable the relative-time mask; defaults are unchanged and pinned by the existing tests |
|
||||
| T-31-05 | Information disclosure | broadcast sidecars | medium | mitigate | the per-case writer reuses the API-key body check of `RecordBroadcasts`; the authorization header is stored as a boolean only; `WriteBroadcastGolden` keeps refusing token-shaped bodies |
|
||||
| T-31-SC | Tampering | npm/pip/cargo installs | high | mitigate | no package install; use existing dependencies and explicit lockfiles |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
Tide per-case broadcast/upstream sidecars, minted credentials, body comparers and CLI wiring is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-02-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
@@ -2,101 +2,53 @@
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 03
|
||||
type: execute
|
||||
wave: 2
|
||||
depends_on: [31-01, 31-02]
|
||||
wave: 1
|
||||
depends_on: []
|
||||
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/.gitmodules
|
||||
- ../sm-wavepath-app/summer.yaml
|
||||
- ../sm-wavepath-app/go.mod
|
||||
- ../sm-wavepath-app/go.work
|
||||
- ../sm-wavepath-app/app/app.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/
|
||||
- ../sm-wavepath-app/config/app.yaml
|
||||
- ../sm-wavepath-app/parity/pins.env
|
||||
- ../sm-wavepath-app/parity/parity.env
|
||||
- ../sm-wavepath-app/parity/php_parity.sh
|
||||
- ../sm-wavepath-app/parity/case_hook.sh
|
||||
- ../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]
|
||||
- ../sm-wavepath-app/parity/README.md
|
||||
- ../sm-wavepath-app/README.md
|
||||
autonomous: false
|
||||
requirements: [SC-1, D-01, D-02, D-05, D-08, D-20, D-21]
|
||||
estimate:
|
||||
tokens: 360000
|
||||
raw_tokens: 360000
|
||||
tasks: 3
|
||||
tokens: 200000
|
||||
raw_tokens: 200000
|
||||
tasks: 4
|
||||
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."
|
||||
- "sm-wavepath-app skeleton and fail-closed isolated PHP parity stack is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
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"
|
||||
- path: "../sm-wavepath-app/.gitmodules"
|
||||
provides: "sm-wavepath-app skeleton and fail-closed isolated PHP parity stack"
|
||||
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
|
||||
- from: "../sm-wavepath-app/.gitmodules"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## 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.
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<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.
|
||||
sm-wavepath-app skeleton and fail-closed isolated PHP parity stack.
|
||||
|
||||
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.
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@@ -108,121 +60,133 @@ Output: proxy-derived and hand-written specs, 196 recorded route fixtures, per-c
|
||||
@.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>
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-VALIDATION.md
|
||||
</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>
|
||||
<name>Task 1: Tracer: one route goes from PHP at the pinned commits to a recorded fixture, a green PHP self-replay, a pending manifest entry the Go harness loads and a gate that prints the pending count</name>
|
||||
<reversibility rating="costly">D-02: the repository name, module path and parity/ layout are what WavePath's agent and every later WavePath phase build on; a rename later touches every import. Task 5 asks before the first push.</reversibility>
|
||||
<precondition>`../sm-wavepath-app` does not exist; `docker info` answers; `GIT_OPTIONAL_LOCKS=0 git -C /media/nvme/dev/jz/wavepath.org cat-file -t 7c517191879cada7bb50ac05f474f3ac02ad4b98` prints `commit` and `GIT_OPTIONAL_LOCKS=0 git -C /media/nvme/dev/jz/wavepath.org/plugins/golem15/chat cat-file -t fbfbcf98e3392269c6e98801270669dc5d845b3b` prints `commit`.</precondition>
|
||||
<files>../sm-wavepath-app/.gitignore, ../sm-wavepath-app/.gitmodules, ../sm-wavepath-app/summer.yaml, ../sm-wavepath-app/go.mod, ../sm-wavepath-app/go.sum, ../sm-wavepath-app/go.work, ../sm-wavepath-app/main.go, ../sm-wavepath-app/plugins.gen.go, ../sm-wavepath-app/boot_test.go, ../sm-wavepath-app/config/app.yaml, ../sm-wavepath-app/app/app.go, ../sm-wavepath-app/plugins/golem15/wavepath/go.mod, ../sm-wavepath-app/plugins/golem15/wavepath/plugin.go, ../sm-wavepath-app/plugins/golem15/wavepath/README.md, ../sm-wavepath-app/parity/pins.env, ../sm-wavepath-app/parity/parity.env, ../sm-wavepath-app/parity/php_parity.sh, ../sm-wavepath-app/parity/wavepath_reset.php, ../sm-wavepath-app/parity/fixtureplugin/plugin.go, ../sm-wavepath-app/parity/fixtureplugin/seed.go, ../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/fixtures/seed/bootstrap.yaml, ../sm-wavepath-app/parity/fixtures/routes/GET___wave_api_v1_community_friends_jwt.yaml, ../sm-wavepath-app/parity/parity_test.go, ../sm-wavepath-app/parity/testmain_test.go, ../sm-wavepath-app/scripts/parity-stack.sh, ../sm-wavepath-app/scripts/check-parity.sh</files>
|
||||
<read_first>../sm-demo-app/summer.yaml, ../sm-demo-app/go.mod, ../sm-demo-app/go.work, ../sm-demo-app/.gitmodules, ../sm-demo-app/boot_test.go, ../sm-demo-app/testmain_test.go, ../sm-demo-app/plugins/demo/plugin.go (lines 35-126), ../fonoteka.go/go.mod, ../fonoteka.go/go.work, ../fonoteka.go/app/app.go, ../fonoteka.go/parity/php_parity.sh (whole file), ../fonoteka.go/parity/fonoteka_reset.php (lines 1-100 and 640-676), ../fonoteka.go/parity/fixtureplugin/plugin.go, ../fonoteka.go/parity/fonoteka_seed_test.go (lines 1-80 and 600-660), ../fonoteka.go/parity/manifest.yaml (lines 1-40), ../fonoteka.go/parity/parity_test.go (lines 40-210), ../fonoteka.go/parity/synthetic_test.go (lines 36-104), ../fonoteka.go/parity/fixtures/seed/bootstrap.yaml, modules/tide/README.md ("Usage", "CLI commands"), 31-RESEARCH.md ("Recording commit and pins", "PHP stack from outside the checkout", "The sm-wavepath-app skeleton"), 31-PATTERNS.md (the sections for summer.yaml, app/app.go, manifest.yaml, php_parity.sh, wavepath_reset.php, fixtureplugin and parity_test.go). From the PHP contract, read-only with `git show`: the route at `routes.php` line 616 (`GET community/friends`), `controllers/api/CommunityFriendsController.php` (index), `classes/responses/ApiResponse.php`, and the code that issues the session JWT at login</read_first>
|
||||
<action>Per D-02, D-01, D-08, D-20, D-04, D-21 and D-15.
|
||||
1. Repository: `git init -b master ../sm-wavepath-app`. `.gitignore` covers the built binary `wavepath`, `tmp/`, `*.vars`, `*.vars.yaml` and editor files. `summer.yaml`: module `git.golem15.com/golem15/sm-wavepath-app`, binary `wavepath`, the eight shared plugin entries in the order of the interfaces block, then `golem15.wavepath` with module `git.golem15.com/golem15/sm-wavepath-app/plugins/golem15/wavepath`. Add the eight shared plugins as submodules at `plugins/golem15/NAME` with `ssu` (or `git submodule add -b BRANCH`), each checked out at the released tag listed in the interfaces block. `go.mod` requires the framework and the plugins at those tags and replaces the framework with `../summercms.go`; `go.work` uses `.`, the eight submodule directories and `./plugins/golem15/wavepath`, and carries the framework replace. Check each plugin's go.mod for other `replace` lines and override any in go.work.
|
||||
2. App plugin shell `plugins/golem15/wavepath` (own go.mod, package `wavepath`): `const ID = "golem15.wavepath"`, a `Plugin` type holding `*backpack.App`, `Requires()` returning the eight shared plugin ids, `Register` and `Boot` that only store the app, `init()` calling `party.Register`, compile-time assertion for `party.Plugin`. README in the module README structure (H1, one sentence, import line, Overview, Usage, Testing), marked as the start of WavePath's Go app.
|
||||
3. `app/app.go`: `PluginIDs` (the nine ids) and `Handler` in the shape of fonoteka's, with the nine plugins blank-imported. `config/app.yaml`: the application config the binary and tests load, with test-only values only. Generate `plugins.gen.go` and `main.go` with the `summer build` command (install the CLI with `go install ./cmd/summer` from `summercms.go`, then run `summer build` in the app directory); do not hand-write them. `boot_test.go`: `TestBootAllPlugins` in the shape of the demo's.
|
||||
4. `parity/pins.env`: `KEY=value` lines for `SUPERPROJECT`, and one `PIN_NAME` per pinned repository (wavepath, chat, chatchannels, chatbots, chatvideo, forum, herald, userfriends, user, websockets, oauthserver, journal, and the three clients), with full 40-character ids read from `git ls-tree 7c517191879cada7bb50ac05f474f3ac02ad4b98` in the checkout. They must agree with the research table; a difference is reported, not resolved silently. `parity/parity.env`: the test-only overlay values as `KEY=value` data: `APP_KEY`, `JWT_SECRET`, `CENTRIFUGO_API_KEY`, `CENTRIFUGO_SECRET` (at least 32 bytes), `CENTRIFUGO_PROXY_SECRET`, a VAPID pair generated once for tests, `LIVEKIT_API_KEY`, `LIVEKIT_API_SECRET`, `TURNSTILE_SECRET`, `TURNSTILE_SITE_KEY`, and a JWT lifetime long enough for a whole recording run.
|
||||
5. `parity/php_parity.sh` (bash, `set -euo pipefail`, structure of fonoteka's): variables `WAVEPATH_SRC` (default `/media/nvme/dev/jz/wavepath.org`), `PARITY_ROOT` (default `${XDG_CACHE_HOME:-$HOME/.cache}/summercms/wavepath-parity`), `PARITY_INSTANCE` (default `corpus`), `PHP_ROOT="$PARITY_ROOT/$PARITY_INSTANCE/php"`, vars file `$PARITY_ROOT/$PARITY_INSTANCE/vars.yaml` (mode 0600). Subcommands for the tracer:
|
||||
- `export`: with `GIT_OPTIONAL_LOCKS=0`, archive the superproject at `SUPERPROJECT` into `PHP_ROOT`, then every gitlink that `git ls-tree -r` lists at that commit (recursively) from its own repository directory at the recorded commit; a missing commit object is a refusal naming the repository (never fetch there). Copy `vendor/` with `rsync -a` (source read-only), and any other untracked directory Composer installed that the application needs to boot. Write `PHP_ROOT/.parity-export` listing each path and commit. Never copy `.env`.
|
||||
- `db`: start (or reuse) the container `wavepath-parity-mariadb` from the local image `mariadb:11`, published on `127.0.0.1:33306` only, and create the database `wavepath_parity_$PARITY_INSTANCE`.
|
||||
- `export_env` (a function): refuse a database name without `parity` or a non-loopback host; export `DB_*`, `CACHE_DRIVER=file`, `SESSION_DRIVER=array`, `MAIL_MAILER=array`, `APP_URL`, `APP_DEBUG=false`, `SCOUT_DRIVER=null` and the values of `parity/parity.env` (parsed as data).
|
||||
- `artisan ARGS`, `reset` (runs `artisan winter:up`, then `artisan tinker --execute` requiring the absolute path of `parity/wavepath_reset.php` with `PARITY_VARS_OUT` set), `serve` (PHP's built-in server on `127.0.0.1:8423` with `-d error_reporting=8191`, cwd `PHP_ROOT`), `rows SELECT` (one SELECT without a semicolon).
|
||||
- After `export`, assert through `artisan tinker` that the file of `Golem15\Chat\Classes\AttachmentStreamer` lies under `PHP_ROOT`; otherwise print `refuse: PHP loaded chat from outside the parity root` and exit 1.
|
||||
6. `scripts/parity-stack.sh` in its thinnest form: `up` (mode `readonly`: `BROADCAST_ENABLED=false`, `QUEUE_CONNECTION=database` with no worker, `HTTPS_PROXY` and `https_proxy` set to `http://127.0.0.1:9`, then export, db, reset and serve, recording the process group), `down` (stops this instance's PHP server; the container stays), `self-replay` (runs `summer parity:replay --manifest parity/manifest.yaml --fixtures parity/fixtures --target http://127.0.0.1:8423 --vars VARSFILE --self-check true` and prints its summary line).
|
||||
7. `parity/wavepath_reset.php`, tracer scope: users `alice@parity.test` and `dave@parity.test` with explicit ids, an accepted friendship between them, id floors with `ALTER TABLE … AUTO_INCREMENT`, the session JWT of alice minted with the application's own token code, and only the vars file as output (`jwt:alice`, `id:alice`, `id:dave`; never echo a value).
|
||||
8. `parity/fixtureplugin`: the plugin shell (`ID()` `parity.fixtureplugin`, `Requires()` `golem15.wavepath`, constructed in process, never registered) and `Seed(ctx, db, store)` writing the same two users, the friendship and the same variable names, with alice's JWT minted through the user plugin's token service.
|
||||
9. `parity/manifest.yaml`: version 1, auth groups `jwt`, `guest`, `bot`, `webhook`, `realtime`, the seed spec, and one route: id `GET /_wave/api/v1/community/friends jwt`, status `pending`, seed hook `community`, two cases: `alice` (request header `Cookie: token={{jwt:alice}}`, `Accept: application/json`) and `unauthenticated` (no cookie). Record both from PHP with `summer parity:record --manifest`, then run the self-replay. If the recorded body holds a relative-time string that only plan 31-01's mask can compare and that plan has not committed it yet, record `GET /_wave/api/v1/push/vapid-public-key jwt` as the tracer route instead and say so in the SUMMARY (the friends route is then recorded in plan 31-05).
|
||||
10. `parity/testmain_test.go` and `parity/parity_test.go`: a testcontainers Postgres (`postgres:16-alpine`) started in `TestMain` after `flag.Parse()` unless `testing.Short()`; `seedHooks` with `community` calling `fixtureplugin.Seed`; `TestParityCorpus` loads and validates the manifest, serves `app.Handler` through `httptest`, loads every fixture of a pending route without sending it, replays every ported route strictly, and logs one line `parity: ported P pending N`. A pending route is never counted as passing.
|
||||
11. `scripts/check-parity.sh` in its first form: the corpus stage (fixtures of the manifest load), the replay stage (`go test -count=1 -json ./parity`, failing on a failed test, on zero tests and on a missing `TestParityCorpus`), an optional `--self-replay` stage calling `scripts/parity-stack.sh up`, `self-replay` and `down`, and one summary line `check-parity: recorded R/T ported P pending N`. The flags `--allow-unrecorded` and `--allow-pending-foundation` are accepted.
|
||||
12. Commit in `../sm-wavepath-app` in logical steps (skeleton; PHP stack; scenario seed; manifest and fixture; harness and gate), staging by path.</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>
|
||||
<automated>go -C ../sm-wavepath-app vet . ./app/... ./parity/... ./plugins/golem15/wavepath/... && go -C ../sm-wavepath-app test -count=1 -short . ./app/... ./plugins/golem15/wavepath/... && go -C ../sm-wavepath-app test -count=1 -run '^TestBootAllPlugins$' -v . 2>&1 | grep -q -- '^--- PASS: TestBootAllPlugins' && go -C ../sm-wavepath-app test -count=1 -run '^TestParityCorpus$' -v ./parity 2>&1 | grep -q -- '^--- PASS: TestParityCorpus'</automated>
|
||||
<fails_when>Non-zero exit: vet or a short test fails, the nine plugins do not boot, or the `--- PASS: TestParityCorpus` line is absent (the manifest or the fixture did not load, Docker was not reachable, or the filter matched nothing).</fails_when>
|
||||
<automated>OUT="$(../sm-wavepath-app/scripts/check-parity.sh --self-replay --allow-unrecorded --allow-pending-foundation 2>&1)" && printf '%s\n' "$OUT" | grep -qE 'failing 0 unrecorded 0' && printf '%s\n' "$OUT" | grep -qE '^check-parity: recorded 1/1 ported 0 pending 1'</automated>
|
||||
<fails_when>Non-zero exit from the gate (the PHP stack refused or did not boot, the self-replay found a difference), or the output lacks the self-replay line `failing 0 unrecorded 0`, or lacks the summary line `check-parity: recorded 1/1 ported 0 pending 1`.</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.
|
||||
- `grep -c '^\[submodule ' ../sm-wavepath-app/.gitmodules` prints 8, and `git -C ../sm-wavepath-app submodule status` prints eight lines, none starting with `+` or `-`.
|
||||
- `grep -c 'golem15.wavepath' ../sm-wavepath-app/summer.yaml` prints 1; `grep -c 'parity.fixtureplugin' ../sm-wavepath-app/summer.yaml ../sm-wavepath-app/plugins.gen.go ../sm-wavepath-app/app/app.go | awk -F: '{s+=$2} END {print s}'` prints 0.
|
||||
- The recorded fixture has the `alice` case with status 200 and the `unauthenticated` case with the status PHP answered, and holds no JWT: `grep -cE 'eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.' ../sm-wavepath-app/parity/fixtures/routes/*.yaml | awk -F: '{s+=$2} END {print s}'` prints 0.
|
||||
- `stat -c %a "${XDG_CACHE_HOME:-$HOME/.cache}/summercms/wavepath-parity/corpus/vars.yaml"` prints 600.
|
||||
- `grep -vE '^\s*#' ../sm-wavepath-app/parity/php_parity.sh ../sm-wavepath-app/scripts/parity-stack.sh | grep -cE 'worktree add|git (-C [^ ]+ )?(checkout|stash|commit|fetch|pull)|composer (install|update)|(npm|pnpm) (install|ci|add)'` prints 0.
|
||||
- `git -C ../sm-wavepath-app remote` prints nothing.
|
||||
</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>
|
||||
<done>The application repository exists and boots, the PHP reference backend runs from the pinned commits without touching the other agent's checkout, and one real route is recorded, self-replays green on PHP and is counted as pending by the Go harness and by the gate.</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>
|
||||
<name>Task 2: The stack fails closed: record mode, instances, snapshot and per-case restore, status and check, and a self-test of every refusal</name>
|
||||
<precondition>Task 1's verify passed: `../sm-wavepath-app/scripts/parity-stack.sh up` and `down` work in read-only mode.</precondition>
|
||||
<files>../sm-wavepath-app/scripts/parity-stack.sh, ../sm-wavepath-app/parity/php_parity.sh, ../sm-wavepath-app/parity/case_hook.sh, ../sm-wavepath-app/parity/README.md</files>
|
||||
<read_first>../sm-wavepath-app/scripts/parity-stack.sh and ../sm-wavepath-app/parity/php_parity.sh (as Task 1 left them), ../fonoteka.go/scripts/dev-stack.sh (lines 1-130 the header contract and helpers; the functions is_loopback, parse_env_file, check_keys, check_services, port_busy, launch, stop_groups, cleanup, up, down, status, check and the dispatch at the end), ../fonoteka.go/parity/php_parity.sh (lines 10-73 and 120-220), 31-RESEARCH.md ("Recommended shape" items 1 to 6, pitfalls 3, 4, 5 and 8), 31-PATTERNS.md ("parity-stack.sh", "Fail-closed scripts", "No Analog Found"). From the PHP contract with `git show`: the config files that name the environment variables for Centrifugo, LiveKit, VAPID, Turnstile, the queue and the cache</read_first>
|
||||
<action>Per D-08 and D-20, closing threats T-31-08 and T-31-10.
|
||||
1. `scripts/parity-stack.sh`: a header comment listing every subcommand and environment variable and the rule that lines starting with `refuse:` or `missing:` mean the script stopped and `warn:` lines never stop it. Helpers `say`, `warn`, `refuse`, `fail` in the style of fonoteka's; `set -euo pipefail`; `unset FORCE_COLOR`; a `curl --noproxy '*'` wrapper; env files parsed as `KEY=value` data, never executed. Subcommands:
|
||||
- `up [--mode readonly|record]`. Mode `record` exports `BROADCAST_DRIVER=centrifugo`, `BROADCAST_ENABLED=true`, `CENTRIFUGO_API_URL=http://127.0.0.1:RECORDER_PORT/api`, `QUEUE_CONNECTION=sync`, `HTTPS_PROXY` and `https_proxy` at `http://127.0.0.1:PROXY_PORT`, `NO_PROXY=127.0.0.1,localhost`, the parity CA through `-d curl.cainfo` and `-d openssl.cafile` on the PHP server, `LIVEKIT_URL=https://livekit.example.test` (a name that never resolves, so a call that bypasses the proxy fails), and the LiveKit, VAPID and Turnstile values of `parity/parity.env`. Before starting PHP it waits up to `PARITY_LISTENER_WAIT` seconds (default 60) for the recorder and the proxy to accept connections and then prints `refuse: recorder not listening on …` or `refuse: upstream proxy not listening on …` and exits 1. Mode `readonly` is Task 1's.
|
||||
- `down` stops this instance's process groups (TERM, then KILL after 10 seconds); `down --all` also stops the container when no other instance has a pid file.
|
||||
- `status` lists the instance, mode, ports, database and whether each process answers.
|
||||
- `check` verifies: the export's `.parity-export` equals `parity/pins.env`; the chat class-path assertion; the database name contains `parity` and the host is loopback; the vars file is mode 0600; the keys of the vars file equal `parity/scenario.vars.keys` once that file exists; in record mode both listeners answer. It prints every failed check and exits 1 if any failed.
|
||||
- `selftest` runs each refusal against planted input in a scratch directory with no real service: a database name without `parity`, a non-loopback `DB_HOST`, a non-loopback target, record mode with nothing listening, a `pins.env` that differs from the export record, a vars file with mode 0644. Each must print its `refuse:` line and exit non-zero; `selftest` prints `selftest: ok` only when all did.
|
||||
- Ports per instance: `corpus` uses 8423 (PHP), 8424 (recorder), 8425 (upstream proxy), 8422 (session proxy); any other instance name adds 100 to each. The MariaDB container is shared, one database per instance.
|
||||
2. `parity/php_parity.sh`: add `snapshot` (dump the instance database after `reset` into `$PARITY_ROOT/$PARITY_INSTANCE/snapshot.sql`, AUTO_INCREMENT floors included) and `restore` (load the snapshot, clear the export's file cache so rate-limit counters start at zero); add `script FILE [ARGS]` (run a PHP file through `artisan tinker` with the overlay, for plan 31-08). Keep the `rows` guard.
|
||||
3. `parity/case_hook.sh` (executable): reads `PARITY_ROUTE_ID`, `PARITY_CASE_ID` and `PARITY_SEED_HOOK`, calls `php_parity.sh restore`, and applies the case's scenario variant when the reset script defines one for that case id. Exit non-zero on any failure. Measure one restore and write the time into the README.
|
||||
4. `parity/README.md`: the runbook so far: what the parity root holds, the pins, the two modes, the instance rule, every refusal and what it means, how to bring the stack up and down, and the rule that nothing is written in the PHP checkout.
|
||||
5. Commit: `feat(parity): fail-closed stack with record mode, instances and per-case restore`.</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>
|
||||
<automated>OUT="$(../sm-wavepath-app/scripts/parity-stack.sh selftest 2>&1)" && printf '%s\n' "$OUT" | grep -qx 'selftest: ok'</automated>
|
||||
<fails_when>Non-zero exit, or the line `selftest: ok` is absent: a planted bad input (database name without parity, non-loopback host or target, missing listeners, pin mismatch, vars mode) was accepted.</fails_when>
|
||||
<automated>( ../sm-wavepath-app/scripts/parity-stack.sh up --mode readonly && ../sm-wavepath-app/scripts/parity-stack.sh check && ../sm-wavepath-app/parity/php_parity.sh snapshot && PARITY_ROUTE_ID=x PARITY_CASE_ID=y PARITY_SEED_HOOK=community ../sm-wavepath-app/parity/case_hook.sh && OUT="$(../sm-wavepath-app/scripts/parity-stack.sh self-replay 2>&1)" && printf '%s\n' "$OUT" | grep -q 'failing 0 unrecorded 0'; RC=$?; ../sm-wavepath-app/scripts/parity-stack.sh down; exit $RC )</automated>
|
||||
<fails_when>Non-zero exit: `up` or `check` printed a `refuse:` line, the snapshot or the case hook failed, or the self-replay after a restore no longer prints `failing 0 unrecorded 0` (the restore does not bring back the recorded state).</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.
|
||||
- `PARITY_LISTENER_WAIT=2 ../sm-wavepath-app/scripts/parity-stack.sh up --mode record` with nothing on 8424 exits non-zero and prints a line starting with `refuse: recorder not listening`.
|
||||
- `grep -c 'refuse:' ../sm-wavepath-app/scripts/parity-stack.sh` prints at least 6.
|
||||
- `grep -vE '^\s*#' ../sm-wavepath-app/parity/php_parity.sh ../sm-wavepath-app/scripts/parity-stack.sh ../sm-wavepath-app/parity/case_hook.sh | grep -cE 'worktree add|git (-C [^ ]+ )?(checkout|stash|commit|fetch|pull)|composer (install|update)|(npm|pnpm) (install|ci|add)'` prints 0.
|
||||
- `test -x ../sm-wavepath-app/parity/case_hook.sh` exits 0.
|
||||
- `docker ps --format '{{.Names}} {{.Ports}}' | grep wavepath-parity-mariadb` shows the port published on `127.0.0.1` only.
|
||||
</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>
|
||||
<done>The stack cannot serve PHP in record mode without the recorder and the proxy, cannot use a database that is not a parity database, and can return to the recorded state before every case.</done>
|
||||
</task>
|
||||
|
||||
<task type="checkpoint:decision" gate="blocking">
|
||||
<name>Task 5: Go-ahead for the remote of sm-wavepath-app and its module path</name>
|
||||
<read_first>`git -C ../sm-wavepath-app log --oneline`, the module path in ../sm-wavepath-app/go.mod and summer.yaml, the gate's summary line from Task 4, memory note "sm- repo naming"</read_first>
|
||||
<acceptance_criteria>
|
||||
- The user's answer is recorded in the SUMMARY with the confirmed module path and remote URL, or "local".
|
||||
</acceptance_criteria>
|
||||
<decision>Create the remote for sm-wavepath-app and push master, and is `git.golem15.com/golem15/sm-wavepath-app` the right module path?</decision>
|
||||
<context>D-02 rates the repository name, module path and parity/ layout as costly: WavePath's agent and every later WavePath phase build on them, and a rename later touches every import. Right now the repository is a skeleton, so a rename is one `go mod edit` and a small import rewrite. The other applications live under `golem15/` except `sm-bm-app` (`jakub/`). Plans 31-03 to 31-06 work on the local repository either way; a push is not needed to continue. Claude cannot create the repository on git.golem15.com; if you choose to push, the remote must exist first.</context>
|
||||
<options>
|
||||
<option id="push">
|
||||
<name>Keep the path, push to git@git.golem15.com:golem15/sm-wavepath-app.git</name>
|
||||
<pros>The work is backed up and WavePath's agent can clone it.</pros>
|
||||
<cons>The name and path are public from now on.</cons>
|
||||
</option>
|
||||
<option id="rename">
|
||||
<name>Another namespace or name (say which), then push</name>
|
||||
<pros>Fixed while it costs almost nothing.</pros>
|
||||
<cons>A second remote to create.</cons>
|
||||
</option>
|
||||
<option id="local">
|
||||
<name>Keep it local for now</name>
|
||||
<pros>Nothing leaves this machine; the decision can wait.</pros>
|
||||
<cons>No backup; a later rename costs more with every plan.</cons>
|
||||
</option>
|
||||
</options>
|
||||
<resume-signal>Reply "push" (after creating the empty remote), "rename NAMESPACE/NAME" or "local".</resume-signal>
|
||||
</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>
|
||||
<name>Task 6: Act on the answer: rename if asked, push if allowed, and leave the repository clean</name>
|
||||
<reversibility rating="costly">A pushed module path is what other checkouts and go.sum files will name; after this point a rename is a coordinated change.</reversibility>
|
||||
<precondition>Task 5 has an answer.</precondition>
|
||||
<files>../sm-wavepath-app/go.mod, ../sm-wavepath-app/go.work, ../sm-wavepath-app/summer.yaml, ../sm-wavepath-app/plugins.gen.go, ../sm-wavepath-app/main.go, ../sm-wavepath-app/app/app.go, ../sm-wavepath-app/plugins/golem15/wavepath/go.mod, ../sm-wavepath-app/README.md</files>
|
||||
<read_first>The Task 5 answer, ../sm-wavepath-app/go.mod, summer.yaml and every Go file that imports the module path (`grep -rl 'sm-wavepath-app' ../sm-wavepath-app --include=*.go --include=*.yaml --include=go.mod --include=go.work`)</read_first>
|
||||
<action>Per D-02.
|
||||
- "rename NAMESPACE/NAME": change the module path in `go.mod`, the app plugin's `go.mod`, `summer.yaml` and every import; regenerate `plugins.gen.go` and `main.go` with `summer build`; if the directory name changes too, stop and ask (the plans of this phase name `../sm-wavepath-app`). Run Task 4's first verify command again, commit `chore: module path NAMESPACE/NAME`, then continue as "push" with the new URL.
|
||||
- "push": `git -C ../sm-wavepath-app remote add origin URL`, `git push -u origin master`, and check that `git ls-remote origin refs/heads/master` equals `git rev-parse HEAD`. A refused push (the remote does not exist, no permission) is reported with the exact message; nothing else is tried.
|
||||
- "local": add no remote. Record it.
|
||||
In every case: no tag. Post the g15office comment on task `hgol7otp` (plan 31-03 executed; repository local or pushed).</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>
|
||||
<automated>go -C ../sm-wavepath-app vet . ./app/... ./parity/... ./plugins/golem15/wavepath/... && go -C ../sm-wavepath-app test -count=1 -short . ./app/... ./plugins/golem15/wavepath/... && test -z "$(git -C ../sm-wavepath-app status --porcelain)" && test -z "$(git -C ../sm-wavepath-app tag)"</automated>
|
||||
<fails_when>Non-zero exit: the repository no longer vets or passes its short tests after a rename, has uncommitted changes, or has a tag.</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.
|
||||
- With "push" or "rename": the commit id printed by `git -C ../sm-wavepath-app ls-remote origin refs/heads/master` equals `git -C ../sm-wavepath-app rev-parse HEAD`. With "local": `git -C ../sm-wavepath-app remote` prints nothing.
|
||||
- The SUMMARY records the answer, the module path and the remote URL or "local".
|
||||
</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>
|
||||
<done>The repository has the name and path the user confirmed, is pushed only if the user said so, and the next plans can work on it.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
@@ -232,42 +196,29 @@ Expected contracts from 31-02:
|
||||
|
||||
| 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 |
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## 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 |
|
||||
| T-31-07 | Tampering | scripts touching the other agent's checkout | high | mitigate | export by `git archive` at commit ids and rsync with the checkout as source only; `GIT_OPTIONAL_LOCKS=0`; acceptance greps the scripts for checkout, stash, commit, fetch, pull, worktree and install commands; the PHP server's cwd and storage are the export |
|
||||
| T-31-08 | Information disclosure | a recording run reaching real vendors | high | mitigate | record mode refuses to start PHP unless the recorder and the upstream proxy listen; read-only mode sets the HTTPS proxy to a closed loopback port and a queue with no worker; LiveKit uses a host name that never resolves; the overlay holds test-only values from `parity/parity.env`; `selftest` proves the refusals |
|
||||
| T-31-10 | Tampering | recording against a real database | high | mitigate | the database is a container published on loopback only; the name must contain `parity`; the checkout's `.env` is never read or copied; `selftest` plants a bad name and a non-loopback host |
|
||||
| T-31-13 | Tampering | recording a version other than the freeze | medium | mitigate | export by the commit ids of `parity/pins.env`; `.parity-export` compared by `check`; the class-path assertion on a class that exists only at the chat pin |
|
||||
| T-31-SC | Tampering | npm/pip/cargo installs | high | mitigate | no package install; use existing dependencies and explicit lockfiles |
|
||||
</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.
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</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.
|
||||
sm-wavepath-app skeleton and fail-closed isolated PHP parity stack is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</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.
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-03-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
|
||||
@@ -3,106 +3,52 @@ phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 04
|
||||
type: execute
|
||||
wave: 3
|
||||
depends_on: [31-03]
|
||||
depends_on: [31-01, 31-02, 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/scenario.md
|
||||
- ../sm-wavepath-app/parity/scenario.vars.keys
|
||||
- ../sm-wavepath-app/parity/scenario-deferred.txt
|
||||
- ../sm-wavepath-app/parity/wavepath_reset.php
|
||||
- ../sm-wavepath-app/parity/fixtureplugin/
|
||||
- ../sm-wavepath-app/parity/fixtures/seed/bootstrap.yaml
|
||||
- ../sm-wavepath-app/parity/manifest.yaml
|
||||
- ../sm-wavepath-app/parity/routes.snapshot
|
||||
- ../sm-wavepath-app/parity/foundation-routes.txt
|
||||
- ../sm-wavepath-app/parity/check_corpus.go
|
||||
- ../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/parity/harness_test.go
|
||||
- ../sm-wavepath-app/parity/upstream_replay_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]
|
||||
requirements: [SC-1, SC-3, D-04, D-09, D-15, D-16, D-18, D-19]
|
||||
estimate:
|
||||
tokens: 390000
|
||||
raw_tokens: 390000
|
||||
tasks: 3
|
||||
tokens: 180000
|
||||
raw_tokens: 180000
|
||||
tasks: 2
|
||||
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."
|
||||
- "Scenario on both sides, 196 pending-route manifest, corpus checker, harness and fail-closed gate is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
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"
|
||||
- path: "../sm-wavepath-app/parity/scenario.md"
|
||||
provides: "Scenario on both sides, 196 pending-route manifest, corpus checker, harness and fail-closed gate"
|
||||
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
|
||||
- from: "../sm-wavepath-app/parity/scenario.md"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## 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.
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<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.
|
||||
Scenario on both sides, 196 pending-route manifest, corpus checker, harness and fail-closed gate.
|
||||
|
||||
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.
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@@ -114,112 +60,87 @@ Output: production app-plugin handlers and wiring, host companion migrations, ex
|
||||
@.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>
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-VALIDATION.md
|
||||
</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>
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 3: The whole scenario is seeded on both sides with the same ids and variable names</name>
|
||||
<files>../sm-wavepath-app/parity/scenario.md, ../sm-wavepath-app/parity/scenario.vars.keys, ../sm-wavepath-app/parity/scenario-deferred.txt, ../sm-wavepath-app/parity/wavepath_reset.php, ../sm-wavepath-app/parity/fixtureplugin/plugin.go, ../sm-wavepath-app/parity/fixtureplugin/seed.go, ../sm-wavepath-app/parity/seed_test.go, ../sm-wavepath-app/parity/fixtures/seed/bootstrap.yaml</files>
|
||||
<read_first>../sm-wavepath-app/parity/wavepath_reset.php and ../sm-wavepath-app/parity/fixtureplugin/seed.go (as Task 1 left them), ../fonoteka.go/parity/fonoteka_reset.php (whole file), ../fonoteka.go/parity/fonoteka_seed_test.go (lines 1-120 and 600-700), 31-CONTEXT.md (D-04, D-11, D-18, D-19, D-21), 31-RESEARCH.md ("Rate buckets in the corpus", "Route table", "Gap map", "Upstream vendors the corpus reaches", "Pattern 2", pitfalls 2, 4, 6 and 10), the models of the eight shared Go plugins (`../sm-wavepath-app/plugins/golem15/*/models/`) and their test fixture plugins (`fixture_plugin_test.go`) for how rows are created. From the PHP contract with `git show`: the models of the wavepath plugin and of the shared plugins, `Plugin.php` lines 160-558 (what a created group, a new member and a message trigger), and the migrations under `updates/` that add host columns to shared tables</read_first>
|
||||
<behavior>
|
||||
- `TestScenarioSeeds` (Docker): `fixtureplugin.Seed` on a migrated database succeeds twice in a row (idempotent) and every seeded row has the id the scenario names.
|
||||
- `TestScenarioVarsMatch`: the variable names the Go seeder wrote, together with the names in `parity/scenario-deferred.txt`, equal the names in `parity/scenario.vars.keys`; a name missing on one side fails with that name.
|
||||
- `TestFixtureAbsentFromProduction`: `parity.fixtureplugin` is not in `app.PluginIDs`, `summer.yaml` or `plugins.gen.go`.
|
||||
- `TestSeededJWTAuthenticates` (Docker): a request to a route of the user plugin behind `jwt.auth` with `Cookie: token=` and the seeded JWT of alice is authenticated as alice.
|
||||
</behavior>
|
||||
<action>Per D-04, D-21, D-11 (a user on each side of every access rule), D-18 and D-19.
|
||||
1. `parity/scenario.md` is the single definition. It names every identity, row and explicit id, and for each the variable it produces (`id:NAME`, `jwt:IDENTITY`, `token:NAME`, `code:NAME`). Minimum content:
|
||||
- Identities: `alice` (owner of the group `harbor`), `bob` (admin of `harbor`, two push subscriptions, offline), `carol` (member, with a user status), `dave` (no group; accepted friend of alice), `erin` (banned from `harbor`), `frank` (stranger: no friendship, no group), `olive` (member, the one user the presence script reports online), an unclaimed imported member, one user per rate bucket for the ten 429 cases (`rl-wave-api`, `rl-community-join` and so on), and a bot user with a `wave_` token of scope `chat:bot`.
|
||||
- Groups: `harbor` (closed, with an invite code and a custom code free for the invite cases), `plaza` (open, for the open-join cases), `cellar` (closed, alice is not a member, for denials), each with its chat and channels as the PHP lifecycle creates them.
|
||||
- Channels of `harbor`: the system default `general`, a private channel, an archived channel, a category, a personal category, pins, a favourite, a muted channel.
|
||||
- Messages: plain messages, one thread with replies, a message per delete, edit, pin and reaction case, a webhook message, an attachment; no http(s) URL in any message except in the unfurl cases.
|
||||
- Direct messages: a conversation between alice and dave with a thread.
|
||||
- Friendships: alice and dave accepted, bob to alice pending, alice to carol sent, each case that changes one having its own row.
|
||||
- Video: a call link, a channel guest link, a guest session in each state the guest routes need.
|
||||
- Forum: categories, threads and posts in `harbor`. Notes (D-18): diary entries of alice, one shared publicly and one shared with `harbor`.
|
||||
- Push: the VAPID test pair and subscriptions whose endpoints are on real public push host names (the PHP endpoint rule resolves them); the subscription key pairs are test-only and listed in the scenario.
|
||||
- A webhook on `general` with its token, a custom emoji, and the rows the 17 uncalled routes need for a success case each (D-19).
|
||||
Each access rule of D-11 has an identity on each side of it; the document says which.
|
||||
2. `parity/wavepath_reset.php`: the whole scenario, idempotent, wiping the scenario's state by id before recreating it, with explicit ids and AUTO_INCREMENT floors per table (steps of 10000000, so ids of different tables never collide when values become variables). Per-case variants are selected by an environment variable naming the case. It mints the session JWT of every identity and writes only the vars file. It never prints a secret.
|
||||
3. `parity/fixtureplugin/seed.go`: the same rows through the Go plugins' models for every table that exists (the shared plugins' tables, and the user rows), with the same explicit ids, Postgres sequences set to the same floors, and the same variable names written into the `*tide.Store`. The JWTs are minted through the user plugin with the secret from `parity/parity.env`. A scenario row whose host table does not exist yet is not seeded and its variable names go into `parity/scenario-deferred.txt`, one per line with the phase that ports the table (31.1 or 31.2); this plan adds no host table.
|
||||
4. `parity/scenario.vars.keys`: the sorted variable names, written from a PHP reset run (names only, no values). `parity/fixtures/seed/bootstrap.yaml`: the seed flow without a login step (D-21).
|
||||
5. `parity/seed_test.go`: the behavior block.
|
||||
6. Run `scripts/parity-stack.sh up`, `check` (it now compares the vars keys), `php_parity.sh snapshot`, `down`. Commit: `feat(parity): the community scenario on PHP and Go`.</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>
|
||||
<automated>go -C ../sm-wavepath-app vet ./parity/... && go -C ../sm-wavepath-app test -count=1 -run '^(TestScenarioSeeds|TestScenarioVarsMatch|TestFixtureAbsentFromProduction|TestSeededJWTAuthenticates)$' -v ./parity 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 4</automated>
|
||||
<fails_when>Non-zero exit: fewer than four `--- PASS: Test` lines (a seeding error, a variable name on one side only, the fixture plugin listed for production, or the seeded cookie JWT not accepted by the Go guard; a skipped Docker test also yields fewer than four).</fails_when>
|
||||
<automated>( ../sm-wavepath-app/scripts/parity-stack.sh up --mode readonly && ../sm-wavepath-app/scripts/parity-stack.sh check; RC=$?; ../sm-wavepath-app/scripts/parity-stack.sh down; exit $RC )</automated>
|
||||
<fails_when>Non-zero exit: the PHP reset failed on the fresh MariaDB database, or `check` printed a `refuse:` line because the vars file's key set differs from `parity/scenario.vars.keys`.</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.
|
||||
- `grep -cE '^(jwt|id):(alice|bob|carol|dave|erin|frank|olive)$' ../sm-wavepath-app/parity/scenario.vars.keys` prints 14.
|
||||
- `grep -c '^jwt:rl-' ../sm-wavepath-app/parity/scenario.vars.keys` prints at least 8 (the buckets keyed by user; the guest, bot and webhook buckets use their own credentials).
|
||||
- Every line of `../sm-wavepath-app/parity/scenario-deferred.txt` names a variable and one of `31.1` or `31.2`: `grep -vcE ' (31\.1|31\.2)$' ../sm-wavepath-app/parity/scenario-deferred.txt` prints 0.
|
||||
- `grep -cE 'eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.' ../sm-wavepath-app/parity/scenario.md ../sm-wavepath-app/parity/scenario.vars.keys ../sm-wavepath-app/parity/wavepath_reset.php | awk -F: '{s+=$2} END {print s}'` prints 0.
|
||||
</acceptance_criteria>
|
||||
<done>A real foundation write works end to end against the frozen PHP contract, including its publication.</done>
|
||||
<done>Both backends start every case from the same named state, and a request can log in on either side with a seeded cookie.</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>
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 4: The 196-route manifest with every route pending, the corpus checker and snapshot, a harness that can fail, and the complete gate</name>
|
||||
<files>../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/routes.snapshot, ../sm-wavepath-app/parity/foundation-routes.txt, ../sm-wavepath-app/parity/check_corpus.go, ../sm-wavepath-app/parity/parity_test.go, ../sm-wavepath-app/parity/harness_test.go, ../sm-wavepath-app/parity/upstream_replay_test.go, ../sm-wavepath-app/scripts/check-parity.sh, ../sm-wavepath-app/parity/README.md, ../sm-wavepath-app/README.md, ../sm-wavepath-app/plugins/golem15/wavepath/plugin_test.go</files>
|
||||
<read_first>../sm-wavepath-app/parity/manifest.yaml, parity_test.go and scripts/check-parity.sh (as Task 1 left them), ../fonoteka.go/parity/check_corpus.go (whole file: flags at 120-129, run at 138-206, scanSecrets at 437-515, the PHP route parser at 549-648, sanitizeFile at 717, the ported-versus-fixture check at 766-779), ../fonoteka.go/parity/check_corpus_test.go (how the checker is built and tested beside a test package), ../fonoteka.go/parity/routes.snapshot, ../fonoteka.go/parity/parity_test.go (lines 106-310), ../fonoteka.go/parity/synthetic_test.go, ../fonoteka.go/parity/upstream_replay_test.go (whole file), scripts/check-phase19.1.sh (lines 1-80: stages, the go test -json detectors, the self-test stage, the Docker message), ../sm-demo-app/scripts/check-all.sh (lines 42-82), 31-RESEARCH.md ("Count", "Route table", "Consumer gate"), 31-PATTERNS.md ("check_corpus.go", "check-parity.sh", "parity_test.go"). The route file, read-only: `GIT_OPTIONAL_LOCKS=0 git -C /media/nvme/dev/jz/wavepath.org/plugins/golem15/wavepath show a08ed0a34d1af72314a3453bb25593c6a1660056:routes.php`</read_first>
|
||||
<behavior>
|
||||
- `go run ./parity/check_corpus.go --manifest parity/manifest.yaml --snapshot parity/routes.snapshot --allow-incomplete` (run in the app directory) exits 0 and prints `routes 196` and the recorded and pending counts; with `--routes FILE` it also checks the SHA-256 of the route file against the snapshot and that the parsed ids equal the snapshot.
|
||||
- It exits non-zero when: the manifest has a route the snapshot lacks or the reverse; a route's auth group differs from the classifier's; `--require-recorded` is set and a case has no fixture; a ported case's manifest status differs from its fixture; `--check-secrets` finds a JWT shape, a `wave_` token, an invite code, a webhook token, a call-link code or a cookie value in a fixture or sidecar that is not an allow-listed test constant.
|
||||
- `TestParityHarnessCanFail`: over a synthetic manifest and handler, the suite fails for a ported route whose response differs, for a ported route without a fixture, for a ported route with an unknown seed hook and for a mutated recorded response; a pending route is reported as pending and is not in the passing count.
|
||||
- `TestUpstreamSidecarsAreReplayed`: fails on an upstream sidecar of a ported route that no case replayed (it passes while no route is ported).
|
||||
- `TestNoWaveRoutesYet` in the app plugin: the shell registers no route (the foundation slice adds them in plans 31-06 and 31-07).
|
||||
- The gate: `scripts/check-parity.sh --self-test` feeds planted go test -json output (a failed test, zero tests, a skipped required test, a missing required test name) and planted checker output to its detectors and passes only when each is refused.
|
||||
</behavior>
|
||||
<action>Per D-09, D-15 as amended by D-16, D-10 (the realtime routes are ordinary routes) and D-05.
|
||||
1. `parity/check_corpus.go` (`package main`, run with `go run`, built beside the test package the way fonoteka does it): constants for the 194 routes of the route file and the 196 expected ids; the PHP route parser over `Route::group` frames and `Route::` verbs, filtered to the D-09 prefixes (`/_wave/api/v1/community`, `/_wave/api/v1/guest`, `/_wave/api/v1/push`, the four bot and token routes under `/api/v1`, `/hooks/{token}`); the classifier mapping prefix and middleware to `jwt`, `guest`, `bot`, `webhook`; the two realtime ids as extras in group `realtime`. Flags `--manifest`, `--snapshot`, `--routes`, `--fixtures`, `--allow-incomplete`, `--require-recorded`, `--require-clients`, `--check-secrets`, `--foundation FILE` (prints `foundation F pending G`), `--write-snapshot` (writes the snapshot from `--routes`). Route id is `METHOD path auth_group`; a fixture name is the id with slashes and spaces replaced, as `sanitizeFile` does. Secret patterns beyond fonoteka's: `wave_` bearer tokens, 40-character webhook tokens, invite and call-link codes that equal a vars entry, any cookie value; the test-only constants of `parity/parity.env` are allow-listed by exact value.
|
||||
2. `parity/routes.snapshot`: written once with `--write-snapshot` from the route file at `a08ed0a` (digest and the 196 ids). `parity/manifest.yaml`: all 196 routes, status `pending`, seed hook `community`, the auth group of each, the tracer route keeping its two cases; no other cases yet (plan 31-05 writes them). `parity/foundation-routes.txt`: the 36 foundation-slice route ids, one per line.
|
||||
3. `parity/parity_test.go`: assert the manifest has 196 routes; one subtest per route; the pending and ported branches as in the tracer; a `coverage` subtest. `parity/harness_test.go`: `TestParityHarnessCanFail` over a synthetic manifest and handler. `parity/upstream_replay_test.go`: the upstream switch (the fake put on each request's context with `fetchguard.WithTransport`; a case without a sidecar gets an empty fake, so any vendor call fails it) and `TestUpstreamSidecarsAreReplayed`, copied from fonoteka's with this suite's names.
|
||||
4. `scripts/check-parity.sh`, complete: stages `self-test`, `corpus` (the checker with `--check-secrets`, and `--require-recorded` unless `--allow-unrecorded`), `replay` (`go test -count=1 -json ./parity`, parsed: a failed test, a skipped required test, zero tests, a missing required test name or an unreachable Docker daemon fails the stage; required names `TestParityCorpus`, `TestParityHarnessCanFail`, `TestUpstreamSidecarsAreReplayed`, `TestScenarioVarsMatch`, `TestFixtureAbsentFromProduction`), `foundation` (every id in `parity/foundation-routes.txt` is `ported` unless `--allow-pending-foundation`), `consumers` (`sm-bm-app`: `go build ./...` and its tests `TestChatMounted`, `TestRealtimeDefaultDriver`, `TestRealtimeRoutes`, `TestRealtimeConfigDefaults`, `TestRemoteKeyOverride`; `sm-demo-app`: `go vet` and `go test -short` of the root package and `./plugins/demo/...`; directories from `BM_DIR` and `DEMO_DIR` with `../` defaults), optional `--self-replay`. One summary line: `check-parity: recorded R/196 ported P pending N foundation-pending F`. Each allow flag prints `NOT COMPLETE: …` with the count it let through. Exit 0 only when no stage failed.
|
||||
5. `parity/README.md`: the corpus boundary (D-09), the manifest conventions, the checker's flags, the harness rules (pending never passes), the gate's stages and flags. `README.md` at the root: what the repository is, the plugin list, quick start (`summer build`, `go test -short ./...`), a pointer to `parity/README.md`.
|
||||
6. Commit in steps: checker and snapshot; manifest; harness; gate and READMEs.</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>
|
||||
<automated>go -C ../sm-wavepath-app vet . ./app/... ./parity/... ./plugins/golem15/wavepath/... && go -C ../sm-wavepath-app run ./parity/check_corpus.go --manifest parity/manifest.yaml --snapshot parity/routes.snapshot --allow-incomplete --check-secrets --foundation parity/foundation-routes.txt 2>&1 | grep -qx 'routes 196' && go -C ../sm-wavepath-app test -count=1 -run '^(TestParityCorpus|TestParityHarnessCanFail|TestUpstreamSidecarsAreReplayed)$' -v ./parity 2>&1 | grep -c -- '^--- PASS: Test' | grep -qx 3</automated>
|
||||
<fails_when>Non-zero exit: vet fails, the checker does not print the line `routes 196` (a route missing, extra or in the wrong group, or a secret found), or fewer than three `--- PASS: Test` lines are printed.</fails_when>
|
||||
<automated>OUT="$(../sm-wavepath-app/scripts/check-parity.sh --allow-unrecorded --allow-pending-foundation 2>&1)" && printf '%s\n' "$OUT" | grep -qE '^check-parity: recorded [0-9]+/196 ported 0 pending 196 foundation-pending 36$' && ! ../sm-wavepath-app/scripts/check-parity.sh >/dev/null 2>&1</automated>
|
||||
<fails_when>Non-zero exit: the gate with both allow flags failed a stage (self-test, corpus, replay or a consumer build), the summary line is absent or has other counts, or the gate without flags exited 0 although routes are unrecorded and the foundation slice is pending.</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.
|
||||
- `grep -c '^ - id: ' ../sm-wavepath-app/parity/manifest.yaml` prints 196 and `grep -c 'status: ported' ../sm-wavepath-app/parity/manifest.yaml` prints 0.
|
||||
- `wc -l < ../sm-wavepath-app/parity/foundation-routes.txt` prints 36.
|
||||
- `go -C ../sm-wavepath-app run ./parity/check_corpus.go --manifest parity/manifest.yaml --snapshot parity/routes.snapshot --require-recorded` exits non-zero (195 routes have no fixture yet).
|
||||
- `../sm-wavepath-app/scripts/check-parity.sh --self-test` exits 0 and prints a line for each planted case it refused.
|
||||
- `git -C ../sm-wavepath-app status --porcelain` prints nothing.
|
||||
</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>
|
||||
<done>The corpus has its full route list, a checker that ties it to the PHP route file, a replay suite proven able to fail, and a gate that says how many routes are recorded, ported and pending and refuses to pass early.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
@@ -229,42 +150,28 @@ Rules that bind this plan:
|
||||
|
||||
| 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 |
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## 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 |
|
||||
| T-31-09 | Information disclosure | secrets in committed fixtures | high | mitigate | captured values live in the mode-0600 vars file under the parity root; the reset script writes only that file; `check_corpus --check-secrets` scans fixtures and sidecars for JWT shapes, `wave_` tokens, webhook tokens, codes and cookie values; `.gitignore` covers vars files |
|
||||
| T-31-11 | Spoofing | a gate that passes on nothing | high | mitigate | the gate parses `go test -json`, requires named tests, fails on zero tests, skips and a missing Docker daemon; its self-test feeds planted output to each detector; `TestParityHarnessCanFail` proves a pending route is never a pass |
|
||||
| T-31-12 | Elevation of privilege | the fixture plugin in a production binary | high | mitigate | constructed in process by tests only; never registered with `party.Register`, never in `summer.yaml`, `plugins.gen.go` or `app.PluginIDs`; `TestFixtureAbsentFromProduction` |
|
||||
| T-31-SC | Tampering | npm/pip/cargo installs | high | mitigate | no package install; use existing dependencies and explicit lockfiles |
|
||||
</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`.
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</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.
|
||||
Scenario on both sides, 196 pending-route manifest, corpus checker, harness and fail-closed gate is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</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.
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-04-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
|
||||
@@ -2,119 +2,53 @@
|
||||
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."
|
||||
wave: 4
|
||||
depends_on: [31-02, 31-04]
|
||||
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
|
||||
- ../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/
|
||||
- ../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-3, SC-4, D-08, D-14, D-20, D-22, TODO-OIDC, TODO-SLASH, TODO-MODERATION]
|
||||
requirements: [SC-1, SC-2, D-06, D-07, D-09, D-10, D-11, D-12, D-13, D-17, D-19]
|
||||
estimate:
|
||||
tokens: 300000
|
||||
raw_tokens: 300000
|
||||
tokens: 260000
|
||||
raw_tokens: 260000
|
||||
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."
|
||||
- "Full 196-route PHP recording with client provenance, publications, upstreams and green self-replay is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
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"
|
||||
- path: "../sm-wavepath-app/parity/manifest.yaml"
|
||||
provides: "Full 196-route PHP recording with client provenance, publications, upstreams and green self-replay"
|
||||
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
|
||||
- from: "../sm-wavepath-app/parity/manifest.yaml"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## 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.
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<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.
|
||||
Full 196-route PHP recording with client provenance, publications, upstreams and green self-replay.
|
||||
|
||||
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.
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@@ -126,117 +60,95 @@ Output: a green OIDC parity corpus, catalog-aware slash behavior in vue-chat-lay
|
||||
@.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>
|
||||
@.planning/phases/31-chat-polish-against-wavepath-clients/31-VALIDATION.md
|
||||
</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>
|
||||
<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, 31-03-SUMMARY.md, 31-04-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>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>
|
||||
<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>
|
||||
- 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.
|
||||
- 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>PHP OIDC behavior is a committed, secret-free reference corpus and the existing Go provider passes it under the mandatory parity flag.</done>
|
||||
<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" 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>
|
||||
<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>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>
|
||||
<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>
|
||||
- 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.
|
||||
- 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>A user can deliberately post slash-prefixed text with //, while accidental unknown commands are refused locally exactly as WavePath specifies.</done>
|
||||
<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" 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>
|
||||
<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>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>
|
||||
<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>
|
||||
- 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.
|
||||
- `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>Hosts can moderate all requested names and filenames through additive pre-save events, and the demo proves refusals while unlistened plugins remain compatible.</done>
|
||||
<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>
|
||||
@@ -246,43 +158,31 @@ Rules that bind this plan:
|
||||
|
||||
| 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 |
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## 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 |
|
||||
| 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 package install; use existing dependencies and explicit lockfiles |
|
||||
</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.
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</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.
|
||||
Full 196-route PHP recording with client provenance, publications, upstreams and green self-replay is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</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.
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-05-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
|
||||
@@ -2,104 +2,53 @@
|
||||
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]
|
||||
wave: 5
|
||||
depends_on: [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
|
||||
- ../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/api/response.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/api/actor.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/parity/manifest.yaml
|
||||
- ../sm-wavepath-app/parity/foundation_smoke_test.go
|
||||
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]
|
||||
requirements: [SC-1, SC-2, D-01, D-03, D-10, D-11, D-16, D-21]
|
||||
estimate:
|
||||
tokens: 300000
|
||||
raw_tokens: 300000
|
||||
tasks: 3
|
||||
tokens: 150000
|
||||
raw_tokens: 150000
|
||||
tasks: 2
|
||||
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."
|
||||
- "Foundation infrastructure: envelope, actor, buckets, contexts, resolvers, authorizers and realtime is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
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"
|
||||
- path: "../sm-wavepath-app/plugins/golem15/wavepath/plugin.go"
|
||||
provides: "Foundation infrastructure: envelope, actor, buckets, contexts, resolvers, authorizers and realtime"
|
||||
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
|
||||
- from: "../sm-wavepath-app/plugins/golem15/wavepath/plugin.go"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## 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.
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<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.
|
||||
Foundation infrastructure: envelope, actor, buckets, contexts, resolvers, authorizers and realtime.
|
||||
|
||||
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.
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@@ -112,114 +61,30 @@ Output: focused test matrices across touched repos and a green foundation phase
|
||||
@.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>
|
||||
<name>Task 1: Tracer: recorded foundation write through envelope, cookie actor, buckets, shared service and broadcast</name>
|
||||
<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/updates/, ../sm-wavepath-app/parity/manifest.yaml, ../sm-wavepath-app/parity/foundation_smoke_test.go</files>
|
||||
<action>Per D-01, D-03, D-10, D-11 and D-21, select one recorded foundation write with a deterministic publication. Start with a failing TestFoundationTracer that sends the fixture's token cookie through app.Handler and compares response and broadcast sidecar. Implement typed PHP-compatible success/error envelopes, actor/path/body helpers, app-owned wave-api and presence-state buckets, reuse userfriends.JoinBucket, mount only the selected unchanged /_wave path, and call the shared service through a host serializer. Add only migration-backed companion data needed by the route. Mark only the tracer route ported; fix implementation rather than fixtures.</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>
|
||||
<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, a named test does not run, or the expected corpus count is absent.</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>
|
||||
<done>One real foundation write is green end to end with exact PHP envelope, persistence and publications.</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>
|
||||
<name>Task 2: Contexts, access resolvers, wave/presence authorizers and realtime routes</name>
|
||||
<files>../sm-wavepath-app/plugins/golem15/wavepath/chat.go, ../sm-wavepath-app/plugins/golem15/wavepath/realtime.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</files>
|
||||
<action>Per D-03 and D-10, implement the host group context over userfriends membership and roles, use the existing friendgroup alias, and add only the channel alias. Install channel/forum resolvers inside lagoon.OnDatabase and deny on missing database or errors. Read lighthouse channel parsing before implementing strict wave:group:{id} and presence:wave:group:{id} authorizers; register wave once and match recorded info/capabilities. Mount token and subscribe routes with their recorded auth and cache behavior. Mark only the two realtime routes ported after all success and denial fixtures pass.</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>
|
||||
<automated>go -C ../sm-wavepath-app test -count=1 -run 'TestParityCorpus/.+realtime' -v ./parity 2>&1 | grep -q -- '^--- PASS:'</automated>
|
||||
<fails_when>Non-zero exit, a named test does not run, or the expected corpus count is absent.</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>
|
||||
<done>Foundation infrastructure and both realtime routes match the corpus and deny malformed or cross-group access.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
@@ -229,57 +94,29 @@ Use final names/signatures from all five summaries, not draft names in PLAN file
|
||||
|
||||
| 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 |
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## 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 |
|
||||
| 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-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-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; use existing dependencies and explicit lockfiles |
|
||||
</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.
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</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.
|
||||
Foundation infrastructure: envelope, actor, buckets, contexts, resolvers, authorizers and realtime is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</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.
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-06-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 07
|
||||
type: execute
|
||||
wave: 6
|
||||
depends_on: [31-06]
|
||||
files_modified:
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/plugin.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/routes.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/lifecycle.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/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-03, D-10, D-11, D-13, D-16]
|
||||
estimate:
|
||||
tokens: 190000
|
||||
raw_tokens: 190000
|
||||
tasks: 2
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "Foundation handlers and lifecycle green: groups, members, invites, join, friends and phase gate is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
artifacts:
|
||||
- path: "../sm-wavepath-app/plugins/golem15/wavepath/plugin.go"
|
||||
provides: "Foundation handlers and lifecycle green: groups, members, invites, join, friends and phase gate"
|
||||
key_links:
|
||||
- from: "../sm-wavepath-app/plugins/golem15/wavepath/plugin.go"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<objective>
|
||||
Foundation handlers and lifecycle green: groups, members, invites, join, friends and phase gate.
|
||||
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</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
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="tracer">
|
||||
<name>Task 1: Port groups, members, invites, join and friends against recorded cases</name>
|
||||
<files>../sm-wavepath-app/plugins/golem15/wavepath/routes.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>
|
||||
<action>Per D-03, D-11, D-13 and D-16, expand from the tracer one vertical family at a time: groups, members, invites/join, then friends. Use GroupService and FriendshipService for generic operations and app-side transactions for host-only fields without changing shared serializers. Define typed requests/responses from fixtures, preserve nil/empty/conditional keys, scope parent before nested ids, and reproduce recorded 401/403/404/422/429 behavior. Stack wave-api with community-join only where recorded. Mark each family ported only after all of its cases and broadcasts pass; finish with 34 non-realtime foundation routes ported.</action>
|
||||
<verify>
|
||||
<automated>go -C ../sm-wavepath-app test -count=1 -run 'TestParityCorpus/.+(groups|members|invites|join|friends)' -v ./parity 2>&1 | tee /tmp/phase31-foundation.log && ! grep -q -- '^--- FAIL:' /tmp/phase31-foundation.log && grep -q -- '^--- PASS:' /tmp/phase31-foundation.log</automated>
|
||||
<fails_when>Non-zero exit, a named test does not run, or the expected corpus count is absent.</fails_when>
|
||||
</verify>
|
||||
<done>All group/member/invite/join/friend routes and their denial, validation, rate and publication cases pass.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Transactional group lifecycle and foundation-pending zero gate</name>
|
||||
<files>../sm-wavepath-app/plugins/golem15/wavepath/plugin.go, ../sm-wavepath-app/plugins/golem15/wavepath/lifecycle.go, ../sm-wavepath-app/plugins/golem15/wavepath/README.md, ../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>
|
||||
<action>Per D-03, listen for GroupCreated, MemberJoined/Left and GroupDeleted. Work on ev.Tx so failures roll back; create group chat/default channel once, avoid duplicate owner work, update memberships idempotently, and on delete end video and remove forum/host context in PHP order. Add lifecycle smoke coverage for rows, rollback and publications. Prove exactly foundation-routes.txt is ported and run the gate without allow flags; it must report recorded 196/196, ported 36, pending 160, foundation-pending 0.</action>
|
||||
<verify>
|
||||
<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, a named test does not run, or the expected corpus count is absent.</fails_when>
|
||||
</verify>
|
||||
<done>Lifecycle is rollback-safe and the Phase 31 foundation gate closes at zero foundation pending while 160 later-phase routes remain pending.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| 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-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-SC | Tampering | npm/pip/cargo installs | high | mitigate | no package install; use existing dependencies and explicit lockfiles |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
Foundation handlers and lifecycle green: groups, members, invites, join, friends and phase gate is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-07-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
@@ -0,0 +1,115 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 08
|
||||
type: execute
|
||||
wave: 2
|
||||
depends_on: [31-03]
|
||||
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
|
||||
autonomous: true
|
||||
requirements: [SC-3, D-08, D-20, TODO-OIDC]
|
||||
estimate:
|
||||
tokens: 80000
|
||||
raw_tokens: 80000
|
||||
tasks: 1
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "Folded OIDC PHP parity recording in sm-oauthserver-plugin is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
artifacts:
|
||||
- path: "../sm-oauthserver-plugin/testdata/parity/flows/"
|
||||
provides: "Folded OIDC PHP parity recording in sm-oauthserver-plugin"
|
||||
key_links:
|
||||
- from: "../sm-oauthserver-plugin/testdata/parity/flows/"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<objective>
|
||||
Folded OIDC PHP parity recording in sm-oauthserver-plugin.
|
||||
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</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
|
||||
</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-03-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>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## 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-SC | Tampering | npm/pip/cargo installs | high | mitigate | no package install; use existing dependencies and explicit lockfiles |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
Folded OIDC PHP parity recording in sm-oauthserver-plugin is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-08-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
@@ -0,0 +1,118 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 09
|
||||
type: execute
|
||||
wave: 1
|
||||
depends_on: []
|
||||
files_modified:
|
||||
- ../vue-chat-layer/app/composables/useChat.ts
|
||||
- ../vue-chat-layer/tests/store.test.ts
|
||||
- ../vue-chat-layer/README.md
|
||||
autonomous: true
|
||||
requirements: [SC-4, D-22, TODO-SLASH]
|
||||
estimate:
|
||||
tokens: 60000
|
||||
raw_tokens: 60000
|
||||
tasks: 1
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "Folded vue-chat-layer slash-command parity fix is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
artifacts:
|
||||
- path: "../vue-chat-layer/app/composables/useChat.ts"
|
||||
provides: "Folded vue-chat-layer slash-command parity fix"
|
||||
key_links:
|
||||
- from: "../vue-chat-layer/app/composables/useChat.ts"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<objective>
|
||||
Folded vue-chat-layer slash-command parity fix.
|
||||
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</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
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<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>
|
||||
|
||||
</tasks>
|
||||
|
||||
<threat_model>
|
||||
## Trust Boundaries
|
||||
|
||||
| Boundary | Description |
|
||||
|----------|-------------|
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| 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-SC | Tampering | npm/pip/cargo installs | high | mitigate | no package install; use existing dependencies and explicit lockfiles |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
Folded vue-chat-layer slash-command parity fix is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-09-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
@@ -0,0 +1,133 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 10
|
||||
type: execute
|
||||
wave: 1
|
||||
depends_on: []
|
||||
files_modified:
|
||||
- ../sm-chat-plugin/events/events.go
|
||||
- ../sm-chat-plugin/classes/service.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/README.md
|
||||
- ../sm-user-plugin/classes/events.go
|
||||
- ../sm-user-plugin/contracts/rejection.go
|
||||
- ../sm-user-plugin/controllers/
|
||||
- ../sm-user-plugin/README.md
|
||||
- ../sm-demo-app/plugins/demo/moderation.go
|
||||
- ../sm-demo-app/plugins/demo/plugin.go
|
||||
autonomous: true
|
||||
requirements: [SC-3, D-14, TODO-MODERATION]
|
||||
estimate:
|
||||
tokens: 150000
|
||||
raw_tokens: 150000
|
||||
tasks: 1
|
||||
confidence: low
|
||||
must_haves:
|
||||
truths:
|
||||
- "Folded additive moderation seams for users, friend groups and attachment filenames is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
artifacts:
|
||||
- path: "../sm-chat-plugin/events/events.go"
|
||||
provides: "Folded additive moderation seams for users, friend groups and attachment filenames"
|
||||
key_links:
|
||||
- from: "../sm-chat-plugin/events/events.go"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<objective>
|
||||
Folded additive moderation seams for users, friend groups and attachment filenames.
|
||||
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</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
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<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 |
|
||||
|----------|-------------|
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## STRIDE Threat Register
|
||||
|
||||
| Threat ID | Category | Component | Severity | Disposition | Mitigation Plan |
|
||||
|-----------|----------|-----------|----------|-------------|-----------------|
|
||||
| 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 package install; use existing dependencies and explicit lockfiles |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
Folded additive moderation seams for users, friend groups and attachment filenames is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-10-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
@@ -0,0 +1,188 @@
|
||||
---
|
||||
phase: 31-chat-polish-against-wavepath-clients
|
||||
plan: 11
|
||||
type: execute
|
||||
wave: 7
|
||||
depends_on: [31-01, 31-02, 31-04, 31-05, 31-07, 31-08, 31-09, 31-10]
|
||||
files_modified:
|
||||
- modules/tide/
|
||||
- cmd/summer/parity_test.go
|
||||
- ../sm-wavepath-app/plugins/golem15/wavepath/
|
||||
- ../sm-wavepath-app/parity/
|
||||
- ../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: 260000
|
||||
raw_tokens: 260000
|
||||
tasks: 3
|
||||
confidence: low
|
||||
scope_exception: "This closing unit-and-gate plan intentionally groups test matrices across the phase; splitting it would violate the project rule that the last plan owns unit coverage and the closing gate."
|
||||
must_haves:
|
||||
truths:
|
||||
- "Unit tests last: tide, app foundation, parity/gate and folded-todo regression matrices is delivered against the frozen PHP corpus and locked decisions."
|
||||
- "Verification fails closed: missing, skipped, pending or mismatching evidence is not counted as a pass."
|
||||
- "D-16 remains intact: messaging, satellites, Range support, guest/bot/webhook host services, zero total pending and final security review stay in Phases 31.1/31.2."
|
||||
- "The final gate reports recorded 196/196, ported 36, pending 160 and foundation-pending 0."
|
||||
artifacts:
|
||||
- path: "modules/tide/"
|
||||
provides: "Unit tests last: tide, app foundation, parity/gate and folded-todo regression matrices"
|
||||
key_links:
|
||||
- from: "modules/tide/"
|
||||
to: "the plan's automated verification"
|
||||
via: "the named tracer and fail-closed checks"
|
||||
---
|
||||
|
||||
## Phase Goal
|
||||
|
||||
WavePath's complete 196-route PHP community corpus is recorded and self-replays green; Phase 31 ports and proves only the 36-route foundation slice, leaving exactly 160 routes pending for Phases 31.1 and 31.2 per D-16.
|
||||
|
||||
<objective>
|
||||
Unit tests last: tide, app foundation, parity/gate and folded-todo regression matrices.
|
||||
|
||||
Purpose: preserve the frozen client/PHP contract while keeping this executor slice cohesive and within the authorized hybrid re-slice.
|
||||
Output: the artifacts and machine evidence named below.
|
||||
</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
|
||||
</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-05-SUMMARY.md fixture/sidecar counts, 31-07-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 and 31-02-SUMMARY.md final tide APIs, every tide smoke test and adjacent existing unit tests, cmd/summer/parity_test.go, 31-06-SUMMARY.md and 31-07-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-08-SUMMARY.md, 31-09-SUMMARY.md and 31-10-SUMMARY.md final flow/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 |
|
||||
|----------|-------------|
|
||||
| recorded PHP/client contract to committed artifacts | live identities, responses and side effects become replay expectations |
|
||||
| untrusted request to Go/plugin behavior | authentication, authorization, validation and rate limits must match safely |
|
||||
| automated evidence to completion verdict | missing or skipped work must not look green |
|
||||
|
||||
## 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 | no package install; use existing dependencies and explicit lockfiles |
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
Run every task's automated command and preserve its fails_when semantics. Do not use Phase 31.1/31.2 work to make this plan green.
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
Unit tests last: tide, app foundation, parity/gate and folded-todo regression matrices is complete, its named tests ran, and no locked decision or D-16 phase boundary drifted.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
Create `.planning/phases/31-chat-polish-against-wavepath-clients/31-11-SUMMARY.md` with commits, final identifiers, verification evidence, deviations, and remaining D-16 pending work.
|
||||
</output>
|
||||
@@ -928,19 +928,19 @@ Dependencies between areas: A before C (recording needs T-1, T-2, T-6, T-7, T-10
|
||||
| A13 | Denial statuses in the example manifest (401, 404) | Code Examples | None; the recording defines them |
|
||||
| A14 | `GroupService` in PHP userfriends has `attachImage` and custom invite codes live on `GroupInvite` | Gap map | The gap sits in the app plugin instead of sm-userfriends-plugin |
|
||||
|
||||
## Open Questions
|
||||
## Open Questions (RESOLVED)
|
||||
|
||||
1. **Split into 31, 31.1, 31.2?** Known: 12 to 15 large plans. Unclear: whether the user wants D-15's zero-pending gate on one phase. Recommendation: propose the split at the plan-count checkpoint.
|
||||
2. **`wavepath-mcp` has no route in the corpus.** Success criterion 1 names it as a recording client. Recommendation: correct the criterion to two clients in the first planning commit, or widen D-09 to the `/api/v1` token routes (that pulls diary, practices, trainings and stats into scope, which the boundary excludes).
|
||||
3. **Shared notes need the diary.** D-09 includes `community/notes` (16 routes); the boundary excludes the diary. Recommendation: a minimal `DiaryEntry` read model and fixture rows in the app plugin, flagged as provisional for WavePath's agent; or drop `notes` from the corpus. Needs the user.
|
||||
4. **The 17 uncalled routes.** Keep with hand-written cases, or drop from the corpus? Recommendation: keep `/hooks/{token}` and `webhook-icon` (real traffic, just not from the three clients); ask about the five compatibility note routes and the nine unused channel and forum routes.
|
||||
5. **Which database for the PHP stack.** Recommendation: an isolated MariaDB container. D-08 allows the dev database; confirm the user prefers isolation.
|
||||
6. **Checking out `chat` and `journal` at their pins** changes the other agent's working tree. Recommendation: do it with a printed notice, or use a worktree under the parity root. Needs the user or the other agent.
|
||||
7. **Search backend for recording.** Typesense on both sides, or the null driver?
|
||||
8. **Slash behaviour.** WavePath refuses unknown slash text; the todo wants it postable. Recommendation: catalog check plus a `//` escape. Needs the user.
|
||||
9. **Attachment `url`** (absolute legacy path in PHP). App-side rewrite or shared serializer change? Recommendation: app-side; confirm when the first fixture shows the real value.
|
||||
10. **Where does login come from on replay?** `/_wave/api/v1/auth/login` is outside the corpus. Recommendation: both seeders mint the session JWTs into the vars store, and requests carry `Cookie: token={{jwt:…}}`. This needs the same `JWT_SECRET` and claim shape on both sides, which the user plugin port already matched (Phase 7).
|
||||
11. **Remote for `sm-wavepath-app`.** Creating it and pushing need the user's go-ahead; the plan should stop at a checkpoint there.
|
||||
1. **(RESOLVED — D-16) Split into 31, 31.1, 31.2?** Yes. Phase 31 records all 196 routes and ports only the 36-route foundation. Phase 31.1 ports messaging and Range support; Phase 31.2 ports satellites and closes at zero total pending.
|
||||
2. **(RESOLVED — D-17) `wavepath-mcp` has no route in the corpus.** Record only `vue-wavepath-app` and `hubot-wavepath`; the D-09 corpus boundary stays unchanged.
|
||||
3. **(RESOLVED — D-18) Shared notes need the diary.** Keep the routes and scenario rows; Phase 31.2 adds the minimal provisional `DiaryEntry` read model.
|
||||
4. **(RESOLVED — D-19) The 17 uncalled routes.** Keep all 17 with hand-written success, denial and validation cases.
|
||||
5. **(RESOLVED — D-20) Which database for the PHP stack.** Use an isolated MariaDB container.
|
||||
6. **(RESOLVED — D-20) Checking out `chat` and `journal` at their pins.** Export or use a parity-root worktree without changing the source checkout; the plans choose read-only export.
|
||||
7. **(RESOLVED — D-16) Search backend for recording.** Recording stays in Phase 31; the Go search backend choice is deferred to Phase 31.2 discussion.
|
||||
8. **(RESOLVED — D-22) Slash behaviour.** Validate the first token against the loaded command catalog, retain unknown-command drafts, and use `//` as the explicit text escape.
|
||||
9. **(RESOLVED — D-16) Attachment `url`.** The implementation choice is deferred to Phase 31.1, where attachment parity is ported; research recommends an app-side rewrite.
|
||||
10. **(RESOLVED — D-21) Where login comes from on replay.** Both seeders mint session JWTs into the vars store and requests carry the `token` cookie; login routes remain outside the corpus.
|
||||
11. **(RESOLVED — D-02) Remote for `sm-wavepath-app`.** Build locally, then stop at a blocking decision checkpoint before creating a remote or pushing.
|
||||
|
||||
## Environment Availability
|
||||
|
||||
@@ -962,7 +962,7 @@ See "PHP stack from outside the checkout" for the table. Summary: PHP 8.5.11, Co
|
||||
| SC-1 | Every corpus route is recorded from PHP | corpus check | `go run ./parity/check_corpus.go --manifest parity/manifest.yaml --routes <routes.php> --require-recorded --check-secrets` | no, Wave 0 |
|
||||
| SC-1 | PHP self-replay is green | manual-run script (needs the PHP stack) | `summer parity:replay --manifest … --self-check true` | no, Wave 0 |
|
||||
| SC-1 | Go replays every ported route; pending never passes | integration | `go test ./parity -run TestParityCorpus` | no, Wave 0 |
|
||||
| SC-1 | Zero pending at close | gate | `scripts/check-parity.sh` | no, Wave 0 |
|
||||
| SC-1 | Foundation pending is zero at Phase 31 close; 160 routes remain pending for 31.1/31.2 (D-16) | gate | `scripts/check-parity.sh` | no, Wave 0 |
|
||||
| SC-2 | Publications of each writing case match the golden | integration | `go test ./parity -run TestBroadcasts` | no, Wave 0 |
|
||||
| SC-2 | Channel authorization routes replay | integration | `go test ./parity -run 'TestParityCorpus/.*realtime'` | no, Wave 0 |
|
||||
| D-11 | Vendor calls match the sidecars | integration | `go test ./parity -run TestUpstreamSidecarsAreReplayed` | no, Wave 0 |
|
||||
@@ -970,8 +970,7 @@ See "PHP stack from outside the checkout" for the table. Summary: PHP 8.5.11, Co
|
||||
| SC-3 | demo builds and passes | integration | `cd ../sm-demo-app && go test ./...` | yes |
|
||||
| SC-3 | Framework docs name no application | docs check | `summer docs:build --check`; `go test ./cmd/summer -run TestDocsTree` | yes |
|
||||
| SC-4 | tide additions | unit | `go test ./modules/tide/...` | yes (extend) |
|
||||
| SC-4 | App plugin host services | unit | `go test -short ./plugins/golem15/wavepath/...` | no, Wave 0 |
|
||||
| D-12 | Attachment Range, 206 and 416 | unit and parity | `go test -short ./... -run TestAttachmentRange` in sm-chat-plugin | no, Wave 0 |
|
||||
| SC-4 | Foundation app-plugin services only: envelope, actor, buckets, contexts, resolvers, authorizers, realtime, groups/members/invites/join/friends/lifecycle | unit | `go test -short ./plugins/golem15/wavepath/...` | no, Wave 0 |
|
||||
| Todo | OIDC parity | integration | `PHASE194_REQUIRE_PARITY=1 go test -count=1 -run '^(TestPHPParityReplay|TestIDTokenShapeParity)$' ./...` in sm-oauthserver-plugin | yes (skips today) |
|
||||
| Todo | Moderation seams fire and reject | unit | `go test -short ./...` in user, userfriends, chat; `go test ./... -run TestModeration` in sm-demo-app | partly |
|
||||
| Todo | Slash handling in the layer | unit | the layer's Vitest suite | to check |
|
||||
|
||||
@@ -45,7 +45,7 @@ Task IDs are filled in by the planner. The rows below are the behaviours every p
|
||||
|---------|------|------|-------------|------------|-----------------|-----------|-------------------|-------------|--------|
|
||||
| TBD | TBD | TBD | SC-1 every corpus route recorded from PHP | — | fixtures carry no secrets (`--check-secrets`) | corpus check | `go run ./parity/check_corpus.go --manifest parity/manifest.yaml --routes <routes.php> --require-recorded --check-secrets` | ❌ W0 | ⬜ pending |
|
||||
| TBD | TBD | TBD | SC-1 Go replays every ported route; pending never passes | — | denial cases (401, 403, 404) replay | integration | `go test ./parity -run TestParityCorpus` | ❌ W0 | ⬜ pending |
|
||||
| TBD | TBD | TBD | SC-1 zero pending at close (D-15) | — | fail-closed gate | gate | `scripts/check-parity.sh` | ❌ W0 | ⬜ pending |
|
||||
| 31-07-T2 | 31-07 | 6 | SC-1 foundation-pending 0 with 160 routes explicitly pending for Phases 31.1/31.2 (D-16) | T-31-24 | fail-closed foundation gate | gate | `scripts/check-parity.sh` | ❌ W0 | ⬜ pending |
|
||||
| TBD | TBD | TBD | SC-2 publications of each writing case match the golden (D-10) | — | no publication reaches a non-member channel | integration | `go test ./parity -run TestBroadcasts` | ❌ W0 | ⬜ pending |
|
||||
| TBD | TBD | TBD | SC-2 channel authorization routes replay | — | subscribe proxy and `realtime/token` deny non-members | integration | `go test ./parity -run 'TestParityCorpus/.*realtime'` | ❌ W0 | ⬜ pending |
|
||||
| TBD | TBD | TBD | D-11 vendor calls match the sidecars | — | N/A | integration | `go test ./parity -run TestUpstreamSidecarsAreReplayed` | ❌ W0 | ⬜ pending |
|
||||
@@ -53,8 +53,7 @@ Task IDs are filled in by the planner. The rows below are the behaviours every p
|
||||
| TBD | TBD | TBD | SC-3 `sm-demo-app` builds and passes | — | N/A | integration | `cd ../sm-demo-app && go test ./...` | ✅ | ⬜ pending |
|
||||
| TBD | TBD | TBD | SC-3 framework docs name no application | — | N/A | docs check | `summer docs:build --check` and `go test ./cmd/summer -run TestDocsTree` | ✅ | ⬜ pending |
|
||||
| TBD | TBD | TBD | SC-4 tide additions | — | N/A | unit | `go test ./modules/tide/...` | ✅ (extend) | ⬜ pending |
|
||||
| TBD | TBD | TBD | SC-4 app plugin host services | — | guest, bot and token auth, webhook, access resolvers | unit | `go test -short ./plugins/golem15/wavepath/...` | ❌ W0 | ⬜ pending |
|
||||
| TBD | TBD | TBD | D-12 attachment Range, 206 and 416 | — | N/A | unit and parity | `go test -short ./... -run TestAttachmentRange` in `sm-chat-plugin` | ❌ W0 | ⬜ pending |
|
||||
| 31-11-T2 | 31-11 | 7 | SC-4 foundation app-plugin services | T-31-20, T-31-21, T-31-22, T-31-24 | envelope, cookie actor, buckets, contexts, resolvers, authorizers, realtime, groups/members/invites/join/friends/lifecycle | unit | `go test -short ./plugins/golem15/wavepath/...` | ❌ W0 | ⬜ pending |
|
||||
| TBD | TBD | TBD | Todo: OIDC parity | — | N/A | integration | `PHASE194_REQUIRE_PARITY=1 go test -count=1 -run '^(TestPHPParityReplay\|TestIDTokenShapeParity)$' ./...` in `sm-oauthserver-plugin` | ✅ (skips today) | ⬜ pending |
|
||||
| TBD | TBD | TBD | Todo: moderation seams fire and reject | — | with no listener, behaviour is unchanged | unit | `go test -short ./...` in user, userfriends, chat; `go test ./... -run TestModeration` in `sm-demo-app` | partly | ⬜ pending |
|
||||
| TBD | TBD | TBD | Todo: slash handling in the layer | — | N/A | unit | the layer's Vitest suite (`pnpm --dir ../vue-chat-layer test`) | ✅ (extend) | ⬜ pending |
|
||||
@@ -81,7 +80,7 @@ Task IDs are filled in by the planner. The rows below are the behaviours every p
|
||||
|----------|-------------|------------|-------------------|
|
||||
| PHP self-replay is green | SC-1 | needs the local PHP stack running; not part of `go test` | bring the stack up with `scripts/parity-stack.sh`, then `summer parity:replay --manifest parity/manifest.yaml --self-check true` |
|
||||
| Proxy sessions of the real clients | D-07 | done once by a person driving the clients through `summer parity:proxy` | follow the recording runbook in `sm-wavepath-app/parity/README.md` |
|
||||
| Accepted-differences sign-off | D-13 | each entry needs the user's signature | review the accepted-differences file before the gate is run |
|
||||
| Accepted-differences review for foundation entries | D-13, D-16 | each Phase 31 entry needs the user's signature; final corpus sign-off is Phase 31.2 | review foundation entries before the Phase 31 gate; do not require 31.1/31.2 entries yet |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user