From 4efe3ba8515e3c59c6d2aaa39b4b77776af97028 Mon Sep 17 00:00:00 2001 From: digital-garbage <133010426+digital-garbage@users.noreply.github.com> Date: Sun, 28 Jun 2026 20:14:44 +0300 Subject: [PATCH] =?UTF-8?q?test:=20JS=20test=20harness=20for=20scene?= =?UTF-8?q?=E2=86=92root=20matching=20(regression=20guard)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extracts the pure global-prompt scene-matching kernel into scene_align.js (dual browser/CommonJS export) and adds a node test suite so the "stale scene anchor after reorder/insert/delete" class can't silently regress again (it has recurred twice). - scene_align.js: matchParsedToRoots(parsedTexts, rootTexts) — the two-pass content-first matcher (exact text + nearest-position tiebreak, then leftover roots in order), index-based and dependency-free. Exposed as window.SceneAlign in the browser (same pattern as window.PipelineCaps) and module.exports under node. - store.js _alignScenesFromParsed now delegates the matching to the kernel and maps indices back to roots — single source of truth, no duplicated logic. Behaviour is identical to the previous inline two passes. - index.html loads scene_align.js before store.js. - scene_align.test.js: 11 cases via node's built-in runner — reorder, edit-in-place, insert-at-front, delete-middle, reorder+edit-one, edit+insert+keep, irreducible, duplicate-text tiebreak, empty-text, no-roots, used-once. Run with `npm test` (node --test) in this dir. Co-Authored-By: Claude Opus 4.8 --- movie_editor/frontend/index.html | 1 + movie_editor/frontend/package.json | 8 +++ movie_editor/frontend/scene_align.js | 53 +++++++++++++++ movie_editor/frontend/scene_align.test.js | 79 +++++++++++++++++++++++ movie_editor/frontend/store.js | 36 ++++------- 5 files changed, 153 insertions(+), 24 deletions(-) create mode 100644 movie_editor/frontend/package.json create mode 100644 movie_editor/frontend/scene_align.js create mode 100644 movie_editor/frontend/scene_align.test.js diff --git a/movie_editor/frontend/index.html b/movie_editor/frontend/index.html index edf63bf2..ba317f97 100644 --- a/movie_editor/frontend/index.html +++ b/movie_editor/frontend/index.html @@ -110,6 +110,7 @@ + diff --git a/movie_editor/frontend/package.json b/movie_editor/frontend/package.json new file mode 100644 index 00000000..5cc752df --- /dev/null +++ b/movie_editor/frontend/package.json @@ -0,0 +1,8 @@ +{ + "name": "funpack-movie-editor-frontend", + "private": true, + "description": "Movie Editor browser frontend. Plain