Every question the Cookbook pages answer
The 6 cookbook pages answer 24 named questions between them. Every one is listed below, and every link lands on the paragraph that answers it rather than the top of the page.
Recipe: Single-Flight Refresh-Token Rotation
- Is this recipe safe to paste into a production backend?It is written to be, with one caveat about scale. The logic — per-user single flight, atomic persistence, bounded retry, dead-grant…
- How would I plug my own database into the grant store?Implement two methods: load(userId), returning the stored record or null, and save(userId, record), writing the whole record in one…
- What does the client do when the token endpoint returns 503 rather than invalid_grant?It raises a retryable error and leaves the stored grant completely untouched. That distinction is deliberate: invalid_grant means the…
- Does the recipe still work with a provider that does not rotate refresh tokens?Yes, and that is the point of writing it this way. When the token response omits refresh_token, the client keeps the one it already had, so…
Recipe: A Replay-Safe Health Webhook Receiver
- Why acknowledge a delivery that blew up inside the handler?Because replaying the same bytes hits the same defect. The signature already proved who sent it, so answering with a 500 buys nothing…
- Why does the enqueued job carry a window instead of the numbers from the payload?Most fitness notifications are change pointers rather than data carriers, so the values in the body are either absent or untrustworthy.…
- Which parts of this file will I have to rewrite for my provider?Three, and they are isolated for exactly that reason. The hmac function, because signature schemes differ per vendor and some are not…
- What stops a late delivery from resurrecting a user who asked to be erased?Subject resolution happens before any store is touched, and an unresolvable subject is acknowledged and dropped with no row written…
Recipe: A Rate-Limit-Aware Fetch Wrapper
- Why does a 429 not count towards opening the circuit?A provider answering 429 is healthy and telling you the truth about your allowance. Tripping a breaker on it would degrade a service that…
- What makes full jitter better than a fixed backoff here?A fixed backoff passes every single-user test you will ever write and then synchronizes your whole fleet onto the same second the moment a…
- Why does the wrapper return an envelope instead of throwing on failure?Because a backfill worker handling hundreds of windows should park the ones it could not read and carry on, not die on the first outage.…
- How does the wrapper decide a call is too risky to replay?It looks at the method, and you can override it per call. GET, HEAD, OPTIONS, PUT and DELETE are treated as safe to repeat; POST and PATCH…
Day-Boundary Rollup: Grouping Samples by Civil Date
- Where in a health pipeline should the local date get computed?At ingest, once, on the write path, and then stored as a real column. The writer in this recipe takes the instant and the UTC offset in…
- What should the writer do with a sample that arrives without an offset?Refuse it, loudly, rather than filling in a value. This implementation throws a TypeError instead of defaulting to UTC or to the device's…
- How do I exercise a 23-hour day in tests without waiting for March?Inject the zone as a piecewise offset series rather than reading a real timezone database. The recipe's createOffsetSeries takes a list of…
- Can the rollup run against a real database rather than the in-memory store?Yes, and it is designed for that swap. The writer only ever calls put on whatever store you hand it, so a Postgres upsert keyed on the…
Rep Counter: A State Machine and the Scorer That Guards It
- What smoothing constant should the EMA use for a joint angle?There is no right value to copy, which is why it is a constructor argument here rather than a baked-in number. It is a straight trade: a…
- How do I choose the two hysteresis thresholds for a new exercise?Start from the joint whose angle swings most cleanly through the movement in the camera plane, then set the entry thresholds inside each…
- Can I score the counter against keypoints my own pose model produced?Replaying recorded keypoint sequences captured from a real device run is exactly right, and this recipe is built for it: every frame…
- Why does the scorer return a null precision instead of a perfect score?Because a clip where nothing was predicted has no evidence about precision, and reporting 1.0 there would let a counter that fired zero…
Backfill Checkpointer: A Resumable Window Walker
- Should the checkpoint be written before or after a window commits?After, always, and the ordering is the only reason this recipe offers any guarantee at all. Fetch, then commit, then checkpoint. Written in…
- What should a backfill worker do when its retry budget runs out on a window?Record the window and why it failed, then move on to the next one. Never mark it done and never let the walk stop. This implementation…
- How do I stop a recorded gap from being rendered as a zero-activity day?Keep the gap list as a first-class input to the display layer rather than as a log line. The walker returns the gaps and persists them, and…
- Is it safe to run two workers against one checkpoint store?Not as written, and that is deliberate. This walker owns its job and assumes one runner, because the guarantee it makes is about crash…
Back to the Cookbook hub, or see every question this site answers.