Repository navigation
divide 0.9.0
divide 0.9.0 simulates Runner Flows. Runner 0.3 runs the Flow with test doubles: every condition and activity is answered by a double you declare, and no Function of the project is loaded or called. divide then replays Runner's trace on the Flow's board, event by event, forwards and backwards. A paused simulation resumes in a new process, and the playback goes on.
Simulate a Flow
Open it with:
- Shift+F9 in a Flow's code, its Flow window or its board;
- Run > Simulate Flow with doubles;
- S on the Flow Designer's board.
The dialog:
- Initial context: a JSON file, or a JSON object typed in the field.
- Doubles: Runner's own
--simulatefile, by default.div/simulations/<flow>.doubles.json, a file the team can share. A double returns a value, throws, pauses, follows a sequence or runs a nested YAML Flow, and can merge keys into the context. - Keep error and log messages in the trace: off by default, because a message could hold a secret.
Before anything runs, the dialog lists the functions that still need a double, and refuses an incomplete or malformed file. Edit doubles writes a complete template, or adds the missing doubles, and opens the file. Replay reopens the last simulation without running PHP.
A modified Flow is simulated as it is in the editor, from a copy of its YAML. Your file is not saved or written.
The Simulation window
The Flow's board, read-only, with a mark on each Step's card:
| Mark | The Step |
|---|---|
► |
current |
√ |
visited |
- |
skipped |
» |
waiting for its call |
= |
paused |
X |
failed |
The call and jump lines taken are underlined. The marks are characters, so they read the same in every theme.
The panel shows the event: its Block.Step, a condition's result, a CALL that returns here or a JUMP that does not return, the RETURN and whether its frame came from the checkpoint, an activity's result or error, the context's changes, the logs, the calls waiting to return, and Runner's exact _flow_state and _flow_stack. At the bottom, it shows how the simulation ended, whether the trace was cut, and whether the Flow or its doubles changed since.
Keys:
| Key | Does |
|---|---|
| F7 / Shift+F7 | next / previous event |
| F8 / Shift+F8 | next / previous Step |
| Ctrl+Home / Ctrl+End | first / last event |
| F4, or Enter on a card | the selected Step's next event |
| F | follow the current Step |
| X | the context at the event, in Output |
| Ctrl+F2 | back to the first event |
| Ctrl+F9 | resume a paused simulation |
Moving through the events changes nothing: not the events, the context, the YAML or any file.
Pause and resume
A paused simulation resumes from Runner's simulation session, in a new PHP process, and its events are added to the same playback. If the Flow or its doubles changed, divide asks first, and the resume uses what the simulation started with. Runner refuses a changed nested Flow, and the simulation can still be resumed once it is restored.
Kept apart from a real run
- Ctrl+F9 is still the real Run. Its dialog now says REAL RUN, with side effects.
- Separate folders. Simulations live in
.div/simulation/, ignored by Git, with the newest 20 kept (up to 64 MiB). They never touch the real run's checkpoints in.div/runner/. - Older Runner. With Runner 0.2, Simulation says it needs 0.3.0 and runs nothing.
A simulation is not a sandbox: the YAML is still compiled by PHP, and Flows and doubles are trusted inputs.
Also
- The help has a new page, Flow Simulation, in English and Spanish, with the workflow as a GIF and screenshots. The Flow Designer, Running Flows, Flow Functions and Keyboard Reference pages link it.
examples/runnerrequires Runner^0.3and has its doubles ready: openflows/fulfil.ymland press Shift+F9.- The Spanish interface covers all of the above.
Known limits
- One Flow on the board. A nested Flow's events are in the playback, but its Steps are not drawn.
- Doubles for every function. Each function the YAML references needs a double, even on Steps the given context will not reach.
- YAML only. Only YAML Flows can be simulated.
- Flow events only. The simulation steps through the Flow's events, not PHP statements.
Install
Ready to run, with nothing else to install:
- macOS and Linux:
brew install divengine/tap/divide - Windows:
scoop install https://github.com/divengine/divide/releases/latest/download/divide.json, or the.msibelow - Linux: the
.deb,.rpm,.apkand Arch packages, the AppImage or the binary alone, below - macOS: the archive for Apple silicon or Intel, below
Rendering and checking includes need PHP 8 and Div (composer require divengine/div); Runner Flows need Runner (composer require divengine/runner, 0.3 or newer to simulate); the Git menu needs git. divide is free software under the GPL, version 3 or later. The binaries are not signed yet: see Installation.
