Files
Pranay Prakash 15ce521e51 [core] Encode start({ retention }) as an integer duration
The server reads `$retention` as a duration written as a decimal integer,
not as the name of a mode: it honors the string `'0'`, and resolves
everything else — `'none'` included — to the plan default while counting it
as `retention.unsupported`. As written the two halves disagreed and the
option would have been inert, so the wire value moves to `'0'`.

The unit that duration is measured in has deliberately not been decided
yet. It will most likely be seconds or milliseconds, chosen for
granularity, and explicitly not days. Zero is the one value that means the
same thing in every unit, which is exactly why it can ship ahead of that
decision: it commits to a shape — a number, so the namespace has somewhere
to grow — without committing to a scale.

That is also why the option is typed `0 | 'default'` rather than
`number | 'default'`. Someone writing `retention: 7` today has no unit to
have meant it in, and the server would quietly keep their data; the literal
type makes that a compile error, and a runtime guard makes it a thrown
error for untyped JS callers. The arbitrary-string pass-through goes for
the same reason — its only example, `'90d'`, baked in a unit — and callers
targeting a World with its own retention vocabulary still have the
documented escape hatch of writing `$retention` through `attributes` with
`allowReservedAttributes`.

With arbitrary strings gone, the empty-value and max-byte-length checks are
unreachable (a fixed one-byte value cannot fail either), so they go too
rather than sit as dead branches.
2026-08-27 21:49:25 -07:00
..
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00

Workflow SDK docs

Check out the docs here