refactor: search.ts の scan 系 3 関数の boilerplate を helper に集約 (#259)#260
Merged
Conversation
…el helper に集約 (#259) searchFilesImpl / scanUnresolvedWikilinksImpl / scanBacklinksImpl の `Promise.all + ioLimit + isStale 2 重 check + try/catch readFile` boilerplate (~5 行 × 3 = 15 行重複) を file-private helper に集約。skipFile callback で scanBacklinksImpl の self-skip も統一表現。挙動・並列度・cancel 反応性は変更なし。
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.
概要
electron/main/ipc/search.tsの 3 つの scan 系 IPC (searchFilesImpl/scanUnresolvedWikilinksImpl/scanBacklinksImpl) で duplicate していたPromise.all + ioLimit + isStale 2 重 check + try/catch readFileboilerplate (~5 行 × 3 = 15 行重複) を file-private helperprocessMdFilesParallelに集約。skipFilecallback を導入し、scanBacklinksImplの self-skip も統一表現で吸収。挙動・並列度 (
ioLimit(16)) ・cancel 反応性は変更なし、pure refactor。関連 Issue
closes #259
移行 Stage
(該当 stage なし — 既存機能のリファクタリング)
変更内容
electron/main/ipc/search.ts:processMdFilesParallel(ioFiles, inFiles, isStale, { skipFile?, process })helper を file-private で追加 (Promise.all + ioLimit + isStale 2 重 check + try/catch readFile を集約)searchFilesImpl: per-line scan logic をprocesscallback として渡す形に書き換えscanUnresolvedWikilinksImpl:displayPath算出 +iterateWikilinkOccurrencescallback をprocessで表現scanBacklinksImpl: self-skip (inFile === targetInput) をskipFilecallback で表現。readFile 前 timing は維持PR #250 skip 判定の再判定 (issue #259 §採用根拠 抜粋)
PR #250 で
/simplifyreviewer が同 helper 抽出を指摘したが「scope 拡大、3 関数の body が異なり薄い wrapper にしかならない」と当時 skip された。本 PR では:search.ts内に閉じている)skipFilecallback でscanBacklinksImplの self-skip も対称化可能 (PR refactor: search.ts の scan 系 IPC を bounded-concurrency parallel readFile 化 (#249) #250 当時の skip 判定根拠の一部を解消)動作確認
pnpm typecheck3 config (node / web / e2e) passbiome check electron/main/ipc/search.tscleanpnpm test2230 pass / 2 skipped (regression なし、search.test.ts 93 pass)/code-review lowで runtime correctness bugs なし確認 ((none))スクリーンショット
UI 変更なし。