@feng0531/dsh-code-review 0.17.0 → 0.18.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 +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/defect-guidance.mjs +13 -0
- package/src/primary-input.mjs +2 -1
- package/src/verification-loop.mjs +2 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 当前状态
|
|
6
6
|
|
|
7
|
-
当前代码版本为 0.
|
|
7
|
+
当前代码版本为 0.18.0,包含有界覆盖预检、显式项目规则及候选证据与反证复核;发布状态以 npm 和 GitHub Release 为准。已通过真实临时 Git/SVN 仓库测试,以及隔离进程中的真实 DSH ToolRuntime 注册验证。当前开发会话的实际预览已返回0.6.0的plan/rules字段,空变更预览与默认关闭外发已验证;已进行经宿主审批的六次小规模真实试跑,累计12次模型调用;四组合成正负例与历史修复对照符合预期,历史引入方向检出候选但引用复核未完成(partial)。不是独立盲测或整体质量证明。详情见 [试跑结果](evaluation/PILOT-RESULTS.md)。
|
|
8
8
|
|
|
9
9
|
## 工作区下多个子仓库(0.11.0)
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Original defect checklists, not executable rules or proof of a defect.
|
|
2
|
+
const common = ['Only report a concrete defect with trigger, impact and changed-code evidence.', 'Check before/after behavior and counterexamples; absent context means uncertainty, not an invented contract.'];
|
|
3
|
+
const checklists = {
|
|
4
|
+
cpp: ['Check ownership, dangling references, double release and allocator/object lifetime across all exits.', 'Check stop publication, synchronization, join completion and remaining users before teardown; source order alone is not a happens-before proof.', 'Check exception/early-return resource cleanup, iterator invalidation, bounds, integer conversion and undefined behavior.', 'Do not assume macro expansion, overload binding, build flags or virtual dispatch targets without evidence.'],
|
|
5
|
+
csharp: ['Check IDisposable/async disposal, cancellation propagation and completion before releasing shared state.', 'Check nullability and actual runtime guards, event subscription lifetime, deferred enumeration and captured mutable state.', 'Check async exception observation, synchronization and thread-affinity; do not assume await establishes unrelated ordering.'],
|
|
6
|
+
javascript: ['Check null/undefined contract changes, promise rejection handling and missing await or cleanup on failure.', 'Check event/timer/listener lifecycle, closure state, cancellation races and concurrent updates.', 'Check untrusted input at injection/authentication boundaries; do not report style or infer TypeScript runtime checks.'],
|
|
7
|
+
configuration: ['Check changed configuration keys against consumer/schema evidence, type/unit/default mismatches and compatibility.', 'Check exposed secrets, privilege expansion and unsafe interpolation only with concrete supported evidence.']
|
|
8
|
+
};
|
|
9
|
+
export function defectGuidance(filePath) {
|
|
10
|
+
const lower = filePath.toLowerCase();
|
|
11
|
+
const language = /\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$/.test(lower) ? 'cpp' : lower.endsWith('.cs') ? 'csharp' : /\.(js|jsx|mjs|cjs|ts|tsx)$/.test(lower) ? 'javascript' : /\.(json|yaml|yml|toml|ini|xml|properties)$/.test(lower) ? 'configuration' : 'generic';
|
|
12
|
+
return { version:1, language, checks:[...common,...(checklists[language] ?? [])], notice:'Guidance is not evidence, a semantic parser, a style rule or permission to read outside the snapshot.' };
|
|
13
|
+
}
|
package/src/primary-input.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defectGuidance } from './defect-guidance.mjs';
|
|
1
2
|
import { cppCallSites } from './cpp-call-sites.mjs';
|
|
2
3
|
import { inferCsharpContext } from './csharp-context.mjs';
|
|
3
4
|
import { inferImportRelations } from './import-relations.mjs';
|
|
@@ -11,7 +12,7 @@ import { initialInputBudget } from './input-budget.mjs';
|
|
|
11
12
|
// Pure preparation over already captured data. No model calls or new reads.
|
|
12
13
|
export function preparePrimaryInput(input, file, { instructions, scope, grouping, maxInputBytes }) {
|
|
13
14
|
const changes = changeMap(file.left.text, file.right.text);
|
|
14
|
-
const base = { snapshotId: input.id, file, changes, context: input.context ?? [], rules: input.rules ?? [] };
|
|
15
|
+
const base = { defectGuidance: defectGuidance(file.path), snapshotId: input.id, file, changes, context: input.context ?? [], rules: input.rules ?? [] };
|
|
15
16
|
const contextRelations = inferContextRelations(input, file);
|
|
16
17
|
if (contextRelations.length) {
|
|
17
18
|
base.contextRelations = contextRelations;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defectGuidance } from './defect-guidance.mjs';
|
|
1
2
|
import { createEvidenceReceipts } from './evidence-receipts.mjs';
|
|
2
3
|
import { retrievalLoop } from './retrieval-loop.mjs';
|
|
3
4
|
import { validateCandidateVerification } from './candidate-verification.mjs';
|
|
@@ -13,7 +14,7 @@ export async function verificationLoop(model, request, candidates, scope, option
|
|
|
13
14
|
if (!candidates.length) return [];
|
|
14
15
|
const ids = candidates.map((_, i) => 'c' + (i + 1));
|
|
15
16
|
const rules = request.input ? (JSON.parse(request.input).rules ?? []) : [];
|
|
16
|
-
const input = JSON.stringify({ rules, candidates: candidates.map((finding, i) => ({ candidateId: ids[i], finding })) });
|
|
17
|
+
const input = JSON.stringify({ defectGuidance: [...new Set(candidates.map(f => scope.catalog().find(s => s.fileId === f.fileId)?.path).filter(Boolean))].map(defectGuidance), rules, candidates: candidates.map((finding, i) => ({ candidateId: ids[i], finding })) });
|
|
17
18
|
const receipts = createEvidenceReceipts(scope.read);
|
|
18
19
|
const retrievalScope = { ...scope, read: receipts.read };
|
|
19
20
|
const response = await retrievalLoop(model, { ...request, input, instructions: VERIFICATION_INSTRUCTIONS }, retrievalScope, options);
|