Skip to content

Commit d11306f

Browse files
committed
Merge origin/main after workspace fixes
2 parents 1ae6c0f + a39f77d commit d11306f

28 files changed

Lines changed: 873 additions & 57 deletions

DEVELOPER_GUIDE.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,22 @@ The lock files for projects with zero direct `PackageReference` entries (e.g. `t
117117

118118
`cdidx workspace use <name>` writes the active workspace to the per-user config directory. Query DB resolution keeps existing precedence: explicit `--db`, then explicit `--data-dir` / `CDIDX_DATA_DIR`, then active workspace state, then ancestor/CWD discovery.
119119

120+
### Observability
121+
122+
CodeIndex exposes an opt-in `ActivitySource` named `CodeIndex`. MCP JSON-RPC frames create `mcp.request` server spans and SQLite commands routed through tracked database helpers create `db.query` spans. MCP callers can pass W3C trace context as `params._meta.traceparent`; when present, the MCP span uses that trace as its parent. No exporter dependency is bundled, so spans are emitted only when the host process installs an OpenTelemetry/Diagnostics listener.
123+
124+
Set `CDIDX_SLOW_QUERY_MS=<milliseconds>` to write slow SQLite command diagnostics to stderr. Query commands also accept `--profile` for a JSON profile block and `--slow-query-ms <milliseconds>` for command-scoped profiling.
125+
120126
### Indexing pipeline
121127

122128
```
123-
Directory scan / shared path filter (built-in skip lists + `.gitignore` / `.cdidxignore` + reparse/Windows Hidden/System attribute pruning)
129+
Directory scan / shared path filter (built-in skip lists + `.gitignore` / `.cdidxignore` + directory symlink policy + reparse/Windows Hidden/System attribute pruning)
124130
→ Parallel extraction workers (`--parallelism`, `CDIDX_INDEX_PARALLELISM`; default CPU count capped at 16) read UTF-8, split chunks, extract symbols/references, and validate content
125131
→ Single SQLite writer checks unchanged-file reuse, UPSERTs file records, runs post-extraction hooks, and inserts chunks + symbols + references + issues in per-file transactions
126132
→ Populate FTS5 index
127133
```
128134

129-
Scoped `--files` / `--commits` refreshes reuse the same path filter as full scans. Before scanning a nested project root, `FileIndexer` loads ignore files from the resolved ignore-rule root through each existing ancestor directory down to the project root's parent, then loads the project directory's own rules during the normal walk. Within each directory, `FileIndexer` loads `.gitignore` before `.cdidxignore`, appends both rule sets in that order, and honors later `!` patterns as re-includes. If an ancestor ignore directory cannot be read, scanning fails closed with a scan error instead of silently skipping those rules; `ScanFilesResult.AncestorIgnoreDirectories` records the resolved ancestor list for troubleshooting. If a commit-scoped refresh includes `.gitignore` or `.cdidxignore` changes, `IndexCommandRunner` falls back to a full scan so newly ignored files are purged safely. Malformed ignore lines are reported as scan errors and skipped instead of aborting the whole run. On Windows, files and directories with Hidden or System attributes are rejected before language detection; clear those attributes before indexing project-owned sources because ignore rules cannot re-include them.
135+
Scoped `--files` / `--commits` refreshes reuse the same path filter as full scans. Before scanning a nested project root, `FileIndexer` loads ignore files from the resolved ignore-rule root through each existing ancestor directory down to the project root's parent, then loads the project directory's own rules during the normal walk. Within each directory, `FileIndexer` loads `.gitignore` before `.cdidxignore`, appends both rule sets in that order, and honors later `!` patterns as re-includes. If an ancestor ignore directory cannot be read, scanning fails closed with a scan error instead of silently skipping those rules; `ScanFilesResult.AncestorIgnoreDirectories` records the resolved ancestor list for troubleshooting. If a commit-scoped refresh includes `.gitignore` or `.cdidxignore` changes, `IndexCommandRunner` falls back to a full scan so newly ignored files are purged safely. Malformed ignore lines are reported as scan errors and skipped instead of aborting the whole run. Directory symlinks default to `--follow-symlinks none`; `internal` follows only targets that resolve under the workspace root, and `all` preserves the broad historical behavior. Dangling symlinks are counted and warned separately. On Windows, files and directories with Hidden or System attributes are rejected before language detection; clear those attributes before indexing project-owned sources because ignore rules cannot re-include them.
130136

131137
Incremental refreshes that mutate `fts_chunks` increment `codeindex_meta.fts_incremental_writes_since_optimize`. When the counter reaches `DbWriter.DefaultFtsOptimizeIncrementalWriteThreshold`, the update path runs `INSERT INTO fts_chunks(fts_chunks) VALUES('optimize')`, resets the counter, and stamps `fts_last_optimized_at`. Users can run the same maintenance directly with `cdidx optimize --db <path>` or `cdidx index <projectPath> --optimize`; this may briefly hold the writer lock on large indexes.
132138

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 1654
5+
affected:
6+
- src/CodeIndex/Indexer/Scanning/FileIndexer.cs
7+
- tests/CodeIndex.Tests/FileIndexerTests.cs
8+
---
9+
10+
## English
11+
12+
- **File reads now retry once when mtime changes during indexing (#1654)**`FileIndexer` rechecks `LastWriteTimeUtc` after reading content and retries once before persisting metadata, reducing stale mtime/content races.
13+
14+
## 日本語
15+
16+
- **index 中に mtime が変わったファイル読み取りを 1 回 retry するようになりました (#1654)**`FileIndexer` は content 読み取り後に `LastWriteTimeUtc` を再確認し、metadata 保存前に 1 回 retry することで stale mtime/content race を減らします。
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 1655
5+
affected:
6+
- src/CodeIndex/Indexer/Scanning/FileIndexer.cs
7+
- tests/CodeIndex.Tests/FileIndexerTests.cs
8+
---
9+
10+
## English
11+
12+
- **Mid-scan deletes remain non-fatal purge candidates (#1655)** — files that disappear during scan probing are recorded as skipped non-indexable paths with warnings, preserving directory purge authority instead of leaving orphan rows behind.
13+
14+
## 日本語
15+
16+
- **scan 中に削除されたファイルを非 fatal な purge 候補として扱います (#1655)** — probe 中に消えたファイルは warning 付きの non-indexable path として記録され、directory purge の authority を失わず orphan row を残しにくくなります。
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 1656
5+
affected:
6+
- src/CodeIndex/Indexer/Scanning/FileIndexer.cs
7+
- src/CodeIndex/Cli/IndexCommandRunner.FullScan.cs
8+
- src/CodeIndex/Cli/JsonOutputContracts.cs
9+
- tests/CodeIndex.Tests/FileIndexerTests.cs
10+
---
11+
12+
## English
13+
14+
- **Dangling symlinks are now reported distinctly (#1656)** — directory symlink targets that cannot be resolved are warned as dangling symlinks and counted as `dangling_symlinks_skipped` in full-scan JSON summaries.
15+
16+
## 日本語
17+
18+
- **dangling symlink を個別に報告するようになりました (#1656)** — 解決できない directory symlink target は dangling symlink として warning され、full-scan JSON summary の `dangling_symlinks_skipped` に計上されます。
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
category: added
3+
issues:
4+
- 1679
5+
affected:
6+
- src/CodeIndex/Telemetry/CodeIndexTelemetry.cs
7+
- src/CodeIndex/Mcp/McpServer.cs
8+
- src/CodeIndex/Database/DbDebug.cs
9+
- DEVELOPER_GUIDE.md
10+
---
11+
12+
## English
13+
14+
- **Added opt-in ActivitySource tracing for MCP and SQLite work (#1679)** — CodeIndex now exposes a `CodeIndex` activity source, creates MCP request and SQLite query spans, and honors MCP `params._meta.traceparent` as the parent trace context.
15+
16+
## 日本語
17+
18+
- **MCP と SQLite 処理向けの opt-in ActivitySource tracing を追加しました (#1679)** — CodeIndex は `CodeIndex` activity source を公開し、MCP request / SQLite query span を作成し、MCP `params._meta.traceparent` を親 trace context として扱うようになりました。
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
category: added
3+
issues:
4+
- 1711
5+
affected:
6+
- src/CodeIndex/Indexer/Scanning/FileIndexer.cs
7+
- src/CodeIndex/Cli/IndexCommandRunner.Parse.cs
8+
- src/CodeIndex/Cli/ConsoleUi.cs
9+
- src/CodeIndex/Cli/IndexWatchRunner.cs
10+
- DEVELOPER_GUIDE.md
11+
- tests/CodeIndex.Tests/FileIndexerTests.cs
12+
---
13+
14+
## English
15+
16+
- **Added `--follow-symlinks none|internal|all` for directory scans (#1711)** — indexing now defaults to not following directory symlinks, can opt into workspace-internal targets, or can opt into all targets explicitly.
17+
18+
## 日本語
19+
20+
- **directory scan 向けに `--follow-symlinks none|internal|all` を追加しました (#1711)** — indexing は既定で directory symlink を辿らず、workspace 内 target のみ、または全 target を明示 opt-in できます。
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 1715
5+
affected:
6+
- src/CodeIndex/Indexer/Scanning/FileIndexer.cs
7+
- src/CodeIndex/Cli/IndexCommandRunner.cs
8+
- src/CodeIndex/Cli/ProgramRunner.cs
9+
---
10+
11+
## English
12+
13+
- **Ignore path normalization now respects POSIX backslashes (#1715)**`.cdidxignore` and `.gitignore` comparisons no longer rewrite literal backslashes in POSIX filenames while Windows paths still normalize separators.
14+
15+
## 日本語
16+
17+
- **ignore path 正規化が POSIX の backslash を尊重するようになりました (#1715)**`.cdidxignore` / `.gitignore` の比較で POSIX ファイル名内のリテラル backslash を書き換えず、Windows path では引き続き区切り文字を正規化します。
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 1717
5+
affected:
6+
- src/CodeIndex/Cli/IndexCommandRunner.cs
7+
---
8+
9+
## English
10+
11+
- **Project-root escape checks now reject backslash traversal (#1717)** — commit and file-scoped indexing paths treat `..\` traversal the same as `../` before accepting a relative target.
12+
13+
## 日本語
14+
15+
- **project root 外への escape 判定が backslash traversal を拒否するようになりました (#1717)** — commit / file scoped indexing path は relative target を受け入れる前に `..\` traversal を `../` と同じように扱います。
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 1725
5+
affected:
6+
- src/CodeIndex/Cli/ProgramRunner.cs
7+
---
8+
9+
## English
10+
11+
- **CLI project-path detection now follows platform path syntax (#1725)** — Windows drive and UNC forms are recognized on Windows, while POSIX filenames containing literal backslashes are no longer treated as path syntax.
12+
13+
## 日本語
14+
15+
- **CLI の project path 判定がプラットフォーム別の path 構文に沿うようになりました (#1725)** — Windows では drive / UNC 形式を認識し、POSIX ではリテラル backslash を含むファイル名を path 構文として扱わないようになりました。
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 1786
5+
affected:
6+
- src/CodeIndex/Cli/QueryCommandRunner.cs
7+
- src/CodeIndex/Database/DbDebug.cs
8+
- DEVELOPER_GUIDE.md
9+
---
10+
11+
## English
12+
13+
- **Documented query profiling output for slow query diagnosis (#1786)** — query commands expose `--profile` and `--slow-query-ms` profiling so operators can inspect query timing and SQL diagnostics without patching the source.
14+
15+
## 日本語
16+
17+
- **遅い query 診断向けの query profiling output を明記しました (#1786)** — query command は `--profile``--slow-query-ms` による profiling を提供し、ソース修正なしで query timing と SQL diagnostics を確認できるようになりました。

0 commit comments

Comments
 (0)