R4.7: block commands, reviewed three rounds, round-3 fixes in component 0558f0c

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-14 15:04:10 -04:00
1 parent 135002fda9
commit 91e54b5f48
4 files changed
+72 -1

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
FAIL
1. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/insert.rs:32` — Inserting a block can panic at valid source carets in heading syntax. On `# alpha`, put the caret at byte 0 and run `Rule`: `back` slices `text[2..0]`. A caret within the closing hashes of `# alpha ###` similarly panics in `forth` at line 44. The heading body bounds exclude these valid caret positions, but the splitter assumes the selection is inside them. Validate/map syntax positions before slicing, or return an explicit refusal. Both paths were reproduced in `probes.log`.
2. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:190` — Converting a mixed GFM list to a task list clears existing completion states. With `- a\n- [x] b`, run `TaskList` on `b`: the result is `- [ ] a\n- [ ] b`. `marker` always emits an unchecked box. Typora's task conversion sets item style without clearing `checked`; this command is not a task-status command. Preserve existing checked values when adding task markers to the other items.
3. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/quote.rs:70` — Unwrapping a nested alert deletes its enclosing list item's opener. On `- > [!NOTE]\n > a\n- b`, run `Quote` on `a`: the output is ` a\n- b`, which markdown-rs reads as a top-level paragraph followed by a one-item list. Deleting the complete marker line also deletes the outer `- `. Remove only the alert's own marker and transfer any enclosing container opener to the surviving content.
4. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/insert.rs:304` — Splitting a paragraph ignores inline syntax crossing the caret. Insert `Rule` between `b` and `c` in `**abcd**`: the result is `**ab\n\n---\n\ncd**`, so both fragments lose bold and display literal asterisks. Typora's `splitAt` uses `smartSplit` to close and reopen inline pairs. Preserve those pairs across the inserted block, and explicitly refuse boundaries that cannot be split safely.
5. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:188` — Retyping a list consumes first-line code indentation as marker whitespace. `- code` contains an indented code block, but `OrderedList` produces `1. code`, whose item contains ordinary prose. The replacement removes every space after the marker, although CommonMark treats excess spaces as content indentation. Retain that excess indentation while replacing the list marker and adjusting continuation lines.
6. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/insert.rs:331` — `ParagraphBefore` detaches the first paragraph from its list item. On `- a`, it produces `- \n\n a`; markdown-rs reads an empty list followed by a top-level paragraph, rather than retaining `a` inside the item. The existing test checks this exact string without checking its parsed structure. Handle a first child's container opener when making room, or refuse an unrepresentable insertion; preserve the original list membership.
7. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/insert.rs:390` — Deleting a block can merge untouched neighboring paragraphs. In `p\n# h\nq`, delete the heading: the result is `p\nq`, one paragraph instead of the original two surrounding paragraphs. The deletion removes the only block boundary and never checks the resulting adjacency. Leave a separating blank line when removing the block would otherwise join its neighbors.
8. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/heading.rs:107` — Turning prose into an ATX heading can remove visible text. `Heading(1)` on `alpha #` writes `# alpha #`; markdown-rs now treats the final hash as a closing delimiter and the heading text becomes only `alpha`. Protect literal text that acquires heading-syntax meaning when adding the opening hashes, and verify the parsed heading text remains unchanged.
9. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/heading.rs:133` — `Paragraph` can create another block type instead of a paragraph. On `# - alpha`, removing the heading marker produces `- alpha`, a list item. Only removing the old syntax is insufficient when the remaining text is a block opener. Escape newly active block syntax while preserving the heading's inline content so the result actually parses as a paragraph.
10. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/quote.rs:111` — Quoting a task item's first paragraph reports success but creates no quote. `Quote` on `- [ ] a` produces `- [ ] > a`; markdown-rs reads the task's text as literal `> a`, with no blockquote. This is the same GFM first-line restriction already handled for heading commands. Produce a valid nested block without changing the task, or return an explicit refusal instead of inserting an ineffective marker.
11. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/insert.rs:282` — Inserting at the start of a task item's text also treats that text position as a block boundary. On `- [ ] ab`, put the caret before `a` and run `Rule`: the output is `- [ ] ---\n\n ab`, containing no thematic break. `CodeBlock` there similarly puts the opening fence in task text rather than creating the requested code block. Check this boundary before writing block syntax; preserve the task and emit a real block, or refuse explicitly.
12. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:47` — A selection starting in a list item bypasses sibling-range handling even when it ends outside that list. In `- a\n\nb`, select from `a` through `b` and run `OrderedList`: only the first list is retyped to `1. a`; the selected paragraph `b` is left outside. Determine the selection's common holder before taking the existing-list shortcut, and apply the command to all touched siblings as required by the accepted selection rule.
13. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/heading.rs:21` — Selecting the current heading level incorrectly toggles it to a paragraph. `Heading(2)` on `## alpha` removes its heading. Typora's actual Paragraph menu calls `changeBlock(e)` with one argument; its same-level toggle requires a truthy third argument, so the menu leaves this heading unchanged. Executing the extracted function with that menu call confirmed zero mutations (`typora.log`). Make explicit heading-level commands idempotent, and correct the test and AGENTS.md claim that currently require the toggle.
+25
View File
@@ -0,0 +1,25 @@
FAIL
1. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/split.rs:102` — Reopening an inline format can turn its text into block syntax. In `~~ab~cd~~`, insert `Rule` between `b` and the literal `~`: the result is `~~ab~~\n\n---\n\n~~~cd~~`. The last line becomes an opening code fence, so the visible `~cd` disappears. The new seam copies delimiters without checking how they combine with neighboring text. Escape the newly adjacent literal delimiters, or refuse an unsafe split; verify that both fragments retain their text and formatting. The same issue changes which underscores are bold in `__ab_cd__`.
2. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/heading.rs:91` — The paragraph-opener check includes closing heading hashes that the edit subsequently removes. `Paragraph` on `# --- ###` succeeds with `---`, a thematic break; on `# [x]: /u ###` it produces a link definition and the displayed text disappears. Both original suffixes parse as prose while the closing hashes remain. Check the actual retained heading body, excluding closing syntax, before deciding whether to escape or refuse it. This leaves round-1 F9 incomplete.
3. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:193` — Checked-state preservation only handles a checkbox on the opener's physical line. `TaskList` on `1.\n [x] a` produces `- [ ] \n [x] a`: markdown-rs changes the checked item to unchecked and makes `[x]` part of its text. Preserve the parsed item's checkbox even when its first paragraph starts on a continuation line, without adding a second box. This leaves round-1 F2 incomplete.
4. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/quote.rs:77` — Unwrapping an alert with a lazy continuation concatenates that line's indentation with the retained outer opener. `Quote` on `- > [!NOTE]\n a` produces `- a`, turning the original paragraph into indented code. With an enclosing quote, `> > [!NOTE]\n> a` becomes `> > a`, retaining the quote that was meant to be removed. Transfer the surviving content after consuming its enclosing-container prefix and appropriate continuation indentation. The explicit-prefix regression test does not cover this branch.
5. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/quote.rs:76` — Leading blank lines in an alert can still detach its body from the enclosing item. `Quote` on `- > [!NOTE]\n >\n >\n > a` writes `- \n \n a`; markdown-rs reads an empty list followed by a top-level paragraph. The splice only transfers the first following line, even when that line is blank. Preserve the item's membership when removing the marker and leading quote-only lines, or refuse the unrepresentable edit. This is another unhandled case of round-1 F3.
6. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/quote.rs:79` — Alert removal assumes the decoded marker ends at a physical newline. The existing `alert` reader recognizes `> [!NOTE]&#10;a` as a NOTE whose body is `a`, but `Quote` deletes the entire document because there is no following source line. Locate the marker's actual source extent using the same decoded interpretation, or refuse without editing; never remove the surviving body. The probe confirmed the reader's body before asserting the failed unwrap.
7. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:201` — Retyping still loses code indentation when marker whitespace contains tabs. `OrderedList` on `-\t\tcode` produces `1. \tcode`, changing its child from `Code("code")` to a paragraph. Removing a whole tab also removes its excess columns, and the remaining tab reaches a different stop after the new marker. Preserve indentation in columns, including the unused part of a consumed tab, and account for the new marker width. The spaces-only F5 regression misses this case.
8. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:201` — Converting an item with first-line indented code to a task list reports success while discarding the code block. `TaskList` on `- a` writes `- [ ] a`, parsed as task paragraph text rather than code. Keeping the spaces does not preserve code after a GFM checkbox. Retain the original child block in a representable task-item structure, or explicitly refuse this conversion as the other task-first-line commands do; add a task-list case to the code-preservation regression.
9. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/insert.rs:304` — Deletion's join check still counts container openers that the deletion removes. In `p\n> # h\nq`, delete `h`: the result is `p\nq`, merging two untouched paragraphs. `joins_before(..., None)` sees the quote opener on the deleted line and suppresses the separating blank. Determine adjacency from the surviving prefixes and blocks, excluding openers removed with the target. The root-level heading test passes, but round-1 F7 remains for nested blocks.
10. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/heading.rs:216` — Literal closing hashes are protected only by `to_heading`, leaving other paths that create ATX boundaries destructive. `Heading(3)` on `alpha #\n===` writes `### alpha #`, whose visible text loses `#`. Likewise, `split.rs:145` turns `# a # b`, with `Rule` inserted after the interior `#`, into `# a #\n\n---\n\n# b`, losing that literal hash. Apply the closing-hash protection whenever a heading line is created or shortened, and assert its parsed text. These leave round-1 F8 incomplete.
11. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/split.rs:159` — Splitting a paragraph leaves newly active block openers unprotected in the surviving fragment. Insert `Rule` before `-` in `a - b`: the output is `a\n\n---\n\n- b`, so the original paragraph text becomes a list and its literal dash becomes syntax. The command should split the paragraph while retaining its content. Escape a fragment's newly active block syntax, or refuse if it cannot be represented safely, and test the resulting block kinds and text.
12. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/heading.rs:89` — Four added comments exceed the explicit ten-word limit: this line, `block/list.rs:173`, and `block/split.rs:1` and `:69` each contain eleven words. For example, “The byte to escape if `at`'s line would open a block.” is eleven. Shorten each to at most ten words while retaining its single-line form.
+19
View File
@@ -0,0 +1,19 @@
FAIL
1. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/check.rs:59` — The reread comparison discards all whitespace, including literal whitespace inside code. `Heading(3)` on ``a `x\n y`‸\n===`` succeeds, changing the inline-code value from `x\n y` to `x y`. The real MarkdownReader comparison also fails: this changes the code while merely changing the heading level. Preserve significant whitespace when joining the heading, or refuse as `Misread`; the verification must compare it instead of filtering it out.
2. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/check.rs:38` — The signature compares raw mdast nodes rather than the text and formats the component displays. Inserting `Rule` at `<u>ab‸cd</u>` succeeds with `<u>ab\n\n---\n\ncd</u>`, but MarkdownReader now renders `cd` without underline. Changing the first line of `<u>a‸\nb</u>` to a heading has the same loss. Likewise, splitting `x:smile: ‸:smile:` changes the second literal shortcode into an emoji. Verify the fragments through the same reader used for display, preserving its text and inline formats, or refuse the unsafe edit.
3. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/quote.rs:93` — Alert unwrapping strips the surviving body's significant indentation. `Quote` with the caret in `code` in `> [!NOTE]\n>\n> code` succeeds with `code`, changing the alert's indented code block into a paragraph. An indented fenced block also changes its code value because only its opening line loses the indentation. Preserve the body's indentation relative to the removed quote, consistently across its lines, or refuse if its block kind and code value cannot survive.
4. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:214` — Retyping identifies a fence from the code's literal contents after discarding its indentation. `OrderedList` on ``- ```lang‸`` writes ``1. ```lang``: the original code value, three backticks followed by `lang`, becomes an empty fenced code block with language `lang`. Determine whether the original block is fenced from its source structure and indentation, not whether its content starts with backticks or tildes; retain the parsed code value.
5. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:220` — Code padding counts every Unicode whitespace character's UTF-8 bytes as indentation, then leaves that character in the source as well. For `-` followed by five ASCII spaces, U+00A0, and `code`, `OrderedList` adds two ASCII spaces to the parsed code value: `\u{00A0}code` becomes ` \u{00A0}code`. Count actual indentation in columns and preserve non-ASCII whitespace as code content; do not duplicate its byte length as spaces.
6. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:205` — Removing a task checkbox can activate block syntax in the retained paragraph. `BulletList` on `- [x] ---` succeeds with `- ---`, which parses as a thematic break: both the list and its displayed text disappear. `- [x] # h` similarly becomes a heading inside the item. Escape the newly active opener or refuse the conversion, and verify that removing the checkbox preserves the child's text and block kind. List retyping does not preserve these by construction.
7. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/list.rs:149` — The continuation-line checkbox fix covers retyping but not unwrapping. `TaskList` on `-\n [x] a` toggles the task list off and produces `[x] a`, making the former checkbox literal paragraph text; the equivalent same-line task unwraps to `a`. Remove the parsed checkbox on its own physical line when unwrapping, as well as the list opener and continuation indentation.
8. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/heading.rs:71` — The new guard requires a parsed paragraph node even when the valid result is an empty paragraph. `Paragraph` on `# ‸` now returns `EditRefusal::Misread` instead of removing the heading marks. Empty paragraphs have no mdast node, so `block_at` necessarily returns `None`. Recognize this valid empty result while continuing to reject results that actually reinterpret retained content.
9. `C:/Users/zhang/Documents/Github/Ely-GPUI-Components/src/documents/document/block/quote.rs:75` — The same-line alert guard rejects safely removable markers that the existing alert reader decodes. `> \[!NOTE]\n> a` is recognized as an alert with body `a`, but `Quote` now returns `Misread` because the raw marker does not start with `[!`. Its marker occupies a physical line of its own; the decoded-newline refusal does not apply. Identify the marker using the reader's decoded interpretation and distinguish a marker-only line from a line that also contains body text.