Skip to content

Label seam in stack-core (getLabelFieldName / getItemLabel + ui.labelField) #629

Description

@borisno2

What to build

A single label seam in stack-core that answers "what one field represents a row, and what text is its label" — used everywhere the admin UI shows a row as a reference (relationship cells, dropdown options, page headings).

Two entry points sharing one resolver, so the field chosen for projection can never drift from the field used for rendering:

  • getLabelFieldName(listConfig): string — resolves ui.labelField ?? 'name' ?? 'title' ?? 'id' (first field that exists on the list).
  • getItemLabel(listConfig, item): string — reads the resolved field off the row, falls back to id when the field is absent (e.g. stripped by field-level access).

Add ui.labelField?: string to the list config type, exported both functions from the @opensaas/stack-core root entry point. This is the Label field / Item label vocabulary now recorded in CONTEXT.md.

No consumer changes in this slice — this is the foundation two downstream slices build on.

Acceptance criteria

  • ui.labelField accepted on the list config and validated (references a declared scalar field when set)
  • getLabelFieldName and getItemLabel exported from the root entry point
  • Fallback order pinned: configured labelFieldnametitleid
  • getItemLabel falls back to id when the resolved field is missing from the row
  • Unit tests table over (ui.labelField, fields present, row) asserting the projection⇄render agreement (the field getLabelFieldName returns is the field getItemLabel reads)
  • Changeset added (minor: new config option + exports)

Blocked by

None - can start immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions