fix(client,sdk): the smaller silent failures, and a dead SDK test file

The SDK's parity suite had an unescaped apostrophe in an it() title, so the
file did not parse and vitest reported it as "no tests". Both guards in it
were dead - including the byte-identical egress-policy check the package's own
notes call the worst possible bug in that module to lose. No CI job runs the
SDK suite, so it landed quietly; the next npm publish would have failed on it,
since prepublishOnly runs the tests.

Also in the SDK: the dev preview answered trek:geolocation without checking
the geolocation:read grant, so a plugin whose manifest is missing the
permission works perfectly in dev and is dead once installed. That is the
lenient direction, which is the one that ships broken plugins.

Client side: the background-task poll never dismissed a 404'd import job and
spun forever, "Update All" collapsed its busy flag after the first plugin
settled, the lightbox had no cancellation so a slow signed URL rendered the
wrong image, the plugin geolocation watch was torn down by any unrelated
settings write, manual date entry accepted 31 February, cover previews were
never revoked, and check-all issued one request per packing item.
This commit is contained in:
Maurice
2026-08-23 10:08:38 +02:00
committed by Maurice
parent b3d8bf08f1
commit c75e958fc0
27 changed files with 476 additions and 53 deletions
@@ -229,6 +229,33 @@ describe('KategorieGruppe — bulk actions', () => {
await waitFor(() => expect(puts).toEqual([1]))
})
it('FE-W5CAT-011a: Check All sends the items together, not one round trip after another', async () => {
const started: number[] = []
let release = () => {}
const gate = new Promise<void>(resolve => { release = resolve })
server.use(
http.put('/api/trips/1/packing/:itemId', async ({ params }) => {
started.push(Number(params.itemId))
// The first item only answers once the second one has been sent, so a
// serialised loop would never get its second request out.
if (started.length === 1) await gate
return HttpResponse.json({ item: buildPackingItem({ id: Number(params.itemId) }) })
}),
)
const { container } = setup({
items: [
buildPackingItem({ id: 1, name: 'Tent', checked: 0 }),
buildPackingItem({ id: 2, name: 'Rope', checked: 0 }),
],
})
openCategoryMenu(container)
fireEvent.click(screen.getByText('Check All'))
await waitFor(() => expect(started).toHaveLength(2))
release()
})
it('FE-W5CAT-012: a failing PUT during Check All is reported by the store, once', async () => {
server.use(http.put('/api/trips/1/packing/:itemId', () => new HttpResponse(null, { status: 500 })))
seedStore(useTripStore, { packingItems: [buildPackingItem({ id: 1, name: 'Tent', checked: 0 })] })
@@ -99,16 +99,13 @@ export function KategorieGruppe({ kategorie, items, tripId, allCategories, onRen
}
// togglePackingItem rolls its own optimistic update back and reports the
// failure itself, so the bulk actions just drive it item by item.
// failure itself, so the bulk actions just drive it item by item. They go out
// together: serialised, a long list costs one round trip per item.
const handleCheckAll = async () => {
for (const item of Array.from(items)) {
if (!item.checked) await togglePackingItem(tripId, item.id, true)
}
await Promise.all(items.filter(i => !i.checked).map(i => togglePackingItem(tripId, i.id, true)))
}
const handleUncheckAll = async () => {
for (const item of Array.from(items)) {
if (item.checked) await togglePackingItem(tripId, item.id, false)
}
await Promise.all(items.filter(i => i.checked).map(i => togglePackingItem(tripId, i.id, false)))
}
const handleDeleteAll = async () => {
await onDeleteAll(items)