Skip to content

Commit 2a72c82

Browse files
authored
docs(contracts): apply compat-fallback taxonomy to resolved-layout fragmentIndex (SD-2923) (#3112)
The four `fragmentIndex` fields on ResolvedFragmentItem / Table / Image / Drawing previously used the word "legacy" with three different shades across the layout-engine - older path, current fallback, and removed code - all conflated. In this file, "legacy" actually means the *current load-bearing fallback* the painter uses to read inner content from Fragment until ResolvedFragmentItem carries full content directly. Apply the compat-fallback term from comment-policy.md uniformly: each fragmentIndex field now carries an AIDEV-NOTE: compat-fallback anchor naming what triggers the fallback (ResolvedFragmentItem missing content) and the retirement condition (paint items become self-describing). Drop "legacy content lookup" trailer from ResolvedFragmentItem.blockId and rewrite the type-level docstring to reference the per-field anchor instead of "legacy fragment renderers". This is the first in-the-wild use of the loaded-term taxonomy added in #3103. No behavior change.
1 parent d87bf15 commit 2a72c82

1 file changed

Lines changed: 36 additions & 7 deletions

File tree

packages/layout-engine/contracts/src/resolved-layout.ts

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ export type ResolvedGroupItem = {
8989

9090
/**
9191
* A resolved fragment wrapper item.
92-
* Carries positioning and metadata needed to create the fragment's DOM wrapper,
93-
* while inner content rendering is delegated to legacy fragment renderers via fragmentIndex.
92+
* Carries positioning and metadata needed to create the fragment's DOM wrapper.
93+
* Inner content rendering is delegated to the Fragment-based render path via
94+
* fragmentIndex; see the compat-fallback note on that field.
9495
*/
9596
export type ResolvedFragmentItem = {
9697
kind: 'fragment';
@@ -110,9 +111,16 @@ export type ResolvedFragmentItem = {
110111
zIndex?: number;
111112
/** Source fragment kind — used by the painter for wrapper style decisions. */
112113
fragmentKind: Fragment['kind'];
113-
/** Block ID — written to data-block-id and used for legacy content lookup. */
114+
/** Block ID. Written to data-block-id. */
114115
blockId: string;
115-
/** Index within page.fragments — bridge to legacy content rendering. */
116+
/**
117+
* Index back into page.fragments.
118+
*
119+
* AIDEV-NOTE: compat-fallback. The painter currently reads inner content from
120+
* Fragment via this index because ResolvedFragmentItem does not carry full
121+
* content yet. Becomes unused once paint items are self-describing; do not
122+
* promote this to a permanent API surface.
123+
*/
116124
fragmentIndex: number;
117125
/** ProseMirror start position for click-to-position mapping. */
118126
pmStart?: number;
@@ -240,7 +248,14 @@ export type ResolvedTableItem = {
240248
zIndex?: number;
241249
/** Block ID — written to data-block-id. */
242250
blockId: string;
243-
/** Index within page.fragments — bridge to legacy rendering. */
251+
/**
252+
* Index back into page.fragments.
253+
*
254+
* AIDEV-NOTE: compat-fallback. The painter currently reads inner content from
255+
* Fragment via this index because ResolvedFragmentItem does not carry full
256+
* content yet. Becomes unused once paint items are self-describing; do not
257+
* promote this to a permanent API surface.
258+
*/
244259
fragmentIndex: number;
245260
/** ProseMirror start position for click-to-position mapping. */
246261
pmStart?: number;
@@ -294,7 +309,14 @@ export type ResolvedImageItem = {
294309
zIndex?: number;
295310
/** Block ID — written to data-block-id. */
296311
blockId: string;
297-
/** Index within page.fragments — bridge to legacy rendering. */
312+
/**
313+
* Index back into page.fragments.
314+
*
315+
* AIDEV-NOTE: compat-fallback. The painter currently reads inner content from
316+
* Fragment via this index because ResolvedFragmentItem does not carry full
317+
* content yet. Becomes unused once paint items are self-describing; do not
318+
* promote this to a permanent API surface.
319+
*/
298320
fragmentIndex: number;
299321
/** ProseMirror start position for click-to-position mapping. */
300322
pmStart?: number;
@@ -340,7 +362,14 @@ export type ResolvedDrawingItem = {
340362
zIndex?: number;
341363
/** Block ID — written to data-block-id. */
342364
blockId: string;
343-
/** Index within page.fragments — bridge to legacy rendering. */
365+
/**
366+
* Index back into page.fragments.
367+
*
368+
* AIDEV-NOTE: compat-fallback. The painter currently reads inner content from
369+
* Fragment via this index because ResolvedFragmentItem does not carry full
370+
* content yet. Becomes unused once paint items are self-describing; do not
371+
* promote this to a permanent API surface.
372+
*/
344373
fragmentIndex: number;
345374
/** ProseMirror start position for click-to-position mapping. */
346375
pmStart?: number;

0 commit comments

Comments
 (0)