diff --git a/apps/server/src/orchestration-v2/pullRequestWatch.test.ts b/apps/server/src/orchestration-v2/pullRequestWatch.test.ts index 5a836898bb66c..fe630e35fa533 100644 --- a/apps/server/src/orchestration-v2/pullRequestWatch.test.ts +++ b/apps/server/src/orchestration-v2/pullRequestWatch.test.ts @@ -735,6 +735,58 @@ describe("evaluatePullRequestWatch", () => { assert.include(text, `"${"x".repeat(196)}..."`); }); + it("quotes a remark's text instead of its leading HTML, and keeps tags in prose and code", () => { + const badge = + 'Severity > `Minor`'; + const report = evaluatePullRequestWatch(watch(), detail(), [ + remark( + "coderabbitai", + "2026-10-02T12:06:00Z", + `${badge}\n\n_⚠️ Potential issue_ | _🟠 Major_\n\n**Guard the empty list.**`, + ), + remark( + "reviewer", + "2026-10-02T12:07:00Z", + "Return Promise, not Promise or Promise.", + ), + remark( + "designer", + "2026-10-02T12:08:00Z", + "Replace `
` with ````:\n~~~html\n

Done

\n~~~", + ), + remark("maintainer", "2026-10-02T12:09:00Z", "

Guard this

, and `\nCheck the retry.`, + ), + remark( + "fencer", + "2026-10-02T12:12:00Z", + "Use this literal opener:\n```html\n", open + 4); + if (close === -1) break; + text += `${body.slice(from, open)} `; + from = close + 3; + } + return text + body.slice(from); +} + function snippet(body: string): string { - const text = body - .replaceAll(//g, " ") + const text = withoutHtmlComments(body) + .replaceAll(/\s+/g, " ") + .slice(0, SNIPPET_SCAN_LENGTH) + .toWellFormed() + .replaceAll(MARKUP, (match, code: string | undefined) => (code === undefined ? " " : match)) .replaceAll(/\s+/g, " ") .trim(); if (text.length <= SNIPPET_LENGTH) return text;