@feng0531/dsh-code-review 0.76.2 → 0.77.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,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.77.0 — SVN 标准关键字自动依赖
6
+
7
+ 自动依赖和显式链入口复用标准关键字BASE核验,保留原始展开证据,全部来源计入共享预算/截止;预览披露映射。不支持配置明确阻断,共享耗尽失败,限定调用方关键字扫描仍未开放。
8
+
9
+ ## 0.76.3 — 修复 SVN 本地导航组合共享预算
10
+
11
+ 显式上下文/自动依赖/调用方扫描/关键字BASE核验共同使用1MiB来源账本和30秒截止,不再分阶段重新计费。非命中扫描仍计费,共享耗尽明确失败,不变成成功或普通候选阻断。原有更细限制保持,纯BUG修复不增加读取权限。517项串行回归、4项预算/关键字/EOL专项、宿主/隔离安装和四矩阵CI通过;原始Actions/npm/Release包150,607字节逐字节一致,双哈希/清单/冻结说明通过。
12
+
5
13
  ## 0.76.2 — 修复 SVN 普通变更来源身份遗漏
6
14
 
7
- 普通节点和根URL进入快照并末尾复核,切换祖先下的子文件明确阻断,正常预览后切换目录会拒绝执行;不以相同正文/revision代替来源身份。复制语义及中文转义兼容保持。共享来源预算的独立审查发现仍待修复。
15
+ 普通节点和根URL进入快照并末尾复核,切换祖先下的子文件明确阻断,正常预览后切换目录会拒绝执行;不以相同正文/revision代替来源身份。复制语义及中文转义兼容保持。共享来源预算的独立审查发现仍待修复。515项串行回归和16项采集专项通过;v0.76.1因Windows测试URL等价断言失败未发布、标签未移动,修正后v0.76.2四矩阵CI通过。原始Actions/npm/Release包149,274字节逐字节一致,双哈希/清单/冻结说明通过。
8
16
 
9
17
  ## 0.76.0 — 独立显式 SVN 标准关键字上下文
10
18
 
@@ -32,7 +32,9 @@
32
32
 
33
33
  ## 当前验证结论
34
34
 
35
- - 最近完整回归:514项通过;v0.76.0 显式/依赖组合9项通过。
35
+ - 最近完整回归:517项通过;v0.76.3 预算/关键字/EOL组合4项通过。
36
+ - v0.76.3 已发布本地导航共享1MiB来源/30秒截止BUG修复,显式/依赖/调用方扫描及关键字BASE核验共同扣费,共享耗尽传播失败;宿主/隔离安装和四矩阵CI通过,原始Actions/npm/Release包150,607字节逐字节一致,双哈希/清单/冻结正文通过。全面SVN其余缺口继续。
37
+ - v0.76.2 已发布普通SVN变更来源URL/UUID/revision冻结和切换祖先阻断,预览execute来源变化拒绝且零发送;v0.76.1测试编码断言失败未发布、原标签保留,修正后四矩阵CI通过。原始Actions/npm/Release包149,274字节逐字节一致,双哈希/清单/冻结正文通过。共享预算超限独立BUG仍待修复。
36
38
  - v0.76.0 已发布独立显式标准关键字上下文,BASE展开/未展开核验计入原来源预算,原始展开正文为证据,预览元数据披露;宿主/隔离安装及四矩阵CI通过,原始Actions/npm/Release包147,614字节逐字节一致,双哈希/清单/冻结说明通过。自动依赖/调用方关键字与全面SVN其余缺口继续。
37
39
  - v0.75.1 已发布根级上下文祖先检查BUG修复,所有节点指纹绑定祖先属性,mergeinfo变化使旧身份过期,不安全根属性拒绝;宿主/隔离安装和四矩阵CI通过,原始Actions/npm/Release包146,408字节逐字节一致,双哈希/清单/冻结正文通过。纯BUG递增Z;全面SVN缺口继续。
38
40
  - v0.75.0 已发布独立显式SVN工作副本上下文节点/属性/URL身份核验与EOL元数据,末尾复核且离线受限,拒绝不安全来源;宿主/隔离安装与四矩阵CI通过,原始Actions/npm/Release包145,650字节逐字节一致,双哈希/清单/冻结说明通过。关键字、特殊状态与分支来源等缺口继续。
package/DEVELOPMENT.md CHANGED
@@ -19,7 +19,7 @@
19
19
  - 每个主文件的模型与检索阶段共享默认 120 秒;关联综合沿用相关主文件的生命周期,不因切换阶段重新计时。
20
20
  - 每阶段最多三轮检索;全局最多 50 次读取请求,返回内容累计 256 KiB,单次最多 64 KiB,读取最多 200 行。
21
21
  - Git 工作区依赖链最多三层、512 个精确路径查询、20 个候选、手动入口与自动依赖共享 1 MiB 正文;文件读取与最终复核共享 30 秒。
22
- - SVN 依赖链最多三层,以精确本地路径和安全正常节点捕获;512 路径、20 候选和上下文、1 MiB 来源及 30 秒含核验,拒绝切换、外部与特殊属性节点。
22
+ - SVN 依赖链最多三层,以精确本地路径和安全正常节点捕获;512 路径、20 候选和上下文。工作副本显式上下文、自动依赖、调用方扫描(含非命中)及关键字BASE核验共享1 MiB来源账本与30秒含核验截止,不能切换阶段重新获得额度;切换、外部与不支持属性节点拒绝。
23
23
  - Git 历史依赖链同样最多三层,两侧共享 512 个路径、20 个候选和上下文、1 MiB 正文及 30 秒;只读取固定对象。
24
24
  - 引用方发现最多四个不重叠的非根目录;128 个候选正文共 1 MiB,目录索引最多 256 条/64 KiB,竞争路径最多 512 个。发现与复核共享 30 秒。
25
25
 
package/README.md CHANGED
@@ -156,7 +156,7 @@ dsh plugin add https://github.com/f-e-n-g-0531/dsh-code-review.git
156
156
 
157
157
  这些文件和目录需要实际存在,路径相对于所选仓库:
158
158
 
159
- - `contextPaths`:手动加入辅助文件,不代表该文件本身完成了主审。SVN工作副本的未变更文件须通过离线正常节点/属性及来源检查;标准关键字仅在未启用autoContext的独立显式选择下核验后支持;自定义/固定宽度关键字、特殊或不可确认来源仍明确拒绝,已选择的可审查变更复用快照。
159
+ - `contextPaths`:手动加入辅助文件,不代表该文件本身完成了主审。SVN工作副本的未变更文件须通过离线正常节点/属性及来源检查;标准关键字在显式上下文和autoContext依赖中经过BASE核验后支持;自定义/固定宽度关键字、特殊或不可确认来源仍明确拒绝,已选择的可审查变更复用快照。
160
160
  - `autoContext:true`:自动补充最多三层文本依赖,不是全仓扫描或编译器分析。
161
161
  - `callerScopePaths`:在明确指定的非根目录中寻找字面引用。预览可能扫描该目录内不匹配的候选正文;只有捕获的匹配上下文随执行发送模型。不保证找到全部调用方。
162
162
  - `rulePaths`:最多四个 UTF-8 Markdown 或文本规则文件,不能同时列为上下文。
package/RELEASE-NOTES.md CHANGED
@@ -1,14 +1,14 @@
1
- # v0.76.2 发布说明
1
+ # v0.77.0 发布说明
2
2
 
3
- ## 修复 SVN 普通变更未冻结节点来源的问题
3
+ ## SVN 自动依赖支持标准关键字文件
4
4
 
