api/ui: Allow per-scratch TTL (min 1m) #4

Closed
opened 2026-09-01 15:49:42 -05:00 by s1d3sw1ped · 1 comment
Owner

it would be quite convenient if scratches could be configured with different timeouts < then what it would have normally been down to a simple 1 minute as a minimum this should be configurable in the ui and api

it would be quite convenient if scratches could be configured with different timeouts < then what it would have normally been down to a simple 1 minute as a minimum this should be configurable in the ui and api

Triage (Linus):

Intent is clear enough. Today every scratch gets server limits.default_ttl (default 15m, hard cap 24h) — createScratch always passes DefaultTTLDuration, UI only displays it. No per-scratch TTL.

Scope for Ash (implement on develop, do not merge)

  1. API POST /api/scratch: accept an optional per-scratch TTL (form field or query — pick one, document it). Omit → keep current limits.default_ttl.
  2. Bounds: minimum 1m, maximum existing maxDefaultTTLLimit (24h). Reject out-of-range with 400. No infinite TTL.
  3. UI: control on upload so the user can pick a TTL down to 1 minute (and up to the server max / show default). Wire it into the create call.
  4. Persist expires_at as today; cleanup worker unchanged if it already keys off metadata expiry.
  5. Tests for min/max/default/omit paths. No LICENSE edits. Commit area: Imperative summary.

Out of scope: changing the server-wide default, rate limits, encryption, multi-file uploads.

Next action: Ash implements. Justin: if you wanted something other than Go-duration style TTL (e.g. only presets), say so on this issue before the PR lands.

Triage (Linus): Intent is clear enough. Today every scratch gets server `limits.default_ttl` (default `15m`, hard cap `24h`) — `createScratch` always passes `DefaultTTLDuration`, UI only displays it. No per-scratch TTL. ## Scope for Ash (implement on develop, do not merge) 1. **API** `POST /api/scratch`: accept an optional per-scratch TTL (form field or query — pick one, document it). Omit → keep current `limits.default_ttl`. 2. **Bounds:** minimum **1m**, maximum existing `maxDefaultTTLLimit` (`24h`). Reject out-of-range with 400. No infinite TTL. 3. **UI:** control on upload so the user can pick a TTL down to 1 minute (and up to the server max / show default). Wire it into the create call. 4. Persist `expires_at` as today; cleanup worker unchanged if it already keys off metadata expiry. 5. Tests for min/max/default/omit paths. No LICENSE edits. Commit `area: Imperative summary`. Out of scope: changing the server-wide default, rate limits, encryption, multi-file uploads. Next action: Ash implements. Justin: if you wanted something other than Go-duration style TTL (e.g. only presets), say so on this issue before the PR lands.
Ghost changed title from Feature: adjustable scratch timeouts to api/ui: Allow per-scratch TTL (min 1m) 2026-09-01 16:04:24 -05:00
Ghost closed this issue 2026-09-01 16:22:31 -05:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: s1d3sw1ped/scratchbox#4