Repository navigation
A drafted Copy lands in the Work's draft, across lists too - #1635
Merged
Merged
Conversation
haowjy
marked this pull request as ready for review
November 16, 2026 02:16
Owner
Author
|
Tree lead sign-off: plan reviewed (p17753) and revised; code review p18021's blocker (Copy into Scratch on Draft = 500) fixed at its cause in b1d17a8 (the copy port picks a branch only for drafted schemes; grant and placement now one decision) and checked on a stack; browser run p18046 passed folder copy into the draft + Apply + link, draft-only source copied with its text, the AI's drafted cross-list copy and its Undo, Discard. main merged (0a6d62f), test:db 605, CI 10/10. Batching large drafted copies is the next PR (plan approved with changes). |
haowjy
added a commit
that referenced
this pull request
Nov 16, 2026
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
Why
Copy previously refused a draft destination, so it was the one tree action that ignored the Draft view. Copies should land in the view the writer or AI selected and be available to Apply or Undo with the rest of the Work's changes.
Examples
Copy into Draft
pnpm dev, open a project and a Work with pending changes, and select Draft in Sources.Screenshots:
,
,
.
Benchmarks
On the shared development machine, two successful copies of 197 documents into a Work's draft took 11.37 s and 8.91 s end to end. Instrumentation in the second run measured 5.16 s after namespace lock acquisition: 3.94 s in tree insertion and admission, then 1.22 s writing draft content. A third run took 10.42 s end to end and held the list key for approximately 6.20 s through commit; draft admission accounted for 3.72 s. These are individual observations under load (load average 44 on 24 CPUs; a Work with hundreds of pending changes), not a comparison. Draft admission and content writes run once per document; batching them needs a batch boundary in the shared draft runtime (one savepoint for draft creation and append, keeping pre-seeded imports), which also serves Apply and import. That is its own PR, next.
Design decisions
Changes
domains/context/copy,domains/context/adapters/context-fsdomains/collab/domain/effective-document-reader.tsfeatures/project/context,lib/model-toolspackages/contracts/src/release,.contextCompatibility and risk
Verification
Review fix: destination branch selection now checks the destination scheme in the copy port, and the AI passes its grant destination. A contained draft content write fails the copy rather than silently losing text. On the final stack, a request carrying Draft to Scratch returned 200 and the copied text was readable live; the same request to Manuscript returned 200 and was absent from Live. A mock-model cross-list move in a draft-mode chat succeeded and its copy was absent from Live. Browser verification of this fix remains outstanding.
Browser: the prior run copied a folder into Draft, checked it was absent from Live, and applied it with text. Screenshots above.
Model: a live
deepseek-flashchat copied across lists into Draft; card Undo and Redo changed the pending count from 8 to 6 and back to 8.API: live and draft destinations, draft-only source, draft-only destination folder, mixed live/draft source folder, command ID conflict, and a copied internal link were exercised in the prior run.
Tests: prior run passed
pnpm test:db(93 files, 605 tests) anddraft-pulls.test.ts(3 tests). No tests added.Combined live model and browser run: the AI copied a document, a linked folder and a PNG into a fresh draft. Card Undo and Redo restored the changes; Apply published the text and the image, which rendered in Live. After Apply, following the copied link opened the copied target in Manuscript. Large-copy batching remains outstanding.
Gates:
pnpm test:dbpassed after the review fix (93 files, 605 tests).pnpm checkfailed on three unrelated test timeouts under machine load; its typecheck passed, and all three timed-out files passed on a focused rerun (8 tests).pnpm check:pr-bodypassed. Before the fix,pnpm checkpassed on commit8dca757d63.Deferred
References