Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit ad7172453bff969e01c3a848be10eec5db48c53a
parent bb007c25771a4daf0c8219daaadd6fd3d3f1cd22
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 20 Nov 2026 14:37:52 -0500

umtool e2e: gap-cue.spec, the gap mark set on the bench and seen in Play

- The bench: a gap's band picks it. Its mark, why, own words and corner, and
  the clip's mark, corner and shortest gap, are each written as the CLI
  writes them, and the gap's settings leave an undo point. The bench's Undo
  takes the last edit back. Remove puts the seconds back.
- Play the cut: the mark is up at the join for its life (3 to 4.1 s into the
  cut) saying "» 2 s · dead air", and is gone before and after.
- The Modules panel: the project's label is saved, a cleared label clears,
  and Play's mark says "2 s later".
- Fixture: gapcue-fixture (make-fixture.mjs), the gaps fixture's shape as a
  project of its own, so this spec and gaps-zoom.spec never share a
  manifest.

Run alone once the machine was free: gap-cue.spec 3/3, gaps-zoom.spec
(its band click now picks) 7/7.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/e2e/fixtures/make-fixture.mjs | 13+++++++++++++
Aumtool/e2e/gap-cue.spec.ts | 172+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 185 insertions(+), 0 deletions(-)

diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs @@ -2000,6 +2000,19 @@ makeMediaScenesFixture({ reports, deckManifest }); mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true }); copyFileSync(path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), path.join(dir, "out", "clips-raw", "gapvid_0.00-9.00.mp4")); } +// The gap mark (lane gap-cue, slice 1b; gap-cue.spec.ts), which WRITES (the spec puts the gaps and the settings back +// before each test): gc01 gapcuevid 0.5-8.5 and gc02 1.0-3.0, both locked, on the tone window cached as +// gapcuevid_0.00-9.00.mp4 -- the gaps fixture's shape, its own project so the two specs never share a manifest. +{ + const g = manifest("gapcue-fixture", "The Gap Mark Fixture", { siteOrigin: "https://archive.example" }, [ + { type: "clip", id: "gc01", video: "gapcuevid", start: 0.5, end: 8.5, cite: 1, section: 0, lock: true, quote: "a clip with a marked gap" }, + { type: "clip", id: "gc02", video: "gapcuevid", start: 1.0, end: 3.0, cite: 1, section: 0, lock: true, quote: "the clip after it" }, + ]); + g.render.fetchPad = 0; + const dir = writeProject("gapcue-fixture", g); + mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true }); + copyFileSync(path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), path.join(dir, "out", "clips-raw", "gapcuevid_0.00-9.00.mp4")); +} // Fetch more from where the edge is now (clip-bench.spec.ts): one clip, r01 reachvid 300-306, on a // recording a thousand seconds long; nothing cached -- the spec fetches through the editor stub. writeProject( diff --git a/umtool/e2e/gap-cue.spec.ts b/umtool/e2e/gap-cue.spec.ts @@ -0,0 +1,172 @@ +import { test, expect, type APIRequestContext, type Page } from "@playwright/test"; +import { readFileSync, readdirSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; + +// --------------------------------------------------------------------------- +// The gap mark set and seen in umtool (lane gap-cue, slice 1b; common +// lib/report/gapCue.mjs is the rule, lib/report/gapCueView.mjs lays it out on a +// page's clock): +// +// - the bench: a click on a gap's band picks it; its mark, why, own words and +// corner, and the clip's mark settings, each written through the window +// route (gapEdit / gapCue) as an undo point; the bench's Undo; Remove +// - Play the cut: the mark is up at the join for its life, then gone, saying +// the gap's reason +// - the Modules panel: the project's label, and the mark in Play says it +// +// Fixture: gapcue-fixture (make-fixture.mjs), which this spec WRITES: gc01 +// gapcuevid 0.5-8.5 and gc02 1.0-3.0, on the tone window gapcuevid_0.00-9.00.mp4. +// Every test starts from one gap, 3.5-5.5 (2 s: the default shortest marked), +// and no mark settings. +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const PROJECT = "reports/gapcue-fixture"; +const DIR = path.join(HERE, "..", ".e2e-song", "reports", "gapcue-fixture"); +const MANIFEST = path.join(DIR, "video.manifest.json"); +type Gap = { from: number; to: number; mark?: boolean; why?: string; reason?: string; corner?: string }; +type Manifest = { render: { gapCue?: Record<string, unknown> }; timeline: { id: string; gaps?: Gap[]; gapCue?: Record<string, unknown> }[] }; +const read = () => JSON.parse(readFileSync(MANIFEST, "utf8")) as Manifest; +const clipOf = (id = "gc01") => read().timeline.find((e) => e.id === id)!; +const undoPoints = () => { + try { + return readdirSync(path.join(DIR, "revisions")).filter((f) => f.includes("auto-before-gaps")).length; + } catch { + return 0; + } +}; + +const token = async (request: APIRequestContext, clip = "gc01") => + ((await (await request.get(`/api/report/clip?project=${encodeURIComponent(PROJECT)}&clip=${clip}`)).json()) as { token: string }).token; +const putWindow = async (request: APIRequestContext, data: Record<string, unknown>, clip = "gc01") => + request.put("/api/report/window", { data: { project: PROJECT, clip, token: await token(request, clip), ...data } }); +const putLook = async (request: APIRequestContext, patch: Record<string, unknown>) => { + const t = ((await (await request.get(`/api/report/render?project=${encodeURIComponent(PROJECT)}`)).json()) as { token: string }).token; + return request.put("/api/report/render", { data: { project: PROJECT, token: t, patch } }); +}; + +const openBench = async (page: Page) => { + await page.goto(urls.clipBenchHref(PROJECT, "gc01")); + await page.locator("[data-wave-box]").scrollIntoViewIfNeeded(); + await expect(page.locator("[data-gap-band]")).toHaveCount(1); +}; + +test.beforeEach(async ({ request }) => { + test.setTimeout(120_000); + let r = await putWindow(request, { gaps: [{ from: 3.5, to: 5.5 }], gapCue: null }); + expect(r.ok(), await r.text()).toBeTruthy(); + r = await putLook(request, { gapCue: null }); + expect(r.ok(), await r.text()).toBeTruthy(); +}); + +test("the bench: a gap's band picks it; its mark, why, words and corner, and the clip's settings, are written as the CLI writes them, each an undo point", async ({ page }) => { + await openBench(page); + const row = page.locator("[data-gap-picked-row]"); + await expect(row).toHaveCount(0); + // The clip's settings are there with a gap, each saying the project's. + await expect(page.locator("[data-gap-cue-mark]")).toContainText("as the project"); + await page.locator("[data-gap-band]").click(); + await expect(page.locator("[data-gap-band][data-gap-picked]")).toHaveCount(1); + await expect(row).toBeVisible(); + // Fast-forward is said, not offered. + await expect(row.locator("[data-gap-show=skip]")).toContainText("fast-forward: not built yet"); + + // Its mark on: gapEdit, an undo point. + const before = undoPoints(); + await row.locator("[data-gap-mark-select]").selectOption("on"); + await expect.poll(() => clipOf().gaps?.[0]?.mark).toBe(true); + expect(undoPoints()).toBeGreaterThan(before); + // Its why: the mark says it. + await row.locator("[data-gap-why-select]").selectOption("dead-air"); + await expect.poll(() => clipOf().gaps?.[0]?.why).toBe("dead-air"); + await expect(row.locator("[data-gap-says]")).toHaveAttribute("data-gap-says", "» 2 s · dead air"); + // Its own words, then its corner. + await row.locator("[data-gap-reason]").fill("walks off"); + await row.locator("[data-gap-reason]").press("Enter"); + await expect.poll(() => clipOf().gaps?.[0]?.reason).toBe("walks off"); + await expect(row.locator("[data-gap-says]")).toHaveAttribute("data-gap-says", "» 2 s · walks off"); + await row.locator("[data-gap-corner-select]").selectOption("tr"); + await expect.poll(() => clipOf().gaps?.[0]?.corner).toBe("tr"); + // The bench's Undo takes the last one back; the seconds never moved. + await page.locator("[data-gap-undo]").click(); + await expect.poll(() => clipOf().gaps?.[0]?.corner).toBeUndefined(); + expect(clipOf().gaps?.[0]).toMatchObject({ from: 3.5, to: 5.5, mark: true, why: "dead-air", reason: "walks off" }); + // Off, and back to the clip's. + await row.locator("[data-gap-mark-select]").selectOption("off"); + await expect.poll(() => clipOf().gaps?.[0]?.mark).toBe(false); + await row.locator("[data-gap-mark-select]").selectOption(""); + await expect.poll(() => clipOf().gaps?.[0]?.mark).toBeUndefined(); + + // The clip's own: gapCue on the window route, an undo point. + const before2 = undoPoints(); + await page.locator("[data-gap-cue-mark]").selectOption("on"); + await expect.poll(() => clipOf().gapCue?.mark).toBe(true); + await page.locator("[data-gap-cue-corner]").selectOption("br"); + await expect.poll(() => clipOf().gapCue?.corner).toBe("br"); + await page.locator("[data-gap-cue-min]").fill("1.5"); + await page.locator("[data-gap-cue-min]").press("Enter"); + await expect.poll(() => clipOf().gapCue?.min).toBe(1.5); + expect(undoPoints()).toBeGreaterThanOrEqual(before2); + await page.locator("[data-gap-cue-corner]").selectOption(""); + await expect.poll(() => clipOf().gapCue?.corner).toBeUndefined(); + + // Remove puts the seconds back. + await row.locator("[data-gap-remove]").click(); + await expect.poll(() => clipOf().gaps).toBeUndefined(); + await expect(row).toHaveCount(0); +}); + +/** Play the cut, from the start, until cut second `until`: every (t, chip text) seen. */ +const playAndWatch = async (page: Page, until: number) => { + await page.goto(urls.playHref(PROJECT, {})); + const root = page.locator("[data-play-cut]"); + await expect(root).toHaveAttribute("data-play-edges", "render", { timeout: 30_000 }); + await expect(page.locator("[data-gap-mark-layer]")).toHaveCount(1); + await page.locator("[data-play-toggle]").click(); + const seen: { t: number; text: string | null }[] = []; + await expect + .poll(async () => { + const t = Number(await root.getAttribute("data-play-t")); + const chip = page.locator("[data-gap-mark-chip]"); + seen.push({ t, text: (await chip.count()) ? await chip.getAttribute("data-gap-mark-chip") : null }); + return t; + }, { timeout: 30_000, intervals: [80] }) + .toBeGreaterThan(until); + await page.keyboard.press("k"); + return seen; +}; + +test("Play the cut: the mark is up at the join for its life, saying the gap's reason, and gone after", async ({ page, request }) => { + expect((await putWindow(request, { gapEdit: { at: 4.5, why: "dead-air" } })).ok()).toBeTruthy(); + expect((await putLook(request, { gapCue: { mark: true } })).ok()).toBeTruthy(); + // gc01 plays 0.5-8.5 less 3.5-5.5: its join 3 s into the cut, the mark up 3-4.1. + const seen = await playAndWatch(page, 5); + console.log(`gap-cue: ${seen.map((s) => `${s.t.toFixed(2)}=${s.text ?? "-"}`).join(" ")}`); + const up = seen.filter((s) => s.t > 3.2 && s.t < 3.9); + expect(up.length, "sampled while it is up").toBeGreaterThan(0); + for (const s of up) expect(s.text).toBe("» 2 s · dead air"); + for (const s of seen.filter((x) => x.t < 2.9 || (x.t > 4.2 && x.t < 5))) expect(s.text).toBeNull(); +}); + +test("the Modules panel: the project's label, and Play's mark says it", async ({ page, request }) => { + expect((await putLook(request, { gapCue: { mark: true } })).ok()).toBeTruthy(); + await page.goto(urls.section(PROJECT, "onscreen")); + const card = page.getByTestId("module-gap-cue"); + await expect(card).toBeAttached({ timeout: 60_000 }); + await card.locator("summary").click(); + await card.getByTestId("module-field-gap-cue-label").fill("{s} later"); + await card.getByTestId("module-save-gap-cue").click(); + await expect(card.getByTestId("module-status-gap-cue")).toHaveText("saved"); + await expect.poll(() => read().render.gapCue).toEqual({ mark: true, label: "{s} later" }); + // Cleared there, it clears (the writer merges: the panel sends null). + await card.getByTestId("module-field-gap-cue-label").fill(""); + await card.getByTestId("module-save-gap-cue").click(); + await expect.poll(() => read().render.gapCue).toEqual({ mark: true }); + await card.getByTestId("module-field-gap-cue-label").fill("{s} later"); + await card.getByTestId("module-save-gap-cue").click(); + await expect.poll(() => read().render.gapCue?.label).toBe("{s} later"); + const seen = await playAndWatch(page, 4.5); + expect(seen.filter((s) => s.t > 3.2 && s.t < 3.9).map((s) => s.text)).toContain("2 s later"); +});