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
- b27b
- mainmain branch
- vl27-resetkey
Latest commits
- a06fc778Reset virtual-list window when the host changes resetKeyAtlas
- 3aab598cRe-vendor complete Hybriel day73 set for virtual-list resetAtlas
- 337ca075MD1 gate check measures frames in the page, not milliseconds from outside, and takes the middle load (components#30)mre
- f5f131c5Record AP29 autoplay comparisons and passing gatesmre
- 51c38187Gate media autoplay on first load and after client mountmre
- a3f2223dRecord successful B44 deployment and live proofmre
- 06c1e021Record passing B44 browser rerunmre
- c9861533Record B44 component proof and browser gate blockermre
- 1b7413beIgnore detached media events and space demo option outputsmre
- ca3b4959Re-vendor complete Hybriel plugins and runtime to day44mre
- df9e7df9Last-item checks run in the browser gate (components#26 fixed on day41); media-player loop is a plain Booleanmre
- 895a5afcRe-vendor complete Hybriel plugins and runtime to day41mre
- 16006bb3Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 88397fc3Re-vendor complete Hybriel plugins and runtime to day39mre
- 9b872cedRecord IC28 deployment and live icon verificationmre
- 46fefaa7Count the icons entry in the offline home-page checkmre
- c7e14cabRecord IC28 rerun and unchanged-main baseline comparisonmre
- 5e090ffdRecord IC28 review evidence and gate resultsmre
- adfe2c4dAdd shuffle, repeat and repeatOne shared iconsmre
- c96709c8media-player: skip = false and repeat = 'one' options (jukebox#19)mre