The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
chore(lint): keep the fixes within the lint ratchets
Maurice8a9f5367b1da
diff --git a/client/src/components/Help/HelpGuideView.test.tsx b/client/src/components/Help/HelpGuideView.test.tsxindex da274fd04..f2ba9a3bf 100644--- a/client/src/components/Help/HelpGuideView.test.tsx+++ b/client/src/components/Help/HelpGuideView.test.tsx@@ -29,10 +29,15 @@ describe('HelpGuideView: links', () => {})it('takes an admin guide to the tab its settings sit under', () => {- const { unmount } = render(<HelpGuideView guide={getHelpGuide('instance-keys')!} />)+ const guideOf = (id: string) => {+ const guide = getHelpGuide(id)+ if (!guide) throw new Error(`no guide ${id}`)+ return guide+ }+ const { unmount } = render(<HelpGuideView guide={guideOf('instance-keys')} />)expect(screen.getByRole('link', { name: /^Go to/ })).toHaveAttribute('href', '/admin?tab=services')unmount()- render(<HelpGuideView guide={getHelpGuide('auth-methods')!} />)+ render(<HelpGuideView guide={guideOf('auth-methods')} />)expect(screen.getByRole('link', { name: /^Go to/ })).toHaveAttribute('href', '/admin?tab=settings')})})diff --git a/client/src/components/Help/HelpGuideView.tsx b/client/src/components/Help/HelpGuideView.tsxindex a4f542c2c..ccecd6a4f 100644--- a/client/src/components/Help/HelpGuideView.tsx+++ b/client/src/components/Help/HelpGuideView.tsx@@ -18,6 +18,11 @@ const prefersReducedMotion = (): boolean =>const stepMedia = (guide: HelpGuide, n: number): string =>guide.media.clips?.includes(n) && !prefersReducedMotion() ? helpMedia.clip(guide.id, n) : helpMedia.step(guide.id, n)+/** Where a guide's "go to" link leads: its own route, else its screen's. */+function routeOf(guide: HelpGuide, screen: ReturnType<typeof getHelpContext>): string | undefined {+ return guide.route ?? screen?.route+}+/*** One guide, top to bottom: a header card that says where you are and how big* the task is, the steps as a numbered rail with a picture each, what the@@ -38,7 +43,7 @@ export default function HelpGuideView({ guide }: { guide: HelpGuide }): React.Reconst related = (guide.related ?? []).map(getHelpGuide).filter((g): g is HelpGuide => g !== null)const Icon = helpIcon(guide.icon)const ScreenIcon = screen ? helpIcon(screen.icon) : Icon- const screenRoute = useScreenRoute(guide.route ?? screen?.route)+ const screenRoute = useScreenRoute(routeOf(guide, screen))return (<div className="trek-help-view flex flex-col gap-6">diff --git a/client/src/mobile/components/NativeImportSheet.test.tsx b/client/src/mobile/components/NativeImportSheet.test.tsxindex befb4ec20..0d0b7c454 100644--- a/client/src/mobile/components/NativeImportSheet.test.tsx+++ b/client/src/mobile/components/NativeImportSheet.test.tsx@@ -208,7 +208,9 @@ describe('NativeImportSheet', () => {answer = () => resolve([]);}));- act(() => void useTripAddonsStore.getState().load(1));+ await act(async () => {+ void useTripAddonsStore.getState().load(1);+ });expect(screen.getByRole('button', { name: /Japan/ })).toBeInTheDocument();await act(async () => answer());expect(screen.getByRole('button', { name: /Japan/ })).toBeInTheDocument();diff --git a/client/src/pages/admin/useAdmin.test.tsx b/client/src/pages/admin/useAdmin.test.tsxindex 1aa40af94..e9fcbbe93 100644--- a/client/src/pages/admin/useAdmin.test.tsx+++ b/client/src/pages/admin/useAdmin.test.tsx@@ -1031,9 +1031,13 @@ describe('useAdmin', () => {await waitFor(() => expect(result.current.admin.isLoading).toBe(false));expect(result.current.admin.activeTab).toBe('security');- act(() => void result.current.navigate('/admin?tab=services'));+ await act(async () => {+ await result.current.navigate('/admin?tab=services');+ });expect(result.current.admin.activeTab).toBe('services');- act(() => void result.current.navigate('/admin?tab=settings'));+ await act(async () => {+ await result.current.navigate('/admin?tab=settings');+ });expect(result.current.admin.activeTab).toBe('security');act(() => result.current.admin.setActiveTab('audit'));expect(result.current.admin.activeTab).toBe('audit');diff --git a/client/src/pages/tripPlanner/useRoadtripStopEdits.ts b/client/src/pages/tripPlanner/useRoadtripStopEdits.tsindex a7cd7d223..5095c7cb2 100644--- a/client/src/pages/tripPlanner/useRoadtripStopEdits.ts+++ b/client/src/pages/tripPlanner/useRoadtripStopEdits.ts@@ -49,8 +49,12 @@ async function writeEditedStop(tripId: PlannerBase['tripId'],assignments: TripStoreState['assignments'],{ placeId, assignmentId, dwellMinutes: before }: { placeId: number; assignmentId?: number; dwellMinutes?: number },- { stopType, dwellMinutes }: { stopType: RoadtripStopType | null; dwellMinutes: number },- { mayEditVisit, refused }: { mayEditVisit: boolean; refused: string },+ {+ stopType,+ dwellMinutes,+ mayEditVisit,+ refused,+ }: { stopType: RoadtripStopType | null; dwellMinutes: number; mayEditVisit: boolean; refused: string },): Promise<void> {const visitDayId = savedVisitDayOf(assignments, assignmentId)if (assignmentId == null || visitDayId === null) {@@ -101,7 +105,9 @@ export function useRoadtripStopEdits(options: RoadtripStopEditsOptions) {}try {if (stopDraft.editing) {- await writeEditedStop(tripActions, tripId, assignments, stopDraft.editing, { stopType, dwellMinutes }, {+ await writeEditedStop(tripActions, tripId, assignments, stopDraft.editing, {+ stopType,+ dwellMinutes,mayEditVisit: can('day_edit', trip),refused: t('trip.journal.errorForbidden'),})diff --git a/client/src/store/tripAddonsStore.ts b/client/src/store/tripAddonsStore.tsindex 2198bdd87..c3734c3f4 100644--- a/client/src/store/tripAddonsStore.ts+++ b/client/src/store/tripAddonsStore.ts@@ -70,7 +70,11 @@ export const useTripAddonsStore = create<TripAddonsState>((set, get) => ({// A push that landed meanwhile is newer than this answer and stays, in the// store and in the device's copy the answer was written over.if (current && current.rev !== rev) {- if (addons && current.addons) void tripAddonsRepo.remember(tripId, current.addons).catch(() => {});+ if (addons && current.addons)+ void tripAddonsRepo.remember(tripId, current.addons).catch(() => {+ // The device copy stays one answer behind until the next read of this trip writes it.+ return undefined;+ });return current.addons;}const entry: TripAddonsEntry = addonsdiff --git a/server/src/nest/integrations/dawarich-sync.service.ts b/server/src/nest/integrations/dawarich-sync.service.tsindex c640c4e51..f3913cd82 100644--- a/server/src/nest/integrations/dawarich-sync.service.ts+++ b/server/src/nest/integrations/dawarich-sync.service.ts@@ -362,11 +362,14 @@ export class DawarichSyncService {* @txIndependent one stay at a time after its network read.*/private async rereadUnnamed(nameStay: StayNamer): Promise<void> {- for (const stay of nameStay.unnamed.slice(0, MAX_UNNAMED_STAY_REREADS)) {+ // One after another: a read that finds the budget spent stops the rest.+ await nameStay.unnamed.slice(0, MAX_UNNAMED_STAY_REREADS).reduce<Promise<boolean>>(async (going, stay) => {+ if (!(await going)) return false;const found = await nameStay.read(stay.startedAt, stay.endedAt);- if (found === undefined) return;+ if (found === undefined) return false;if (found !== null) await this.suggestions.renameNewVisit(stay.id, found);- }+ return true;+ }, Promise.resolve(true));}/**diff --git a/server/src/nest/plugins/plugin-event-addons.ts b/server/src/nest/plugins/plugin-event-addons.tsindex 5d38792c7..900c2f8c4 100644--- a/server/src/nest/plugins/plugin-event-addons.ts+++ b/server/src/nest/plugins/plugin-event-addons.ts@@ -47,7 +47,7 @@ export function tripEventSink(addons: AddonsService, orm: MikroORM | undefined,return (tripId, event, meta) => {const addonId = tripAddonOfEvent(event);const before = queues.get(tripId);- if (!addonId && !before) return deliver(tripId, event, meta);+ if (!addonId && before === undefined) return deliver(tripId, event, meta);const ask = () => (addonId ? addons.isEnabledForTrip(tripId, addonId) : Promise.resolve(true));const on = (orm && addonId ? withRequestContext(orm, ask) : ask()).catch(() => false);const queued = (before ?? Promise.resolve())diff --git a/server/tests/postgres/backup-round-trip.test.ts b/server/tests/postgres/backup-round-trip.test.tsindex 4473396c1..c2e64a620 100644--- a/server/tests/postgres/backup-round-trip.test.ts+++ b/server/tests/postgres/backup-round-trip.test.ts@@ -82,10 +82,7 @@ afterAll(async () => {describe('Postgres backup round trip', () => {it('PGRT-001: a dump restores over a changed schema, dropping what came later, views and functions included', async (ctx) => {- if (unfit) {- console.log(`PGRT-001 skipped: ${unfit}`);- ctx.skip();- }+ if (unfit) ctx.skip(`PGRT-001 skipped: ${unfit}`);await asOwner((run) =>oneByOne([diff --git a/server/tests/unit/db/engine/postgres/script-settings.test.ts b/server/tests/unit/db/engine/postgres/script-settings.test.tsindex 65d782337..ccf227f52 100644--- a/server/tests/unit/db/engine/postgres/script-settings.test.ts+++ b/server/tests/unit/db/engine/postgres/script-settings.test.ts@@ -54,9 +54,9 @@ describe('script-settings', () => {'SCRIPTSET-001: a PostgreSQL %i server gets the script without SET transaction_timeout, and nothing else changes',async (major) => {const expected = SCRIPT.replace('SET transaction_timeout = 0;\n', '');- for (const size of [1, 3, 7, 64, 1 << 20]) {- expect(await filtered(SCRIPT, major, size), `chunks of ${size}`).toBe(expected);- }+ const sizes = [1, 3, 7, 64, 1 << 20];+ const results = await Promise.all(sizes.map((size) => filtered(SCRIPT, major, size)));+ results.forEach((result, i) => expect(result, `chunks of ${sizes[i]}`).toBe(expected));},);diff --git a/server/tests/unit/db/migrate-encryption-parity.test.ts b/server/tests/unit/db/migrate-encryption-parity.test.tsindex b4840ca57..2fd1f6112 100644--- a/server/tests/unit/db/migrate-encryption-parity.test.ts+++ b/server/tests/unit/db/migrate-encryption-parity.test.ts@@ -459,7 +459,7 @@ describe('migrate-encryption.ts rotates the stores the app writes', () => {token: string | null;}>;after.close();- expect(decryptWith('new-key', rows[0].token!)).toBe('wanderer-token');+ expect(decryptWith('new-key', String(rows[0].token))).toBe('wanderer-token');expect(rows[1].token).toBeNull();}, 30000);diff --git a/server/tests/unit/mcp/tools-files.test.ts b/server/tests/unit/mcp/tools-files.test.tsindex 332c094b3..1901efba0 100644--- a/server/tests/unit/mcp/tools-files.test.ts+++ b/server/tests/unit/mcp/tools-files.test.ts@@ -688,7 +688,7 @@ describe('Tool: upload_trip_file', () => {name: 'upload_trip_file',arguments: { tripId: trip.id, filename: 'receipt.pdf', content: pdf, budget_item_id: expense.id },}),- ) as any;+ ) as { file: { id: number } };expect((await linkRows(data.file.id)).map((l) => l.budget_item_id)).toEqual([expense.id]);const foreign = await h.client.callTool({name: 'upload_trip_file',@@ -713,8 +713,8 @@ describe('Tool: upload_trip_file', () => {name: 'upload_trip_file',arguments: { tripId: trip.id, filename: 'ticket.pdf', content: pdf },}),- ) as any- ).file.id as number;+ ) as { file: { id: number } }+ ).file.id;const receipt = await upload();const refused = await h.client.callTool({name: 'update_trip_file',diff --git a/server/tests/unit/nest/files.service.test.ts b/server/tests/unit/nest/files.service.test.tsindex 465f68e56..bddf7394c 100644--- a/server/tests/unit/nest/files.service.test.ts+++ b/server/tests/unit/nest/files.service.test.ts@@ -386,8 +386,12 @@ describe('listFiles', () => {const files = (await svc.listFiles(trip.id, false, true)) as Record<string, unknown>[];expect(files.map((f) => f.id).sort()).toEqual([onBooking.id, onPlace.id, receipt.id].sort());- expect(await svc.isAttached((await svc.getFileById(receipt.id, trip.id))!)).toBe(true);- expect(await svc.isAttached((await svc.getFileById(loose.id, trip.id))!)).toBe(false);+ const [receiptRow, looseRow] = await Promise.all([+ svc.getFileById(receipt.id, trip.id),+ svc.getFileById(loose.id, trip.id),+ ]);+ expect(receiptRow && (await svc.isAttached(receiptRow))).toBe(true);+ expect(looseRow && (await svc.isAttached(looseRow))).toBe(false);});});diff --git a/server/tests/unit/nest/mail-ingest/mail-ingest.controller.test.ts b/server/tests/unit/nest/mail-ingest/mail-ingest.controller.test.tsindex 49f66e9f9..b05fe486f 100644--- a/server/tests/unit/nest/mail-ingest/mail-ingest.controller.test.ts+++ b/server/tests/unit/nest/mail-ingest/mail-ingest.controller.test.ts@@ -129,14 +129,16 @@ describe('the mail tools', () => {it('are listed only while the import is on, since every call needs it', async () => {expect(tools).toHaveLength(7);- for (const name of tools) {+ // One tool after another: each takes the next answer of the settings stub.+ await tools.reduce(async (previous, name) => {+ await previous;const entry = getEntry(MailIngestMcp as unknown as ClassRef, name);const when = entry?.kind === 'tool' ? entry.options.when : undefined;expect(when, name).toBeTypeOf('function');settings.isAvailable.mockResolvedValueOnce(false);expect(await when?.(ctx, mcp()), name).toBe(false);expect(await when?.(ctx, mcp()), name).toBe(true);- }+ }, Promise.resolve());});});diff --git a/server/tests/unit/nest/reservations.service.test.ts b/server/tests/unit/nest/reservations.service.test.tsindex 4253761db..10239e172 100644--- a/server/tests/unit/nest/reservations.service.test.ts+++ b/server/tests/unit/nest/reservations.service.test.ts@@ -1548,10 +1548,12 @@ describe('ReservationsService — referenced ids stay inside the trip', () => {const foreignDay = await findRow(orm, Days, { trip: theirs.id }) as { id: number };const foreignAcc = createDayAccommodation(testDb, theirs.id, foreignPlace.id, foreignDay.id, foreignDay.id);- for (const accommodation_id of [3000000000, foreignAcc.id]) {+ const dropped = async (accommodation_id: number) => {const { reservation } = await svc.create(String(mine.id), { title: 'Hotel', type: 'hotel', accommodation_id });expect(await findRow(orm, Reservations, { id: reservation.id })).toMatchObject({ accommodation_id: null });- }+ };+ await dropped(3000000000);+ await dropped(foreignAcc.id);});it('RESV-SCOPE-011: a stay whose refs resolve to nothing is refused, never written and never dropped in silence', async () => {