Commit Graph

36 Commits (0a9c664d17cba2139fcf93274536ea1ab1272cb4)

Author SHA1 Message Date
Rick Carlino 399ddf50c8
PersistentRegimen => RegimenInstance 2019-09-13 16:03:17 -07:00
connor rigby d842c3a123
🎉 Implement Variables in Regimen 2019-09-13 16:03:17 -07:00
Rick Carlino aa9ad9523a
Update EnigmaWorker to not die causing supervisor restarts.
* Tests for enigma cleanup
2019-09-13 16:03:17 -07:00
Rick Carlino 0b5df60f67
Implement and test Enigmas for firmware_missing
* Test for create_or_update_enigma!() and clear_enigma()
2019-09-13 16:03:17 -07:00
Connor Rigby f1dd9009ea
Rename FarmbotCore Namespace 2019-09-13 16:03:16 -07:00
Connor Rigby 4114e26804
Implement new CeleryScript Runtime environment.
This is obviously a rather large change warranting an essay describing
it.

A Brief overview
Basically the old implementation had quite a few down sides preventing
it from really working as intended, especially with the addition of the
variables feature. Here is the shortlist of things that needed
addressing:

* No scoping between sequences.
What this essentially means is that a sequence that executes another
sequence is unable to add data to the calle. This is important for using
Variables.

* Error recovery
certain nodes have a high likelyhood of failing such as anything that
interfaces the firmware. Much focus was spent ensuring that errors would
be recoverable when desired.

* Complexity of control flow asts versus action asts.
Nodes such as `if` will always work in the same way regardless of the
state of the rest of the system meaning there is no reason for it to
have a special implementation per environment. on the other hand
`move_absolute` is bound to a specific part of the system. Seperating
these concerns allows for better testing of each piece independently.

A More In Depth overview
The core of this change resolves around 1 really big change resulting in
many more small changes. This change is the CeleryScript `compiler`. The
TLDR of this system is that now CeleryScript ASTs are deterministicly
compiled to Elixir's AST and executed. Doing this has some big benifits
as described below.

1) CeleryScript "runtime" environment is now much simpiler in favor of a somewhat
complex "compile time" environment. Basically instead of EVERY single
CeleryScript AST having a custom runtime implementation, only a subset
of ASTs that require external services such as the Firmware, Database,
HTTP, etc require having a runtime implementation. This subset of ASTs
are called `SysCalls`. Also the runtime implementations are compiled to
a single function call that can be implemented instead of needing to
have a contextual environment and making decisions at runtime to
evaluate variables and the like.

2) Static analysis is now possible. This means an incorrectly crafted
sequence can be validated at compile time rather than getting half way
through a sequence before finding the error.

3) Having the "external services" separated leads to better plugability.
There is now a behaviour to be implemented for the subset of syscalls
that are system specific.
2019-09-13 16:03:15 -07:00
Connor Rigby 3bc18fee09
Refactor tests to stop juggling timeouts 2019-09-13 16:03:14 -07:00
Connor Rigby 0d32bdfccf
Add formatting and Timezone to CI 2019-09-13 16:03:14 -07:00
Connor Rigby 6e2a018598
Implement Regimens again, add tests and test support
* This also includes changes to all Farmbot API Assets adding
  a `monitor: :boolean` field. This allows tests to be run
  causing minimal side effects on the rest of the systems.
2019-09-13 16:03:14 -07:00
Connor Rigby 869d1ad1a4
Progress on refactoring data syncing (#643) 2019-09-13 16:03:13 -07:00
connor rigby cf1ef23b17
Start splitting Farmbot Application Poncho Style
This begins splitting the monolithic Farmbot application
into separate, independent OTP applicatoins.
2019-09-13 16:03:13 -07:00
Connor Rigby a23d223995 Nerves Hub (#647) 2018-12-18 14:19:30 -08:00
connor rigby 181f1398f7 Remove references to removed code. 2018-05-11 17:11:56 -07:00
connor rigby 7747331ec7 Refactor DB lookups in FarmEvent and Regimen managers. 2018-03-12 08:58:41 -07:00
Connor Rigby f8cec7c1bd Add some tests 2018-03-11 15:17:56 -07:00
connor rigby ac3a33c775 Add some test support 2017-12-13 09:45:16 -08:00
Connor Rigby 21137c7eb3 More fw disable #4 2017-12-05 12:13:52 -08:00
Connor Rigby cec5bd53cd More fw disable #3 2017-12-05 12:01:59 -08:00
Connor Rigby 3d035f30b3 More fw disable 2017-12-05 11:59:52 -08:00
Connor Rigby adc369943d More fw disable 2017-12-05 11:39:16 -08:00
Connor Rigby 5343e57010 Disable installing first party farmware on test environment. 2017-12-05 11:23:00 -08:00
Connor Rigby 34ef41632f Add some tests 2017-12-05 10:16:48 -08:00
connor rigby 2c96e759d5 More prod prep. 2017-12-04 13:25:21 -08:00
connor rigby 94525fae04 Misc test fixes.
* Temp disable set_user_env test.
* add test support for waiting for the firmware handler to be up
2017-12-04 10:00:33 -08:00
Connor Rigby e9669135d1 Add some tests 2017-12-01 19:08:07 -08:00
Connor Rigby cec26b5fed Fix tests 2017-11-29 22:18:52 -08:00
connor rigby 3db2a97271 write some tests 2017-11-10 09:51:56 -08:00
Connor Rigby ae79980dd7 Misc cleanup.
* Update .gitignore
* move test/runtime artifacts into their own dirs.
* remove sqlite dbs that leaked into source control.
2017-10-26 09:40:43 -07:00
Connor Rigby fe32cd1540 use Elixir 1.6.0 code formatter 2017-10-11 15:53:00 -07:00
Connor Rigby fa3492f5aa time to merge back in 2017-09-26 07:00:43 -07:00
Connor Rigby 487ce22cfc Fix tests
* reimplement config system to be a bit more intuitive.
2017-09-12 09:51:31 -07:00
Connor Rigby 926f9ce156 clean up some unused code. 2017-09-09 17:51:13 -07:00
Connor Rigby 33cac0ef8b add some preflight checks to the test env to give helpful errors. 2017-08-23 08:18:00 -07:00
Connor Rigby fab37034a5 add tests for firmware. 2017-08-22 11:39:01 -07:00
Connor Rigby 2ddfb5868f test the init system in a reasonable way, bring back excoveralls 2017-08-10 23:37:42 -07:00
Connor Rigby 8469a573a4 implement test stubs. Not sure what to do about the token 2017-08-10 22:02:40 -07:00