Releases: balena-io-modules/mahler
v4.1.2
v4.1.1
v4.1.0
v4.0.0
Mahler v4 release
Breaking changes
Simplified Sensor interface
The ouput of a Sensor is now a Subscribable
instance that emits Operation
values. The sensor no longer modifies the agent state but only returns changes that are applied by the Agent runtime.
This makes state management more robust as state is only modified by the agent runtime, preventing non-determinism on state reporting because of concurrency.
Removed logger option when constructing an Agent
The option has been replaced by a single trace
option, which expects a void function that will be called for each agent runtime event. The function can be used to generate human readable logs or to log agent progress on disk. The agent runtime events relate to each other according to the following diagram.
Note that this also means that the Agent runtime no longer produces human readable logs by default. In order to get a readable log a readableTrace
function has now be added on mahler/utils
. The function accepts a Logger instance.
import { readableTrace } from 'mahler/utils';
const agent = Agent.from({
initial: 0,
tasks: [/* task list */],
// readableTrace requires a Logger instance
opts: { trace: readableTrace(console) },
});
Minor improvements
- Improved state management on the Agent runtime. Previously, the internal agent state could be modified by different operations within the runtime lifecycle, action execution, rollbacks, sensors, etc. While the generated plans ensure that two actions cannot modify the same part of the state at the same time, the Agent state could still be affected by concurrency, because of the need to clone the state for some of these operations. With this new version, state changes are propagated using Operation events, limiting the number of places where state changes are allowed. This reduces the need for state cloning and ensures the state remains consistent event if some actions of the plan fail.
- A new
plannerMaxWaitMs
configuration option has been added to the Agent constructor. This value defaults to 60 seconds and allows the agent to interrupt planning if it's taking too long. A long planning time usually means that there is some scenario not being considered and that a Method should be added to the task knowledge databased to help prune the search tree. A planning timeout is reported to the trace function with the event nameplan-timeout
.
Other improvements
Other changes include refactoring, better linting, improved types and some updated dev dependencies.
List of commits
b22c7b6 (Add agent option to abort planning with timeout, 2024-07-18)
696993c (Improve Pointer type to be more precise, 2024-07-17)
c2847de (Update balena-lint and typescript, 2024-07-17)
3da719f (Bump dev dependencies, 2024-07-18)
cadaada (Remove logger
property of AgentOpts, 2024-07-15)
a60e568 (Move state rollback to Agent runtime, 2024-05-26)
543942f (Modify runtime to report changes, 2024-05-24)
1861702 (Simplify Sensor interface., 2024-05-24)
f99ba5f (Refactor operation types, 2024-05-24)
v3.5.1
v3.5.0
db77732 (Update sensor subscription at runtime init, 2024-05-08)
0255dbb (Fix Pointer tests, 2024-05-09)
750b2a1 (Add lens utilities, 2024-05-04)
7765144 (Allow using observables for sensors, 2024-05-03)
e4c88f4 (Add filter
operation to Observable, 2024-05-03)
0ad3762 (Allow lens variables for Sensor constructor, 2024-05-02)
v3.4.1
v3.4.0
2db3f07 (Expose reduce
function on the DAG module, 2024-04-28)
74ac937 (Cleanup code in DAG module, 2024-04-28)
fbd2453 (Refactor planner node module to use DAG types, 2024-04-27)
2f34d84 (Use DAG operations in agent runtime, 2024-04-26)
ea5efa9 (Use DAG.reverse in planner, 2024-04-26)
e63bf04 (Add mapReduce and reverse methods to DAG, 2024-04-26)
ea8015b (Generate real DAGs using the PlanBuilder interface, 2024-04-24)
fcd6bf0 (Use dag module in planner and testing modules, 2024-04-22)
991ae3a (Create generic DAG interface and methods, 2024-04-22)