Skip to content

refactor(mattermost): deduplicate draft streaming tests - #118215

Merged
steipete merged 1 commit into
mainfrom
codex/wave20-mattermost-draft-stream-cleanup
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/wave20-mattermost-draft-stream-cleanup

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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.

@openclaw-barnacle openclaw-barnacle Bot added channel: mattermost Channel integration: mattermost size: M maintainer Maintainer-authored PR labels Aug 2, 2026
@steipete
steipete marked this pull request as ready for review August 2, 2026 21:44
@steipete steipete self-assigned this Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 5:50 PM ET / 21:50 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 3 items remain

This 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
Reviewed head: 6aa37c8eb8254b72ad40ba4239ce82e46bd53fc3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving test refactor with no actionable correctness or security finding from source review.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-requested test-only cleanup does not change a live user path; the relevant proof is preservation of the focused regression suites and exact-head CI.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-requested test-only cleanup does not change a live user path; the relevant proof is preservation of the focused regression suites and exact-head CI.
Evidence reviewed 6 items Current-main surface unchanged: The advertised current-main commit is available locally, and its range from the PR base has no changes to either affected test file; the refactor remains applicable to the current test surface.
Test matrix preserved: Both suites retain identical ordered test-case names, while assertion totals remain 102 before/after for draft streaming and 69 before/after for draft delivery.
Narrow fixture boundary: The typed draft fixture fixes common client, channel, and throttle setup while allowing per-scenario overrides; the delivery fixture centralizes only shared receipt and parameter construction.
Findings None None.
Security None None.

How this fits together

Mattermost 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
Loading

Before merge

  • Add real behavior proof - Not applicable: This maintainer-requested test-only cleanup does not change a live user path; the relevant proof is preservation of the focused regression suites and exact-head CI.
  • Resolve merge risk (P1) - Several repository checks in the supplied PR state are still in progress. Merge should wait for the exact head's required checks and GitHub mergeability rather than rely only on validation claims in the PR body.
  • Complete next step (P2) - No repair is indicated; wait for normal exact-head CI and mergeability gates on this protected maintainer PR.
Agent review details

Security

None.

PR surface

Tests -261. Total -261 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 107 368 -261
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 107 368 -261

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a two-file, test-only cleanup with no production-code or user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is a two-file, test-only cleanup with no production-code or user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

Likely related people:

  • steipete: Recent function-history, blame, and aggregate file history identify Peter Steinberger as the primary contributor to the affected Mattermost draft-preview test surfaces. (role: recent area contributor; confidence: high; commits: 05ab51810949, 6aa37c8eb825; files: extensions/mattermost/src/mattermost/draft-stream.test.ts, extensions/mattermost/src/mattermost/monitor-draft-delivery.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 761c3e3 into main Aug 2, 2026
148 of 150 checks passed
@steipete
steipete deleted the codex/wave20-mattermost-draft-stream-cleanup branch August 2, 2026 22:01
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: mattermost Channel integration: mattermost maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant