Skip to content

finding: metadata-admin/previews/object-fields-bridge.ts has zero importers, and its serializeDesignerField would destroy every key the designer does not model #6309

Description

@os-support-ai

Observational finding, surfaced while resolving #6043. Not fixed there — #6043 only removed the formula read/write this file carried, because removing DesignerFieldDefinition.formula forced that edit. Same class as #6224 (metadataConverters.ts, zero importers).

1. The module is unreferenced

packages/app-shell/src/views/metadata-admin/previews/object-fields-bridge.ts exports bridgeFromDraft, commitToDraft and FieldsBridgeResult. Measured on origin/main @ 7ccb53a, repo-wide over packages/ apps/ examples/ scripts/, excluding the file itself and dist/:

grep -rn "bridgeFromDraft\|commitToDraft\|FieldsBridgeResult\|object-fields-bridge" \
--include=*.ts --include=*.tsx --include=*.mjs --include=*.json
=> 4 hits, ALL of them prose in comments
(types/src/designer.ts, types designer-field-types.test.ts x2, fields richtext-cell-renderer-5452.test.tsx)
=> 0 hits that import or call anything it exports

Zero-hit control, so the reading is not just a bad grep: the same command shape against its live sibling in the same directory, object-fields-io, returns 10+ real consumers (useObjectFields.ts, StudioDesignSurface.tsx, ObjectFormDesigner.tsx, …). The instrument finds consumers when they exist.

Note the comments still describe the bridge as though it were wired — that is what makes it worth a card rather than a silent delete: a future reader has three in-repo pointers telling them this bridge mediates between the framework field record and FieldDesigner, and nothing telling them it is unreachable.

2. If it is ever revived, its round-trip is lossy — and its own header says the opposite

serializeDesignerField builds a fresh object and copies only the keys DesignerFieldDefinition models:

constout: FrameworkFieldDef={type: f.type,label: f.label};if(f.required)out.required=true;// … ~10 more known keys, then:returnout;

prev is never spread. So for any field type the designer CAN edit, every other key is dropped on commit — including real FieldSchema keys such as expression, returnType and inlineHelpText. A formula field authored in metadata-admin's ObjectFieldInspector (which writes expression and stamps returnType from inferred CEL type) would come back through this bridge with its expression gone.

The file header currently claims the opposite:

  • reassembles the full record on commit, putting preserved entries back in their original order/shape so nothing the user can't see is destroyed.

That guarantee holds only for the quarantined branch (types the designer cannot edit, preserved verbatim). For the designer-editable branch it is false. The two branches are adjacent in the same function, which is how the claim reads as covering both.

Suggested resolutions (not adjudicated here)

Not urgent: with zero importers there is no live data loss today. The severity is entirely about what happens when someone wires it up trusting its header.

Refs: #6043 (where it surfaced) · #6224 (same class) · #5761 (the parity gate — note FrameworkFieldDef is not one of its PAYLOAD_SHAPES, so the gate is green over this file by construction)

Metadata

Metadata

Assignees

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:dispatched

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions