Skip to content

feat(slack): centralize Block Kit input validation#18284

Closed
Solvely-Colin wants to merge 1 commit into
openclaw:mainfrom
Solvely-Colin:codex/slack-blocks-input-validation
Closed

feat(slack): centralize Block Kit input validation#18284
Solvely-Colin wants to merge 1 commit into
openclaw:mainfrom
Solvely-Colin:codex/slack-blocks-input-validation

Conversation

@Solvely-Colin

@Solvely-Colin Solvely-Colin commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Why

Block Kit input parsing/validation is currently duplicated across tool and plugin paths. A shared validator keeps behavior consistent and prevents malformed/empty block payloads from reaching Slack APIs.

Dependency

What This PR Adds

  • New shared parser/validator:
    • /Users/solvely/Projects/OpenClaw/src/slack/blocks-input.ts
  • New unit tests:
    • /Users/solvely/Projects/OpenClaw/src/slack/blocks-input.test.ts

Validation rules now centralized:

  • blocks JSON must parse
  • blocks must be an array
  • blocks must be non-empty
  • max 50 blocks
  • each block must be an object with non-empty string type

Integrations updated to use the shared parser:

  • /Users/solvely/Projects/OpenClaw/src/agents/tools/slack-actions.ts
  • /Users/solvely/Projects/OpenClaw/src/plugin-sdk/slack-message-actions.ts

Additional regression coverage:

  • /Users/solvely/Projects/OpenClaw/src/agents/tools/slack-actions.e2e.test.ts
  • /Users/solvely/Projects/OpenClaw/src/channels/plugins/actions/actions.test.ts

Behavior

  • Keeps existing valid block behavior.
  • Fails earlier and consistently for malformed/empty blocks.

Validation

  • pnpm test src/slack/blocks-input.test.ts src/channels/plugins/actions/actions.test.ts
  • pnpm exec vitest run --config vitest.e2e.config.ts src/agents/tools/slack-actions.e2e.test.ts
  • pnpm check

Reviewer Focus

  • src/slack/blocks-input.ts
  • src/slack/blocks-input.test.ts
  • src/agents/tools/slack-actions.ts
  • src/plugin-sdk/slack-message-actions.ts

Greptile Summary

This PR fixes a JavaScript this-binding bug in src/slack/monitor/events/interactions.ts. The previous code destructured the viewClosed method from the app object into a standalone variable, which lost the this context when invoked. The fix keeps the method on its parent object (appWithViewClosed.viewClosed(...) instead of the bare viewClosed(...) call), ensuring proper this binding at call time.

  • Bug fix: viewClosed is now invoked as a method on appWithViewClosed rather than as a detached function, preserving method binding
  • The PR description references broader Block Kit validation changes, but those live in dependency PRs — this commit only contains the viewClosed binding fix

Confidence Score: 5/5

  • This PR is safe to merge — it's a small, targeted fix that preserves method binding semantics.
  • The change is a 2-line behavioral fix (keeping method on its object instead of destructuring it) with no new logic, no new dependencies, and no risk of regression. The pattern matches how other methods (action, view) are already called in the same file.
  • No files require special attention.

Last reviewed commit: ca522b1

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack agents Agent runtime and tooling size: XL labels Feb 16, 2026
@Solvely-Colin
Solvely-Colin force-pushed the codex/slack-blocks-input-validation branch from 3986c59 to eaf2ee6 Compare February 16, 2026 23:03
@steipete steipete closed this Feb 16, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed agents Agent runtime and tooling size: XL labels Feb 16, 2026
@steipete steipete reopened this Feb 17, 2026
@Solvely-Colin
Solvely-Colin force-pushed the codex/slack-blocks-input-validation branch from eaf2ee6 to ca522b1 Compare February 17, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants