CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

delete-paste-ranges

Check that Backspace, Delete, Return, typing, paste, cut and bold keep the text outside their range in order over every caret and range of every small document, with a link, a read-only inline, a required title, a one-text code block and a block void among them, that typing never writes into a void, that a command over a range keeps none of its letters, that the result stays canonical and that one undo gives back the document. Use before and after changing packages/plitejs/src/transforms-text/delete-text.ts, delete-text-whole-blocks.ts, merge-nodes.ts, slice landing or another file in its coverage record, when the delete-paste-ranges step of pnpm check fails, or when fixing a delete, join, typing or paste bug a tester found.

Quality

79%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./.agents/skills/delete-paste-ranges/SKILL.md
SKILL.md
Quality
Evals
Security

Delete and paste over ranges

Handle $ARGUMENTS. check, or no argument, runs the gate bound. deep runs --blocks=3 --lines=3 and compares its failures with Findings. lower runs --lower after a fix removes a known finding. case <identity> runs --case=<identity> to print one case's full detail. update brings the verification in line with changed code, as Coverage record says.

The property. A user puts the caret anywhere, or selects any range, and presses Backspace, Delete or Return, types a letter, pastes, cuts and pastes back, bolds the range, or presses Cmd+B at the caret and types a letter. The text before the range and the text after it stay, in order, around what the command inserts, and the lines split and join only where the range and the fragment say. A paste at a caret whose last block has the caret line's type leaves the text after the caret in that line's block, which keeps its properties, as EDIT-CLIPBOARD-MIDDLE-BLOCKS-401 says. A read-only inline changes only whole, as EDIT-INLINE-READONLY-DELETE-001 in the Delete Commands section of docs/editor-behavior/markdown-editing-spec.md says. A required title keeps its slot. Backspace over whole blocks leaves the block the EDIT-SEL-BS-001 note names in their place, and a delete leaves the same document whether its range comes as the target or through the selection. An element whose schema holds one text, such as Plate's code block, never gets a second text, as EDIT-CB-RANGE-MARK-001 says. A block void's text is not editable content, so a typed letter lands in a text block, never in the void, and typing through the transaction's text insert, as plugins and DOM repair do, leaves the lines the typing command leaves. A command over a range replaces every letter in it, so a comment or caret anchored to a selected letter does not survive, even when the pasted text ends like the text it replaces. The result is the value loading it into a fresh editor gives, one undo gives back the document before, and a cut pasted back at the caret it leaves gives back the document. In a quote that holds text beside a paragraph, Return in a text line gives what it gives in that line wrapped in a paragraph, as rows M1 to M3 of docs/plans/2026-11-23-mixed-content-lines-6.md ask: the quote stays one quote, every letter keeps its properties, and the next letter lands at the start of the second half.

The harm. A delete or paste that drops, copies or moves text outside the selection destroys what the user did not select. Three open P1 bugs sit in these commands, t_31726070, t_b2ddef38 and t_ea3f0bf2. Eight fixes landed in the same commands between 2026-10-24 and 2026-11-02, each found one case at a time: efbc6d54d2, 02e4705837, 1b4aa31709, 7587a84c1e, fa33511739, 4fa60a34c7, e2116bf1b8 and 887caefa1b. Two more fixed a second text in a code block: 03cbb1bb61, where Cmd+B on part of its text threw, and 9b3552d0ca, where the letter typed after Cmd+B at a caret there was lost.

What it checks

packages/plitejs/scripts/delete-paste-ranges.ts runs the real Plite editor commands on every case up to a bound. It checks the TypeScript code itself, not a model of it.

  1. Documents. Every document of up to --blocks top-level blocks and --lines lines. Each block is a paragraph, a quote of one or two paragraphs, or a code block, whose schema content is schema.content.text({ min: 1, max: 1 }) like Plate's code block. Each line is empty, two letters, or a letter, an inline of two letters and a letter, where the inline is a link or a read-only guard. A document holds at most one inline. The titled world puts a required title first, through schema.content.prefix, and neither the title nor a code block holds an inline. Letters run from a in document order, so each one names its place. Texts may carry a bold mark. Each document with a code block also comes once more with a second line in each code block, a line break and two letters, one past the line bound, because a code block keeps its lines in its one text. Each plain-world document without a code block also comes twice more with an embed first or last, a block void declared as void: 'block' like Plate's board, one past the block bound. The void holds no place and no line, so a range over every text block has only the void beside it. The mixed world holds eight documents of quotes that hold text lines beside paragraphs. A text line is a run of texts between two of the quote's blocks, or between a block and the quote's edge. The documents are quote("ab" paragraph("cd")), the same quote with b bold, quote(paragraph("ab") "cd"), quote("ab" paragraph("cd") "ef"), that quote after a paragraph, that quote before a paragraph, two adjacent mixed quotes and quote(paragraph("ab") "cd" paragraph("ef")). They hold no empty paragraph, link or guard, because the first baseline already lists range findings for a quote with an empty paragraph. A mixed identity names each text's marks and each element's properties with their values, as in quote("a" "b"{bold} paragraph("cd")), where {bold: false} would name a mark set to false. So moving the mark to another text, or changing its value, changes the document's name. The script refuses two mixed documents with one name.
  2. Places. Every offset of every text, an inline's own text included, so the caret before an inline and the caret at its inside start are two places. A range runs from each place to each later one.
  3. Commands. At a caret: editorCommands.delete backward and forward by character, insertBreak, insertText of X, replaceSlice of four slices, and toggleMark of bold followed by insertText of X in a second update. Over a range: deleteFragment backward, the same insertBreak, insertText and replaceSlice of the first three slices, addMark of bold, and a cut, which reads state.slice.get() over what the delete removes, as the editable's cut does, runs deleteFragment and pastes the slice back with replaceSlice. When the root's default block takes the place of the whole blocks a range covers, the cut reads those blocks closed, so they paste back with their types, as EDIT-SEL-CUT-ALL-001 says. The slices are text, one open paragraph X; lines, open paragraphs X and Y; quote, an open paragraph X and a quote whose open paragraph is Y; and closedQuote, a closed quote of paragraphs X and Y. closedQuote runs only at a caret in a quoted line or inside a link, the places the oracle gives its lines. At a caret in a paragraph line, replaceSlice also pastes checked, open paragraphs X and Y that carry checked: true, a property the schema allows only on paragraphs. Over a range that ends after a letter of its text, on lines without an inline, replaceSlice also pastes an open paragraph of X and that letter, named by its text, such as paste Xb. That paste ends like the text it replaces, which a fitter that matches by look reads as kept. deleteFragment forward gave the same findings as backward at the gate, so ranges run only Backspace. Backspace over a range runs a second time on a fresh editor, with the range as deleteFragment's at, because the browser deletes its input target range that way. Typing over a range runs a second time on a fresh editor, with the range as both the selection and insertText's at, because the browser types over its input target range that way. It runs a third time through the transaction, tx.text.insert of X over the selection, which plugins and DOM repair call and which skips the command's whole-block replacement. Over a range that covers all of one line's text, as a triple-click selects it, the script also runs a triple: it selects the range and writes the tripleClickedBlock annotation with the line's block, as the click does, runs deleteFragment without a range in a second update, as a headless call right after the click does, and types X in a third update, as the browser does after a triple-click and Backspace. In the mixed world only Return runs, at every caret.
  4. Oracle. The oracle is a line model of the document before. It holds each text block's text, in order, with the read-only inline's span. Each command gives the lines it may leave:
    • A range or a caret command replaces the text from its start to its end with what it inserts, and the text before the range ends the first inserted line and the text after it starts the last. Cmd+B and a letter at a caret insert X, like typing.
    • EDIT-CLIPBOARD-MIDDLE-BLOCKS-401: a closed quote pasted at a caret in a quoted paragraph lands its paragraphs in that quote, so its first line ends with the text before the caret and its last starts with the text after it, as the open lines slice does. A caret at a link's inside edge and the caret just outside the link are one place in the line. In a line outside a quote, the paragraph cannot hold the quote, so the quote lands whole between the line's two halves. No spec rule names that case. Both halves hold text there, because a link sits between two letters.
    • EDIT-CLIPBOARD-MIDDLE-BLOCKS-401: after the checked paste, the line that holds the text before the caret keeps the caret line's block. So does the line that holds the text after the caret, when there is any, as a split's tail does. A pasted line that holds no text of the caret line keeps its own block.
    • EDIT-CB-RANGE-MARK-001: bold over a range keeps every line's text. Where the range covers part of a code block's text, that text stays unmarked, and the rest of the range takes the mark.
    • Backspace at a line's start joins it into the line before, and Delete at a line's end joins the next line into it. At the first or last line nothing changes. Each line of a code block's text is a line of its own, so a join into or out of a code block moves only the line it reaches, as EDIT-CB-JOIN-BEFORE-001 says.
    • A range from a text's start to the start of a later line may also end at the end of the line before, because deleteText unhangs such a range, unless the range ends at the end of the document. A void after the last line means the range does not end there. No spec rule names this case. The EDIT-SEL-BS-001 note covers only a range over all of one block's text, which leaves that block empty.
    • EDIT-INLINE-READONLY-DELETE-001: a command with the caret or both edges inside the read-only inline, its edges included, changes nothing, and so does a delete with either edge inside it. Backspace or Delete from the text beside it removes it whole. Typing, Return or paste over a range with one edge inside it replaces the range with the inline included.
    • In the titled world, a command that joins every body line into the title may leave one empty body line, because the body keeps an occupant. Backspace or Delete at a caret may instead change nothing, as fa33511739 keeps an empty title only when no block must be built in place of the joined one.
    • EDIT-ATOMIC-BS-AFTER-EMPTY-001: Backspace in an empty paragraph right after the void removes that paragraph.
    • EDIT-SEL-TRIPLE-BS-001: after a triple, the letter starts the next line when the block after the selected one takes text, because Backspace removed the selected block. A required title, a line of a quote with two lines, the last block and a block before the void stay, empty, and take the letter.
    • Plite core has no quote rules. The spec's blockquote rules, such as EDIT-BQ-ENTER-EMPTY-001, belong to Plate's blockquote plugin, so a quote here is a plain container.
    • Rows M1 to M3 of docs/plans/2026-11-23-mixed-content-lines-6.md: the line model reads a quote that holds text beside a block as text lines and blocks, so each text line is a line of its own. Return in a text line gives what it gives in that line wrapped in a paragraph, and Return in a paragraph there splits the paragraph. For the mixed world the oracle also builds the whole document Return leaves: the line becomes two paragraphs in its container, each half keeps its letters with their properties, an empty half holds one empty text without marks, and every other node stays as it was. The letter typed next lands at the second paragraph's start, with the marks of the text that paragraph starts with, or of the text the caret sat in when that paragraph is empty.
  5. Laws. After each command the script compares the editor with the oracle. A case records its first failure:
    • range-read-only: a read-only inline whose text changed but not whole, or a changed document where the oracle says nothing changes.
    • range-slot: a titled document whose first block is not a title.
    • range-canonical: a document that loading would change: an element with no children, two texts with the same marks side by side, an empty text no inline needs, or an inline without text on both sides. Inside an inline the same holds, so a bolded part of a link is a text of its own. An inline may hold no text after any command except typing or paste at a caret, because loading keeps an empty link and EDIT-INLINE-BS-EMPTY-001 says how Backspace removes one. Typing or paste at a caret never leaves one. In the mixed world, the law reads each text line between an element's blocks as a line of its own, so an empty text at a text line's edge counts only as the spacer an inline element needs, as in quote(paragraph("ab") "" link("cd") "" paragraph("ef")). In every other world, the law reads an element that holds text as one line, so a block inside it fails. In the mixed world, the law also loads the result into a fresh editor and fails when loading changes it or throws.
    • range-text: the text, read across all lines, differs from every form the oracle allows. The command lost, copied or reordered text.
    • range-lines: the text matches but the lines split or join elsewhere.
    • range-props: after the checked paste, a line's block, read as its type and properties, differs from the block the oracle gives it.
    • range-kept: a command over a range other than bold changed the document but kept a selected letter. Before the command, the script puts an inward anchor that drops on deletion over each selected letter, and after it every anchor must resolve to nothing. The text and lines laws cannot see this, because a kept letter and a pasted copy of it read the same.
    • range-undo: one undo does not give back the document before.
    • range-cut-paste: the cut's slice, pasted back at the caret the cut leaves, does not give back the document. Ranges with an edge inside the read-only inline get no cut, because the spec says such a cut removes nothing.
    • range-throws: a command or its undo throws an error other than a refusal, or the editor refuses bold over a range. EDIT-CB-RANGE-MARK-001 says the mark still applies outside a code block's partly covered text, so a refusal there loses the user's Cmd+B.
    • range-void: the void holds text after typing or any other command. The law also reads the transaction's typing.
    • range-type-tx: typing over a range through the transaction leaves other lines than the typing command.
    • range-type-at: typing over a range with the range as its target leaves other lines than typing over it through the selection. The law compares lines only. Compared as documents, the two paths differ in 138 gate cases on whether the letter joins a link the range ends at, and no spec rule picks one: paragraph("") paragraph("a" link("bc") "d") :: type X over [0,0]:0..[1,0]:1 puts X before the link with the range as its target and inside it through the selection.
    • range-block: Backspace over whole top-level blocks leaves another block in their place than the EDIT-SEL-BS-001 note says. A range from a block's start to the end of a later block, or to the start of the block after it, keeps its first block, emptied, with its type, when another block stays beside them, and otherwise leaves the root's default paragraph, as EDIT-SEL-CUT-ALL-001 says. The law reads only the type and properties of that block, and of a quote's first paragraph, because the lines law already reads the text. A range that starts at the title's start is out of it.
    • range-at: Backspace over a range with the range as its target leaves another document than Backspace over it through the selection. The key passes its range as the target, and a headless call often reads the selection, so the two must agree.
    • range-tree: a Return in the mixed world whose document differs from the one the oracle builds. The law compares the whole document, so a quote split in two, a line left outside a paragraph, or a letter whose properties changed in either half or in an untouched sibling fails it. It runs after range-lines and before range-undo.
    • range-next-letter: a letter typed right after a Return in the mixed world, on a separate replay, whose wrapper type, parent, rooted path, offset or marks differ from what the oracle gives. The law first checks that Return leaves a caret, not a range or a selection of nodes. After the letter, it compares the text of every line with the oracle's lines, with the letter at the start of the second half. So a Return that selects the next letter, which the typed letter then replaces, fails it. It runs after range-undo.
  6. A refusal the editor gives to any other command counts in the summary's refused, and the laws then compare the document it kept.
  7. It compares the findings with five baselines through tooling/scripts/finding-baseline.mjs: documents without a code block or a void with packages/plitejs/scripts/delete-paste-ranges-baseline.json, documents with a code block of one line with packages/plitejs/scripts/delete-paste-ranges-code-baseline.json, documents whose code blocks hold a second line with packages/plitejs/scripts/delete-paste-ranges-code-lines-baseline.json, documents with a void with packages/plitejs/scripts/delete-paste-ranges-embed-baseline.json, and the mixed world's documents with packages/plitejs/scripts/delete-paste-ranges-mixed-baseline.json. The code, code-lines and void documents have baselines of their own because most of their findings repeat the first baseline's causes under new identities, and a baseline never grows. The mixed world has its own so that each key step of docs/plans/2026-11-23-mixed-content-lines-6.md empties the findings its key fixes. Every finding is filed under packages/plitejs/src/transforms-text. An identity names the document, the command and its places as [path]:offset, never the result.

