Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
// Direct path-literal edges in the forgotten-sibling gate (#16068): a changed workflow / root
// config has no import "consumer" — the pinning test reads the file itself. The gate treats
// `impactMap.artifacts[changedFile]` as a direct edge with the same diff/masking/allowlist
// semantics as the import edges. Incident that motivated this: a quality.yml edit broke the
// `#7307` guard in tests/unit/build/check-workflows.test.ts and the gate stayed silent.
//
// Complements tests/unit/path-literal-edges.test.ts with the edge cases it does not pin:
// exact finding shape, an unpinned artifact producing no output at all, and an impact map
// predating the `artifacts` key.
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import test, { after } from "node:test";
import { analyzeForgottenSiblingTests } from "../../scripts/check/check-forgotten-sibling-tests.mjs";
const fixtureRoots: string[] = [];
after(() => {
for (const root of fixtureRoots) fs.rmSync(root, { recursive: true, force: true });
});
function fixture(files: Record<string, string>) {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "forgotten-sibling-literal-"));
fixtureRoots.push(root);
for (const [file, contents] of Object.entries(files)) {
const absolute = path.join(root, file);
fs.mkdirSync(path.dirname(absolute), { recursive: true });
fs.writeFileSync(absolute, contents);
}
return root;
}
const WORKFLOW = ".github/workflows/sibling-fixture.yml";
const GUARD = "tests/unit/build/check-workflows.test.ts";
const impactMap = { sources: {}, artifacts: { [WORKFLOW]: [GUARD] } };
function run(changedEntries: { status: string; file: string }[], extra = {}) {
const root = fixture({ [WORKFLOW]: "name: q\n", [GUARD]: "" });
return analyzeForgottenSiblingTests({ root, changedEntries, impactMap, allowlist: [], ...extra });
}
test("a changed workflow whose pinning test is absent from the diff is a finding", () => {
const result = run([{ status: "M", file: WORKFLOW }]);
assert.deepEqual(result.findings, [
{
changedModule: WORKFLOW,
changedSymbols: [],
consumer: WORKFLOW,
candidateTest: GUARD,
reason: "candidate sibling test is absent from the PR diff",
},
]);
assert.equal(result.diagnostics.length, 0);
});
test("updating the pinning test alongside the workflow clears the finding", () => {
const result = run([
{ status: "M", file: WORKFLOW },
{ status: "M", file: GUARD },
]);
assert.deepEqual(result.findings, []);
assert.deepEqual(result.maskingRisks, []);
});
test("deleting the pinning test is a masking risk, not a clean pass", () => {
const result = run([
{ status: "M", file: WORKFLOW },
{ status: "D", file: GUARD },
]);
assert.deepEqual(result.findings, []);
assert.equal(result.maskingRisks.length, 1);
assert.equal(result.maskingRisks[0].candidateTest, GUARD);
assert.equal(result.maskingRisks[0].reason, "candidate sibling test was deleted");
});
test("an allowlist entry suppresses a path-literal finding like any other", () => {
const root = fixture({ [WORKFLOW]: "name: q\n", [GUARD]: "" });
const result = analyzeForgottenSiblingTests({
root,
changedEntries: [{ status: "M", file: WORKFLOW }],
impactMap,
allowlist: [
{
consumer: WORKFLOW,
candidateTest: GUARD,
rationale: "guard is regenerated by a separate job, reviewed in #1",
reference: "#1",
},
],
});
assert.deepEqual(result.findings, []);
assert.equal(result.suppressed.length, 1);
});
test("a changed artifact nobody pins produces nothing (no false RUN_ALL-style noise)", () => {
const result = run([{ status: "M", file: ".github/workflows/sibling-other.yml" }]);
assert.deepEqual(result.findings, []);
assert.deepEqual(result.diagnostics, []);
});
test("an old impact map without `artifacts` still works (backward compatible)", () => {
const root = fixture({ [WORKFLOW]: "name: q\n", [GUARD]: "" });
const result = analyzeForgottenSiblingTests({
root,
changedEntries: [{ status: "M", file: WORKFLOW }],
impactMap: { sources: {} },
allowlist: [],
});
assert.deepEqual(result.findings, []);
});