@feng0531/dsh-code-review 0.86.1 → 0.87.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 +9 -0
- package/CORE-ALIGNMENT-TASKS.md +17 -3
- package/CORE-SOURCE-INVENTORY.md +6 -6
- package/DEVELOPMENT.md +15 -1
- package/README.md +20 -3
- package/RELEASE-NOTES.md +15 -11
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/src/candidate-verification.mjs +1 -1
- package/src/coverage-plan.mjs +20 -6
- package/src/cpp-migration-bindings.mjs +149 -0
- package/src/evidence-context.mjs +96 -0
- package/src/group-interaction.mjs +48 -0
- package/src/group-primary.mjs +14 -3
- package/src/interaction-risk.mjs +71 -0
- package/src/migration-contracts.mjs +160 -0
- package/src/migration-regression.mjs +103 -0
- package/src/model-contract.mjs +3 -3
- package/src/model-tools.mjs +6 -4
- package/src/prompts.mjs +1 -0
- package/src/regression-assessment.mjs +8 -2
- package/src/report-summary.mjs +59 -0
- package/src/retrieval-loop.mjs +16 -3
- package/src/review-reader-allocation.mjs +46 -4
- package/src/review-resume.mjs +67 -2
- package/src/review-stage-state.mjs +143 -0
- package/src/review.mjs +169 -42
- package/src/service.mjs +7 -7
- package/src/stage-continuation.mjs +74 -0
- package/src/verification-loop.mjs +9 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { prepareMigrationRegression, migrationRegressionMetadata } from './migration-regression.mjs';
|
|
2
|
+
import { VERIFICATION_INSTRUCTIONS, MIGRATION_VERIFICATION_INSTRUCTIONS } from './prompts.mjs';
|
|
2
3
|
import { CONTEXT_SIDE_NOTICE } from './context-identity.mjs';
|
|
3
4
|
import { defectGuidance } from './defect-guidance.mjs';
|
|
4
5
|
import { modelWireBudget } from './model-wire-budget.mjs';
|
|
@@ -15,13 +16,17 @@ export { VERIFICATION_INSTRUCTIONS };
|
|
|
15
16
|
export async function verificationLoop(model, request, candidates, scope, options = {}) {
|
|
16
17
|
request.signal?.throwIfAborted();
|
|
17
18
|
if (!Array.isArray(candidates) || candidates.length > 50) throw new Error('Invalid candidates');
|
|
19
|
+
if (options.enableMigrationRegression !== undefined && typeof options.enableMigrationRegression !== 'boolean') throw new Error('Invalid migration regression policy');
|
|
18
20
|
if (!candidates.length) return [];
|
|
19
21
|
const ids = candidates.map((_, i) => 'c' + (i + 1));
|
|
20
22
|
const envelope = request.input ? JSON.parse(request.input) : {};
|
|
21
23
|
const rules = envelope.rules ?? [];
|
|
22
|
-
const
|
|
24
|
+
const project = options.migrationSnapshot?.projectScope || options.migrationSnapshot?.files?.some(file => file.reviewMode === 'project') || envelope.file?.reviewMode === 'project';
|
|
25
|
+
if (options.enableMigrationRegression === true && !project && options.migrationContracts?.length && options.migrationSnapshot?.id !== envelope.snapshotId) throw new Error('Migration verification snapshot mismatch');
|
|
26
|
+
const migrationContext = options.enableMigrationRegression === true && !project && options.migrationContracts?.length ? prepareMigrationRegression(options.migrationSnapshot, scope, options.migrationContracts, candidates) : undefined;
|
|
27
|
+
const input = JSON.stringify({ ...(envelope.snapshotId ? { snapshotId: envelope.snapshotId } : {}), ...(migrationContext ? { migrationContracts: migrationRegressionMetadata(migrationContext) } : {}), contextSideNotice:CONTEXT_SIDE_NOTICE, ...(envelope.businessRequirement!==undefined?{businessRequirement:envelope.businessRequirement,requirementNotice:envelope.requirementNotice}:{}), defectGuidance: [...new Set(candidates.map(f => scope.catalog().find(s => s.fileId === f.fileId)?.path).filter(Boolean))].map(path => envelope.file?.path === path && envelope.defectGuidance ? envelope.defectGuidance : envelope.files?.find(f=>f.path===path)?.defectGuidance ?? defectGuidance(path)), rules, candidates: candidates.map((finding, i) => ({ candidateId: ids[i], finding })) });
|
|
23
28
|
const seedReceipts = new Map();
|
|
24
|
-
const verificationRequest = { ...request, input, instructions:envelope.file?.reviewMode==='project'?VERIFICATION_INSTRUCTIONS+' 本次为当前项目源码审查,空old只是传输占位,不是历史版本。不要要求回归因果;regression.classification用uncertain并说明不适用,仅凭new侧原文核实当前缺陷和反证。':VERIFICATION_INSTRUCTIONS };
|
|
29
|
+
const verificationRequest = { ...request, input, instructions:envelope.file?.reviewMode==='project'?VERIFICATION_INSTRUCTIONS+' 本次为当前项目源码审查,空old只是传输占位,不是历史版本。不要要求回归因果;regression.classification用uncertain并说明不适用,仅凭new侧原文核实当前缺陷和反证。':VERIFICATION_INSTRUCTIONS + (migrationContext ? ' ' + MIGRATION_VERIFICATION_INSTRUCTIONS : '') };
|
|
25
30
|
// Explicit final-only mode has extra finalization metadata/instructions and
|
|
26
31
|
// permits no retrieval rounds. Do not spend its budget on optional prefetch.
|
|
27
32
|
const initialRetrieved = options.maxRounds === 0 ? [] : verificationSeeds(candidates, scope, {
|
|
@@ -39,5 +44,5 @@ export async function verificationLoop(model, request, candidates, scope, option
|
|
|
39
44
|
// read under this invocation's receipt table and the shared approved budget.
|
|
40
45
|
const response = await retrievalLoop(model, verificationRequest, retrievalScope, { ...options, initialRetrieved });
|
|
41
46
|
request.signal?.throwIfAborted();
|
|
42
|
-
return validateCandidateVerification(response, ids, scope.read, resolveEvidence, { catalog: scope.catalog(), fileIds: Object.fromEntries(ids.map((id, i) => [id, candidates[i].fileId])) });
|
|
47
|
+
return validateCandidateVerification(response, ids, scope.read, resolveEvidence, { enableMigrationRegression: options.enableMigrationRegression === true && !project, migrationContext, catalog: scope.catalog(), fileIds: Object.fromEntries(ids.map((id, i) => [id, candidates[i].fileId])) });
|
|
43
48
|
}
|