chore(release): v1.4.38

Robustness sweep, perf hotspots, full localization, coach gate
cascade closure.

- /api/dashboard/summary cold-mount 4.6 s → ~500 ms via DAY-bucket
  sparkline + 60 s response cache.
- Coach API gate inventory test surfaced and closed two orphan
  routes (chat[id] GET+DELETE, chat-message feedback POST).
- Cross-tz fast-path runtime guard falls back to live for users
  more than ±3 h from UTC; proper bucket minting stays v1.5.
- es / fr / it / pl coverage 27 % → 63 % (~3 400 new strings) plus
  three medication-cluster placeholder restorations.
- IANA timezone validation closes the User.timezone self-DoS
  regression the new dashboard SQL would have surfaced.
- Unit suite 4520 → 4524.

See CHANGELOG.md for the full set.
This commit is contained in:
Marc-André Bombeck committed 2026-05-17 19:07:03 +02:00
1 parent fe64f66c7f
commit a550031a84
66 files changed
+7910 -3717

No files matched your search

@@ -235,4 +235,40 @@ describe("measurement validation", () => {
expect(parsed.success).toBe(false);
});
});
// v1.4.38 — the per-day drill-down branch always returns at most
// 1000 rows (one pathological phone-only stepCount day). Push the
// cap into the validator so a caller asking for more sees a 422
// instead of a silent server-side Math.min clamp.
describe("listMeasurementsSchema — v1.4.38 dayKey limit ceiling", () => {
it("accepts limit=1000 alongside a dayKey", () => {
const parsed = listMeasurementsSchema.safeParse({
type: "ACTIVITY_STEPS",
dayKey: "2026-05-15",
limit: 1000,
});
expect(parsed.success).toBe(true);
});
it("rejects limit=1001 when dayKey is set (drill-down hard cap)", () => {
const parsed = listMeasurementsSchema.safeParse({
type: "ACTIVITY_STEPS",
dayKey: "2026-05-15",
limit: 1001,
});
expect(parsed.success).toBe(false);
if (!parsed.success) {
expect(parsed.error.issues[0].message).toMatch(/<=\s*1000/);
expect(parsed.error.issues[0].path).toEqual(["limit"]);
}
});
it("accepts limit=5000 when dayKey is omitted (legacy ceiling)", () => {
const parsed = listMeasurementsSchema.safeParse({
type: "ACTIVITY_STEPS",
limit: 5000,
});
expect(parsed.success).toBe(true);
});
});
});
+13 -1
View File
@@ -325,7 +325,19 @@ export const listMeasurementsSchema = z
"offset is not supported with groupBy=day or dayKey; use a smaller window or omit offset",
path: ["offset"],
},
);
)
// v1.4.38 — surface the drill-down cap on the validator so a caller
// asking for more than 1000 rows on a per-day branch sees a 422
// instead of a silent `Math.min(limit, 1000)` clamp inside the
// route. The drill-down returns at most one phone-only stepCount
// day's worth of per-sample chunks; 1000 covers the pathological
// case with room to spare. Callers that want a wider window should
// omit `dayKey` and use `from` / `to` instead.
.refine(({ limit, dayKey }) => !(dayKey != null && limit > 1000), {
message:
"limit must be <= 1000 when dayKey is set; drill-down responses are capped at 1000 rows",
path: ["limit"],
});
export const createBatchMeasurementSchema = z.object({
measurements: z.array(createMeasurementSchema).min(1).max(5),