@feng0531/dsh-code-review 0.85.6 → 0.85.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  本文件介绍对使用者有意义的变化。安装与参数见 [README](README.md),本次发布正文见 [发布说明](RELEASE-NOTES.md)。历史提交和安装包保留在 [GitHub Releases](https://github.com/f-e-n-g-0531/dsh-code-review/releases);本文不把开发日志当作功能介绍。
4
4
 
5
+ ## 0.85.7 — 大仓库项目选择预览修复
6
+
7
+ - Git 项目模式显式选择文件时只查询所选精确索引,不再因未选文件导致全仓索引输出或节点数超限;空选择不枚举索引,目录及通配符不展开。
8
+ - 初次捕获、执行前及末尾复核使用同一局部范围,保留所选索引/正文变动拒绝、冲突及链接限制;未选索引变化不再使局部快照失效。
9
+ - 局部预览与报告明确显示清单不完整、全仓总数未知及所选清单数,不冒充全项目覆盖。未指定选择和 SVN 清单上限保持不变。
10
+ - 这是当前源码项目预览修复,不新增历史重命名配对,也不将项目审核当作重构前后功能等价证明。
11
+
5
12
  ## 0.85.6 — 快照正确性、任务隔离与取消修复
6
13
 
7
14
  - Git 工作区撤销暂存重命名后按 HEAD 到当前原路径的净内容比较,不再误报不存在的删除;历史提交允许非 UTF-8 消息,父对象标识仍严格验证。
package/DEVELOPMENT.md CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  服务按DSH session对象隔离缓存和锁,同一会话changes/project两种模式共用互斥锁;不同会话可并行,模型调用与取消由各请求生命周期约束。Git工作区默认比较HEAD到工作区;changeScope=staged/unstaged分别只比较HEAD→index和index→工作区,执行前复核对应内容。宿主dispose终止全部会话服务。全项目是跟踪文件的当前源码分批,不是多仓库汇总或跨批次语义分析。
18
18
 
19
- 项目捕获最多10000清单节点、1000选择节点、16MiB,不设默认总模型调用次数或执行秒表,初次捕获/复核均遵循宿主与用户取消。SVN项目模式拒绝不支持节点属性,不隐式继承固定历史审查的网络权限。
19
+ 项目捕获完整清单最多 10000 节点、1000 选择节点、16 MiB。Git 显式选择以精确字面路径查询所选索引,单次查询最多 64 KiB、总计 2 MiB,不受未选索引数量影响;初次、执行前及末尾复核使用相同范围。局部清单不宣称全仓完整性或总数,只绑定所选索引和正文,未选索引变动不使其失效。公开工具的显式列表仍最多 200 项。不设默认总模型调用次数或执行秒表,初次捕获/复核均遵循宿主与用户取消。SVN 仍枚举本地完整已观察清单,项目模式拒绝不支持节点属性,不隐式继承固定历史审查的网络权限。
20
20
 
21
21
  ## 全项目并发与离线速度对照
22
22
 
package/README.md CHANGED
@@ -254,11 +254,11 @@ Git / SVN 历史审查也能使用这些参数;依赖和调用方按对应版
254
254
 
255
255
  项目模式只接受reviewMode、repositoryPath和可选selectedPaths,不与历史revision、autoContext、规则或调用方参数混用。默认全部跟踪节点;不读取未跟踪/忽略文件、子模块、外部仓库及链接目标。目录只作清单记录,源码按批次审查;跨批次不宣称完整调用图或全程序语义分析。
256
256
 
257
- 清单上限10000节点,单次选择最多1000节点/16MiB,12节点一批,单文件256KiB;超限明确拒绝,缩小选择后必须重新预览。单次采集共享8MiB元数据内存保护,不按命令条数、插件秒表或模型调用次数中断;耗时受宿主/模型提供方限制,用户可随时取消。SVN为本地已观察清单,稀疏/外部/链接及不支持属性显示限制;不证明仓库远端完整覆盖。
257
+ 未指定选择时,清单上限 10000 节点,Git 索引输出上限 2 MiB。Git 显式 `selectedPaths` 只查询所选精确文件,不先枚举全仓,因此大仓库可用小范围预览;空数组不枚举索引,目录与通配符不会展开。此时 `inventoryScope:"selected"`、`inventoryComplete:false`、`selectionComplete:false`,`totalTrackedNodes:null` 表示全仓总数未知,`inventoryNodes` 仅为所选清单数;只绑定所选索引及正文,未选文件的变化不使该局部快照失效。单次选择运行时最多 1000 节点(公开工具参数显式列表最多 200 项)/16 MiB,12 节点一批,单文件 256 KiB;超限必须重新预览。SVN 仍枚举本地已观察清单,显式选择不绕过清单上限,稀疏/外部/链接及不支持属性显示限制,不证明远端完整覆盖。SVN 单次采集共享 8 MiB 元数据保护;Git 所选索引单次查询最多 64 KiB、合计 2 MiB。不按命令条数、插件秒表或模型调用次数中断;耗时受宿主/模型提供方限制,用户可随时取消。
258
258
 
259
259
  全项目审查默认最多 **8 个独立批次并行**,每批内主审、检索、复核仍按依赖顺序执行;预览和报告的 `execution.batchConcurrency` 显示实际配置。插件配置 `projectConcurrency` 可设为 1~8,设 1 回退串行;遇到模型提供方并发限制或 429,应降低并发。该设置不是 preview 参数,不扩大来源或共享模型调用预算,也不减少模型调用量或承诺 token 成本下降。仅一个批次时不会获得批间加速;实际提速受提供方吞吐、批次均衡及检查点写入影响。
260
260
 
261
- 对外只交付一份统一最终报告,给出总数、completed、excluded、blocked、pending、去重后的发现及未完成综合阶段;内部批次快照仅供证据追溯,不需要用户拼接报告。completed只表示所选捕获文件已处理,不代表代码正确;排除与阻断从不算完成。代码或清单变化会拒绝旧预览,运行后无法复核则标记outdated。
261
+ 对外只交付一份统一最终报告,给出总数、completed、excluded、blocked、pending、去重后的发现及未完成综合阶段;内部批次快照仅供证据追溯,不需要用户拼接报告。completed只表示所选捕获文件已处理,不代表代码正确;排除与阻断从不算完成。所绑定的代码或清单变化会拒绝旧预览,运行后无法复核则标记outdated。
262
262
 
263
263
  ## 工具调用流程(给需要精确指定参数的人)
264
264
 
package/RELEASE-NOTES.md CHANGED
@@ -1,22 +1,15 @@
1
- # v0.85.6 发布说明
1
+ # v0.85.7 发布说明
2
2
 
3
3
  使用方式见 [README](README.md),详细变化见 [变更记录](CHANGELOG.md),发布门禁见 [开发说明](DEVELOPMENT.md)。
4
4
 
5
- ## 审核正确性
5
+ ## 大仓库也能按文件预览
6
6
 
7
- - Git 撤销暂存重命名后按实际工作区净内容比较;历史审核不再因合法非 UTF-8 提交消息失败。
8
- - 方法绑定不再遗漏 `toString`、`valueOf` 等合法名称;构造行附加语句、原型替换及可执行参数不再被错误认证。
9
- - SVN 标准关键字别名与固定字段 UTF-8 字节宽度保持原生语义;显式上下文增加原始正文哈希重验,验证读取继续累计预算。
10
-
11
- ## 隔离、取消与发布验证
12
-
13
- - 后台任务卸载覆盖首次持久化到终态,避免卸载完成后才启动审核;报告目录以真实路径验证工作区隔离,阻断路径别名绕过。
14
- - 本地文件以只读非阻塞方式打开并验证句柄,避免 Linux FIFO 替换导致等待;取消时关闭自身捕获管道,仍等待直接子进程退出并保留终止升级机制。正常成功路径继续完整收集输出。
15
- - npm 元数据及安装包正文网络中断按预算重试;无效 JSON、非法工件地址、输出超限及完整性不一致仍立即失败。
16
- - 补齐测试临时 SVN 仓库与工作副本清理。
7
+ - 修复 Git 项目模式只选少量文件,仍因全仓索引超过 2 MiB 或 10000 节点而预览失败的问题。显式 `selectedPaths` 现在只查询所选精确索引;空选择不枚举索引,目录和通配符不展开。
8
+ - 初次捕获、执行前及末尾复核保持相同选择范围;所选索引或正文变化仍使快照失效,冲突、链接、子模块及凭据路径保护不放宽。未选索引变化不影响局部快照。
9
+ - 预览、批次和报告标明局部清单范围;全仓总数为未知值,不把所选数量或局部完成当成全仓覆盖。
17
10
 
18
11
  ## 验证与边界
19
12
 
20
- 新增 43 项回归。本地完整测试:Windows 750 项中 746 通过、4 项平台限定跳过;Linux 750 项全部通过。正式发布仍须通过冻结标签同一提交的 Ubuntu/Windows × Node.js 22/24 四组 CI、隔离安装以及原始包、npm 与 GitHub Release 工件一致性门禁。最终结果以对应 CI 和发布工作流为准。
13
+ 新增 15 项大索引、精确路径、空选择、失效快照和范围披露回归。本地 Windows 完整测试 765 项:761 通过、4 项平台限定跳过、0 失败;隔离安装入口及本地化导出验证通过。正式发布须通过冻结标签同一提交的 Ubuntu/Windows × Node.js 22/24 四组 CI、隔离安装以及原始包、npm 与 GitHub Release 工件一致性门禁;最终结果以对应 CI 和发布工作流为准。
21
14
 
22
- 只读非阻塞打开不是原子防路径替换,不保证任意设备或网络文件系统无阻塞;进程取消不承诺杀死全部后代。本版不保证模型始终输出合法 JSON,也不代表补齐此前自动审核失败的文件。发布不自动安装、升级或重启 DSH;更新并重新加载插件后生效。
15
+ 未指定选择的完整索引捕获及 SVN 项目清单仍保留原上限;历史变更范围仍最多 200 个变更路径。本版不新增跨路径旧/新实现配对,不将当前源码项目审核替代重构前后功能对照,也不以空发现证明功能等价。发布不自动安装、升级或重启 DSH;更新并重新加载插件后生效。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.85.6",
3
+ "version": "0.85.7",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
@@ -31,7 +31,7 @@ function makeCaptureBudget(signal) {
31
31
 
32
32
  async function captureProject(cwd, args, signal) {
33
33
  const captureBudget = makeCaptureBudget(signal);
34
- const captureOptions = { signal, svnCaptureBudget: captureBudget };
34
+ const captureOptions = { signal, svnCaptureBudget: captureBudget, selectedPaths: args.selectedPaths };
35
35
  const root = await realpath(await resolveWorkspaceRepository(cwd, args.repositoryPath));
36
36
  const vcs = await detectVcs(root);
37
37
  const inventory = await projectInventory(root, vcs, captureOptions);
@@ -59,9 +59,10 @@ async function captureProject(cwd, args, signal) {
59
59
  }
60
60
 
61
61
  const result = {
62
- root, vcs, inventoryId: inventory.id, inventoryComplete: inventory.vcs === 'git',
63
- totalTrackedNodes: inventory.records.length, selectedFiles: paths.length,
64
- selectionComplete: paths.length === inventory.records.length, notice: inventory.notice, batches,
62
+ root, vcs, inventoryId: inventory.id, inventoryComplete: inventory.inventoryComplete,
63
+ inventoryScope: inventory.inventoryScope, inventoryNodes: inventory.records.length,
64
+ totalTrackedNodes: inventory.totalTrackedNodes, selectedFiles: paths.length,
65
+ selectionComplete: inventory.inventoryScope !== 'selected' && paths.length === inventory.records.length, notice: inventory.notice, batches,
65
66
  };
66
67
  return { ...result, id: hash(JSON.stringify(result)) };
67
68
  }
@@ -96,7 +97,7 @@ export function createProjectReviewService(llm, { allowModelSending = false, aut
96
97
  previewId, snapshotId: s.id, reviewMode: 'project', repositoryRoot: s.root, vcs: s.vcs,
97
98
  model: current.route, modelSendingEnabled: allowModelSending,
98
99
  totalTrackedNodes: s.totalTrackedNodes, selectedFiles: s.selectedFiles, selectionComplete: s.selectionComplete,
99
- inventoryComplete: s.inventoryComplete, batches: s.batches.length,
100
+ inventoryComplete: s.inventoryComplete, inventoryScope: s.inventoryScope, inventoryNodes: s.inventoryNodes, batches: s.batches.length,
100
101
  execution: { batchConcurrency: projectConcurrency },
101
102
  files: s.batches.flatMap(b => b.files.map(f => ({ path: f.path, eligibility: f.eligibility, reason: f.reason }))),
102
103
  notice: s.notice + PREVIEW_NOTICE_SUFFIX,
@@ -160,7 +161,7 @@ export function createProjectReviewService(llm, { allowModelSending = false, aut
160
161
  : results.every(r => r.status === 'completed') && files.every(f => ['completed', 'excluded'].includes(f.status)) ? 'completed'
161
162
  : 'partial',
162
163
  repositoryRoot: s.root, vcs: s.vcs, model: p.route, modelCalls: calls, maxModelCalls: projectMaxCalls,
163
- totalTrackedNodes: s.totalTrackedNodes, selectionComplete: s.selectionComplete, inventoryComplete: s.inventoryComplete,
164
+ totalTrackedNodes: s.totalTrackedNodes, selectionComplete: s.selectionComplete, inventoryComplete: s.inventoryComplete, inventoryScope: s.inventoryScope, inventoryNodes: s.inventoryNodes,
164
165
  coverage, files, findings, batches: results,
165
166
  execution: { batchConcurrency: projectConcurrency },
166
167
  notice: s.notice + REPORT_NOTICE_SUFFIX,
@@ -15,7 +15,29 @@ async function inventoryGit(root, options) {
15
15
  const args = ['--no-optional-locks', '-c', 'core.fsmonitor=false', '-c', 'core.untrackedCache=false'];
16
16
  const actual = text(await checked('git', [...args, 'rev-parse', '--show-toplevel'], { ...options, cwd: root })).replace(/\r?\n$/, '');
17
17
  if (await realpath(actual) !== root) throw new Error('Full project requires explicit repository root');
18
- const index = await checked('git', [...args, 'ls-files', '--stage', '-z'], { ...options, cwd: root, maxBytes: 2 * 1024 * 1024 });
18
+ const selected = options.selectedPaths;
19
+ let index;
20
+ if (selected === undefined) {
21
+ index = await checked('git', [...args, 'ls-files', '--stage', '-z'], { ...options, cwd: root, maxBytes: 2 * 1024 * 1024 });
22
+ } else {
23
+ const chunks = [];
24
+ let bytes = 0;
25
+ for (const name of [...selected].sort()) {
26
+ // Literal pathspecs still recurse. Exclude descendants, not the node:
27
+ // a trailing-slash literal exclusion would also hide an exact gitlink.
28
+ const escaped = Array.from(name, c => '*?[]'.includes(c) ? String.fromCharCode(92) + c : c).join('');
29
+ const chunk = await checked('git', [...args, 'ls-files', '--stage', '-z', '--',
30
+ ':(top,literal)' + name, ':(top,glob,exclude)' + escaped + '/**'],
31
+ { ...options, cwd: root, maxBytes: 64 * 1024 });
32
+ for (const row of text(chunk).split(String.fromCharCode(0)).filter(Boolean)) {
33
+ if (row.slice(row.indexOf(String.fromCharCode(9)) + 1) !== name) throw new Error('Git project selection expanded beyond literal path');
34
+ }
35
+ bytes += chunk.length;
36
+ if (bytes > 2 * 1024 * 1024) throw new Error('Selected project inventory exceeds shared 2MiB limit');
37
+ chunks.push(chunk);
38
+ }
39
+ index = Buffer.concat(chunks);
40
+ }
19
41
  const records = [];
20
42
  for (const row of text(index).split(String.fromCharCode(0)).filter(Boolean)) {
21
43
  const m = /^(\d{6}) ([a-f0-9]+) ([0-3])\t([\s\S]+)$/.exec(row);
@@ -47,6 +69,11 @@ async function inventorySvn(root, options) {
47
69
  }
48
70
 
49
71
  export async function projectInventory(cwd, vcs, options = {}) {
72
+ const selected = options.selectedPaths;
73
+ if (selected !== undefined) {
74
+ if (!Array.isArray(selected) || selected.length > 1000 || new Set(selected).size !== selected.length) throw new Error('Invalid tracked project selection');
75
+ selected.forEach(relativePath);
76
+ }
50
77
  const root = await realpath(cwd);
51
78
  const source = vcs === 'git' ? await inventoryGit(root, options)
52
79
  : vcs === 'svn' ? await inventorySvn(root, options)
@@ -58,7 +85,14 @@ export async function projectInventory(cwd, vcs, options = {}) {
58
85
  const grouped = new Map();
59
86
  for (const r of records) { if (grouped.has(r.path)) { grouped.get(r.path).duplicate = true; } else grouped.set(r.path, r); }
60
87
  records = [...grouped.values()];
61
- const inventory = { root, vcs, records, identity: source.identity, notice: INVENTORY_NOTICE };
88
+ const scoped = vcs === 'git' && selected !== undefined;
89
+ const inventory = {
90
+ root, vcs, records, identity: source.identity,
91
+ inventoryScope: scoped ? 'selected' : 'repository',
92
+ inventoryComplete: vcs === 'git' && !scoped,
93
+ totalTrackedNodes: scoped ? null : records.length,
94
+ notice: INVENTORY_NOTICE + (scoped ? ' Explicit Git selection only: repository total is unknown; unrelated index entries are not enumerated or bound to this snapshot.' : ''),
95
+ };
62
96
  return { ...inventory, id: hash(JSON.stringify(canonical(inventory))) };
63
97
  }
64
98
 
@@ -100,7 +134,7 @@ export async function captureProjectBatch(inventory, paths, options = {}) {
100
134
  delete file.left; delete file.right;
101
135
  }
102
136
  }
103
- const scope = { mode: 'project', inventoryId: inventory.id, totalTrackedNodes: inventory.records.length, batchPaths: paths, untrackedIncluded: false, inventoryComplete: inventory.vcs === 'git', scopeCompleteness: inventory.vcs === 'svn' ? 'observed-working-copy-only' : 'tracked-index-only', notice: inventory.notice };
137
+ const scope = { mode: 'project', inventoryId: inventory.id, inventoryScope: inventory.inventoryScope, inventoryNodes: inventory.records.length, totalTrackedNodes: inventory.totalTrackedNodes, batchPaths: paths, untrackedIncluded: false, inventoryComplete: inventory.inventoryComplete, scopeCompleteness: inventory.vcs === 'svn' ? 'observed-working-copy-only' : inventory.inventoryScope === 'selected' ? 'selected-index-only' : 'tracked-index-only', notice: inventory.notice };
104
138
  const snapshot = { schemaVersion: 1, vcs: inventory.vcs, root: inventory.root, files, context: [], projectScope: scope };
105
139
  return { ...snapshot, id: hash(JSON.stringify(snapshot)) };
106
140
  }