Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

fix(templates): make decision-tree export compatible with timeline proxies

罗高bc8f342b7148
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7e7c1fa7..85d578a6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -141,7 +141,7 @@ jobs:
run: node --experimental-strip-types --test tests/diagnostics.test.ts tests/install.test.ts tests/npm-installer.test.ts tests/native-runtime.test.ts tests/npm-package.test.ts tests/test-package.test.ts tests/source-install.test.ts tests/bootstrap.test.ts tests/mcp-registry.test.ts tests/public-names.test.ts tests/mcp-runtime.test.ts tests/mcp-upgrade.test.ts tests/preview.test.ts tests/editor-urls.test.ts tests/workspace-studio.test.ts tests/sync.test.ts tests/phase1.test.ts tests/preview-handoff.test.ts tests/adapters.test.ts tests/package.test.ts tests/library-install.test.mjs tests/recreate-measure.test.ts tests/workflow.test.ts tests/catalog.test.ts tests/prism-templates.test.ts tests/extension-boundary.test.ts tests/connections.test.ts tests/install-guide.test.ts tests/readme-resources.test.ts tests/motion-design-remix.test.ts
- name: Studio regression
run: npm run test:studio -- --maxWorkers=2
- - name: Built-in template playback regression
+ - name: Built-in template playback and export regression
run: node --experimental-strip-types --test tests/decision-tree.test.ts
- name: Build phase-one ZIP and exercise all public tools
run: |
diff --git a/template-library/decision-tree/compositions/decision_tree.html b/template-library/decision-tree/compositions/decision_tree.html
index f8e05ab6..f2f088ee 100644
--- a/template-library/decision-tree/compositions/decision_tree.html
+++ b/template-library/decision-tree/compositions/decision_tree.html
@@ -378,7 +378,6 @@
// 14. Highlighted text deletes and "Python" types in (fast)
// Squiggle disappears when last char lands
- const typingStart = tl.labels["hold5"];
const words = ["P", "Py", "Pyt", "Pyth", "Pytho", "Python"];
words.forEach((word, i) => {
tl.add(
@@ -386,20 +385,20 @@
const el = document.querySelector("#python-text");
if (el) el.innerHTML = `Start with <span class="text-highlight">${word}</span>`;
},
- typingStart + i * 0.05,
+ `hold5+=${i * 0.05}`,
);
});
// Remove highlight and squiggle at the end of typing
- const typingEnd = typingStart + words.length * 0.05;
+ const typingDuration = words.length * 0.05;
tl.add(() => {
const pyEl = document.querySelector("#python-text");
if (pyEl) pyEl.innerHTML = "Start with Python";
gsap.set(".squiggle-container", { opacity: 0 });
- }, typingEnd);
+ }, `hold5+=${typingDuration}`);
// 15. Hold 0.5s
- tl.addLabel("hold6", typingEnd + 0.5);
+ tl.addLabel("hold6", `hold5+=${typingDuration + 0.5}`);
// 16. Cursor moves slightly and clicks away to deselect
tl.to("#cursor", { x: -1420, y: -500, duration: 0.3, overwrite: "auto" }, "hold6");
diff --git a/tests/decision-tree.test.ts b/tests/decision-tree.test.ts
index ccb727a8..1d79dc59 100644
--- a/tests/decision-tree.test.ts
+++ b/tests/decision-tree.test.ts
@@ -1,11 +1,32 @@
import test from 'node:test';
import assert from 'node:assert/strict';
-import { mkdtemp, readFile, rm } from 'node:fs/promises';
+import { copyFile, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { JSDOM } from 'jsdom';
import { copyTemplate } from '../template-library.ts';
import { pluginRoot } from '../hyperframes.ts';
+import { renderNext } from '../server.ts';
+import { fixture } from './fixtures.ts';
+
+test('the unchanged decision-tree template exports a verified 1080p MP4', { timeout: 180_000 }, () => fixture(async store => {
+ await copyTemplate('decision-tree', store.projectDirectory, pluginRoot);
+ const before = await store.get();
+ const job = await store.requestExport(before.revision, { phase1: true, audio: 'silent' });
+ await renderNext(store, pluginRoot);
+ const completed = (await store.job(job.id))!;
+ const evidence = process.env.OPENMOTION_DECISION_TREE_EVIDENCE;
+ if (evidence) {
+ await mkdir(evidence, { recursive: true });
+ await writeFile(path.join(evidence, 'export.json'), JSON.stringify(completed, null, 2));
+ await copyFile(path.join(store.directory, 'jobs', job.id, 'render.log'), path.join(evidence, 'render.log'));
+ if (completed.file) await copyFile(path.join(store.directory, completed.file), path.join(evidence, 'decision-tree.mp4'));
+ }
+ assert.equal(completed.state, 'completed', JSON.stringify(completed));
+ assert.deepEqual(completed.expected, { width: 1920, height: 1080, fps: 30, duration: 10, audio: 'silent' });
+ assert.equal((completed.verification as any).status, 'passed', JSON.stringify(completed.verification));
+ assert.equal((await store.get()).revision, before.revision, 'export must preserve the template source');
+}, false));
test('the decision-tree selection follows playback, seeking, replay and loops', async () => {
const directory = await mkdtemp(path.join(tmpdir(), 'motion-decision-tree-'));