Commit Graph
5 Commits
Author SHA1 Message Date
yunyingk c572cba842 fix(approval-runs): 传输层失败不再被误判为业务结论
`sealApprovalRunFlowGet` 用两次"请求被拒"充当路由信号:记录查询被拒,就
认为入参是单号;运行记录列表被拒,就认为该单据没有 AI 记录。两处都写成
裸 `catch {}`,于是所有失败都被吸收进这两个业务结论。

后果不是偶尔不准,而是以十足的语气给出错误答案:token 过期、连接重置、
网关 5xx 会被渲染成「单据已删除」或「AI 从未审核」,用户没有任何线索去
怀疑刚才那次请求其实失败了;退出码同时失去语义,本该由 classifyCliError
产出 11(认证/上游失败),实际退化成一次"成功的查询"。

现在只有标识符形态的拒绝才计为未命中:HTTP 400/404/422,或响应体确实
到达但不是一条审批记录。认证失败、5xx、限流、以及根本没有响应的传输
错误一律原样上抛。

- errors:导出既有的 `responseStatus` 结构读取器,让调用方能区分"没有
  响应"与"收到了 400/404 响应"。
- approval-runs:新增 `isUpstreamLookupMiss`,替换两处裸 catch。
- test:新增四个回归用例(401/403/503/连接失败),断言原始错误对象抵达
  调用方;另加一条非合思租户的守卫用例。
2026-11-10 19:47:48 +08:00
gitea 50e4e492b4 Fix architecture review findings and align CLI metadata 2026-10-17 20:17:06 +08:00
gitea 586ad521dc Harden post-write error codes, rules push recovery ledger, and capability param normalization 2026-10-13 11:48:37 +08:00
gitea 66eb81f3d1 Add exit codes 13 and 14 for config validation and safety blocks
The classifier only matched English usage wording, so every Chinese-language
usage error, every enterprise-selection failure, and every Zod/SyntaxError
fell through to exit 1 ("upstream failure"), while environment safety guards
were reported as exit 2 or 1. Add two semantic codes:

- 13 (validationError): well-formed command, unusable value — missing --corp,
  unparseable enterprise JSON, missing required parameter, ambiguous webhook
  channel selection.
- 14 (safetyBlocked): the target environment forbids the action — replaying
  into production, regression outside a test tenant.

classifyCliError now recognises Chinese usage wording, enterprise-selection
phrasing, local file problems, Zod issue lists (structural, not textual) and
SyntaxError; English Usage:/Unknown-command stays 2, domain failures and
quality gates stay 1. Docs (AGENTS, cli-protocol, skill cli.md) and the exit
code assertions follow.
2026-09-29 22:04:12 +08:00
gitea ab9b9965e9 Refactor seal tools into modular domains and fix layer inversions
- Split monolithic tools.ts (4,257 lines) into 11 domain-specific modules in src/domains/seal/tools/
- Extract helpers.ts containing 71 helper functions and shared tool types
- Retain tools.ts as thin re-export for complete backward compatibility
- Fix layer inversions: sink CliError to core/errors.ts, extract linter paths to core/paths.ts, move tenant-diagnose to domain
- Eliminate null as any in runner.ts by widening signatures and adding proper runtime guards
- Rebuild dist/mcp/server.js to satisfy pre-push bundle gate
2026-09-22 16:36:37 +08:00