S009: updates, perf and idle-CPU smoke tests; FEATURES, PROGRESS, INDEX

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-12 14:41:08 -06:00
commit 3b76b302eb
9 changed files with 88 additions and 12 deletions

View file

@ -14,11 +14,11 @@ Verify Discord Rich Presence, media session and visualizer, spell check, update
- [x] Discord: fake IPC server on a temp socket (`XDG_RUNTIME_DIR` throwaway) that logs frames; check handshake and activity updates from a local media page
- [x] Media: a local page with `<audio>`/`<video>` (bundled test file); check now-playing data, mute, PiP, visualizer levels (simulated if no cava)
- [x] Spell check: misspelled word in a textarea gets suggestions in the context menu
- [ ] Updates: point the update URL at a local JSON file; check the notice and that nothing downloads automatically
- [ ] Gamepad: check it enumerates without a device and doesn't spin the CPU; single instance: second launch forwards a URL
- [ ] Performance: freeze/discard idle tabs and memory saver numbers; mark FEATURES rows verified/broken
- [x] Updates: point the update URL at a local JSON file; check the notice and that nothing downloads automatically
- [x] Gamepad: check it enumerates without a device and doesn't spin the CPU; single instance: second launch forwards a URL
- [x] Performance: freeze/discard idle tabs and memory saver numbers; mark FEATURES rows verified/broken
- [x] R4-09 Discord site icon: `icon_url` in `src/discord.rs` (https image/favicon, else the origin's /favicon.ico) is written, **not compiled yet**; build, run `nice cargo test --release -j 2 icon_prefers`, see the icon in the fake-IPC `SET_ACTIVITY` frame (`assets.large_image`), user confirms in real Discord; app ID stays in Settings, never in code
- [ ] PROGRESS entry, INDEX line, commit `S009: …` and push
- [x] PROGRESS entry, INDEX line, commit `S009: …` and push
## End criteria
- Integration scripts pass via `tools/smoke.sh`.

View file

@ -15,7 +15,7 @@ Tracker: https://claude.ai/artifact/9AD7fPfwJ4ASFzVTJGKU4h
- [x] [S006 — Browser basics pass](02%20Verify/S006-verify-basics.md) · Opus medium
- [x] [S007 — Network pass](02%20Verify/S007-verify-network.md) · Opus medium
- [x] [S008 — Stores and pages pass](02%20Verify/S008-verify-stores.md) · Sonnet high
- [ ] [S009 — Integrations pass](02%20Verify/S009-verify-integrations.md) · Sonnet high
- [x] [S009 — Integrations pass](02%20Verify/S009-verify-integrations.md) · Sonnet high
- [ ] [S010 — Phase 2 review with the user](02%20Verify/S010-phase2-review.md) · Sonnet medium · 🧑
## 03 Gaps

View file

@ -25,7 +25,7 @@ Every item of the settings screenshot and of the original Nacre's `config.py`, w
| QR code for page | `ui/menus.rs` | verified S006 (keys.txt shot) |
| Task manager, free up memory | `ui/pages/misc.rs` | verified S006 (task manager opens: keys.txt); free memory not checked |
| Keyboard shortcuts, rebindable | `keys.rs`, settings | verified S006 (every action by `do` in basics.txt + keys.txt except save page, print, incognito, quit; key parsing unit test); rebinding not checked |
| Gamepads (W3C standard mapping), Web Bluetooth device picker | `app.rs poll_gamepads`, `ui/dialogs.rs` | not checked in S006 (no device in tests); rumble reports unsupported |
| Gamepads (W3C standard mapping), Web Bluetooth device picker | `app.rs poll_gamepads`, `ui/dialogs.rs` | verified S009 (integ-perf.txt, integ-idle-cpu.sh): `navigator.getGamepads()` exists and lists nothing without a device, idle CPU 0 %. Not checked: a real device (S010 list); rumble reports unsupported |
| Notifications (notify-send or in-app) | `app.rs` | permission asked, remembered, denied/granted to the page verified S008 (site-memory*.txt); showing the notification itself (notify-send) not checked |
## General (screenshot)
@ -36,7 +36,7 @@ Every item of the settings screenshot and of the original Nacre's `config.py`, w
| Home page | written |
| Search engine (+ custom engines, suggestions) | written |
| Profiles (list, add, delete, open) | written |
| Spell check (languages, dictionaries downloaded, suggestions, add word) | written (`spell.rs`, SPELL_JS) |
| Spell check (languages, dictionaries downloaded, suggestions, add word) | verified S009 (integ-spell.txt, tiny offline dictionary): wrong words underlined, the context menu on one lists suggestions, choosing one replaces the word. Fixed: the menu got no word in text fields (S009). Not checked: download of a dictionary, add word, several languages, the settings page |
| Keyboard shortcuts | written |
| Import from another browser (Chromium/Firefox families; bookmarks file; passwords CSV) | verified S008 (stores-import.txt on fake Chrome + Firefox profiles in a throwaway home: bookmarks, folders, history, home page, search engine; bookmarks HTML and passwords CSV: stores-lists.txt, stores-vault.txt through the store, not the file dialog); no importer for the old Python Nacre's JSON stores; Windows paths not checked |
| New tab shortcuts and page elements, backgrounds, weather, notes | written (`ui/pages/newtab.rs`) |
@ -65,8 +65,8 @@ written.
| Memory (use, threads, free up) | written (Linux numbers) |
| Low-memory mode auto/on/off | written |
| Energy saver off/battery/always | written |
| Memory saver (unload after) | written |
| Freeze background tabs | partial: stops drawing; Servo can't pause scripts |
| Memory saver (unload after) | verified S009 (integ-perf.txt, see Freeze); `status` shows memory 288 MB and 54 threads with two tabs |
| Freeze background tabs | partial: stops drawing; Servo can't pause scripts. Verified S009 (integ-perf.txt): a hidden tab freezes after the set minutes, is unloaded after the discard minutes and loads again when shown |
| Always keep these sites active | written |
| Load restored tabs when opened | written |
| Preload pages | written (DNS warm-up) |
@ -114,7 +114,7 @@ IDM (Windows), a file at an address with no hint (no extension, no "download"-li
## Media
Media button (when playing/always/never), player flyout (art, seek, controls, mute tab/site, PiP), visualizer
(cava / simulated / off), spin artwork, Discord Rich Presence (arRPC/Discord, per-site app IDs, browsing activity,
buttons, paused state): written. Picture in picture (own always-on-top window; reloads the page in a web view
buttons, paused state): verified S009 (integ-discord.txt + integ-discord-check.sh, fake IPC server): handshake with the Settings app ID, SET_ACTIVITY with title, artist, progress bar, button, paused state and a browsing activity; the media state comes from the page's Media Session. Fixed R4-09: the large image falls back to the origin's /favicon.ico when the page's favicon is data:, http: or long. Not checked: real Discord, per-site IDs, display type, the media flyout, visualizer, mute, PiP (S005). Picture in picture (own always-on-top window; reloads the page in a web view
of its own and seeks the video, page state lost, D-008): verified on Xvfb (S005). Protected content (Widevine): engine
limit, shown as unavailable.
@ -128,5 +128,5 @@ Install site as app (own window, launcher entry), desktop shortcut, user scripts
verified S008 (stores-apps.txt): .user.js and .user.css installed by address run on matching pages and not on others; install as app writes the launcher entry and the app opens its own window. Not checked: desktop shortcut, uninstall, editing a script, disable toggle, @exclude, run-at start/idle.
## About
Version, engine, colour, profile paths, update repository, automatic and manual update check: written
Version, engine, colour, profile paths, update repository, automatic and manual update check: verified S009 (integ-updates.txt, local fake Forgejo API): the notice says "Version 9.9.9 is available" and nothing is downloaded. Not checked: GitHub/GitLab address forms by smoke (unit tests only), the Get it button.
(`updates.rs`).

View file

@ -281,6 +281,11 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
- Not done: YouTube stalls and the hung js probe not investigated (S027/S028); the pad-task race only shows in the C test under CPU load.
- Later (S027/S028): coded frame removal in gst_mse (`remove` is a stub); `HTMLMediaElement.buffered` from the MediaSource; script thread blocking (S022 note) seen again after the video ended.
## S009 — Integrations pass (2026-11-12)
Done: Discord against a fake IPC server (`SMOKE_FAKE_DISCORD=1`, `tests/smoke/net/fake-discord.py`, check script `integ-discord-check.sh`): handshake, SET_ACTIVITY for media (title, artist, progress, button, paused) and browsing. R4-09 fixed: unusable favicon URLs (data:/http:/long) fall back to `https://<host>/favicon.ico` (no third party), `icon_url` + unit test. Spell check (`integ-spell.txt`, tiny offline dictionary): found and fixed that the page menu got no word in text fields (Servo has no `caretRangeFromPoint`; the spell mirror's underlined words are hit-tested now). Updates (`integ-updates.txt`, local fake API): notice shown, nothing downloaded. Memory saver (`integ-perf.txt`, 3.5 min): freeze, unload, reload. Gamepad API empty without a device, idle CPU 0 % (`integ-idle-cpu.sh`). Single instance was verified in S006. 62 unit tests green.
Not done: real Discord, real gamepad, spell dictionary download/add word/other languages, per-site Discord IDs, media flyout/visualizer/mute (S005 did PiP).
Later: S010 list: user checks the Discord icon with their own client (the Discord client may refuse a `.ico` icon; then a PNG source is needed), plays a real gamepad, tries the dictionary download.
## Later
- Turnstile widget paints as a black half-disc (Servo painting of its iframe/shadow DOM, S006 site doctor).
- Google sign-in past the email step: press Next with a real account, by the user (S006).

View file

@ -719,7 +719,7 @@ impl App {
.map(|(i, t)| {
serde_json::json!({
"active": i == w.active, "url": t.shown_url(), "title": t.display_title(), "loading": t.loading(),
"load_status": format!("{:?}", t.load_status), "has_web": t.web.is_some(), "blocked": t.blocked,
"load_status": format!("{:?}", t.load_status), "has_web": t.web.is_some(), "frozen": t.frozen, "blocked": t.blocked,
"hidden_elements": t.hidden_elements, "pinned": t.pinned, "muted": t.muted, "zoom": t.zoom,
"favicon": t.favicon.is_some(), "crashed": t.crashed, "can_back": t.can_go_back(), "can_forward": t.can_go_forward(),
"history_len": t.back_forward.len(), "find": [t.find.index, t.find.count], "prompts": t.prompts.len(),

16
tests/smoke/integ-idle-cpu.sh Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# CPU use of an idle Nacre (S009): tests/smoke/integ-idle-cpu.sh <outdir>. Needs the page server on 8768.
# Samples utime+stime of the browser over 20 s, after 15 s of settling; fails above 10 % of one core.
out=${1:?usage: integ-idle-cpu.sh <outdir>}
root=$(cd "$(dirname "$0")/../.." && pwd)
"$root/tools/smoke.sh" "$root/tests/smoke/integ-idle.txt" "$out" &
smoke=$!
sleep 15
pid=$(pgrep -n -f "$root/target/release/nacre")
[ -n "$pid" ] || { echo "FAIL: browser not running"; exit 1; }
ticks() { awk '{print $14+$15}' "/proc/$pid/stat"; }
a=$(ticks); sleep 20; b=$(ticks)
wait "$smoke"
pct=$(( (b - a) * 100 / (20 * $(getconf CLK_TCK)) ))
echo "idle CPU: $pct % of one core"
[ "$pct" -le 10 ] && echo "ok" || { echo "FAIL: too high"; exit 1; }

View file

@ -0,0 +1,7 @@
# Integrations pass (S009): an idle browser (gamepad polling on, no device, no media) doesn't spin the CPU.
# Run through tests/smoke/integ-idle-cpu.sh, which samples the process while this waits.
open http://127.0.0.1:8768/hello.html
waitload
wait 40
status done
quit

View file

@ -0,0 +1,33 @@
# Integrations pass (S009): memory saver and gamepad enumeration. Takes about 3.5 minutes (tab rest is counted in
# minutes, checked every 30 s). Run: SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/integ-perf.txt <outdir>
# Memory numbers come from `status`: /memory and /threads. Gamepad: no device here, so only that the API exists and
# lists nothing (CPU use while idle is checked by tests/smoke/integ-idle-cpu.sh).
set /perf/freeze_min 1
set /perf/discard_min 2
set /perf/lite "off"
status mem-start
wait 2
open http://127.0.0.1:8768/hello.html
waitload
assert typeof navigator.getGamepads === 'function' && navigator.getGamepads().filter(Boolean).length === 0
newtab http://127.0.0.1:8768/basics.html
waitload
status two-tabs
expect /tabs/1/has_web true
# Back to the first tab: the second one is now hidden and idle.
cmd select 0
wait 100
status frozen
expect /tabs/1/frozen true
expect /tabs/1/has_web true
wait 90
status discarded
expect /tabs/1/has_web false
# Showing it again loads it again.
cmd select 1
wait 5
status restored
expect /tabs/1/has_web true
expect /tabs/1/frozen false
status done
quit

View file

@ -0,0 +1,15 @@
# Integrations pass (S009): update check against a local fake release API. Run:
# python3 -m http.server 8769 --bind 127.0.0.1 --directory tests/smoke/data/updates 2>access.log &
# tools/smoke.sh tests/smoke/integ-updates.txt target/smoke/integ-updates
# The notice must say 9.9.9 is available and nothing may be downloaded (no request for /dl/ in the server log,
# no download in the status).
set /update/repo "http://127.0.0.1:8769/astar76/Nacre"
set /update/auto_check false
wait 2
cmd check_updates
wait 4
status updates
expect /update "Version 9.9.9 is available"
shot update-notice
status done
quit