Run it

Run every command from the repository root.

  • pnpm check:delete-paste-ranges checks the gate bound of two blocks and two lines. It compares 21,633 cases on the 84 documents without a code block or a void, 8,248 cases on the 42 with a code block, 17,404 cases on the 42 whose code blocks hold a second line, 35,830 cases on the 136 with a void and 73 cases on the 8 mixed documents. The triple added 106, 49 and 172 of them, and the checked paste added 548, 144, 144 and 952. Before the code block and bold, its 17,792 cases cost 209 s of processor time, about 12 ms a case, spread over 16 workers, so they needed about 13 s on a machine with 16 free cores. The 28,234 cases took 26 s at a load average of 42, and the 61,990 with the void documents took 24 s on 16 workers. At a load average of 110, the 62,687 cases with the range-kept law and the echo pastes took 137 s, and the 61,990 before them took 165 s right before, so the law's cost is within the host's noise. The 81,327 cases with the second code line took 223 s and 245 s on 16 workers while browser runs shared the host. The 83,115 cases with the checked paste took 184 s while other checks held most of the host's 18 cores. Most of a case is the command, because one deleteFragment on a two-paragraph editor costs about 5 ms. It prints one JSON summary line for each baseline, whose code, mixed and documents fields say which, then each finding that baseline does not list. pnpm check delete-paste-ranges runs the same step through the check runner, and Local CI runs it on next after each landing.
  • pnpm check:delete-paste-ranges --light runs a fixed half of each gate's cases at the gate bound. A hash of the case's identity picks the half, so every light case is a gate case with the same identity. It compares 10,817, 4,122, 8,704 and 17,915 cases, half of each of the four gates, and 40 of the mixed world's 73, its witnesses included. Before the code-lines gate, its three gates took 35 s at a load average near 166, and with it one run through the check runner took 170 s. With the checked paste it took 83 s. Each light run fails on a finding its baseline does not list and passes a listed finding it does not reach. It also fails when a light count misses its pin, the lightCases field of its GATES entry. It takes no flag but --jobs. A session runs pnpm check delete-paste-ranges --light before a diff panel and the cases its change targets, with --case, while it fixes. Local CI runs the gate after landing.
  • --blocks and --lines raise the bound. Three blocks need three lines, so the gate holds one and two blocks, and --blocks=3 --lines=3 is the deep run. A bound other than the gate's or --case skips the baseline and exits 1 on any failure.
  • --case='<identity or part of one>' runs only the matching cases and prints each failure's full stack, such as '--case=paragraph("ab") paragraph("cd") :: paste quote at [0,0]:1'.
  • --jobs=<n> sets the number of worker processes. It defaults to CHECK_CORES, the cores the check runner reserves for the step, and otherwise to the machine's cores up to 16.
  • Exit 0 is a pass and exit 1 a finding. Exit 2 is a bad flag or a crashed worker. At the gate the run also fails when any baseline's documents give a case count other than its pin, the cases field of its GATES entry, now 21,633, 8,248, 17,404, 35,830 and 73. So a change that stops documents or places from generating cannot shrink the gate while the baselines still match. Update a count only with the reason it moved.
  • The mixed world's GATES entry names witnesses, which run in every bound, the light one included: rows M1 and M3 of docs/plans/2026-11-23-mixed-content-lines-6.md and Return at [0,0]:1 in quote("ab" paragraph("cd") "ef"), and at [0,0]:1, [0,1]:0 and [0,1]:1 in quote("a" "b"{bold} paragraph("cd")), the mark's edge from each side and the bold text's end. The run prints every mixed case it runs with its first finding or pass, and fails when a witness did not run, unless --case narrows the run. A run where a witness did not run writes no baseline, under --lower or --init too.
  • After a fix removes a known finding, the gate fails until you run pnpm check:delete-paste-ranges --lower, which lowers every baseline. A baseline never grows. --init seeds only a rule a baseline lacks. It fails on a finding that baseline does not list under a rule it lists, and checks the other baselines as usual. --lower and --init write nothing to a baseline whose case count misses its pin.

