diff --git a/CLAUDE.md b/CLAUDE.md index 3342292..18cf094 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,6 +1,6 @@ # Nacre -Nacre is a web browser written from scratch in Rust with an egui UI, **switching from the Servo 0.7 engine to a tuned WebKit (D-032; Linux only)**, meant to replace the Python/QtWebEngine Nacre as the user's daily browser. Final deliverable: Linux (AppImage, tar.gz) builds of the browser, published through the `releases/` folder to the user's Forgejo (astar76/Nacre). Vision: [PLAN.md](PLAN.md). +Nacre is a web browser written from scratch in Rust with an egui UI, **on a tuned WebKitGTK 6.0 in a GTK 4 host (D-032; Linux only; Servo was removed in S053)**, meant to replace the Python/QtWebEngine Nacre as the user's daily browser. Final deliverable: Linux (AppImage, tar.gz) builds of the browser, published through the `releases/` folder to the user's Forgejo (astar76/Nacre). Vision: [PLAN.md](PLAN.md). ## 0. Session rules — read first @@ -11,7 +11,7 @@ Nacre is a web browser written from scratch in Rust with an egui UI, **switching 5. **Invent nothing**: check the code/docs; if a fact is still missing, ask — the **orchestrator** if you were started by one (never the user directly), otherwise the user. 6. **End of session**: (a) end criteria verified **by commands**, not memory; (b) `docs/PROGRESS.md` entry (≤ 15 lines: done, not done, later); (c) `docs/DECISIONS.md` if a decision binds later plans; (d) tick your line in `Plans/INDEX.md` (no commentary); (e) commit `SNNN: …` and push to `origin`; (f) short report: done, not done, what the user/orchestrator must do, and any instruction that cost more than it gave. 7. **Languages**: answer in English. Code, comments and docs in English. Internal docs (`CLAUDE.md`, `Plans/`, `PROGRESS.md`) in English. -8. Also at session start (user rule): read `docs/HANDOFF.md` and `docs/STATUS.md` if they exist. `docs/DESIGN.md` is the architecture and Servo API cheat sheet; read the parts your plan names. +8. Also at session start (user rule): read `docs/HANDOFF.md` and `docs/STATUS.md` if they exist. `docs/DESIGN.md` is the architecture and WebKit embedding cheat sheet; read the parts your plan names. ## Tracker @@ -22,7 +22,7 @@ After ticking a box: `ArtifactData` `update` with `url` = the tracker, `collecti Root: `/home/astar76/Projects/Nacre` ``` -src/ main, app (winit), window, hub (Servo delegates), tabs, actions, keys, inject, adblock, discord, media, ... +src/ main, app, window (GTK window + egui overlay), egui_area, engine/ (WebKit host, views, events), tabs, actions, keys, inject, adblock, discord, media, ... src/store/ settings, history, bookmarks, downloads, vault, permissions, session, apps, scripts src/net/ bridge (local CONNECT proxy), fetch, tor, dns, download, dlm src/ui/ egui chrome, menus, dialogs, widgets, pages/* (every nacre:// page) @@ -35,11 +35,10 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl ## 2. Facts -- **Engine switch in progress (D-032)**: the Servo facts below describe today's code until the `08 WebKit engine` plans replace it. Engine test and WebKit tuning data: `docs/engine/engine-comparison.md`, `docs/engine/tune/`. Everything Servo-only and what WebKit must replace: `docs/engine/servo-removal.md`. - -- Cargo package `nacre` 0.4.0, edition 2024, Rust ≥ 1.88. Servo is `=0.7.0` from crates.io, trimmed (no WebXR, WebGPU, multiprocess). Gamepad and Web Bluetooth stay in. -- Status: ~19k lines written, **never compiled**. Review passes were done by reading only. Expect a round of compile errors at the first build; fix them in place, don't restructure. -- User rules: function first; plain egui UI until everything works; the Material You redesign comes afterwards (see `docs/UI-BRIEF.md`); nothing from the original is dropped silently (Servo limits are shown as unavailable, see DESIGN.md "Engine limits"); never connect to Tor or proxies in tests. +- **Engine**: WebKitGTK 6.0 (`webkit6` crate, `=0.6.1`) in a GTK 4 window; egui draws the chrome in a transparent `Gtk.GLArea` over the web views (D-033, D-035). WebKit tuning data and the engine test: `docs/engine/engine-comparison.md`, `docs/engine/tune/`. The Servo removal inventory (history): `docs/engine/servo-removal.md`. Pages' network work happens in the web process extension `webext/`. +- Cargo package `nacre` 0.4.0, edition 2024, Rust ≥ 1.88. No Servo, vendored crates or patched engine any more; builds take minutes (~2–4 min release), not hours. +- Status: builds, `cargo test` green, hidden smokes pass; features still to re-verify on WebKit are marked in `docs/FEATURES.md`. +- User rules: function first; plain egui UI until everything works; the Material You redesign comes afterwards (see `docs/UI-BRIEF.md`); nothing from the original is dropped silently (engine limits are shown as unavailable, see DESIGN.md "Engine limits"); never connect to Tor or proxies in tests. - Known gaps and things to check at the first build: `docs/REVIEW.md`. Feature list with file and review state: `docs/FEATURES.md`. - The original Python Nacre (`~/Documents/Apps/Nacre/nacre`, `config.py` DEFAULTS) is the feature spec. @@ -48,16 +47,14 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl - Write like the neighbouring code. KISS, DRY, YAGNI; no abstraction without ≥ 2 uses. - New pure logic gets a test; a bug fix gets a regression test when feasible. - Fix compile errors in place; don't restructure working modules. -- Servo callbacks run on the main thread; `load_web_resource` must answer synchronously (see REVIEW.md). +- WebKit signals run on the main thread; handlers only queue `Event`s (see `src/engine/mod.rs`); never touch `App` inside a signal handler. ## 4. Domain pitfalls (all agents) -- **Builds**: `nice cargo build --release -j 2` only. The first build takes hours (Servo, SpiderMonkey, WebRender). Never run `cargo test` at the same time as a release build, and never run two cargo commands on the same `target/`. -- Servo needs clang. Start from Servo's own lock versions to avoid pre-release drift (rsa/pkcs1). +- **Builds**: `nice cargo build --release -j 2` only. Never run `cargo test` at the same time as a release build, and never run two cargo commands on the same `target/`. - Run apps in the hidden nested session (`tools/nested-session.sh`: Xvfb → nested niri, software GL; `kwin_wayland` isn't installed) unless the user asked to watch. Xvfb has no DRI3, so clients there use `LIBGL_ALWAYS_SOFTWARE=1 WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 GSK_RENDERER=gl` (the session's `env` file sets them). VMs have no real GPU: use software rendering there. - Never connect to Tor or proxies in tests; `NACRE_NO_BRIDGE=1` disables the bridge for debugging. -- Servo 0.7 can't add request headers, block third-party cookies, do per-WebView private mode, EME/DRM, printing: don't try, see DESIGN.md. -- Several painters on one GL context (one per tab) is unproven; the fallback is in DESIGN.md. +- WebKit has no EME/Widevine here, no Chrome extensions, no JS pause for background tabs: see DESIGN.md "Engine limits"; don't try to work around them. - Use throwaway `XDG_*` dirs for test runs so the user's profile is untouched. ## 5. Verification tools @@ -74,11 +71,10 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl | `tools/smoke.sh tests/smoke/settings.txt` (+ `SMOKE_SIZE=1280x1100`) | every settings section and sub-page dark and light, search results (`nacre://settings/?search=…`), narrow width; `settings-write.txt` (hidden, `SMOKE_SIZE=1280x1100`, fresh outdir) taps controls with selftest `tap x y`, then check `home/.config/nacre-servo/Default/settings.json` (expected values in its header) | now (S019) | | `SMOKE_SIZE=1280x1600 tools/smoke.sh tests/smoke/sliders.txt` | controls hold still (R1-21): Interface size drag (value label while held, applied on release), Contrast live, Style chip pick; `SMOKE_VISIBLE=1 tools/smoke.sh tests/smoke/sliders-visible.txt` the same plus scrolling for the user's window (~772 px). Selftest `press`/`drag`/`release`, `scroll x y dy`; read the PNGs | now (R1-21) | | `python3 tests/smoke/net/server.py &` + `tools/smoke.sh tests/smoke/net-{privacy,adblock,downloads}.txt` | network pass, offline: secure DNS through a local DoH stub (`*.nacre.test` → 127.0.0.1), HTTPS-only + certificate warning, tracking params, ad blocker with a local list, downloads + download manager stubs; the server's `/log` has requests, DNS names, Range headers, manager calls. `cache-restart.txt` with `SMOKE_HOME=/home`: disk cache. `net-real.txt` needs internet. `@HOME@` in scripts = the throwaway home | now (S007) | -| `SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/mse.txt` + `tests/smoke/mse-leak-check.sh ` | MSE: chunk-appended fMP4, WebM and split A/V play; `mse-spec.html` spec cases (attach/detach, duration, buffered/seekable, remove, removeSourceBuffer, changeType, abort, reopen, sequence, leak); the leak check reads nacre.log (offline). `NACRE_DOM_MEDIA_SOURCE_ENABLED=0 tools/smoke.sh tests/smoke/mse-off.txt`: the switch. `SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/mse-player.txt`: player integration (attach without blocking, seeks, rate, ended, decode error, garbage append, script-thread gaps < 1 s; `?only=` in the page URL for one case). `tools/gst-mse.sh test`: patched gst_mse + C tests. DESIGN.md "Media and Media Source Extensions" | S022, S027, S028 | -| `tools/gst-mse.sh [test]` | builds Nacre's patched gst_mse library and `mse` plugin (vendor/gst-mse) into `target/gst-mse/` (needed before running a build that uses MSE); `test` also runs the C tests in `tests/gst-mse/` | now (S026, branch s022-mse-proto) | +| `SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/mse.txt`, `…/mse-player.txt` | plain MSE tests on WebKit: chunk-appended fMP4, WebM and split A/V play; `mse-spec.html` spec cases (attach/detach, duration, buffered/seekable, remove, removeSourceBuffer, changeType, abort, reopen, sequence); player integration (attach, seeks, rate, ended, decode error, garbage append; `?only=` in the page URL for one case). Offline. `youtube-mse.txt` is an internet probe | S022, S027, S028, S053 | | `tools/smoke.sh tests/smoke/privacy-mode.txt` (+ `SMOKE_ARGS=--incognito … privacy-incognito.txt`) | privacy mode: `pages/fingerprint.html` read off/on, `fp-off.json`/`fp-on.json` + shots (offline); `privacy-net.txt` (needs `tests/smoke/net/server.py`) frame cookies, per-site pause, Accept-Language; `SMOKE_TIMEOUT=700 … coveryourtracks.txt` EFF's test off/on (internet, direct). Selftest `save ` writes a JS string result to `.json`; `SMOKE_ARGS` passes browser arguments | now (S024) | | `python tools/icons.py` | rebuilds the icon font subset and `src/ui/icons.rs` from `tools/icons.txt` (needs fontTools and Arch's ttf-material-symbols-variable) | now (S015) | -| `tools/engine-test/run.sh servo\|chromium\|webkit` + `analyze.py` | engine comparison: one browser visible on DP-1, throwaway profile, sites from `sites.txt`, per-second RAM (PSS), CPU, GPU of the whole process tree into `docs/engine/runs//samples.csv`; `webkit_shell.py` is the WebKitGTK 6.0 shell (needs `webkitgtk-6.0`); report `docs/engine/engine-comparison.md`. Never run two at once or alongside cargo | now | +| `tools/engine-test/run.sh chromium\|webkit` + `analyze.py` | engine comparison: one browser visible on DP-1, throwaway profile, sites from `sites.txt`, per-second RAM (PSS), CPU, GPU of the whole process tree into `docs/engine/runs//samples.csv`; `webkit_shell.py` is the WebKitGTK 6.0 shell (needs `webkitgtk-6.0`); report `docs/engine/engine-comparison.md`. Never run two at once or alongside cargo | now | | `tools/smoke.sh tests/smoke/pip.txt` (+ `tools/hidden.sh tests/smoke/pip.txt -- tests/smoke/pip-driver.sh`: `/windows.json` PiP floating), `bindings.txt` (side buttons, middle click; hidden only), `ctxmenu.txt` (site menu vs Nacre's; hidden only), `pip-return.txt` (page input after PiP and back; hidden only), selftest `pick x y` (GTK's pick at a page point + view state), `python3 tests/smoke/net/server.py &` + `SMOKE_SIZE=1280x900 tools/smoke.sh tests/smoke/auth.txt`, `tests/smoke/visible-ui.txt` (by hand, header) | PiP moves the live view and back (offline); HTTP sign-in cancel + saved login (offline); visible: portal file chooser, notification, page full screen, Web Inspector (`dialogs.txt` now also checks dialog answers, context menu, leave page, permission bars, notifications count) | now (S048, S056) | | `tools/hidden.sh