P1e: persist undo and redo history across reloads

This commit is contained in:
Emil
2026-11-01 01:53:05 +03:00
parent 346035e869
commit 9d84c2f162
9 changed files with 113 additions and 16 deletions
+9
View File
@@ -107,6 +107,14 @@ try {
const loadedEdge = second.cores[0].faces[7].end_sec;
if (Math.abs(loadedEdge - cutEdge) > 0.002) throw new Error('manual face did not survive');
if (second.project_name !== first.project_name) throw new Error('project name changed');
if (!second.can_undo) throw new Error('undo history did not survive');
await client.command(26, { type: 'undo' });
const undoneEdge = client.snapshot.cores[0].faces[7].end_sec;
if (Math.abs(undoneEdge - beforeCut) > 0.002) throw new Error('undo after reload did not revert the cut');
if (!client.snapshot.can_redo) throw new Error('redo did not become available');
await client.command(27, { type: 'redo' });
const redoneEdge = client.snapshot.cores[0].faces[7].end_sec;
if (Math.abs(redoneEdge - cutEdge) > 0.002) throw new Error('redo after reload did not restore the cut');
console.log(JSON.stringify({
project: second.project_name,
path: project,
@@ -116,6 +124,7 @@ try {
step: restored.velocities[0],
bpm: second.transport.bpm,
cut: { before: beforeCut, after: loadedEdge },
history: { restored: second.can_undo, undone: undoneEdge, redone: redoneEdge },
journal: second.journal_len,
db: existsSync(join(project, 'project.db'))
}, null, 2));