Read a failure

A finding prints its rule, identity and the first line of its detail:

range-lines paragraph("a" link("bc") "d") paragraph("") :: Backspace over [0,1,0]:0..[1,0]:0
  gives the lines ["","a"], not ["a"]

range-text paragraph("ab") paragraph("cd") :: paste quote at [0,0]:1
  gives the text "abcd", not "aXYbcd"

Both are known findings. The first deletes from the link's inside start to the start of the empty last line and leaves the empty line first, which is t_31726070. The second pastes a slice that ends in a quote between a and b, and replaceSlice returns false and pastes nothing. Run --case on the identity for the full detail.

Tell a real bug from a modeling error before you change code:

  • Real bug. A user can make the selection and press the key, and the document loses, copies or moves text, or keeps a shape the oracle rules out. Fix the command, then run --lower.
  • Modeling error. The oracle claims one result where the spec allows another, such as a structural rule of a block type this schema does not have. Fix the oracle in the script with the spec rule that allows it, and give the rule ID in its comment.
  • Intended change. A spec change to what a command does to its lines changes the oracle too. Change the spec rule and the oracle together. Never weaken a law or add a baseline entry to get green.

Findings

The first baseline lists 2,832 findings, each with one of sixteen causes. The counts by cause add up to 2,992, because later fixes lowered the baseline without lowering them:

  • A slice that ends in a quote. replaceSlice of quote mid-line returns false and pastes nothing, as paragraph("ab") paragraph("cd") :: paste quote at [0,0]:1 shows. At a line's end its first line does not join the line, so paragraph("ab") paragraph("cd") :: paste quote at [0,0]:2 gives ["ab","X","Y","cd"], which is t_ea3f0bf2. Its open end never joins the text after the caret. 773 findings.
  • Typing, Return or paste writes into part of a read-only inline. paragraph("") paragraph("a" guard("bc") "d") :: paste lines over [1,0]:1..[1,1,0]:1 leaves the inline holding c. The spec's ownership note says these commands remove a selection through removeText, which skips the read-only test. 603 range-read-only findings.
  • Typing, Return or paste over a range with an edge in a read-only inline splits the lines. paragraph("") paragraph("a" guard("bc") "d") :: type X over [0,0]:0..[1,1,0]:1 gives ["X","d"], not ["Xd"]. 631 findings.
  • A cut at a link's edge copies an empty link. paragraph("") paragraph("a" link("bc") "d") :: cut over [1,0]:0..[1,1,0]:0 and paste it back gives a, an empty link and the link, so pasting it back splits the link. 532 range-cut-paste findings.
  • A join out of a quote whose paragraph holds an inline leaves the quote. This is t_b2ddef38. mergeNodes in merge-nodes.ts now removes the quote a join empties whatever the joined paragraph holds, so paragraph("") quote(paragraph("a" link("bc") "d")) :: Backspace at [1,0,0]:0 gives ["abcd"]. That fix dropped 138 of the cause's 152 findings, every Backspace and Delete among them. 14 findings stay counted here.
  • A slice that ends in a quote, pasted at a link's inside start, splits the link. paragraph("a" link("bc") "d") :: paste quote at [0,1,0]:0 gives a, an empty link and X, then the quote and the line bcd. Every other slice lands just outside the link. This one cannot land there, because the first cause refuses it mid-line, so the fit keeps the inside edge. 11 range-canonical findings.
  • A range from the title into the only body block does nothing. title("ab") paragraph("cd") :: Backspace over [0,0]:0..[1,0]:1 keeps abcd, and so do Return, typing and paste over the same range. 94 findings.
  • A cut of a range that hangs into the next line copies the line break it does not delete. paragraph("") paragraph("ab") :: cut over [0,0]:0..[1,0]:0 and paste it back gives an extra empty line, because deleteText unhangs the range and the slice read does not. 88 findings.
  • A range out of or into a quote at a paragraph that holds an inline does nothing. quote(paragraph("a" link("bc") "d")) paragraph("") :: Backspace over [0,0,1,0]:0..[1,0]:0 keeps abcd, and so does paragraph("") quote(paragraph("a" link("bc") "d")) :: paste text over [0,0]:0..[1,0,0]:1. 66 findings.
  • A cut across a quote's or the title's edge does not paste back in place. paragraph("ab") quote(paragraph("cd")) :: cut over [0,0]:2..[1,0,0]:0 and paste it back gives one paragraph abcd and loses the quote, and title("ab") paragraph("cd") :: cut over [0,0]:1..[1,0]:0 and paste it back adds an empty line. 42 findings.
  • Return or paste over a range that ends at the start of the empty last line keeps that line. paragraph("") paragraph("") :: paste text over [0,0]:0..[1,0]:0 gives ["X",""], where Backspace over the same range leaves one line. 40 findings.
  • Paste over a range that ends inside a link in a quote does not join the lines. paragraph("ab") quote(paragraph("c" link("de") "f")) :: paste text over [0,0]:0..[1,0,1,0]:1 gives ["X","ef"]. 20 findings.
  • A range from an inline's edge to the start of the empty last line puts the empty line first. paragraph("a" link("bc") "d") paragraph("") :: Backspace over [0,1,0]:0..[1,0]:0 gives ["","a"]. This is t_31726070. 14 findings.
  • Typing through the transaction over a range that ends at the start of the empty last line keeps that line. quote(paragraph("ab") paragraph("")) :: type X over [0,0,0]:0..[0,1,0]:0 gives ["X",""] through tx.text.insert, where the command's whole-block replacement gives ["X"]. deleteText unhangs the range, as for Return and paste above. 8 range-type-tx findings.
  • Typing, Return or paste over a range that ends at the read-only inline's inside start keeps the letters before it. paragraph("") paragraph("a" guard("bc") "d") :: paste text over [0,0]:0..[1,1,0]:0 gives ["X","abcd"] and keeps the selected a. The command unhangs the range as if offset 0 of the inline's text were the line's start, and the oracle allows that unhung form, so only the anchor on a shows it. EDIT-INLINE-READONLY-DELETE-001 says such a range is replaced with the inline included. 66 range-kept findings.
  • Backspace through the selection over the whole document keeps an empty quote. quote(paragraph("ab")) paragraph("cd") :: Backspace over [0,0,0]:0..[1,0]:2 leaves quote(paragraph("")), where EDIT-SEL-CUT-ALL-001 leaves one empty paragraph. A delete without a range that empties the whole document takes the transform's whole-block removal, which keeps the first block's type, because history cannot yet redo the command's landing after a collaborator moves or joins the kept block's content. With the range as its target the delete takes that landing, which leaves the paragraph. 31 range-block findings. The history peer-undo plan's phase 2, docs/plans/2026-11-12-history-peer-undo.md, owns that redo; once its step 17 lands, the delete without a range takes the landing and --lower removes these findings.

