Repository navigation
fix(studio): a sealed preview edits text over 200,000 characters in place, as unsealed does - #9074
Conversation
…ine text in both modes
…lace, as unsealed does
…ecks the error says why
…' into test/sealed-parity-long-text
…ng-text # Conflicts: # packages/studio/src/hooks/inlineTextTyping.browser.test.ts
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at bc004b0. No blocker.
Read whole: the diff (7 files, +43/-16), textMarkup.ts, and the event parsers in textEdit.ts. Read as hunks: editElement.ts, the three test files, the manifest. Nothing was run; one string search over core, studio and studio-server for the remaining 200,000 bounds.
Checked:
- Every length check on text markup between Studio and the frame now uses
MAX_TEXT_MARKUP:isEditableText,isTextMarkup, thehtml/expectfields ineditElement.ts, andhtml/previouson an ended edit. No text markup check is left on the old bound, so open and close of an edit cannot disagree. - Style and attribute values keep 200,000 (
MAX_EDIT_VALUEineditElement.ts,restoreAttributes.ts,setAudioGroupAttribute.tsuntouched). - The markup rule itself (
holdsOnlyTextMarkup: text tags, plain attributes) is unchanged; only the length moved. - 32 MiB matches
MAX_TEXT_READ_BYTESinstudio-server/src/routes/files.ts. - The "fails without the fix:" line is in the body and names the test; the new case runs in both modes and compares saved, written and shown text. The refusal tests moved to one past the new bound, so the refusal path is still covered.
- The manifest edits only the
inline-text-longrow and its name matches the new case.
Non-blocking:
- The bound counts string length (UTF-16 units) while the server cap counts bytes, so non-ASCII text can pass here and still make a file the server will not read back as text. The two ceilings are equal only for ASCII; a comment on
MAX_TEXT_MARKUPwould keep that from surprising anyone. - Studio now parses up to two strings of this size (
html,previous) into a template for each ended edit the frame reports. Fine as a ceiling; if this event can ever arrive without an edit Studio opened, that cost is worth a guard. - The two refusal tests now build strings over 32 MiB in the DOM stand-in; watch their run time in CI.
Need: yes · Size: small · Reuse: one constant beside the existing one · Simpler: no · Structure: fine
Risk: low; larger messages across the frame boundary, same markup rule.
— Rames
|
Thanks. On the non-blocking notes:
|
Edit accuracy: accurate 275 (base branch 273), smooth 66 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) |
|
Durations from this head's CI, and one correction to my last comment:
|
What
A sealed preview now edits text over 200,000 characters in place, as the unsealed preview does. Until now a sealed preview would not open a text edit on such an element, and would refuse a typed result that grew past 200,000 characters.
inline-text-long: words typed after a text of 249,999 characters save and show, in both modes.main; on this branch 21 of 35.Why
Studio may only seal its preview by default once every behaviour works the same in both modes. #8183 recorded this one as a known sealed-only gap: 200,000 characters was the bound on text markup between Studio and the sealed preview, and the unsealed preview has none. The unsealed save path has no limit of its own: the element patch route takes any body, and the real ceiling is the 32 MiB a file may have for Studio to read it as text (
MAX_TEXT_READ_BYTESinpackages/studio-server/src/routes/files.ts). The text-markup bound is now that same ceiling, so both modes stop at one size. Style and attribute values keep the 200,000 bound.Related work
Follow-up to #8183, #9058 and #9064.
How
textMarkup.ts:MAX_TEXT_MARKUP(32 MiB) next toMAX_EDIT_VALUE. Every check on text markup between Studio and the frame uses it:isEditableText: may the frame open an edit on this element.isTextMarkupand thehtml/expectchecks ineditElement.ts: the markup Studio sends the frame.html/previouschecks on an ended edit intextEdit.ts: the markup the frame sends Studio.inlineTextTyping.browser.test.ts:typeAndEndtakes the element's markup; a new both-mode case types after a 249,999-character text.textEdit.test.tsandinlineTextEdit.sealed.test.ts: the refusal cases now go one past the new bound.Test plan
fails without the fix: "words typed after a sealed text over 200,000 characters save" (
packages/studio/src/hooks/inlineTextTyping.browser.test.ts) times out before the fix: the sealed edit never opens. The unsealed case passes before and after.With the fix, on the devbox: the new file 6 of 6 per mode. Core
textEdit.test.tsandeditElement.test.ts: 41 of 41. StudioinlineTextEdit.sealed.test.ts: 61 of 61.tsc --noEmitinpackages/coreandpackages/studio: exit 0.Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug
No visible change
A sealed preview now edits long text as the unsealed preview already does. Nothing on screen changes for text under 200,000 characters.