From c38778451d3e27ecd2d64cec679a5792ccf594d8 Mon Sep 17 00:00:00 2001 From: Jage9 Date: Tue, 24 Feb 2026 19:57:05 -0500 Subject: [PATCH] Remove client fallback item metadata inference --- client/public/version.js | 2 +- client/src/items/itemPropertyPresentation.ts | 64 +------------------- client/src/items/itemRegistry.ts | 2 +- docs/protocol-notes.md | 1 + 4 files changed, 6 insertions(+), 63 deletions(-) diff --git a/client/public/version.js b/client/public/version.js index e121865..92bb4a2 100644 --- a/client/public/version.js +++ b/client/public/version.js @@ -1,5 +1,5 @@ // Maintainer-controlled web client version. // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) -window.CHGRID_WEB_VERSION = "2026.02.25 R232"; +window.CHGRID_WEB_VERSION = "2026.02.25 R233"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/client/src/items/itemPropertyPresentation.ts b/client/src/items/itemPropertyPresentation.ts index 9548429..291737c 100644 --- a/client/src/items/itemPropertyPresentation.ts +++ b/client/src/items/itemPropertyPresentation.ts @@ -35,59 +35,6 @@ export function createItemPropertyPresentation(deps: PresentationDeps): { return segments[segments.length - 1] ?? raw; }; - const inferItemPropertyValueType = (item: WorldItem, key: string): string | undefined => { - if (key === 'useSound' || key === 'emitSound') return 'sound'; - if (key === 'enabled' || key === 'use24Hour' || key === 'directional') return 'boolean'; - if (key === 'mediaChannel' || key === 'mediaEffect' || key === 'emitEffect' || key === 'timeZone' || key === 'instrument' || key === 'voiceMode') return 'list'; - if ( - key === 'x' || - key === 'y' || - key === 'version' || - key === 'mediaVolume' || - key === 'emitVolume' || - key === 'emitSoundSpeed' || - key === 'emitSoundTempo' || - key === 'mediaEffectValue' || - key === 'emitEffectValue' || - key === 'facing' || - key === 'emitRange' || - key === 'octave' || - key === 'attack' || - key === 'decay' || - key === 'release' || - key === 'brightness' || - key === 'sides' || - key === 'number' || - key === 'useCooldownMs' - ) { - return 'number'; - } - if (key in item.params || key in getItemTypeGlobalProperties(item.type)) { - const value = item.params[key] ?? getItemTypeGlobalProperties(item.type)?.[key]; - if (typeof value === 'boolean') return 'boolean'; - if (typeof value === 'number') return 'number'; - if (typeof value === 'string') return 'text'; - } - return 'text'; - }; - - const getFallbackInspectPropertyTooltip = (key: string): string | undefined => { - if (key === 'type') return 'The item type identifier.'; - if (key === 'x') return 'X coordinate on the grid.'; - if (key === 'y') return 'Y coordinate on the grid.'; - if (key === 'carrierId') return 'Current carrier user id, or none when on the ground.'; - if (key === 'version') return 'Server version for this item, incremented after each update.'; - if (key === 'createdBy') return 'User id of who created this item.'; - if (key === 'createdAt') return 'Timestamp when this item was created.'; - if (key === 'updatedAt') return 'Timestamp when this item was last updated.'; - if (key === 'capabilities') return 'Server-declared actions supported by this item.'; - if (key === 'useSound') return 'One-shot sound played when use succeeds.'; - if (key === 'emitSound') return 'Looping emitted sound source for this item.'; - if (key === 'useCooldownMs') return 'Global cooldown in milliseconds between uses.'; - if (key === 'directional') return 'Whether emitted audio favors item facing direction.'; - return undefined; - }; - const getItemPropertyValue = (item: WorldItem, key: string): string => { if (key === 'title') return item.title; if (key === 'type') return item.type; @@ -137,15 +84,10 @@ export function createItemPropertyPresentation(deps: PresentationDeps): { const describeItemPropertyHelp = (item: WorldItem, key: string): string => { const metadata = getItemPropertyMetadata(item.type, key); const parts: string[] = []; - const tooltip = metadata?.tooltip ?? getFallbackInspectPropertyTooltip(key); - if (tooltip) { - parts.push(tooltip); - } else { - parts.push('No tooltip available.'); - } + parts.push(metadata?.tooltip ?? 'No tooltip available.'); - const valueType = metadata?.valueType ?? inferItemPropertyValueType(item, key); - if (valueType) { + if (metadata?.valueType) { + const valueType = metadata.valueType; parts.push(`Type: ${valueType}.`); } diff --git a/client/src/items/itemRegistry.ts b/client/src/items/itemRegistry.ts index 57a8575..40b8493 100644 --- a/client/src/items/itemRegistry.ts +++ b/client/src/items/itemRegistry.ts @@ -112,7 +112,7 @@ export function getClockTimeZoneOptions(): string[] { /** Returns default timezone used by clock items when no override is set. */ export function getDefaultClockTimeZone(): string { - return getClockTimeZoneOptions()[0] ?? 'America/Detroit'; + return getClockTimeZoneOptions()[0] ?? ''; } /** Returns item-type display order for add-item menus. */ diff --git a/docs/protocol-notes.md b/docs/protocol-notes.md index e58b0fd..520e795 100644 --- a/docs/protocol-notes.md +++ b/docs/protocol-notes.md @@ -62,6 +62,7 @@ This is a behavior guide for packet semantics beyond raw schemas. - `itemTypes[].propertyMetadata`: property-level metadata (`valueType`, optional `label`, optional `range`, optional `tooltip`, optional `maxLength`, optional `options`, optional `visibleWhen`) - `itemTypes[].globalProperties`: non-editable global values (`useSound`, `emitSound`, `useCooldownMs`, `emitRange`, `directional`, `emitSoundSpeed`, `emitSoundTempo`) - Client item UI requires this metadata from the server; there is no fallback item definition map. +- Client property help/type rendering is metadata-driven; it does not infer fallback types/tooltips from hardcoded key heuristics. ## Validation Boundaries