refactor(chat): locate iMessage progress policy in channel folder

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-12 08:33:40 -05:00
1 parent 498be55046
commit e5c8f9738c
3 files changed
+26 -2

No files matched your search

@@ -220,3 +220,16 @@ by the service. No state or registration moves in this slice.
- Existing CI fixtures cover exact outbound ownership, interleaved control
messages, consumed progress, interactions, committed failure replacement and
issue-to-run lock order. Local database capacity remains blocked.
### 2026-10-12 channel-folder reassessment: slice 4
Publication replacement is shared ownership logic: exact outbound links, run and
wake scope, consumed progress messages, interaction prompts and retained-source
authorization. Keep those queries together. The close-message provider allowlist
is shared dispatch metadata, not four separate implementations.
Move the iMessage queued/working suppression policy and explanation to
`imessage-photon/publications.ts`. Preserve when endpoint lookup occurs and leave
all ownership queries unchanged. Baseline: 49 public-service publication and
Photon cases passed, including close-owned progress, interleaved Slack control,
Telegram confirmation and FIFO replacement. The same 49 cases passed after. Server typecheck and module boundaries pass.
@@ -0,0 +1,9 @@
import type { SafeChatPublicationPayload } from "@paperclipai/shared";
export function imessageProgressSupersessionReason(
progress: SafeChatPublicationPayload["progressState"],
): string | null {
return progress && ["queued", "working"].includes(progress)
? "iMessage uses typing instead of progress bubbles"
: null;
}
@@ -1,3 +1,4 @@
import { imessageProgressSupersessionReason } from "./imessage-photon/publications.js";
import { fastResponseRequests } from "@paperclipai/db";
import {
@@ -74,9 +75,10 @@ export function createChatPublicationReplacement(db: Db, options: ChatPublicatio
publication: typeof chatPublications.$inferSelect,
): Promise<string | null> {
const progress = publication.payload.progressState;
if (progress && ["queued", "working"].includes(progress)) {
const typingReason = imessageProgressSupersessionReason(progress);
if (typingReason) {
const endpoint = await endpointRecord(publication.endpointId);
if (endpoint?.endpoint.provider === "imessage-photon") return "iMessage uses typing instead of progress bubbles";
if (endpoint?.endpoint.provider === "imessage-photon") return typingReason;
}
if (
!progress ||