Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restart() BotAction #97

Merged
merged 15 commits into from
Mar 3, 2021
Merged

restart() BotAction #97

merged 15 commits into from
Mar 3, 2021

Conversation

mrWh1te
Copy link
Owner

@mrWh1te mrWh1te commented Feb 26, 2021

Description

Recycle abort line signals to restart an assembled line of BotActions

Related

Checklist

  • Recycle Restart
    • default no minimum assembledLines
    • optionally set minimum assembledLines
  • Unit tests
  • Update deps
    • Puppeteer
    • cron-schedule

Documentation

  • setup pr
    • code, example
    • polish

Publishing

  • new minor release
    • confirm works automatically with auxiliary packages

@codecov
Copy link

codecov bot commented Feb 26, 2021

Codecov Report

Merging #97 (49c75d5) into master (80a3c8e) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #97   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           36        36           
  Lines          665       685   +20     
  Branches       169       172    +3     
=========================================
+ Hits           665       685   +20     
Impacted Files Coverage Δ
libs/core/src/lib/actions/abort.ts 100.00% <100.00%> (ø)
libs/core/src/lib/helpers/abort.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 80a3c8e...49c75d5. Read the comment docs.

- this allows you to build a bot script that varies on each attempt,
like your not sure exactly how the bot will accomplish X, but you have
an idea and need to do trial and error with slight differences on each
try by adjusting the pipe value of the first assembled BotAction to the
value resolved from the optional useThisActionsPipeValueOnRecycle
@mrWh1te
Copy link
Owner Author

mrWh1te commented Feb 28, 2021

going to simplify recycle's design

use abort(1, 'pipe-value') as a means to setup the next pipe value for the next iteration of scheduled actions

therefore there is no need for an additional optional param, type BotAction, because both the page (and injectables) are available in the BotAction returning the Abort Line Signal (with assembledLines = 1 and a pipe value) and that signal's pipe value can be injected into the next iteration of BotActions

@mrWh1te
Copy link
Owner Author

mrWh1te commented Feb 28, 2021

should the initial pipe value, received by schedule, be reused for each scheduled line of BotActions or should the last value returned by the last assembled BotAction, of each schedule, be used as the pipe value for the next assembled lines of BotActions

final returned value is passed through

@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 2, 2021

what if the final return value was a signal like Cases Signal that was a summary/report of dates when actions ran with their end result pipe value?

edit: schedule()() could work like this ie SchedulesSignal... but it would be better to use state()() on the outside then later on rely on it to know when scheduled actions ran with their resulting pipe value

edit2: this would be a RecycleSignal. A report on when botactions were recycled and to what effect (pipe value)

edit3: is it worth differentiating signals with a new group called reports? Signals directly cause an effect. A report is data to be ingested that may (or may not) indirectly cause an effect.

@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 3, 2021

fixed a bug for a rare edge-case with the processAbortLineSignal() helper

edit: essentially if assembledLines and the reduceAssembledLinesBy were a number greater than 1, but not 1, it would produce an Infinity Abort Line Signal instead of reducing it too the signal's pipe value

a unit-test has been added to cover this now and in the future

- the rare edge case of using processAbortLineSignal with a reduction in
assembledLines count > 1 is rare with an edge case of assembledLines and
reduction number being the same, returning an Infinity signal instead of
the signals pipe value
@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 3, 2021

might adjust schedule()'s return to a more informative signal in the future, but for recycle(), kept it more in line with what pipe does, returns the final action value, with the small addition that a default abort() signal (assembledLines = 1) will actually be caught and have its pipeValue injected as the assembled botactions are started over

botmation's architecture is summarized by Einstein's quote - as simple as possible but no simpler. Each BotAction should do one one thing only, very well. This prevents technical debt, in the form of functional entanglement that increases the cost of adding/removing/modifying flows of functionality that scales exponentially with complexity.

That is, the more complex the features, the more complex the changes, the more exponential the rise in cost of adding/removing functionality due to technical debt in the form of functional entanglement

it's like trying to surgically replace a meatball in a plate of spaghetti with a sausage. The sausage has to be precisely placed, after carefully removing the meatball and then all those threads of spaghetti that pertain to this sausage, once connected to the meatball, have to be reconnected to the sausage, in various places. The more out of control that spaghetti is, the less consolidated it is, the less organized, the more expensive it drastically becomes to do this

@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 3, 2021

rename recycle() to restart() ?

@mrWh1te mrWh1te changed the title WIP: recycle BotAction restart() BotAction Mar 3, 2021
@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 3, 2021

should @botmation/core v1.2.0 include Puppeteer v8 and latest cron-schedule ?

see https://david-dm.org/mrWh1te/Botmation

@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 3, 2021

Puppeteer v8 and cron-schedule v3's major breaking changes do not break Botmation so its included in this minor release of @botmation/core v1.2.0

- wip -> instagram package not installing?
- the <2.0.0 didnt work, im surprised
- changed back to ^1.x which should be fine since the Minor number is
greater than zero, which is what caused the original problem of syncing
deps
@sonarcloud
Copy link

sonarcloud bot commented Mar 3, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 3, 2021

published:

  • @botmation/core v1.2.1
  • @botmation/instagram v1.0.2
  • @botmation/linkedin v1.0.2

also new docs published

@mrWh1te mrWh1te merged commit 1e2a5bb into master Mar 3, 2021
@mrWh1te mrWh1te deleted the 67-recycle-abort-line-signal branch March 3, 2021 15:15
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