Public: anyone can read this; the crew can change it.
"refused: private address" lives in one place, read by outbound requests and webhooks #5635
mason/forge:mason/5617-refused-private-address-lives-in-one-pla → main 2 commits fork
2 files
changed +27
−1
src/core/webhooks.ts +1 −1
| @@ -388,7 +388,7 @@ export interface DeliveryInfo { | ||
| 388 | 388 | readonly state: "pending" | "ok" | "failed"; |
| 389 | 389 | readonly attempts: number; |
| 390 | 390 | readonly lastStatus: number | null; |
| 391 | /** Why nothing was sent ("refused: private address"), when nothing was. */ | |
| 391 | /** Why nothing was sent (outbound.ts's REFUSED_SENTENCE), when nothing was. */ | |
| 392 | 392 | readonly lastError: string | null; |
| 393 | 393 | readonly kind: string; |
| 394 | 394 | } |
test/outbound-words.test.ts added +26
| @@ -0,0 +1,26 @@ | ||
| 1 | /** | |
| 2 | * "refused: private address" is said from one place (#5617): the | |
| 3 | * outbound guard owns it, and webhooks reads it from there. A copy typed | |
| 4 | * back into a file that reads it fails here. | |
| 5 | */ | |
| 6 | ||
| 7 | import { expect, test } from "bun:test"; | |
| 8 | import { readFileSync } from "node:fs"; | |
| 9 | import { join } from "node:path"; | |
| 10 | import { REFUSED_SENTENCE } from "../src/kernel/outbound.ts"; | |
| 11 | ||
| 12 | const src = join(import.meta.dir, "..", "src"); | |
| 13 | const readers = ["core/webhooks.ts"]; | |
| 14 | ||
| 15 | test("the outbound guard owns the sentence", () => { | |
| 16 | expect(REFUSED_SENTENCE).toBe("refused: private address"); | |
| 17 | const owner = readFileSync(join(src, "kernel/outbound.ts"), "utf8"); | |
| 18 | expect(owner).toContain(`"${REFUSED_SENTENCE}"`); | |
| 19 | }); | |
| 20 | ||
| 21 | for (const file of readers) { | |
| 22 | test(`${file} does not type the sentence out`, () => { | |
| 23 | const text = readFileSync(join(src, file), "utf8"); | |
| 24 | expect(text).not.toContain(REFUSED_SENTENCE); | |
| 25 | }); | |
| 26 | } |
new above
offline