Align BIT-21924 smoke seed with verification AC paths

verification_report.sources now use google_factcheck, claimcheck, and cross_reference with per-source status/confidence.
Slug smoke-verification-bit21924; skip if any row already has the three paths (idempotent across legacy smoke rows).

Paperclip-Issue: BIT-21924
Paperclip-Run: 6be4879b-b739-479f-a6f9-f08d0654678d
This commit is contained in:
Xika committed 2026-05-12 15:41:43 +00:00
1 parent ec203917d1
commit 492ab8f678
3 files changed
+56 -10

No files matched your search

+1 -1
View File
@@ -1023,7 +1023,7 @@ async function tryHandleAdminUi(req, res) {
} else if (flashParam === 'err') {
flash = { type: 'err', text: 'Não foi possível atualizar (token, artigo, ou dados inválidos).' };
} else if (flashParam === 'seeded-vr') {
flash = { type: 'ok', text: 'Linha smoke de verificação multi-fonte inserida (slug smoke-verification-report).' };
flash = { type: 'ok', text: 'Linha smoke de verificação inserida (slug smoke-verification-bit21924; fontes google_factcheck / claimcheck / cross_reference).' };
} else if (flashParam === 'seeded-vr-skip') {
flash = { type: 'ok', text: 'Smoke de verificação já existia — nada alterado.' };
}
+24 -9
View File
@@ -3,31 +3,46 @@
const { readLastArticles, appendArticleRecord } = require('./article-log');
const { serializeVerificationReport } = require('./verification-report');
const SMOKE_SLUG = 'smoke-verification-report';
/** Distinct from any legacy smoke slug so older rows do not block AC-compliant re-seed. */
const SMOKE_SLUG = 'smoke-verification-bit21924';
function verificationReportHasAcPaths(vr) {
if (!vr || typeof vr !== 'object' || !Array.isArray(vr.sources)) {
return false;
}
const names = new Set(vr.sources.map((s) => String(s.source_name || '')));
return names.has('google_factcheck') && names.has('claimcheck') && names.has('cross_reference');
}
/**
* Idempotent: appends one dashboard row with a bounded multi-source verification_report
* (staging / QA smoke — BIT-21924).
*
* @returns {{ seeded: boolean, slug: string }}
* AC: `verification_report.sources` must include the three pipeline paths
* (`google_factcheck`, `claimcheck`, `cross_reference`) with per-source status/confidence.
*
* @returns {{ seeded: boolean, slug: string, reason?: string }}
*/
function seedSmokeVerificationArticle() {
const articles = readLastArticles(500);
if (articles.some((a) => verificationReportHasAcPaths(a.verification_report))) {
return { seeded: false, slug: SMOKE_SLUG, reason: 'ac_compliant_row_exists' };
}
if (articles.some((a) => String(a.slug || '').trim() === SMOKE_SLUG)) {
return { seeded: false, slug: SMOKE_SLUG };
return { seeded: false, slug: SMOKE_SLUG, reason: 'slug_exists' };
}
const rawV = {
status: 'verified',
overall_confidence: 87,
claims: ['Afirmação de smoke para validação da coluna Verificação em staging.'],
claims: ['Afirmação de smoke para validação da coluna Verificação em staging (BIT-21924).'],
sources: [
{ source_name: 'Fonte A', status: 'match', confidence: 0.91 },
{ source_name: 'Fonte B', status: 'partial', confidence: 0.72 },
{ source_name: 'Fonte C', status: 'mismatch', confidence: 0.41 }
{ source_name: 'google_factcheck', status: 'found', confidence: 0.88 },
{ source_name: 'claimcheck', status: 'found', confidence: 0.74 },
{ source_name: 'cross_reference', status: 'found', confidence: 0.69 }
]
};
appendArticleRecord({
title: '[Smoke] Relatório de verificação multi-fonte',
title: '[Smoke] Relatório de verificação multi-fonte (AC)',
slug: SMOKE_SLUG,
summary: 'Linha de smoke BIT-21924 para validar coluna Verificação (aggregação multi-fonte).',
mode: 'listen',
@@ -38,4 +53,4 @@ function seedSmokeVerificationArticle() {
return { seeded: true, slug: SMOKE_SLUG };
}
module.exports = { seedSmokeVerificationArticle, SMOKE_SLUG };
module.exports = { seedSmokeVerificationArticle, SMOKE_SLUG, verificationReportHasAcPaths };
+31
View File
@@ -51,5 +51,36 @@ describe('smoke-verification-seed', () => {
assert.equal(rows.length, 1);
assert.ok(rows[0].verification_report);
assert.equal(rows[0].verification_report.status, 'verified');
const names = new Set((rows[0].verification_report.sources || []).map((s) => s.source_name));
assert.ok(names.has('google_factcheck'));
assert.ok(names.has('claimcheck'));
assert.ok(names.has('cross_reference'));
});
it('skips when an AC-compliant row already exists (any slug)', () => {
const al = loadFreshArticleLog();
const { serializeVerificationReport } = require('./verification-report');
const rawV = {
status: 'verified',
overall_confidence: 80,
claims: ['Other row'],
sources: [
{ source_name: 'google_factcheck', status: 'found', confidence: 0.9 },
{ source_name: 'claimcheck', status: 'found', confidence: 0.8 },
{ source_name: 'cross_reference', status: 'found', confidence: 0.7 }
]
};
al.appendArticleRecord({
title: 'Pre-existing',
slug: 'other-smoke',
mode: 'listen',
verification_report: serializeVerificationReport(rawV)
});
const { seedSmokeVerificationArticle } = loadFreshSeed();
const r = seedSmokeVerificationArticle();
assert.equal(r.seeded, false);
assert.equal(r.reason, 'ac_compliant_row_exists');
const rows = al.readLastArticles(20);
assert.equal(rows.filter((x) => x.slug === 'smoke-verification-bit21924').length, 0);
});
});