Repository navigation
test(db-sync, undo-redo): tests for operator changes the suite let through - #13680
Open
yuxi-liu-wired wants to merge 4 commits into
Open
yuxi-liu-wired wants to merge 4 commits into
yuxi-liu-wired wants to merge 4 commits into
Conversation
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 11, 2026
This was referenced Oct 12, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 13, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 16, 2026
yuxi-liu-wired
force-pushed
the
test/mutation-app-tests
branch
5 times, most recently
from
October 22, 2026 11:01
dac7c82 to
b45d3ab
Compare
yuxi-liu-wired
force-pushed
the
test/mutation-app-tests
branch
4 times, most recently
from
October 29, 2026 11:12
9189521 to
b52006c
Compare
yuxi-liu-wired
force-pushed
the
test/mutation-app-tests
branch
2 times, most recently
from
November 3, 2026 12:00
234f64d to
98e25ae
Compare
yuxi-liu-wired
force-pushed
the
test/mutation-app-tests
branch
7 times, most recently
from
November 18, 2026 14:37
0df95e2 to
1df040b
Compare
Master now confirms an empty :fix entry (2adc540: a tx-log row and a new t, so the client's tx id is acknowledged), and its own test covers that; this test pinned the old behavior.
yuxi-liu-wired
force-pushed
the
test/mutation-app-tests
branch
from
November 19, 2026 12:00
1df040b to
53c225e
Compare
This branch has not been deployed
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.
Tests only. No source changes. Follows #13679, which covers
deps/outlineranddeps/dbthe same way.These tests come from mutation testing: each change of one operator in the source (
=tonot=,andtoor,firsttolast,whentowhen-not,truetofalseand so on) that the existing tests let through. Each new test passes on master and fails on at least one such change. Changes that no test could observe got no test.What the tests cover
deps/db-sync/test/logseq/db_sync/worker/handler/sync_mutation_test.cljs(logseq.db-sync.worker.handler.sync, the server side of sync):DecompressionStreamreject only gzip; theresetparameter; a non-error "too big" rejection returns 413; the graph is marked uploading until the upload finishesretractEntityof an existing block, and cardinality-many retract and add, are chunked independently; groups sharing an item stay in one chunk; the checksum listener is removed; a large:db-migrateentry is applied in one transaction and a small entry as one plain transaction:block/uuidlookups as missing blocks, reject an invalidt-before, and a:fixentry retracting only a missing block is not broadcastsync/pullreturns the txs aftersinceand rejects an invalidsince; the health route reports oksrc/test/frontend/worker/undo_redo_mutation_test.cljs(frontend.worker.undo-redo)::db/retractEntityrecords the retracted entity, an insert the added oneChecks
logseq.db-sync.worker.handler.sync-mutation-testandfrontend.worker.undo-redo-mutation-test29 tests, 87 assertions, 0 failures, 0 errors.clj-kondo --parallel --lint src, carve, large-vars, ns-docstrings,lang:lint-hardcoded) anddeps/db-sync(clj-kondo --lint src test, carve, large-vars).Which mutants each test catches
Each row: a change of one operator in the source (at the commit the mutation pass ran on) that the existing tests let through and this test fails on.
ensure-schema-initializes-schema-once-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsensure-schema!true→false(set! (.-schema-ready self) true)))health-route-reports-ok-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandletrue→false(http/json-response :sync/health {:ok true})sync-pull-is-blocked-while-snapshot-upload-is-in-progress-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljs<ready-for-sync?false→true(p/resolved false)sync-pull-returns-txs-after-since-and-rejects-invalid-since-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-pullif→if-notsince (if (some? raw-since) (parse-int raw-since) 0)sync-pull-returns-txs-after-since-and-rejects-invalid-since-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-pullsome?→nil?since (if (some? raw-since) (parse-int raw-since) 0)sync-pull-returns-txs-after-since-and-rejects-invalid-since-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-pullor→and(if (or (and (some? raw-since) (not (number? since))) (neg? since))sync-pull-returns-txs-after-since-and-rejects-invalid-since-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-pullsome?→nil?(if (or (and (some? raw-since) (not (number? since))) (neg? since))tx-batch-rejects-invalid-t-before-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-tx-batch!or→and(or (not (number? t-before)) (neg? t-before))tx-batch-reports-only-block-uuid-lookups-as-missing-blocks-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsblock-uuid-lookup-refand→or(when (and (sequential? entity-id)tx-batch-fix-retracting-only-a-missing-block-is-not-broadcast-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljssanitize-tx-entry=→not={:drop-missing-retract-ops? (or (= outliner-op :fix)large-tx-of-1000-independent-maps-is-applied-in-two-chunks-of-500-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsreplaced-value-attrswhen→when-not(when (and (vector? item)large-tx-of-1000-independent-maps-is-applied-in-two-chunks-of-500-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljstx-item-group-keysand→or(and (map? item) (tempid? (:db/id item)))large-tx-of-1000-independent-maps-is-applied-in-two-chunks-of-500-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljstx-item-group-keysand→or(and (vector? item)large-tx-of-1000-independent-maps-is-applied-in-two-chunks-of-500-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsreduce-ordered-tx-chunks>→>=(> next-count large-tx-max-chunk-items))large-tx-chunks-updates-of-an-existing-block-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljstempid?and→or(or (and (integer? value) (neg? value))large-tx-chunks-updates-of-an-existing-block-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsreplaced-value-attrswhen→when-not(when (and (vector? item)large-tx-chunks-updates-of-an-existing-block-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsreplaced-value-attrsand→or(when (and (vector? item)large-tx-chunks-updates-of-an-existing-block-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsreplaced-value-attrs=→not=(= :db/retract (first item))large-tx-chunks-updates-of-an-existing-block-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljstx-item-group-keysand→or(and (contains? #{:db/add :db/retract} op)large-tx-chunks-cardinality-many-retract-and-add-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljscardinality-many-attr?or→and(or (get-in (d/schema db) [attr :db/cardinality])large-tx-chunks-cardinality-many-retract-and-add-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsreplaced-value-attrsand→or(when (and (not (tempid? entity))large-tx-chunks-cardinality-many-retract-and-add-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljstx-item-group-keysand→or(and (contains? #{:db/add :db/retract} op)large-tx-chunks-retract-entity-of-an-existing-block-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljstempid?and→or(or (and (integer? value) (neg? value))large-tx-chunks-retract-entity-of-an-existing-block-independently-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljstx-item-group-keysand→or(and (vector? item)large-tx-keeps-groups-sharing-an-item-in-one-chunk-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsmerge-ranges<=→<(if (<= start prev-end)tx-entry-of-500-items-is-applied-as-large-tx-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsreduce-ordered-tx-chunks>→>=(> next-count large-tx-max-chunk-items))tx-entry-of-500-items-is-applied-as-large-tx-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljslarge-tx?>=→>(>= (count tx-data) large-tx-min-items))small-tx-entry-is-applied-as-one-plain-transaction-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsapply-tx-entry!and→or(if (and (not= outliner-op :db-migrate)large-db-migrate-entry-is-applied-in-one-transaction-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsapply-tx-entry!and→or(if (and (not= outliner-op :db-migrate)large-tx-removes-its-checksum-listener-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsapply-large-tx-entry!when→when-not(when sqlsnapshot-download-omits-gzip-when-env-flag-is-boolean-false-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljssnapshot-stream-gzip-enabled?false→true(false? v) falsesnapshot-stream-pages-by-the-last-row-addr-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljssnapshot-export-streamfirst→last(vreset! last-addr (first (peek batch)))import-snapshot-stream-resets-for-an-empty-snapshot-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsimport-snapshot-stream!true→falsereset? (and @reset-pending? true)]import-snapshot-stream-resets-for-an-empty-snapshot-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsimport-snapshot-stream!or→and(when (or reset? (seq rows))import-snapshot-stream-resets-only-with-the-first-chunk-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsimport-snapshot-stream!and→orreset? (boolean (and @reset-pending? (seq rows)))]snapshot-upload-decompresses-only-gzip-bodies-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsmaybe-decompress-streamif→if-not(if (and (= encoding snapshot-content-encoding) (exists? js/DecompressionStream)snapshot-upload-decompresses-only-gzip-bodies-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsmaybe-decompress-streamand→or(if (and (= encoding snapshot-content-encoding) (exists? js/DecompressionStream)snapshot-upload-decompresses-only-gzip-bodies-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsmaybe-decompress-stream=→not=(if (and (= encoding snapshot-content-encoding) (exists? js/DecompressionStream)snapshot-upload-decompresses-only-gzip-bodies-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploador→andencoding (or req-encoding "")]snapshot-upload-decompresses-only-gzip-bodies-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadand→or(if (and (= encoding snapshot-content-encoding)snapshot-upload-decompresses-only-gzip-bodies-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadnot→identity(not (exists? js/DecompressionStream)))snapshot-upload-without-decompression-stream-rejects-only-gzip-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsmaybe-decompress-streamif→if-not(if (and (= encoding snapshot-content-encoding) (exists? js/DecompressionStream)snapshot-upload-without-decompression-stream-rejects-only-gzip-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploador→andencoding (or req-encoding "")]snapshot-upload-without-decompression-stream-rejects-only-gzip-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadand→or(if (and (= encoding snapshot-content-encoding)snapshot-upload-without-decompression-stream-rejects-only-gzip-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-upload=→not=(if (and (= encoding snapshot-content-encoding)snapshot-upload-without-decompression-stream-rejects-only-gzip-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadnot→identity(not (exists? js/DecompressionStream)))snapshot-upload-reset-param-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsimport-snapshot-stream!and→orreset? (boolean (and @reset-pending? (seq rows)))]snapshot-upload-reset-param-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsparse-reset-paramif→if-not(if (nil? value)snapshot-upload-reset-param-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsparse-reset-paramnil?→some?(if (nil? value)snapshot-upload-reset-param-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljsparse-reset-paramnot→identity(not (contains? #{"false" "0"} value))))snapshot-upload-reset-param-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadwhen→when-not_ (when reset?snapshot-upload-reset-param-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadfalse→true(<set-graph-ready-for-use! self graph-id false))snapshot-upload-reset-param-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadwhen→when-not_ (when finished?snapshot-upload-reset-param-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadtrue→false(<set-graph-ready-for-use! self graph-id true))]snapshot-upload-marks-graph-uploading-until-finished-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadwhen→when-not_ (when reset?snapshot-upload-marks-graph-uploading-until-finished-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadtrue→false(storage/set-meta! (.-sql self) snapshot-uploading-meta-key true))snapshot-upload-marks-graph-uploading-until-finished-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadwhen→when-not_ (when reset?snapshot-upload-marks-graph-uploading-until-finished-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadfalse→true(<set-graph-ready-for-use! self graph-id false))snapshot-upload-marks-graph-uploading-until-finished-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadwhen→when-not_ (when finished?snapshot-upload-marks-graph-uploading-until-finished-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadfalse→true(storage/set-meta! (.-sql self) snapshot-uploading-meta-key false))snapshot-upload-marks-graph-uploading-until-finished-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadwhen→when-not_ (when finished?snapshot-upload-marks-graph-uploading-until-finished-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljshandle-sync-snapshot-uploadtrue→false(<set-graph-ready-for-use! self graph-id true))]snapshot-upload-returns-413-for-a-non-error-too-big-rejection-testdeps/db-sync/src/logseq/db_sync/worker/handler/sync.cljssqlite-too-big-error?or→and(let [message (-> (or (ex-message error)set-pending-editor-info-goes-into-next-entry-testsrc/main/frontend/worker/undo_redo.cljsset-pending-editor-info!if→if-not(if editor-infoui-state-entry-with-editor-info-returns-ui-state-str-testsrc/main/frontend/worker/undo_redo.cljsundo-redo-auxfirst→last:ui-state-str (second (first op))})synced-graph-history-action-tx-meta-testsrc/main/frontend/worker/undo_redo.cljsundo-redo-action-metanot→identity:redo? (not undo?)added-and-retracted-ids-testsrc/main/frontend/worker/undo_redo.cljsgen-undo-ops!and→or(fn [id] (and (nil? (d/entity db-after id)) (d/entity db-before id)))added-and-retracted-ids-testsrc/main/frontend/worker/undo_redo.cljsgen-undo-ops!nil?→some?(fn [id] (and (nil? (d/entity db-after id)) (d/entity db-before id)))added-and-retracted-ids-testsrc/main/frontend/worker/undo_redo.cljsgen-undo-ops!and→or(fn [id] (and (nil? (d/entity db-before id)) (d/entity db-after id)))added-and-retracted-ids-testsrc/main/frontend/worker/undo_redo.cljsgen-undo-ops!nil?→some?(fn [id] (and (nil? (d/entity db-before id)) (d/entity db-after id)))