mirror of
https://github.com/qybaihe/bla.git
synced 2026-11-20 08:20:59 +08:00
fix(redteam): emit unverified JSON when REA dist absent
Keep CI soft-skip exit 0, but print bla-redteam-rea/v1 status unverified so agents never treat SKIP as a red-team pass. Harness covers the path.
This commit is contained in:
@@ -39,10 +39,20 @@ function tsharkVersion(env) {
|
||||
|
||||
async function main() {
|
||||
if (!reaDistReady()) {
|
||||
// Honest agent-facing status: exit 0 keeps CI green when REA is optional,
|
||||
// but never imply a red-team pass. MCP bla_redteam_report uses the same word.
|
||||
console.log(
|
||||
"SKIP: sibling REA dist not ready (expected at ../rea or $REA_ROOT). " +
|
||||
"Red-team empirical gates require a local REA checkout; CI skips when absent.",
|
||||
);
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
schema: "bla-redteam-rea/v1",
|
||||
status: "unverified",
|
||||
reason:
|
||||
"Sibling REA dist not ready — empirical redteam:rea did not run (not a pass).",
|
||||
}),
|
||||
);
|
||||
process.exit(0);
|
||||
}
|
||||
const tshark = resolveTsharkEnv();
|
||||
|
||||
@@ -152,3 +152,27 @@ describe("WASM interface exhaustion vs representation budget", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("redteam:rea skip honesty", () => {
|
||||
it("emits status unverified JSON when sibling REA dist is absent", async () => {
|
||||
const { spawnSync } = await import("node:child_process");
|
||||
const { mkdtempSync } = await import("node:fs");
|
||||
const { tmpdir } = await import("node:os");
|
||||
const emptyRea = mkdtempSync(join(tmpdir(), "bla-no-rea-"));
|
||||
const r = spawnSync(process.execPath, ["scripts/redteam/run.mjs"], {
|
||||
cwd: process.cwd(),
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, REA_ROOT: emptyRea },
|
||||
});
|
||||
expect(r.status).toBe(0);
|
||||
expect(r.stdout).toMatch(/SKIP: sibling REA dist not ready/);
|
||||
const line = r.stdout
|
||||
.split("\n")
|
||||
.map((s) => s.trim())
|
||||
.find((s) => s.startsWith("{") && s.includes("bla-redteam-rea"));
|
||||
expect(line).toBeTruthy();
|
||||
const payload = JSON.parse(line!);
|
||||
expect(payload.schema).toBe("bla-redteam-rea/v1");
|
||||
expect(payload.status).toBe("unverified");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user