Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ All notable changes to OpenSignup are documented here. Format follows [Keep a Ch

- A signup's three tabs (Build, Responses, Settings) now fit whole on a 320px phone (#1022). In Swedish and German the strip was wider than the screen, so a signup opened on Build showed its Settings tab cut in half at the right edge, with nothing to say the strip scrolls. Below the `sm` breakpoint the tabs, the counts beside them and the strip's own side margin are a little narrower; the tabs keep their height, and wider screens are unchanged. A count of three digits can still make the strip scroll.
- `POST /api/signups` now refuses a `visibility` of `public` or `password` with `invalid_input` on `visibility` (#1082), as `PATCH /api/signups/[id]` already did (#517). It used to accept either, store it and send it back, though nothing reads it: no password protected anything, and no signup was listed. `unlisted`, or no `visibility` at all, is still accepted, and every new signup is stored as `unlisted`. A script that creates signups with `public` or `password` needs to send `unlisted` or leave the key out.
- A slot value that is empty or only spaces now counts as no value in Magic Compose drafts and the AI connector's `create_signup` (#1098), as it already did everywhere else. `create_signup` refused the whole signup over one, with "some values do not fit their fields", and now stores that slot without the value; Magic Compose's "values left blank because they didn't fit" warning no longer counts them; and an empty Number value is no longer stored as 0, on either path.
- On a phone, the organizer header's crumbs no longer run under Help, Account and Sign out (#978). Below tablet width the header now shows only the site's name, which stays a link back to Your signups, beside Help, Account and Sign out; the page's own heading says where you are. From tablet width up the whole trail shows, and only the current page's crumb shortens with "…" when the row is full, so the links before it keep their words. On Your signups, **New signup** stays on one line in Swedish at 320px, and the heading beside it wraps instead.
- A long slot name now shows in full on a signup's page, on up to two lines (#869). It was cut to one line with "…", so on a phone "Cupcakes or muffins (a dozen)" read "Cupcakes or muffins (a d…" and the amount only showed once a participant tapped **Sign up**. A name longer than two lines still ends in "…". The organizer's preview shows the same.
- On the Build tab, a group heading on a signup grouped by a Number or Time field is now set with the same control as a slot's value (#1051): a number box for a Number field, the list of times for a Time field. It was a free-text box, and on a Number grouping a heading that wasn't a number saved as "Saved" while blanking that field on every slot in the group, which then moved to the empty group after a reload. A Number value that isn't a number is now sent to the server, which refuses it, so the Build tab says the save failed and puts the old value back. The Build tab's own Group by choice still doesn't offer Number or Time fields; a signup gets one from Magic Compose, the REST API or an AI assistant.
Expand Down
28 changes: 28 additions & 0 deletions src/lib/magic-compose/to-template.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,34 @@ describe('magicComposeToTemplate', () => {
]);
});

it('treats an empty or space-only value as blank, not as a value that did not fit', () => {
const r = parseFull({
title: 'My signup',
fields: [
{ ref: 'what', label: 'What', fieldType: 'text' },
{ ref: 'day', label: 'Day', fieldType: 'date' },
{ ref: 'at', label: 'At', fieldType: 'time' },
{ ref: 'size', label: 'Size', fieldType: 'enum', choices: ['S', 'M'] },
{ ref: 'n', label: 'N', fieldType: 'number' },
],
slots: [
{ values: { what: ' ', day: ' ', at: ' ', size: ' ', n: ' ' } },
{ values: { what: '', day: '', at: '', size: '', n: '' } },
],
});
expect(r.template.slots.map((s) => s.values)).toEqual([{}, {}]);
expect(r.dropped.coercionFailures).toEqual([]);
});

it('still counts a real misfit beside a blank value', () => {
const r = parseFull({
title: 'My signup',
fields: [{ ref: 'day', label: 'Day', fieldType: 'date' }],
slots: [{ values: { day: ' ' } }, { values: { day: 'tomorrow' } }],
});
expect(r.dropped.coercionFailures).toEqual([{ slot: 1, ref: 'day', reason: 'date' }]);
});

it('returns empty dropped summary for a clean draft', () => {
const r = parseFull({
title: 'My signup',
Expand Down
6 changes: 5 additions & 1 deletion src/lib/magic-compose/to-template.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isBlankSlotValue } from '@/lib/blank-slot-value';
import type { SignupTemplate, SignupTemplateSlot } from '@/lib/signup-templates';
import { isRealDate, isRealTime } from '@/lib/reminder-fields';
import {
Expand Down Expand Up @@ -145,11 +146,14 @@ export function magicComposeToTemplate(
if (!dropped.strayValueKeys.includes(ref)) dropped.strayValueKeys.push(ref);
continue;
}
// Blank is no value, not one that didn't fit, and never reaches
// `Number()`, which reads '' and ' ' as 0.
if (isBlankSlotValue(raw)) continue;
const enumChoices = field.config.fieldType === 'enum' ? field.config.choices : undefined;
const coerced = coerceValue(field.fieldType, raw, enumChoices);
if (coerced !== undefined) {
values[ref] = coerced;
} else if (raw !== undefined && raw !== null && raw !== '') {
} else {
dropped.coercionFailures.push({ slot: i, ref, reason: field.fieldType });
}
}
Expand Down
23 changes: 23 additions & 0 deletions src/mcp/tools/signups-write.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,29 @@ describe('create_signup', () => {
expect(svc.createSignup).not.toHaveBeenCalled();
});

it('stores a slot whose value is only spaces without that value, rather than refusing', async () => {
svc.createSignup.mockResolvedValueOnce(ok(row));
svc.getSignupForOrganizer.mockResolvedValueOnce(ok(created));
const client = await connectTestClient(ctx, WRITE_TOOLS);
const r = await client.callTool({
name: 'create_signup',
arguments: {
title: 'Snack rota',
fields: [{ ref: 'date', label: 'Date', fieldType: 'date' }],
slots: [{ values: { date: '2026-10-03' } }, { values: { date: ' ' } }],
},
});
expect(r.isError, JSON.stringify(r.structuredContent)).toBeFalsy();
const [, , , , opts] = svc.createSignup.mock.calls[0] as [
unknown,
unknown,
unknown,
unknown,
{ template: { slots: Array<{ values: Record<string, unknown> }> } },
];
expect(opts.template.slots.map((s) => s.values)).toEqual([{ date: '2026-10-03' }, {}]);
});

// Magic Compose cuts an over-long description down; the tool refuses it, so
// the assistant can retry with a shorter one.
it('refuses a description over its limit and creates nothing', async () => {
Expand Down