Bold and the echo pastes give none of them. The code baseline lists 1,297 findings. The counts below add up to 1,359 for the same reason. Of the counts, 1,121 are a cause above, because the same document with a paragraph in place of the code block has a listed finding for the same command and places, and 29 are the whole-document cause above, which also keeps an empty code block, as code("ab") paragraph("cd") :: Backspace over [0,0]:0..[1,0]:2 shows. The other 209 come from three causes of the code block:

  • A line that holds an inline never joins into a code block. code("ab") paragraph("c" link("de") "f") :: Backspace at [1,0]:0 keeps ["ab","cdef"], and a range from the code block into that line deletes its text but keeps two lines, as code("ab") paragraph("c" link("de") "f") :: Backspace over [0,0]:2..[1,0]:1 gives ["ab","def"]. The code block allows one text, so it cannot take the inline, and no spec rule says whether the join should drop the inline or do nothing. 90 findings.
  • A code block never joins into a quote's paragraph. quote(paragraph("ab")) code("cd") :: Backspace at [1,0]:0 keeps ["ab","cd"], where a paragraph in place of the code block joins. 76 findings.
  • A cut across a code block's edge pastes back with the other block's type. code("ab") paragraph("cd") :: cut over [0,0]:0..[1,0]:1 and paste it back gives two paragraphs. 43 findings.

