fix: UI 감사와 11-01·11-03 성숙도 리뷰의 발견을 반영한다 #4

Merged
donghyeon.kang merged 361 commits from fix/ui-design-audit-2026-11-01 into main 2026-11-05 10:33:58 +00:00
3 changed files with 80 additions and 0 deletions
Showing only changes of commit 32da8a40e9 - Show all commits
+9
View File
@@ -57,6 +57,15 @@ describe("REST operation v2 registry", () => {
}),
).toThrow("Incoherent REST replay contract");
});
// 07-06 (MX5). A KEYED command without a required idempotency key would be
// resent with no key to bind the retry to.
it("rejects a KEYED_COMMAND whose idempotency key is not required", () => {
expect(() =>
defineRestOperation({ ...command(), idempotencyKeyPolicy: "NONE" }),
).toThrow("Incoherent REST replay contract: CREATE_RESOURCE");
expect(defineRestOperation(command()).idempotencyKeyPolicy).toBe("REQUIRED");
});
});
function command(): RestOperationV2 {
+20
View File
@@ -35,6 +35,26 @@ describe("platform DTO mapper boundary", () => {
).toThrow("duplicate boundary mapper");
});
// 07-06 (MX2). V2 rows look mappers up by `mapperId`; a registry key that
// differs would install a mapper no operation can reach.
it("rejects a registry key that is not the mapper's own id", () => {
const mapper = {
mapperId: "ResourceMapper",
mapperVersion: 1,
inputSchemaId: "ResourcePayload",
outputContractId: "Resource",
owner: "test",
maxOutputItems: 1,
map: (input: unknown) => mappingSuccess(input),
};
expect(() =>
composeBoundaryMapperRegistry([{ OtherMapper: mapper }]),
).toThrow("Invalid or duplicate boundary mapper: OtherMapper");
expect(
Object.keys(composeBoundaryMapperRegistry([{ ResourceMapper: mapper }])),
).toEqual(["ResourceMapper"]);
});
it("adapts a boundary result to the canonical mapping result (D-15)", () => {
expect(toContractMappingResult(mappingSuccess(1))).toEqual({
ok: true,
@@ -86,6 +86,57 @@ describe("external contract contribution composition", () => {
});
});
// 07-06 (MX1, MX9, MX6). The write-API rules the composer teaches through its
// error messages. TEST_CONTRACT_CONTRIBUTION composing in the first block is
// the valid control.
describe("write operation rules", () => {
const [listRow, , createRow] = TEST_CONTRACT_CONTRIBUTION.http as readonly [
InstalledContractContribution["http"][number],
InstalledContractContribution["http"][number],
InstalledContractContribution["http"][number],
];
function reasonFor(row: object): string {
return captureContributionError(() =>
composeContractContributions([
contribution("write-rule", [
row as InstalledContractContribution["http"][number],
]),
]),
).reason;
}
// The executor decides "write" by `commandEffect !== null`, not by method,
// so this rule is the only thing keeping a GET from running as a command.
it("rejects command descriptors on a read operation", () => {
expect(
reasonFor({
...listRow,
contract: { ...listRow.contract, commandEffect: createRow.contract.commandEffect },
}),
).toBe("test-feature/TEST_LIST_ENTITIES: read operations carry no command descriptors");
});
it("requires a recovery descriptor on a KEYED command", () => {
expect(
reasonFor({
...createRow,
contract: { ...createRow.contract, commandRecovery: null },
}),
).toBe("test-feature/TEST_CREATE_ENTITY: KEYED commands require a recovery descriptor");
});
it("rejects a retry budget on a NEVER-retry operation", () => {
expect(
reasonFor({
...createRow,
contract: { ...createRow.contract, retrySemantics: "NEVER" },
frontend: { ...createRow.frontend, retryBudget: 1 },
}),
).toBe("test-feature/TEST_CREATE_ENTITY: retry budget contradicts NEVER retry semantics");
});
});
// The sample feature's own cases (its fixture composes, a second one does not)
// live in tests/features so they leave with the sample.
describe("template fixture provenance (07-04, §4.8)", () => {