Skip to content

Refuse renaming a page to a case variant of another page - #13516

Merged
tiensonqin merged 5 commits into
masterfrom
logseq/fix-page-rename-case-collision-9648
Sep 29, 2026
Merged

tiensonqin merged 5 commits into
masterfrom
logseq/fix-page-rename-case-collision-9648

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Renaming a page to a case variant of another ordinary page (for example Bar → foo when Foo already exists) was accepted. Create already treats those as the same page via :block/name / page-name-sanity-lc, so the graph ended up with two live pages that share one lookup name. [[foo]] then resolved to the oldest Foo.

Change

validate-unique-for-page now matches create for ordinary pages:

  • Collision is by :block/name (case-insensitive), not exact :block/title.
  • Same-parent siblings collide; top-level pages collide with other top-level pages.
  • Pages that share names under different parents stay allowed (db-test#272).
  • Tags and properties stay case-sensitive.

Page-only collisions notify with Another page named "{1}" already exists. (:page.validation/duplicate-name). Tagged-page collisions still use :page.validation/duplicate.

Tests

  • logseq.outliner.validate-test: top-level, tagged, namespaced sibling, different-parent, and same-page case-variant cases.
  • logseq.outliner.page-test: create foo still opens Foo; rename validation refuses Bar → foo.
  • frontend.worker.db-core-test/validate-block-tag-returns-notification-payload: existing page fixture now includes :block/name so tag uniqueness can find it.

deps/outliner nbb suite: 136 tests, 685 assertions, 0 failures.
frontend.worker.db-core-test: 147 tests, 1601 assertions, 0 failures.

Fixes logseq/db-test#1344

Open in Web Open in Cursor 

Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Fixed in cb375dd — validate-unique-for-page now evaluates the #Page exemption for every returned candidate (via some) and throws on the first non-exempt collision, so an exempt earlier candidate can no longer mask a real duplicate. Added validate-block-title-unique-checks-all-candidates covering the Foo #Company / foo #Fruit / Bar #Fruit → "FOO" scenario.

devin-ai-integration[bot]

This comment was marked as resolved.

cursoragent and others added 4 commits September 29, 2026 13:58
Rename/save-block uniqueness now matches create: ordinary pages collide on
:block/name for the same parent or among top-level pages. Tags and properties
stay case-sensitive. Pages that share names under different parents remain
allowed.

Co-authored-by: Tienson Qin <[email protected]>
validate-block-tag-returns-notification-payload now includes the page
lookup name so rename/create uniqueness can find the existing Object page.

Co-authored-by: Tienson Qin <[email protected]>
@tiensonqin
tiensonqin force-pushed the logseq/fix-page-rename-case-collision-9648 branch from 12e171f to ed727c3 Compare September 29, 2026 05:58
Extract colliding-tag-ids and throw-duplicate so validate-unique-for-page
stays under the 55-line lint max.

Co-authored-by: Tienson Qin <[email protected]>
@tiensonqin
tiensonqin merged commit 82e2717 into master Sep 29, 2026
21 checks passed
@tiensonqin
tiensonqin deleted the logseq/fix-page-rename-case-collision-9648 branch September 29, 2026 09:14
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 1, 2026
* fix(outliner): refuse rename to a case-variant page name

Rename/save-block uniqueness now matches create: ordinary pages collide on
:block/name for the same parent or among top-level pages. Tags and properties
stay case-sensitive. Pages that share names under different parents remain
allowed.

Co-authored-by: Tienson Qin <[email protected]>

* fix(test): set :block/name on page used for tag uniqueness

validate-block-tag-returns-notification-payload now includes the page
lookup name so rename/create uniqueness can find the existing Object page.

Co-authored-by: Tienson Qin <[email protected]>

* fix(outliner): check all name-collision candidates and merge duplicate queries

* fix(outliner): keep i18n keys as map literals for translation lint

* fix(outliner): split page uniqueness helpers under large-vars limit

Extract colliding-tag-ids and throw-duplicate so validate-unique-for-page
stays under the 55-line lint max.

Co-authored-by: Tienson Qin <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
* fix(outliner): refuse rename to a case-variant page name

Rename/save-block uniqueness now matches create: ordinary pages collide on
:block/name for the same parent or among top-level pages. Tags and properties
stay case-sensitive. Pages that share names under different parents remain
allowed.

Co-authored-by: Tienson Qin <[email protected]>

* fix(test): set :block/name on page used for tag uniqueness

validate-block-tag-returns-notification-payload now includes the page
lookup name so rename/create uniqueness can find the existing Object page.

Co-authored-by: Tienson Qin <[email protected]>

* fix(outliner): check all name-collision candidates and merge duplicate queries

* fix(outliner): keep i18n keys as map literals for translation lint

* fix(outliner): split page uniqueness helpers under large-vars limit

Extract colliding-tag-ids and throw-duplicate so validate-unique-for-page
stays under the 55-line lint max.

Co-authored-by: Tienson Qin <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
* fix(outliner): refuse rename to a case-variant page name

Rename/save-block uniqueness now matches create: ordinary pages collide on
:block/name for the same parent or among top-level pages. Tags and properties
stay case-sensitive. Pages that share names under different parents remain
allowed.

Co-authored-by: Tienson Qin <[email protected]>

* fix(test): set :block/name on page used for tag uniqueness

validate-block-tag-returns-notification-payload now includes the page
lookup name so rename/create uniqueness can find the existing Object page.

Co-authored-by: Tienson Qin <[email protected]>

* fix(outliner): check all name-collision candidates and merge duplicate queries

* fix(outliner): keep i18n keys as map literals for translation lint

* fix(outliner): split page uniqueness helpers under large-vars limit

Extract colliding-tag-ids and throw-duplicate so validate-unique-for-page
stays under the 55-line lint max.

Co-authored-by: Tienson Qin <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a page to a case variant of another page's name makes 2 pages with 1 name

2 participants