Skip to content

Feature/wiki links indexer#1123

Merged
perber merged 5 commits into
mainfrom
feature/wiki-links-indexer
Jun 4, 2026
Merged

Feature/wiki links indexer#1123
perber merged 5 commits into
mainfrom
feature/wiki-links-indexer

Conversation

@perber

@perber perber commented Jun 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

perber added 2 commits June 4, 2026 16:52
…ndexer

Adds extraction of [[Title]] and [[Title|Alias]] patterns from page content,
resolved via title-based lookup. [[Folder/Title]] syntax is treated as a path
hint and resolved via the existing route-path lookup. Single matches are stored
as resolved outgoing links; ambiguous or missing titles are stored as broken.
…ture

B1: Replace [[target]] sentinel format with "wikilink:<target>" so broken
    wiki-link records are distinguishable from normal paths and can be
    found by the healing infrastructure.

B2: Fall back to title-based lookup when a slash-containing target fails
    the path lookup, so [[C/C++]] and similar titles are not always broken.

B3: Add HealWikiLinksForTitle to LinksStore, HealWikiLinksForPage to
    LinkService, and wire both into LinkIndexSideEffect.updateAndHeal.
    When a page is created or restored, broken [[Title]] sentinels that
    match its title are healed automatically.

B4: Strip the "wikilink:" prefix in toOutgoingResultItem so the API
    returns [[Title]] in the to_path field instead of the raw sentinel.
Copilot AI review requested due to automatic review settings June 4, 2026 15:00

Copilot AI 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.

Pull request overview

This PR extends LeafWiki’s link indexing/healing pipeline to understand [[Title]] / [[Title|Alias]] wiki-link syntax, persist unresolved wiki-links via a sentinel to_path, and attempt to heal those links automatically after relevant page mutations.

Changes:

  • Add wiki-link parsing and resolution ([[...]]) alongside existing Markdown link indexing.
  • Introduce a wikilink: sentinel scheme for broken wiki-links plus a store/service heal path for those sentinels.
  • Add unit tests covering wiki-link extraction, resolution, and post-creation healing.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/wiki/pagesave/link_effect.go Triggers wiki-link healing after page mutations.
internal/links/links_store.go Adds DB healing method for wiki-link sentinel records.
internal/links/link_service.go Routes indexing through combined Markdown + wiki-link target collection; exposes wiki-link heal method.
internal/links/link_service_test.go Adds tests for extraction/resolution and healing behavior.
internal/links/helpers.go Implements [[...]] parsing, sentinel helpers, and wiki-link target resolution; improves outgoing display for sentinels.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/wiki/pagesave/link_effect.go Outdated
Comment thread internal/links/links_store.go
Comment thread internal/links/links_store.go
Comment thread internal/links/helpers.go
perber added 3 commits June 4, 2026 17:09
HealWikiLinksForPage was only called on Create/Restore. After renaming
a page (title change), broken [[NewTitle]] sentinels in other pages were
never healed. Calling it after every Update ensures that renaming a page
to a title that was previously broken as a wiki-link resolves correctly.
1. Move HealWikiLinksForPage into healExact so it runs consistently for
   all code paths (Create/Restore/Move/Update), removing the separately
   placed call and the duplication in updateAndHeal.

2. Use COLLATE NOCASE in HealWikiLinksForTitle so that a broken [[target
   page]] sentinel is healed when the page is created as "Target Page",
   matching the case-insensitive behaviour of FindPagesByTitle.

3. Skip wikilink sentinel paths in rewriteResolvedTargets to prevent
   them being normalised as route paths (e.g. /wikilink:Title) during
   rename/move refactors, which would make them permanently unresolvable.

4. Store broken path-hint targets as normal route paths instead of
   sentinels so HealLinksForExactPath can heal them when the target page
   is later created at that path.
@perber
perber merged commit 8e87d56 into main Jun 4, 2026
9 checks passed
@perber
perber deleted the feature/wiki-links-indexer branch June 4, 2026 15:23
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.

2 participants