Sanity Library Reference Docs
    Preparing search index...
    • Classify an instance from its document alone — no evaluation, no reads, no actor. The transition-level causes need GROQ when results, so only diagnoseInstance reaches those.

      Sound but incomplete, and a consumer must present it that way: undefined means "no cause this classifier can see", never "healthy". Flag an instance on a cause; never word an absence as an all-clear.

      Parameters

      • args: {
            definition:
                | {
                    description?: string;
                    fields?: FieldEntry[];
                    groups?: Group[];
                    initialStage: string;
                    lifecycle?: WorkflowLifecycle;
                    name: string;
                    predicates?: Record<string, string>;
                    roleAliases?: RoleAliases;
                    semantics?: Semantic[];
                    stages: Stage[];
                    start?: StartBlock;
                    title: string;
                }
                | undefined;
            instance: Pick<
                WorkflowInstance,
                "currentStage"
                | "effectHistory"
                | "pendingEffects"
                | "stages",
            >;
        }
        • definition:
              | {
                  description?: string;
                  fields?: FieldEntry[];
                  groups?: Group[];
                  initialStage: string;
                  lifecycle?: WorkflowLifecycle;
                  name: string;
                  predicates?: Record<string, string>;
                  roleAliases?: RoleAliases;
                  semantics?: Semantic[];
                  stages: Stage[];
                  start?: StartBlock;
                  title: string;
              }
              | undefined

          The instance's parsed snapshot. Absent, the answer narrows — a failed effect cannot be tied to the activity it stalls — and never widens.

        • instance: Pick<
              WorkflowInstance,
              "currentStage"
              | "effectHistory"
              | "pendingEffects"
              | "stages",
          >

      Returns StuckCause | undefined