Repository navigation
Upstream sync — resolve Issue #5 (rum→hsx migration) - #6
Merged
Merged
Conversation
Both were found with this test and filed since the first commit. logseq#1312 shares its signature with logseq#1305, so the pattern is listed under both.
The visible graph now holds a tag's tag properties and the nodes a block's text links to, so the test sees logseq/db-test#1311 and logseq#1310. A save of a link sends the linked node in :block/refs, as the editor does; before, "[[alpha]]" was saved as plain text. Block e of the initial graph links to the tag Movie. Known: logseq#1302, logseq#1310 and logseq#1311, and the combined signatures of logseq#1310 with logseq#1305 and of logseq#1311 with logseq#1309.
bb lint:large-vars caps a var at 100 lines; op->plan had grown to 189. It is now 3 plan fns by area (outline, properties, pages) over 1 shared context, dispatched by op kind. Same plans: 120 sequences at seeds 4242 and 777 list the same signatures, counts and shortest sequences before and after.
Undo of deleting today's journal or a tag or property page restores the page's top-level blocks with 1 insert op each. A block that refers to a block of a later op (a node property value) fails to insert, the replay reports :error and undo clears the history. The block-delete path already defers those refs to save-block ops after all inserts; the page-delete paths now share that step.
* fix(outliner): do not revert many to one on undo Keep :db.cardinality/many when undoing a one-to-many toggle that already has values. The inverse omits :db/cardinality so undo does not throw or clear history. Co-authored-by: Tienson Qin <tiensonqin@gmail.com> * fix(outliner): keep cardinality when schema omits it Closed-value properties still run a schema update on undo. Missing :db/cardinality must not default to :one. Co-authored-by: Tienson Qin <tiensonqin@gmail.com> * fix(outliner): keep many-to-one undo from invalid types Coerce types that cannot be :many back to :one. Skip an unsafe cardinality restore when a replayed schema has other fields. Co-authored-by: Tienson Qin <tiensonqin@gmail.com> * fix(test): balance parens in property cardinality tests Co-authored-by: Tienson Qin <tiensonqin@gmail.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
editor-delete treated leftover editing? as a live editor. After a journal title-row click the textarea can already be gone, so get-input is nil and keydown-delete-handler read input.value. Fixes logseq/db-test#1358 Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* fix: skip property rows in toggle-collapse! Ctrl+; mapped selected ls-block nodes through uuid, so a property-value row without blockid threw. Use selection-node-block-id and drop nils. Co-authored-by: Tienson Qin <tiensonqin@gmail.com> * test: assert toggle-collapse! skip without requiring nil Co-authored-by: Tienson Qin <tiensonqin@gmail.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* fix: allow Alt+Shift+C to toggle Contents while editing Move :ui/toggle-contents from the non-editing-only handler to global-prevent-default so it stays active in edit mode, matching :sidebar/open-today-page. Co-authored-by: Tienson Qin <tiensonqin@gmail.com> * test: assert toggle-contents is only on the editing-active handler Co-authored-by: Tienson Qin <tiensonqin@gmail.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
All Pages and Graph View listed child pages after their parent was moved to Recycle, because the id-only exclude set only dropped pages with a direct deleted-at/hide flag. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…3490) * fix: create missing global config.edn when saving shortcuts Startup restored ~/.logseq/config/config.edn before creating it, so a fresh DB install never wrote the file. Shortcut saves then failed with ENOENT. Create the config dir and file first, and do the same before writing a shortcut change. Co-authored-by: Tienson Qin <tiensonqin@gmail.com> * fix: keep overlapping shortcut saves on global config Update in-memory config before any async work, then serialize disk writes so two quick shortcut changes cannot overwrite each other. Co-authored-by: Tienson Qin <tiensonqin@gmail.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* test(graph-view): count entity lookups, not time The 2 large tags-and-objects graph tests bounded wall-clock time (best of 3 under 1 s). They now count the d/entity lookups made while building the graph, at a small and a large size, and require the same count: 12 and 12000 unrelated pages, 12 and 3885 tagged objects. * test(search): count work instead of CPU time combine-results: instead of a 200 ms CPU bound, count the reads of result fields and the db lookups at 625 and 2500 results. 4 times the results must take under 8 times the reads (linear gives 4, a scan per result 16) and the same number of db lookups. The 2 sync cases for 300 new blocks drop their 1 s CPU bound. The page-check count of the same insert now allows 1 check per new block; checking every new block for page descendants doubles it, which the old bound of 2 per block let through.
Count real [[tag]] page-link refs on class/tag pages so Linked References can mount. Keep the property-page skip. Tagged #tag instances stay filtered out of that count and the linked-refs view. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
subs-loader sends one render-snapshot request at a time and picked each request by kind in the order view resources, resources, blocks, children. On a page open the page's children request (open-block-tree, the body) was queued behind the title's reactions, comment threads, display properties and favorite status, and behind the linked references' blocks and breadcrumbs, so it left after about 12 serial requests. Flush blocks and children before other resources. View resources (view-data, views) still leave first and alone, so a tag page's first table window keeps its own request ahead of everything else.
The search index triggers removed a block's old FTS row with `DELETE FROM blocks_fts WHERE id = old.id`. FTS5 has no index on a regular column, so that statement reads every FTS row, and it runs on every save of an indexed block and on every block delete, before the worker replies. Give each FTS row the rowid of its blocks row and find it by rowid in the delete and update triggers. Bump the search index version to 5. An index at version 4 moves in place instead of a rebuild from the graph: a new FTS table with rowid triggers of its own is filled from the blocks table in batches of 200 rows, while the old table and its triggers keep serving search. After each batch the move pauses twice as long as the batch took, so it takes at most a third of the worker's time. 1 transaction then drops the old table and triggers, renames the new table, creates the rowid triggers and sets version 5. The move runs from the idle-scheduled index check, after the graph opens. Other versions still rebuild.
* test: cover integer number property values from plugin API
Assert that upserting 0, negatives, and numbers that coincide with
value-block entity ids stores those literals instead of treating them
as entity lookups.
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
* fix: store integer number properties as values
Stop convert-ref-property-value from treating :number integers as
entity ids. Plugin and HTTP API callers can now set 0, negatives, and
numbers that coincide with other value-block ids. Reuse a value block
with batch-set-property! {:entity-id? true}.
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
* fix: distinguish plugin numbers from entity references
* fix: keep empty placeholder when clearing number properties
Nil plugin writes for :number properties must use remove-block-property!
so a default value does not reappear after the batch nil retract.
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
* test: attach a number value block as the default rating
create-property-text-block! cannot write a parsed number onto
:logseq.property/default-value, so the regression test creates a rating
value first and then sets that entity as the default.
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
The worker pipeline extends a transaction with 1 or 2 more d/with calls, each its own tx id, and the stored tail keeps their datoms as 1 entry. A restore replays the entry, whose datoms keep their own tx ids, and sets :max-tx to its first datom's tx, below the :max-tx the graph had. The next transaction then took a tx id that datoms of the graph already carried, and since the sync checksum is stored with the :max-tx it covers, every reopen after an edit that went through the pipeline recomputed the whole-graph checksum. Take the largest tx among the tail's datoms. Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
…seq#13448) Fixes logseq/db-test#1294 A DB graph missing the logseq/config.edn :file/path entity made every config-backed Settings toggle render wrong and silently drop writes: - restore-repo-config! read nil content and left [:config repo] unset, so toggles rendered defaults instead of the stored values. - repo-config-set-key-value bailed on nil content, silently dropping every write. - Even a forced write would fail: save-file! transacted a file entity without :block/uuid, which fails file-block validation. Now a missing/blank config file falls back to the default config content on both restore and write, and save-file! assigns the deterministic built-in :block/uuid (matching build-initial-files) when the file entity does not exist yet.
…#13099) The bullet right-click handler derived block-id from the bullet's blockid attribute. A row rendered through :block/link carries the LINKED block's uuid there and the linking block's own uuid in originalblockid, so every block-level context menu action was built around the embed target rather than the embed. Deleting a node embed via the menu's Cut item therefore destroyed the target and its whole subtree while leaving the embed in place. Distinct from the async-selection defect in logseq/logseq#13096: cut-block! never resolved originals, before or after the worker migration. Verified over six embed shapes (block with content, block with children, empty block, empty page, page with blocks, embed-of-embed chain): the menu's Cut now removes the placeholder and leaves the target intact. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
…3081) * fix(worker): allow a missing :block/order on a direct child direct-children-membership rejects any direct child whose :block/order is not a string, and the rejection is a throw that discards the whole membership read rather than the one child. Because open-block-tree calls it recursively over the open tree, a single such child makes every ancestor page unopenable -- the throw returns to the renderer as a 500 from the worker and is caught by the React ErrorBoundary, so the user gets "Something went wrong" with no indication of which page or which block is involved, though the ex-info already carries both. The rejected value is legal. :block/order is {:optional true} for pages in normal-page, `graph validate` reports nothing against such a page, and the pre-worker renderer displayed it without complaint. Only block-attrs makes the attribute mandatory, and that governs normal blocks; a page nested under another page may carry none. Nothing downstream needs the guard either. The very next expression is (sort-by second), and cljs.core/compare already orders nil ahead of any string -- which is what ldb/sort-by-order, a bare (sort-by :block/order), relies on everywhere else in the codebase. So accept nil and let it sort first, consistent with the rest of the tree, while still rejecting a non-string value as the real defect it would be. Hit on a live DB graph: one page created without an order made the top-level Library page, four levels above it, impossible to open. Adds tests for both halves -- an order-less child no longer removes its siblings, and a numeric order still throws. The first fails on the old implementation with the same error seen in the wild. * fix: drop leftover merge marker --------- Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
* i18n(zh-Hant): translate account authentication messages * i18n(zh-Hant): use consistent honorifics in account copy
* fix: preserve current page context in sidebar queries * fix: preserve current page context in sidebar queries
added 28 commits
November 14, 2026 10:19
state/pub-event! resolves as soon as the handler returns, with the handler's promise as its value; promesa does not adopt it. The capture dispatch therefore resolved before quick capture had inserted anything, so clips were acked and parked captures dropped ahead of the insert, and a failed insert went unnoticed. Bind the event's value a second time. Quick capture also resolves on paths that insert nothing (no journal title, missing or recycled target page). Treat a result without a block as a failure, and pass :append so a capture never lands in the block being edited. Also: - graph-ready? took :db/restoring? nil for restored, so on a returning session captures were dispatched before the db was loaded, and the inbox was fetched without a token (401). Wait for the restore and the session. - One capture that keeps failing no longer blocks the ones behind it, in the inbox and in the parked queue; the user gets one notice. - A localStorage failure while parking no longer aborts app boot.
…nnect Since cba9a23 the watchdog ignored stalls with nothing outstanding. That case also covers a flush that failed before sending (large-title upload, e2ee key fetch), which nothing re-triggers until the next edit. Re-enqueue the flush instead of doing nothing; during a long apply that is a no-op. The kill counter was only reset by progress seen between two ticks of one connection, but every reconnect cleared the snapshot and the recovery usually completes before the first tick. Keep the snapshot across reconnects, and reset the counter and the wedge error once nothing is pending.
<rtc-replace-local-with-remote! did not wait for :graph/switch (pub-event! resolves with the handler's promise as value), and only switched after the remote graph list loaded: a failing list left the renderer on the replaced graph's content. Decide whether the download created the db with :thread-api/db-exists, which checks the pool directory that will be opened. list-db names are decoded from directory names and do not round-trip for every graph name, so a failed download could unlink an existing local graph.
- The eviction stat'ed /<graph name>/assets/..., while the storage layer keeps the graph segment URL-encoded. For any graph name with a space or a non-ASCII character nothing was ever found. - :logseq.kv/graph-remote? and asset remote metadata survive deleting the remote graph or leaving a shared one, so they do not prove the server holds an asset. Only offer assets of the graph whose sync is open. - Pause after every pass that ran, and after a failed one. A pass that cannot reach its target re-ran every 30 s and evicted whatever had just been viewed.
… failures - Every caller that finds the session gone publishes [:user/login], often several at once; each opened another dialog. Open one. - Logout cleared local state only. The session cookie is HttpOnly, so the next page load (or the refresh loop within minutes) logged the user back in. Call /auth/logout. - One failed <rtc-start! (expired token while offline, lost session) ended the auto-start background task for the rest of the tab session, so later logins, graph switches and reconnects no longer started sync. - The 30 s db-worker wait no longer drops the post-login work; it logs and keeps waiting. - A 200 from /auth/session without a token is retried, not ignored.
When the device secret is created, any stored e2ee password predates it and was wrapped with the JWT sub. It no longer decrypts, but it stayed at rest until the user re-entered the password. Delete it then.
The error listed bare ids, which --output human prints as an empty line and which no other candidates error uses.
build.yml runs the ClojureScript tests and lint only on master, and deps-db-sync.yml only on master, so nothing on develop or in the upstream-sync PRs ran them. The anchor script ran only in the weekly sync and needs ripgrep.
The parent check ran after the tag and property ops had been applied, so a rejected parent left those changes behind. Resolve and check the parent first.
Parked captures and the inbox drain read and rewrite the same localStorage lists and the same server inbox. Two tabs booting together inserted the same clip twice, and one could drop the other's parked capture. Run both under navigator.locks.
- A hash mangled by an unquoted $ in .env made every login answer 401 without a hint; a non-numeric session TTL made sessions never expire; HYPHA_COOKIE_SECURE=True silently meant false; a bad HYPHA_JWT_TTL failed only at the first login. Fail at startup instead. - Mark /auth/* and /capture* replies no-store, so a caching rule on the outer proxy cannot hand one user's token or clips to another. - Drop expired sessions when a new one is created; clipper logins create sessions that are never looked up again. - Test that the runner passes DB_SYNC_TRUST_FORWARDED_HEADERS to the adapter: without it every graph download breaks.
Logout clears localStorage, which held the parked share-target captures (the only copy) and the ids of clips inserted but not yet acked (which would then be inserted again). Keep those two keys in Hypha mode.
The marketplace and CDN proxies served plugin HTML and JS from the Hypha origin to anyone. A script there can call /auth/session, so any site could navigate a logged-in browser to a plugin page and run code with the user's session. Require the session cookie: it is SameSite=Strict, so the app's own fetches and plugin iframes carry it and cross-site navigations do not. Installed plugins still run on the Hypha origin; isolating them needs a separate origin.
…suer The compose files published port 3000 on every interface, and the session cookie lacked Secure unless HYPHA_COOKIE_SECURE was set to exactly "true". Following the docs on a VPS exposed plain HTTP to the internet, next to the TLS proxy. Publish on 127.0.0.1 unless HYPHA_BIND says otherwise, and derive Secure from the issuer scheme when HYPHA_COOKIE_SECURE is unset.
The dialog closed as soon as "Replace" was clicked, and the graph being replaced stayed editable during the download; edits went into the new db. Keep the dialog open with its buttons disabled (its overlay blocks the editor) until the take-over finishes, and close it by id.
Brings the fork up to logseq/master a0f4399 (1349 commits). Conflict resolution: - Take upstream's OCaml CLI in cli/ and drop the legacy ClojureScript CLI (its Hypha patches #16-#19 are ported in follow-up commits). - Take upstream for quick capture (drops Patch #23) and the RTC background task rewrite (drops Patch #24). - Re-apply Hypha fixes on upstream's new structure: Patch #10 device secret in sync/crypt.cljs, nil stripping of pipeline extra-tx-data, alias-aware unlinked references and nil-free block parents in worker/handler/block.cljs, the web download cleanup in handler/db_based/sync.cljs, and the :user/login and graph name collision events as defevent! registrations. Adaptations to upstream API changes: - state/set-auth-id-token keys the graph session by user id; Hypha passes the JWT sub, so a token re-mint no longer looks like a user switch that empties the remote graph list. - <ensure-id&access-token! awaited a core.async channel with p/let and threw before the refresh finished; bridge it into a promise. - Replace state/state and flows/*current-login-user in Hypha code. - The block context menu gets a plain worker map now; query the property history (Patch #21) from the worker. - Move the name-collision banner out of repos-cp (large-vars lint). - bin/hypha-build: the logseq-cli shadow target is gone. Tests: - Match highlight-matching-query on the marked text, not hiccup attrs. - db-sync-test: a with-datascript-conns cleanup that settles after its test ended no longer resets the conns of a later test.
The CLI is now OCaml/Melange (cli/, built with `pnpm cli:release`). The image gets opam and an OCaml 5.1.1 switch (CI's OCAML_VERSION); the CLI's opam packages go into the new hypha-opam volume on first `opam install . --deps-only --with-test`. bin/dev rebuilds images built before the OCaml label existed.
Port of Hypha Patch #16 to the OCaml CLI. With literal "/" in titles (Patch #15) a page hierarchy needs an explicit :block/parent, and the MCP bridge reaches the graph only through the CLI. --parent moves the page under the parent page (created if missing) with :move-blocks, so the worker assigns the order. --remove-parent retracts :block/parent and :block/order. The parent is checked before anything is written: not the page itself, not one of its descendants (:move-blocks would silently ignore that) and no page with the same title under it already. Extends cli/spec/commands/upsert.mli (page_opts and Upsert_page) with parent and remove_parent; approved for this port.
Port of Hypha Patch #18 to the OCaml CLI. `upsert page|block --update-properties '{:prop "2026-02-12"}'` sent the raw string and the worker rejected it ("should be a journal date"). An ISO date for a :date property now becomes the db/id of that day's journal page, found by :block/journal-day, so the graph's journal title format does not matter. A missing day is created with create-page, which the outliner turns into that day's journal page. The outliner test pins that create-page of an ISO title reuses the journal of a custom title format.
- rename_page calls `upsert page --rename` (the legacy `rename page` command, Patch #19, is gone); it identifies the page by name or id. - --remove-parent is a flag now, without a value. - upsert_blocks sends the block tree as a markdown outline; --blocks no longer takes EDN. - Document the date formats the CLI accepts and the new build steps.
Upstream added a root pnpm-workspace.yaml. `pnpm --dir hypha-server install` then installs the root workspace and leaves hypha-server and deps/db-sync without node_modules, so tsc found no fastify/jose and the image would ship without them. Install and prune both with --ignore-workspace, as upstream does for cli/. CI builds the test asset with `pnpm cljs:test` like upstream: the electron db-worker-manager tests start a real db-worker-node.
On 2026-11-13 the CLI daemon lost a tx/batch/ok. The watchdog reconnected, the pull returned the client's own txs, and the client rebased its pending copies on top: they stayed pending as :rebase txs that only rewrote :block/updated-at and were resent after every reconnect. The server applied each resend again, because it checked t-before but never the tx-id: 449 rounds, about 18,500 journal entries that the iPad received as thousands of remote changes. - Server: a tx entry whose tx-id is already journaled is confirmed without being applied (indexed lookup on tx_log.tx_id). A resend can no longer duplicate txs or revert later changes. - Client: pull/ok keeps the tx-id, and apply-remote-txs! acknowledges a pending tx whose id comes back from the server instead of rebasing it. Either side alone ends the loop. Hypha Patch logseq#25.
The login dialog gets an eye button that switches the access code input between hidden and plain text. The button keeps the focus in the input, so typing continues after a click.
Upstream replaced the RTC auto-start task (it dropped Patch #24) with event triggers. The login trigger fires before GET /graphs returns, so the current graph is not in :rtc/graphs yet and the start is skipped as "graph not in remote list". Upstream's own login path triggers the start again after fetching the graph list; Hypha's did not, so sync never started after a login. Do the same after the Hypha graph fetch.
A pull/ok is one WebSocket message and the ws library caps a message at 100 MiB. After the 2026-11-13 loop a browser 18,982 txs behind got a 101.5 MB pull/ok; the proxy closed the socket, and the client reconnected and pulled again about once a second without catching up. - Server: pull/ok carries at most 2000 txs or 8 MiB (at least one tx). Its :t is the end of the page, and the head checksum comes only with the last page. The page is read with a LIMIT query. - Client: after applying a page that ends before the head known from hello or changed, pull the next page. Hypha Patch logseq#26.
Sessions lived in memory only, so every deploy logged the user out. The app loads plugins before the login dialog, and the plugin proxies require a session, so the first page load after a deploy also lost plugins. The store now persists to sessions.json in HYPHA_DATA_DIR (write-then-rename, mode 0600). It keeps SHA-256 hashes of the session IDs, so reading the file does not yield a usable cookie. Expired sessions are dropped on load.
teuffel
added a commit
that referenced
this pull request
Nov 22, 2026
Upstream sync — resolve Issue #5 (rum→hsx migration)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #5.
Merges
upstream/masterintodevelop. The three declared conflicts masked a full upstream rum → hsx migration (upstream removedrumdependency + all usage).Conflicts resolved (keep fork patch + adopt upstream hsx)
property-history-cp, migrate it +block-context-menu-contenttohsx/defc.:remote?guard) alongside upstream's newrtc-graph?gate; keep Patch Upstream sync needs attention — 2026-08-03 #14 name-collision helper + binding; migraterepos-cptohsx/defc+hooks/use-effect!.(-> ui-ready (p/then …))restructure while keeping Patch Upstream sync needs attention — 2026-08-03 #14 hypha-mode demo-skip +hypha-init/start!.rum→hsx ports (fork-only files upstream will never migrate)
rum/defc→hsx/defc(stateless).rum/defcs+rum/localmixins →hsx/defc+hooks/use-state.Anchor maintenance
(rum|hsx)/defc new-db-graph-inner;HYPHA_PATCHES.mdupdated to match.Verification
clojure -M:cljs compile app: 2461 files, 0 warningsbb dev:lint-and-test: (running — will note result)Review for semantic changes before merging.