fix(db): date-named tags create valid classes by tiensonqin · Pull Request #13779 · logseq/logseq · GitHub
Skip to content

fix(db): date-named tags create valid classes - #13779

Open
tiensonqin wants to merge 2 commits into
masterfrom
logseq/fix-date-class-journal-collision-3492
Open

tiensonqin wants to merge 2 commits into
masterfrom
logseq/fix-date-class-journal-collision-3492

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1447

Problem

In DB graphs, creating a tag/class whose title looks like a date produced an invalid hybrid entity: a Tag that also carried :block/journal-day, the deterministic journal UUID (00000001-YYYY-MMDD-0000-000000000000), and sometimes :block.temp/original-page-name. Closed-schema validation then failed (:block/journal-day / :block.temp/original-page-name disallowed on a class page, :logseq.property.class/extends missing/wrong, ident should be :logseq.class/Root).

Paths:

  • Saving a block that tags a date: #2024-01-01, #[[2024-01-01]], #x[[Jan 1st, 2024]]
  • Creating a tag directly: outliner-page/create! with {:class? true} and title Jan 1st, 2024 / jan 1st, 2024 / 2024-01-01

Root cause: page-name-string->map ran convert-page-if-journal whenever the title parsed as a date, including when class? was true. Journal attributes then leaked into class construction.

Design choice

Create a plain valid class from a date-like title (option a), rather than refusing the name (option b).

Why:

  • Classes and journals are different entity types. A title that happens to look like a date is still a valid class name (#2024-01-01 should tag, not fail).
  • The parser already has skip-journal? for this distinction; using it is the smallest consistent change.
  • Refusing date-like tags would surprise users and would not match titles like 20240101 / jan 1st, 2024x, which already worked.
  • An existing journal with the same title is not converted or merged. #x[[Jan 1st, 2024]] also does not create a journal-attributed class. A page ref such as [[2024-01-01]] still creates a journal.

The resulting class has no :block/journal-day, no journal UUID, no persisted :block.temp/original-page-name, :logseq.property.class/extends :logseq.class/Root, and a normal user.class ident.

Slash journal titles such as 2026/05/18 stay a single class even when split-namespace? is true (the frontend default). They are dates, not parent/child namespaces.

Changes

  • Graph parser: skip journal conversion for DB classes/tags.
  • Outliner page create: do not look up or reuse journal UUID when class?; do not convert an existing journal into a class; do not split slash journal titles into namespace tags.
  • Outliner ref resolution: date-like tags create classes without forwarding journal UUID / original-page-name.
  • build-new-class: strip leftover journal identity (journal-day, original-page-name, journal/page tags, journal UUID).

Tests

  • logseq.graph-parser.block-test
  • logseq.outliner.page-test
  • logseq.db.frontend.class-test
  • frontend.handler.db-based.editor-test (wrap-parse-block)
  • frontend.worker.pipeline-test (save-block + closed-schema validation)

No editor UI behavior change, so no clj-e2e coverage added.

Open in Web Open in Cursor 

Creating a tag or class whose title looks like a date no longer
attaches journal-day, a journal UUID, or original-page-name. The
entity is a normal class that extends Root and passes closed-schema
validation. Existing journal pages with the same title stay journals.

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>

Copy link
Copy Markdown
Contributor Author

Class create skips journal conversion, so a title like 2026/05/18
no longer has journal-day. Treat slash journal titles as a single
class instead of splitting them into parent tags.

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
@cursor

cursor Bot commented Oct 17, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

DB graph: tagging a date (#2024-01-01) creates a class page that is also a journal

2 participants