Sanity Library Reference Docs
    Preparing search index...

    One spawned child in the instance's workflow-scope registry (instance.subworkflows). A child instance is a real lake document whose lifetime is not bound to any stage, so its record lives at workflow scope — rows are never deleted, and a child's status is always derived from its document (or from SubworkflowEntry.resolved once it terminated).

    interface SubworkflowEntry {
        _key: string;
        abortPending?: { at: string; reason: string };
        action: string;
        activity: string;
        cohortStage: string;
        definition: string;
        ref: GlobalDocumentReference;
        resolved?: { aborted?: true; at: string; stage?: string };
        rowKey: string;
        spawnedAt: string;
        stageEntry: string;
    }
    Index

    Properties

    _key: string
    abortPending?: { at: string; reason: string }

    An abort the engine owes this child but could not perform inside the condemning commit (children are separate documents — aborting one is its own commit). Lives ON the row — a condemned child's whole story is one record — and survives a crash because the row persists; the cascade drains condemned rows (abort child → stamp SubworkflowEntry.resolved) idempotently, and the field stays afterwards as the audit of WHY. Set by a parent abort or an onExit: "abort" stage exit; a condemned row is never adopted into a fresh cohort.

    Type declaration

    • at: string

      The condemning commit's clock reading.

    • reason: string

      Why — recorded on the child's own abort history when the drain runs.

    action: string

    The spawning ACTION's name — rows key per (activity entry, spawning action), so two spawn actions on one activity can never cross-adopt each other's children.

    activity: string

    The spawning activity's name.

    cohortStage: string

    The cohort's stage NAME (denormalized from SubworkflowEntry.stageEntry for lake queries/inspectors). Deliberately not called stage: the child's own stage lives on resolved.stage and the $subworkflows var row.

    definition: string

    The child definition's name — adoption never crosses definitions.

    GDR of the child instance document.

    resolved?: { aborted?: true; at: string; stage?: string }

    Terminal cache, stamped when the engine observes the child terminal. Terminal state is immutable, so once stamped the child leaves the watch-set and status derives from here instead of its document.

    Type declaration

    • Optionalaborted?: true

      Set when the child was aborted rather than completing normally.

    • at: string

      The child's completedAt — or the drain's clock reading when the child document was already gone and only the disposition is known.

    • Optionalstage?: string

      The child's final stage. Absent when the child document vanished before the engine could observe it.

    rowKey: string

    Identity of the forEach row that produced this child — what adopt matching keys on: _key ?? _id ?? GDR id (a {id, type} row with a GDR-URI id) for object rows, the value itself for scalar rows.

    spawnedAt: string
    stageEntry: string

    _key of the StageEntry whose cohort this row currently belongs to. Re-adoption on a stage re-entry re-binds the row to the new entry; a row bound to an exited entry is a detached child — still tracked, still propagating, just outside any activity's implicit gate.