openvibers/openvibe.media Commits

Media: h15-repair --apply no longer ends in an error after a successful run (#81)

OP OpenVibers committed 10 Oct 2026 · 7cbb9f605c · 1 file, +2 −3

`scripts/h15-repair.js --apply` ended with `h15-repair: copyPath is not defined` and exit 1, though the repair itself had succeeded. Its last log line still named the SQLite-era database copy, which the PostgreSQL switch removed. The changes and the rollback file were already written before that line, so nothing was lost; the error just made a successful run look failed.

- The closing line prints the rollback file and notes that point-in-time recovery is the database's own safety net.
- The always-null `dbCopy` / `backup` field is removed from the record.

Found while clearing production's one `object_copies` warning (2026-10-10): VOD 1804 (`med_01M03NTA881DM261H0TFKX32ES`, August 15) was a 0.6-second fragment whose only copy, on B2, decodes cleanly but is 218,283 bytes against a recorded 262,144. The tool planned and applied `failed_recording` (lifecycle `ready` → `failed`). The rollback file is `data/reports/h15-repair-2026-10-10-vod1804-backup.json`, and `/api/ready` now reports `object_copies` ok with `no_good_copy: 0`.

Test: `node --check`; the script's only other reference to the database copy is gone.

Changes

ddiff --git a/scripts/h15-repair.js b/scripts/h15-repair.js
iindex 01834d9..97003e1 100644
---- a/scripts/h15-repair.js
++++ b/scripts/h15-repair.js
@@@ -142,7 +142,6 @@ const { execFile } = require('child_process');
}
// The database's own safety net is PostgreSQL's point-in-time recovery (pgBackRest); <file.json> is this run's undo.
if (fs.existsSync(BACKUP)) usage(`${BACKUP} already exists; pick a new --backup name`);
-- const dbCopy = null;
const changes = [];
for (const step of steps) {
if (step.action === 'lost') continue;
@@@ -154,10 +153,10 @@ const { execFile } = require('child_process');
const { file, ...s } = step;
changes.push(await h15.apply(h, s, step.facts));
}
-- Object.assign(record, { applied: true, backup: dbCopy, changes });
++ Object.assign(record, { applied: true, changes });
fs.writeFileSync(BACKUP, JSON.stringify(record, null, 2));
for (const c of changes) console.log(`${c.object_id} ${c.action}: ${c.skipped ? `skipped (${c.skipped})` : 'applied'}`);
-- console.log(`\nApplied. Rollback file: ${BACKUP}; database copy: ${copyPath}`);
++ console.log(`\nApplied. Rollback file: ${BACKUP} (the database's own safety net is point-in-time recovery)`);
return 0;
} finally {
fs.rmSync(tmp, { recursive: true, force: true });