
























@@ -371,6 +371,7 @@ describe("deliverMattermostReplyWithDraftPreview", () => {
371371it("suppresses reasoning-prefixed finals before preview finalization", async () => {
372372const draftStream = createDraftStreamMock();
373373const deliverFinal = vi.fn(async () => {});
374+const recordThreadParticipation = vi.fn();
374375375376await deliverMattermostReplyWithDraftPreview({
376377payload: { text: " \n > Reasoning:\n> _hidden_" } as never,
@@ -382,6 +383,7 @@ describe("deliverMattermostReplyWithDraftPreview", () => {
382383resolvePreviewFinalText: (text) => text?.trim(),
383384previewState: { finalizedViaPreviewPost: false },
384385logVerboseMessage: vi.fn(),
386+ recordThreadParticipation,
385387deliverPayload: deliverFinal,
386388});
387389@@ -390,6 +392,36 @@ describe("deliverMattermostReplyWithDraftPreview", () => {
390392expect(draftStream.discardPending).not.toHaveBeenCalled();
391393expect(draftStream.clear).not.toHaveBeenCalled();
392394expect(updateMattermostPostSpy).not.toHaveBeenCalled();
395+// No visible reply was sent, so the thread must not be marked as participated.
396+expect(recordThreadParticipation).not.toHaveBeenCalled();
397+});
398+399+it("records thread participation when a same-thread final finalizes the preview in place", async () => {
400+const draftStream = createDraftStreamMock();
401+const deliverFinal = vi.fn(async () => {});
402+const recordThreadParticipation = vi.fn();
403+404+await deliverMattermostReplyWithDraftPreview({
405+payload: { text: "All good" } as never,
406+info: { kind: "final" },
407+kind: "channel",
408+client: createMattermostClientMock(),
409+ draftStream,
410+effectiveReplyToId: "thread-root-1",
411+resolvePreviewFinalText: (text) => text?.trim(),
412+previewState: { finalizedViaPreviewPost: false },
413+logVerboseMessage: vi.fn(),
414+ recordThreadParticipation,
415+deliverPayload: deliverFinal,
416+});
417+418+// Default streaming finalizes by editing the preview post, bypassing deliverPayload —
419+// participation must still be recorded (regression: PR #95552 review P1).
420+expect(updateMattermostPostSpy).toHaveBeenCalledWith(expect.anything(), "preview-post-1", {
421+message: "All good",
422+});
423+expect(deliverFinal).not.toHaveBeenCalled();
424+expect(recordThreadParticipation).toHaveBeenCalledTimes(1);
393425});
394426395427it("deletes the preview after a successful normal final send", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。