Skip to content

Surface canonical variant display_name across all variant-displaying UIs #695

@dougborg

Description

@dougborg

Context

After PR #N (variant card rev 2), the canonical formula for a variant's display name lives in one place — build_variant_display_name(parent_name, config_attributes, fallback_sku) -> str in katana_public_api_client/domain/variant.py. Three consumers already delegate to it:

  • KatanaVariant.get_display_name (domain class)
  • CachedVariant.display_name (typed-cache postprocess hook)
  • VariantDetailsResponse.display_name (new field — surfaces on get_variant_details UI)

This issue tracks the audit and rollout to the other surfaces where variants appear and currently use ad-hoc name formatting (or worse, raw Variant.name).

Audit candidates

Each item below needs a check: "what does this UI currently render as the variant's title?" and "should it use display_name?"

Surface Tool Current behavior Action
search_items results search_items Pulls from CachedVariant.display_name already, but verify it flows through the response payload Verify
Inventory check rows check_inventory Per-row "name" field Switch to display_name
Low-stock rows list_low_stock_items Per-row "name" field Switch to display_name
Item detail (nested variants) get_item Today shows raw variant name Switch to display_name
PO row tables (preview + result) create_purchase_order, modify_purchase_order row.variant_id only? Looks up names? Determine + switch
SO row tables create_sales_order, modify_sales_order Same question Determine + switch
MO row tables create_manufacturing_order, modify_manufacturing_order Same question Determine + switch
MO recipe row cards get_manufacturing_order_recipe line items reference variants Switch
Modification preview / result cards Generic modify dispatcher Diff context references variants Switch
Fulfillment cards fulfill_order (sales + manufacturing) Per-row variant rendering Switch
Receipt card receive_purchase_order Per-row variant rendering Switch
Verification card verify_order_document line-by-line comparison Switch

Suggested approach

  1. Walk each surface, find the variant-display code path, and either:
    • Use the cache's pre-computed CachedVariant.display_name directly (cheapest — already there)
    • Compute via build_variant_display_name from the cache row's parent_name + config_attributes if the row was fetched without the precomputed field
    • Add the field to whatever response model needs it, mirroring how VariantDetailsResponse.display_name was added
  2. Update tests per surface to assert the slash-joined format appears
  3. Land per-surface in small PRs (one per tool family, e.g. one PR for inventory tools, one for PO/SO/MO row tables, one for fulfillment/receipt)

Acceptance criteria

  • Every UI that displays a variant title uses display_name (or equivalent precomputed cache column)
  • One end-to-end test per surface confirming the slash-joined format renders
  • No ad-hoc string formatting like f"{parent_name} - {sku}" remaining

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttoolMCP tool implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions