Skip to content

refactor(slack): derive event contracts from upstream types - #150406

Merged
RomneyDa merged 1 commit into
mainfrom
type-improver/b17-slack-event-contract-owner
Sep 17, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
type-improver/b17-slack-event-contract-owner

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Slack ingress event DTOs manually copied Bolt event shapes and erased subtype ownership, while persisted relay messages crossed an unknown boundary through assertions.

User Impact

User impact: no intended user-visible change; Slack event contracts now track @slack/types, and malformed persisted relay messages fail closed before dispatch.

Why This Change Was Made

Project permissive runtime DTOs from upstream event types, retain OpenClaw-only compatibility fields explicitly, and validate message identity at relay persistence boundaries.

Evidence

  • node scripts/check-changed.mjs
  • Focused Slack event and relay suites
  • Regression sensitivity: with decoder validation temporarily removed, the same-lane malformed-row test fails by dispatching both malformed and valid messages; restored validation passes all 3 relay tests
  • Autoreview P0–P2: no actionable findings

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@RomneyDa
RomneyDa marked this pull request as ready for review September 17, 2026 00:28
@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: M maintainer Maintainer-authored PR labels Sep 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 10:29 PM ET / September 17, 2026, 02:29 UTC (Revision 4).

ClawSweeper review

What this changes

Derives Slack event contracts from upstream types, validates persisted relay messages before dispatch, and reorganizes relay regression coverage.

Merge readiness

✅ Ready for maintainer review

Keep open: the refactor remains useful and is absent from current main. Both earlier relay findings are resolved, and no blocking introduced defect was found. The member-authored PR is also protected from automated closure.

Priority: P2
Reviewed head: f2873d1a4b1b8b0c33ea65877a82210b25d5852c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable refactor with resolved prior findings, relevant regression coverage, and no blocking defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The member-authored internal refactor is exempt from the external-contributor proof gate; the supplied queue regression supports malformed-row handling, and no material authority change triggers additional proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored internal refactor is exempt from the external-contributor proof gate; the supplied queue regression supports malformed-row handling, and no material authority change triggers additional proof.
Evidence reviewed 8 items Pinned scope and current status: The supplied complete merge-base delta identifies nine introduced paths; the verified test merge preserves base-only work. A live GitHub read confirms the PR remains open and unmerged at the reviewed head.
Current main and release still use copied contracts: Inspected current-main and v2026.9.4 Slack types: both retain handwritten event shapes. Current-main relay decoding checks only whether the payload is a record, so the proposed message-shape validation remains distinct.
Prior findings resolved at the queue boundary: Relay decoding now throws SlackIngressPayloadError for invalid message shapes, which the existing classifier treats as non-retryable. The new regression places malformed and valid rows in the same conversation lane and asserts only the valid message dispatches, with no pending rows. The body reports regression sensitivity; tests were not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

The Slack plugin accepts messages from a trusted relay and stores them in a durable queue before acknowledgement. Queue replay validates each message before passing it to the normal Slack message handler.

flowchart LR
  A[Trusted Slack relay] --> B[Validate message shape]
  B --> C[Durable ingress queue]
  C --> D[Validate replayed message]
  D -->|Valid| E[Slack message handler]
  D -->|Malformed| F[Record terminal failure]
  F --> G[Continue conversation lane]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -52, Tests +64, Other 0. Total +12 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 97 149 -52
Tests 3 144 80 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 4 0
Total 9 245 233 +12

Review metrics

None.

Technical review

Best possible solution:

Keep upstream-derived contracts private to Slack and reuse the existing relay admission predicate during replay, preserving valid queued messages and terminally rejecting malformed rows.

Do we have a high-confidence way to reproduce the issue?

Not applicable to the primary type refactor; malformed replay has a focused same-lane regression and reported before/after sensitivity, but this review did not execute tests.

Is this the best way to solve the issue?

Yes. Upstream-derived private types remove copied declarations, while replay validation reuses the existing transport predicate without changing valid payload formats.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9ce12dfa6125.

Labels

