Merge branch 'lf/hook-cond-negotiate'

This commit is contained in:
Liam Fitzgerald 2021-04-29 15:41:00 +10:00
commit 4d6315562c
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
2 changed files with 50 additions and 11 deletions

View File

@ -90,7 +90,12 @@
$: tracking=(map resource track) $: tracking=(map resource track)
inner-state=vase inner-state=vase
== ==
::
+$ base-state-3
$: prev-version=@ud
prev-min-version=@ud
base-state-2
==
:: ::
+$ state-0 [%0 base-state-0] +$ state-0 [%0 base-state-0]
:: ::
@ -100,11 +105,14 @@
:: ::
+$ state-3 [%3 base-state-2] +$ state-3 [%3 base-state-2]
:: ::
+$ state-4 [%4 base-state-3]
::
+$ versioned-state +$ versioned-state
$% state-0 $% state-0
state-1 state-1
state-2 state-2
state-3 state-3
state-4
== ==
:: ::
++ default ++ default
@ -198,7 +206,7 @@
++ agent ++ agent
|* =config |* =config
|= =(pull-hook config) |= =(pull-hook config)
=| state-3 =| state-4
=* state - =* state -
^- agent:gall ^- agent:gall
=< =<
@ -224,13 +232,20 @@
=| cards=(list card:agent:gall) =| cards=(list card:agent:gall)
|^ |^
?- -.old ?- -.old
%3 %4
=^ og-cards pull-hook =^ og-cards pull-hook
(on-load:og inner-state.old) (on-load:og inner-state.old)
=. state old =. state old
=/ kick=(list card)
?: ?& =(min-version.config prev-min-version.old)
=(version.config prev-version.old)
==
~
(poke-self:pass kick+!>(%kick))^~
:_ this :_ this
:(weld cards og-cards (poke-self:pass kick+!>(%kick))^~) :(weld cards og-cards kick)
:: ::
%3 $(old [%4 0 0 +.old])
%2 $(old (state-to-3 old)) %2 $(old (state-to-3 old))
%1 $(old [%2 +.old ~]) %1 $(old [%2 +.old ~])
%0 !! :: pre-breach %0 !! :: pre-breach
@ -255,8 +270,10 @@
:: ::
++ on-save ++ on-save
^- vase ^- vase
=. inner-state =: inner-state on-save:og
on-save:og prev-min-version min-version.config
prev-version version.config
==
!>(state) !>(state)
:: ::
++ on-poke ++ on-poke
@ -472,6 +489,7 @@
:: ::
++ tr-add ++ tr-add
|= [s=^ship r=resource] |= [s=^ship r=resource]
?< =(s our.bowl)
=: ship s =: ship s
rid r rid r
status [%active ~] status [%active ~]

View File

@ -57,13 +57,21 @@
inner-state=vase inner-state=vase
== ==
:: ::
+$ base-state-1
$: prev-version=@ud
prev-min-version=@ud
base-state-0
==
::
+$ state-0 [%0 base-state-0] +$ state-0 [%0 base-state-0]
:: ::
+$ state-1 [%1 base-state-0] +$ state-1 [%1 base-state-0]
+$ state-2 [%2 base-state-1]
:: ::
+$ versioned-state +$ versioned-state
$% state-0 $% state-0
state-1 state-1
state-2
== ==
++ push-hook ++ push-hook
|* =config |* =config
@ -153,7 +161,7 @@
++ agent ++ agent
|* =config |* =config
|= =(push-hook config) |= =(push-hook config)
=| state-1 =| state-2
=* state - =* state -
^- agent:gall ^- agent:gall
=< =<
@ -179,16 +187,21 @@
=| cards=(list card:agent:gall) =| cards=(list card:agent:gall)
|^ |^
?- -.old ?- -.old
%1 %2
=^ og-cards push-hook =^ og-cards push-hook
(on-load:og inner-state.old) (on-load:og inner-state.old)
=/ old-subs =/ old-subs
find-old-subs (find-old-subs [prev-version prev-min-version]:old)
=/ version-cards =/ version-cards
:- (fact:io version+!>(version.config) /version ~) :- (fact:io version+!>(version.config) /version ~)
?~ old-subs ~ ?~ old-subs ~
(kick:io old-subs)^~ (kick:io old-subs)^~
[:(weld cards og-cards version-cards) this(state old)] [:(weld cards og-cards version-cards) this(state old)]
::
%1
%_ $
old [%2 0 0 +.old]
==
:: ::
:: ::
%0 %0
@ -205,6 +218,12 @@
== ==
:: ::
++ find-old-subs ++ find-old-subs
|= [prev-min-version=@ud prev-version=@ud]
?: ?& =(min-version.config prev-min-version)
=(prev-version version.config)
==
:: bail on kick if we didn't change versions
~
%~ tap in %~ tap in
%+ roll %+ roll
~(val by sup.bowl) ~(val by sup.bowl)
@ -230,8 +249,10 @@
-- --
:: ::
++ on-save ++ on-save
=. inner-state =: prev-version version.config
on-save:og prev-min-version min-version.config
inner-state on-save:og
==
!>(state) !>(state)
:: ::
++ on-poke ++ on-poke