@feng0531/dsh-code-review 0.58.1 → 0.59.0

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,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.59.0 — SVN 复制新增文件与移动两侧覆盖
6
+
7
+ 支持同仓库、固定 copyfrom revision 的复制新增文件,旧侧明确为空目标,完整审查工作侧正文与属性;预览披露来源 URL/revision/UUID,采集末尾复核来源身份。移动作为目标新增与原路径删除分别覆盖,不冒充已验证重命名。不读复制来源正文,也不增加网络访问。凭据来源拒绝;复制替换与目录复制继续阻断,避免把来源 BASE 冒充目标旧节点。
8
+
5
9
  ## 0.58.1 — SVN 根目录属性预览修复
6
10
 
7
- 修复 SVN 合并产生根目录 mergeinfo 属性时,默认预览和指定文件预览均报 Invalid relation file 的问题。保留根目录属性变更和覆盖统计,仅允许有目录身份的根节点 `.`,普通路径穿越仍拒绝;上下文竞争条目保留目录身份。独立 SVN 三文件变更与根 mergeinfo 场景验证预览零模型发送和工作副本状态不变。全面 SVN 扩展另按支持矩阵分批推进,尚未宣称历史区间或所有特殊状态已支持。
11
+ 修复 SVN 合并产生根目录 mergeinfo 属性时,默认预览和指定文件预览均报 Invalid relation file 的问题。保留根目录属性变更和覆盖统计,仅允许有目录身份的根节点 `.`,普通路径穿越仍拒绝;上下文竞争条目保留目录身份。独立 SVN 三文件变更与根 mergeinfo 场景验证预览零模型发送和工作副本状态不变。全面 SVN 扩展另按支持矩阵分批推进,尚未宣称历史区间或所有特殊状态已支持。456 项串行回归、宿主、隔离安装和四组 CI 通过;原产物/npm/Release 116,254 字节逐字节一致,双哈希、清单与冻结发布说明通过。
8
12
 
9
13
  ## 0.58.0 — 本地评测入口可靠性整理
10
14
 
@@ -32,7 +32,8 @@
32
32
 
33
33
  ## 当前验证结论
34
34
 
35
- - 最近完整回归:454 项通过。
35
+ - 最近完整回归:456 项通过。
36
+ - v0.58.1 已交付 SVN 根目录 mergeinfo 属性预览修复及全面支持矩阵。456 项串行回归、实际宿主、隔离安装与四组 CI 通过;npm、Release 与原包 116,254 字节逐字节一致,SHA-256、SHA-512、清单与冻结发布说明核验通过。SVN 全面扩展目标仍在进行,历史与特殊状态尚未全部支持。
36
37
  - v0.58.0 已正式交付实验性本地评测入口及可靠性整理。454 项串行回归、实际宿主、隔离安装与四组 CI 通过;npm、Release 与原包 113,697 字节逐字节一致,SHA-256、SHA-512、清单与冻结发布说明核验通过。正常 DSH 审查行为与预算不变;尚无真实模型基准评分。
37
38
  - v0.57.0 已正式交付对齐结论与边界收尾。449 项回归与四组 CI 通过;npm、Release 与原包 108,451 字节一致,SHA-256、SHA-512、清单与发布说明核验通过;不改变审查行为或参数。
38
39
  - v0.56.0 已正式交付依赖清单与配置文件专用指导。449 项回归、实际宿主、隔离安装与四组 CI 通过;npm、Release 与原包 108,081 字节一致,SHA-256、SHA-512、清单与发布说明核验通过;不改变审查行为或参数。
package/README.md CHANGED
@@ -89,7 +89,7 @@ commit 与 baseRevision/targetRevision 不能同时使用。oldContextPaths 只
89
89
  - 不执行项目代码、构建脚本或模型生成的 shell 命令。模型只能在批准的快照中查找、搜索和读取。
90
90
  - 常见凭据路径会被排除,但普通源码也可能含秘密。路径过滤不能代替人工检查。
91
91
  - 二进制、不能解码的文件、链接和超限内容会被阻断,不会自动截断后假装完成。
92
- - SVN 的复制、替换、切换目录、外部工作副本、冲突及部分属性状态不受支持。含 svn:keywords 的文件也会被阻断,以免把关键字展开当作代码变化。
92
+ - SVN 同仓库复制新增文件以空目标旧侧审查,copyfrom URL/revision/UUID 在预览中披露,仅作来源信息,不自动读取来源正文,也不认定为已验证重命名。文件移动的新增/删除两侧分别覆盖。复制目录、替换、切换目录、外部工作副本、冲突及部分属性状态仍未支持;含 svn:keywords 的文件仍阻断。全面扩展进度见 [SVN 支持矩阵](SVN-SUPPORT-MATRIX.md)。
93
93
 
