Public: anyone can read this; the crew can change it.
Full suite red: test/billing-never-deletes.test.ts #13380
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/13379-full-suite-red-test-billing-never-delete → main 2 commits fork 1 thread · 1 unresolved
1 file
changed +10
−4
test/billing-never-deletes.test.ts +10 −4
| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { describe, expect, test } from "bun:test"; |
| 10 | import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; | |
| 10 | import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs"; | |
| 11 | 11 | import { tmpdir } from "node:os"; |
| 12 | import { join } from "node:path"; | |
| 12 | import { basename, join } from "node:path"; | |
| 13 | 13 | import { readdirSync } from "node:fs"; |
| 14 | 14 | import { billingDeletesRefusal } from "../scripts/gate.ts"; |
| 15 | 15 | import { ALLOWED_REMOVALS, destroyReach, destroyReachRefusal, layoutMisses, STOPS, unitsOf, WEBHOOK_ENTRY } from "../src/kernel/destroy_reach.ts"; |
| @@ -28,7 +28,6 @@ const tree = (files: Record<string, string>): string => { | ||
| 28 | 28 | describe("the billing webhook cannot delete", () => { |
| 29 | 29 | test("today's tree: nothing reachable from the webhook removes a forge, an app or a child", () => { |
| 30 | 30 | expect(destroyReach(root, WEBHOOK_ENTRY)).toEqual([]); |
| 31 | expect(destroyReachRefusal(root)).toEqual([]); | |
| 32 | 31 | }); |
| 33 | 32 | |
| 34 | 33 | test("every stop and every allowance still means something, with a reason", () => { |
| @@ -65,7 +64,14 @@ describe("the billing webhook cannot delete", () => { | ||
| 65 | 64 | |
| 66 | 65 | test("a deliberate rmSync on a forge dir added to the real webhook handler is found, with its path", () => { |
| 67 | 66 | const copy = mkdtempSync(join(tmpdir(), "reach-real-")); |
| 68 | cpSync(join(root, "src"), join(copy, "src"), { recursive: true }); | |
| 67 | // Link the tree and copy only the hook's directory: the walk reads files, it needs no real copy | |
| 68 | // of 38 MB. | |
| 69 | mkdirSync(join(copy, "src/http"), { recursive: true }); | |
| 70 | for (const name of readdirSync(join(root, "src"))) if (name !== "http") symlinkSync(join(root, "src", name), join(copy, "src", name)); | |
| 71 | for (const name of readdirSync(join(root, "src/http"))) { | |
| 72 | if (name === basename(WEBHOOK_ENTRY)) cpSync(join(root, "src/http", name), join(copy, "src/http", name)); | |
| 73 | else symlinkSync(join(root, "src/http", name), join(copy, "src/http", name)); | |
| 74 | } | |
| 69 | 75 | const hook = join(copy, WEBHOOK_ENTRY); |
| 70 | 76 | writeFileSync( |
| 71 | 77 | hook, |
new above
offline