🐛 Preserve the current review target when resident focus races a new edit
Some checks failed
web-ci / checks (push) Has been cancelled
web-ci / checks (pull_request) Has been cancelled

This commit is contained in:
d-robotics 2026-10-22 01:34:26 +08:00
parent badabafb3b
commit 69cdbb5ad7
4 changed files with 72 additions and 2 deletions

View File

@ -5,7 +5,7 @@
## 范围与顺序
1. 在独立工作树验证 API/处理器、Worker、独立 package 镜像,保存源码、基础镜像、产物字节与 digest 的对应证据。API/处理器使用 `scripts/release.py`;Worker、字典和工作流切换另附有界计划。
2. 在 v4 尚未激活时,按发布工具先处理器后 API;随后将 Worker 暂停至 0 副本并确认旧扫描进程退出。现有独立算子 Job 不删除,调度及状态收敛暂时停顿。完成字典和工作流切换后更新兼容新旧协议的 Worker 镜像与构建标记,恢复原来的 2 副本,再开始新版本接入。不更新 Coordinator、validator、Secret、资源规格或存储配置。
2. 在 v4 尚未激活时,按发布工具先处理器后 API;随后更新兼容新旧协议的 Worker 镜像与构建标记,确认原来的 2 副本完整就绪且所有工作流仍使用旧协议。再将 Worker 暂停至 0 副本并确认扫描进程退出,完成字典和工作流切换后恢复同一已验证镜像的 2 副本。现有独立算子 Job 不删除,暂停期间调度及状态收敛暂时停顿。不更新 Coordinator、validator、Secret、资源规格或存储配置。
3. 按预览清单为当前无 tags 的启用词条初始化 `tags=[名称]`,递增版本并追加历史。逐条比较原版本、名称、状态、更新时间与标签;发现漂移停止,不覆盖管理员的新修改。此步骤不更新任务、草稿或已冻结字典选择。
4. 对每个目标项目创建隐藏的新工作流版本,仅修改 package 的固定镜像、`PART_INDEX_DELIVERY=true`、`DELIVERY_JSON_V4=true`、`DELIVERY_JSON_V3=false`、`SOURCE_INDEX_DELIVERY=true`、`PIN_OPERATOR_IMAGE=true`,并添加内部 JSON 输出 `deliveryAudit`。保留原节点、边、输入、供应商、接入目录、并发和验收抽样策略;逐项比较允许变更以外的内容。
5. 检查内置 artifact 存储与客户目录隔离、完整的每 part 原始选择及 meta、分类标签、两相机时钟和验收固定修订。全舍弃、无描述继承、无效动作及独立动作词条均须有验证证据。

View File

@ -37,3 +37,9 @@ v4 默认关闭不等于旧版本写入安全:新字段开始保存后,旧 A
独立 package 镜像已由 `8f6b531f` 实际构建、核对镜像内源码并上传 Fanyu 仓库,摘要为 `sha256:dc22ee3b77f00a8e27aa4d4cf11b1b225e8b8d476b8dd3429d43c4d73396ca1d`。仅更新 package 的真实发布记录及生成清单,保留 POC 历史镜像记录。独立发布使用 `OPERATOR_RELEASE_ENV=fanyu python3 scripts/generate_operator_repository_manifests.py --slug package --check`,仍强制验证所选算子的实际源码树和镜像摘要;默认不带选择的全量检查继续保留,不能据此声称全库清单通过。未修改、未发布 annotation_gate,其已有清单漂移仍保留为独立遗留项;本次工作流固定新 package digest,不依赖重写全局算子目录来替换旧任务镜像。
切换修复保留已启动采集及父子 Run 的原归属,恢复隐藏版本上未启动登记的迁移,保留原 ID,并在未知启动结果时阻断激活。未知启动结果须先停扫描、核查原归属并单独恢复,不能按记录年龄自动重复创建 Run。新 v4 接入前验证完整八类原始文件,包括 meta;布尔开关与打包器、内部审核保存使用一致口径。详情见启用核对表,实际部署仍须具体计划授权。
## 启用前审核输入回归
正式发布门禁发现保存后立即编辑下一条意见的竞态:模型已切到切片编辑器,但 React 尚未提交新 DOM 时,常驻输入框的旧动作聚焦回调会重新选择动作,将新切片文字提前暂存并打开空动作编辑器。常驻输入框改用控制器的 `editSelected()` 读取当前目标,避免使用渲染时捕获的旧作用域。
真实组件浏览器回归控制聚焦回调在 React 提交前执行,同时验证切片、来源和文字保留、没有额外 PUT。旧实现的质检与验收两项均稳定失败,修复后全套 36 项通过;临时诊断代码已清理。原始发布失败、受控失败和成功证据分别保存在启用证据目录,不以重试到成功替代问题修复。五角色线上登录与自身身份预检已通过;该结果不是候选上线后的业务验收。

