Skip to content

[feat] web: create Director Stage nodes that save and reopen - #328

Closed
MrDongsls wants to merge 4 commits into
ThinkFlowLab:mainfrom
MrDongsls:feat/stage-node-entry
Closed

MrDongsls wants to merge 4 commits into
ThinkFlowLab:mainfrom
MrDongsls:feat/stage-node-entry

Conversation

@MrDongsls

@MrDongsls MrDongsls commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Refs #241
Refs #262

Summary

The creation menu and tool rail can create a Director Stage node, the editor opens right after creation, and the stage document persists through apply, close, and reopen. This is slice 1 of 4 delivering #241; the import pipeline, output assets, and agent publishing land on top in #329, #330 and #331.

  • src/canvas/creationTools.ts registers the external Director Stage entry; src/canvas/workspace/useWorkspaceInteraction.tsx opens the editing session for the new node.
  • The external node's editor binding projects to a director editor document, covered by backend contract tests in tests/test_creation_director.py.
  • tests/browser/director_stage_entry.mjs covers create, edit, apply, reopen, undo and redo in both en-US and zh-CN.

Linked issue

Labels

  • type:feat, area:canvas

Test plan

  • Local, run at this PR's head: npx tsc --noEmit clean; npm test 676/676; npm run check:i18n 0 problems; .venv/bin/python -m pytest tests/test_creation_director.py 1 passed; node tests/browser/director_stage_entry.mjs and DIRECTOR_STAGE_LOCALE=zh-CN node tests/browser/director_stage_entry.mjs both pass (checks: shared creation toolbar entry, automatic editor opening, external node projects to director document, keyframes persist and reopen, undo and redo preserve identities, no page errors).
  • Left to CI: full pytest suite, Release checks.
  • Not run: nothing outstanding for this slice.

Evidence that it works

  • Stage editor opened from the creation menu at this head, on the isolated tests/browser/creation_server.py backend:
    stage entry

Provider verification

  • No real-provider calls; the flow is local canvas and document behavior against the isolated fixture backend.

Bilingual UI

  • No user-facing copy changed in this slice.

@MrDongsls
MrDongsls force-pushed the feat/stage-node-entry branch 2 times, most recently from 4c94079 to 25b41bc Compare November 15, 2026 03:26
- Enable the Director Stage entry in the shared creation toolbar and
  open the stage editor automatically after creating the node.
- Pin node, document, and keyframe identity across editor.save, undo,
  redo, and storage reload with a service-level command test.
- Add a browser acceptance flow covering creation, editing, undo,
  redo, and reopen, runnable in en-US and zh-CN via
  DIRECTOR_STAGE_LOCALE.

