@feng0531/dsh-code-review 0.63.0 → 0.64.1

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,9 +2,17 @@
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.64.1 — SVN 已提交历史替换双侧采集修复
6
+
7
+ 固定 revision summary 中同一路径的同类型 deleted/added 两记录合并为 replaced,分别从目标旧/新 revision 读取正文及属性,避免此前将合法历史替换当作重复路径拒绝。只接受一对同类型增删,重复新增/删除、多记录或类型变化继续拒绝;目录替换仍检查子项覆盖。未提交工作副本替换不因此开放。
8
+
9
+ ## 0.64.0 — SVN 历史旧侧独有上下文
10
+
11
+ SVN 固定历史模式支持 oldContextPaths:只读取 baseline 的指定正文,保留 UUID/URL/peg/operative revision 和哈希,不创建目标正文或推断目标存在性。已选删除等旧变更复用原身份,排除/阻断/无旧侧变更拒绝回流;与目标上下文共享 20 名额和原历史读取预算。预览明确披露 SVN 来源,与 Git blob 校验分开。自动历史链与调用方仍待实现。479 项串行回归、宿主、隔离安装和四矩阵 CI 通过;原产物/npm/Release 127,879 字节逐字节一致,双哈希、清单与冻结发布说明通过。
12
+
5
13
  ## 0.63.0 — SVN 历史显式上下文与目标规则
6
14
 
7
- 固定 revision 历史模式支持显式 contextPaths 和 rulePaths。上下文目标/旧侧独立读取与验证 UUID、URL、peg/operative revision 和原字节/正文哈希,规则只取目标版本;不读脏工作树,不让已排除或删除变更通过上下文重新进入。共享原名额、源码、命令和总采集预算;old-only、自动历史链与历史调用方继续待实现。同时增加模型 JSON 输出形状和无效 read 字段的安全诊断,明确读行协议,保留严格拒绝、失败分类与零自动重试;用户 loader 实际失败样本尚未验证。
15
+ 固定 revision 历史模式支持显式 contextPaths 和 rulePaths。上下文目标/旧侧独立读取与验证 UUID、URL、peg/operative revision 和原字节/正文哈希,规则只取目标版本;不读脏工作树,不让已排除或删除变更通过上下文重新进入。共享原名额、源码、命令和总采集预算;old-only、自动历史链与历史调用方继续待实现。同时增加模型 JSON 输出形状和无效 read 字段的安全诊断,明确读行协议,保留严格拒绝、失败分类与零自动重试;用户 loader 实际失败样本尚未验证。477 项串行回归、宿主、隔离安装与四矩阵 CI 通过;原产物/npm/Release 127,355 字节逐字节一致,双哈希、清单与冻结发布说明通过。
8
16
 
9
17
  ## 0.62.0 — SVN 原生固定 revision 历史审查初始模式
10
18
 
@@ -32,7 +32,9 @@
32
32
 
33
33
  ## 当前验证结论
34
34
 
35
- - 最近完整回归:472 项通过。
35
+ - 最近完整回归:479 项通过。
36
+ - v0.64.0 已交付 SVN 历史 oldContextPaths,仅旧侧正文及来源身份,不合成目标,选中旧变更复用原身份,排除项拒绝回流。479 项串行回归、宿主、隔离安装和四矩阵 CI 通过;原产物/npm/Release 127,879 字节逐字节一致,双哈希、清单与冻结发布说明通过。自动历史链、调用方及全面 SVN 矩阵仍未闭环。
37
+ - v0.63.0 已交付 SVN 历史显式双侧上下文与目标规则,以及模型 JSON/read 请求的安全诊断。477 项串行回归、宿主、隔离安装和四矩阵 CI 通过;原产物/npm/Release 127,355 字节逐字节一致,双哈希、清单与冻结发布说明通过。用户 loader 的实际协议失败尚未核验,不宣称已修复该样本;历史自动链/调用方、旧侧独有上下文及其他 SVN 缺口继续。
36
38
  - v0.62.0 已交付 SVN 原生固定 revision/区间初始审查:显式远端门禁、固定双侧正文/属性/来源身份、目录后代覆盖和确认执行链。472 项串行回归、宿主、隔离安装与四矩阵 CI 通过;原产物/npm/Release 125,486 字节逐字节一致,双哈希、清单与冻结发布说明通过。历史上下文/规则/调用方、跨 URL 分支和工作副本替换等仍待实现。
37
39
  - v0.61.0 已交付同仓库目录复制后代显式覆盖与继承来源身份;目标新增空旧侧、预览零发送、离线及凭据后代保护通过。465 项串行回归、宿主、隔离安装和四矩阵 CI 通过;原产物/npm/Release 120,159 字节逐字节一致,双哈希、清单与冻结发布说明通过。替换、关键字与历史等继续待实现。
38
40
  - v0.60.1 已交付 SVN 阻断状态稳定诊断及预览/报告原因码;普通与复制替换仍明确拒绝,不冒充真实双侧支持。463 项串行回归、宿主、隔离安装和四矩阵 CI 通过;原产物/npm/Release 119,462 字节逐字节一致,双哈希、清单与冻结发布说明通过。全面 SVN 目标继续。
package/README.md CHANGED
@@ -61,14 +61,14 @@ DSH 的只读代码审查插件。它比较 Git 或 SVN 中的代码变更,使
61
61
  | contextPaths | 手动加入理解代码所需的文件 | ["src/types.ts"] |
