fix(project): 归档被进行中环节拦截时没有错误码 —— 前端说不出原因(P7,攒批走 delta)
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
## 缺口
契约缺口 `KNOWN_CONTRACT_GAPS.P7`(`packages/contracts/src/project.ts`)。
「有进行中环节时拒绝归档」(U-2⑵)这条已裁定的失败,**后端已经实现了拦截**,但**没有可判等的错误码**:
- 仓储返回 `active-segment-exists`(`pg-project-archive-repository.ts:83`)
- → 用例抛 `ProjectArchiveBlockedByActiveSegmentError`(`application/project/errors.ts:46`,**故意不带 reasonCode**)
- → 控制器 catch 后抛**裸 400,无 reasonCode 字段**(`interface/controllers/project.controller.ts:516-518`)
`archiveProject.err` 枚举里只有 `ORG_ROLE_INSUFFICIENT` / `PROJECT_ARCHIVED` / `AUTH_SERVICE_UNAVAILABLE`,表达不了这一条。
## 后果
前端拿到的是 `HTTP 400` 且 `ApiError.reasonCode` 为空,**无法如实告诉用户「因为有环节正在进行」**。
## 本版处理(coord-main 2026-08-12 夜间裁决 (a))
PJ-03 归档接线**不编原因**:显示通用「操作失败」文案。理由逐字——「『操作失败』比编一个未证实的原因诚实」。缺口记在本 issue,不为一个错误码单独开一轮签核。
## 后续
建议错误码名:`ARCHIVE_BLOCKED_ACTIVE_SEGMENT`(422 fail-closed,与 PJ-13 的 `BLUEPRINT_NOT_APPLICABLE` 同形)。
**挂 project 束的下一次 delta 批次**,等该束攒出下一批契约变更一起走签核,不单独开轮。
/cc @coord-main
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with packages/contracts/src/project.ts, then trace the existing path through pg-project-archive-repository.ts, application/project/errors.ts, and interface/controllers/project.controller.ts. The current decision is to show a generic failure, while the proposed error code is deferred to the next project delta batch and contract sign-off; done is therefore not defined for an immediate patch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100