Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions TESTING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ For background log or metrics sinks, use explicit writer-entry/release signals a
- For bounded NDJSON streams, include plain and recipe/audit search paths, parse the final `terminal_record`, verify authoritative-versus-lower-bound totals (including per-query and total-limit omissions) and selection reasons/counts before result-limit trimming, count UTF-8 bytes including newlines, and assert partial exit `11` plus the explicit `--allow-partial` exit-`0` opt-in. Also assert that capped profile/verbose/envelope combinations fail before stdout.
- Keep `symbols` and `files` `--results-only` coverage in one seeded discovery fixture: assert each command emits only parseable NDJSON result rows without a `terminal_record`, and assert array output is rejected instead of silently ignoring the row-stream control.
- For `find --all`, cover row-terminal, count-object, and human scan metadata together: assert indexed literal candidate selection can reach a late-sorted match before the line cap, every indexed candidate is reverified, `search_strategy` / fallback reasons distinguish regex, exact-normalized, short, non-ASCII, legacy-index, active-bulk-rebuild, and missing-sync-trigger scans, and trigram synchronization survives incremental insert/update/delete plus bulk rebuild. Simulate an older writer by leaving the trigram table while removing its synchronization triggers; prove query-only fallback remains complete and writable initialization rebuilds the stale index. Also assert active file/line caps, `scan_complete` / authority fields, stable continuation/recovery guidance, the same partial-exit opt-in, option-order handling, and rejection of every row format that cannot carry terminal metadata. Envelope tests must keep row terminals in `metadata.stream_terminal` and preserve count objects as results.
- Long-token search fallback coverage must pair a greater-than-1000-rune minified HTML/JavaScript token with a short ASCII middle literal and an ordinary shorter-token substring control. Assert search, total count, and per-file count stay aligned; the fallback must require current `fts_token_too_long` evidence and a synchronized trigram index.
- For `find` context controls, cover separated and inline `--context`, both relative orders with `--before` / `--after`, and a JSON-lines batch invocation; assert that explicit asymmetric sides win independently of order.
- For rejected checkpoint names, assert the usage exit/error code and syntax hint together, and verify that no checkpoint directory was created.

Expand Down Expand Up @@ -2078,6 +2079,7 @@ background の log / metrics sink は、sleep や狭い stopwatch 閾値では
- 上限付き NDJSON stream は plain search と recipe / audit search の両経路を含め、最後の `terminal_record` を解析し、query ごとおよび total-limit の省略を含む authoritative / lower-bound の総件数、result-limit 適用前の selection 理由 / 件数、改行を含む UTF-8 byte 数、partial 終了コード `11`、明示的な `--allow-partial` による終了コード `0` の opt-in を検証する。上限付き profile / verbose / envelope の組み合わせが stdout 前に失敗することも確認する。
- `symbols` と `files` の `--results-only` coverage は 1 つの seed 済み discovery fixture で共有し、各 command が `terminal_record` を含まない parse 可能な NDJSON result row だけを出力すること、および array 出力では row-stream control を黙って無視せず拒否することを検証する。
- `find --all` は row 終端、count object、human scan metadata を併せて検証する。index を使う literal の候補選択が line cap より後ろに sort された一致へ到達できること、index の全候補を再検証すること、`search_strategy` / fallback reason が regex、exact normalization、短い query、非 ASCII、旧 index、bulk rebuild 中、同期 trigger 欠落の走査を区別すること、trigram 同期が incremental insert / update / delete と bulk rebuild 後も維持されることを確認する。旧 writer を模擬して trigram table を残したまま同期 trigger を削除し、query-only fallback が完全性を保つことと writable initialization が古い index を再構築することを証明する。さらに、有効な file / line cap、`scan_complete` / authority field、安定した continuation / recovery 案内、同じ partial-exit opt-in、option 順序の扱い、終端 metadata を持てない全 row format の拒否を確認する。envelope test では row 終端を `metadata.stream_terminal` に入れ、count object を result として保持することを検証する。
- long-token search fallback coverage では、1000 rune 超の minified HTML / JavaScript token、中央にある短い ASCII literal、通常の短い token 内の substring control を組み合わせる。search、総 count、file ごとの count が一致すること、および fallback が現在有効な `fts_token_too_long` の evidence と同期済み trigram index を必須とすることを検証する。
- `find` の context control は、separated / inline の `--context`、`--before` / `--after` との両方の相対順序、JSON Lines batch invocation を検証し、明示した asymmetric side が順序に依存せず優先されることを確認する。
- 拒否される checkpoint 名では usage の終了コード / error code と構文 hint を併せて検証し、checkpoint directory が作成されていないことも確認する。

