Repository navigation
refactor(mattermost): deduplicate draft streaming tests - #118215
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 5:50 PM ET / 21:50 UTC. ClawSweeper reviewWhat this changesThe branch replaces repeated setup in two Mattermost draft-preview test suites with typed, file-local stream, receipt, and delivery fixtures while leaving production code unchanged. Merge readinessThis is a sound, focused Mattermost test refactor with no actionable correctness or security finding. Keep it open for its protected maintainer review path and merge only after the exact head is green and GitHub reports it mergeable. Priority: P3 Review scores
Verification
How this fits togetherMattermost draft streaming turns incremental model output into preview posts, then final delivery either finalizes that preview or sends a normal reply and returns a durable receipt. The two edited suites cover these adjacent paths through isolated mocked clients and streams. flowchart LR
A[Incremental model output] --> B[Mattermost draft stream]
B --> C[Preview post API calls]
C --> D[Final delivery decision]
D --> E[Message receipt]
F[Test fixture builders] --> B
F --> D
Before merge
Agent review detailsSecurityNone. PR surfaceTests -261. Total -261 across 2 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the full existing Mattermost draft-preview regression matrix while keeping repeated mock construction in these file-local typed fixtures, then land after exact-head CI and mergeability complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors regression tests rather than reporting a runtime defect. Source comparison confirms the test-case matrix and assertion count are preserved. Is this the best way to solve the issue? Yes. File-local typed builders reduce repeated setup without adding a production abstraction, and the test-specific overrides retain the distinct timing, request, receipt, and thread scenarios. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 30cb41fe52cb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves\n\nMaintainer-requested cleanup: Mattermost draft-preview regression suites repeatedly construct equivalent clients, draft streams, delivery arguments, and provider receipts, making their delivery and sequencing contracts harder to maintain.\n\n## Why This Change Was Made\n\nUse file-local typed fixtures and receipt builders with explicit scenario overrides. Each test still owns its client, request history, stream, thread-root choice, throttle, receipt ordering, and async lifecycle; only the two reserved Mattermost tests change.\n\n## User Impact\n\nNo production or user-visible behavior changes. Developers retain all 48 original scenarios and all 171 assertions with 261 fewer test lines.\n\n## Evidence\n\n- Exact patch: 107 additions, 368 deletions, 261 net test lines removed; production delta zero.\n- Focused: pnpm test extensions/mattermost/src/mattermost/draft-stream.test.ts extensions/mattermost/src/mattermost/monitor-draft-delivery.test.ts — 2 files, 48/48 passed.\n- Full Mattermost plugin: pnpm test extensions/mattermost — 51 files, 742/742 passed, including adjacent client, ingress, delivery-trace, slash, and monitor coverage.\n- Changed gate: pnpm check:changed — formatting, plugin boundaries, dead exports, extension test types, and lint passed; zero lint warnings.\n- Remote proof: Blacksmith Testbox tbx_01kz2660p9fxcyqwtpv8arwexj; https://github.com/openclaw/openclaw/actions/runs/30768056417.\n- Two independent xhigh reviews verified identical ordered case names, 171 assertion chains, async lifecycle calls, provider partial-delivery behavior, thread roots, and receipt aggregation.\n- AI-assisted; independently reviewed and remotely validated.