Skip to content

refactor: search.ts の scan 系 3 関数の boilerplate を helper に集約 (#259)#260

Merged
ymnao merged 1 commit into
mainfrom
refactor/scan-md-files-parallel-helper-#259
Jun 28, 2026
Merged

refactor: search.ts の scan 系 3 関数の boilerplate を helper に集約 (#259)#260
ymnao merged 1 commit into
mainfrom
refactor/scan-md-files-parallel-helper-#259

Conversation

@ymnao

@ymnao ymnao commented Jun 28, 2026

Copy link
Copy Markdown
Owner

概要

electron/main/ipc/search.ts の 3 つの scan 系 IPC (searchFilesImpl / scanUnresolvedWikilinksImpl / scanBacklinksImpl) で duplicate していた Promise.all + ioLimit + isStale 2 重 check + try/catch readFile boilerplate (~5 行 × 3 = 15 行重複) を file-private helper processMdFilesParallel に集約。skipFile callback を導入し、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 を process callback として渡す形に書き換え
    • scanUnresolvedWikilinksImpl: displayPath 算出 + iterateWikilinkOccurrences callback を process で表現
    • scanBacklinksImpl: self-skip (inFile === targetInput) を skipFile callback で表現。readFile 前 timing は維持

PR #250 skip 判定の再判定 (issue #259 §採用根拠 抜粋)

PR #250/simplify reviewer が同 helper 抽出を指摘したが「scope 拡大、3 関数の body が異なり薄い wrapper にしかならない」と当時 skip された。本 PR では:

動作確認

  • pnpm typecheck 3 config (node / web / e2e) pass
  • biome check electron/main/ipc/search.ts clean
  • pnpm test 2230 pass / 2 skipped (regression なし、search.test.ts 93 pass)
  • /code-review low で runtime correctness bugs なし確認 ((none))
  • CI (lint / typecheck / test / build / e2e / electron-e2e / dependency-review / CodeQL)

スクリーンショット

UI 変更なし。

…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 反応性は変更なし。
@ymnao ymnao merged commit 036d120 into main Jun 28, 2026
9 checks passed
@ymnao ymnao deleted the refactor/scan-md-files-parallel-helper-#259 branch June 28, 2026 15:40
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.

refactor: search.ts の scan 系 3 関数の Promise.all + ioLimit boilerplate を processMdFilesParallel helper に集約

1 participant