Skip to content

The review graph

winslow show --reviews prints the review cycle of one workflow as JSON: its producers, its reviewers in pipeline order, the content types between them, and the reviewers that each type of change wakes. A UI draws the graph from it, and an agent reasons about the cycle with it. The reviews page explains the cycle itself.

winslow show --reviews --workflow build --story genpei-war > graph.json

Pass the options of the workflow as for winslow run. The command builds the workflow as a run does: it calls get_parameters, should_be_initialized and is_eligible of the tasks, and fills the eager cache entries. The graph then comes from the declarations of the tasks alone. The JSON goes to stdout, and the log and every print of the workflow go to stderr.

An example

A producer with two types and three reviewers, one for each form of content_types:

{
  "schema_version": 1,
  "workflow": "build",
  "values": {"story": "genpei-war"},
  "producers": [
    {
      "key": "write-text-03c267ed", "task": "write-text",
      "groups": ["section-writer"], "agent_name": "section-writer-050",
      "parameters": {"section": "050"},
      "declares": ["fact", "wording"],
      "waits_for": ["fetch-sources-a07a6f44"],
      "constraints": {"checkability": ["BriefAgreed"]},
      "reviewers": ["check-layout-f573fbd1", "check-facts-25c6f45d", "edit-story-1ca49c0a"],
      "wakes": {"fact": ["check-facts-25c6f45d", "edit-story-1ca49c0a"],
                "wording": ["edit-story-1ca49c0a"],
                "untyped": ["check-layout-f573fbd1", "check-facts-25c6f45d", "edit-story-1ca49c0a"]}
    }
  ],
  "reviewers": [
    {
      "key": "check-layout-f573fbd1", "task": "check-layout",
      "groups": [], "agent_name": null, "parameters": {},
      "content_types": [], "max_reviews": 5,
      "reviewed": ["write-text-03c267ed"],
      "waits_for": ["write-text-03c267ed"],
      "constraints": {}
    },
    {
      "key": "check-facts-25c6f45d", "task": "check-facts",
      "groups": ["fact-checker"], "agent_name": "fact-checker-050",
      "parameters": {"section": "050"},
      "content_types": ["fact"], "max_reviews": 12,
      "reviewed": ["write-text-03c267ed"],
      "waits_for": ["write-text-03c267ed"],
      "constraints": {"checkability": ["BriefAgreed"]}
    },
    {
      "key": "edit-story-1ca49c0a", "task": "edit-story",
      "groups": [], "agent_name": null, "parameters": {},
      "content_types": null, "max_reviews": 5,
      "reviewed": ["write-text-03c267ed"],
      "waits_for": ["write-text-03c267ed", "check-facts-25c6f45d"],
      "constraints": {}
    }
  ]
}

The fields

Each task is named by its identity key, the name of its review folder. The graph holds the eligible tasks, in pipeline order. reviewers of a producer and reviewed of a reviewer are in pipeline order too.

Field Meaning
values the options of the workflow, as parsed
parameters the parameters of the task
declares the content_types of a producer: the types that a change of its work can have
content_types the types that ask a reviewer: null for every change, [] for an untyped change only, or a list
max_reviews the limit of the reviewer, from get_max_reviews()
waits_for the keys of the direct dependencies, without the premier and the terminal tasks
constraints the class names of each constraint list of the task that is not empty
wakes for each declared type and for untyped, the reviewers that a change of that type asks again

wakes is the answer of winslow.review.state.wakes() for each reviewer. An untyped change, such as each fix of the producer itself, asks every reviewer. A reviewer that makes a change is not asked again by it, so a typed change asks the reviewers of its row except its author.

The schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "The review graph of a workflow",
  "type": "object",
  "required": ["schema_version", "workflow", "values", "producers", "reviewers"],
  "properties": {
    "schema_version": {"const": 1},
    "workflow": {"type": "string"},
    "values": {"type": "object"},
    "producers": {"type": "array", "items": {"$ref": "#/$defs/producer"}},
    "reviewers": {"type": "array", "items": {"$ref": "#/$defs/reviewer"}}
  },
  "$defs": {
    "keys": {"type": "array", "items": {"type": "string"}},
    "task": {
      "type": "object",
      "required": ["key", "task", "groups", "agent_name", "parameters", "waits_for", "constraints"],
      "properties": {
        "key": {"type": "string"},
        "task": {"type": "string"},
        "groups": {"type": "array", "items": {"type": "string"}},
        "agent_name": {"type": ["string", "null"]},
        "parameters": {"type": "object"},
        "waits_for": {"$ref": "#/$defs/keys"},
        "constraints": {
          "type": "object",
          "propertyNames": {"enum": ["eligibility", "runnability", "checkability", "success"]},
          "additionalProperties": {"type": "array", "items": {"type": "string"}}
        }
      }
    },
    "producer": {
      "allOf": [{"$ref": "#/$defs/task"}],
      "required": ["declares", "reviewers", "wakes"],
      "properties": {
        "declares": {"type": "array", "items": {"type": "string"}},
        "reviewers": {"$ref": "#/$defs/keys"},
        "wakes": {
          "type": "object",
          "required": ["untyped"],
          "additionalProperties": {"$ref": "#/$defs/keys"}
        }
      }
    },
    "reviewer": {
      "allOf": [{"$ref": "#/$defs/task"}],
      "required": ["content_types", "max_reviews", "reviewed"],
      "properties": {
        "content_types": {"type": ["array", "null"], "items": {"type": "string"}},
        "max_reviews": {"type": "integer"},
        "reviewed": {"$ref": "#/$defs/keys"}
      }
    }
  }
}

A change of the shape raises schema_version.