CanonicalizeLinks silently leaves wing:/wiki/-prefixed wikilinks broken instead of repairing them #87

Closed
opened 2026-07-26 21:12:24 +00:00 by mathias · 1 comment
Owner

Problem

4 wikilinks have a literal path-root prefix baked into the target text instead of a clean slug:

  • wiki/homelab/failures/act-runner-host-mode-container-needs-node-and-libatomic.md[[wing:homelab/failures/rootless-buildah-act-runner-run-containers-denied]]
  • same file → [[wing:homelab/failures/act-runner-host-executor-tmp-persists]]
  • wiki/agentsquad/hypotheses/council-consolidation-standalone-deliberation-service.md[[wiki/agentsquad/decisions/autoresearch-council-sibling-pipe]]
  • same file → [[wiki/agentsquad/facts/llm-council-design-and-first-runs-2026-06-21]]

Both targets resolve correctly once the wing:/wiki/ prefix is stripped — the underlying notes exist.

Where it lives

ingestion/internal/pipeline/links.go, CanonicalizeLinks/canonicalizeContent. plainLinkRE matches any [[...]] without a pipe, including these path-prefixed forms, and treats the whole string as a "display name" to look up in titleToSlug (built from note titles, not paths). Lookup fails, it emits an "unknown wikilink" warning and leaves the malformed link untouched — so however the LLM extraction step originally produced a path-style link (likely a schema/prompt slip, not this function), this canonicalization pass has no path to actually repair it.

Scope

Before falling back to the title-lookup path, detect and strip a leading wing: or wiki/ (or any known root prefix) from the bracket content, and try resolving the remainder as a path-style wing/hall/slug or hall/slug target directly (same resolution style the audit tooling in brain-gardener already uses per knowledge/brain-graph-key-by-path-not-basename-slug.md). Also worth checking BuildPrompt's schema instructions — if the LLM is told exact link syntax and still produces prefixed forms, the schema/prompt may need tightening too.

Scope (repair)

Fix the 4 existing links to clean hall/slug form once the normalizer handles this case.

Acceptance criteria

  • Regression test covering both prefix shapes resolving correctly.
  • The 4 links repaired.
## Problem 4 wikilinks have a literal path-root prefix baked into the target text instead of a clean slug: - `wiki/homelab/failures/act-runner-host-mode-container-needs-node-and-libatomic.md` → `[[wing:homelab/failures/rootless-buildah-act-runner-run-containers-denied]]` - same file → `[[wing:homelab/failures/act-runner-host-executor-tmp-persists]]` - `wiki/agentsquad/hypotheses/council-consolidation-standalone-deliberation-service.md` → `[[wiki/agentsquad/decisions/autoresearch-council-sibling-pipe]]` - same file → `[[wiki/agentsquad/facts/llm-council-design-and-first-runs-2026-06-21]]` Both targets resolve correctly once the `wing:`/`wiki/` prefix is stripped — the underlying notes exist. ## Where it lives `ingestion/internal/pipeline/links.go`, `CanonicalizeLinks`/`canonicalizeContent`. `plainLinkRE` matches any `[[...]]` without a pipe, including these path-prefixed forms, and treats the whole string as a "display name" to look up in `titleToSlug` (built from note *titles*, not paths). Lookup fails, it emits an "unknown wikilink" warning and leaves the malformed link untouched — so however the LLM extraction step originally produced a path-style link (likely a schema/prompt slip, not this function), this canonicalization pass has no path to actually repair it. ## Scope Before falling back to the title-lookup path, detect and strip a leading `wing:` or `wiki/` (or any known root prefix) from the bracket content, and try resolving the remainder as a path-style `wing/hall/slug` or `hall/slug` target directly (same resolution style the audit tooling in brain-gardener already uses per `knowledge/brain-graph-key-by-path-not-basename-slug.md`). Also worth checking `BuildPrompt`'s schema instructions — if the LLM is told exact link syntax and still produces prefixed forms, the schema/prompt may need tightening too. ## Scope (repair) Fix the 4 existing links to clean `hall/slug` form once the normalizer handles this case. ## Acceptance criteria - Regression test covering both prefix shapes resolving correctly. - The 4 links repaired.
Author
Owner

Fixed in hyperguild@6d014c1. canonicalizeContent now strips a known wing:/wiki/ root prefix and emits the clean path-style target directly when the title-lookup fails (path-style targets never match a title, so they always fell through to the unknown-wikilink warning before). Regression tests cover both prefix shapes; confirmed title-lookup still takes priority for normal display-name links.

Repaired the 4 known-broken links in mathias/brain@3bcae87 (confirmed all 4 targets exist before editing):

  • wing:homelab/failures/rootless-buildah-act-runner-run-containers-deniedhomelab/failures/rootless-buildah-act-runner-run-containers-denied
  • wing:homelab/failures/act-runner-host-executor-tmp-persistshomelab/failures/act-runner-host-executor-tmp-persists
  • wiki/agentsquad/decisions/autoresearch-council-sibling-pipeagentsquad/decisions/autoresearch-council-sibling-pipe
  • wiki/agentsquad/facts/llm-council-design-and-first-runs-2026-06-21agentsquad/facts/llm-council-design-and-first-runs-2026-06-21
Fixed in hyperguild@6d014c1. `canonicalizeContent` now strips a known `wing:`/`wiki/` root prefix and emits the clean path-style target directly when the title-lookup fails (path-style targets never match a title, so they always fell through to the unknown-wikilink warning before). Regression tests cover both prefix shapes; confirmed title-lookup still takes priority for normal display-name links. Repaired the 4 known-broken links in `mathias/brain@3bcae87` (confirmed all 4 targets exist before editing): - `wing:homelab/failures/rootless-buildah-act-runner-run-containers-denied` → `homelab/failures/rootless-buildah-act-runner-run-containers-denied` - `wing:homelab/failures/act-runner-host-executor-tmp-persists` → `homelab/failures/act-runner-host-executor-tmp-persists` - `wiki/agentsquad/decisions/autoresearch-council-sibling-pipe` → `agentsquad/decisions/autoresearch-council-sibling-pipe` - `wiki/agentsquad/facts/llm-council-design-and-first-runs-2026-06-21` → `agentsquad/facts/llm-council-design-and-first-runs-2026-06-21`
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/hyperguild#87