Skip to content

refactor(slack): centralize modal private_metadata utilities#18409

Closed
Solvely-Colin wants to merge 1 commit into
openclaw:mainfrom
Solvely-Colin:codex/slack-modal-metadata-utils
Closed

refactor(slack): centralize modal private_metadata utilities#18409
Solvely-Colin wants to merge 1 commit into
openclaw:mainfrom
Solvely-Colin:codex/slack-modal-metadata-utils

Conversation

@Solvely-Colin

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

Copy link
Copy Markdown
Contributor

Why

Modal private_metadata parsing is currently embedded in interaction handler logic. A shared utility makes routing metadata consistent and gives us an explicit producer-facing encoder for future modal-open flows.

Dependency

What This PR Adds

  • New utility module:

    • /Users/solvely/Projects/OpenClaw/src/slack/modal-metadata.ts
    • parseSlackModalPrivateMetadata(raw)
    • encodeSlackModalPrivateMetadata(input)
  • Utility behavior:

    • parse: safe JSON parse with known fields (sessionKey, channelId, channelType)
    • encode: normalized payload and Slack size guard (private_metadata <= 3000 chars)
  • Interaction handler wiring:

    • /Users/solvely/Projects/OpenClaw/src/slack/monitor/events/interactions.ts now uses shared parse utility.
  • Tests:

    • /Users/solvely/Projects/OpenClaw/src/slack/modal-metadata.test.ts
    • existing interactions tests still pass.

Behavior

  • No behavioral regression intended; parsing logic is centralized.
  • Adds reusable encoder for upcoming modal-open helper work.

Validation

  • pnpm test src/slack/modal-metadata.test.ts src/slack/monitor/events/interactions.test.ts
  • pnpm check

Reviewer Focus

  • src/slack/modal-metadata.ts
  • src/slack/modal-metadata.test.ts
  • src/slack/monitor/events/interactions.ts

Greptile Summary

This PR preserves the method binding for viewClosed in the Slack interaction handler. The change extracts the typed app object reference instead of just the method, ensuring the correct this context is maintained when calling viewClosed. This prevents potential runtime errors from losing the method's binding to its parent object.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a small, focused refactor that fixes a method binding issue. It's well-tested (existing tests cover viewClosed functionality), follows established patterns, and has no side effects on other code paths.
  • No files require special attention

Last reviewed commit: 86996a3

@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-modal-metadata-utils branch from f7aafce 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-modal-metadata-utils branch from eaf2ee6 to 86996a3 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