components
All repositories: gitoria
3.9 KB
# F3 — MdEditor ignores a value that changes from outside (data loss)Branch f3-mdvalue (components c2d0de5 + d58ed98). Not merged, pushed or deployed.## CauseMdEditor builds its contenteditable surface once (mdMount, from the hidden field) and the framework never repaints it. hl:web hands kept offline state (rehydrate) and pushes from other devices to the host as ordinary writes of the bound member `value` (Arachne: no way to apply kept state before the children mount). Only the hidden `<input value>` followed; the surface kept the old text, so the next key wrote OLD text + key back (saved `20` + `5` became `25`, not `205`). Seen at CPU throttle 6 where rehydrate lands after the 100 ms mount.## Fix (components/md-editor/md-editor.hl, pure Hybriel, no polling or re-keying)- The root carries `'data-value' = value`; at mount a `MutationObserver` on that attribute calls `followValue` (new, with `own`).- `mdSeen` = every value the editor loaded or wrote itself since the last outside change (capped at 300000 chars; the first entry stays). A value not in it is OUTSIDE: `load()` into the surface, the source textarea and the field follow, caret to the end if focused.- A value that is in it is an older text of the editor itself handed back (the host answers with the server's version while the user has typed on; the row of a new note first shows its empty text). It is not news: the surface is kept and `sync()` writes it back. My first version loaded such values and lost typed keys (notes gate, throttle 6: "tables: typed to the end" timeouts; MDOUT log showed `v=""` with 150 own values); this is the "unless the user has typed since" rule.- Demo buttons `#md-outside`, `#md-stale` + 12 new gate checks `f3:` (outside value shown, field/source follow, first keys continue from it, 36 fast keys kept, second outside change, source view open, older text handed back keeps typed text).- notes, tickets, layouts: verbatim copy of md-editor.hl, branch f3-mdvalue in each worktree (notes 0516b4c, tickets 138d198, layouts badc187; notes also tests/e2e-outside.mjs).## Proof1. Components gate (COMPONENTS_GATE_PORT 8740): new 492/0 (runs: 491/1 flaky comments push check once under load 36, then 492/0 ×2); main code with the new tests: the f3 checks FAIL (surface `<p><br></p>`, 202 passed / 3 failed, then crash). Main with its own tests: 480.2. F2 repro (notes copy, .scratch/f2-mdvalue/run.mjs, waits for hydration): old `{"field":"after","shown":"before"} BUG`; new `{"field":"after","shown":"after"} OK`.3. Notes browser gate: HL_CPU_THROTTLE=6 old: 68/1, 57/1 (crash, load), 68/1 — "tables: offline" fails 2 of 3. New (final code) 5× 69/0. Normal speed new 3× 69/0. (An earlier version of the fix failed 3 of 3 throttled runs at table typing; fixed by `mdSeen`.)4. Deploy gates new == main, 0 failed: components 492/0 (480 + 12 new); notes 69/0 + theme 21 files 0 problems; tickets browser 386/0, events 52/0, theme 45/0; layouts browser 310/0, theme 43/0 (same on main).5. Real browser E2E on lisbeth (tests/e2e-outside.mjs in the notes branch, copy of the newest backup, lock rules kept, tunnel -L 8745 -R 8744, tab put back to about:blank): a note with a table open, another device saves qty 20 + a line (API, same login, live push), click the cell, End, type 5. Old: surface keeps `2`, field `25`, server `25` and the other device's line lost (390 px). New: 13/13 at 390 and 1280 px, surface shows 20 + new line, field and server `205` + the line.Screenshots (/media/STORAGE/claude-scratch/atlas/F3/shots/): old-390-1-open, old-390-2-after-push (stale `2`), old-390-3-typed (`25`), old-1280-*; new-390-2-after-push, new-390-3-typed (`205`), new-1280-3-typed (`205`, "Changed on another device").## LimitsA genuine outside value identical to a text the editor held earlier since the last outside change (e.g. another device reverts to it) is not loaded: the editor's text wins and is written back. Arachne's 400 ms-slow-kept-read case is covered by the `#md-outside` check (a later write to the bound member).
Branches
Latest commits
- ba96735ficons: README, md-editor README note, gate checks for the single focus ring and toolbar iconsmre
- 96c97691icons: shared Icon component; md-editor toolbar and files-upload remove use it; no inner focus ring in md-editormre
- 0d6863d6reports/F3-mdvalue.mdmre
- d58ed98bMdEditor: an older text of the editor handed back is not an outside change (kept surface, written back); gate for itmre
- c2d0de59MdEditor: show a value that changes from outside (data-value observer), demo button and gatemre
- c4272fa3re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- 2e22618etests: cdp-blank/md-bg/md-keys-run Chrome range and base port from env (MDK_CHROME, MDK_PORT), defaults unchangedmre
- a5d2384bre-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- 52902d23docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
- 022b943fdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
- d17f8543mission 012: re-vendor Hybriel master f9614007 (plugins), fixes comments push redraw; gate 480/0mre
- 5f95de05mission 012: re-vendor Hybriel ce6f2e0a (plugins), report: gate 478/2 on comments push redrawmre
- 3794c591mission 011: report, LOG, STATUS, md-keys-run widths, cdp-blank helpermre
- 77a93c16mission 011: gate hook for md-keys (480/0), flatten() runs one at a time (removeChild race), surface also built on first focus / pointer-down (background tab), md-bg test, README keysmre
- 3c906718mission 011: md-editor key tests (real keys) and fixes: nested p/ul flatten, bare br, link change, Ctrl+E, code block exit (WIP)mre
- 1442e583mission 010: report, LOG, STATUSmre
- 6f27ad31md-editor: phone toolbar row contained (inline-size) so it never widens a grid parentmre
- d702d76dmd-editor look: root class md-empty (a host .empty rule hit it), rows = surface height, one phone toolbar row with 44 px targets; comment form rows 3; gate 360/0mre
- 15be2ac0comments: attach (FilesUpload pick), onPost(text, files), files per comment; md-editor files=off; README, gate fixmre
- 1f8d79d6comments (mission 009 WIP, tickets#27): attachments — attach="true" puts the form in FilesUpload pick mode, onPost(text, files), files per comment (thumbnails open full size, file rows, no url = no link); MdEditor files="off"; demo with attachments; gate m009 checks (WIP: 356/1)mre