Skip to content

Releases: balena-io-modules/mahler

v4.1.2

09 Dec 17:34
45a9b1c
Compare
Choose a tag to compare

0a559df (Fix mermaid tests, 2024-12-06)
a21b9f4 (Fix planner unit test, 2024-12-06)
3dd97f4 (Calculate task id base on user definition, 2024-12-06)
65c160e (Fix bug with generated delete actions, 2024-12-06)

v4.1.1

19 Sep 17:19
bdf9f62
Compare
Choose a tag to compare

49e25e5 (Use noUncheckedIndexedAccess as TS configuration, 2024-08-22)

v4.1.0

05 Aug 22:41
f40e388
Compare
Choose a tag to compare

3d63b81 (Improve Task contructor typings, 2024-08-05)
3e91574 (Improve README, 2024-08-05)

v4.0.0

25 Jul 16:01
f26ff58
Compare
Choose a tag to compare

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.
Agent runtime state machine

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 name plan-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

10 May 15:12
e00e49e
Compare
Choose a tag to compare

29e6263 (Fix import paths using lib/*, 2024-05-10)

v3.5.0

10 May 03:19
427a158
Compare
Choose a tag to compare

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

30 Apr 22:38
5e8d54c
Compare
Choose a tag to compare

59d9fa9 (Use parallel plan representation when debugging, 2024-04-30)
6f04dcf (Settle parallel branches before re-planning, 2024-04-30)

v3.4.0

28 Apr 19:56
4bc3c49
Compare
Choose a tag to compare

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)

v3.3.0

10 Apr 23:58
4056b5e
Compare
Choose a tag to compare

dec3668 (Add test utility to run a task, 2024-04-10)

v3.2.1

10 Apr 20:12
a24196c
Compare
Choose a tag to compare

154c008 (Fix UnorderedArray comparison failing for undefined, 2024-04-10)