Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-2984]): don't count a hash-rejected clip in the import's file total

[._.]/ Adam Eivy465364a12825
diff --git a/server/services/sprites/importer.js b/server/services/sprites/importer.js
index 465d2370f9..fe7ef47f33 100644
--- a/server/services/sprites/importer.js
+++ b/server/services/sprites/importer.js
@@ -105,13 +105,19 @@ async function verifyHashes(destDir, expectations, errors, copiedThisRun) {
// a clean re-import.
if (SOURCE_CLIP_REF.test(relPath)) {
await rm(join(destDir, relPath), { force: true });
- return { error: `run ${relPath.split('/')[1]}: source clip failed sha256 verification — not imported` };
+ return { dropped: true, error: `run ${relPath.split('/')[1]}: source clip failed sha256 verification — not imported` };
}
return { error: `sha256 mismatch: ${relPath}` };
}),
);
for (const o of outcomes) if (o.error) errors.push(o.error);
- return outcomes.filter((o) => o.verified).length;
+ // `dropped` feeds back into the caller's file count: a clip removed here was
+ // counted when it was copied, and an import summary must not claim a file it
+ // deliberately deleted.
+ return {
+ verified: outcomes.filter((o) => o.verified).length,
+ dropped: outcomes.filter((o) => o.dropped).length,
+ };
}
// Manifest paths reference files repo-relative (art-source/sprites/<id>/…) or
@@ -398,7 +404,9 @@ async function importCharacter({ sourceRoot, characterId, spec, specPath, select
}
}
- result.verified = await verifyHashes(destDir, hashExpectations, result.errors, copiedThisRun);
+ const { verified, dropped } = await verifyHashes(destDir, hashExpectations, result.errors, copiedThisRun);
+ result.verified = verified;
+ result.files -= dropped;
const record = await upsertImportedRecord(characterId, {
kind: 'character',
diff --git a/server/services/sprites/importer.test.js b/server/services/sprites/importer.test.js
index e251e91fe8..321a125115 100644
--- a/server/services/sprites/importer.test.js
+++ b/server/services/sprites/importer.test.js
@@ -379,6 +379,10 @@ describe('walk-run source clips', () => {
it('refuses a clip whose bytes disagree with the manifest\'s sourceVideoSha256, naming the run', () => {
expect(drifter.errors).toContain('run run-b: source clip failed sha256 verification — not imported');
expect(existsSync(join(drifterDir(), 'runs/run-b/generated/source-video.mp4'))).toBe(false);
+ // …and the summary doesn't claim a file the import deliberately deleted:
+ // spec + walk set + 2 run records + 2 packaged manifests + strip + south
+ // clip = 8, with the dropped east clip subtracted back out.
+ expect(drifter.files).toBe(8);
// The rest of that run still imported — one bad clip isn't a run-wide abort.
expect(existsSync(join(drifterDir(), 'runs/run-b/animation-run.json'))).toBe(true);
});