Files
Synapse/src/test/frontend/config_test.cljs
Dasemu 1e7e9a3c13 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>
2026-08-26 15:59:39 +02:00

26 lines
1.2 KiB
Clojure

(ns frontend.config-test
(:require [cljs.test :refer [deftest is testing]]
[frontend.config :as config]
[frontend.state :as state]
[logseq.common.config :as common-config]))
(deftest get-local-dir-uses-encoded-directory-name
(with-redefs [state/get-state (fn [] {:system/info {:home-dir "/tmp/home"}})]
(is (= "/tmp/home/logseq/graphs/foo~2Fbar"
(config/get-local-dir (str common-config/db-version-prefix "foo/bar"))))))
(deftest get-electron-backup-dir-uses-unified-backup-directory
(with-redefs [state/get-state (fn [] {:system/info {:home-dir "/tmp/home"}})]
(is (= "/tmp/home/logseq/graphs/foo~2Fbar/backup"
(config/get-electron-backup-dir (str common-config/db-version-prefix "foo/bar"))))))
(deftest valid-sync-server-url?-test
(testing "accepts http and https URLs"
(is (config/valid-sync-server-url? "https://my-server.example.com"))
(is (config/valid-sync-server-url? "http://localhost:8787")))
(testing "rejects non-URL strings"
(is (not (config/valid-sync-server-url? "not a url")))
(is (not (config/valid-sync-server-url? "")))
(is (not (config/valid-sync-server-url? nil)))))