fix(mail-ingest): compare look-alike bookings at their wall time on any server zone

The window around a booking's start went through the host time zone, so on a server outside UTC it missed a booking at the same local time and added it twice.
This commit is contained in:
Maurice
2026-11-23 14:56:18 +01:00
parent dea903f011
commit eaa557343e
2 changed files with 21 additions and 1 deletions
@@ -557,6 +557,24 @@ describe('what a mail names', () => {
});
});
it('sees a booking at the same wall time as a look-alike whatever zone the server runs in', async () => {
const zone = process.env.TZ;
process.env.TZ = 'Asia/Tokyo';
try {
const user = await person();
await makeTrip(orm(), user.id, { start_date: '2030-03-01', end_date: '2030-03-10' });
machine.mockResolvedValue([DINNER]);
await forward(user.id, eml('dinner', 'Fwd: Your table', BOTH));
machine.mockResolvedValue([{ ...DINNER, title: 'Sora dinner' }]);
const [again] = await entriesOf(await forward(user.id, eml('dinner-again', 'Fwd: Your table', BOTH)));
expect(again).toMatchObject({ resolution: 'pending', reason: 'possible_duplicate' });
} finally {
if (zone === undefined) delete process.env.TZ;
else process.env.TZ = zone;
}
});
});
describe('a mail that keeps failing', () => {