R4.6: inline format commands, closed after three review rounds

Component 68d33b4..1d03545 (pushed). Round-3 findings fixed with
regressions; rounds spent. Two limits recorded in the task line.

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 13:16:35 -04:00
1 parent 87886c8a8d
commit 411d32b97e
4 files changed
+36 -1

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
FAIL
- `Ely-GPUI-Components/src/documents/document/format.rs:210`: The unwrap path returns before checking protected boundaries, and merging likewise loses the original endpoints. Strong at `a *‸*bold** z` removes bold, and Link at `[a](ht‸tps://example.com)` deletes the address; both must refuse as `Across`. Strong also accepts `a *⟨*b** c⟩` and the partial other-style selection `*a⟨b*⟩` (producing `*a**b***`). Validate the original endpoints against marks and addresses before unwrapping or expanding same-style nodes, and distinguish containment in a node's body from containment including its delimiters. Reproduced in `.work/R4.6-r1-review/confirmed-probes.log`.
- `Ely-GPUI-Components/src/documents/document/format.rs:219`: Block lookup uses only the first-to-last child's content span, excluding editable trailing whitespace and positions in empty cells. Strong at `alpha ‸` returns `Outside` instead of inserting `alpha **‸**`; the empty cell in `| h |\n| - |\n| ‸ |` also returns `Outside`. Both positions satisfy the empty-pair rule. Locate the owning paragraph, heading or cell independently of its children's text span, then include its editable whitespace while excluding structural marks. Both cases fail executable probes.
- `Ely-GPUI-Components/src/documents/document/format.rs:402`: Clear only removes the node kinds handled by `marks` and HTML tags, leaving other inline `.md-meta` intact. Clear on `**a** $x‸+y$` produces `a $x+y$`, and on `a‸ [^n]\n\n[^n]: note` leaves the footnote reference unchanged. Typora's decorator explicitly marks the math and footnote delimiters as `.md-meta`; escaped punctuation's backslashes are another reproduced omission. Remove these inline marks too, retaining their content and untouched blocks, and cover them with exact-output tests.
- `Ely-GPUI-Components/src/documents/document/format.rs:175`: Underline detection requires the nearest HTML tags on either side to be `<u>` and `</u>`, so an intervening tag hides the enclosing underline. Underline at `<u>a <br>b‸c</u>` produces `<u>a <br><u>bc</u></u>` instead of removing the enclosing pair to produce `a <br>bc`; nested `<em>` reproduces the same failure. Find the enclosing matched underline pair through intervening and nested tags, rather than treating adjacent tags as the pair.
- `Ely-GPUI-Components/src/documents/document/format.rs:192`: Every format command reparses the entire file synchronously from `MarkdownDocument::format`, bypassing the existing background-read threshold and source-only size limit. An optimized probe on `"word\n\n".repeat(64000)` (384,000 bytes), formatting the first word, took 4,735 ms; parsing alone took 3,873 ms (`.work/R4.6-r1-review/timing.log`). The UI thread therefore stalls for seconds even when the command touches one word, and larger source-only files still enter the parser. Reuse a current parse or perform command parsing off the UI thread, enforcing the existing large-file guard before applying the edit.
- `Ely-GPUI-Components/src/documents/document/format.rs:225`: Blank-line detection splits only on LF. In a CR-only file, Strong at `a\r‸\rb` returns `Outside` instead of inserting `a\r**‸**\rb`. This rejects a real blank line that the Markdown parser recognizes. Detect LF, CRLF and CR consistently with the existing source-line reader, preserving the original separators; the CR case fails the probe.
- `Ely-GPUI-Components/src/documents/document/format.rs:233`: A selection spanning valid blocks reports `Outside`, contrary to the specified `Across` refusal. Strong on `⟨alpha\n\nbeta⟩` reproduces this, so the caller receives the wrong reason despite both endpoints being in paragraphs. Distinguish a selection crossing blocks from a caret outside an editable block, and assert the exact refusal in the tests.
+13
View File
@@ -0,0 +1,13 @@
FAIL
- `Ely-GPUI-Components/src/documents/document/format.rs:241`: Unwrapping still checks only the requested style's own marks, then returns before validating nested boundaries; the underline return at line 286 has the same problem. Strong at `**[a](ht‸tps://x)**` or `**~~a~‸~**` removes the outer bold, and Underline at `<u>[a](ht‸tps://x)</u>` removes the underline, instead of returning `Across`. Thus round 1's boundary defect is only partly fixed. Validate the original selection against all protected marks and addresses before either unwrap path, including partial crossings of nested styles. Four full-library regressions fail in `.work/R4.6-r2-review/probes.log`.
- `Ely-GPUI-Components/src/documents/document/format/clear.rs:32`: Every text node is scanned for escapes, including autolink text where backslashes are literal. Clear on `a‸ <https://x/\*>` produces `a https://x/*`, deleting a character that the parser retains in both the label and URL. Removing formatting must retain that literal backslash. Distinguish actual Markdown escapes from verbatim autolink contents before collecting removal ranges, and add an exact-output regression. The full-library failure and original AST are in `.work/R4.6-r2-review/clear-regression.log`.
- `Ely-GPUI-Components/src/documents/document/format/apply.rs:37`: The synchronous branch still blocks the UI well beyond PERF-02 below `AT_ONCE`. Formatting the first character of `"a\n\n".repeat(32000)` (96,000 bytes) takes 1,179 ms at P95 over 30 optimized runs of the unchanged toggle implementation on a Ryzen 9 9950X3D under WSL. This branch runs that entire parse and validation on the UI thread. Round 1's stall therefore remains for smaller documents with many paragraphs. Reuse a current parse or move expensive parsing and validation off the UI thread at these sizes too; cover this document shape rather than only one long word above the cutoff. Measurements and sample hash: `.work/R4.6-r2-review/timing.log`.
- `Ely-GPUI-Components/src/documents/document/format/apply.rs:48`: Assigning the next task to `_formatting` drops the preceding accepted command. With `"x".repeat(AT_ONCE + 1)` and the caret at byte 1, request Strong and then Emphasis before the background work finishes: both calls return `Ok(())`, but the result has only emphasis (`*xxx…*`), losing Strong. Serialize accepted commands, or explicitly refuse a new command while one is pending instead of silently replacing it. Add a regression asserting both formatting effects and their undo behavior. Reproduced by the failing two-command test in `.work/R4.6-r2-review/probes.log`.
- `Ely-GPUI-Components/src/documents/document/format/apply.rs:60`: Background refusals are logged without being delivered to the caller, so MARK-15's required explanation cannot be shown. In a source document consisting of an inline code span followed by more than `AT_ONCE` bytes of prose, Strong with the caret inside that code returns `Ok(())`; completion leaves the text unchanged and emits no document event. The same refusal is returned to the caller in a short document. Provide a completion result or event carrying `FormatRefusal`, including refusals from `apply`, so the host can explain the failure. The accepted result, empty event list and unchanged text are recorded in `.work/R4.6-r2-review/probes.log`.
- `Ely-GPUI-Components/src/documents/document/format/apply.rs:18`: The new method documentation spans three comment lines, violating the explicit one-line comment rule. Also, the new comment at `format.rs:63` contains eleven words, exceeding the ten-word limit. Reduce these comments to single lines of at most ten words, or remove them.
+7
View File
@@ -0,0 +1,7 @@
FAIL
- `Ely-GPUI-Components/src/documents/document/format/apply.rs:39`: The 16 KiB cutoff still allows a format parse followed by the visual document's synchronous reparse (`document/mod.rs:308`) in one uninterrupted UI update, so round 2's PERF-02 defect remains. In Visual mode with no open block, put the caret at byte 3 of `format!("word\n\n{}", "~*a*~".repeat(3270))` (16,356 bytes) and toggle Strong. Thirty full-document calls measured 234 ms P95 with the component and parser optimized; all 30 emitted `Parsed` before yielding. A separate release build of the unchanged toggle plus just the subsequent parser call took 133–144 ms, excluding rendering and reader conversion. Budget the complete update, reusing a valid parse or moving expensive work off the UI thread, and cover this visual-mode case. Evidence: `.work/R4.6-r3-review/optimized-probes.log`, `timing-confirm.log`, and `review.log`.
- `Ely-GPUI-Components/src/documents/document/mod.rs:44`: Lowering the shared cutoff makes previously synchronous initial reads preserve the rendered end placeholder's scroll anchor when `adopt` inserts the document's blocks. Opening `format!("alpha beta\n\n{}", "x".repeat(20000))` directly in Visual mode now finishes at line 2 near the bottom of the second block, with the first block offscreen. The same test passes at line 0 with the first block visible when only `AT_ONCE` is restored to its previous 128 KiB value. Preserve the initial or requested document position when the first asynchronous read replaces the placeholder, and add a visual-opening regression between the two cutoffs. Evidence: `.work/R4.6-r3-review/optimized-probes.log` and `previous-cutoff.log`.
- `Ely-GPUI-Components/src/documents/document/tests/format.rs:3`: The new `std::time::Instant` import violates the component's explicit `web_time::Instant` rule and fails the mandatory time-source check in `scripts/check.sh`. Running that exact scan on the unmodified checkout identifies this line and returns the house-rule failure. Use `web_time::Instant` in the timing test. Evidence: `.work/R4.6-r3-review/house-rules.log`.