62
62
  | autoContext | 从变更及手动上下文寻找依赖;Git 和 SVN 最多沿三层依赖链读取 | true |
63
63
  | callerScopePaths | 在指定目录中寻找引用变更文件的代码;已捕获调用方会标出调用行与唯一声明行 | ["src/clients"] |
64
- | oldContextPaths | Git 历史审查中,只加入旧版本的上下文 | ["src/removed-helper.ts"] |
64
+ | oldContextPaths | Git/SVN 固定历史审查中,只加入旧版本的上下文;共享上下文名额 | ["src/removed-helper.ts"] |
65
65
  | rulePaths | 加入项目审查规则,最多四个 UTF-8 Markdown 或文本文件 | ["review-rules.md"] |
66
66
  | businessRequirement | 提供业务要求;不是缺陷证据,也不会增加读取权限 | "请求失败时必须释放连接" |
67
67
  | reviewRounds | 独立审查次数,1~3,默认 1;会增加模型调用量 | 2 |
68
68
 
69
- commit 与 baseRevision/targetRevision 不能同时使用。oldContextPaths 只能用于 Git 历史审查。
69
+ commit 与 baseRevision/targetRevision 不能同时使用。oldContextPaths 只能用于 Git/SVN 固定历史审查,不适用于工作副本模式。
70
70
 
71
- SVN 历史模式使用独立参数,不可与 Git 参数混用。示例:`{"svnRevision":"7315","svnAllowNetwork":true}`;或 `{"svnBaseRevision":"7314","svnTargetRevision":"7315","svnAllowNetwork":true}`。只接受固定十进制 revision,不接受 HEAD、日期或相对别名。仅选择工作副本根当前仓库 URL,不支持任意远端 URL;预览会读取明确端点的仓库元数据与源码(远端需显式许可),但不发送模型。历史模式支持显式 contextPaths 与 rulePaths:上下文按目标版和已核验的旧版正文分别保存,规则只读取目标版;共享 20 上下文名额与原采集预算。autoContext、oldContextPaths 和历史 callerScopePaths 仍未支持,不能回退到当前工作副本。目录新增/删除按后代逐项覆盖,凭据、链接/特殊节点与超限继续拒绝。
71
+ SVN 历史模式使用独立参数,不可与 Git 参数混用。示例:`{"svnRevision":"7315","svnAllowNetwork":true}`;或 `{"svnBaseRevision":"7314","svnTargetRevision":"7315","svnAllowNetwork":true}`。只接受固定十进制 revision,不接受 HEAD、日期或相对别名。仅选择工作副本根当前仓库 URL,不支持任意远端 URL;预览会读取明确端点的仓库元数据与源码(远端需显式许可),但不发送模型。历史模式支持显式 contextPaths 与 rulePaths:上下文按目标版和已核验的旧版正文分别保存,规则只读取目标版;共享 20 上下文名额与原采集预算。oldContextPaths 可显式选择仅旧版正文,没有目标占位,选中旧变更复用原身份;不能恢复已排除/阻断/无旧侧的变更。autoContext 和历史 callerScopePaths 仍未支持,不能回退到当前工作副本。目录新增/删除按后代逐项覆盖,凭据、链接/特殊节点与超限继续拒绝。
72
72
 
73
73
  自动上下文和引用方发现是保守的文本导航,不是编译器分析。动态导入、宏、重载、继承和实例方法可能无法解析;找到引用不等于证明函数实际被调用。历史调用方的命名导入线索逐侧对应相同版本声明,标明 side/revision;缺少该版本的批准正文不回退另一侧。Git 历史可沿修改前后两侧分别捕获最多三层依赖;SVN 工作副本模式可沿安全的当前节点取得最多三层依赖;初始固定 revision 历史模式尚不支持历史依赖导航。已批准正文中的唯一命名声明和唯一 default 导出会标出位置;同名、重导出或跨侧内容不猜测。命名空间导入后的独立成员调用可导航至唯一命名声明;写入、逃逸或间接调用不推定绑定,不是实例类型分析。
74
74
 
package/RELEASE-NOTES.md CHANGED
@@ -1,22 +1,14 @@
1
- # v0.63.0 发布说明
1
+ # v0.64.1 发布说明
2
2
 
3
- ## SVN 历史显式上下文与目标规则
3
+ ## SVN 已提交历史替换双侧采集修复
4
4
 
5
- 固定 revision 历史审查支持显式 `contextPaths` 与 `rulePaths`,无需回退或修改工作副本。
5
+ 修复固定 revision 历史审查中,合法替换的同路径删除/新增记录被当作歧义拒绝的问题。
6
6
 
7
- - 上下文目标正文与可验证旧侧正文分别读取固定对象,保留 UUID、URL、peg/operative revision、原字节及正文哈希,不能跨侧替换。
8
- - 项目规则只读取目标版,沿用 UTF-8、单规则 16KiB 和总规则 32KiB 限额。
9
- - 已排除、阻断或已删除的变更不能通过上下文/规则重新进入批准范围。
10
- - 共享原 20 上下文名额与历史源码、元数据、命令和总采集时间预算;故意污染的本地文件不会进入历史模型输入。
7
+ - 仅合并同类型节点的一对 deleted/added,为 replaced;其他重复和类型变化拒绝,不任意选择。
8
+ - 从被替换目标的旧 revision 和新 revision 分别读取真实正文与属性,复制替换不使用复制来源 BASE 冒充旧侧。
9
+ - 来源逐侧固定 URL/UUID/peg/operative revision,仍保持选择、预算与目录后代覆盖保护。
10
+ - 独立 SVN 测试覆盖已提交普通与复制替换以及旧属性删除、新属性添加。
11
11
 
12
- ## 模型协议失败诊断
12
+ 本版仅针对已提交的固定历史版本;未提交工作副本替换、类型变化及其他全面 SVN 缺口仍按 [支持矩阵](SVN-SUPPORT-MATRIX.md) 推进,不以候选 diff 重建冒充支持。
13
13
 
14
- 针对“不是完整 JSON”和“Invalid read request”增加不含源码的诊断:JSON 空输出、非 JSON 开头、非精确 fence 与无效 JSON-like 形状分别标明;读请求报告无效字段名和请求序号,保留 MODEL_INVALID_READ_REQUEST 分类。明确 start/count 整数及 200 行上限,不修复或补全模型 JSON、不默认值转换、不扩大预算、不自动重试。
15
-
16
- 这些改动尚未用用户三个 loader 文件的实际响应核验,不宣称该样本失败已消失或审核已通过。
17
-
18
- ## 当前限制
19
-
20
- `oldContextPaths`、自动历史依赖链、历史调用方和跨 URL 分支比较仍待后续实现;远端仍须显式 `svnAllowNetwork:true`。工作副本替换、关键字映射等也未全部支持,见 [SVN 支持矩阵](SVN-SUPPORT-MATRIX.md)。
21
-
22
- 使用见 [README](README.md)。
14
+ 用法见 [README](README.md)。
@@ -19,7 +19,7 @@
19
19
  | 根目录属性/mergeinfo | v0.58.1 已发布;独立复现后修复,指定三文件和默认预览均通过、0 模型发送、状态不变;456 项串行回归、宿主、隔离安装和四矩阵 CI 通过,原产物/npm/Release 116,254 字节逐字节一致及双哈希/清单/发布说明通过 | 第一批先发布此修复 |
20
20
  | 复制/移动、copyfrom 及目录结构变更 | v0.59.0 已发布同仓库复制新增文件及文件移动的新增/删除独立覆盖:新增目标旧侧为空,copyfrom 只作来源信息,预览披露并冻结身份;离线与凭据来源拒绝测试通过。459 项串行回归、宿主、隔离安装、四矩阵 CI 通过;原产物/npm/Release 117,098 字节逐字节一致,双哈希/清单/冻结发布说明通过。v0.61.0 已发布同仓库目录复制后代展开与继承来源身份,目标旧侧为空且预览披露。465 项串行回归、宿主、隔离安装、四矩阵 CI 与原包/npm/Release 120,159 字节、双哈希/清单/冻结发布说明通过。复制替换仍未支持 | 第二批:明确旧侧来源和后代覆盖 |
21
21
  | 普通新增/删除目录及后代 | v0.60.0 已发布:补齐默认 status 隐藏的删除后代,离线递归枚举与末尾清单复核;普通结构目录只在后代全选且可审查时开放,凭据/阻断子项导致目录覆盖不足。461 项串行回归、宿主、隔离安装与四矩阵 CI 通过;原产物/npm/Release 118,284 字节逐字节一致,双哈希/清单/冻结发布说明通过 | 第二批普通目录子批 |
22
- | 替换、删除再新增、文件/目录类型变化 | 普通与复制替换分别用 SVN_REPLACEMENT/SVN_COPIED_REPLACEMENT 诊断;离线探测确认前者 BASE 无 pristine,后者可能返回复制来源,禁止伪造旧侧。已新增未接入采集的 candidate-only 完整 diff 重建组件及真实离线测试:匹配完整工作侧,拒绝片段、错侧、截断与超限。diff 仍不能独立证明旧节点/编码/旧属性,因此真实双侧替换仍未支持,不能把辅助组件算作支持完成 | 第二批:区分 BASE 旧节点与目标节点 |
22
+ | 替换、删除再新增、文件/目录类型变化 | 普通与复制替换分别用 SVN_REPLACEMENT/SVN_COPIED_REPLACEMENT 诊断;离线探测确认前者 BASE 无 pristine,后者可能返回复制来源,禁止伪造旧侧。已新增未接入采集的 candidate-only 完整 diff 重建组件及真实离线测试:匹配完整工作侧,拒绝片段、错侧、截断与超限。diff 仍不能独立证明旧节点/编码/旧属性,因此未提交工作副本真实双侧替换仍未支持,不能把辅助组件算作支持完成。本地修复已提交固定历史版本的同路径 deleted/added 合并,真实目标旧/新正文与属性已测试;待 v0.64.1 发布核验,类型变化仍拒绝 | 第二批:区分 BASE 旧节点与目标节点 |
23
23
  | 缺失、文本/属性/树冲突、阻塞 | v0.60.1 已发布稳定状态诊断:SVN_MISSING_NODE/OBSTRUCTED_NODE/INCOMPLETE_NODE/TEXT_CONFLICT/PROPERTY_CONFLICT/TREE_CONFLICT 等,预览与报告透传 blockCode。463 项串行回归、宿主、隔离安装、四矩阵 CI 与原包/npm/Release 119,462 字节、双哈希/清单/发布说明通过。诊断不算真实双侧支持,仍需后续实现 | 第三批:明确状态诊断;不能合成不存在的工作侧或声称审核通过 |
24
24
  | svn:keywords、svn:eol-style | keywords 当前阻断;换行保留原文但无规范化映射 | 第三批:双侧可验证映射,保留原字节和定位 |
25
25
  | svn:special/链接 | 当前阻断,不跟随链接取正文 | 第三批:如支持只审链接目标数据;不沿链接读取文件 |
@@ -28,7 +28,7 @@
28
28
  | 固定 revision 区间 | v0.62.0 已发布 svnBaseRevision/svnTargetRevision,固定树端点 summary+逐侧 cat/proplist,目录后代与属性纳入预算,不建临时工作树;同上述完整发布验证。分支间不同 URL 和历史上下文尚未支持 | 第五批:固定树端点与逐路径差异 |
29
29
  | 分支复制、分支间比较、合并来源 | mergeinfo 当前仅作为属性文本;不证明源码归属或被合并提交均已审查 | 第六批:URL/peg/operative revision 与 mergeinfo 导航披露 |
30
30
  | 当前三层依赖与限定目录调用方 | 已有安全 normal 节点的离线有界测试;根属性修改可能使祖先检查拒绝,需单独验证 | 第四批补祖先/混合状态组合 |
31
- | 历史两侧上下文与调用方 | 本地新增显式 contextPaths 的固定双侧来源、目标 rulePaths;UUID/URL/peg/operative revision/原字节与正文 hash 验证,禁止脏工作树与排除项回流,待本批发布。old-only、自动三层历史链与历史调用方仍未实现 | 第六批:逐侧固定版本,不能回退至工作副本 |
31
+ | 历史两侧上下文与调用方 | v0.63.0 已发布显式 contextPaths 固定双侧来源及目标 rulePaths,UUID/URL/peg/operative revision/原字节与正文 hash 验证,禁止脏工作树与排除项回流。477 项串行回归、宿主、隔离安装、四矩阵 CI 与原包/npm/Release 127,355 字节、双哈希/清单/发布说明通过。v0.64.0 已发布 oldContextPaths 旧侧独有正文、SVN 来源专用校验、预览披露与选中删除身份复用;479 项串行回归、宿主、隔离安装、四矩阵 CI 与原包/npm/Release 127,879 字节、双哈希/清单/发布说明通过;自动三层历史链与历史调用方仍未实现 | 第六批:逐侧固定版本,不能回退至工作副本 |
32
32
  | 真正 r7314→r7315 样本 | 用户未提供隔离副本路径;本地类似复现不是该样本验收 | 获得路径后只读生成预览,不自动发送模型 |
33
33
 
34
34
  ## 每批发布门禁
package/index.mjs CHANGED
@@ -12,7 +12,7 @@ export function apply(ctx, config = {}) {
12
12
  };