5
- 普通工作副本变更现在也记录并复核节点URL、仓库UUID/根、revision、类型及调度身份。预览披露来源,根URL进入快照,避免只核验正文和属性却遗漏来源变化。
5
+ 工作副本使用 `autoContext:true` 时,可沿既有三层字面依赖捕获带标准 `svn:keywords` 的正常文件,手动上下文也可作为链入口。
6
6
 
7
- - 切换目录下的修改子文件即使自身没有switched标志,也会因实际URL偏离所选仓库路径而以 SVN_SWITCHED_ANCESTOR 明确阻断。
8
- - 普通节点在采集末尾重新核验,根节点身份也复核;复制来源仍保持独立信息与目标新增语义。
9
- - 不新增网络访问,不修改工作副本;中文、空格与合法URL转义的等价表示仍兼容。
10
- - 正常预览后切换目录,执行会拒绝旧预览且不发送模型。
7
+ - 复用独立显式上下文的节点/祖先身份和BASE收缩核验;原始展开正文、字节哈希和行号不替换。
8
+ - 工作正文、BASE展开及未展开核验正文计入同一1MiB来源预算,沿用共享30秒截止、20上下文名额和512精确探测。
9
+ - 预览披露关键字映射元数据,执行仍需批准;模型输入使用原文,不把收缩视图当行为等价证明。
10
+ - 自定义/固定宽度/不完整展开以候选阻断说明,不继续读取其依赖;共享预算耗尽仍直接失败。
11
11
 
12
- 本版是BUG补丁,不代表新增switched节点审查支持。另一个已复现的本地组合共享来源预算问题尚未修复,继续保留在 [支持矩阵](SVN-SUPPORT-MATRIX.md) 中。
12
+ 用法:预览参数 `{"autoContext":true}`,或 `{"contextPaths":["src/version.h"],"autoContext":true}`。先检查捕获文件、阻断项和模型,再确认执行。限定调用方的关键字扫描本批未开放,特殊状态和分支来源等仍见 [支持矩阵](SVN-SUPPORT-MATRIX.md)。
13
13
 
14
- 使用见 [README](README.md)。
14
+ 完整操作见 [README](README.md)。
@@ -31,12 +31,29 @@
31
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 字节、双哈希/清单/发布说明通过;本地开发了注入固定版本 lookup/read 能力的三层历史依赖导航核心,逐侧共享512探测/20候选/1MiB来源与上下文名额;排除项、旧侧限定和规则隔离测试通过。v0.68.0 已发布三层逐侧历史 autoContext,固定父目录有界清单 lookup,清单成功证明缺失、访问失败直接传播,真实旧/新版本链和脏工作树隔离通过。496 项串行回归、宿主、隔离安装、四矩阵 CI 与原包/npm/Release 134,056 字节、双哈希/清单/发布说明通过;本地新增逐侧固定 revision 调用方核心能力接口:共享256索引/128扫描/1MiB正文/512侧探测,命中侧才捕获正文,规则/变更排除与old-only限制保留,同侧命名调用声明导航测试通过;本地已接入固定 SVN 显式目录递归清单/同侧正文、统一30秒/512命令/元数据/正文预算,caller 与依赖共享精确探测及来源上限,真实集成专项13项通过;v0.69.0 已发布历史限定调用方和autoContext组合;502项串行全量回归、组合模型输入隔离、宿主/隔离安装、四矩阵 CI 通过。原包/npm/Release 136,030 字节、双哈希/清单/发布说明通过;字面发现仍不证明完整调用覆盖 | 第六批:逐侧固定版本,不能回退至工作副本 |
32
32
  | 真正 r7314→r7315 样本 | 用户未提供隔离副本路径;本地类似复现不是该样本验收 | 获得路径后只读生成预览,不自动发送模型 |
33
33
 
