Skip to content

test: same-line [[target]] [[target]] の trim test を追加 (#241)#244

Merged
ymnao merged 1 commit into
mainfrom
feature/same-line-wikilink-trim-test-#241
Jun 27, 2026
Merged

test: same-line [[target]] [[target]] の trim test を追加 (#241)#244
ymnao merged 1 commit into
mainfrom
feature/same-line-wikilink-trim-test-#241

Conversation

@ymnao

@ymnao ymnao commented Jun 27, 2026

Copy link
Copy Markdown
Owner

概要

iterateWikilinkOccurrences (electron/main/ipc/search.ts:367-380) は yield 毎に新規 ref オブジェクトを alloc する設計で、PR #235 で producer-side に置いた line.trim() はその「per-yield 新規 alloc」前提に依存している。将来 helper が ref を pool / reuse する refactor を入れると trim 効果が壊れる可能性があるため、同一行に [[target]] が複数回出る case を defensive な test として lock する。

production code は無変更 (test 追加のみ、+38 / -0)。

関連 Issue

Closes #241

移行 Stage

post-migration の保守 (該当 Stage なし)

変更内容

issue snippet からの逸脱

なし。issue 本文の snippet をほぼそのまま採用 (formatter による expect の行折り返し差のみ)。

動作確認

  • node_modules/.bin/tsc --noEmit — pass (typecheck clean)
  • node_modules/.bin/biome check electron/main/ipc/search.test.ts — pass
  • node_modules/.bin/vitest run electron/main/ipc/search.test.ts — 93/93 pass (新規 2 件含む)
  • node_modules/.bin/vitest run (full suite) — 2230 passed / 2 skipped / 0 failed (HANDOFF 41 の 2228 + 新規 2 = 想定通り)
  • /code-review medium — 8 angle (3 correctness + 3 cleanup + altitude + conventions) review、findings 0 件

`iterateWikilinkOccurrences` (search.ts:367-380) は yield 毎に新規 ref オブ
ジェクトを alloc する設計で、PR #235 で producer-side に置いた `line.trim()`
はその「per-yield 新規 alloc」前提に依存している。将来 helper が ref を pool /
reuse する refactor を入れると trim 効果が壊れる可能性があるため、同一行に
`[[target]]` が複数回出る case を defensive な test として lock する。

- `scanBacklinksImpl` describe: 既存 #227 trim test (line 432-443) の隣に追加。
  `src.md` に `"  see [[target]] and [[target]] in the same line  \n"` を書き、
  両 ref の `lineContent` が同一 trim 済 string であること、`byteOffset` は別
  であることを assert。
- `scanUnresolvedWikilinksImpl` describe: 対称に追加。issue では optional 扱い
  だが、既存 #227 trim test が両 consumer にペアで存在する pattern と整合させ
  るため両側追加する判断。

production code は無変更 (test 追加のみ、+38 / -0)。
@ymnao ymnao merged commit f4c0886 into main Jun 27, 2026
9 checks passed
@ymnao ymnao deleted the feature/same-line-wikilink-trim-test-#241 branch June 27, 2026 02:57
@ymnao ymnao mentioned this pull request Jul 5, 2026
7 tasks
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.

test: same-line [[target]] [[target]] の trim test を追加 (iterateWikilinkOccurrences の per-yield 新規 alloc を lock)

1 participant