Skip to content

Commit 06a46f2

Browse files
docs(runtime): state that a calc body has no choice points and that policies may reach different ones
Co-Authored-By: jason.han <hanhuijun@gmail.com>
1 parent f3065a8 commit 06a46f2

5 files changed

Lines changed: 34 additions & 30 deletions

File tree

changes/unreleased/scheduling-policy.added.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
library orders nothing — several steppable tokens in one step, several holding guards at a
33
decision, several enabled transitions out of one state for one event, and so whose same-step
44
write to one feature stands — the executors follow a named policy: `reverse` (the default:
5-
reverse token order, first holding guard, first enabled transition, so every existing result
6-
and trace is unchanged), `declared` (tokens in spawn order, guards and transitions in
7-
declaration order) or `seed:<n>` (a pseudo-random order the seed fixes, so one seed replays
8-
one run on every platform and two seeds may take two linearizations). The spelling is the same
9-
everywhere: `sysml -schedule <policy>` for `-action`, `-state`, `-analysis` and a `-calc` whose
10-
body performs actions; `%schedule [<policy>]` in the REPL, shown with no argument and applied
11-
to the runs started after it while a debugging session under way keeps its own; a `schedule`
12-
field on `ExecuteActionRequest`, `ExecuteStateRequest` and `RunAnalysisRequest`, empty for the
13-
default and advertised as the `schedule` capability, with the Go and Python clients taking it
14-
as an option (`opensysml.WithSchedule`, `opensysml.Schedule`, `schedule=`); and a `schedule`
15-
pin on a conformance case, which the harness runs under. A policy changes only which
16-
alternative each choice takes: the same choice points are reported and each `took …` is what
17-
the policy took. A spelling naming no policy — an unknown name, `seed` or `seed:` without a
18-
number, `seed:-1`, `seed:abc` — is refused before anything runs, as `INVALID_ARGUMENT` on the
19-
wire. `explore`, the bounded exhaustive replay, is reserved and refused by name until it exists.
20-
The conformance suite also runs whole under `declared` and `seed:1`, requiring every case that
21-
pins no policy and lists no `outcomes` to produce its default outputs; the two cases whose
22-
default result is one linearization of several — a message two accepts answer to, a send to a
23-
same-named port — pin `reverse` until their admissible set is derived.
5+
reverse token order, first holding guard, first enabled transition, so every existing result and
6+
trace is unchanged), `declared` (tokens in spawn order, guards and transitions in declaration
7+
order) or `seed:<n>` (a pseudo-random order the seed fixes, so one seed replays one run on every
8+
platform and two seeds may take two linearizations). The spelling is the same everywhere: `sysml
9+
-schedule <policy>` for `-action`, `-state` and `-analysis` (a calc's body performs nothing, so
10+
`-calc` has no choice to make); `%schedule [<policy>]` in the REPL, shown with no argument and
11+
applied to the runs started after it while a debugging session under way keeps its own; a
12+
`schedule` field on `ExecuteActionRequest`, `ExecuteStateRequest` and `RunAnalysisRequest`,
13+
empty for the default and advertised as the `schedule` capability, with the Go and Python
14+
clients taking it as an option (`opensysml.WithSchedule`, `opensysml.Schedule`, `schedule=`);
15+
and a `schedule` pin on a conformance case, which the harness runs under. A policy changes only
16+
which alternative each choice takes: every choice point a run reaches is reported and each `took
17+
…` is what the policy took, though another linearization may reach other choice points. A
18+
spelling naming no policy — an unknown name, `seed` or `seed:` without a number, `seed:-1`,
19+
`seed:abc` — is refused before anything runs, as `INVALID_ARGUMENT` on the wire. `explore`, the
20+
bounded exhaustive replay, is reserved and refused by name until it exists. The conformance
21+
suite also runs whole under `declared` and `seed:1`, requiring every case that pins no policy
22+
and lists no `outcomes` to produce its default outputs; the two cases whose default result is
23+
one linearization of several — a message two accepts answer to, a send to a same-named port —
24+
pin `reverse` until their admissible set is derived.

docs/guide/06-behavior.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,17 @@ executor can be told to resolve every choice point under another: `declared` tak
213213
order they were spawned and guards and transitions in declaration order, and `seed:<n>` draws each
214214
pick from a pseudo-random sequence the non-negative integer `n` fixes, so `seed:1` replays the same
215215
run every time and on every platform while `seed:2` may take another linearization. The policy is
216-
spelled the same everywhere — `sysml -schedule declared` for `-action`, `-state`, `-analysis` and a
217-
`-calc` whose body performs actions, `%schedule seed:7` in the REPL for the runs started after it
218-
(a debugging session under way keeps its own), a `schedule` field on the gRPC execution requests,
219-
and a `schedule` pin on a conformance case — and changes only which alternative each choice takes:
220-
the same choice points are reported, and each `took …` is what the named policy took, so running
221-
a model under two policies and comparing the outcomes is how a scheduling artefact is told from a
222-
bug. An unknown spelling — `random`, `seed` without a number, `seed:-1` — is refused before
223-
anything runs rather than falling back to the default. Where the library orders the alternatives
216+
spelled the same everywhere — `sysml -schedule declared` for `-action`, `-state` and `-analysis`
217+
(a calc's body performs nothing, so `-calc` has no choice to make), `%schedule seed:7` in the
218+
REPL for the runs started after it (a debugging session under way keeps its own), a `schedule`
219+
field on the gRPC execution requests, and a `schedule` pin on a conformance case — and changes
220+
only which alternative each choice takes: every choice point the run reaches is reported, and
221+
each `took …` is what the named policy took, so running a model under two policies and comparing
222+
the outcomes is how a scheduling artefact is told from a bug. Another linearization can reach
223+
other choice points — which tokens are steppable in a step depends on the order the earlier ones
224+
moved — so the count is not fixed across policies, only the reporting is. An unknown spelling —
225+
`random`, `seed` without a number, `seed:-1` — is refused before anything runs rather than falling
226+
back to the default. Where the library orders the alternatives
224227
— the innermost transition over its enclosing state's — there is no choice, and every policy
225228
follows that order.
226229

0 commit comments

Comments
 (0)