@feng0531/dsh-code-review 0.25.1 → 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 +10 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/coverage-plan.mjs +2 -2
- package/src/csharp-context.mjs +3 -2
- package/src/primary-input.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# 变更记录
|
|
2
2
|
|
|
3
|
+
## 0.25.3
|
|
4
|
+
|
|
5
|
+
- 历史C#方法语法提示按侧使用明确捕获的oldText/目标text,标记contextSide/contextVersion;缺oldText不回退新定义。
|
|
6
|
+
- 268测试通过,线索不作为语义绑定或因果证明,不额外读取。
|
|
7
|
+
|
|
8
|
+
## 0.25.2
|
|
9
|
+
|
|
10
|
+
- 修预览已知跨文件minimumCalls计入风险规划,动态业务交互maximumAdditionalInitialCalls同样计入规划阶段。
|
|
11
|
+
- 预览/实际链路一致预算断言,避免静态调用下界漏计。
|
|
12
|
+
|
|
3
13
|
## 0.25.1
|
|
4
14
|
|
|
5
15
|
- 修复大仓库小提交历史快照Command output limit exceeded:用diff-tree raw NUL元数据取代两端全树ls-tree,不扩大整树上限。
|
package/README.md
CHANGED
package/package.json
CHANGED
package/src/coverage-plan.mjs
CHANGED
|
@@ -18,7 +18,7 @@ export function buildCoveragePlan(input, options) {
|
|
|
18
18
|
const prepared = preparePrimaryInput(input, file, options);
|
|
19
19
|
return { ...item, ...prepared.metadata, status: prepared.budget.fits ? 'ready' : 'input-blocked', minimumCalls: prepared.budget.fits ? ((prepared.batches?.length ?? 1) * (options.enableRiskPlanning === true ? 2 : 1) + (prepared.synthesis?.budget.fits ? 1 : 0)) : 0 };
|
|
20
20
|
});
|
|
21
|
-
const interactions = options.scope && options.grouping ? options.grouping.groups.filter(g => g.fileIds.length > 1).map(group => { const prepared = prepareInteractionInput(input, group, payload => initialInputBudget({ instructions: options.instructions, input: payload }, options.scope, options.maxInputBytes)); return { groupId: group.id, fileIds: prepared.fileIds, status: prepared.status, reason: prepared.reason, minimumCalls: prepared.status === 'ready' ? 1 : 0 }; }) : [];
|
|
22
|
-
const businessGrouping = options.enableBusinessGrouping === true && input.files.filter(f => f.eligibility === 'reviewable').length > 1 ? { minimumCalls: 1, dynamicInteractionCalls: 'unknown-until-execution', maximumAdditionalInitialCalls: Math.floor(input.files.filter(f => f.eligibility === 'reviewable').length / 2), notice: '模型分组假设仅调度,额外综合动态且不保证预算或覆盖。' } : null;
|
|
21
|
+
const interactions = options.scope && options.grouping ? options.grouping.groups.filter(g => g.fileIds.length > 1).map(group => { const prepared = prepareInteractionInput(input, group, payload => initialInputBudget({ instructions: options.instructions, input: payload }, options.scope, options.maxInputBytes)); return { groupId: group.id, fileIds: prepared.fileIds, status: prepared.status, reason: prepared.reason, minimumCalls: prepared.status === 'ready' ? (options.enableRiskPlanning === true ? 2 : 1) : 0 }; }) : [];
|
|
22
|
+
const businessGrouping = options.enableBusinessGrouping === true && input.files.filter(f => f.eligibility === 'reviewable').length > 1 ? { minimumCalls: 1, dynamicInteractionCalls: 'unknown-until-execution', maximumAdditionalInitialCalls: Math.floor(input.files.filter(f => f.eligibility === 'reviewable').length / 2) * (options.enableRiskPlanning === true ? 2 : 1), notice: '模型分组假设仅调度,额外综合动态且不保证预算或覆盖。' } : null;
|
|
23
23
|
return { ...(businessGrouping ? { businessGrouping } : {}), interactions, snapshotId: input.id, maxInputBytes: options.maxInputBytes, items, minimumCalls: (businessGrouping?.minimumCalls ?? 0) + items.reduce((sum,item) => sum + item.minimumCalls, 0) + interactions.reduce((sum,item) => sum + item.minimumCalls, 0), initialRequestsOnly: true };
|
|
24
24
|
}
|
package/src/csharp-context.mjs
CHANGED
|
@@ -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
|
|
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
|
}
|
package/src/primary-input.mjs
CHANGED
|
@@ -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 = '
|
|
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 = {};
|