Skip to content

Retire the three unreachable postAiResponse helpers #259

Description

@NathanTarbert

Three fully-formed "post the AI answer to the platform" helpers exist and none of them is reachable:

  • apps/github-app/src/lib/github-poster.ts:36postAiResponsepostIssueComment / postDiscussionComment, real Octokit calls
  • apps/slack-bot/src/lib/slack-poster.ts:16postAiResponseclient.chat.postMessage
  • apps/teams-bot/src/lib/teams-poster.ts:26postAiResponsecontext.sendActivity (the file documents its own unreachability at lines 23-24)

Nothing imports any of them except github-poster.test.ts, so there's no live leak. The real path is the worker's PlatformAdapter, which is gated on shadow mode in packages/outpost/queue/src/handlers/ai-response.ts.

The problem is what happens next time someone needs a direct post. Each of these is one import away from being wired up, and none consults shadow mode, so the caller would silently bypass the gate — and docs/deployment.md:212 currently asks the author to remember by hand. That's the same shape as the bug #233 is fixing: enforcement by convention rather than by the predicate.

Two ways to go, and I lean toward the first:

  1. Delete them. The PlatformAdapter path in the worker is the real one, and dead code that looks live is worse than no code.
  2. Guard them, so a future caller inherits the check:
export async function postAiResponse(target: PostTarget, options: PostResponseOptions): Promise<void> {
    if (isShadowMode()) {
        console.log(`[GitHub App] Shadow mode — response for ${owner}/${repo} withheld`);
        return;
    }
    ...
}

Worth confirming nobody has a branch in flight that intends to use them before deleting. Depends on #233 if we take option 2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: integrationsSlack, Teams, Linear, GitHub App, Postmark, Pathfinder, HubSpotpriority: lowNon-blocking; nice-to-have / slow-burn follow-uproadmap: laterRoadmap horizon: backlog / cleanup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions