refactor: prune room legacy

This commit is contained in:
Peter Steinberger
2026-01-17 07:41:01 +00:00
parent 6d969fe58e
commit d5fdda8e28
15 changed files with 43 additions and 34 deletions

View File

@@ -2,14 +2,14 @@ import { describe, expect, it } from "vitest";
import {
buildSlackSlashCommandMatcher,
isSlackRoomAllowedByPolicy,
isSlackChannelAllowedByPolicy,
resolveSlackThreadTs,
} from "./monitor.js";
describe("slack groupPolicy gating", () => {
it("allows when policy is open", () => {
expect(
isSlackRoomAllowedByPolicy({
isSlackChannelAllowedByPolicy({
groupPolicy: "open",
channelAllowlistConfigured: false,
channelAllowed: false,
@@ -19,7 +19,7 @@ describe("slack groupPolicy gating", () => {
it("blocks when policy is disabled", () => {
expect(
isSlackRoomAllowedByPolicy({
isSlackChannelAllowedByPolicy({
groupPolicy: "disabled",
channelAllowlistConfigured: true,
channelAllowed: true,
@@ -29,7 +29,7 @@ describe("slack groupPolicy gating", () => {
it("blocks allowlist when no channel allowlist configured", () => {
expect(
isSlackRoomAllowedByPolicy({
isSlackChannelAllowedByPolicy({
groupPolicy: "allowlist",
channelAllowlistConfigured: false,
channelAllowed: true,
@@ -39,7 +39,7 @@ describe("slack groupPolicy gating", () => {
it("allows allowlist when channel is allowed", () => {
expect(
isSlackRoomAllowedByPolicy({
isSlackChannelAllowedByPolicy({
groupPolicy: "allowlist",
channelAllowlistConfigured: true,
channelAllowed: true,
@@ -49,7 +49,7 @@ describe("slack groupPolicy gating", () => {
it("blocks allowlist when channel is not allowed", () => {
expect(
isSlackRoomAllowedByPolicy({
isSlackChannelAllowedByPolicy({
groupPolicy: "allowlist",
channelAllowlistConfigured: true,
channelAllowed: false,

View File

@@ -1,5 +1,5 @@
export { buildSlackSlashCommandMatcher } from "./monitor/commands.js";
export { isSlackRoomAllowedByPolicy } from "./monitor/policy.js";
export { isSlackChannelAllowedByPolicy } from "./monitor/policy.js";
export { monitorSlackProvider } from "./monitor/provider.js";
export { resolveSlackThreadTs } from "./monitor/replies.js";
export type { MonitorSlackOpts } from "./monitor/types.js";

View File

@@ -11,7 +11,7 @@ import type { SlackMessageEvent } from "../types.js";
import { normalizeAllowList, normalizeAllowListLower, normalizeSlackSlug } from "./allow-list.js";
import { resolveSlackChannelConfig } from "./channel-config.js";
import { isSlackRoomAllowedByPolicy } from "./policy.js";
import { isSlackChannelAllowedByPolicy } from "./policy.js";
export function inferSlackChannelType(
channelId?: string | null,
@@ -314,7 +314,7 @@ export function createSlackMonitorContext(params: {
const channelAllowlistConfigured =
Boolean(params.channelsConfig) && Object.keys(params.channelsConfig ?? {}).length > 0;
if (
!isSlackRoomAllowedByPolicy({
!isSlackChannelAllowedByPolicy({
groupPolicy: params.groupPolicy,
channelAllowlistConfigured,
channelAllowed,

View File

@@ -1,4 +1,4 @@
export function isSlackRoomAllowedByPolicy(params: {
export function isSlackChannelAllowedByPolicy(params: {
groupPolicy: "open" | "disabled" | "allowlist";
channelAllowlistConfigured: boolean;
channelAllowed: boolean;

View File

@@ -33,7 +33,7 @@ import {
import { resolveSlackChannelConfig, type SlackChannelConfigResolved } from "./channel-config.js";
import { buildSlackSlashCommandMatcher, resolveSlackSlashCommandConfig } from "./commands.js";
import type { SlackMonitorContext } from "./context.js";
import { isSlackRoomAllowedByPolicy } from "./policy.js";
import { isSlackChannelAllowedByPolicy } from "./policy.js";
import { deliverSlackSlashReplies } from "./replies.js";
type SlackBlock = { type: string; [key: string]: unknown };
@@ -247,7 +247,7 @@ export function registerSlackMonitorSlashCommands(params: {
Boolean(ctx.channelsConfig) && Object.keys(ctx.channelsConfig ?? {}).length > 0;
const channelAllowed = channelConfig?.allowed !== false;
if (
!isSlackRoomAllowedByPolicy({
!isSlackChannelAllowedByPolicy({
groupPolicy: ctx.groupPolicy,
channelAllowlistConfigured,
channelAllowed,