Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): let the user clear a name/title back to the placeholder
[._.]/ Adam Eivyc3305dba923b
diff --git a/client/src/pages/CharacterSheet.a11y.test.jsx b/client/src/pages/CharacterSheet.a11y.test.jsxindex 3239a521e2..625ad45728 100644--- a/client/src/pages/CharacterSheet.a11y.test.jsx+++ b/client/src/pages/CharacterSheet.a11y.test.jsx@@ -119,6 +119,22 @@ describe('CharacterSheet name editing accessibility', () => {);});+ it('clears the name to empty on Enter, returning to the placeholder (#2677)', async () => {+ // The human-centered page renders '' as the "Your name" placeholder, so clearing must be a+ // real save — not a skipped no-op — or the placeholder state is unreachable once a name is set.+ renderSheet();+ fireEvent.click(await findNameTrigger());+ const input = screen.getByLabelText('Character name');+ fireEvent.change(input, { target: { value: '' } });++ fireEvent.keyDown(input, { key: 'Enter' });++ await waitFor(() => expect(put).toHaveBeenCalledWith('/character', { name: '' }, { silent: true }));+ await waitFor(() =>+ expect(screen.getByRole('button', { name: /edit your name/i })).toHaveTextContent('Your name'),+ );+ });+it('cancels the edit on Escape and restores the original name', async () => {renderSheet();fireEvent.click(await findNameTrigger());diff --git a/client/src/pages/CharacterSheet.jsx b/client/src/pages/CharacterSheet.jsxindex 140731af15..2d5b8c3b0a 100644--- a/client/src/pages/CharacterSheet.jsx+++ b/client/src/pages/CharacterSheet.jsx@@ -319,10 +319,14 @@ export default function CharacterSheet() {setNameVal(char.name || '');return;}- if (!(nameVal.trim() && nameVal.trim() !== char.name)) return;+ // Save on any real change, INCLUDING clearing back to '' (which returns the sheet to the+ // "Your name" placeholder). Only a no-op — the trimmed value equal to what's persisted —+ // skips the PUT. Compare against `char.name || ''` so a blank→blank edit doesn't churn.+ const nextName = nameVal.trim();+ if (nextName === (char.name || '')) return;setNameSaving(true);try {- const data = await charPut({ name: nameVal.trim() });+ const data = await charPut({ name: nextName });setChar(data);} catch (err) {toast.error(err.message || 'Failed to save name');@@ -345,8 +349,11 @@ export default function CharacterSheet() {const handleClassSave = async () => {try {- if (classVal.trim() && classVal !== char.class) {- const data = await charPut({ class: classVal.trim() });+ // Save on any real change, including clearing back to '' (restores the "Add a title"+ // placeholder); only a no-op skips the PUT.+ const nextClass = classVal.trim();+ if (nextClass !== (char.class || '')) {+ const data = await charPut({ class: nextClass });setChar(data);}} catch (err) { toast.error(err.message || 'Failed to save class'); }diff --git a/server/routes/character.js b/server/routes/character.jsindex 6d91c2e9af..c48b39c8c6 100644--- a/server/routes/character.js+++ b/server/routes/character.js@@ -17,8 +17,11 @@ const router = Router();// Zod schemas for request validationconst updateCharacterSchema = z.object({- name: z.string().min(1).max(100).optional(),- class: z.string().min(1).max(100).optional(),+ // Empty is allowed (not `.min(1)`): '' is the "unset" state the human-centered page renders+ // as the "Your name" / "Add a title" placeholder (#2677), so the user must be able to clear+ // a name/title back to blank, not just replace it.+ name: z.string().max(100).optional(),+ class: z.string().max(100).optional(),avatarPath: z.string().max(500).regex(/^\/data\/images\/[A-Za-z0-9._-]+$/, 'Invalid avatar path').optional()});diff --git a/server/routes/character.test.js b/server/routes/character.test.jsindex 6b8fb916f5..5ac4943e56 100644--- a/server/routes/character.test.js+++ b/server/routes/character.test.js@@ -108,8 +108,16 @@ describe('PUT /api/character', () => {expect(characterService.updateCharacterFields).toHaveBeenCalledWith({ name: 'Radagast' });});- it('rejects an empty name instead of clearing it', async () => {- const res = await request(makeApp()).put('/api/character').send({ name: '' });+ it('accepts an empty name/class to clear it back to the placeholder (#2677)', async () => {+ // '' is the "unset" state the human-centered page renders as "Your name" / "Add a title",+ // so clearing must be an accepted update, not a 400 — the field is no longer `.min(1)`.+ const res = await request(makeApp()).put('/api/character').send({ name: '', class: '' });+ expect(res.status).toBe(200);+ expect(characterService.updateCharacterFields).toHaveBeenCalledWith({ name: '', class: '' });+ });++ it('still enforces the max length on name/class', async () => {+ const res = await request(makeApp()).put('/api/character').send({ name: 'x'.repeat(101) });expect(res.status).toBe(400);expect(characterService.updateCharacterFields).not.toHaveBeenCalled();});