Skip to content

fix: reindex and resolve journals by current title format - #14060

Closed
tiensonqin wants to merge 1 commit into
masterfrom
devin/1795019181-journal-title-display-format
Closed

tiensonqin wants to merge 1 commit into
masterfrom
devin/1795019181-journal-title-display-format

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Display-only alternative to #14059: stored journal :block/title / :block/name are never rewritten when :logseq.property.journal/title-format changes; titles keep being computed at read time (entity_plus). This PR closes the two read-side gaps:

  • Search (get-affected-blocks): when the Journal formatter differs between db-before and db-after, all :block/journal-day entities are fed into the existing title-change invalidation path, so journals and blocks referencing them are reindexed with the new-format title.
  • Lookup (get-first-page-by-name): a string that round-trips exactly through the current formatter (normalized with page-name-sanity-lc) resolves by journal-day; anything else (e.g. 2021Q4, which the loose parser accepts under dd.MM.yyyy) falls back to stored-name lookup.

No schema bump, migration, pipeline or exporter change.

Known tradeoff vs #14059: readers of raw stored datoms still see the old-format title/name — Datalog/query DSL title rules, case-sensitive title lookup, All Pages fast filter (view.cljs), plugin get_all_pages, API get-page-data, semantic search prefilter.

Tests: search regressions (Settings :set-block-property route, new-format journal + referrer found, old format no longer matches, stored title/name unchanged) and lookup regressions incl. 2021Q4. frontend.worker.pipeline-test + frontend.worker.search-test: 120 tests, 532 assertions, 0 failures; clj-kondo clean.


QA Engineer opened this PR for Tienson
Implemented in session Fix custom date format journal title and search
Review with Devin · Open in Devin Desktop


@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +24 to +28
(or (when (and journal-day
(= (common-util/page-name-sanity-lc page-name)
(common-util/page-name-sanity-lc
(date-time-util/int->journal-title journal-day formatter))))
(:e (first (d/datoms db :avet :block/journal-day journal-day))))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Date-named pages resolve to wrong journals

After changing formats, get-first-page-by-name returns a journal before an existing page with the same displayed title. Opening that page by name lands on the journal instead.

Learn more

A page name lookup previously selected the oldest page whose stored :block/name matched the requested name. Journal titles are now computed from the current format, while stored names remain unchanged. When the format changes, an existing ordinary page can have the same name as a journal's newly displayed title. The journal-day lookup wins even though the ordinary page is still present. get-page and the name lookup in get-block then select the wrong entity.

Example: Create an ordinary page named 20.01.2004 while journals use MMM do, yyyy, and create a journal for January 20, 2004. Change the journal format to dd.MM.yyyy. Opening 20.01.2004 now opens the journal rather than the ordinary page.

Recommended fix: Define collision precedence for stored-name matches versus computed journal titles. Preserve access to an exact stored-name page and provide an unambiguous journal lookup by day for the journal-specific paths.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Browser QA

Compared base 8ab397fef8, this PR (fcff453104) and #14059 on disposable DB graphs (recording, incl. base vs. changed before/after).

Passed

  • Search: new-format query finds journal + referencing blocks; old-format query no longer matches.
  • Autocomplete of a new-format [[date]] resolves to the existing journal (no duplicate).
  • Second format change search and undo: no error.

Failed

  • After changing the format, journal headings, references, Journals view and All Pages keep the old-format title, also after reload.
  • All Pages filter with the new-format title (2024-12-16 Monday) returns no rows.
  • Search result label for the journal still shows the old-format title.
Stale heading/references after reload Empty All Pages filter Stale search label
stale filter search

Untested: RTC/multi-client, raw Datalog/plugin API readers.

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.

1 participant