Archived
三面拆分④:驾驶舱首页 —— 度量改接 report 真八指标,纠正率/DMN 不再恒为 0
治理台原先调 memory 的五指标版,还把 submissions/corrections/judgements 硬塞 0 —— 仪表在说谎。八指标本就在 report 里算好,这里接上,与工作台汇报同源同口径。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -410,21 +410,27 @@ export function registerGovernanceOpsRoutes(app: Hono<AppEnv>, container: Contai
|
||||
* 度量仪表 —— 自主率与纠正率**成对读**,复合为有效自主率。
|
||||
* 只读近期任务的任务记忆聚合;度量本身不载权力。
|
||||
*/
|
||||
/*
|
||||
* 度量八指标 —— 走 report 模块的**全组织**投影(staffId 传 undefined)。
|
||||
*
|
||||
* 此前这里调的是 memory 的五指标版,且把 submissions / corrections /
|
||||
* judgements 四个入参硬塞 0 —— 纠正率与 DMN 覆盖率于是结构性恒为 0,
|
||||
* 仪表在说谎。八指标本就在 report 里算好(§report/contract.ts:「治理台记忆区的
|
||||
* 仪表读数,同源同口径」),这里只是把它接上,不另起一套口径。
|
||||
*/
|
||||
app.get(govMetricsRoute.path, async (c) => {
|
||||
const denied = await readMemory(c.get('account'));
|
||||
if (denied) return c.json(denied, denyStatus(denied));
|
||||
const parsed = govMetricsRoute.query.safeParse(c.req.query());
|
||||
if (!parsed.success) {
|
||||
const body: ApiError = { code: 'validation-failed', message: '统计窗口不合法', detail: parsed.error.issues };
|
||||
return c.json(body, 400);
|
||||
}
|
||||
const period = parsed.data.period ?? 'month';
|
||||
const { staff } = await container.org.listStaff();
|
||||
const nested = await Promise.all(staff.map((s) => container.task.listByOwner(s.id)));
|
||||
const taskIds = nested.flat().map((t) => t.id);
|
||||
const metrics = await container.memory.metrics({
|
||||
taskIds,
|
||||
submissions: 0,
|
||||
corrections: 0,
|
||||
taskCount: taskIds.length,
|
||||
deterministicJudgements: 0,
|
||||
totalJudgements: 0,
|
||||
});
|
||||
return c.json({ ...metrics, taskCount: taskIds.length });
|
||||
const metrics = await container.report.metrics(undefined, period);
|
||||
return c.json({ ...metrics, taskCount: nested.flat().length, period });
|
||||
});
|
||||
|
||||
/* ── 系统管理 · 通道实例 ────────────────────────────────────────── */
|
||||
|
||||
@@ -24,5 +24,11 @@
|
||||
- **口径挂归侧与事件流,零埋点**:输入只有归侧日志行与任务终态,没有第三种埋点
|
||||
- **自主率与纠正率成对读**,复合为有效自主率 —— 单看任一都会被优化坏
|
||||
- **单位成本的分母只认放行通过**:跑得多不等于产出多
|
||||
- 度量是**只读投影**,不设独立模块(§4 注);治理台记忆区与工作台汇报同源同口径
|
||||
- 度量是**只读投影**,不设独立模块(§4 注);治理台驾驶舱与工作台汇报同源同口径
|
||||
- 周期窗口左闭右开、**周一为首日**、按 UTC 切分(单组织单时区)
|
||||
|
||||
近变(2026-07-27):
|
||||
- 模块面**未变**。app 层的 `GET /api/gov/metrics`(运营驾驶舱)改接本模块的
|
||||
`metrics(undefined, period)` —— 此前它调 memory 的五指标版并把 submissions /
|
||||
corrections / judgements 硬塞 0,纠正率与 DMN 覆盖率结构性恒为 0。
|
||||
「治理台与工作台汇报同源同口径」这一条,从此在代码里也成立。
|
||||
|
||||
Reference in New Issue
Block a user