Skip to content

P3. Rework execute functions step. Expose step-function to build own executor - #16

Merged
SerhiiRI merged 2 commits into
mainfrom
feat/execute-flow-control
Aug 9, 2026
Merged

SerhiiRI merged 2 commits into
mainfrom
feat/execute-flow-control

Conversation

@SerhiiRI

@SerhiiRI SerhiiRI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Motivation

Real life shows me that the internals of status-map is very presios by the many reason. For building UI, for checking something before the execute. To avoid dancing with hooks or parametrization i decide to expose our internal steps outside. That allow to

  1. Implement user own execute function safely.
  2. Execute 3 first steps, hold the process of execution to check something, run the rest of steps.

Example from the tests.

(deftest execute-steps-halt-and-resume-test
  (testing "Pipeline can be halted before commands run, inspected, then resumed to completion"
    (let [instruction {"a" 1 "b" {:commando/from ["a"]}}
          steps (commando/steps-pipeline-default [cmds-builtin/command-from-spec])
          halted (commando/with-execute-context nil
                   (fn []
                     (commando/execute-steps
                       (smap/status-map-pure {:instruction instruction})
                       (take-while #(not= (:step-name %) :step-execute-commands!) steps))))
          resumed (commando/with-execute-context nil
                    (fn []
                      (commando/execute-steps halted
                        (drop-while #(not= (:step-name %) :step-execute-commands!) steps))))]
      (is (some? (:internal/cm-running-order halted)) "Running order is available before commands run")
      (is (nil? (:internal/cm-results halted)) "Commands have not run yet")
      (is (commando/ok? resumed))
      (is (= 1 (get-in resumed [:instruction "b"])) "Resumed run executes the deferred commands"))))

as You see the problem with injection additional steps almost gone, we allow advanced (controlled) usage with creating self implementation of steps-pipeline-default, where for example :step-execute-commands! may even been replaced on backend for something more parallel or even group few steps in one to speed up the execution. Status Map kept almost all needed metainformation.

@SerhiiRI SerhiiRI self-assigned this Aug 3, 2026
@SerhiiRI
SerhiiRI requested a review from Kaspazza August 3, 2026 21:32
@SerhiiRI SerhiiRI changed the title feat/execute-flow-control: expose execute's pipeline as data (steps-p… Rework execute functions step. Expose step-function to build own executor Aug 3, 2026
@SerhiiRI SerhiiRI changed the title Rework execute functions step. Expose step-function to build own executor P3. Rework execute functions step. Expose step-function to build own executor Aug 3, 2026
@SerhiiRI
SerhiiRI force-pushed the feat/execute-flow-control branch from 0ce5108 to 6e8a3c7 Compare August 9, 2026 09:22
Base automatically changed from feat/hook-command-guard to main August 9, 2026 09:23
…ipeline-default/execute-steps/with-execute-context)

- ADDED api interface to build own/custom commando/execute
- REFACTORED all old pipeline functions were renamed by adding step-
prefix before the function name
- UPDATED README.md by adding section about control-flow.
@SerhiiRI
SerhiiRI force-pushed the feat/execute-flow-control branch from 6e8a3c7 to bd918ac Compare August 9, 2026 09:23
@SerhiiRI
SerhiiRI merged commit 6d0e6bf into main Aug 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant