画图不检查,激活才查完整 —— 保存 bug 的根治 + 异常看板
你存不了图的根因:保存跑闭合校验,而画图必然经过不完整的中间态
(节点没接完边、活动没安装)—— 画到一半就 412 卡死。实测同一份图:
改前 412 拒存;改后存为未生效的新版,报告随行。
## 模型改成三段
画图 = 只创建节点和边,图上真正生效可编辑的只有**名字**(双击不再出岗位一栏;
边上的字是辅助阅读的注记;岗位/判据/映射这些**闭环要素在节点属性里决定**;
分配到人是运营的事,设计侧不碰)
保存 = 不检查、不生效:恒存为新版本号,谁也伤不着 —— 因此不设确认卡,直接存;
任何版本都可编辑(在旧版上改 = 以旧版为底另起一版)
激活 = 完整性闸:不闭合 412 拦下并点名缺什么;过了即独占生效
## 异常看板(左,与版本卡同列同风)
画图不拦,看板替你盯着:逐条列这一版缺什么,**点一条定位到那个节点的属性**;
零异常时给空占位说「可以激活」。版本行的「激活」按钮按闭合灰显 ——
不闭合点不了,亮了才能上线。实测:v4 两条异常全列出、激活灰;闭合的 v2/v1 亮。
## 顺手修一个画布盲区
packageToGraph 以手绘存证为呈现真相,**语义里有、存证里没有的节点画布看不见**:
异常看板指着一个图上不存在的节点,点了也定位不到(实测:API 直存的包新增节点后
picker 里根本没有它)。补画:缺席节点按 60px 一档排在图纸下缘 —— 位置丑没关系,
看得见才能修。实测点异常 → 选中 A8 → 五张属性小卡弹出。
## 布局照你定的
row2 = 异常看板(1/3,与版本卡对齐)+ 节点属性卡(2/3,与流程图同宽);
属性卡内部小卡**等高 250px**,输入/输出超高的内容自己滚(实测五张全 250)。
种子改为保存后显式激活;NotClosedError 文案「不得保存」→「不得激活」。
typecheck ✓ lint ✓ depcruise ✓ 498 测试 ✓
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -276,19 +276,11 @@ export function registerGovernanceOpsRoutes(app: Hono<AppEnv>, container: Contai
|
||||
return c.json(body, 400);
|
||||
}
|
||||
/*
|
||||
* **严格检查 + 保存即生效**:不闭合拒存(412 带报告),存下来的就能起单。
|
||||
* 版本号由用例层算(恒新增),这里不采信入参的 version —— 它只说明「改的是哪一版」。
|
||||
* 保存**不检查、不生效**:画图的中间态天然不完整,存下来是未生效的新版本。
|
||||
* 返回连同闭合报告 —— 异常看板据它列清单;完整性闸在激活路由。
|
||||
*/
|
||||
try {
|
||||
const pkg = await container.process.savePackage(parsed.data.pkg);
|
||||
return c.json({ pkg, report: await container.process.validate(pkg) });
|
||||
} catch (error) {
|
||||
if (error instanceof NotClosedError) {
|
||||
const body: ApiError = { code: 'precondition-failed', message: error.message, detail: error.report };
|
||||
return c.json(body, 412);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
const pkg = await container.process.savePackage(parsed.data.pkg);
|
||||
return c.json({ pkg, report: await container.process.validate(pkg) });
|
||||
});
|
||||
|
||||
/** 版本启停:激活即独占,停用即下线 —— 在途按启动版本跑完,零影响 */
|
||||
@@ -300,12 +292,21 @@ export function registerGovernanceOpsRoutes(app: Hono<AppEnv>, container: Contai
|
||||
const body: ApiError = { code: 'validation-failed', message: '启停状态不合协议' };
|
||||
return c.json(body, 400);
|
||||
}
|
||||
const packages = await container.process.setPackageState(
|
||||
c.req.param('id'),
|
||||
Number(c.req.param('version')),
|
||||
parsed.data.state,
|
||||
);
|
||||
return c.json({ packages });
|
||||
try {
|
||||
const packages = await container.process.setPackageState(
|
||||
c.req.param('id'),
|
||||
Number(c.req.param('version')),
|
||||
parsed.data.state,
|
||||
);
|
||||
return c.json({ packages });
|
||||
} catch (error) {
|
||||
// 不闭合不得激活 —— 412 带整份报告,前端异常看板直接用
|
||||
if (error instanceof NotClosedError) {
|
||||
const body: ApiError = { code: 'precondition-failed', message: error.message, detail: error.report };
|
||||
return c.json(body, 412);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
/** 画图即校验 —— 与前端画布同源 */
|
||||
|
||||
@@ -455,10 +455,12 @@ export async function seedMvpFlow(container: Container): Promise<void> {
|
||||
if (current !== undefined && stripped(current) === stripped(MVP_PACKAGE)) {
|
||||
log(`④ 流程包「统一报价」v${current.version} 已在库,内容未变 —— 不存新版`);
|
||||
} else {
|
||||
// 保存不生效 —— 激活才是上线闸(不闭合在这一步被拦,种子包若不闭合要吵出来)
|
||||
const saved = await container.process.savePackage(MVP_PACKAGE);
|
||||
await container.process.setPackageState(saved.id, saved.version, 'active');
|
||||
log(
|
||||
`④ 流程包「统一报价」v${saved.version} 已保存生效 —— ${saved.nodes.length} 节点,` +
|
||||
`闭合校验通过(不闭合会拒存)${current === undefined ? '' : `;旧版 v${current.version} 原样留着,在途任务照它跑完`}`,
|
||||
`④ 流程包「统一报价」v${saved.version} 已保存并激活 —— ${saved.nodes.length} 节点,` +
|
||||
`闭合校验过(不闭合不得激活)${current === undefined ? '' : `;旧版 v${current.version} 原样留着,在途任务照它跑完`}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user