34
- ## 审查发现修复:普通变更来源身份(v0.76.2 待发布)
34
+ ## 下一批:自动依赖标准关键字(v0.77.0 待发布)
35
+
36
+ - 本地依赖链复用已验证的显式来源捕获,工作/BASE展开/未展开全部计费,共享1MiB/30秒;原始展开为唯一正文证据,三层/20名额/512探测保持。
37
+ - 捕获后按同一允许关键字策略复核身份;显式入口元数据复用,不把节点允许策略泄漏给调用方扫描。
38
+ - `test/svn-auto-keywords.test.mjs` 真实离线链复现:展开原文、BASE计费、后续依赖、unsupported候选阻断、预览0发送与模型原文/稳定ID;既有显式/依赖/预算10项通过。518项串行全量回归、10项显式/依赖/预算组合、离线链专项及宿主/隔离安装通过,尚未发布。
39
+ - 限定调用方标准关键字、自定义/固定宽度与其余SVN缺口仍未完成。
40
+
41
+ ## 审查发现修复:本地组合共享预算(v0.76.3 已发布)
42
+
43
+ 冻结提交 `7794dcd0b2b9eaee66c3a2d71ee3e416b803e00c`;标签CI `38724071757`,唯一发布运行 `38724938443`,原工件 `11968546653`。原始Actions/npm/Release包150,607字节逐字节一致;SHA-256 `aa25450df36c068567b1da3984a09d2af6a7f86cebb75cb9a3318eaba87150d4`,SHA-512/清单/冻结发布正文核验通过。
44
+
45
+ - 修复前真实组合contextPaths+callerScopePaths可读取1,140,102字节,超过1MiB但成功。修复后snapshot入口创建一个source账本/30秒signal,各本地导航阶段共同扣费,关键字BASE两份核验正文亦计费。
46
+ - `test/svn-navigation-budget.test.mjs` 覆盖精确1MiB边界/越界/取消和真实显式+非命中扫描组合、autoContext入口+扫描组合越界拒绝,小请求正常;与关键字/EOL组合4项通过。517项串行全量回归、4项预算/关键字/EOL组合、宿主/隔离安装、四矩阵标签和发布CI通过,正式发布工件核验完成。
47
+ - 共享预算错误在依赖链直接传播,不伪装成成功;保留原有单阶段核验/文件/字节限制。本批未新增特殊SVN状态或自动关键字支持。
48
+
49
+ ## 审查发现修复:普通变更来源身份(v0.76.2 已发布)
50
+
51
+ 冻结提交 `34ded1840536406fd454ab120b977ec6aa97abf7`;标签CI `38719902365`,唯一发布运行 `38720759455`,原工件 `11967005142`。原始Actions/npm/Release包149,274字节逐字节一致;SHA-256 `e7702aa23e01146c440d4e3bdf4820332d5a7e6eb5f1747ab66d854a01f33cbf`,SHA-512/清单/冻结发布说明核验通过。
35
52
 
36
53
  v0.76.1 标签CI `38718993310` 的Windows两组因新测试比较 `~` 与 `%7E` 原始URL字符串失败,Ubuntu两组通过;未触发正式发布,标签保留不移动。修正测试按等价URL比较后使用新补丁v0.76.2重新验收。
37
54
 
38
55
  - 已复现切换祖先的修改子文件误收及不同分支同正文/revision快照碰撞。修复为普通节点冻结URL/UUID/仓库根/revision/kind/schedule,末尾及根身份复核,预览披露workingSource。
39
- - `test/svn-working-identity.test.mjs` 真实仓库证明正常来源绑定、切换子节点SVN_SWITCHED_ANCESTOR阻断、无正文授权、旧预览execute拒绝且0模型发送;与普通采集组合16项通过。中文/空格/URL转义兼容修正,515项串行全量回归、16项采集专项、宿主/隔离安装通过,尚未发布。
56
+ - `test/svn-working-identity.test.mjs` 真实仓库证明正常来源绑定、切换子节点SVN_SWITCHED_ANCESTOR阻断、无正文授权、旧预览execute拒绝且0模型发送;与普通采集组合16项通过。中文/空格/URL转义兼容修正,515项串行全量回归、16项采集专项、宿主/隔离安装、修正测试后的四矩阵标签与发布CI通过,正式发布工件核验完成。
40
57
  - switched状态并未因此可审查;阻断项可同ID但无正文授权,不把其视为已审核成功。
41
58
  - 独立待修BUG:本地contextPaths+callerScopePaths来源分别计费,实测1,140,102字节超过共享1MiB仍成功;本批不声称已解决。
42
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.76.2",
3
+ "version": "0.77.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
package/src/snapshot.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import {captureSvnDependencyChain} from './svn-dependency-chain.mjs';
2
+ import {createSvnNavigationBudget} from './svn-navigation-budget.mjs';
2
3
  import {captureSvnExplicitContext} from './svn-explicit-context.mjs';
3
4
  import {captureDependencyChain} from './dependency-chain.mjs';
4
5
  import {captureSvnCallers} from './svn-caller-capture.mjs';
@@ -54,18 +55,20 @@ export async function captureSnapshot(cwd, options = {}) {
54
55
  const snapshot = await capture(cwd, options);
55
56
  if (!Array.isArray(rulePaths) || rulePaths.some(name => contextPaths.includes(name))) throw new Error('Rule paths must be separate from context paths');
56
57
  const rules = await captureProjectRules(snapshot.root, rulePaths, { signal: options.signal, files: snapshot.files });
58
+ const navigationBudget=type==='svn'?createSvnNavigationBudget(options.signal):undefined;
59
+ const navigationOptions=navigationBudget?{...options,signal:navigationBudget.signal,svnNavigationBudget:navigationBudget}:options;
57
60
  const context = [];
58
61
  let autoContext, index, verifyDependencies, explicitSeeds = [], indexOptions = options;
59
62
  if (options.autoContext === true && type==='git') {
60
63
  const chain=await captureDependencyChain(snapshot.root,snapshot.files,options);
61
64
  explicitSeeds=chain.explicitSeeds;context.push(...chain.context);autoContext=chain.autoContext;index=chain.index;indexOptions=chain.indexOptions;
62
65
  } else if (options.autoContext === true) {
63
- const chain=await captureSvnDependencyChain(snapshot.root,snapshot.files,options);
66
+ const chain=await captureSvnDependencyChain(snapshot.root,snapshot.files,navigationOptions);
64
67
  explicitSeeds=chain.explicitSeeds;context.push(...chain.context);autoContext=chain.autoContext;indexOptions=chain.indexOptions;verifyDependencies=chain.verify;
65
68
  }
66
69
  let verifyExplicit;
67
70
  if(type==='svn'&&options.autoContext!==true&&contextPaths.length){
68
- const explicit=await captureSvnExplicitContext(snapshot.root,[...new Set(contextPaths)].filter(name=>!snapshot.files.some(f=>f.path===name)).sort(),options);
71
+ const explicit=await captureSvnExplicitContext(snapshot.root,[...new Set(contextPaths)].filter(name=>!snapshot.files.some(f=>f.path===name)).sort(),navigationOptions);
69
72
  explicitSeeds=explicit.context;verifyExplicit=explicit.verify;indexOptions=explicit.options;
70
73
  }
71
74
  for (const name of [...new Set(contextPaths)].sort()) {
@@ -79,12 +82,13 @@ export async function captureSnapshot(cwd, options = {}) {
79
82
  const item=type==='svn'&&options.autoContext!==true&&seed?structuredClone(seed):{path:name,...await readLocal(snapshot.root,name,indexOptions)};
80
83
  if(seed&&seed.hash!==item.hash)throw new Error('Explicit dependency seed changed during capture');
81
84
  if(seed?.eolMapping)item.eolMapping=structuredClone(seed.eolMapping);
85
+ if(seed?.keywordMapping)item.keywordMapping=structuredClone(seed.keywordMapping);
82
86
  context.push(item);
83
87
  }
84
88
  }
85
89
  let callerDiscovery, verifyCallers;
86
90
  if (options.callerScopePaths !== undefined) {
87
- const callers = await (type==='git'?captureCallers:captureSvnCallers)(snapshot.root, snapshot.files, options.callerScopePaths, options);
91
+ const callers = await (type==='git'?captureCallers:captureSvnCallers)(snapshot.root, snapshot.files, options.callerScopePaths, type==='svn'?navigationOptions:options);
88
92
  verifyCallers = callers.verify;
89
93
  callerDiscovery = { ...callers.discovery, capturedPaths: [] };
90
94
  for (const item of callers.context) {
@@ -23,7 +23,7 @@ export async function captureSvnCallers(root, files, scopes, options={}) {
23
23
  // Read failures are fatal: unread bytes are not negative search evidence.
24
24
  const identity=await svnCallerNode(root,name,bounded);
25
25
  const content=await readLocal(root,name,bounded);
26
- scannedBytes+=content.bytes;
26
+ bounded.svnNavigationBudget?.charge(content.bytes);scannedBytes+=content.bytes;
27
27
  if(scannedBytes>1024*1024)throw new Error('Caller scan byte limit exceeded');
28
28
  scanned.push({path:name,...content,...(identity.eolStyle?{eolMapping:svnEolMapping(content.text,identity.eolStyle)}:{}),nodeFingerprint:identity.fingerprint,revision:identity.revision});
29
29
  }
@@ -1,16 +1,18 @@
1
1
  import {contextCandidates} from './context-candidates.mjs';
2
2
  import {svnCallerNode,svnCallerProbes} from './svn-caller-node.mjs';
3
- import {readLocal} from './content.mjs';
4
- import {svnEolMapping} from './svn-eol-mapping.mjs';
3
+ import {captureSvnExplicitContext} from './svn-explicit-context.mjs';
4
+ import {createSvnNavigationBudget} from './svn-navigation-budget.mjs';
5
+
5
6
  // Exact local path probes only. Every body requires safe offline SVN node identity.
6
7
  export async function captureSvnDependencyChain(root,files,options={}){
7
- const signal=AbortSignal.any([AbortSignal.timeout(30000),...(options.signal?[options.signal]:[])]),bounded={...options,signal,maxFileBytes:Math.min(options.maxFileBytes??256*1024,256*1024)};
8
+ const signal=AbortSignal.any([AbortSignal.timeout(30000),...(options.signal?[options.signal]:[])]),bounded={...options,signal,svnNavigationBudget:options.svnNavigationBudget??createSvnNavigationBudget(signal),maxFileBytes:Math.min(options.maxFileBytes??256*1024,256*1024)};
8
9
  const visited=new Set(files.map(f=>f.path)),reserved=new Set([...(options.contextPaths??[]),...(options.rulePaths??[])]),probes=new Set(),context=[],candidates=[],nodes=[];let frontier=[...files],bytes=0,truncated=false,index;
9
10
  const limit=Math.min(options.maxContextFiles??20,20);if(new Set(options.contextPaths??[]).size>limit)throw new Error('Context file limit exceeded');
11
+ const capture=async name=>{const value=await captureSvnExplicitContext(root,[name],bounded);bytes+=value.sourceBytes;if(bytes>1024*1024)throw new Error('SVN dependency source byte limit exceeded');return {item:value.context[0],node:value.identities[0]};};
10
12
  // Explicit context remains separately selected; safe normal nodes can seed navigation.
11
13
  const explicitSeeds=[];for(const name of [...new Set(options.contextPaths??[])].sort()){
12
14
  const changed=files.find(f=>f.path===name);if(changed){if(changed.eligibility!=='reviewable'||changed.rightExists===false)throw new Error('Context path is an excluded blocked or deleted change');continue;}
13
- const node=await svnCallerNode(root,name,bounded),item={path:name,...await readLocal(root,name,bounded)};if(node.eolStyle)item.eolMapping=svnEolMapping(item.text,node.eolStyle);bytes+=item.bytes;if(bytes>1024*1024)throw new Error('SVN dependency source byte limit exceeded');nodes.push({path:name,fingerprint:node.fingerprint});explicitSeeds.push(item);visited.add(name);frontier.push({path:name,eligibility:'reviewable',right:item});
15
+ const {node,item}=await capture(name);nodes.push({path:name,fingerprint:node.fingerprint});explicitSeeds.push(item);visited.add(name);frontier.push({path:name,eligibility:'reviewable',right:item});
14
16
  }
15
17
  const onProbe=paths=>{for(const p of paths)probes.add(p);if(probes.size>512)throw new Error('SVN dependency lookup limit exceeded');};
16
18
  for(let depth=1;depth<=3&&frontier.length;depth++){
@@ -18,10 +20,10 @@ export async function captureSvnDependencyChain(root,files,options={}){
18
20
  const plans=[];for(let i=0;i<frontier.length;i+=200)plans.push(contextCandidates(frontier.slice(i,i+200),index.paths));const next=[];
19
21
  for(const plan of plans){truncated ||= plan.truncated;for(const entry of plan.candidates){if(visited.has(entry.path)||reserved.has(entry.path))continue;visited.add(entry.path);const c={...entry,depth};candidates.push(c);if(candidates.length>20)throw new Error('SVN dependency candidate limit exceeded');
20
22
  if(context.length+new Set(options.contextPaths??[]).size>=limit){c.status='blocked';c.reason='Context file limit exceeded';continue;}
21
- try{const node=await svnCallerNode(root,entry.path,bounded),item={path:entry.path,...await readLocal(root,entry.path,bounded)};if(node.eolStyle)item.eolMapping=svnEolMapping(item.text,node.eolStyle);bytes+=item.bytes;if(bytes>1024*1024)throw new Error('SVN dependency source byte limit exceeded');context.push(item);nodes.push({path:item.path,fingerprint:node.fingerprint});c.status='captured';next.push({path:item.path,eligibility:'reviewable',right:item});}
22
- catch(error){signal.throwIfAborted();if(error.message==='SVN dependency source byte limit exceeded')throw error;c.status='blocked';c.reason=error.message;}
23
+ try{const {node,item}=await capture(entry.path);context.push(item);nodes.push({path:item.path,fingerprint:node.fingerprint});c.status='captured';next.push({path:item.path,eligibility:'reviewable',right:item});}
24
+ catch(error){signal.throwIfAborted();if(error.code==='SVN_NAVIGATION_BUDGET'||error.message==='SVN dependency source byte limit exceeded')throw error;c.status='blocked';c.reason=error.message;}
23
25
  }}frontier=next;
24
26
  }if(frontier.length)truncated=true;
25
- const verify=async()=>{for(const node of nodes)if((await svnCallerNode(root,node.path,bounded)).fingerprint!==node.fingerprint)throw new Error('SVN dependency node changed during capture');if(index&&(await svnCallerProbes(root,[...probes],bounded)).fingerprint!==index.fingerprint)throw new Error('SVN dependency resolution changed during capture');signal.throwIfAborted();};
27
+ const verify=async()=>{for(const node of nodes)if((await svnCallerNode(root,node.path,{...bounded,allowExplicitKeywords:true})).fingerprint!==node.fingerprint)throw new Error('SVN dependency node changed during capture');if(index&&(await svnCallerProbes(root,[...probes],bounded)).fingerprint!==index.fingerprint)throw new Error('SVN dependency resolution changed during capture');signal.throwIfAborted();};
26
28
  return {context,explicitSeeds,indexOptions:bounded,verify,autoContext:{candidates,capturedPaths:context.map(c=>c.path),truncated,maxDepth:3,sourceBytes:bytes,probeCount:probes.size,notice:'Offline safe SVN current-side literal dependencies, at most 3 layers, 512 exact probes, 20 candidates/context slots, 1MiB source and 30s including verification. Not symbol binding or complete caller coverage.'}};
27
29
  }
@@ -8,11 +8,11 @@ export async function captureSvnExplicitContext(root,names,options={}){
8
8
  if(!Array.isArray(names)||names.length>20||new Set(names).size!==names.length)throw new Error('Invalid SVN explicit context selection');
9
9
  const context=[],identities=[];let bytes=0;
10
10
  for(const name of names){
11
- const node=await svnCallerNode(root,name,bounded),content=await readLocal(root,name,bounded);bytes+=content.bytes;if(bytes>1024*1024)throw new Error('SVN explicit context source byte limit exceeded');
11
+ const node=await svnCallerNode(root,name,bounded),content=await readLocal(root,name,bounded);bounded.svnNavigationBudget?.charge(content.bytes);bytes+=content.bytes;if(bytes>1024*1024)throw new Error('SVN explicit context source byte limit exceeded');
12
12
  let keywordMapping;
13
13
  if(node.keywords){
14
14
  const current=svnKeywordMapping(content.text,node.keywords);
15
- const readBase=async(ignore)=>{const data=await checked('svn',['--non-interactive','cat',...(ignore?['--ignore-keywords']:[]),'-r','BASE','--',name+'@'],{...bounded,cwd:root,maxBytes:bounded.maxFileBytes});bytes+=data.length;if(bytes>1024*1024)throw new Error('SVN explicit context source byte limit exceeded');return decode(data);};
15
+ const readBase=async(ignore)=>{const data=await checked('svn',['--non-interactive','cat',...(ignore?['--ignore-keywords']:[]),'-r','BASE','--',name+'@'],{...bounded,cwd:root,maxBytes:bounded.maxFileBytes});bounded.svnNavigationBudget?.charge(data.length);bytes+=data.length;if(bytes>1024*1024)throw new Error('SVN explicit context source byte limit exceeded');return decode(data);};
16
16
  const base=svnKeywordMapping((await readBase(false)).text,node.keywords),repository=await readBase(true);
17
17
  if(base.text!==repository.text)throw new Error('SVN explicit BASE keyword mapping differs from repository text');
18
18
  const {text,...metadata}=current;keywordMapping={...metadata,status:'verified-line-view',notice:'Raw working text remains evidence; BASE contraction independently verified. Keyword view is not behavioral equivalence.'};
@@ -20,5 +20,5 @@ export async function captureSvnExplicitContext(root,names,options={}){
20
20
  context.push({path:name,...content,...(keywordMapping?{keywordMapping}:{}),...(node.eolStyle?{eolMapping:svnEolMapping(content.text,node.eolStyle)}:{})});identities.push({path:name,fingerprint:node.fingerprint});
21
21
  }
22
22
  const verify=async()=>{for(const node of identities)if((await svnCallerNode(root,node.path,bounded)).fingerprint!==node.fingerprint)throw new Error('SVN explicit context identity changed during capture');signal.throwIfAborted();};
23
- return {context,verify,options:bounded,sourceBytes:bytes};
23
+ return {context,verify,options:bounded,sourceBytes:bytes,identities};
24
24
  }
@@ -0,0 +1,5 @@
1
+ // One source ledger/deadline per working-copy navigation capture, never per stage.
2
+ export function createSvnNavigationBudget(signal){
3
+ const sharedSignal=AbortSignal.any([AbortSignal.timeout(30000),...(signal?[signal]:[])]);let bytes=0;
4
+ return Object.freeze({signal:sharedSignal,charge(size){sharedSignal.throwIfAborted();if(!Number.isSafeInteger(size)||size<0)throw new Error('Invalid SVN navigation source size');bytes+=size;if(bytes>1024*1024)throw Object.assign(new Error('SVN shared navigation source byte limit exceeded'),{code:'SVN_NAVIGATION_BUDGET'});},usage(){return bytes;}});
5
+ }