syntaxai/tdd.md · main · src / b32_contributing_drift.test.ts

b32_contributing_drift.test.ts 46 lines · 1721 bytes raw
// Drift-detection sibling test for ./CONTRIBUTING.md.
// CONTRIBUTING.md is a SYNTHESIS that links to canonical sources —
// it must not become a restater. These tests check that the load-
// bearing links are still present + the file hasn't bloated past
// a ceiling that would suggest someone copied rule definitions
// inline instead of linking out.
//
// Lives next to b32_*.ts as a Layer-1-adjacent meta-test (it reads
// disk at test time, which is allowed for sibling tests per /sama/v2
// §4.3 — see b32_sama_verify.test.ts for the same shape).

import { describe, expect, test } from "bun:test";

const contributingMd = await Bun.file("./CONTRIBUTING.md").text();

describe("CONTRIBUTING.md drift detection", () => {
  test("links to the SAMA v2 spec (canonical rules)", () => {
    expect(contributingMd).toContain("/sama/v2");
  });

  test("links to the /goal workflow's canonical /goal file", () => {
    expect(contributingMd).toContain("/goals/migrate-historical-goals");
  });

  test("links to the on-ramp gap drama post", () => {
    expect(contributingMd).toContain("/blog/2026-05/sama-v2-on-ramp-gap");
  });

  test("links to the chain-gap drama post (prior context)", () => {
    expect(contributingMd).toContain("/blog/2026-05/sama-v2-goal-chain-gap");
  });

  test("links to the external-engagement issue tracker", () => {
    expect(contributingMd).toContain("git.tdd.md/syntaxai/tdd.md/issues");
  });

  test("links to /sama/v2/verify as the anti-fudge gate", () => {
    expect(contributingMd).toContain("/sama/v2/verify");
  });

  test("does not exceed bloat ceiling (250 lines)", () => {
    const lines = contributingMd.split("\n").length;
    expect(lines).toBeLessThan(250);
  });
});