Remove untraceable driftCount from approval-runs export (#112)

`approval-runs export` returned a bare audit-drift counter with no way to
trace it back to a document: no sourceDocumentSN, no recordId, no reason.
Interpreting it required a separate per-document `approval-runs flow`
query, and the word "drift" alone suggested the tool or the approval flow
was broken rather than a snapshot/lifecycle difference.

The drift itself is already visible in the workbook row: AI 决策「通过」
next to 人工审核「已取消」 and E人工行为「已撤回」, with the retraction
recorded in the standard formatted E人工意见 column. The aggregate carried
no information those columns do not.

`seal_approval_runs_export` never enabled flow alignment, so for MCP
consumers the field was a constant 0.

Rather than enriching the field, remove it. Per-run auditDrift and
auditDriftReason in `approval-runs flow` are unchanged.
This commit is contained in:
gitea committed 2026-09-15 15:00:00 +08:00
1 parent a8a30f6065
commit 82d0d97efb
3 files changed
+6 -4

No files matched your search

+3
View File
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- **Approval Runs Export No Longer Emits `driftCount`** (#112): `approval-runs export` returned a bare audit-drift counter with no way to trace it back to a document — no SN, no `recordId`, no reason — so interpreting it required a separate per-document `approval-runs flow` query. The drift itself is already visible in the workbook's `E人工行为` / `E人工意见` columns (e.g. AI 决策「通过」with E人工行为「已撤回」and a formatted retraction opinion), and `seal_approval_runs_export` never enabled the flow alignment, so the field was a constant `0` there. Removed `driftCount` from the export result rather than enriching it; per-run `auditDrift` / `auditDriftReason` in `approval-runs flow` are unchanged.
## [0.10.24] - 2026-09-15
### Added & Enhanced
@@ -354,6 +354,9 @@ describe("exportApprovalRunsToExcel integration", () => {
});
expect(result.recordCount).toBe(1);
// Audit drift is deliberately not aggregated here: a bare count cannot be traced back to a
// record, while the drift itself is already visible in the E人工行为 / E人工意见 columns.
expect("driftCount" in result).toBe(false);
const wb = new ExcelJS.Workbook();
await wb.xlsx.readFile(tmpOut);
const ws = wb.worksheets[0]!;
-4
View File
@@ -46,7 +46,6 @@ export interface ApprovalRunsExportResult {
rejectReasonCount: number;
fileSizeBytes: number;
exportedAt: string;
driftCount?: number;
excludedDeletedCount?: number;
excludedSimulationCount?: number;
}
@@ -645,7 +644,6 @@ export async function exportApprovalRunsToExcel(
const statusCounts: Record<string, number> = {};
let rejectReasonCount = 0;
let driftCount = 0;
// 3.5 如果是合思租户且显式启用 withFlow(--with-flow),获取原生审批流并对齐 E人工行为 / E人工意见
const alignmentsByRecordId = new Map<string, HoseRunAlignment>();
@@ -696,7 +694,6 @@ export async function exportApprovalRunsToExcel(
const aligned = alignApprovalRunsWithHoseFlow(runsForDoc, flow);
for (const [recordId, align] of aligned.entries()) {
alignmentsByRecordId.set(recordId, align);
if (align.auditDrift) driftCount++;
}
} catch (err: any) {
console.error(`⚠️ 拉取单据 ${displaySN} 审批流失败: ${err.message},使用降级对齐。`);
@@ -1043,7 +1040,6 @@ export async function exportApprovalRunsToExcel(
rejectReasonCount,
fileSizeBytes: stat.size,
exportedAt: new Date().toISOString(),
driftCount,
excludedDeletedCount,
excludedSimulationCount
};