View File

@ -214,7 +214,7 @@ export function ReviewProblemPanel({
value={resident.text}
readOnly
rows={3}
onFocus={() => review.selectScope(resident.scope, true)}
onFocus={() => review.editSelected()}
placeholder="填写问题与修改要求"
className="w-full resize-y rounded border bg-transparent p-2 text-sm"
/>

View File

@ -142,6 +142,70 @@ try {
assert.equal(await page.evaluate(() => window.review.confirmations[0].note.trim()), "still an issue");
assert.equal(await page.evaluate(() => window.review.dirty), false);
report.cases.push("server-trimmed notes do not leave a permanent dirty state");
await begin("saved before resident focus");
assert.equal(await page.evaluate(() => window.review.save()), true);
await page.waitForFunction(() => !window.review.editor && window.review.selectedScope === "action");
const writesBeforeResidentFocus = report.writes.length;
const residentBeforeCommit = await page.evaluate(() => {
const input = window.review.inputRef.current;
if (!input?.readOnly) throw new Error("expected the resident action textarea before the next edit");
input.blur();
const resident = { scope: window.review.selectedScope, readOnly: input.readOnly };
const requestFrame = window.requestAnimationFrame;
const cancelFrame = window.cancelAnimationFrame;
const callbacks = new Map();
// Deliver the hook's real focus callback while the previous resident DOM
// is still mounted, before React commits the new slice editor.
window.requestAnimationFrame = (callback) => {
const id = requestFrame.call(window, (time) => {
callbacks.delete(id);
callback(time);
});
callbacks.set(id, callback);
return id;
};
window.cancelAnimationFrame = (id) => {
callbacks.delete(id);
cancelFrame.call(window, id);
};
try {
window.review.beginProblem(window.positionFor("left"), "slice");
window.review.setText("slice text survives resident focus");
const scheduled = [...callbacks];
if (scheduled.length !== 1) throw new Error("expected exactly one scheduled editor focus");
const [id, callback] = scheduled[0];
cancelFrame.call(window, id);
callbacks.delete(id);
callback(performance.now());
return resident;
} finally {
window.requestAnimationFrame = requestFrame;
window.cancelAnimationFrame = cancelFrame;
}
});
assert.deepEqual(residentBeforeCommit, { scope: "action", readOnly: true });
await page.waitForFunction(() => window.review.editor);
assert.deepEqual(
await page.evaluate(() => {
const { scope, text, sliceId, sourceItemId = "" } = window.review.editor;
return { scope, text, sliceId, sourceItemId };
}),
{
scope: "slice",
text: "slice text survives resident focus",
sliceId: cfg.role === "acceptance" ? "same" : "left",
sourceItemId: cfg.role === "acceptance" ? "source-a" : "",
},
"resident focus before React commit must preserve the new slice editor and source",
);
assert.equal(
await page.getByRole("textbox", { name: "审查问题说明" }).inputValue(),
"slice text survives resident focus",
);
assert.equal(report.writes.length, writesBeforeResidentFocus, "resident focus must not park a background write");
await page.evaluate(() => window.review.guardDiscard());
await page.waitForFunction(() => !window.review.dirty && !window.review.editor);
report.cases.push("resident focus before React commit preserves slice text and source without background writes");
for (const recovery of ["manual", "generation"]) {
const baseline = await page.evaluate(() => window.review.currentDraft().confirmations[0]);
await page.evaluate(() => window.review.setConfirmation("prior", true));