Label justifications:

  • P2: This is a bounded Slack contract improvement with a concrete malformed-replay safeguard and no established urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored internal refactor is exempt from the external-contributor proof gate; the supplied queue regression supports malformed-row handling, and no material authority change triggers additional proof.

Evidence

What I checked:

  • Pinned scope and current status: The supplied complete merge-base delta identifies nine introduced paths; the verified test merge preserves base-only work. A live GitHub read confirms the PR remains open and unmerged at the reviewed head. (f2873d1a4b1b)
  • Current main and release still use copied contracts: Inspected current-main and v2026.9.4 Slack types: both retain handwritten event shapes. Current-main relay decoding checks only whether the payload is a record, so the proposed message-shape validation remains distinct. (extensions/slack/src/types.ts:1, 9ce12dfa6125)
  • Prior findings resolved at the queue boundary: Relay decoding now throws SlackIngressPayloadError for invalid message shapes, which the existing classifier treats as non-retryable. The new regression places malformed and valid rows in the same conversation lane and asserts only the valid message dispatches, with no pending rows. The body reports regression sensitivity; tests were not executed during this read-only review. (extensions/slack/src/monitor/ingress.relay.test.ts:109, f2873d1a4b1b)
  • Dependency boundary and compatibility: The changed contracts directly import @slack/types; the Slack package already pins version 3.1.0. The parser preserves the existing relay admission predicate: message type plus string channel. Private event types are not promoted through the plugin's public barrels, and queue version, serialized shape, routing, and authorization remain unchanged. (extensions/slack/src/types.ts:2, f2873d1a4b1b)
  • Published upstream declarations inspected: npm metadata identifies slackapi/node-slack-sdk as the source repository and records gitHead c663dc06c362cffbb11773cc85228eb4f943630c for @slack/types 3.1.0. Read the published message, attachment, reaction, member, app, channel, and pin declarations directly from the tarball without installing or executing them; the projected fields match these contracts. (c663dc06c362)
  • Baseline reconciliation does not introduce extra allowance: The two non-Slack baseline increases match four and thirteen assertions already present in the unchanged base sources. The ratchet's allowanceWithExistingBaseCounts explicitly recognizes existing base counts; these changes do not authorize additional assertions beyond that allowance. (scripts/check-assertion-safety-ratchet.mts:221, f2873d1a4b1b)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-17T00:34:29.072Z sha f32849e0cd97c8bb88d92d8c3c83a67598309db0 :: blocked before merge. :: [P2] [P2] Classify malformed relay messages as non-retryable
  • reviewed 2026-09-17T01:03:58.863Z sha f660a4bacc2f29c9516dcd431b24c00dac0d4a6f :: needs changes before merge. :: [P2] [P2] Keep the malformed fixture in the claimed conversation lane
  • reviewed 2026-09-17T01:29:10.072Z sha d43117a32946ce31926c8f4197cece8651949759 :: needs maintainer review before merge. :: none

@RomneyDa
RomneyDa force-pushed the type-improver/b17-slack-event-contract-owner branch from f32849e to f660a4b Compare September 17, 2026 00:56
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label Sep 17, 2026
@RomneyDa
RomneyDa force-pushed the type-improver/b17-slack-event-contract-owner branch 2 times, most recently from e442b46 to d43117a Compare September 17, 2026 01:21
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 17, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member

Coordination for required CI repair in #150026: exact CI run35170756418 reports a Madge cycle between monitor/ingress.ts and monitor/thread-resolution.ts after merged #150457 imports the transient-error classifier. The return edge is only the SlackIngressTurnLifecycle type. I am moving that unchanged private lifecycle type to a small leaf module and updating its four consumers; no event-contract changes from this PR and no gate suppression. This touches the import/type-definition area of ingress.ts; the event-contract changes here remain independent. No active cycle-fix PR was found.

@RomneyDa
RomneyDa force-pushed the type-improver/b17-slack-event-contract-owner branch from d43117a to f2873d1 Compare September 17, 2026 02:20
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@RomneyDa
RomneyDa merged commit fd8543b into main Sep 17, 2026
89 checks passed
@RomneyDa
RomneyDa deleted the type-improver/b17-slack-event-contract-owner branch September 17, 2026 05:27
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants