Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ tree's own drag is [Row selection and drag](../../../../../../../../docs/qa/row-
too. Then rebind the chat to another Work (`./mf api PUT /api/threads/<chat>/work --data
'{"workId":"<other>"}'`) and copy all three again: each still holds the first Work's draft, never the
chat's current Work's or the live text. With the ask menu open on the change row, Discard the Work's
draft (`POST …/works/<w>/branches/discard`) and choose Copy: nothing is copied and the toast says
"That Work no longer has a draft of it."
draft (`POST …/works/<w>/branches/discard`) and choose Copy: the live text is copied, with no
refusal and no note.
8. **Uploads.** Open the chat's Files menu and drag `notes` to a folder: it asks; Copy leaves the upload in
the menu. Drag it onto the Uploads heading: no drop, and the hint says files move or copy out of Uploads,
not in.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ copied, the one already in the destination's parent included (its copy is a
twin), and an edge drop may anchor on a carried row. Each entry's `view` goes to the
server with its root: a tree row copies the live document, a draft title or receipt row the draft it
shows. A draft view names its Work and no chat; the server reads that Work's active branch's draft
of the document, and a Work with no draft of it refuses the Copy (it never reads live text). The copies are
of the document, and where the Work holds no draft of it, its live text, which is what Draft view shows. The copies are
one request with one root per row: the browser mints the copies' ids and the command's id and sends
them once (`copyRows`), and the answer places every root or refuses the whole Copy. The copies
arrive through the list like anyone's records.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function refusalOf(error: unknown): CopyRefusal {
const { details } = error;
const reason = details && typeof details === "object" && "reason" in details && details.reason;
if (reason === "source_behind") return retry(t`The latest edits hadn't reached the server.`);
if (reason === "no_draft") return retry(t`That Work no longer has a draft of it.`);
switch (error.code) {
case "not_found":
case "stale_source":
Expand Down
4 changes: 2 additions & 2 deletions apps/app/src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7264,8 +7264,8 @@ msgid "That Work isn't available."
msgstr "That Work isn't available."

#: src/features/project/context/entry-drag/entry-failure.ts
msgid "That Work no longer has a draft of it."
msgstr "That Work no longer has a draft of it."
#~ msgid "That Work no longer has a draft of it."
#~ msgstr "That Work no longer has a draft of it."

#: src/features/import/selection-limits.ts
msgid "That's {count} files. Import up to {limit} at a time."
Expand Down
4 changes: 2 additions & 2 deletions apps/app/src/locales/zh/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7264,8 +7264,8 @@ msgid "That Work isn't available."
msgstr ""

#: src/features/project/context/entry-drag/entry-failure.ts
msgid "That Work no longer has a draft of it."
msgstr ""
#~ msgid "That Work no longer has a draft of it."
#~ msgstr ""

#: src/features/import/selection-limits.ts
msgid "That's {count} files. Import up to {limit} at a time."
Expand Down
10 changes: 6 additions & 4 deletions apps/server/server/domains/context/.context/CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,15 @@ one source's tree contributes.
`destination_missing` for a destination that no longer exists, `stale_target` for one that
moved, `permission_denied` for an identity destination the writer cannot edit,
`invalid_operation`
for a folder into its own subtree ("Can't go inside itself", the drag hint's words), an
unsupported source (a draft view of a folder, or of a document its Work holds no draft of:
reason `no_draft`), the source root, or a draft placement destination. Uploads as the
for a folder into its own subtree ("Can't go inside itself", the drag hint's words), the
source root, or a draft placement destination. Uploads as the
destination (by path or by folder identity), a malformed path or state vector, and a vector
sent for a folder are refused by the route before the domain runs, typed and unrecorded. A
draft view names its Work and no chat: the server reads that Work's active branch's draft of
the document, and a Work outside the project is refused as `work_missing`.
each document, and a Work outside the project is refused as `work_missing`. A draft view
never refuses for lack of a draft: a document the Work holds no draft of copies its live text
(`copiedFrom.version` `live`), so a folder copies each document as the Work shows it. The
copy is what the writer saw: Draft view shows a document with no draft as its live text.
- A client-held source sends its Yjs state vector with a document source (a folder source
with a vector is a 400). The vector is compared with the room of the view being read, live
or draft. When the cut lacks updates it names, the read waits up to 2 s for the room to
Expand Down
6 changes: 3 additions & 3 deletions apps/server/server/domains/context/.context/qa/copy-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ server only). The browser's Copy has its own recipe, [Copy in the tree](../../..
3. **Draft source.** The same chat overwrites `manuscript://Outside/Sheet` in its
draft. Copy it with `--draft-work w1`: the copy holds the draft text and
`metadata.copiedFrom.version` is `draft`. Copy without the flag: the live text,
`live`. A folder with a draft view is refused (`invalid_operation`). The draft is the
`live`. A folder with a draft view copies each document as the Work shows it: the draft text
where the Work holds a draft, otherwise the live text. The draft is the
Work's, whichever chat wrote it: rebind the chat to another Work, and `--draft-work w1`
still copies Work w1's draft. A Work that holds no draft of the document (`--draft-work`
a second Work) is refused with `invalid_operation` reason `no_draft`, never the
live text.
a second Work) copies the live text: `copiedFrom.version` `live`.
4. **Fifty documents.** Copy a folder of 50 documents linking in a ring. All 50 land
in one transaction (about 4 s here, most of it reading the sources before any
lock), the ring closes inside the copy, and concurrent copies into one folder get
Expand Down
8 changes: 2 additions & 6 deletions packages/contracts/src/protocol/context-operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ import type {
/**
* Why an operation can't run, when a caller words it: a rename
* whose extension would change how the document is stored (a binary file to a text one or
* back), or which kind of text document it is, or a Copy of a Work's draft of a document that
* Work holds no draft of.
* back), or which kind of text document it is.
*/
export type InvalidOperationReason =
| "file_type_conversion"
| "document_type_conversion"
| "no_draft";
export type InvalidOperationReason = "file_type_conversion" | "document_type_conversion";

export type ContextError =
| { code: "command_conflict"; uri: string }
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/protocol/http-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export type CopyContextEntryView =
| { kind: "live" }
/**
* The owner's draft of the document, the one its active branch holds. An owner with no draft
* of it refuses the Copy; it never reads the live document instead.
* of it copies the live document, as its view shows it.
*/
| { kind: "draft"; owner: DraftOwnerKey };

Expand Down
Loading