test(GOV-06): mutation-fixturerna bygger på den historiska down+402/404-posten SYNTEISKT — inte repots nuvarande evidens (som med rätta är running+200 sedan flottan-cutovern; testerna ska aldrig flippa när verkligheten flippar)
CI (SIAX Cloud) / integration (push) Has been skipped
masterplan-lock / check (push) Successful in 4s
CI (SIAX Cloud) / security (push) Successful in 19s
Security Scan (SIAX Cloud) / security (push) Successful in 33s
CI (SIAX Cloud) / quality (push) Successful in 39s
masterplan-lock / check (pull_request) Successful in 28s
Security Scan (SIAX Cloud) / security (pull_request) Failing after 29s
CI (SIAX Cloud) / security (pull_request) Failing after 37s
CI (SIAX Cloud) / integration (pull_request) Failing after 57s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m7s

This commit is contained in:
2026-09-22 21:23:38 +02:00
parent 99f42a94ba
commit d01efe29e2
+27 -13
View File
@@ -55,6 +55,20 @@ const REAL_EVIDENCE = JSON.parse(
readFileSync(path.join(REPO_ROOT, "evidence", "operational-state.json"), "utf8"),
);
// FIXTURE-BAS: den HISTORISKA, dokumenterade lögner-paret (down + 402/404)
// som en SYNTETISK post — mutationstesterna nedan muterar denna bas, inte
// repots NUVARande evidens (som med rätta är running + 200 sedan flottan-
// cutovern: testerna ska aldrig flippa när verkligheten flippar).
const HISTORIC_EVIDENCE = {
...REAL_EVIDENCE,
operationalState: "down",
checkedAt: "2026-09-07T00:00:00Z",
probes: [
{ fqdn: "0pt.app", env: "prod", url: "https://0pt.app/api/health", httpStatus: 402, ok: false, note: "server: Vercel (historisk proba, fixture)" },
{ fqdn: "api.0pt.app", env: "prod", url: "https://api.0pt.app/api/health", httpStatus: 404, ok: false, note: "server: Vercel (historisk proba, fixture)" },
],
};
/** The GOV-06 failure detail for a fixture, or null when GOV-06 passed. */
function gov06Failure(root: string): string | null {
const { report } = runDoctor(root);
@@ -96,12 +110,12 @@ describe("GOV-06: a FALSE operationalState is detected (the historical defect)",
for (const d of dirs) rmSync(d, { recursive: true, force: true });
});
it("accepts the repo's real, honest pairing (down + 402/404) as the control", () => {
expect(gov06Failure(track(fixture(REAL_REPO, REAL_EVIDENCE)))).toBeNull();
it("accepts the honest pairing (down + 402/404, den historiska lögner-posten) as the control", () => {
expect(gov06Failure(track(fixture({ ...REAL_REPO, operationalState: "down" }, HISTORIC_EVIDENCE)))).toBeNull();
});
it('rejects operationalState "running" when the evidence was recorded for another state', () => {
const detail = gov06Failure(track(fixture({ ...REAL_REPO, operationalState: "running" }, REAL_EVIDENCE)));
const detail = gov06Failure(track(fixture({ ...REAL_REPO, operationalState: "running" }, HISTORIC_EVIDENCE)));
expect(detail).toMatch(/running/);
expect(detail).toMatch(/operational-state\.json/);
});
@@ -111,7 +125,7 @@ describe("GOV-06: a FALSE operationalState is detected (the historical defect)",
track(
fixture(
{ ...REAL_REPO, operationalState: "running" },
{ ...REAL_EVIDENCE, operationalState: "running" },
{ ...HISTORIC_EVIDENCE, operationalState: "running" },
),
),
);
@@ -125,9 +139,9 @@ describe("GOV-06: a FALSE operationalState is detected (the historical defect)",
fixture(
{ ...REAL_REPO, operationalState: "running" },
{
...REAL_EVIDENCE,
...HISTORIC_EVIDENCE,
operationalState: "running",
probes: (REAL_EVIDENCE.probes as { ok: boolean }[]).map((p) => ({ ...p, ok: true })),
probes: (HISTORIC_EVIDENCE.probes as { ok: boolean }[]).map((p) => ({ ...p, ok: true })),
},
),
),
@@ -138,9 +152,9 @@ describe("GOV-06: a FALSE operationalState is detected (the historical defect)",
it('rejects operationalState "down" when a prod host is recorded as answering', () => {
const detail = gov06Failure(
track(
fixture(REAL_REPO, {
...REAL_EVIDENCE,
probes: (REAL_EVIDENCE.probes as { httpStatus: number; ok: boolean }[]).map((p) => ({
fixture({ ...REAL_REPO, operationalState: "down" }, {
...HISTORIC_EVIDENCE,
probes: (HISTORIC_EVIDENCE.probes as { httpStatus: number; ok: boolean }[]).map((p) => ({
...p,
httpStatus: 200,
ok: true,
@@ -158,10 +172,10 @@ describe("GOV-06: a FALSE operationalState is detected (the historical defect)",
fixture(
{ ...REAL_REPO, operationalState: "running" },
{
...REAL_EVIDENCE,
...HISTORIC_EVIDENCE,
operationalState: "running",
checkedAt: stale,
probes: (REAL_EVIDENCE.probes as { httpStatus: number; ok: boolean }[]).map((p) => ({
probes: (HISTORIC_EVIDENCE.probes as { httpStatus: number; ok: boolean }[]).map((p) => ({
...p,
httpStatus: 200,
ok: true,
@@ -184,7 +198,7 @@ describe("GOV-06: a FALSE operationalState is detected (the historical defect)",
{ fqdn: "invented.0pt.app", env: "prod", purpose: "x", registrar: "x" },
],
},
REAL_EVIDENCE,
HISTORIC_EVIDENCE,
),
),
);
@@ -199,7 +213,7 @@ describe("GOV-06: a FALSE operationalState is detected (the historical defect)",
...REAL_REPO,
domains: [{ fqdn: "https://0pt.app/health", env: "prod", purpose: "x", registrar: "x" }],
},
REAL_EVIDENCE,
HISTORIC_EVIDENCE,
),
),
);