gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit3449b1173449b117components: a startup error prints its message before exit 1 (hybriel#247)mre3449b117/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

  • 3449b117components: a startup error prints its message before exit 1 (hybriel#247)mre
  • 59704ce1Merge branch 'n5b-pipes'mre
  • 23b9164aMdEditor: a clipboard whose text is only the names or file:// paths of its files (a file manager copy) is about the files, as before; any other text wins (tickets#49); gate casesmre
  • b0f1ec28MdEditor: a clipboard with text always pastes the text, also when a picture is on it too (a spreadsheet or office app), files on or off; a picture alone still goes to the files; real Ctrl+V gate tests/md-paste-files.mjs (tickets#49)mre
  • ad4e929bMdEditor: pipe rows without a delimiter row are a table (first row = header, short rows padded, written back without an invented | --- | line) (notes#5)mre
  • 4bd11128MdEditor: the Table button's empty table is written as a real pipe table (empty cells), so it survives the source switch, a save and a reload (notes#7)mre
  • 7437e32bMdEditor draws its surface at once when claimed from server HTML: 1 ms mount animation, the first editor mounts all editors of the pagemre
  • 5de0264cRe-vendor onto Hybriel master acaceaf3 (set-day27b): binary, lib and plugins; exit 1 on a startup fault; .gitignore binmre
  • 79c77e7dMerge sb3-standby: components deploys through its standbymre
  • c5442043components: no jobs switch needed in the standbymre
  • 8d2fb24ccomponents: a standby container (port 45016, profile standby); deploy hands over through standby-swap.sh without a gapmre
  • c2834dd3Merge mr-fixes: media player state after a queue pick, Range handling, cover-less audio, accessibility labelsmre
  • 354fe3c6Media player: audio without a cover starts and shows its time (the mount tick sits on the seek bar, which every item has); the speed button names the current speed, the seek slider says its time in words; a gate page for the first render on cover-less audio and a fourth demo queue item without a covermre
  • ee4aee1eMedia player: a new queue item shows its own speed, mute, play state and time and starts when asked, also for two videos in a row; the media route reads suffix ranges and ignores range lists and garbage instead of answering 500; stronger gate checks (the 10 percent drag, the played bar, the queue tap)mre
  • 9a4f9b31Merge mp-player: media served from the committed filesmre
  • ab96e686Media route: serve the demo's media from the committed files in components/media-player (storage/ is not in git, the deploy gate found no files)mre
  • b2980734Merge mp-player: the media player (components/media-player), its demo and the media iconsmre
  • 1c41293eMediaPlayer: back / forward 10 s as replay / forward 10 icons (circular arrow with a 10), the play button keeps its surface background on audio and video, the media route's range end is a letmre
  • 9e1ab228MP: report, LOG line, STATUS entrymre
  • dd003e5dMediaPlayer: audio and video in one phone-first player (components/media-player), its demo /media-player with a queue, the media icons in components/icons, the demo's media files served with ranges (lib/media.hl), 35 gate checksmre