#14249: slack: add DM policy matrix regressions (open/allowlist/pairing/disabled)
channel: slack
stale
Cluster:
Tool and Plugin Enhancements
## Problem
Fixes #13294. Slack DM policy behavior needs explicit regression coverage to prevent fail-open routing and incorrect pairing behavior across policy modes.
## What Changed
- Added a DM policy matrix helper in Slack monitor tests.
- Added policy-path tests for `open`, `allowlist`, `pairing`, and `disabled`.
- Asserts pairing is only triggered for `pairing` mode and blocked paths do not process replies.
## Validation
- `pnpm vitest run src/slack/monitor.tool-result.forces-thread-replies-replytoid-is-set.test.ts`
- Passed (8 tests)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds regression test coverage for Slack DM policy matrix behavior across all four modes (`open`, `allowlist`, `pairing`, `disabled`). A shared `runDmMessageWithPolicy` helper consolidates DM event setup with an empty `allowFrom` list, and four new test cases verify that each policy mode produces the correct routing outcome — ensuring `open` processes messages regardless of allowlist, `allowlist` and `disabled` block without triggering pairing, and only `pairing` mode invokes the pairing flow.
- Added `runDmMessageWithPolicy` helper that configures DM policy and fires a simulated DM event
- Added 4 regression tests covering each `DmPolicy` variant with correct assertion boundaries
- All test assertions align with the existing enforcement logic in `prepare.ts`
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge — it only adds test code with no production changes.
- The PR adds only regression tests in a single test file. No production code is modified. The test assertions correctly match the existing DM policy enforcement logic in prepare.ts. The helper function is well-structured and the four policy paths are all covered with appropriate expectations.
- No files require special attention.
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#17289: test(line): add DM policy matrix coverage for open/allowlist/pairin...
by davidahmann · 2026-02-15
83.9%
#10643: fix(slack): classify D-prefix DMs correctly when channel_type disag...
by mcaxtr · 2026-02-06
78.2%
#12244: fix(slack): preserve thread context for DM thread replies
by junhoyeo · 2026-02-09
76.7%
#22636: fix(whatsapp): skip pairing store merge when dmPolicy is allowlist (#…
by anillBhoi · 2026-02-21
75.8%
#9520: fix: ignore slack already_reacted
by bolismauro · 2026-02-05
74.9%
#14789: fix: per-account dmPolicy ignored in checkInboundAccessControl
by croll83 · 2026-02-12
74.7%
#19083: Slack: preserve per-thread context and consistent thread replies
by jkimbo · 2026-02-17
73.9%
#20406: fix(slack): respect replyToMode when computing statusThreadTs in DMs
by QuinnYates · 2026-02-18
73.9%
#23799: fix(slack): finalize replyToMode off threading behavior
by vincentkoc · 2026-02-22
73.5%
#17865: Refactor: centralize dm/group policy resolution
by iyoda · 2026-02-16
73.4%