fix(lint): derive stub type from target path; slug-match sweep resolution - #753
Open
HUAN2022A wants to merge 1 commit into
Open
fix(lint): derive stub type from target path; slug-match sweep resolution#753HUAN2022A wants to merge 1 commit into
HUAN2022A wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #733
Problem (both halves of the issue)
Part 1 — wrong stub type. Lint's "Fix broken link" keeps the broken target's directory but hard-codes
type: query, producing pages likewiki/concepts/clash-detection.mdwithtype: query. Those pages are then removed from the graph (HIDDEN_TYPESinwiki-graph.ts) and rejected byvalidateWikiPageRoutingon the next write along that path — the app refuses content it created itself. The reporter accumulated 106 such pages, including their most-referenced page (160 inbound links), invisible in the graph.Part 2 — "Create Page" and review sweeps never agree. Review-created pages get timestamped filenames (
clash-detection-2026-09-06-143052.md) whilesweepResolvedReviewsresolvesmissing-pageitems on exact id/title match only, so the suggestion keeps coming back even though the page exists.Fix
Part 1 (
lint-fixes.ts, ~8 lines): newstubPageType(relativePath)derives the frontmatter type from the destination folder via the existinginferWikiTypeFromPath(which the issue notes was already there, UI-only until now):concepts/foo-bar.md→concept; single-segment targets still land inqueries/asquery(unchanged); unknown knowledge dirs (standards, playbooks, …) fall through to the directory name, matching what schema routing expects. Both "Fix" and "Fix All" callensureBrokenLinkStub, so they're covered automatically.Part 2 (
sweep-reviews.ts, ~12 lines):buildWikiIndexnow also indexes the slug of each page's frontmatter title (byTitleSlug), andpageExistsgains a final rule: a candidate matches if its slug equals an indexed title slug — so a candidate namedclash-detectionresolves against the timestamped page. Titles containing no letters/digits are skipped when indexing (makeQuerySlug degenerates to "query" for those, which would let unrelated candidates collide). Deliberately not changed: the Create Page timestamp itself (intentional same-day overwrite protection, per the wiki-filename.ts docstring) and any migration of the reporter's 106 existing pages (better as a separate lint rule).Testing
lint-fixes.test.ts: multi-segment targets now stub withtype: concept/type: entity; single-segment regression (stillqueryinqueries/); unknown-dir fallback;stubPageTypeunit cases.sweep-reviews-build-wiki-index.test.ts: slug indexed from frontmatter title of a timestamped page;pageExistspositive (bare candidate ↔ timestamped page) and negative (unrelated name) cases; body-title lines still excluded from the index.npm run test:mocks: 132 files / 1886 tests passed ·npm run typecheck: clean