mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 08:02:12 +00:00
feat(workouts): generate the per-workout insight on arrival, never on view
The spine dispatches a generator-free enqueue; the worker resolves the provider. Five gates stand in front of it in ascending cost order — both modules on, ten-minute duration floor, a hard count of four a day in the user's own timezone, an input hash over the deterministic evidence, and the token ledger inside the shared status chokepoint. Each refusal returns a status rather than throwing, because retrying against a ceiling that does not move until midnight is an unbounded loop. The detail route only reads: a workout with no row serves null and renders no card, which is every workout that predates this and every re-synced one. An undecryptable paragraph degrades to no card rather than failing the page.
This commit is contained in:
1 parent
e53a8ce8a0
commit
1a469301b3
9 files changed
+556
-29
No files matched your search
@@ -167,13 +167,21 @@ export interface WorkoutSportContextDto {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reserved Activity-Insight payload (strategic-concept Wave C, bet 5).
|
||||
* The wire field is `null` today; the Phase-2 job will populate it and
|
||||
* the detail page's seam mounts a card with zero rework. Declared here
|
||||
* so the type is stable in advance — widen the union (never change the
|
||||
* seam shape) when the job ships.
|
||||
* The per-workout Activity Insight, or `null`.
|
||||
*
|
||||
* The seam shape is unchanged from when it was reserved — the union widened,
|
||||
* nothing else. `null` remains the overwhelmingly common case and is not an
|
||||
* error state: a paragraph exists only for a workout that LANDED while the
|
||||
* feature was live, in a session over ten minutes, under the day's cap, with a
|
||||
* provider reachable. Every historical workout, every re-synced one, and every
|
||||
* workout on a provider-less install reads `null` and renders no card. Nothing
|
||||
* on this read path can ever trigger a generation.
|
||||
*/
|
||||
export type WorkoutActivityInsight = null;
|
||||
export type WorkoutActivityInsight = {
|
||||
/** Plain text. Rendered as React text children — there is no markdown here. */
|
||||
paragraph: string;
|
||||
generatedAt: string;
|
||||
} | null;
|
||||
|
||||
export interface WorkoutDetailPayload extends WorkoutListEntry {
|
||||
minHr: number | null;
|
||||
|
||||
Reference in new issue
Block a user