fix(homolog): isola outputs crus em homolog-report/raw para nao quebrar o ctrf merge

This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-07-14 01:38:26 -03:00
parent bac71f8b66
commit 62925f0877
2 changed files with 7 additions and 5 deletions

View File

@@ -38,13 +38,13 @@ const config = {
// de emitir o "OK" literal — icontains seria falso-positivo de quebra.
tests: [{ assert: [{ type: "javascript", value: "typeof output === 'string'" }] }],
};
fs.mkdirSync("homolog-report", { recursive: true });
fs.mkdirSync("homolog-report/raw", { recursive: true });
fs.writeFileSync(
path.join("homolog-report", "promptfooconfig.yaml"),
JSON.stringify(config, null, 2) // promptfoo aceita JSON como config YAML-compatível
);
fs.writeFileSync(
path.join("homolog-report", "provider-misses.json"),
path.join("homolog-report", "raw", "provider-misses.json"),
JSON.stringify(missing, null, 2)
);
console.log(

View File

@@ -19,7 +19,9 @@ if (!BASE || !process.env.HOMOLOG_ADMIN_PASSWORD) {
process.exit(2);
}
fs.rmSync("homolog-report", { recursive: true, force: true });
fs.mkdirSync("homolog-report", { recursive: true });
// raw/ fica FORA do merge CTRF: `ctrf merge` tenta mesclar qualquer *.json com
// chave "results" e quebra no output cru do promptfoo.
fs.mkdirSync("homolog-report/raw", { recursive: true });
const layers = []; // {name, ok, detail}
const record = (name, ok, detail = "") => {
layers.push({ name, ok, detail });
@@ -89,12 +91,12 @@ try {
"-c",
"homolog-report/promptfooconfig.yaml",
"-o",
"homolog-report/promptfoo.json",
"homolog-report/raw/promptfoo.json",
"--no-cache",
],
{ encoding: "utf8", env: process.env }
);
const pfOut = JSON.parse(fs.readFileSync("homolog-report/promptfoo.json", "utf8"));
const pfOut = JSON.parse(fs.readFileSync("homolog-report/raw/promptfoo.json", "utf8"));
const pfCtrf = promptfooToCtrf(pfOut);
fs.writeFileSync("homolog-report/providers-ctrf.json", JSON.stringify(pfCtrf, null, 2));
record(