Skip to content

finding: app-shell/utils/metadataConverters.ts has zero importers — a dead module still carrying a name-heuristic isSystem and a referenceTo tolerance #6224

Description

@yinlianghui

Observation-class finding, surfaced while re-deriving the read/write sites for objectui#6041 and objectui#6044. No live defect — the code is unreachable, which is the finding. Filed unassigned; finding, deliberately notpm:queue.

Measured

On origin/main @ 7da7b8a1d:

grep -rn "metadataConverters" --include=*.ts --include=*.tsx . \
--exclude-dir=node_modules --exclude-dir=dist | grep -v "utils/metadataConverters.ts:"
=> no output
grep -n "metadataConverters\|toFieldDefinition" packages/app-shell/dist/index.d.ts
=> no output

So toObjectDefinition and toFieldDefinition are exported from the module, imported by nothing in the repo, and not re-exported from @object-ui/app-shell's published entry (exports declares . and ./styles.css only). Control that the instrument works: the same grep for a module that is reachable, packages/app-shell/src/services/MetadataService.ts, returns importers.

Why it is worth recording rather than ignoring

The module is a second, independent copy of the designer's read-direction converter, and it disagrees with the one that is live:

  • toFieldDefinition derives the system-field flag from a name heuristicfield.readonly === true && (field.name === 'id' || field.name === 'createdAt' || field.name === 'updatedAt') — rather than from the spec's system flag. That is the same dead detection objectui#6044 just repaired in MetadataFieldsPage.toDesignerField, in a shape a grep for the misspelling does not find, and with a spelling (createdAt) the spec does not use (created_at).
  • Its MetadataField interface declares referenceTo and reads field.reference_to || field.reference || field.referenceTo — a three-way tolerance for a target the spec spells reference, which objectui#6041 has now made the single spelling on both wire-bound shapes.

A dead copy that disagrees with the live one is the thing that gets revived by a future author looking for "the converter", so the two candidate resolutions are: delete the module (the #4687 shape), or point it at the shared classifiers that already exist — isSystemManagedField in @object-ui/types branches on the spec system flag, and reference-keys.ts in @object-ui/core already owns the target-key read.

Adjacent, same family, not filed separately

packages/plugin-dashboard/src/recordFields.tsx line 56 reads if (def && (def.isSystem === true || def.system === true)) return true;. The isSystem half of that disjunction can never fire on a spec-parsed field def — FieldSchema refuses the key by name — so it is a consumer-side tolerance for a spelling the platform does not emit. Live code, harmless today, and it belongs to whoever takes the module above.

Refs: #6041 · #6044 · #5761 (the parity gate) · #4687

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