fix(medications): key the dedup pin guard on persisted attribution, not a timestamp shape

Every standalone intake anchors its slot on the take time since
v1.15.19, so guarding the nightly dedup on that shape excluded ordinary
drift duplicates from collapsing — the original point of the sweep.
Releasing a pinned dose now persists the user's choice on the row, the
dedup and the repair script key their exclusion on that flag, the read
model reports a released row as deliberately off-schedule instead of
re-snapping it within the anchor epsilon, and the attributed badge only
shows on rows actually bound to a slot. A few fixture names and stray
comments also drop personal references.
This commit is contained in:
Marc-André Bombeck committed 2026-06-10 17:33:56 +02:00
1 parent 04765ea8ac
commit a5650d0617
11 files changed
+267 -93

No files matched your search

@@ -57,7 +57,7 @@ describe("GET /api/user/profile", () => {
vi.mocked(getSession).mockResolvedValue(SESSION_OK as never);
vi.mocked(prisma.user.findUnique).mockResolvedValue({
username: "marc",
displayName: "Marc B.",
displayName: "Alex T.",
email: "marc@example.com",
dateOfBirth: new Date("1985-03-12T00:00:00.000Z"),
gender: "MALE",
@@ -77,7 +77,7 @@ describe("GET /api/user/profile", () => {
};
};
expect(body.data.username).toBe("marc");
expect(body.data.displayName).toBe("Marc B.");
expect(body.data.displayName).toBe("Alex T.");
expect(body.data.heightCm).toBe(180);
expect(body.data.locale).toBe("de");
});
@@ -137,7 +137,7 @@ describe("PATCH /api/user/profile", () => {
vi.mocked(prisma.user.update).mockResolvedValue({
id: "user-1",
username: "marc",
displayName: "Marc B.",
displayName: "Alex T.",
email: null,
role: "USER",
heightCm: null,
@@ -147,13 +147,13 @@ describe("PATCH /api/user/profile", () => {
locale: "de",
} as never);
const res = await PATCH(req({ displayName: "Marc B.", locale: "de" }));
const res = await PATCH(req({ displayName: "Alex T.", locale: "de" }));
expect(res.status).toBe(200);
expect(prisma.user.update).toHaveBeenCalledWith(
expect.objectContaining({
where: { id: "user-1" },
data: expect.objectContaining({
displayName: "Marc B.",
displayName: "Alex T.",
locale: "de",
}),
}),