Metadata-Version: 2.5
Name: trytond_score_design
Version: 8.0.0.1
Summary: Score Workflow Design
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: definition,export,import,score,tryton,workflow
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Requires-Python: >=3.10
Requires-Dist: trytond-score<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

Score Design Module
===================

The ``score_design`` module is the authoring and portability layer of the
``score`` workflow engine.  It is where a definition is authored, it moves one
between deployments, it versions one in source control, it reports what is wrong
with one, and it starts a designer from a template or from a palette of patterns
rather than from an empty screen.

A definition is exported as a *document*: a versioned payload holding the
workflow, its states, its transitions, the guards of the transitions and the
actions they run, written as canonical JSON or as an XML file in the data file
style of the core.  ``schema_version`` is written with every document and
checked on import, so a document produced by a newer module is refused rather
than half read.  A document carries the state machine alone: the runtime data
of the engine - instances, tokens, history - is structurally out of its reach.

An import is a decision rather than a copy: the operator picks a conflict
policy, every element of the document is planned as a creation, an update or a
skip, the plan is shown before anything is written, and a reference the target
deployment can not resolve - a model the pool does not know, a method the model
does not provide, a state code the state field of the model does not offer - is
reported per element.  The plan is applied in a savepoint, so an import that
fails leaves the definition exactly as it was.

A definition is authored on one screen rather than in the four models the engine
stores it in: the designer reads the workflow, the states it declares and the
transitions that leave them together, draws the machine beside them, and authors
the transitions of a state from the state.  That screen *is* the definition of
the engine, so a machine is authored without importing anything and there is no
second copy of it to keep in step.

A definition describes a machine nobody runs yet, and a defect of such a machine
is read from the definition rather than from a run: the module reports on demand
a state no path reaches, a region of the machine a run can not leave, a gate
that can never open and an action no deployment can run, as the sentences an
operator fixes.  What is reported is the definition - the payload a publish
would freeze - and not the runs it recorded.

The module also ships a small library of ready-made definitions - a linear
approval, a four-eyes review, an escalation ladder and a simple ticket
lifecycle - as data of the module.  Installing one writes the same document the
import writes, so a template is authored once and then maintained as a
definition like any other.

Beside the templates the module ships a palette of patterns - an approval gate,
a four-eyes check, an escalation ladder and a rework loop - which are grafted
into a machine that is already there.  Inserting a snippet is the import of its
document: the codes of a snippet are what it attaches by, an element the machine
already holds is left exactly as it is, and the plan of the insertion is shown
before anything is written.

The module is a soft addition to a deployment: it registers the ``score`` groups
it reuses, it adds two models of its own - the template library and the palette
- and two fields to the definition models of the engine (the drawing of a
definition on the workflow, and the transitions that leave a state on a state,
which is a field of a relation rather than a column of the database), and it
never reads or writes the runtime of the engine.
