@feng0531/dsh-code-review 0.33.2 → 0.33.4
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 +11 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/primary-input.mjs +3 -1
- package/src/review.mjs +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
# 变更记录
|
|
2
2
|
|
|
3
|
+
## 0.33.4
|
|
4
|
+
|
|
5
|
+
- 文件失败保留明确MODEL_INVALID_JSON/MODEL_TIMEOUT错误码;取消为CANCELLED,其余未知错误为REVIEW_EXECUTION_FAILED,不猜测根因、不重试。
|
|
6
|
+
- 报告selection保留total/reviewable/excluded/blocked分母;零选择、全排除或全阻塞返回partial及未执行限制,不冒充完整通过。327离线测试通过,候选待远端发布门禁。
|
|
7
|
+
|
|
8
|
+
## 0.33.3
|
|
9
|
+
|
|
10
|
+
- 超预算主审切为精确窗口时,上下文正文留在原批准快照按需read;初始输入仅带版本侧catalog,避免上下文重复导致所有窗口持续超限。不扩大读取范围,不裁剪证据;报告明确未声明全部上下文核查。
|
|
11
|
+
- 当前/历史旧侧隔离、无scope仍阻断、预览执行预算一致、超时等适配器清理且窗口pending验收通过;320离线及真实宿主离线smoke、固定标签四矩阵及唯一发布通过;npm/Release原工件88999字节双hash一致。不宣称用户碰撞审查已恢复或超时根因已定位。
|
|
12
|
+
|
|
3
13
|
## 0.33.2
|
|
4
14
|
|
|
5
15
|
- 接受唯一完整JSON的单一json/无语言Markdown围栏,不提取任意说明中的JSON、不修正文法/字段、不重试;后续原schema及证据校验不变。
|
|
6
|
-
- 不完整JSON返回MODEL_INVALID_JSON及字节/封装类型诊断,不泄露响应正文。317
|
|
16
|
+
- 不完整JSON返回MODEL_INVALID_JSON及字节/封装类型诊断,不泄露响应正文。317离线测试及固定四矩阵/唯一发布通过,npm/Release原工件88609字节双hash匹配。实际碰撞审查原始响应未知,不能宣称复现其三处根因;超时与大文件范围缺口仍待定位。
|
|
7
17
|
|
|
8
18
|
## 0.33.1
|
|
9
19
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 当前状态
|
|
6
6
|
|
|
7
|
-
当前正式版本为 0.33.
|
|
7
|
+
当前正式版本为 0.33.3(固定标签四矩阵及npm/Release原工件字节双hash门禁通过)。JSON围栏兼容与有界窗口上下文已交付;实际项目审查效果仍需原报告和新预览执行验证。
|
|
8
8
|
|
|
9
9
|
Git历史预览新增oldContextPaths:最多20个显式仓库相对文件,与contextPaths/自动上下文共享20槽、256KiB每blob及4MiB快照。仅从baseline普通Git blob捕获,不checkout/fetch/读取工作树;根提交无baseline拒绝,working/SVN明确拒绝。旧侧条目携带oldRevision/oldBlobOid/oldHash,仅进入context-old;oldOnly表示仅批准旧侧,不证明target路径不存在。所选变更复用原changed-old,不重复上下文;excluded/blocked变更、链接/submodule、凭据路径不能重新进入。预览显示身份元数据、不显示正文,确认执行才按宿主正常权限发送。主审/综合/复核按侧提示,计入原输入预算,旧证据不能冒充新侧回归证明。
|
|
10
10
|
|
package/package.json
CHANGED
package/src/primary-input.mjs
CHANGED
|
@@ -46,7 +46,9 @@ export function preparePrimaryInput(input, file, { instructions, scope, grouping
|
|
|
46
46
|
const windows = changeWindows(file, changes);
|
|
47
47
|
if (windows) {
|
|
48
48
|
const compactFile = { ...file, left: { ...file.left, text: undefined }, right: { ...file.right, text: undefined } };
|
|
49
|
-
const
|
|
49
|
+
const contextCatalog = scope.catalog().filter(source => ['context', 'context-old'].includes(source.side));
|
|
50
|
+
if (contextCatalog.length) metadata.contextMode = 'approved-retrieval';
|
|
51
|
+
const compact = JSON.stringify({ ...base, context: [], contextCatalog, contextMode: 'approved-retrieval', contextNotice: '上下文全文仍在同一批准快照,仅目录进入窗口初始输入;必须按sourceId和版本侧read原文,不把目录视为证据或完整覆盖。', file: compactFile, windows, sourceMode: 'change-windows', windowNotice: '仅提供全部精确hunk窗口,start/count为原始源码行号,不得重编号。完整源码未随初始输入发送,可在catalog批准范围内检索;缺少上下文时说明限制。' });
|
|
50
52
|
if (!measure(compact).fits) {
|
|
51
53
|
const envelope = JSON.parse(compact);
|
|
52
54
|
const plan = planWindowBatches(windows, subset => JSON.stringify({ ...envelope, windows: subset, windowNotice: '本批仅审查windows包含的编辑,其他hunk另批;行号为原始行号,跨片段上下文不足说明限制。' }), measure);
|
package/src/review.mjs
CHANGED
|
@@ -61,7 +61,7 @@ async function invoke(model, request, timeoutMs, parentSignal) {
|
|
|
61
61
|
const abort = () => controller.abort(parentSignal.reason);
|
|
62
62
|
parentSignal?.addEventListener('abort', abort, { once: true });
|
|
63
63
|
if (parentSignal?.aborted) abort();
|
|
64
|
-
const timer = setTimeout(() => controller.abort(new Error('Model timeout')), timeoutMs);
|
|
64
|
+
const timer = setTimeout(() => controller.abort(Object.assign(new Error('Model timeout'), { code: 'MODEL_TIMEOUT' })), timeoutMs);
|
|
65
65
|
try {
|
|
66
66
|
controller.signal.throwIfAborted();
|
|
67
67
|
// Executors must honor cancellation; never release ownership before cleanup settles.
|
|
@@ -117,6 +117,7 @@ export async function reviewSnapshot(snapshot, model, options = {}) {
|
|
|
117
117
|
const prepared = preparePrimaryInput(input, file, { instructions: REVIEW_INSTRUCTIONS, scope, grouping: report.grouping, maxInputBytes });
|
|
118
118
|
const { changes, payload } = prepared;
|
|
119
119
|
Object.assign(state, prepared.metadata);
|
|
120
|
+
if (state.contextMode === 'approved-retrieval') report.limitations.push({ fileId: file.id, text: '窗口初始输入仅带上下文身份目录,全文须按需读取;不声明所有上下文已核查。' });
|
|
120
121
|
if (prepared.synthesis) state.synthesisStatus = prepared.synthesis.budget.fits ? 'pending' : 'blocked';
|
|
121
122
|
if (prepared.synthesis && !prepared.synthesis.budget.fits) report.limitations.push({ fileId: file.id, text: '跨窗口综合输入超限,未发送;单窗口完成不表示交互影响已检查' });
|
|
122
123
|
if (state.sourceMode === 'change-windows') state.windowCoverage = { completed: [], pending: [...state.windowIds] };
|
|
@@ -246,10 +247,14 @@ export async function reviewSnapshot(snapshot, model, options = {}) {
|
|
|
246
247
|
} catch (error) {
|
|
247
248
|
state.status = signal?.aborted ? 'cancelled' : 'failed';
|
|
248
249
|
state.reason = error?.message ?? String(error);
|
|
250
|
+
state.failureCode = signal?.aborted ? 'CANCELLED' : ['MODEL_INVALID_JSON','MODEL_TIMEOUT'].includes(error?.code) ? error.code : 'REVIEW_EXECUTION_FAILED';
|
|
249
251
|
}
|
|
250
252
|
}
|
|
251
253
|
for (const interaction of report.interactions) if (interaction.status !== 'completed') report.limitations.push({ text: '跨文件综合未完成:' + interaction.groupId + ' (' + interaction.status + ')' });
|
|
252
254
|
if (report.grouping?.links.some(l => l.split)) report.limitations.push({ text: '跨组关系未综合覆盖;关联分组不代表全部跨文件交互覆盖' });
|
|
255
|
+
const reviewableCount = input.files.filter(f => f.eligibility === 'reviewable').length;
|
|
256
|
+
report.selection = { total: input.files.length, reviewable: reviewableCount, excluded: input.files.filter(f => f.eligibility === 'excluded').length, blocked: input.files.filter(f => f.eligibility === 'blocked').length };
|
|
257
|
+
if (!reviewableCount) report.limitations.push({ text: input.files.length ? '没有可审查文件;排除或阻塞不表示代码审核通过。' : '未选择变更文件,没有执行代码审核。' });
|
|
253
258
|
const unfinished = report.files.some(f => !['completed', 'excluded'].includes(f.status));
|
|
254
259
|
report.status = signal?.aborted ? 'cancelled' : unfinished || report.limitations.length ? 'partial' : 'completed';
|
|
255
260
|
if (report.files.some(f => f.status === 'failed') && !report.files.some(f => f.status === 'completed')) report.status = signal?.aborted ? 'cancelled' : 'failed';
|