mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
fix(daily): judge the briefing's day by when its text was written
The check that keeps an earlier day's briefing off the Today surfaces read the cache row's insightsCachedAt. Every warm moves that column, including the unchanged-hash short-circuit that keeps yesterday's text and only refreshes the stamp, so text written the day before passed as today's after the nightly warm. The cached payload now carries briefingGeneratedAt, written only where new text is written: a full generation in the warm and in the on-demand route, and the daily paragraph re-roll. The stamp refresh leaves it untouched. briefingForToday reads that moment, and a payload without it counts as not from today, so the hero falls back to its own lead until the next generation.
This commit is contained in:
1 parent
14a2931a99
commit
491d542f58
10 files changed
+193
-14
No files matched your search
@@ -11,6 +11,7 @@
|
||||
* write breaks that convergence — the settling seam tests pin the client
|
||||
* half, this comment is the server half of the contract.
|
||||
*/
|
||||
import { withBriefingGeneratedAt } from "@/lib/insights/briefing-generated-at";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { auditLog } from "@/lib/auth/audit";
|
||||
import {
|
||||
@@ -1051,7 +1052,9 @@ export const POST = apiHandler((request: NextRequest) =>
|
||||
},
|
||||
data: {
|
||||
insightsCachedAt: new Date(),
|
||||
insightsCachedText: JSON.stringify(insights),
|
||||
insightsCachedText: JSON.stringify(
|
||||
withBriefingGeneratedAt(insights, new Date()),
|
||||
),
|
||||
insightsCachedLocale: locale,
|
||||
insightsSnapshotHash: hashInsightSnapshot({
|
||||
features: compactFeatures,
|
||||
|
||||
Reference in new issue
Block a user