@feng0531/dsh-code-review 0.25.2 → 0.25.3

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
@@ -1,5 +1,10 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.25.3
4
+
5
+ - 历史C#方法语法提示按侧使用明确捕获的oldText/目标text,标记contextSide/contextVersion;缺oldText不回退新定义。
6
+ - 268测试通过,线索不作为语义绑定或因果证明,不额外读取。
7
+
3
8
  ## 0.25.2
4
9
 
5
10
  - 修预览已知跨文件minimumCalls计入风险规划,动态业务交互maximumAdditionalInitialCalls同样计入规划阶段。
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 当前状态
6
6
 
7
- 当前代码版本为 0.25.2
7
+ 当前代码版本为 0.25.3
8
8
 
9
9
  历史捕获用diff-tree精确端点变更元数据,不前置完整枚举文件树;显式上下文/规则和直接导入依赖按字面非递归路径查询。自动依赖最多512个待查路径,仍保留200变更/20上下文/4MiB快照限制,大树小提交不因无关文件元数据超限。
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.25.2",
3
+ "version": "0.25.3",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
@@ -3,9 +3,10 @@ const safe = text => typeof text === 'string' && Buffer.byteLength(text) <= 256
3
3
  const namespaceOf = text => { const matches = [...text.matchAll(/^\s*namespace\s+([A-Za-z_][A-Za-z0-9_.]*)\s*;\s*$/gm)]; return matches.length === 1 ? matches[0][1] : null; };
4
4
  export function inferCsharpContext(input, primary) {
5
5
  if (!primary.path.endsWith('.cs')) return [];
6
- const contexts = (input.context ?? []).filter(c => c.path.endsWith('.cs') && !input.files.some(f => f.path === c.path));
6
+ const approvedContexts = (input.context ?? []).filter(c => c.path.endsWith('.cs') && !input.files.some(f => f.path === c.path));
7
7
  const result = [];
8
8
  for (const side of ['old', 'new']) {
9
+ const contexts = input.history ? approvedContexts.map(c=>({...c,text:side==='old'?c.oldText:c.text})) : approvedContexts;
9
10
  const source = (side === 'old' ? primary.left : primary.right)?.text;
10
11
  if (!safe(source) || /\busing\b|\bdynamic\b/.test(source)) continue;
11
12
  const ns = namespaceOf(source); if (!ns) continue;
@@ -38,7 +39,7 @@ export function inferCsharpContext(input, primary) {
38
39
  if (malformed || depth !== 0 || typeDepth !== 0 || methodDepth !== 1 || methods[0]?.number <= classes[0].number) continue;
39
40
  if (occurrences.length === 1 && methods.length === 1) declarations.push({ contextPath:context.path, typeLine:classes[0].number, declarationLine:methods[0].number });
40
41
  }
41
- if (declarations.length === 1) result.push({ primaryPath:primary.path, side, contextVersion:'approved-current-not-historical', callLine:i+1, namespace:ns, type, method, ...declarations[0], confidence:'conservative-syntax-only' });
42
+ if (declarations.length === 1) result.push({ primaryPath:primary.path, side, contextVersion:input.history ? (side==='old'?input.history.base:input.history.target) : 'approved-current-not-historical', ...(input.history ? {contextSide:side} : {}), callLine:i+1, namespace:ns, type, method, ...declarations[0], confidence:'conservative-syntax-only' });
42
43
  if (result.length >= 20) return result;
43
44
  }
44
45
  }
@@ -23,7 +23,7 @@ export function preparePrimaryInput(input, file, { instructions, scope, grouping
23
23
  if (calls.length) { base.cppCallSites = calls; base.cppCallNotice = '最多20条零参语法位置/侧,仅导航子集;不表示全部调用覆盖,不证明宏展开、重载选择、动态分派或执行顺序。其他源码须在批准范围内读取。'; }
24
24
  }
25
25
  const csharpHints = inferCsharpContext(input, file);
26
- if (csharpHints.length) { base.csharpContextHints = csharpHints; base.csharpContextNotice = '仅批准当前context的C#静态类型/方法语法位置;不证明语义绑定或执行可达,也不是旧侧历史上下文。歧义不推定,线索不增加审查覆盖。'; }
26
+ if (csharpHints.length) { base.csharpContextHints = csharpHints; base.csharpContextNotice = '仅批准context的C#静态类型/方法语法位置;历史输入按contextSide/contextVersion区分正文,无旧正文不回退目标侧。不证明语义绑定或执行可达。歧义不推定,线索不增加审查覆盖。'; }
27
27
  let payload = JSON.stringify(base);
28
28
  const measure = value => initialInputBudget({ instructions, input: value }, scope, maxInputBytes);
29
29
  const metadata = {};