Skip to content

test(studio): characterization suites for resize commit and razor history#2201

Open
ukimsanov wants to merge 1 commit into
studio-dnd/pr09-asset-click-nudge-policyfrom
studio-dnd/pr10-gesture-characterization-tests
Open

test(studio): characterization suites for resize commit and razor history#2201
ukimsanov wants to merge 1 commit into
studio-dnd/pr09-asset-click-nudge-policyfrom
studio-dnd/pr10-gesture-characterization-tests

Conversation

@ukimsanov

@ukimsanov ukimsanov commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

What

two test-only suites pinning CURRENT behavior before the NLE swap: anchoredResizeReleaseShift.test.ts (manual-offset resize release commits) and useRazorSplit.history.test.tsx (razor split undo/redo history).

Why

regression tripwires — the later glue-swap PRs must keep these green.

How

test files only; they import existing main modules unchanged and pass against them as-is.

Test plan

bunx vitest run on both suites; fallow audit clean.


Stack position 10/25 — studio NLE overhaul (CapCut-parity timeline + canvas). Graphite manages bases; merge from #2192 upward. Temporary TEMP(studio-dnd) fallow entries (unwired-component windows) are all removed by #2213 (app-shell swap), whose tree is byte-identical to the fully-verified integration branch.

ukimsanov commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ukimsanov ukimsanov force-pushed the studio-dnd/pr09-asset-click-nudge-policy branch from 853b5b0 to af9f377 Compare July 11, 2026 00:55
@ukimsanov ukimsanov force-pushed the studio-dnd/pr10-gesture-characterization-tests branch from ff02d68 to 3c08ade Compare July 11, 2026 00:55
@ukimsanov ukimsanov force-pushed the studio-dnd/pr09-asset-click-nudge-policy branch from af9f377 to fc4382f Compare July 11, 2026 01:15
@ukimsanov ukimsanov force-pushed the studio-dnd/pr10-gesture-characterization-tests branch from 3c08ade to ae82816 Compare July 11, 2026 01:15

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed as part of the 25-PR NLE overhaul stack. Full stack review on #2205 (the keystone). No blockers on this PR. — Miga

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Request changesuseRazorSplit.history.test.tsx is genuine characterization and lands 🟢; anchoredResizeReleaseShift.test.ts is 2/3 aspirational math theater that cannot regress on real code changes.

useRazorSplit.history.test.tsx — 🟢 legit characterization.

Both branches (plain HTML + GSAP rewrite) mount the real useRazorSplit hook, exercise handleRazorSplit under act, and assert (i) the split reached disk via the mocked fetch layer that faithfully mirrors /api/projects/:id/file-mutations/split-element/ and /api/projects/:id/gsap-mutations/, (ii) snapshot().undoLabel === "Split timeline clip", (iii) an undo via undoViaDisk restores the exact pre-split bytes. If the production hook drops the history entry, uses a different label, or fails to route through the persistent edit history store, the test fails. Faithful.

Two small callouts, non-blocking:

  • The GSAP-branch fixture (SPLIT_GSAP, line 271-275) writes tl.set("#clip1-split",{x:0},2) — a static synthetic timeline. The server-mirror mock at line 297-306 hardcodes the response to SPLIT_GSAP regardless of what the hook actually asks for. This pins the "endpoint gets called + response gets applied" contract, not "the server produces this exact rewrite given this input" (which is a studio-server concern, correctly out of scope here).
  • expected: finalContent (line 356) uses the fixture as the equality target — meaning the test pins that studio's fetch pipeline round-trips the server response to disk verbatim. Legit contract for a client-side hook test.

anchoredResizeReleaseShift.test.ts — 🟠 aspirational, does not pin production behavior.

Tests 1 (line 97 "the per-frame center anchor converges") and 2 (line 139 "the center stays fixed for every corner at any rotation") both simulate an N-frame anchor loop using a test-file-local helper accumulateResizeAnchor (line 50-60). That helper doesn't wrap or import any production symbol — it re-implements the fix's math inline. The tests then assert that this local math converges.

I grepped the repo for the fix's key state (lastResizeAnchor, accumulateResizeAnchor) at this PR's head SHA — zero hits in production code. The docstring at lines 39-41 says "Fix (useDomEditOverlayGestures pointermove, resize branch, fa4f39168)" — that SHA doesn't resolve in the repo history, and useDomEditOverlayGestures.ts at this SHA has no resize-branch anchor accumulator (grep shows only one line 384 unrelated).

