gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2e9b4a8e2e9b4a8evirtual-list: into main, with centerId and scrollTop/onScroll (jukebox#20)mre2e9b4a8e/reports/F3-mdvalue.md

3.9 KB

  1. # F3 — MdEditor ignores a value that changes from outside (data loss)
  2. Branch f3-mdvalue (components c2d0de5 + d58ed98). Not merged, pushed or deployed.
  3. ## Cause
  4. MdEditor 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.
  5. ## Fix (components/md-editor/md-editor.hl, pure Hybriel, no polling or re-keying)
  6. - The root carries `'data-value' = value`; at mount a `MutationObserver` on that attribute calls `followValue` (new, with `own`).
  7. - `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.
  8. - 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.
  9. - 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).
  10. - 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).
  11. ## Proof
  12. 1. 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.
  13. 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`.
  14. 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`.)
  15. 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).
  16. 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.
  17. 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").
  18. ## Limits
  19. A 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

  • 2e9b4a8evirtual-list: into main, with centerId and scrollTop/onScroll (jukebox#20)mre
  • 69954249Align all plugin sources with Hybriel day38bmre
  • f740f666Re-vendor components to Hybriel set day38bmre
  • 8176eb14Record CS23b deployment and live verificationmre
  • 84e3ddaaRemove blank line before pagination Style closing bracemre
  • a92298ddRecord exact CSS and same-date proof after specificity reviewmre
  • c71a0abePreserve consumer theme specificity with nested tag rulesmre
  • 64a2bc27Document CS23b style formatting proof and review statusmre
  • a72b57cficons: nest Style rules in the language's formmre
  • 927616e2pagination: nest Style rules in the language's formmre
  • aab8ad29code-editor: nest Style rules in the language's formmre
  • ba30727afile-upload: nest Style rules in the language's formmre
  • 42fefa4emodal: nest Style rules in the language's formmre
  • 6fd953e3range-picker: nest Style rules in the language's formmre
  • f661951ddate-picker: nest Style rules in the language's formmre
  • 363577e6media-player: nest Style rules in the language's formmre
  • 0b3fd8c9comments: nest Style rules in the language's formmre
  • 67e043c8plugins/web/README.md from hybriel cb9e480dmre
  • 519b56e9styles.hl: Style in the language's form (nested like the View, one declaration per line, bare @media)mre
  • 29f63d01md-editor: Style in the language's form (nested like the View, one declaration per line, bare @media)mre