The code-lines baseline lists 3,714 findings. 30 are the whole-document cause above. Of the other 3,684, 1,248 are a code-baseline cause, because the same document with each code block cut to its first line has a listed finding for the same command and places. Another 64 come from the join EDIT-CB-JOIN-BEFORE-001 asks for:

  • A cut into a later code block's first line pastes back as two code blocks. code("ab\ncd") code("ef\ngh") :: cut over [0,0]:1..[1,0]:1 and paste it back gives code("ab\ncd") code("ef") code("gh"). The join moves only f out of the later code block, as slatejs.org and platejs.org do, and the paste cannot put ef back in front of gh. Before the plate-private#175 fix the join moved every code line into the block before, which pasted back in place but turned the code into that block's text. A cut from the first code block's start pastes back in place.

The other 2,372 are not sorted by cause yet. The plate-private#191 fix removed 56 cut findings in documents whose code block holds a second line. Most cut from one block's start to the next block's start, such as paragraph("ab") code("\ncd") :: cut over [0,0]:0..[1,0]:0 and paste it back, and now paste back in place. Some repeat the cause of a slice that ends in a quote, such as paragraph("ab") code("cd\nef") :: paste quote over [0,0]:0..[0,0]:1. Others paste paragraphs at a code block's start and leave its lines in a paragraph: paragraph("ab") code("cd\nef") :: paste lines at [1,0]:0 gives the text abXYcd\nef with the line break inside a paragraph. The one-line twin has the same landing, which no law saw, because without a second line the text matches.

The void baseline lists 4,207 findings. The counts below add up to 4,437 for the same reason. Of the counts, 4,401 are a cause above, because the same document without the void has a listed finding for the same command and places. The other 36 come from three causes of the void:

  • Typing through the transaction over a range that ends at the start of the empty line before the void keeps that line. paragraph("ab") paragraph("") embed("") :: type X over [0,0]:0..[1,0]:0 gives ["X",""] through tx.text.insert. This is the first baseline's unhang cause for typing through the transaction, which the void reaches because the line is no longer the end of the document. 20 range-type-tx findings.
  • Backspace in the empty only paragraph of a quote right after the void removes it. embed("") quote(paragraph("")) paragraph("ab") :: Backspace at [1,0,0]:0 gives ["ab"]. EDIT-ATOMIC-BS-AFTER-EMPTY-001 names a paragraph right after the atom, not one inside a quote, so the oracle keeps the line. 10 findings.
  • Return over a range from inside the read-only inline to the start of the empty line before the void drops that line. paragraph("a" guard("bc") "d") paragraph("") embed("") :: Return over [0,1,0]:1..[1,0]:0 gives ["a"]. 6 findings.

The mixed baseline lists 37 findings, one for each Return in a text line, 13 range-lines and 24 range-tree, because Return there splits the quote instead of turning the line into a paragraph. quote("ab" paragraph("cd") "ef") :: Return at [0,0]:2, row M1, keeps the lines ["ab","cd","ef"], and Return at [0,0]:0 and Return at [0,2]:2, row M3, split the quote in two. Every Return in a paragraph passes. Step 3c of docs/plans/2026-11-23-mixed-content-lines-6.md fixes the key and empties this baseline.

The deep run compares 206,836 cases on 588 documents and finds 41,909. It ran before the code block and bold. It took 703 s at a load average near 130. None is a range-throws, range-undo or range-slot failure. It prints only the 38,702 the gate baseline does not list. Sorted by shape, all but 612 of those fall under the gate's causes, and those 612 come from two causes that need a third line:

  • A range from an empty line's start to the end of a later line removes the empty line before it too. paragraph("") paragraph("") paragraph("ab") :: Backspace over [1,0]:0..[2,0]:2 gives [""], not ["",""]. 400 findings.
  • A command that empties a quote's first paragraph also removes an empty paragraph after it in the quote. paragraph("") quote(paragraph("") paragraph("")) :: Backspace at [1,0,0]:0 gives [""], not ["",""], and Delete, Return and typing do the same. 212 findings.

It ran before the oracle let a titled caret join change nothing, so its counts include those cases.

What a pass proves

