|
| 1 | +---- MODULE StageExecution ---- |
| 2 | +\* Lifecycle of a single pipeline stage during execution. Includes cache lookup, execution, and allow_failure handling. |
| 3 | +\* Generated by tlaiser — https://github.com/hyperpolymath/tlaiser |
| 4 | + |
| 5 | +EXTENDS Naturals, Sequences, TLC |
| 6 | + |
| 7 | +\* State constants — each represents a distinct state |
| 8 | +CONSTANTS Pending, CacheHit, Running, Succeeded, Failed, Skipped |
| 9 | + |
| 10 | +\* Variables tracked by this specification |
| 11 | +VARIABLES state, allow_failure, cache_enabled |
| 12 | + |
| 13 | +\* Type invariant: state is always one of the declared states |
| 14 | +TypeInvariant == state \in {Pending, CacheHit, Running, Succeeded, Failed, Skipped} |
| 15 | + |
| 16 | +\* Initial state predicate |
| 17 | +Init == |
| 18 | + /\ state = Pending |
| 19 | + /\ allow_failure = FALSE |
| 20 | + /\ cache_enabled = TRUE |
| 21 | + |
| 22 | +\* Transition actions |
| 23 | +\* Transition: Pending -> Skipped (dry_run_or_condition_false) |
| 24 | +dry_run_or_condition_false == |
| 25 | + /\ state = Pending |
| 26 | + /\ state' = Skipped |
| 27 | + /\ UNCHANGED <<allow_failure, cache_enabled>> |
| 28 | + |
| 29 | +\* Transition: Pending -> CacheHit (cache_lookup_hit) |
| 30 | +cache_lookup_hit == |
| 31 | + /\ state = Pending |
| 32 | + /\ cache_enabled = TRUE |
| 33 | + /\ state' = CacheHit |
| 34 | + /\ UNCHANGED <<allow_failure, cache_enabled>> |
| 35 | + |
| 36 | +\* Transition: Pending -> Running (cache_miss_or_disabled) |
| 37 | +cache_miss_or_disabled == |
| 38 | + /\ state = Pending |
| 39 | + /\ state' = Running |
| 40 | + /\ UNCHANGED <<allow_failure, cache_enabled>> |
| 41 | + |
| 42 | +\* Transition: CacheHit -> Succeeded (cache_result_applied) |
| 43 | +cache_result_applied == |
| 44 | + /\ state = CacheHit |
| 45 | + /\ state' = Succeeded |
| 46 | + /\ UNCHANGED <<allow_failure, cache_enabled>> |
| 47 | + |
| 48 | +\* Transition: Running -> Succeeded (executor_succeeds) |
| 49 | +executor_succeeds == |
| 50 | + /\ state = Running |
| 51 | + /\ state' = Succeeded |
| 52 | + /\ UNCHANGED <<allow_failure, cache_enabled>> |
| 53 | + |
| 54 | +\* Transition: Running -> Failed (executor_fails) |
| 55 | +executor_fails == |
| 56 | + /\ state = Running |
| 57 | + /\ allow_failure = FALSE |
| 58 | + /\ state' = Failed |
| 59 | + /\ UNCHANGED <<allow_failure, cache_enabled>> |
| 60 | + |
| 61 | +\* Transition: Running -> Succeeded (executor_fails_but_allowed) |
| 62 | +executor_fails_but_allowed == |
| 63 | + /\ state = Running |
| 64 | + /\ allow_failure = TRUE |
| 65 | + /\ state' = Succeeded |
| 66 | + /\ UNCHANGED <<allow_failure, cache_enabled>> |
| 67 | + |
| 68 | +\* Next-state relation: disjunction of all transitions |
| 69 | +Next == |
| 70 | + \/ dry_run_or_condition_false |
| 71 | + \/ cache_lookup_hit |
| 72 | + \/ cache_miss_or_disabled |
| 73 | + \/ cache_result_applied |
| 74 | + \/ executor_succeeds |
| 75 | + \/ executor_fails |
| 76 | + \/ executor_fails_but_allowed |
| 77 | + |
| 78 | +\* All variables tuple (for stuttering) |
| 79 | +vars == <<state, allow_failure, cache_enabled>> |
| 80 | + |
| 81 | +\* Complete specification |
| 82 | +Spec == Init /\ [][Next]_vars |
| 83 | + |
| 84 | +\* Fair specification (with weak fairness on Next) |
| 85 | +FairSpec == Spec /\ WF_vars(Next) |
| 86 | + |
| 87 | +\* ---- Temporal Properties ---- |
| 88 | +\* Property: SucceededStageNeverReruns (safety) |
| 89 | +SucceededStageNeverReruns == []([][StageExecution = Succeeded => UNCHANGED StageExecution]_StageExecution) |
| 90 | + |
| 91 | +\* Property: FailedStagePropagates (safety) |
| 92 | +FailedStagePropagates == []([](StageExecution = Failed => allow_failure = FALSE)) |
| 93 | + |
| 94 | +\* Property: PipelineEventuallyTerminates (liveness) |
| 95 | +PipelineEventuallyTerminates == <>(<>(StageExecution = Succeeded \/ StageExecution = Failed \/ StageExecution = Skipped)) |
| 96 | + |
| 97 | + |
| 98 | +==== |
0 commit comments