Skip to content

Unify the CoS avatar-style vocabulary into one exported registry - #6259

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-6253
Sep 4, 2026
Merged

Unify the CoS avatar-style vocabulary into one exported registry#6259
atomantic merged 1 commit into
mainfrom
claim/issue-6253

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • Adds client/src/lib/avatarStyles.js as the single source of truth for the CoS avatar-style vocabulary (AVATAR_STYLES = [{ id, label, webgl }]), with AVATAR_STYLE_IDS, AVATAR_STYLE_LABELS, and WEBGL_AVATAR_STYLE_IDS derived from it.
  • client/src/components/cos/constants.js's AVATAR_STYLE_LABELS and client/src/pages/ChiefOfStaff.jsx's CANVAS_AVATAR_STYLES now derive from the registry instead of hand-maintaining parallel lists.
  • server/routes/cosStatusRoutes.js's avatarStyle zod enum now builds from AVATAR_STYLE_IDS, importing the client leaf module directly at runtime — the same cross-workspace pattern server/lib/personaTraitBlend.js already uses for clamp from client/src/utils/formatters.js, safe because the leaf has zero transitive dependencies.
  • LAZY_AVATARS stays a hand-written id -> lazy() map (it holds real component references, not data). A new completeness test in ChiefOfStaff.test.jsx fails loudly if a registry style is missing from both LAZY_AVATARS and the new INLINE_RENDERED_AVATAR_STYLES set (['svg', 'ascii']), so a style added to the registry alone can no longer silently fall through to the default avatar render.

Closes #6253

Test plan

  • server/routes/cosStatusRoutesAvatar.test.js — asserts every registry id parses through the schema.
  • client/src/lib/avatarStyles.test.js — registry shape and derived-export parity.
  • client/src/pages/ChiefOfStaff.test.jsx — new avatar-style registry coverage test.
  • Verified the server import is safe under the CI condition (client node_modules absent).
  • Full server and client suites run locally; only 2 pre-existing, unrelated failures (a LoRA trigger-words test and an imageGen watermark hook timeout).

AVATAR_STYLE_LABELS, LAZY_AVATARS, CANVAS_AVATAR_STYLES, and the server's
avatarStyle zod enum were four hand-maintained lists with nothing enforcing
agreement between them — a style added to one but not the enum was a
settings 400 at runtime.

Add client/src/lib/avatarStyles.js as the single source of truth
(AVATAR_STYLES = [{id, label, webgl}]), with AVATAR_STYLE_IDS,
AVATAR_STYLE_LABELS, and WEBGL_AVATAR_STYLE_IDS derived from it. The picker
labels, the WebGL-stage set, and the server's zod enum now derive from the
registry directly; the server imports the client leaf module at runtime the
way server/lib/personaTraitBlend.js already imports `clamp` from
client/src/utils/formatters.js, since it carries no transitive dependencies.

LAZY_AVATARS stays a hand-written id->lazy() map (it holds real component
references, not data), so a new completeness test in ChiefOfStaff.test.jsx
fails loudly if a registry style is missing from both LAZY_AVATARS and the
new INLINE_RENDERED_AVATAR_STYLES set.
@atomantic
atomantic merged commit 15877b6 into main Sep 4, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6253 branch September 4, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify the CoS avatar-style vocabulary into one exported registry

1 participant