Filed by the domain:cli seat on the 2026-08-15 maintainer ruling on #5949 (「接受你的建议」, recorded at #5949 comment 5301726968). Card 1 of the two extractions that ruling authorised.
⚠️This is NOT the ADR-0076 D11 decomposition. That programme was ruled closed (option B — the second half is delineated, not split). This card stands on a different justification and would be worth doing even if the routes never move.
The justification — prism ① (coherence), not ③
packages/rest/src/rest-server.ts opens with ~1,980 lines before its first class declaration. That prologue (~732 code lines) is error and fault classification plus response shaping:
mapDataError · resolveErrorResponse · DATA_STORE_FAULT · UNCLASSIFIED_FAULT · isScriptFaultMessage · declaredHttpStatus · truncateClientMessage · sendError · sendFieldVisibilityFault · logWithheldServerFault · isExpectedDataStatus · isExpectedQueryRejection · isExpectedRouteError · logUnexpectedRouteError · handleRouteError · droppedFieldsHeaderValue · applyDroppedFieldsHeader · missingRelationIsObject
This is ADR-0112's domain — how a thrown thing becomes an HTTP answer — and it has zero coupling to the RestServer class: every one of these is a module-level function, declared before the class exists. It lives here for historical reasons, not structural ones.
Extracting it is a move, not a redesign.
Scope
- Move the prologue to its own module in
packages/rest/src/, re-exporting whatever rest-server.ts and any external consumer already import. - ⛔ No behaviour change. This is a file move plus imports. Any change to what a caller receives is out of scope and a stop-and-report.
- ⛔ Do not touch the
RestServer class body, and ⛔ do not extract any registerXxxEndpoints method — that is the programme option B closed. export { zodIssuesToFields } at line ~188 is re-exported from here today; preserve the public surface exactly.
Premise to verify before moving
Measured on origin/main @ 04d03c3a0: first class declaration at line 1981, prologue is module-level functions only. Re-verify by symbol — this file has taken merges since, and this lane has been burned three times by trusting a stated line number.
⚠️ Also verify the zero-coupling claim rather than inheriting it: confirm no prologue function closes over class state or is referenced before its definition in a way that a module split would break. My reading was structural (declaration order), not a dependency trace.
Not claimed
Refs: #5949 (the ruling and the four-prism analysis), ADR-0112, ADR-0076 D11.
Filed by the
domain:cliseat on the 2026-08-15 maintainer ruling on #5949 (「接受你的建议」, recorded at #5949 comment5301726968). Card 1 of the two extractions that ruling authorised.The justification — prism ① (coherence), not ③
packages/rest/src/rest-server.tsopens with ~1,980 lines before its first class declaration. That prologue (~732 code lines) is error and fault classification plus response shaping:mapDataError·resolveErrorResponse·DATA_STORE_FAULT·UNCLASSIFIED_FAULT·isScriptFaultMessage·declaredHttpStatus·truncateClientMessage·sendError·sendFieldVisibilityFault·logWithheldServerFault·isExpectedDataStatus·isExpectedQueryRejection·isExpectedRouteError·logUnexpectedRouteError·handleRouteError·droppedFieldsHeaderValue·applyDroppedFieldsHeader·missingRelationIsObjectThis is ADR-0112's domain — how a thrown thing becomes an HTTP answer — and it has zero coupling to the
RestServerclass: every one of these is a module-level function, declared before the class exists. It lives here for historical reasons, not structural ones.Extracting it is a move, not a redesign.
Scope
packages/rest/src/, re-exporting whateverrest-server.tsand any external consumer already import.RestServerclass body, and ⛔ do not extract anyregisterXxxEndpointsmethod — that is the programme option B closed.export { zodIssuesToFields }at line ~188 is re-exported from here today; preserve the public surface exactly.Premise to verify before moving
Measured on
origin/main@04d03c3a0: first class declaration at line 1981, prologue is module-level functions only. Re-verify by symbol — this file has taken merges since, and this lane has been burned three times by trusting a stated line number.Not claimed
packages/rest/src/rest-server.ts已 8593 行(ADR 记录约 5.1k),且无 issue 承接 #5949 found no measured business pull for anything in this file, and that finding stands. This card is justified on coherence alone, and it is cheap — not on urgency.packages/rest/src/rest-server.ts已 8593 行(ADR 记录约 5.1k),且无 issue 承接 #5949's line-count series was retired in the same ruling; ⛔ do not cite line counts as justification here.Refs: #5949 (the ruling and the four-prism analysis), ADR-0112, ADR-0076 D11.