Bugs planted on this tree showed where the gate holds:

  • Run on 86be6c213f, where deleteFragment without at took the transform's whole-block removal, the gate gives 90 range-block and 16 range-at findings. quote(paragraph("ab")) paragraph("cd") :: Backspace over [0,0,0]:0..[1,0]:2 keeps an empty quote there. With the range as its target the delete gave none. A delete without a range now takes the landing when blocks stay beside the deleted ones, which removes the 16 range-at findings, and the 90 range-block findings stay as the first baseline's whole-document cause.

  • Run on f9404b833e, before 4ee5ac2467 recorded a paste from what the fitter wrote and kept, the gate gives 14 range-kept findings, such as quote(paragraph("") paragraph("ab")) :: paste Xb over [0,0,0]:0..[0,1,0]:2, which keeps the selected b. At 4ee5ac2467 it passes. Every one is a range into, out of or inside a quote. A paste over one text block shows none there. An echo with a bold X found the same 14, and a two-line echo found none.

  • A mutant where deleteText in packages/plitejs/src/transforms-text/delete-text.ts no longer asks hasEdgeInReadOnlyInline gives 683 new range-read-only findings, such as paragraph("") paragraph("a" guard("bc") "d") :: Backspace at [1,1,0]:0 deleting b.

  • A mutant where mergeNodes in packages/plitejs/src/transforms-node/merge-nodes.ts never removes the ancestor a join empties gives 394 new range-lines and 37 new range-cut-paste findings, such as paragraph("ab") quote(paragraph("cd")) :: Backspace at [1,0,0]:0 leaving ["abcd",""].

  • Reverting 03cbb1bb61 in packages/plitejs/src/transforms-node/set-nodes.ts gives 129 new range-throws findings, such as code("") code("ab") :: bold over [1,0]:1..[1,0]:2 refused with Editor element "code" at [1] allows at most 1 children.

  • Reverting 9b3552d0ca in packages/plitejs/src/transforms-text/insert-text.ts gives 69 new range-text findings, such as code("") code("ab") :: bold then type X at [1,0]:1 giving the text ab, not aXb.

  • Typing at the range's own start anchor, not at the point the removal collapses to, in packages/plitejs/src/transforms-text/insert-text.ts gives 892 range-type-at findings in --blocks=3 --lines=3 '--case=:: type X over' and none at the gate, whose two lines leave no line before a start block the range drops. paragraph("ab") paragraph("cd") paragraph("ef") :: type X over [1,0]:0..[2,0]:1 gives the lines ["abX","f"], not ["ab","Xf"], because that anchor falls back to the end of the line before.

  • Letting a write take a whole-block removal's landing in a void, as prepareAt in packages/plitejs/src/transforms-text/delete-text.ts did outside a grid, gives 80 range-void findings at the gate, such as paragraph("ab") paragraph("cd") embed("") :: type X over [0,0]:0..[1,0]:2 leaving only the void, holding X, and 80 range-lines findings for Return over the same ranges, which leave no line.

  • Running the closedQuote slice on the slice fitter from before t_fc9f1701's fix, in packages/plitejs/src/core/slice-fit/compiled-slice-fitter.ts, gives 636 findings at the gate, 588 range-lines and 48 range-text. quote(paragraph("ab") paragraph("cd")) :: paste closedQuote at [0,0,0]:1 gives the text "aXYcd", not "aXYbcd", and quote(paragraph("ab") paragraph("cd")) :: paste closedQuote at [0,1,0]:2 gives the lines ["ab","cdX","Y",""], not ["ab","cdX","Y"].

  • Running the closedQuote slice at carets inside a link on the slice fitter from before t_b960b839's fix gives 201 range-lines findings at the gate: 135 in a quoted line and 66 at a link's inside edge in a line outside a quote. quote(paragraph("a" link("bc") "d")) :: paste closedQuote at [0,0,1,0]:1 gives ["ab","X","Y","cd"], not ["abX","Ycd"], because the quote splits in three. paragraph("a" link("bc") "d") :: paste closedQuote at [0,1,0]:0 gives ["aXYbcd"], not ["a","X","Y","bcd"].

  • Running the checked paste on the slice fitter from before the plate-private#191 fix, in packages/plitejs/src/core/slice-fit/compiled-slice-fitter.ts, gives 1,066 range-props findings at the gate: 326, 88, 88 and 564 in the four gates. paragraph("ab") paragraph("cd") :: paste checked at [0,0]:1 puts the line Yb in the pasted block, with checked: true, instead of the caret line's plain paragraph.

  • A planted Enter in packages/plitejs/src/editor/insert-break.ts that also unbolds the texts beside the block it splits gives 3 range-tree findings past the mixed baseline, such as quote("a" "b"{bold} paragraph("cd")) :: Return at [0,2,0]:1, where b loses bold and merges into ab. The text and lines laws pass there.

  • On an Enter that wraps the text line in a paragraph before it splits, all 73 mixed cases pass. Planting a caret that keeps no marks on that Enter gives one range-next-letter finding, quote("a" "b"{bold} paragraph("cd")) :: Return at [0,1]:1, whose X lands without bold. The tree law cannot see it.

  • A planted Enter that splits correctly and then selects the next letter gives 12 range-next-letter findings in --light, such as quote("ab" paragraph("cd")) :: Return at [0,1,0]:1, because the typed X replaces that letter.

  • A mutant that drops the carets at a text line's start fails --light on two counts: it names the witnesses quote("ab" paragraph("cd") "ef") :: Return at [0,0]:0 and quote("a" "b"{bold} paragraph("cd")) :: Return at [0,1]:0 it did not run, and it compares 34 cases against the pin of 40.

  • Moving the bold document's mark from b to a fails --light on the three bold witnesses it no longer runs and on its 39 cases against the pin of 40.

