Skip to content

Snapshot validation reports named errors and non-fatal warnings

Validating a snapshot against a workflow definition answers with codes a caller can act on, and draws a hard line between what invalidates a snapshot and what is merely worth saying.

The rule

Normative: this is the rule
  1. Validating a snapshot against a workflow definition MUST yield a result carrying named codes.
  2. Each of the following errors MUST make the result invalid: a version mismatch; one unknown-node error per snapshot node absent from the definition; and one dependency-not-met error per completed node whose dependency has no recorded state or is neither completed nor skipped.
  3. The version check MUST be skipped when the snapshot's workflow version is absent.
  4. A version that is present MUST be compared, an empty one or a null included.
  5. The following warnings MUST NOT make the result invalid: one per definition node missing from the snapshot, and one per completed injected node that has dependencies.

What it means

Validating a snapshot against a workflow definition treats two kinds of mismatch very differently. A snapshot node the definition no longer knows — the graph changed under a run that is trying to resume into it — is an error: the result is invalid and a resume cannot go ahead. A definition node the snapshot has simply not reached yet is only a warning: that is the ordinary shape of a mid-run snapshot, and a warning that flipped the result to invalid would get every resumable snapshot refused.

The version check has an exception worth naming: a snapshot that carries no workflow version at all skips the comparison rather than counting as a mismatch. A snapshot built with no known version has nothing to compare, and treating "unknown" as "different" would refuse every such snapshot regardless of the definition it is checked against. An empty version is not "unknown": it is a version, the empty string, and is compared like any other.

Example

The workflow declares two nodes, node_1 and node_2. Only node_1 has completed so far.

A snapshot node the definition does not knowinvalid
{"id": "unknown_node"}
A definition node the snapshot has not reached yetvalid
{"id": "node_2"}
What validation reports for the second case
{"code": "WARNING_ORPHAN_NODE", "nodeId": "node_2"}

The first case invalidates the result; the second is recorded as a warning and the result stays valid.

Why

Recorded under OPEN-25, OPEN-26.

Fixtures

Test cases whose outcome this rule decides. A case compares absent, null and empty members exactly; the fixtures README defines each operation. Where a case and the rule disagree, the rule is right.

  • A snapshot with no workflow version skips the version check validate-snapshot
    {
      "given": {
        "definitionVersion": "3f2a9c0e1b7d4a65",
        "snapshot": {}
      },
      "expect": {
        "valid": true,
        "versionMismatch": false
      }
    }

    fixtures/presence/snap-version-absent-skipped.json

  • An empty workflow version is compared, and mismatches validate-snapshot
    {
      "given": {
        "definitionVersion": "3f2a9c0e1b7d4a65",
        "snapshot": {
          "workflowVersion": ""
        }
      },
      "expect": {
        "valid": false,
        "versionMismatch": true
      }
    }

    fixtures/presence/snap-version-empty-compared.json

  • A null workflow version is compared, and mismatches validate-snapshot
    {
      "given": {
        "definitionVersion": "3f2a9c0e1b7d4a65",
        "snapshot": {
          "workflowVersion": null
        }
      },
      "expect": {
        "valid": false,
        "versionMismatch": true
      }
    }

    fixtures/presence/snap-version-null-compared.json

Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0 · INT-8 · changed in spec 1.0