13
13
  ctx.tools.register({
14
14
  name: 'code_review_preview', description: 'Preview Git/SVN working-copy or Git commit/range review scope and model destination without sending source to a model. repositoryPath selects an explicit child repository relative to session workspace; file paths are repository-relative. Preview each repository separately. Show the preview before execution.',
15
- parameters: { type: 'object', additionalProperties: false, properties: { svnRevision: { type: 'string', description: 'SVN fixed numeric revision reviewed against revision minus one. Requires SVN working-copy root; no HEAD/date aliases.' }, svnBaseRevision: { type: 'string', description: 'SVN fixed numeric old endpoint; requires svnTargetRevision, mutually exclusive with svnRevision and Git revision parameters.' }, svnTargetRevision: { type: 'string', description: 'SVN fixed numeric new endpoint, greater than old endpoint. Fixed repository objects, not working-copy text. Supports explicitly selected target context with verified baseline provenance and target rules; automatic context, old-only context and historical callers remain unsupported.' }, svnAllowNetwork: { type: 'boolean', description: 'Explicit opt-in to read the working-copy repository URL at fixed SVN revisions during preview/execute; preview sends no source to a model. Required for non-file repository URLs; default denies remote access. Does not allow checkout/update/merge or arbitrary URLs.' }, reviewRounds: { type: 'integer', minimum: 1, maximum: 3, description: 'Explicit independent review passes, default 1. Preview discloses extra sends; later passes omit the first risk plan. Shares existing timeout, call and retrieval budgets, not provider reasoning effort. Bound to this preview; execute cannot override.' }, oldContextPaths: { type: 'array', maxItems: 20, items: { type: 'string' }, description: 'Explicit Git historical baseline-only blob context paths. Shares 20 context slots. No target text is inferred; selected old changes reuse their original identity, excluded changes cannot reenter. Unsupported on working reviews and SVN.' }, callerScopePaths: { type: 'array', minItems: 1, maxItems: 4, items: { type: 'string' }, description: 'Explicit non-root repository-relative directories for bounded tracked literal reverse import/include discovery. Git/SVN working review or Git fixed commit/range review. SVN uses offline normal nodes, rejects unsafe ancestor states and special/keyword properties. Historical sides share scan budgets and use object blobs only. Preview reads candidate bodies, including nonmatches; only captured matching context is sent. Navigation only, not complete caller coverage.' }, businessRequirement: { type: 'string', maxLength: 16384, description: 'Optional business constraint text up to 16KiB UTF8; untrusted data, not evidence or permission. Bound to preview and sent in review phases.' }, commit: { type: 'string', description: 'Git commit versus sole parent; root empty, merge requires range.' }, baseRevision: { type: 'string', description: 'Git old endpoint; requires targetRevision, mutually exclusive with commit.' }, targetRevision: { type: 'string', description: 'Git new endpoint, exact tree endpoints not merge-base. Explicit context uses target tree with available baseline provenance; oldContextPaths is baseline-only. Historical caller discovery scans fixed sides; explicit rules use target-tree blobs.' }, repositoryPath: { type: 'string', description: 'Workspace-relative explicit child Git/SVN repository root, forward slashes; omit for current repository.' }, selectedPaths: { type: 'array', items: { type: 'string' }, maxItems: 200 }, autoContext: { type: 'boolean', description: 'Opt in to tracked literal import/include context shown in preview. Working Git follows changed and explicitly selected context sources at most 3 dependency layers under shared 512 exact probes, 20 candidates/context slots, 1MiB source and 30s verification budget. Git history follows at most 3 baseline/target dependency layers with shared limits, object reads only; SVN follows at most 3 safe offline current-side layers with exact path probes and node/ancestor identity verification, sharing limits; no SVN historical review. Not semantic binding or complete definitions.' }, contextPaths: { type: 'array', items: { type: 'string' }, maxItems: 20 }, rulePaths: { type: 'array', items: { type: 'string' }, maxItems: 4 } } },
15
+ parameters: { type: 'object', additionalProperties: false, properties: { svnRevision: { type: 'string', description: 'SVN fixed numeric revision reviewed against revision minus one. Requires SVN working-copy root; no HEAD/date aliases.' }, svnBaseRevision: { type: 'string', description: 'SVN fixed numeric old endpoint; requires svnTargetRevision, mutually exclusive with svnRevision and Git revision parameters.' }, svnTargetRevision: { type: 'string', description: 'SVN fixed numeric new endpoint, greater than old endpoint. Fixed repository objects, not working-copy text. Supports explicitly selected target context with verified baseline provenance and target rules; explicit old-only context is also supported with fixed SVN provenance; automatic context and historical callers remain unsupported.' }, svnAllowNetwork: { type: 'boolean', description: 'Explicit opt-in to read the working-copy repository URL at fixed SVN revisions during preview/execute; preview sends no source to a model. Required for non-file repository URLs; default denies remote access. Does not allow checkout/update/merge or arbitrary URLs.' }, reviewRounds: { type: 'integer', minimum: 1, maximum: 3, description: 'Explicit independent review passes, default 1. Preview discloses extra sends; later passes omit the first risk plan. Shares existing timeout, call and retrieval budgets, not provider reasoning effort. Bound to this preview; execute cannot override.' }, oldContextPaths: { type: 'array', maxItems: 20, items: { type: 'string' }, description: 'Explicit Git/SVN historical baseline-only context paths. Git uses fixed blobs; SVN uses UUID/URL/peg/operative revision/hash. Shares 20 context slots. No target text is inferred; selected old changes reuse original identity, excluded changes cannot reenter. Unsupported on working reviews.' }, callerScopePaths: { type: 'array', minItems: 1, maxItems: 4, items: { type: 'string' }, description: 'Explicit non-root repository-relative directories for bounded tracked literal reverse import/include discovery. Git/SVN working review or Git fixed commit/range review. SVN uses offline normal nodes, rejects unsafe ancestor states and special/keyword properties. Historical sides share scan budgets and use object blobs only. Preview reads candidate bodies, including nonmatches; only captured matching context is sent. Navigation only, not complete caller coverage.' }, businessRequirement: { type: 'string', maxLength: 16384, description: 'Optional business constraint text up to 16KiB UTF8; untrusted data, not evidence or permission. Bound to preview and sent in review phases.' }, commit: { type: 'string', description: 'Git commit versus sole parent; root empty, merge requires range.' }, baseRevision: { type: 'string', description: 'Git old endpoint; requires targetRevision, mutually exclusive with commit.' }, targetRevision: { type: 'string', description: 'Git new endpoint, exact tree endpoints not merge-base. Explicit context uses target tree with available baseline provenance; oldContextPaths is baseline-only. Historical caller discovery scans fixed sides; explicit rules use target-tree blobs.' }, repositoryPath: { type: 'string', description: 'Workspace-relative explicit child Git/SVN repository root, forward slashes; omit for current repository.' }, selectedPaths: { type: 'array', items: { type: 'string' }, maxItems: 200 }, autoContext: { type: 'boolean', description: 'Opt in to tracked literal import/include context shown in preview. Working Git follows changed and explicitly selected context sources at most 3 dependency layers under shared 512 exact probes, 20 candidates/context slots, 1MiB source and 30s verification budget. Git history follows at most 3 baseline/target dependency layers with shared limits, object reads only; SVN follows at most 3 safe offline current-side layers with exact path probes and node/ancestor identity verification, sharing limits; no SVN historical review. Not semantic binding or complete definitions.' }, contextPaths: { type: 'array', items: { type: 'string' }, maxItems: 20 }, rulePaths: { type: 'array', items: { type: 'string' }, maxItems: 4 } } },
16
16
  output,
17
17
  async execute(args, exec) { const preview = await service.preview(args, exec); return { json: JSON.stringify(preview), markdown: '' }; },
18
18
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.63.0",
3
+ "version": "0.64.1",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
@@ -3,20 +3,27 @@ import { assertNonSecretPath } from './secret-path.mjs';
3
3
 
4
4
  export const CONTEXT_SIDE_NOTICE = 'context.text属于批准当前或target侧;oldText/oldRevision与context-old属于baseline旧侧。oldOnly:true表示只捕获旧侧,没有target正文,不证明目标路径不存在。不得互换版本或用旧侧上下文证明新侧行为;没有证据须保留uncertain。';
5
5
 
6
+ function verifySvnSource(source, history, name, revision, text) {
7
+ const expected=history.url?.replace(/\/$/,'')+'/'+name.split('/').map(encodeURIComponent).join('/');
8
+ if(!source||source.repositoryUuid!==history.repositoryUuid||source.url!==expected||source.pegRevision!==revision||source.operativeRevision!==revision||!/^[0-9a-f]{64}$/.test(source.hash??'')||source.textHash!==hash(text))throw new Error('Invalid SVN historical context provenance');
9
+ }
10
+
6
11
  // Validate approved snapshot data only. This does not authorize any capture.
7
12
  export function contextSources(item, history) {
8
13
  if (!item || relativePath(item.path) !== item.path) throw new Error('Invalid context path');
9
14
  assertNonSecretPath(item.path);
10
15
  if (item.oldOnly !== undefined && item.oldOnly !== true) throw new Error('Invalid old-only context marker');
16
+ if (item.oldOnly === true && history?.vcs === 'svn') {
17
+ if(typeof item.oldText!=='string'||item.oldRevision!==history.base||item.oldHash!==hash(item.oldText)||['text','revision','hash','svnSource','oldBlobOid'].some(key=>item[key]!==undefined))throw new Error('Invalid SVN old-only historical context provenance');
18
+ verifySvnSource(item.oldSvnSource,history,item.path,history.base,item.oldText);
19
+ return [{side:'context-old',text:item.oldText,revision:item.oldRevision,hash:item.oldHash,svnSource:structuredClone(item.oldSvnSource)}];
20
+ }
11
21
  if (item.oldOnly === true) {
12
22
  if (!history || !history.base || !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(history.base) || item.oldRevision !== history.base || typeof item.oldText !== 'string' || item.text !== undefined || item.revision !== undefined || item.hash !== undefined || !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(item.oldBlobOid ?? '') || item.oldHash !== hash(item.oldText)) throw new Error('Invalid old-only historical context provenance');
13
23
  return [{side:'context-old',text:item.oldText,revision:item.oldRevision,blobOid:item.oldBlobOid,hash:item.oldHash}];
14
24
  }
15
25
  if (history?.vcs === 'svn') {
16
- const verify = (source, revision, text) => {
17
- const expected = history.url?.replace(/\/$/, '') + '/' + item.path.split('/').map(encodeURIComponent).join('/');
18
- if (!source || source.repositoryUuid !== history.repositoryUuid || source.url !== expected || source.pegRevision !== revision || source.operativeRevision !== revision || !/^[0-9a-f]{64}$/.test(source.hash ?? '') || source.textHash !== hash(text)) throw new Error('Invalid SVN historical context provenance');
19
- };
26
+ const verify = (source, revision, text) => verifySvnSource(source,history,item.path,revision,text);
20
27
  if (item.revision !== history.target || typeof item.text !== 'string') throw new Error('Invalid SVN historical context provenance');
21
28
  verify(item.svnSource, history.target, item.text);
22
29
  if (item.oldText !== undefined) {
package/src/service.mjs CHANGED
@@ -49,7 +49,7 @@ export function createReviewService(llm, { capture = captureSnapshot, now = Date
49
49
  while (previews.size >= maxPreviews) previews.delete(previews.keys().next().value);
50
50
  const previewId = randomUUID();
51
51
  previews.set(previewId, { ...current, target, options, rounds, snapshotId: snapshot.id, expires: now() + ttlMs });
52
- return { ...(options.businessRequirement!==undefined?{businessRequirement:{text:options.businessRequirement,hash:hash(options.businessRequirement),bytes:Buffer.byteLength(options.businessRequirement)}}:{}), previewId, plan, snapshotId: snapshot.id, repositoryRoot: snapshot.root, vcs: snapshot.vcs, ...(snapshot.history ? { history: snapshot.history } : {}), model: current.route, modelSendingEnabled: allowModelSending, files: snapshot.files.map(f => ({ path: f.path, eligibility: f.eligibility, reason: f.reason, ...(f.blockCode ? {blockCode:f.blockCode} : {}), ...(f.copySource ? {copySource:f.copySource,copyNotice:f.copyNotice} : {}) })), contextPaths: snapshot.context.map(c => c.path), ...(options.oldContextPaths !== undefined ? {oldContextPaths:options.oldContextPaths,oldContextSources:snapshot.context.filter(c=>c.oldOnly).map(c=>({path:c.path,side:'context-old',revision:c.oldRevision,blobOid:c.oldBlobOid,hash:c.oldHash}))} : {}), ...(snapshot.callerDiscovery ? {callerDiscovery:snapshot.callerDiscovery} : {}), ...(snapshot.autoContext ? { autoContext: snapshot.autoContext } : {}), rules: (snapshot.rules ?? []).map(({ path, hash }) => ({ path, hash })), notice: (options.oldContextPaths !== undefined ? 'oldContextPaths仅为baseline旧侧正文,无目标侧替代;选中变更复用原old身份,旧侧不能证明新侧行为。' : '') + (snapshot.callerDiscovery ? 'callerScopePaths已授权预览读取限定目录内tracked候选正文,包括不匹配文件;非匹配正文不发送模型,匹配捕获上下文会发送。仅字面引用导航,不是函数调用或完整调用覆盖。' : '') + (enableRiskPlanning ? '执行按plan阈值决定风险假设规划,小变更可跳过独立规划但仍主审并复核;计划不是证据,所有阶段共享原预算。' : '') + '执行会向上述模型提供方发送可审查文件两侧内容、预览列出的显式/自动上下文、所选项目规则全文及预览业务需求文本。模型可在该快照范围内多轮只读检索,不读取范围外文件;候选生成后会进行证据与反证复核,两阶段各最多3轮检索,共享每文件120秒和总模型调用100次预算;复核不能证明缺陷成立。plan.reviewRounds为独立审查工作量,非模型reasoning effort;后续轮不带首轮风险计划,所有轮共享原超时与预算。plan仅预检初始输入,ready不代表已审查;minimumCalls不含后续检索/复核/动态业务综合;多文件可先进行业务分组,分组失败保留原组并记录限制,动态综合数执行前未知,实际预算可能不足。请先向用户展示范围,获得确认后执行。' };
52
+ return { ...(options.businessRequirement!==undefined?{businessRequirement:{text:options.businessRequirement,hash:hash(options.businessRequirement),bytes:Buffer.byteLength(options.businessRequirement)}}:{}), previewId, plan, snapshotId: snapshot.id, repositoryRoot: snapshot.root, vcs: snapshot.vcs, ...(snapshot.history ? { history: snapshot.history } : {}), model: current.route, modelSendingEnabled: allowModelSending, files: snapshot.files.map(f => ({ path: f.path, eligibility: f.eligibility, reason: f.reason, ...(f.blockCode ? {blockCode:f.blockCode} : {}), ...(f.copySource ? {copySource:f.copySource,copyNotice:f.copyNotice} : {}) })), contextPaths: snapshot.context.map(c => c.path), ...(options.oldContextPaths !== undefined ? {oldContextPaths:options.oldContextPaths,oldContextSources:snapshot.context.filter(c=>c.oldOnly).map(c=>({path:c.path,side:'context-old',revision:c.oldRevision,...(c.oldSvnSource?{svnSource:c.oldSvnSource}:{blobOid:c.oldBlobOid}),hash:c.oldHash}))} : {}), ...(snapshot.callerDiscovery ? {callerDiscovery:snapshot.callerDiscovery} : {}), ...(snapshot.autoContext ? { autoContext: snapshot.autoContext } : {}), rules: (snapshot.rules ?? []).map(({ path, hash }) => ({ path, hash })), notice: (options.oldContextPaths !== undefined ? 'oldContextPaths仅为baseline旧侧正文,无目标侧替代;选中变更复用原old身份,旧侧不能证明新侧行为。' : '') + (snapshot.callerDiscovery ? 'callerScopePaths已授权预览读取限定目录内tracked候选正文,包括不匹配文件;非匹配正文不发送模型,匹配捕获上下文会发送。仅字面引用导航,不是函数调用或完整调用覆盖。' : '') + (enableRiskPlanning ? '执行按plan阈值决定风险假设规划,小变更可跳过独立规划但仍主审并复核;计划不是证据,所有阶段共享原预算。' : '') + '执行会向上述模型提供方发送可审查文件两侧内容、预览列出的显式/自动上下文、所选项目规则全文及预览业务需求文本。模型可在该快照范围内多轮只读检索,不读取范围外文件;候选生成后会进行证据与反证复核,两阶段各最多3轮检索,共享每文件120秒和总模型调用100次预算;复核不能证明缺陷成立。plan.reviewRounds为独立审查工作量,非模型reasoning effort;后续轮不带首轮风险计划,所有轮共享原超时与预算。plan仅预检初始输入,ready不代表已审查;minimumCalls不含后续检索/复核/动态业务综合;多文件可先进行业务分组,分组失败保留原组并记录限制,动态综合数执行前未知,实际预算可能不足。请先向用户展示范围,获得确认后执行。' };
53
53
  } finally { busy = false; }
54
54
  },
55
55
  async execute(args, exec) {
@@ -30,14 +30,22 @@ export function svnHistoryDestination(value, allowNetwork) {
30
30
  return {url:scope.href.replace(/\/$/,''),networkAccess};
31
31
  }
32
32
 
33
+ export function mergeSvnHistoryRecord(previous, item) {
34
+ if(!['added','deleted','modified','none'].includes(item?.['@_item'])||!['file','dir'].includes(item?.['@_kind']))throw new Error('Ambiguous or unsupported SVN history summary');
35
+ if(!previous)return item;
36
+ if(previous['@_kind']!==item['@_kind']||!['added','deleted'].includes(previous['@_item'])||!['added','deleted'].includes(item['@_item'])||previous['@_item']===item['@_item'])throw new Error('Ambiguous or unsupported SVN history summary');
37
+ return {...item,'@_item':'replaced'};
38
+ }
39
+
33
40
  // Fixed URL objects only. No checkout, update, merge, working body or lazy HEAD read.
34
41
  export async function captureSvnHistory(cwd,options={}) {
35
42
  const range=svnHistoryRange(options);
36
43
  if (options.svnAllowNetwork!==undefined && typeof options.svnAllowNetwork!=='boolean') throw new Error('Invalid SVN network opt-in');
37
- if (options.autoContext===true || options.callerScopePaths!==undefined || options.oldContextPaths!==undefined) throw new Error('SVN historical automatic context, old-only context and callers are not supported yet');
38
- const contextPaths=options.contextPaths??[],rulePaths=options.rulePaths??[],maxContextFiles=options.maxContextFiles??20;
44
+ if (options.autoContext===true || options.callerScopePaths!==undefined) throw new Error('SVN historical automatic context and callers are not supported yet');
45
+ const contextPaths=options.contextPaths??[],oldContextPaths=options.oldContextPaths??[],rulePaths=options.rulePaths??[],maxContextFiles=options.maxContextFiles??20;
39
46
  if(!Number.isSafeInteger(maxContextFiles)||maxContextFiles<1||maxContextFiles>20||!Array.isArray(contextPaths)||contextPaths.length>maxContextFiles||new Set(contextPaths).size!==contextPaths.length||!Array.isArray(rulePaths)||rulePaths.length>4||new Set(rulePaths).size!==rulePaths.length||rulePaths.some(name=>contextPaths.includes(name)))throw new Error('Invalid SVN historical context or rule selection');
40
- for(const name of [...contextPaths,...rulePaths]){relativePath(name);assertNonSecretPath(name);}
47
+ if(!Array.isArray(oldContextPaths)||oldContextPaths.length>20||new Set(oldContextPaths).size!==oldContextPaths.length||contextPaths.length+oldContextPaths.length>maxContextFiles||oldContextPaths.some(name=>contextPaths.includes(name)||rulePaths.includes(name)))throw new Error('Invalid SVN old context selection');
48
+ for(const name of [...contextPaths,...oldContextPaths,...rulePaths]){relativePath(name);assertNonSecretPath(name);}
41
49
  const {maxFiles=200,maxFileBytes=256*1024,maxSnapshotBytes=4*1024*1024,selectedPaths}=options;
42
50
  for(const [value,cap]of [[maxFiles,200],[maxFileBytes,256*1024],[maxSnapshotBytes,4*1024*1024]])if(!Number.isSafeInteger(value)||value<1||value>cap)throw new Error('Invalid SVN history limit');
43
51
  if(selectedPaths!==undefined && (!Array.isArray(selectedPaths)||selectedPaths.length>200||new Set(selectedPaths).size!==selectedPaths.length))throw new Error('Invalid SVN history selection');
@@ -77,8 +85,7 @@ export async function captureSvnHistory(cwd,options={}) {
77
85
  const decoded=decodeURIComponent(part);if(decoded.includes('/')||decoded.includes('\\'))throw new Error('Encoded SVN path separator');return decoded;
78
86
  }).join('/');
79
87
  if(name!=='.')relativePath(name);
80
- if(records.has(name)||!['added','deleted','modified','none'].includes(item['@_item'])||!['file','dir'].includes(item['@_kind']))throw new Error('Ambiguous or unsupported SVN history summary');
81
- records.set(name,item);
88
+ records.set(name,mergeSvnHistoryRecord(records.get(name),item));
82
89
  }
83
90
  if(selectedPaths?.some(name=>!records.has(name)))throw new Error('Selected path is not an SVN historical change');
84
91
  const properties=async(name,rev)=>{
@@ -119,7 +126,7 @@ export async function captureSvnHistory(cwd,options={}) {
119
126
  }catch(error){signal.throwIfAborted();if(error.code==='SVN_HISTORY_BUDGET')throw error;item.eligibility='blocked';item.reason=error.message;delete item.left;delete item.right;}
120
127
  if(Buffer.byteLength(JSON.stringify(files))>maxSnapshotBytes)throw new Error('SVN historical snapshot limit exceeded');
121
128
  }
122
- for(const item of files.filter(f=>f.kind==='dir'&&['added','deleted'].includes(f.rawStatus)&&f.eligibility==='reviewable')){
129
+ for(const item of files.filter(f=>f.kind==='dir'&&['added','deleted','replaced'].includes(f.rawStatus)&&f.eligibility==='reviewable')){
123
130
  if(files.some(child=>child.path.startsWith(item.path==='.'?'':item.path+'/')&&child!==item&&child.eligibility!=='reviewable')){item.eligibility='blocked';item.reason='Historical directory descendant coverage incomplete';delete item.left;delete item.right;}
124
131
  }
125
132
  const context=[];
@@ -143,6 +150,16 @@ export async function captureSvnHistory(cwd,options={}) {
143
150
  }
144
151
  context.push(item);
145
152
  }
153
+ for(const name of [...oldContextPaths].sort()){
154
+ const changed=files.find(file=>file.path===name);
155
+ if(changed){
156
+ if(changed.eligibility!=='reviewable'||changed.kind!=='file'||!changed.svnSources?.old)throw new Error('Old SVN context conflicts with excluded blocked or absent baseline change');
157
+ // The original changed-file old identity already authorizes this side.
158
+ continue;
159
+ }
160
+ const old=await readSource(name,range.base);if(old.kind!=='file')throw new Error('Old SVN context requires baseline file');
161
+ context.push({path:name,oldOnly:true,oldText:old.content.text,oldHash:hash(old.content.text),oldRevision:range.base,oldSvnSource:old.source});
162
+ }
146
163
  const rules=await captureProjectRules(root,rulePaths,{signal,files,read:async(_root,name)=>{
147
164
  const value=await targetContent(name);if(value.content.bytes>16*1024)throw new Error('Rule file size limit exceeded');return value.content;
148
165
  }});