test(channels): delivery trace harness with feishu and mattermost goldens#104478
Conversation
|
Codex review: needs changes before merge. Reviewed July 11, 2026, 9:40 AM ET / 13:40 UTC. Summary PR surface: Source +425, Tests +703. Total +1128 across 12 files. Reproducibility: not applicable. This PR adds deterministic test infrastructure rather than reporting a current-main runtime bug. The adapter defect is directly source-verifiable by comparing the proposed mapping with production Mattermost callback ordering. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review findings
Review detailsBest possible solution: Represent assistant-message-start as pending state in the Mattermost trace adapter, rotate the preview generation when the next visible activity arrives, and regenerate the affected golden. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR adds deterministic test infrastructure rather than reporting a current-main runtime bug. The adapter defect is directly source-verifiable by comparing the proposed mapping with production Mattermost callback ordering. Is this the best way to solve the issue? No in its current Mattermost mapping: the generic harness and test-only SDK seam are appropriate, but the adapter must preserve production lifecycle ordering before its goldens can serve as an engine oracle. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 325679a33574. Label changesLabel justifications:
Evidence reviewedPR surface: Source +425, Tests +703. Total +1128 across 12 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (2 earlier review cycles)
|
6bd64a2 to
593cea6
Compare
|
Merged via squash.
|
Related: #104318
What Problem This Solves
The channel refactor program needs a conformance oracle: today, each channel's delivery behavior (streaming edits, card entity lifecycles, cancellation, rate-limit recovery, pagination) lives only as code inside deliver callbacks. There is no replayable record of what wire calls a channel makes for a given reply turn — which is exactly what the planned core delivery engines must reproduce before any channel migrates onto them.
Why This Change Was Made
Adds a small deterministic trace harness (
src/channels/plugins/contracts/trace/delivery-trace.ts, 310 LOC, exported through the existingchannel-contract-testingtest subpath): scenario scripts drive a channel's real dispatcher wiring with mocked wire clients under fake timers; ordered in/out events are recorded as committed JSONL goldens; verify mode (default) replays and asserts byte-stable equality;OPENCLAW_TRACE_UPDATE=1re-records. First two adoptions prove the pattern at both extremes: feishu (5 scenarios — full CardKit entity lifecycle, 429'd preview recovery, overflow pagination, cancel discarding the card) and mattermost (3 scenarios — edit-in-place drafts, boundary rotation, stop-flush cancel). Goldens deliberately pin two current-behavior warts as Phase-4 oracles (feishu cross-block snapshot glue without separator; cancel closes the card with partial content). No prod surface; extension tests drive everything (no core→extension imports). Credential/token values never appear in goldens.User Impact
None at runtime — test infrastructure. For maintainers: channel delivery behavior is now pinned and replayable; the planned core engines get an executable acceptance spec.
Evidence
tbx_01kx8hw49gvym563sk9b54r321(record + verify green twice), re-proven post-rebase ontbx_01kx8k1q3spdwp6977bz5hxm2y.pnpm check:changed.Note for reviewers:
pnpm test src/channels/plugins/contractsis a no-op in test-projects (dir excluded); the contracts lanes run viatest:contracts:channels.