t_96b80fff, a paste over a node selection of blocks, and t_dc841e4f, a join into an empty prefix occupant under the authored plugin, are out of reach, because no case makes a node selection and the editor here has no authored plugin.

Coverage record

Synced at test(plitejs): run the delete and paste range check over a code block and bold. The verification describes these files as they stand there:

FileWhat the check exercises
packages/plitejs/src/core/editor-commands.tsdelete, deleteFragment, insertBreak, insertText, replaceSlice, addMark and toggleMark
packages/plitejs/src/core/fragment-deleted-range.tswhat a cut copies: the text the delete removes, or the whole blocks the root's default block replaces
packages/plitejs/src/transforms-text/delete-text.tsdeletes by character and over a range, the unhang, the read-only refusal, the point a removed range collapses to and which removals take the whole-block shortcut
packages/plitejs/src/transforms-text/delete-text-whole-blocks.tsremoving whole top-level blocks and the block beside them a removal lands in
packages/plitejs/src/transforms-node/set-nodes.tsthe split a mark over a range makes, which 03cbb1bb61 keeps out of a one-text element
packages/plitejs/src/transforms-text/insert-text.tstyping with pending marks, the one-text rule of 9b3552d0ca, where typing over a range given as the target lands and the transaction's text insert
packages/plitejs/src/transforms-node/merge-nodes.tsjoins and the emptied ancestor they remove
packages/plitejs/src/editor/element-read-only.tswhich edge is inside a read-only inline
packages/plitejs/src/core/slice-landing.tsplanPaste and writePaste
packages/plitejs/src/core/slice-fit/compiled-slice-fitter.tswhere a slice's lines land
packages/plitejs/src/core/public-state.tsstate.slice.get() and the slice landing it calls
packages/plitejs/src/historythe one undo
packages/plitejs/test/support/recording-laws.tseditorFor, rootChildren and isRefusal
packages/plitejs/scripts/check-harness.tsthe flags, workers and gate
packages/plitejs/scripts/authored-documents.tsstory, which names each document
packages/plitejs/src/editor/insert-break.tsReturn, which the mixed world runs at every caret of a text line and a paragraph
packages/plitejs/src/core/content-completion.tsthe spacers and empty texts loading keeps, which the mixed world's range-canonical copies and its load check compares

To see whether the verification needs another look, find the sync commit with git log --oneline -1 --grep "range check over a code block and bold", then run git log --oneline <that commit>..HEAD -- with the table's files and packages/plitejs/scripts/delete-paste-ranges.ts. For each commit it lists, read the diff and confirm three things. A new rule for a command at a line edge, an inline or a slot is in the oracle, with its spec rule ID. A refusal the editor gives on purpose is still an EditorRefusalError. The oracle still reads the document before the command, not the editor's own result. Move the sync commit in this file forward, naming its subject, only after that check and a run of pnpm check:delete-paste-ranges.

What it does not cover

  • Plate's block plugins. Quote, list, table, code and title rules from the editing spec, such as EDIT-BQ-ENTER-EMPTY-001, live in Plate plugins that this Plite schema does not load. The table check, t_3ebc1211, owns table commands.
  • Word, line and block deletes, Delete over a range, a backward selection, and the caret after a command. Only character deletes run at a caret, and the laws read the document, not the selection, except that the mixed world checks Return leaves a caret.
  • A cut that reads the selection. The cut calls deleteFragment with its range as at, as the editable's cut does, so no law runs a cut without at. Only range-at runs Backspace both ways.
  • Whole blocks below the top level, such as the paragraphs of a quote, for range-block, and a first covered block that holds no text, such as an image or a table, which the EDIT-SEL-BS-001 note replaces with the root's default block. A range here starts at a place in a text, so its first covered block always holds text.
  • Marks other than bold, removing or toggling a mark over a range, inline voids, atoms, a block void between text blocks or in the titled world, nested inlines, named roots and a document of more than one inline. Outside the mixed world, the laws read text and lines, so they do not check which texts carry bold. Only the checked paste reads each line's block, and only at a caret in a paragraph line. The range-kept law reads letters only, so it does not see a kept line break or a kept inline that holds no selected letter, and the echo pastes skip lines that hold an inline.
  • A code block inside a quote, and Plate's code-block rules, such as EDIT-CB-ENTER-001.
  • A closed slice anywhere but a caret in a quoted line or inside a link. At the edge of a line outside a quote, the quote lands beside the line and leaves no empty half, which the oracle does not model.
  • A node selection, so t_96b80fff, and the authored plugin, so t_dc841e4f and Suggesting.
  • In the mixed world, every command but Return, a mark toggled at the caret before Return, a mixed quote with an inline, an empty paragraph or a required title, and an editor with the authored or Yjs plugin. The oracle reads the caret's text by its last path index, so a caret inside an inline element needs a change to it first. Steps 4b and 4c of docs/plans/2026-11-23-mixed-content-lines-6.md add Backspace and Delete, and its phase 2 adds ranges, cuts and paste.
  • The browser: beforeinput, the native clipboard, Plate's clipboard writer and the DOM.

/pstack:maintain-formal-verification-skill brings this verification back in line after changes that did not recheck it.

Repository

udecode/plate

Path

.agents/skills/delete-paste-ranges/SKILL.md

Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.