Expand Down
12 changes: 12 additions & 0 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,13 @@ Search normalizes literal FTS queries to Unicode NFC before matching. If every
literal token exceeds SQLite FTS5 unicode61's 1000-character token cap,
zero-result JSON includes `query_degraded_reason` and `tokens_dropped`. Index
validation reports long unbroken FTS tokens as `fts_token_too_long`.
When an ordinary literal search has no matches, an ASCII unicode61 token
substring of at least three characters can be recovered from a reported
overlong token through the synchronized trigram index. The candidate is
rechecked against the greater-than-1000-rune unicode61 token before it is
returned, so substrings in ordinary tokens remain non-matches. This bounded
fallback is unavailable while the trigram index is missing, rebuilding, or
lacks its synchronization triggers.
Literal-safe `search` queries are capped at 1000 characters and 128 whitespace
terms. Oversized generated input is rejected before FTS5 sanitization; split it
into smaller searches or use narrower text.
Expand Down Expand Up @@ -4956,6 +4963,11 @@ literal FTS クエリは照合前に Unicode NFC へ正規化されます。す
token が SQLite FTS5 unicode61 の 1000 文字 token 上限を超える場合、0 件
JSON には `query_degraded_reason` と `tokens_dropped` が含まれます。index
validation は長い連続 FTS token を `fts_token_too_long` として報告します。
通常の literal search が 0 件の場合、3 文字以上の ASCII unicode61 token の
部分文字列は、同期済み trigram index を介して報告済みの長すぎる token 内から復旧できます。
候補を返す前に 1000 rune 超の unicode61 token 内の一致を再検証するため、通常の
token 内の部分文字列は一致になりません。この限定 fallback は trigram index が
存在しない場合、再構築中の場合、または同期 trigger が欠落している場合は使われません。
literal-safe な `search` query は 1000 文字、128 whitespace term までです。
生成された大きすぎる入力は FTS5 sanitization 前に拒否されるため、小さな検索へ分割するか、
より狭い text にしてください。
Expand Down
19 changes: 19 additions & 0 deletions changelog.d/unreleased/5080.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
category: fixed
issues:
- 5080
affected:
- src/CodeIndex/Database/DbSearchReader.cs
- src/CodeIndex/Indexer/Scanning/FileIndexer.OversizeContentIssues.cs
- tests/CodeIndex.Tests/DbSearchReaderIssueTests.cs
- USER_GUIDE.md
- TESTING_GUIDE.md
---

## English

- **Literal search now recovers ASCII substrings inside reported overlong unicode61 tokens (#5080)** — when ordinary FTS returns no match, `search` uses the synchronized trigram index only for chunks carrying `fts_token_too_long` and rechecks the greater-than-1000-rune token before returning a result, without widening ordinary-token matches.

## 日本語

- **literal search が報告済みの長すぎる unicode61 token 内の ASCII 部分文字列を検索できるようになりました (#5080)** — 通常の FTS が一致を返さない場合、`search` は `fts_token_too_long` のある chunk に限って同期済み trigram index を使い、1000 rune 超の token 内の一致を再検証して返すため、通常 token の照合範囲は広がりません。
Loading
Loading