94
94
  ## 默认规模限制
95
95
 
package/RELEASE-NOTES.md CHANGED
@@ -1,16 +1,16 @@
1
- # v0.58.1 发布说明
1
+ # v0.59.0 发布说明
2
2
 
3
- ## SVN 根目录属性预览修复
3
+ ## SVN 复制新增文件与移动两侧覆盖
4
4
 
5
- 修复 SVN 分支合并产生根目录 svn:mergeinfo 属性变更时,插件预览报 `Invalid relation file` 的问题。原问题既影响默认预览,也影响仅选择源码文件的预览,因为根目录条目仍保留在快照中。
5
+ 支持同仓库复制新增文件,目标旧侧明确为空;完整审查工作侧正文和属性,不将复制来源的 BASE 当作目标旧版本。
6
6
 
7
- - 保留根目录属性变化与覆盖统计,不删除条目掩盖问题。
8
- - 仅允许明确目录身份的根节点 `.`;普通文件的 `.`、`..` 路径仍被拒绝。
9
- - 上下文规划保留目录身份,避免再次触发关系校验错误。
10
- - 独立 SVN 测试覆盖三源码文件与根 mergeinfo 变更,验证两种预览均零模型发送、工作副本状态不变。
7
+ - 预览披露 copyfrom URL、revision、仓库 UUID;采集末尾复核复制身份。
8
+ - 文件移动的原路径删除与目标新增分别计入覆盖,不推定已验证重命名。
9
+ - 不读取复制来源正文,不新增网络访问;凭据路径来源继续拒绝。
10
+ - 复制后修改、来源缺失和仓库离线均有独立测试。
11
11
 
12
- ## SVN 后续支持
12
+ ## 当前限制
13
13
 
14
- 按新的全面 SVN 目标,复制/移动/替换、关键字与换行、固定 revision 历史审查及历史上下文将分批实现。现阶段并非所有 SVN 状态都可审查;见 [支持矩阵](SVN-SUPPORT-MATRIX.md)。
14
+ 复制替换、目录复制及目录后代覆盖尚未实现;特别是复制替换的 `svn cat -r BASE` 可能返回来源内容,不能当作目标旧版本。关键字、冲突、固定 revision 历史审查等继续按 [SVN 支持矩阵](SVN-SUPPORT-MATRIX.md) 推进,本版不宣称全面 SVN 支持已经完成。
15
15
 
16
- 本版本未对用户 r7315 的实际临时副本进行审查,不宣称该提交已由插件通过。日常使用见 [README](README.md)。
16
+ 日常使用见 [README](README.md)。
@@ -16,8 +16,8 @@
16
16
  |---|---|---|
17
17
  | 常规文件修改、普通新增、删除 | 已有 BASE/工作字节与属性捕获测试 | 维持并扩充组合验收 |
18
18
  | 子目录属性变更 | 已有独立属性审查测试 | 第一批 |
19
- | 根目录属性/mergeinfo | 新测试复现 `Invalid relation file`;本地补丁通过指定三文件和默认预览,0 模型发送,456 项回归通过;尚未发布 | 第一批先发布此修复 |
20
- | 复制/移动、copyfrom 及目录结构变更 | 现有采集拒绝复制和目录结构变更;不能说已支持 | 第二批:明确旧侧来源和后代覆盖 |
19
+ | 根目录属性/mergeinfo | v0.58.1 已发布;独立复现后修复,指定三文件和默认预览均通过、0 模型发送、状态不变;456 项串行回归、宿主、隔离安装和四矩阵 CI 通过,原产物/npm/Release 116,254 字节逐字节一致及双哈希/清单/发布说明通过 | 第一批先发布此修复 |
20
+ | 复制/移动、copyfrom 及目录结构变更 | 本地开发已支持同仓库复制新增文件及文件移动的新增/删除独立覆盖:新增目标旧侧为空,copyfrom 只作来源信息,预览披露并冻结身份;离线与凭据来源拒绝测试通过。复制目录及后代覆盖仍未实现,待本批发布核验 | 第二批:明确旧侧来源和后代覆盖 |
21
21
  | 替换、删除再新增、文件/目录类型变化 | 当前 replaced 被拒绝 | 第二批:区分 BASE 旧节点与目标节点 |
22
22
  | 缺失、文本/属性/树冲突、阻塞 | 当前多数仅统一 blocked | 第三批:明确状态诊断;不能合成不存在的工作侧或声称审核通过 |
