Skip to content

webroot: batch and lazy-load backup-list icons - #25

Draft
ash-iir wants to merge 1 commit into
mainfrom
fix-backup-icons
Draft

ash-iir wants to merge 1 commit into
mainfrom
fix-backup-icons

Conversation

@ash-iir

@ash-iir ash-iir commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

WebUI #4. renderBackups called loadBackupIcon for every row, and each one ran backup-icon (one root process) with no batching, no lazy loading and no in-flight dedupe. renderBackups runs again on every debounced search keystroke, select toggle and select-all, and the manager bridge serializes exec, so this queue blocked progress polling. Any failed call (including ERR_PARSE) cached "0" for that ref forever.

  • helper.sh: new backup-icons verb, {refs:[...]} → {ok:true, icons:{<ref>: <b64 or "">}}. "" means the manifest has no icon; invalid refs (same ref_root check as backup-icon) and refs without a manifest are left out. backup-icon stays. Documented in docs/AI-AGENTS.md.
  • scripts.js:
    • Backup rows set data-bref and are observed by the existing iconObserver; loadIcon hands them to loadBackupIcon. renderBackups unobserves its previous icons like the job/blocklist pickers do.
    • loadBackupIcon queues refs and flushBackupIcons sends them in batches of ICON_BATCH (same timer pattern as flushIcons). A ref already in flight is not requested again; icons from re-renders wait on the same request.
    • Only refs present in the answer are cached ("" → "0"); a failed or partial answer leaves the rest uncached so they are retried later.

Testing

  • node --check on scripts.js; sh -n, mksh -n, busybox sh -n on helper.sh; shellcheck -s sh: one more SC2016 note (jq $r in single quotes).
  • Playwright mock harness (shoot.py's fixtures with a call-recording mock, bundled headless Chromium), 60 backups, 3 search edits, scrolling through the list, then another search edit:
    • main: 60 backup-icon calls.
    • this branch: 0 backup-icon, 3 backup-icons calls for the 38 rows that came into view; one ref the mock left out of the first answer was requested again once and then cached; no page errors. Same in Arabic (RTL).
  • The real backup-icons verb (helper.sh copy with the backups root pointed at a temp dir), under mksh, busybox ash and dash: icon and no-icon manifests answer "QUJD" and ""; /etc/passwd, a .. ref and a non-string are left out.
  • Not tested on a rooted device.

The backup list started one backup-icon helper call per row on every
render (search keystroke, select toggle), and any failed call cached
"no icon" for that backup for good.

- New backup-icons helper verb: {refs:[...]} -> {ok, icons:{ref: b64
  or ""}}, one process per batch.
- Backup icons load through iconObserver like app icons, in batches of
  ICON_BATCH, with one in-flight request per ref.
- Only an answered ref is cached; "" caches as no icon, a failed call
  is retried on a later render.

Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant