refactor(contracts): FE-REG-API 행이 refusedBeforeWrite를 타입으로 읽는다

문제
fix/r1103-contracts는 fix/r1103-http가 아직 없을 때
CommandEffectDescriptor에 없는 refusedBeforeWrite를 구조 캐스트로
읽었다. 두 브랜치를 합치자 그 칸이 타입에 생겼다. 또 행 투영 테스트가
Envelope가 아닌 operation에 refusedBeforeWrite를 적는데, http 쪽 조립
검사(1103/03-01)는 그것을 거절해 테스트가 ContractContributionError로
실패한다.

고른 방법
- api-operations.ts는 effect.refusedBeforeWrite를 타입으로 읽는다.
- 테스트의 create descriptor에 responseEnvelope ENVELOPE_V1을 주고,
  code를 업무 거절 모양(TEST_ENTITY_INVALID 등)으로 바꾼다.

위험·한계
- 행 모양은 그대로다. 기준선 영향 없음.

검증
- tests/unit/api-operation-rows.test.ts 12건, test:unit 2,790건,
  check:types, lint 통과.

Refs: docs/reviews/2026-11-03-maturity-review/07-contracts.md 07-01
This commit is contained in:
DongHyeonka
2026-11-04 22:34:35 +09:00
parent 6088f6e533
commit 3fba68bebc
2 changed files with 10 additions and 9 deletions
+6 -7
View File
@@ -131,14 +131,13 @@ function commandEffectRow(
effect: CommandEffectDescriptor<unknown> | null,
): ApiCommandEffectRow | null {
if (effect === null) return null;
// Read structurally: a descriptor that does not name refused codes has no
// such list, and the row then has no such field.
const refused: unknown = (effect as Readonly<{ refusedBeforeWrite?: unknown }>)
.refusedBeforeWrite;
// A descriptor that does not name refused codes has no such list, and the
// row then has no such field.
const refused = effect.refusedBeforeWrite;
return Object.freeze({
classifiesStatus: typeof effect.classifyStatus === "function",
...(Array.isArray(refused)
? { refusedBeforeWrite: Object.freeze(refused.map(String)) }
: {}),
...(refused === undefined
? {}
: { refusedBeforeWrite: Object.freeze([...refused]) }),
});
}