Skip to content

UnvalidatedConfigArtifact

UnvalidatedConfigArtifact = { [K in typeof REQUIRED_BODY_ARRAY_FIELDS[number]]: unknown[] } & object

A config artifact as raw parsed JSON — what import playbook from './revturbine.playbook.json' produces.

This exists because TypeScript widens JSON modules to plain string/number property types, which can never satisfy the literal-typed ConfigArtifact (artifact_type: "playbook" etc.), so a strict-mode project could not pass the imported JSON without a cast.

Widening affects only literal types, so it is no reason to give up on the rest of the shape. The body arrays are structurally required here, which makes a truncated artifact a compile error at the localRuntime boundary rather than a runtime one — the whole point of plan 233. The header fields stay unconstrained because those are exactly the widened ones.

The required-field list is derived from REQUIRED_BODY_ARRAY_FIELDS, the same constant normalizeConfigArtifactOrThrow validates against at runtime, so the compile-time and runtime contracts cannot drift apart.

The index signature keeps every other field open: a Playbook carries many optional header fields, and a fetched artifact (await res.json(), typed any) still satisfies this, so the served path is not made harder to write — only harder to get silently wrong. Values are still validated at runtime by normalizeConfigArtifactOrThrow, which fails fast with a descriptive error; this type constrains the shape, never the values.