Files
claudetools/projects/dataforth-dos/tools/push-clean68.js
Mike Swanson 5ecc6df3dc dataforth(datasheet): Fix 2 — publish the 68 STAGE-3-clean DSCA models to Hoffman
Restarted testdatadb service (new template live), canary-pushed 1 cert (updated,
0 errors), then re-pushed all PASS certs for the 68 Final-Test-content-clean
models via uploadBySerialNumbers from a fresh node process.

Result over 30,423 PASS certs: updated=26022 unchanged=2738 created=0 errors=0
skipped=1663. The 26,022 updates replace the old defective DSCA renders on the
live site with the rebuilt, byte-content-validated ones. The 1,663 skips are the
count-guard correctly refusing any individual cert whose value count != its
template row count (ambiguous) — never publishing misaligned data.

Artifacts: push-clean68.js (driver), dsca-clean68-models.json (the published
set). NOT yet published: the 26 last-digit-diff models, the ~32 ambiguous/null
layout families, and the 231 untemplated models.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 13:02:33 -07:00

28 lines
1.5 KiB
JavaScript

// Fix 2 publish — re-push the 68 STAGE-3 Final-Test-clean DSCA models to Hoffman.
// Idempotent (Updated/Unchanged/Created); renderContent uses the new template;
// null renders (count-guard) + FAIL certs + unregistered models auto-skip.
const db = require('./database/db');
const { uploadBySerialNumbers } = require('./database/upload-to-api');
const clean = require('./_clean-models.json');
(async () => {
const ph = clean.map((_, i) => '$' + (i + 1)).join(',');
const rows = await db.query(
`SELECT serial_number FROM test_records WHERE overall_result='PASS' AND model_number IN (${ph}) ORDER BY serial_number`,
clean,
);
const sns = rows.map(r => r.serial_number);
console.log(`[PUSH] ${sns.length} PASS serials across ${clean.length} clean models`);
const CHUNK = 1000;
const tot = { created: 0, updated: 0, unchanged: 0, errors: 0, skipped: 0 };
for (let i = 0; i < sns.length; i += CHUNK) {
const chunk = sns.slice(i, i + CHUNK);
const r = await uploadBySerialNumbers(chunk);
for (const k of Object.keys(tot)) tot[k] += r[k] || 0;
console.log(`[PUSH] ${Math.min(i + CHUNK, sns.length)}/${sns.length} cumulative ` +
`created=${tot.created} updated=${tot.updated} unchanged=${tot.unchanged} errors=${tot.errors} skipped=${tot.skipped}`);
}
console.log('[PUSH] COMPLETE ' + JSON.stringify(tot));
await db.close();
})().catch(e => { console.error('ERR', e.message, e.stack); process.exit(1); });