- npm test (676 passing at this commit's tree state).
- .venv/bin/python -m pytest tests/test_creation_director.py.
- node tests/browser/director_stage_entry.mjs plus the
  DIRECTOR_STAGE_LOCALE=zh-CN run, against the isolated
  creation_server.py fixture.

Refs: ThinkFlowLab#241
@MrDongsls
MrDongsls force-pushed the feat/stage-node-entry branch from 25b41bc to 8528e1c Compare November 15, 2026 03:36
@MrDongsls
MrDongsls marked this pull request as ready for review November 15, 2026 05:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T05:14:07.991981Z ad67e44 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added area:canvas Canvas, nodes and direct manipulation type:feat New capability or behaviour labels Nov 15, 2026
@allendyu

Copy link
Copy Markdown
Collaborator

Review notes (comment only, no formal decision yet)

I reviewed the diff and ran the suites myself on ad67e44b. No blocking issues found. Leaving this as a comment rather than a formal approval for now — see the note at the end.

What I verified locally

Windows, Python 3.12, Node 24, checked out at the PR head:

Check Result
pytest tests/test_creation_director.py -q 1 passed
pytest tests/ -q (full suite) 2070 passed, 27 skipped
node --test tests/*.test.ts (full suite) 818 passed
tsc --noEmit clean
lint-imports 4 contracts kept
check-i18n 3014 keys, 0 problems

The one failure in each suite is pre-existing on clean main in this Windows environment and unrelated to this PR: test_model_reasoning_trace reads a UTF-8 fixture with the gbk default codec, and browserHost builds a temp path whose non-ASCII name cannot be resolved. I re-ran both against main to confirm.

CI is green on all eight checks, including the three browser lanes, and Codex reported no findings at this same commit.

What the change actually does

Worth stating for the record, because the diff is much smaller than the file count suggests: the machinery already landed on main. src/canvas/stageDocument.ts with createLocalStage, the backend DirectorData contract, and the director-stage tool entry all exist there. This PR is pure enablement:

  • drop unavailable: true from the external entry in creationTools.ts
  • attach localStage: createLocalStage(t) when the node is created
  • open the editor after creation

The part I looked at hardest

The auto-open uses requestAnimationFrame and then re-checks state before acting:

if (historyRef.current.present.id !== current.id) return;
const created = historyRef.current.present.nodes.find((candidate) => candidate.id === node.id);
if (created) void openEditor(created);

That is the right shape. It waits for the commit to be present, bails out if the document moved on (so an undo or a reload between create and frame cannot open a stale node), and re-reads the node from history instead of closing over the pre-commit object. The historyRef dependency also avoids a stale closure over history.

Two things for whoever merges

  1. This is slice 1 of [feat] canvas: Director Stage creation entry, external character import, and export loop #241. [feat] web: import self-contained 3D models into the stage #329 is stacked on this branch, so the two should land in order — merging [feat] web: import self-contained 3D models into the stage #329 first will not apply cleanly. [feat] web: register stage stills and preview MP4s as assets #330 and [feat] agent: publish stage and timeline outputs via shared commands #331 follow on top.
  2. The browser check is registered in the gate lane, so it will keep guarding this entry on every future PR. Good call on promoting it rather than leaving it advisory.

Why this is not an approval yet

Nothing in the code needs to change. I am simply holding the formal decision until the landing order of the #241 stack (#328 → #329 → #330 → #331) is settled, so the approval is not stranded on a branch that gets restacked. Ping me when that order is agreed, or if you would rather have the approval now regardless — either is fine by me.

@allendyu

Copy link
Copy Markdown
Collaborator

Please link this PR to #262 and claim the milestone there

@MrDongsls this PR currently declares only Refs #241. Could you also link the roadmap issue #262 and record the claim there?

Why #262 matters here. #262 is the Q4 canvas/timeline roadmap, and its "By December 31 · P1" milestone explicitly lists:

complete Director Stage creation, external character/scene import with motion binding, and publication as project assets

That is exactly this stack — #328 (creation entry), #329 (import), #330 (output assets), #331 (agent publishing). #241 is the right feature issue, but it does not tell the roadmap where the milestone stands. Both links are useful: #241 covers the feature design, #262 covers delivery.

Two asks

  1. Add Refs #262 to this PR description, keeping Refs #241. A Refs line with both is fine — no closing keyword, since the milestone is not finished by this PR alone.
  2. Post a comment on [roadmap] Q4 2026 Canvas and timeline: editing, UI and output parity / 画布与时间线功能和UI #262 stating that you are taking this work. That issue currently has zero comments and its body says "owners and capacity remain to be confirmed", so right now the December milestone has no visible owner. A claim from you is what makes it trackable.

What would make the claim comment useful

No code change is being requested by this comment — only the links and the claim.

@MrDongsls

Copy link
Copy Markdown
Contributor Author

@allendyu The landing order is settled as #328, then #329, #330 and #331. Could you take another look and give the formal review when you have time?

MrDongsls added a commit to MrDongsls/OpenDirector that referenced this pull request Nov 16, 2026
…b#329 (feat/stage-import-editor)

Fold the Director Stage creation entry slice into the import PR so both
slices are reviewed and landed as one change, per review feedback on ThinkFlowLab#329.
@MrDongsls MrDongsls closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:canvas Canvas, nodes and direct manipulation type:feat New capability or behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants