fix: opening balance direction, safe return paths, backup failure detection, review fixes

- opening balance: "person 2 owes person 1" was stored the wrong way round
- retour param: reject backslash/control chars (open redirect)
- backup: pipefail + check dump completeness, failed dumps no longer logged OK
- deleting a recurring occurrence marks it skipped so sync does not recreate it
- editing a charge regenerates future occurrences of incomes allocated to it
- settlements (incl. opening balance) listed in settings and deletable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
YugonitoandClaude Opus 5.5 committed 2026-10-27 18:51:49 +01:00
1 parent a0bcea4eb1
commit 5b402691f0
15 files changed
+222 -15

No files matched your search

+9 -2
View File
@@ -1,5 +1,7 @@
import { beforeEach, describe, expect, it } from "vitest";
import { computeBalances, describeBalance } from "@/domain/balance";
import { createHousehold, hashPassword, verifyPassword } from "@/server/auth";
import { toSettlement } from "@/server/mappers";
import { prisma } from "@/server/db";
import { resetDb } from "./helpers";
@@ -33,9 +35,14 @@ describe("createHousehold", () => {
const setting = await prisma.setting.findUniqueOrThrow({ where: { id: 1 } });
expect(setting.defaultSplit).toEqual({ [users[0].id]: 6000, [users[1].id]: 4000 });
const s = await prisma.settlement.findFirstOrThrow();
expect(s.fromUserId).toBe(users[1].id);
expect(s.toUserId).toBe(users[0].id);
expect(s.amount.toString()).toBe("150");
// « La personne 2 doit à la personne 1 » : le tableau de bord doit l'afficher ainsi.
const ids = users.map((u) => u.id);
expect(describeBalance(computeBalances([], [toSettlement(s)], ids))).toEqual({
debtor: users[1].id,
creditor: users[0].id,
amount: 15000,
});
});
it("skips the opening balance when empty", async () => {