Consequence: these two tests will pass whether the production resize gesture converges, oscillates, or is deleted entirely — because they never call into it. As a regression tripwire for the "later glue-swap PRs must keep these green" claim in the PR body, tests 1 and 2 are false safety. Two possible fixes:

  1. Preferred. Import the actual production accumulator from useDomEditOverlayGestures and drive the loop through it — even if that means factoring the per-frame anchor step out to a named computeNextResizeAnchor(prev, fixedStart, centerNow) helper that the gesture hook calls. That's the "leaf helper" pattern this stack uses everywhere else (see #2192).
  2. If the production fix hasn't landed yet in this stack: delete tests 1 and 2 from this PR and re-add them in the same PR that lands lastResizeAnchor on the hook, so they're tied to real code from the start. Landing aspirational tests ahead of the production fix creates the exact false-safety window the PR body's "regression tripwires" framing is designed to prevent.

Test 3 (line 182 "net translate after persist+reload equals the committed anchor offset (non-GSAP)") does import real production symbols (applyStudioBoxSize, applyStudioPathOffset, readStudioBoxSize, reapplyPositionEditsAfterSeek, createManualOffsetDragMember, applyManualOffsetDragCommit, buildBoxSizePatches, buildPathOffsetPatches), asserts the committed anchor offset survives the persist→reload chain end-to-end, and would fail if any of those functions drifts. Keep test 3 as-is.

Ask. Either (a) rewire tests 1+2 to drive the loop through the production accumulator this PR body says exists, or (b) drop tests 1+2 and land them alongside the fix in a later PR. Either is fine — the current state ships fabric that looks like characterization but isn't.

R1 by Via

@ukimsanov ukimsanov force-pushed the studio-dnd/pr10-gesture-characterization-tests branch from ae82816 to bd0c221 Compare July 11, 2026 02:56
@ukimsanov ukimsanov force-pushed the studio-dnd/pr09-asset-click-nudge-policy branch from fc4382f to 8e77fb1 Compare July 11, 2026 02:56
@ukimsanov

Copy link
Copy Markdown
Collaborator Author

Fixed — you were right that tests 1–2 proved nothing about production: the accumulate math only lands with the gesture code in #2211, so a test-local helper here was false safety. Taken your option composite: tests 1–2 are removed from this PR (test 3, which imports the real persist symbols, stays), and #2211 now extracts the per-frame anchor step into a named production helper (computeNextResizeAnchor in useDomEditOverlayGestures.ts, same math, one call site) with the convergence tests rewired to drive it directly — they now fail if the production loop oscillates. Also fixed the stale SHA reference in the docstring.

@ukimsanov ukimsanov force-pushed the studio-dnd/pr09-asset-click-nudge-policy branch from 8e77fb1 to ba28195 Compare July 11, 2026 08:18
@ukimsanov ukimsanov force-pushed the studio-dnd/pr10-gesture-characterization-tests branch from bd0c221 to b372711 Compare July 11, 2026 08:18
@ukimsanov ukimsanov marked this pull request as ready for review July 11, 2026 09:06
@ukimsanov ukimsanov force-pushed the studio-dnd/pr09-asset-click-nudge-policy branch from ba28195 to ab2e3db Compare July 11, 2026 10:49
@ukimsanov ukimsanov force-pushed the studio-dnd/pr10-gesture-characterization-tests branch from b372711 to 267d84c Compare July 11, 2026 10:49
…tory

What: two test-only suites pinning CURRENT behavior before the NLE swap:
anchoredResizeReleaseShift.test.ts (manual-offset resize release commits)
and useRazorSplit.history.test.tsx (razor split undo/redo history).

Why: regression tripwires — the later glue-swap PRs must keep these green.

How: test files only; they import existing main modules unchanged and pass
against them as-is.

Test plan: bunx vitest run on both suites; fallow audit clean.
@ukimsanov ukimsanov force-pushed the studio-dnd/pr09-asset-click-nudge-policy branch from ab2e3db to b88fb09 Compare July 11, 2026 12:51
@ukimsanov ukimsanov force-pushed the studio-dnd/pr10-gesture-characterization-tests branch from 267d84c to 34fba38 Compare July 11, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants