← back to Dw Add Sellable Variant Tk10902

tk10875-codex/test-artifacts.mjs

29 lines

#!/usr/bin/env node
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

const here = dirname(fileURLToPath(import.meta.url));
const classification = JSON.parse(readFileSync(join(here, 'classification.json'), 'utf8'));
const pilots = JSON.parse(readFileSync(join(here, 'pilot-sample.json'), 'utf8'));

function assert(condition, message) {
  if (!condition) throw new Error(message);
}

assert(classification.ticket === 'TK-10875', 'wrong ticket');
assert(classification.model === 'codex', 'model comparison label missing');
assert(classification.production_writes === 0, 'production write count is not zero');
assert(classification.summary.active_unbuyable ===
  classification.summary.product_cost_present + classification.summary.product_cost_missing,
  'cost buckets do not reconcile');
assert(classification.classes.reduce((n, row) => n + row.products, 0) ===
  classification.summary.active_unbuyable, 'structural classes do not reconcile');
assert(pilots.every(row => row.pilot_verdict !== 'DRY_RUN_ELIGIBLE_COST_INPUT' ||
  ['verified_trade_cost', 'verified_net_cost'].includes(row.price_kind)),
  'retail-only evidence leaked into cost-eligible pilot');
assert(pilots.every(row => row.vendor !== 'Coordonné' || row.pilot_verdict === 'HOLD_COST_SEMANTICS'),
  'Coordonné retail evidence was promoted to cost');

console.log(`PASS: ${classification.summary.active_unbuyable} products reconcile; ${pilots.length} pilot rows obey cost semantics`);