Skip to content

Commit f67be95

Browse files
committed
refactor(spec): the refused-shape TODO is stamped where every conversion TODO is
check:dispatcher-error-vocabulary classifies OS_METADATA_CONVERSION_TODO per (code, file); the detector list now hands back (refused, detail) and applyConversions builds the notice. Claude-Session: https://claude.ai/code/session_01BRQ9Mp1yH7R1az6MaUM18H Co-authored-by: Claude <noreply@anthropic.com>
1 parent b111eea commit f67be95

2 files changed

Lines changed: 26 additions & 24 deletions

File tree

‎packages/spec/src/conversions/apply.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,21 @@ export function applyConversions(
210210
// [#23269, #23270, #23271] What protocol 18 refuses and nothing converts,
211211
// judged on the converted stack and listed through the same sink: a row the
212212
// chain leaves refused must not read as already on protocol.
213-
if (onTodo) reportRefusedStoredShapes(current, onTodo);
213+
if (onTodo) {
214+
reportRefusedStoredShapes(current, (refused, detail) =>
215+
onTodo({
216+
code: CONVERSION_TODO_CODE,
217+
conversionId: refused.id,
218+
surface: refused.surface,
219+
from: detail.from,
220+
path: detail.path,
221+
reason: detail.reason,
222+
message:
223+
`[protocol] left ${refused.surface} at ${detail.path} as stored — protocol ${refused.toMajor} `
224+
+ `refuses it (ADR-0087 D3 entry '${refused.id}') and no conversion rewrites it losslessly: `
225+
+ detail.reason,
226+
}));
227+
}
214228

215229
return current;
216230
}

‎packages/spec/src/conversions/refused-shapes.ts‎

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* `onTodo` sink. Two callers pass one: the stored-metadata migration pass
2424
* (through `applyConversionsToStoredItem`), and the automation engine's
2525
* `canonicalizeStoredFlow`, which that pass calls for a flow row. Each finding
26-
* reaches the sink as a {@link ConversionTodoNotice}, under its row, exactly
27-
* like a site a conversion left as stored. The authoring funnel and the read
26+
* reaches the sink as a `ConversionTodoNotice`, under its row, exactly like a
27+
* site a conversion left as stored. The authoring funnel and the read
2828
* seams pass no sink, so for them nothing here runs.
2929
*
3030
* ## What it never does
@@ -50,11 +50,7 @@ import {
5050
type ControlledByParentMasterRefusal,
5151
} from '../data/controlled-by-parent-master.js';
5252
import { ViewDataSchema } from '../ui/view.zod.js';
53-
import {
54-
CONVERSION_TODO_CODE,
55-
type ConversionTodoDetail,
56-
type ConversionTodoNotice,
57-
} from './types.js';
53+
import type { ConversionTodoDetail } from './types.js';
5854
import { mapCollection, mapFlowNodeList, mapViewPayloads } from './walk.js';
5955

6056
type Dict = Record<string, unknown>;
@@ -275,26 +271,18 @@ export const REFUSED_STORED_SHAPES: readonly RefusedStoredShape[] = [
275271

276272
/**
277273
* Run every {@link REFUSED_STORED_SHAPES} detector over `stack` and hand each
278-
* finding to `onTodo` as a {@link ConversionTodoNotice}, whose `conversionId`
279-
* is the refusal's D3 entry id. Reads only.
274+
* finding to `report` with the refused shape it belongs to. Reads only.
275+
*
276+
* The notice itself — its `code`, its `conversionId` (the refusal's D3 entry
277+
* id) and its message — is built by the one caller, `applyConversions`, beside
278+
* the conversion TODOs it already builds, so the TODO code is
279+
* stamped at one site.
280280
*/
281281
export function reportRefusedStoredShapes(
282282
stack: Dict,
283-
onTodo: (todo: ConversionTodoNotice) => void,
283+
report: (refused: RefusedStoredShape, detail: ConversionTodoDetail) => void,
284284
): void {
285285
for (const refused of REFUSED_STORED_SHAPES) {
286-
refused.detect(stack, (detail) =>
287-
onTodo({
288-
code: CONVERSION_TODO_CODE,
289-
conversionId: refused.id,
290-
surface: refused.surface,
291-
from: detail.from,
292-
path: detail.path,
293-
reason: detail.reason,
294-
message:
295-
`[protocol] left ${refused.surface} at ${detail.path} as stored — protocol ${refused.toMajor} `
296-
+ `refuses it (ADR-0087 D3 entry '${refused.id}') and no conversion rewrites it losslessly: `
297-
+ detail.reason,
298-
}));
286+
refused.detect(stack, (detail) => report(refused, detail));
299287
}
300288
}

0 commit comments

Comments
 (0)