Fase 8 (2/N): delete the client-side RTC/E2EE/sync UI and finish the teardown

Removes the client-side half of the remote CRDT sync protocol left after
the worker-side deletion in 565c211: RTC/remote-graph UI (components/rtc/*,
db/rtc/debug_ui.cljs, cloud-graph upload/download/leave/delete flows in
components/repo.cljs and mobile/components/app.cljs), E2EE UI and handlers
(components/e2ee.cljs, handler/e2ee.cljs, handler/events/rtc*.cljs), the
db-worker-node ui-request RPC (handler/worker.cljs's :db-worker/ui-request,
which existed only to serve E2EE password prompts), settings panels for the
legacy custom sync-server URL, and the now-orphaned :rtc/* client state
(presence UI, upload/download progress, remote-graph lists) — presence.cljs
was already deleted in the worker-side pass, contrary to the plan's "keep"
list, so all of this had zero producers left and was fully inert.

Also fixes several dead thread-api invokes discovered on LIVE paths that
would throw at runtime rather than being merely dead UI:
- db/restore.cljs's restore-graph! (called on every graph load)
- persist_db.cljs's <ensure-remote! (the Fase 3/4 daemon connect path)
- persist_db/browser.cljs's worker init and shutdown
- handler/user.cljs's logout

Verified via full compile of all 5 shadow-cljs targets (app, electron,
mobile, db-worker-node, test — 0 warnings) and a full bb dev:test run:
every namespace passes except the same 7 frontend.persist-db-test failures
that reproduce identically on unmodified HEAD (confirmed via git stash),
pre-existing network-sandbox flakiness unrelated to this change.

Known follow-up, not yet done: a handful of harmless-but-vestigial :rtc/*
references remain (handler/user.cljs's storage/graph-count exceed-limit
events, handler/events.cljs's :rtc-download? opt, worker/state.cljs's
*db-sync-config atom, worker/handler/graph.cljs's get-rtc-graph-uuid reused
by handler/editor.cljs's quick-add filter) — none throw or affect behavior,
left for a future pass rather than risk removing something still load-bearing
without deeper tracing. deps/db-sync/ (the Cloudflare Worker) is also still
untouched, per the plan's explicit note that it needs separate, larger surgery.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-26 15:59:39 +02:00
parent 565c2114be
commit 1e7e9a3c13
52 changed files with 162 additions and 4904 deletions

View File

@@ -14,60 +14,6 @@
(is (= "/tmp/home/logseq/graphs/foo~2Fbar/backup"
(config/get-electron-backup-dir (str common-config/db-version-prefix "foo/bar"))))))
(deftest custom-url->ws-url-test
(testing "https URL becomes wss"
(is (= "wss://my-server.example.com/sync/%s"
(config/custom-url->ws-url "https://my-server.example.com"))))
(testing "http URL becomes ws"
(is (= "ws://localhost:8787/sync/%s"
(config/custom-url->ws-url "http://localhost:8787"))))
(testing "trailing slashes are stripped"
(is (= "wss://my-server.example.com/sync/%s"
(config/custom-url->ws-url "https://my-server.example.com/")))
(is (= "wss://my-server.example.com/sync/%s"
(config/custom-url->ws-url "https://my-server.example.com///"))))
(testing "preserves port in URL"
(is (= "wss://example.com:3000/sync/%s"
(config/custom-url->ws-url "https://example.com:3000"))))
(testing "preserves subpath in host"
;; Users should only provide a base URL, but verify trailing path doesn't break things
(is (= "wss://example.com/api/sync/%s"
(config/custom-url->ws-url "https://example.com/api")))))
(deftest custom-url->http-base-test
(testing "returns URL as-is when no trailing slash"
(is (= "https://my-server.example.com"
(config/custom-url->http-base "https://my-server.example.com"))))
(testing "strips trailing slashes"
(is (= "https://my-server.example.com"
(config/custom-url->http-base "https://my-server.example.com/")))
(is (= "https://my-server.example.com"
(config/custom-url->http-base "https://my-server.example.com///"))))
(testing "preserves http scheme"
(is (= "http://localhost:8787"
(config/custom-url->http-base "http://localhost:8787"))))
(testing "preserves port"
(is (= "https://example.com:3000"
(config/custom-url->http-base "https://example.com:3000/")))))
(deftest default-urls-are-returned-when-no-custom-url
(testing "db-sync-ws-url returns default when no custom URL is set"
;; In test environment, node-test? is true so get-custom-sync-server-url
;; always returns nil, meaning we always get the default
(is (string? (config/db-sync-ws-url)))
(is (= config/default-db-sync-ws-url (config/db-sync-ws-url))))
(testing "db-sync-http-base returns default when no custom URL is set"
(is (string? (config/db-sync-http-base)))
(is (= config/default-db-sync-http-base (config/db-sync-http-base)))))
(deftest valid-sync-server-url?-test
(testing "accepts http and https URLs"
(is (config/valid-sync-server-url? "https://my-server.example.com"))