23
23
  | svn:keywords、svn:eol-style | keywords 当前阻断;换行保留原文但无规范化映射 | 第三批:双侧可验证映射,保留原字节和定位 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.58.1",
3
+ "version": "0.59.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
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 })), 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.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不含后续检索/复核/动态业务综合;多文件可先进行业务分组,分组失败保留原组并记录限制,动态综合数执行前未知,实际预算可能不足。请先向用户展示范围,获得确认后执行。' };
53
53
  } finally { busy = false; }
54
54
  },
55
55
  async execute(args, exec) {
package/src/svn.mjs CHANGED
@@ -47,14 +47,22 @@ export async function captureSvn(cwd, options = {}) {
47
47
  try {
48
48
  if (name !== '.') relativePath(name);
49
49
  if (!['modified', 'added', 'deleted', 'normal', 'unversioned'].includes(status) || state['@_props'] === 'conflicted' || state['@_tree-conflicted'] === 'true') throw new Error('Unsupported or conflicted SVN state: ' + status);
50
- if (state['@_copied'] === 'true' || state['@_switched'] === 'true' || state['@_file-external'] === 'true') throw new Error('Copy, switched or external node requires explicit historical support');
50
+ if (state['@_switched'] === 'true' || state['@_file-external'] === 'true') throw new Error('Switched or external node requires explicit historical support');
51
+ if (state['@_copied'] === 'true' && status !== 'added') throw new Error('Copied replacement requires verified target baseline');
51
52
  const hasBase = !['added', 'unversioned'].includes(status);
52
53
  let kind;
53
54
  if (status === 'unversioned') kind = (await lstat(path.join(root, name))).isDirectory() ? 'dir' : 'file';
54
55
  else {
55
56
  const node = xml(await svn(root, ['info', '--xml', '--', target(name)], options)).info.entry[0];
56
57
  kind = node['@_kind'];
57
- if (node['wc-info']?.['copy-from-url']) throw new Error('Copied node baseline is not supported');
58
+ if (state['@_copied'] === 'true' || node['wc-info']?.['copy-from-url']) {
59
+ const source = node['wc-info']?.['copy-from-url'], revision = node['wc-info']?.['copy-from-rev'];
60
+ if (status !== 'added' || kind !== 'file' || typeof source !== 'string' || !source || !/^[0-9]+$/.test(String(revision)) || node.repository?.uuid !== info.repository.uuid || node.repository?.root !== info.repository.root) throw new Error('Copied node requires a same-repository added file with fixed copy source');
61
+ if (isSecretPath(decodeURIComponent(new URL(source).pathname))) throw new Error('Credential copy source excluded');
62
+ item.copySource = { url: source, revision: String(revision), repositoryUuid: node.repository.uuid };
63
+ item.copyNotice = 'Target addition is reviewed against an empty target baseline; copy source is provenance only, not an approved source body or verified rename.';
64
+ item.copyNodeIdentity = hash(JSON.stringify([node.url, node['@_kind'], node['@_revision'], node['wc-info']?.schedule, node['wc-info']?.['wcroot-abspath'], source, String(revision), node.repository]));
65
+ }
58
66
  }
59
67
  item.kind = kind;
60
68
  item.rightExists = status !== 'deleted';
@@ -82,6 +90,11 @@ export async function captureSvn(cwd, options = {}) {
82
90
  const after = await svn(root, statusArgs, options);
83
91
  if (!isDeepStrictEqual(xml(after), xml(before))) throw new Error('Working copy changed during capture');
84
92
  for (const item of files.filter(f => f.eligibility === 'reviewable')) {
93
+ if (item.copySource) {
94
+ const node = xml(await svn(root, ['info', '--xml', '--', target(item.path)], options)).info.entry[0];
95
+ const identity = hash(JSON.stringify([node.url, node['@_kind'], node['@_revision'], node['wc-info']?.schedule, node['wc-info']?.['wcroot-abspath'], node['wc-info']?.['copy-from-url'], String(node['wc-info']?.['copy-from-rev']), node.repository]));
96
+ if (identity !== item.copyNodeIdentity) throw new Error('Copy source identity changed during capture');
97
+ }
85
98
  if (item.kind === 'file' && item.rawStatus !== 'deleted' && (await readLocal(root, item.path, options)).hash !== item.right.hash) throw new Error('Content changed during capture');
86
99
  const left = !['added', 'unversioned'].includes(item.rawStatus) ? await properties(root, item.path, true, options) : {};
87
100
  const right = ['deleted', 'unversioned'].includes(item.rawStatus) ? {} : await properties(root, item.path, false, options);