Match production auto-links and require preserved reply source

Use the existing GFM and issue-reference plugins with the viewer company prefixes. Keep source Markdown mandatory in native receipts and cover bare URLs, known issue keys, foreign plain keys and changed destinations.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-29 23:51:32 -05:00
1 parent 6eba7fffb4
commit 6df66df9d9
9 files changed
+61 -23

No files matched your search

+10 -1
View File
@@ -9,10 +9,19 @@ it("parses CommonMark escapes, entities, inline formatting and paragraph boundar
});
it("rejects unsupported Markdown rather than stripping unknown or invisible content", () => {
for (const source of ["Visible <!-- hidden -->", "Visible ![image](https://fixture.test/image.png)", "~~Visible~~"])
for (const source of ["Visible <!-- hidden -->", "Visible ![image](https://fixture.test/image.png)", "|Column|\n|---|\n|Visible|"])
expect(taskReplyContentMatches({ body: "Visible" }, source)).toBe(false);
});
it("uses production GFM autolinks and issue linking with the viewer's known companies", () => {
const context = { pageUrl: "https://fixture.test/QA/issues/QA-1", knownCompanyPrefixes: ["QA"] };
expect(taskReplyContentMatches({ ...context, body: "Depends on QA-123.", content: [{ text: "Depends on " },
{ href: "/QA/issues/QA-123", label: "QA-123", decorated: true }, { text: "." }] }, "Depends on QA-123.")).toBe(true);
expect(taskReplyContentMatches({ ...context, body: "See https://example.com/", content: [{ text: "See " },
{ href: "https://example.com/", label: "https://example.com/" }] }, "See https://example.com/")).toBe(true);
expect(taskReplyContentMatches({ ...context, body: "Depends on TREE-604." }, "Depends on TREE-604.")).toBe(true);
});
it("uses the production company prefix and current task URL without accepting a changed target", () => {
const observation = { body: "Read Outcome", pageUrl: "https://fixture.test/QA/issues/QA-123",
content: [{ text: "Read " }, { href: "/QA/issues/QA-123#document-outcome", label: "Outcome" }] };