Repository navigation
feat(studio): record the layer name on each history entry's target - #7586
Conversation
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head 2041820c
This is a feature, not a fix. The Proof section still names tests that fail without the change.
Scope
Read the full diff (12 files). On the server, name is trimmed, capped at 200 characters, and stored only next to an id, hfId or selector. targetKey leaves name out, so when edits coalesce the latest name wins and the target isn't duplicated. keepTargetsOfItsFiles and revisionState still filter targets by file. On the client, editContextTarget keeps the field set of the two inline copies it replaces. saveProjectFilesWithHistory passes input through, so targets now arrives. A batch timeline target uses the same sourceFile || activeCompPath || "index.html" path as changesByPath, so addTargets keeps it. An empty targets list is dropped. The latest CI, PR captures, regression and Windows runs at this head are green.
— Genesis
What
A history entry's
targetsnow carries an optionalname: the layer name the person saw when they made the edit, which is the layers panel's label for the element (it falls back to the tag name when nothing names the element, as the panel does).HistoryTarget.name?: stringin studio-server. The history route accepts it on a claim's targets, trims it and caps it at 200 characters. It is never an identity: a target still needs anid,hfIdorselector, and renaming the layer later moves nothing.persistTimelineEdit,persistTimelineBatchEdit; the name is the label the clip wears on the timeline). A sharededitContextTarget(file, target)replaces two inline copies of the same object literal;saveProjectFilesWithHistorynow forwardstargets.Why
An entry is labelled by what happened ("Move layer") and says nothing about which layer. A consumer that lists history cannot tell one layer from another, so it cannot group a run of the same edit on the same layer or name it ("Moved Title x6"). The name is recorded at the moment of the edit because it cannot be recovered afterwards: the layer may be renamed or deleted.
Proof
routes/history.test.ts, "keeps a target's layer name, trimmed and capped, and never as its only identity", fails without the change (the stored target has noname) and passes with it. The history route and history suites pass: 15 files, 307 tests.timelineEditingHelpers.test.ts(single clip and batch) fails without the change and passes with it.useGsapScriptCommits.test.tsx, "files a gsap move under the layer it moved, by identity and by the name the person saw", fails without the change (no targets recorded) and passes with it.studioFileHistory.test.tscoverseditContextTarget. Studio suites touched by the change pass (the timeline helpers, quick saves, file history, gsap commits and the nle components: 18 files, 264 tests), andtsc --noEmitis clean for studio and studio-server.Before
A layer drag in Studio (a project from the repo's own fixtures,
packages/studio/tests/e2e/fixtures/design-panel-qa) on main (6b602495): the history's newest entry is labelled "Move layer" and says nothing about which layer. The capture is that entry asGET /api/projects/qa/historyreturns it, after the drag is committed.After
The same drag on this branch: the entry now carries
targetswith the layer's identity and the name the person saw ("Qa Tween Box"). Studio itself looks identical before and after (the window after the drag is in the same captures), because the change is in what is recorded, not in what is drawn. The capture of the entry was taken at5774c2c9; the later commits only remove comments.Not covered