Files
Synapse/docs/agent-guide/exploring/simplification/2026-08-24-remove-unused-db-sync-cycle-repair.md
Dasemu 40631362b3 Initial import of LogDarioSeq baseline
Establishes version control for the personal Logseq DB fork before
starting the server-client architecture migration and domain features
described in docs/agent-guide and the approved implementation plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 15:32:15 +02:00

3.7 KiB

Remove Unused db-sync Cycle Repair

Problem

deps/db-sync/src/logseq/db_sync/cycle.cljs implements approximately 370 lines of client-side DataScript repair for :block/parent and :logseq.property.class/extends cycles. Its approximately 220-line unit test namespace is the only current consumer.

The client remote-apply path stopped requiring and calling fix-cycle! in commit 905e131770 (fix: no need to fix parent cycle for blocks) on 2026-03-20. Current frontend.worker.sync.apply-txs repairs duplicate outliner orders but has no cycle-repair call. Repository-wide searches find no other production, script, documentation-contract, reflection, registry, or generated source reference. The @logseq/db-sync package is private and does not export the namespace as an external API.

The unused utility therefore preserves a behavior model, transaction metadata, and tests that are not part of runtime behavior. The implemented runtime guide must also carry a special warning explaining that the utility is not integrated.

Proposal

Delete:

  • deps/db-sync/src/logseq/db_sync/cycle.cljs; and
  • deps/db-sync/test/logseq/db_sync/cycle_test.cljs.

Remove the Cycle repair utility subsection from docs/agent-guide/implemented/architecture/2026-08-24-logseq-runtime-and-engineering-guide.md. The runtime guide should continue to describe the active duplicate-order repair where relevant, without documenting a removed test-only implementation.

Do not change frontend.worker.sync.apply-txs, transaction application order, outliner semantics, or server-side validation. Generated deps/db-sync/worker/dist/worker-test.js is excluded from source edits and will be regenerated by the db-sync test build.

Alternatives considered

Reconnect fix-cycle! to remote apply

Rejected as a simplification because it would add cycle-repair transactions and change synchronized graph behavior. If runtime evidence shows cycle repair is needed, that work belongs to a separate bugfix or architecture decision with new behavior tests.

Keep the utility as a test-only design reference

Rejected because version control already preserves its history, while the current source and test suite should describe executable behavior. Keeping it also forces the runtime guide to distinguish implemented code from the active path.

Extract a generic graph-cycle library

Rejected because there is no second production consumer and the extraction would relocate unused complexity instead of deleting it.

Acceptance criteria

  • The cycle repair source and its self-contained unit test namespace are removed.
  • Repository-wide search finds no logseq.db-sync.cycle, cycle/fix-cycle!, or equivalent build/test registration reference in tracked source.
  • frontend.worker.sync.apply-txs retains its current remote apply and duplicate-order repair behavior unchanged.
  • The implemented runtime guide no longer documents the removed test-only utility or suggests that active client sync repairs reference cycles.
  • pnpm --dir deps/db-sync test passes and regenerates its test bundle without the deleted namespace.
  • bb lint:carve passes.
  • bb dev:lint-and-test passes.

Risks

  • The deleted implementation includes algorithms for two kinds of cycles, so a future runtime bugfix cannot reuse it directly from the working tree. Its Git history and focused tests remain recoverable from commits before this decision.
  • The removal assumes that the March 2026 production-path deletion was intentional for both supported attributes. Reintroducing any client-side repair would be behavior-changing and requires a new decision rather than a reversal hidden inside this simplification.

Questions

  • None.