From 6b7a7910541e7d2cfd47303ef96097b14681b4e6 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 20 Mar 2020 15:30:24 -0700 Subject: [PATCH 001/280] clay: initial version of +up --- pkg/arvo/lib/strandio.hoon | 92 ++++++++++++++++++++++++++++++++++++++ pkg/arvo/ted/up.hoon | 33 ++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 pkg/arvo/ted/up.hoon diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 649311154..b502340dd 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -380,6 +380,98 @@ ;< ~ bind:m (send-request (hiss-to-request:html hiss)) take-maybe-sigh :: +:: Run ford build +:: +++ ford-build + |= =schematic:ford + =/ m (strand ,build-result:ford) + ^- form:m + ;< ~ bind:m (send-raw-card %pass /ford-build %arvo %f %build | schematic) + ;< =made-result:ford bind:m (take-made-result /ford-build) + ?: ?=(%incomplete -.made-result) + (strand-fail %ford-incomplete tang.made-result) + (pure:m build-result.made-result) +:: +:: Take ford build result +:: +++ take-made-result + |= =wire + =/ m (strand ,made-result:ford) + ^- form:m + |= tin=strand-input:strand + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %sign * %f %made *] + ?. =(wire wire.u.in.tin) + `[%skip ~] + `[%done result.sign-arvo.u.in.tin] + == +:: +:: Run several taggged ford builds +:: +++ build-map + |= builds=(map term schematic:ford) + =/ m (strand ,(map term build-result:ford)) + ^- form:m + =/ schematics=(list schematic:ford) + %+ turn ~(tap by builds) + |= [=term =schematic:ford] + [[%$ %noun !>(term)] schematic] + :: + ;< =build-result:ford bind:m (ford-build %list schematics) + ?: ?=(%error -.build-result) + (strand-fail %ford-error message.build-result) + ?> ?=(%list -.+.build-result) + :: + =| produce=(map term build-result:ford) + |- ^- form:m + =* loop $ + ?^ results.build-result + ?> ?=([[%success %$ %noun *] *] +.i.results.build-result) + =. produce + %+ ~(put by produce) + !<(term q.cage.head.i.results.build-result) + tail.i.results.build-result + loop(results.build-result t.results.build-result) + (pure:m produce) +:: +:: Run ford %core build +:: +++ build-core + |= =rail:ford + =/ m (strand ,vase) + ^- form:m + ;< =build-result:ford bind:m (ford-build %core rail) + ?: ?=(%error -.build-result) + (strand-fail %ford-error message.build-result) + ?> ?=(%core -.+.build-result) + (pure:m vase.build-result) +:: +:: Run ford %core builds +:: +++ build-cores + |= rails=(map term rail:ford) + =/ m (strand ,(map term vase)) + ^- form:m + =/ builds + %- ~(run by rails) + |= =rail:ford + [%core rail] + :: + ;< result-map=(map term build-result:ford) bind:m (build-map builds) + =/ results=(list [=term =build-result:ford]) ~(tap by result-map) + =| produce=(map term vase) + |- ^- form:m + =* loop $ + ?^ results + ?: ?=(%error -.build-result.i.results) + (strand-fail %ford-error message.build-result.i.results) + ?> ?=(%core -.+.build-result.i.results) + =. produce + (~(put by produce) term.i.results vase.build-result.i.results) + loop(results t.results) + (pure:m produce) +:: :: Queue on skip, try next on fail %ignore :: ++ main-loop diff --git a/pkg/arvo/ted/up.hoon b/pkg/arvo/ted/up.hoon new file mode 100644 index 000000000..381deaf95 --- /dev/null +++ b/pkg/arvo/ted/up.hoon @@ -0,0 +1,33 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=+ !<([scratch=desk real=desk ~] arg) +|^ +=/ m (strand ,vase) +^- form:m +;< apps=(map term vase) bind:m load-apps +(pure:m !>((~(run by apps) mug))) +:: +++ scratch-path + |= [=bowl:spider =path] + (weld /(scot %p our.bowl)/[scratch]/(scot %da now.bowl) path) +:: +++ load-apps + =/ m (strand ,(map term vase)) + ^- form:m + ;< =bowl:spider bind:m get-bowl:strandio + =+ .^(=arch %cy (scratch-path bowl /app)) + =/ apps ~(tap in ~(key by dir.arch)) + =/ rails + %- malt + %+ murn apps + |= =term + ^- (unit [^term rail:ford]) + =+ .^(=app=^arch %cy (scratch-path bowl /app/[term])) + ?. (~(has by dir.app-arch) %hoon) + ~ + `[term our.bowl^scratch /hoon/[term]/app] + (build-cores:strandio rails) +-- From 531630e93a4b040e785753f0a9635c43678adb03 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 20 Mar 2020 15:30:52 -0700 Subject: [PATCH 002/280] clay: add %park task and -commit %park is a plumbing commit task. It guarantees completion in a single event, so you have to do much of the work before calling it. -commit is an example of how to do this. --- bin/solid.pill | 4 +- pkg/arvo/lib/strandio.hoon | 44 +++++++++---- pkg/arvo/sys/vane/clay.hoon | 52 +++++++++++++++ pkg/arvo/sys/zuse.hoon | 18 +++++- pkg/arvo/ted/commit.hoon | 125 ++++++++++++++++++++++++++++++++++++ pkg/arvo/ted/up.hoon | 6 +- 6 files changed, 231 insertions(+), 18 deletions(-) create mode 100644 pkg/arvo/ted/commit.hoon diff --git a/bin/solid.pill b/bin/solid.pill index bd5182311..4f588fa91 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4fb8003d603f01ed63813d04b0049fe145be0ee2509fbc8ac16bedf5fca8a335 -size 13073371 +oid sha256:36d204827bdd31705146bd95b1323b86eb037413b6990c10ace14c133d31f010 +size 13099016 diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index b502340dd..a8bbd7262 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -410,31 +410,51 @@ :: Run several taggged ford builds :: ++ build-map - |= builds=(map term schematic:ford) - =/ m (strand ,(map term build-result:ford)) + |= builds=(map path schematic:ford) + =/ m (strand ,(map path build-result:ford)) ^- form:m =/ schematics=(list schematic:ford) %+ turn ~(tap by builds) - |= [=term =schematic:ford] - [[%$ %noun !>(term)] schematic] + |= [=path =schematic:ford] + [[%$ %noun !>(path)] schematic] :: ;< =build-result:ford bind:m (ford-build %list schematics) ?: ?=(%error -.build-result) (strand-fail %ford-error message.build-result) ?> ?=(%list -.+.build-result) :: - =| produce=(map term build-result:ford) + =| produce=(map path build-result:ford) |- ^- form:m =* loop $ ?^ results.build-result ?> ?=([[%success %$ %noun *] *] +.i.results.build-result) =. produce %+ ~(put by produce) - !<(term q.cage.head.i.results.build-result) + !<(path q.cage.head.i.results.build-result) tail.i.results.build-result loop(results.build-result t.results.build-result) (pure:m produce) :: +:: Run several taggged ford builds +:: +++ build-cages + |= builds=(map path schematic:ford) + =/ m (strand ,(map path cage)) + ^- form:m + ;< result-map=(map path build-result:ford) bind:m (build-map builds) + =/ results=(list [=path =build-result:ford]) ~(tap by result-map) + =| produce=(map path cage) + |- ^- form:m + =* loop $ + ?^ results + ?: ?=(%error -.build-result.i.results) + (strand-fail %ford-error message.build-result.i.results) + =. produce + %+ ~(put by produce) path.i.results + (result-to-cage:ford build-result.i.results) + loop(results t.results) + (pure:m produce) +:: :: Run ford %core build :: ++ build-core @@ -450,17 +470,17 @@ :: Run ford %core builds :: ++ build-cores - |= rails=(map term rail:ford) - =/ m (strand ,(map term vase)) + |= rails=(map path rail:ford) + =/ m (strand ,(map path vase)) ^- form:m =/ builds %- ~(run by rails) |= =rail:ford [%core rail] :: - ;< result-map=(map term build-result:ford) bind:m (build-map builds) - =/ results=(list [=term =build-result:ford]) ~(tap by result-map) - =| produce=(map term vase) + ;< result-map=(map path build-result:ford) bind:m (build-map builds) + =/ results=(list [=path =build-result:ford]) ~(tap by result-map) + =| produce=(map path vase) |- ^- form:m =* loop $ ?^ results @@ -468,7 +488,7 @@ (strand-fail %ford-error message.build-result.i.results) ?> ?=(%core -.+.build-result.i.results) =. produce - (~(put by produce) term.i.results vase.build-result.i.results) + (~(put by produce) path.i.results vase.build-result.i.results) loop(results t.results) (pure:m produce) :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 5bd406df7..0752230ab 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1931,6 +1931,7 @@ ?- p.p.rand $d ~| %totally-temporary-error-please-replace-me !! $p ~| %requesting-foreign-permissions-is-invalid !! + $s ~| %please-dont-get-your-takos-over-a-network !! $t ~| %requesting-foreign-directory-is-vaporware !! $u ~| %prolly-poor-idea-to-get-rang-over-network !! $v ~| %weird-shouldnt-get-v-request-from-network !! @@ -2901,6 +2902,39 @@ == == :: + :: Plumbing commit + :: + :: Guaranteed to finish in one event. + :: + :: XX needs to check that head is ancestor of tako + :: XX needs to check tako in rang + :: + ++ park + |= [=tako =rang =ankh mim=(map path (unit mime))] + |^ + ^+ ..park + =: ank.dom ankh + let.dom +(let.dom) + hit.dom (~(put by hit.dom) +(let.dom) tako) + mim.dom (apply-changes-to-mim:util mim.dom mim) + hut.ran (~(uni by hut.rang) hut.ran) + lat.ran (~(uni by lat.rang) lat.ran) + == + ergo + :: + ++ ergo + ^+ ..park + =/ must (must-ergo:util her syd mon (turn ~(tap by mim) head)) + %- emil + %+ turn ~(tap by must) + |= [pot=term len=@ud pak=(set path)] + :* (need hez) %give %ergo pot + %+ turn ~(tap in pak) + |= pax=path + [(slag len pax) (~(got by mim) pax)] + == + -- + :: :: Set permissions for a node. :: ++ perm @@ -3856,6 +3890,17 @@ ?: =(%black mod.rul) !in-list in-list + :: +read-s: produce yaki for given tako + :: + ++ read-s + |= [yon=aeon pax=path] + ^- (unit (unit [%yaki (hypo yaki)])) + ?. ?=([* ~] pax) + `~ + =/ yak=(unit yaki) (~(get by hut.ran) (slav %uv i.pax)) + ?~ yak + ~ + ``yaki+`(hypo yaki)`[-:!>(*yaki) u.yak] :: +read-t: produce the list of paths within a yaki with :pax as prefix :: ++ read-t @@ -4031,6 +4076,7 @@ [~ ~ %& %noun !>(~(key by dos.rom.ruf))] :: %p (read-p path.mun) + %s (bind (read-s yon path.mun) (lift |=(a=cage [%& a]))) %t (bind (read-t yon path.mun) (lift |=(a=cage [%& a]))) %u (read-u yon path.mun) %v (bind (read-v yon path.mun) (lift |=(a/cage [%& a]))) @@ -4315,6 +4361,12 @@ (skim ~(tap by mon.ruf) (corl (cury test pot) tail)) |= {pon/term bem/beam} [u.hez.ruf %give %ogre pon] + :: + %park + =^ mos ruf + =/ den ((de our now ski hen ruf) our des.req) + abet:(park:den [tak ran ank mim]:req) + [mos ..^$] :: %perm =^ mos ruf diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 65c3b2a50..d4d814d31 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -567,6 +567,8 @@ {$mont des/desk bem/beam} :: mount to unix {$dirk des/desk} :: mark mount dirty {$ogre pot/$@(desk beam)} :: delete mount point + {$park des/desk tak/tako ran/rang ank/ankh mim/(map path (unit mime))} + :: plumbing commit {$perm des/desk pax/path rit/rite} :: change permissions $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade @@ -591,7 +593,7 @@ $% {$delta p/lobe q/{p/mark q/lobe} r/page} :: delta on q {$direct p/lobe q/page} :: immediate == :: - ++ care ?($d $p $t $u $v $w $x $y $z) :: clay submode + ++ care ?($d $p $s $t $u $v $w $x $y $z) :: clay submode ++ case :: ship desk case spur $% {$da p/@da} :: date {$tas p/@tas} :: label @@ -697,6 +699,20 @@ r/tako :: self-reference t/@da :: date == :: + :: + :: +page-to-lobe: hash a page to get a lobe. + :: + ++ page-to-lobe |=(page (shax (jam +<))) + :: + :: +make-yaki: make commit out of a list of parents, content, and date. + :: + ++ make-yaki + |= {p/(list tako) q/(map path lobe) t/@da} + ^- yaki + =+ ^= has + %^ cat 7 (sham [%yaki (roll p add) q t]) + (sham [%tako (roll p add) q t]) + [p q has t] -- ::clay :: :::: :::: ++dill :: (1d) console diff --git a/pkg/arvo/ted/commit.hoon b/pkg/arvo/ted/commit.hoon new file mode 100644 index 000000000..877539ba5 --- /dev/null +++ b/pkg/arvo/ted/commit.hoon @@ -0,0 +1,125 @@ +:: Delete `deletes`, insert/change `changes`, and don't touch anything +:: else. +:: +/- spider +/+ strandio +=, strand=strand:spider +=, clay +^- thread:spider +|= arg=vase +=+ !<([=desk deletes=(set path) changes=(map path cage) ~] arg) +=/ m (strand ,vase) +^- form:m +:: +:: Cast to expected marks +:: +;< our=@p bind:m get-our:strandio +=/ cast-builds=(map path schematic:ford) + %- ~(urn by changes) + |= [=path =cage] + [%cast [our desk] =>((flop path) ?~(. %$ i)) %$ cage] +;< cast-results=(map path cage) bind:m (build-cages:strandio cast-builds) +:: +:: Fetch current state +:: +;< now=@da bind:m get-time:strandio +=+ .^(=dome %cv /(scot %p our)/[desk]/(scot %da now)) +:: +:: Apply changes to current state to create new yaki +:: +=/ new-blobs=(map path blob) + %- ~(run by cast-results) + |= =cage + =/ =page [p q.q]:cage + [%direct (page-to-lobe page) page] +:: +=/ parent-tako=tako (~(got by hit.dome) let.dome) +=/ all-lobes=(map path lobe) + =+ .^ parent-yaki=yaki %cs + /(scot %p our)/[desk]/(scot %da now)/(scot %uv parent-tako) + == + =/ after-deletes + %- ~(dif by q.parent-yaki) + (malt (turn ~(tap in deletes) |=(=path [path *lobe]))) + %- ~(uni by after-deletes) + (~(run by new-blobs) |=(=blob p.blob)) +:: +:: XX should we get getting the time later, after all async? +;< now=@da bind:m get-time:strandio +=/ new-yaki=yaki (make-yaki ~[parent-tako] all-lobes now) +:: +:: Apply new blobs and yaki to rang +:: +=/ =rang + :- (~(put by hut:*rang) r.new-yaki new-yaki) + (malt (turn ~(tap by new-blobs) |=([=path =blob] [p.blob blob]))) +:: +:: Checkout ankh +:: +=/ =ankh ank.dome +=. ankh + =/ dels ~(tap in deletes) + |- ^- ^ankh + =* outer-loop $ + ?~ dels + ankh + |- ^- ^ankh + =* inner-loop $ + ?~ i.dels + outer-loop(dels t.dels, fil.ankh ~) + %= ankh + dir + %+ ~(put by dir.ankh) i.i.dels + %= inner-loop + i.dels t.i.dels + ankh (~(gut by dir.ankh) i.i.dels *^ankh) + == + == +=. ankh + =/ blobs=(list [=path =blob]) ~(tap by new-blobs) + |- ^- ^ankh + =* outer-loop $ + ?~ blobs + ankh + =/ orig-path path.i.blobs + |- ^- ^ankh + =* inner-loop $ + ?~ path.i.blobs + %= outer-loop + blobs t.blobs + fil.ankh + ?> ?=(%direct -.blob.i.blobs) + :+ ~ p.blob.i.blobs + (~(got by cast-results) orig-path) + == + %= ankh + dir + %+ ~(put by dir.ankh) i.path.i.blobs + %= inner-loop + path.i.blobs t.path.i.blobs + ankh (~(gut by dir.ankh) i.path.i.blobs *^ankh) + == + == +:: +:: Checkout cache +:: +=/ mim-builds=(map path schematic:ford) + %- ~(run by cast-results) + |= =cage + [%cast [our desk] %mime %$ cage] +;< mim-results=(map path cage) bind:m (build-cages:strandio mim-builds) +=/ can-mim=(map path (unit mime)) + %- ~(run by mim-results) + |= =cage + ?> ?=(%mime p.cage) + `!<(mime q.cage) +=/ del-mim=(map path (unit mime)) + (malt (turn ~(tap in deletes) |=(=path [path ~]))) +=/ new-mim=(map path (unit mime)) + (~(uni by del-mim) can-mim) +:: +:: Send to clay +:: +=/ args [desk r.new-yaki rang ankh new-mim] +;< ~ bind:m (send-raw-card:strandio %pass /commit/[desk] %arvo %c %park args) +(pure:m !>(~)) diff --git a/pkg/arvo/ted/up.hoon b/pkg/arvo/ted/up.hoon index 381deaf95..9aa5ce3e0 100644 --- a/pkg/arvo/ted/up.hoon +++ b/pkg/arvo/ted/up.hoon @@ -7,7 +7,7 @@ |^ =/ m (strand ,vase) ^- form:m -;< apps=(map term vase) bind:m load-apps +;< apps=(map path vase) bind:m load-apps (pure:m !>((~(run by apps) mug))) :: ++ scratch-path @@ -15,7 +15,7 @@ (weld /(scot %p our.bowl)/[scratch]/(scot %da now.bowl) path) :: ++ load-apps - =/ m (strand ,(map term vase)) + =/ m (strand ,(map path vase)) ^- form:m ;< =bowl:spider bind:m get-bowl:strandio =+ .^(=arch %cy (scratch-path bowl /app)) @@ -28,6 +28,6 @@ =+ .^(=app=^arch %cy (scratch-path bowl /app/[term])) ?. (~(has by dir.app-arch) %hoon) ~ - `[term our.bowl^scratch /hoon/[term]/app] + `[/[term] our.bowl^scratch /hoon/[term]/app] (build-cores:strandio rails) -- From 51ff5b8d676ab687864463ec179b3c70e012c759 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 24 Mar 2020 16:48:18 -0700 Subject: [PATCH 003/280] clay: connect |commit to %park Can remove the old commit flow once existing usage of %info is ported to %park. --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 86 +++++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 4f588fa91..8c1c1638d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:36d204827bdd31705146bd95b1323b86eb037413b6990c10ace14c133d31f010 -size 13099016 +oid sha256:4af34fec9a0a4a99b9c6294f8f1898dcfbdbb6b74a83ab77e2d49032532e53b2 +size 13112651 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 0752230ab..2aa270de0 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -498,6 +498,9 @@ == :: task:able:ford :: == :: + $: %g :: to %gall + $>(%deal task:able:gall) :: + == :: $: %j :: by %jael $>(%public-keys task:able:jael) :: == == :: @@ -528,6 +531,9 @@ $: %f :: by %ford $>(%made gift:able:ford) :: == :: + $: %g :: by %gall + $>(%unto gift:able:gall) :: + == :: $: %j :: by %jael $>(%public-keys gift:able:jael) :: == :: @@ -2920,7 +2926,7 @@ hut.ran (~(uni by hut.rang) hut.ran) lat.ran (~(uni by lat.rang) lat.ran) == - ergo + wake:ergo :: ++ ergo ^+ ..park @@ -4279,8 +4285,12 @@ [hen %pass /two %c %info q.bem %& two] == =+ yak=(~(got by hut.ran.ruf) (~(got by hit.dom.u.dos) let.dom.u.dos)) - =+ cos=(mode-to-soba q.yak (flop s.bem) all.req fis.req) - [hen %pass /both %c %info q.bem %& cos]~ + =+ cos=(mode-to-commit q.yak (flop s.bem) all.req fis.req) + =+ tid=:((cury cat 3) 'clay--' des.req '--' (scot %uv eny)) + =+ arg=[~ `tid %commit !>([q.bem [- + ~]:cos])] + :~ [hen %pass /both %g %deal [our our] %spider %watch /thread-result/[tid]] + [hen %pass /both %g %deal [our our] %spider %poke %spider-start !>(arg)] + == :: %merg :: direct state up ?: =(%$ des.req) @@ -4614,6 +4624,29 @@ [~ ..^$] :: %note [[hen %give +.q.hin]~ ..^$] + %unto + ?- -.p.q.hin + %kick [~ ..^$] + %poke-ack + ?~ p.p.q.hin + [~ ..^$] + [[hen %slip %d %flog %crud %into u.p.p.q.hin]~ ..^$] + :: + %watch-ack + ?~ p.p.q.hin + [~ ..^$] + [[hen %slip %d %flog %crud %into u.p.p.q.hin]~ ..^$] + :: + %fact + :_ ..^$ + ?+ p.cage.p.q.hin [hen %slip %d %flog %crud %into >%strange-into< ~]~ + %thread-done ~ + %thread-fail + =+ !<([=term =tang] q.cage.p.q.hin) + [hen %slip %d %flog %crud %into >term< tang]~ + == + == + :: %wake :: TODO: handle behn errors :: @@ -4661,6 +4694,53 @@ ^- rand [p q [p q.q]:r] :: +:: By convention: paf == (weld pax pat) +:: +++ mode-to-commit + |= [hat=(map path lobe) pax=path all=? mod=mode] + ^- [deletes=(set path) changes=(map path cage)] + =/ deletes + %- silt + %+ turn + ^- (list path) + %+ weld + ^- (list path) + %+ murn mod + |= [pat=path mim=(unit mime)] + ^- (unit path) + ?^ mim + ~ + `pat + ^- (list path) + ?. all + ~ + =+ mad=(malt mod) + =+ len=(lent pax) + =/ descendants=(list path) + %+ turn + %+ skim ~(tap by hat) + |= [paf=path lob=lobe] + =(pax (scag len paf)) + |= [paf=path lob=lobe] + (slag len paf) + %+ skim + descendants + |= pat=path + (~(has by mad) pat) + |= pat=path + (weld pax pat) + :: + =/ changes + %- malt + %+ murn mod + |= [pat=path mim=(unit mime)] + ^- (unit [path cage]) + ?~ mim + ~ + `[(weld pax pat) %mime !>(u.mim)] + :: + [deletes changes] +:: ++ mode-to-soba |= {hat/(map path lobe) pax/path all/? mod/mode} ^- soba From 4d013573e1083a9220269bc6c3aaeb7a5768e67b Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 24 Mar 2020 17:24:19 -0700 Subject: [PATCH 004/280] clay: print changes on commit --- pkg/arvo/sys/vane/clay.hoon | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 2aa270de0..378401c62 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2919,6 +2919,7 @@ |= [=tako =rang =ankh mim=(map path (unit mime))] |^ ^+ ..park + =. ..park print =: ank.dom ankh let.dom +(let.dom) hit.dom (~(put by hit.dom) +(let.dom) tako) @@ -2939,6 +2940,31 @@ |= pax=path [(slag len pax) (~(got by mim) pax)] == + :: + ++ print + ^+ ..park + ~& > %print + ?~ hun + ..park + %- emil + %+ turn ~(tap by mim) + |= [=path change=(unit mime)] + =/ car=@tD + ?~ change + '-' + ?: (~(has by mim.dom) path) + ':' + '+' + =/ =tank + =/ pre=^path ~[(scot %p our) syd (scot %ud +(let.dom))] + :+ %rose ["/" "/" ~] + %+ turn (weld pre path) + |= a=cord + ^- tank + ?: ((sane %ta) a) + [%leaf (trip a)] + [%leaf (dash:us (trip a) '\'' ~)] + [u.hun %give %note car tank] -- :: :: Set permissions for a node. From 3f2a7b08a5dfbd19944086aaeeb9d4e65a07bbe1 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 25 Mar 2020 20:12:05 -0700 Subject: [PATCH 005/280] clay: add -merge except meet/mate/meld -merge will replace |merge so that. Once they reach feature parity and %info is rewritten to forward to -commit, we can rip out about half of clay.hoon --- bin/solid.pill | 4 +- pkg/arvo/lib/clay-commit.hoon | 80 +++++++++++++ pkg/arvo/lib/strandio.hoon | 23 ++++ pkg/arvo/sys/arvo.hoon | 2 +- pkg/arvo/sys/vane/clay.hoon | 19 ++-- pkg/arvo/sys/zuse.hoon | 2 +- pkg/arvo/ted/commit.hoon | 77 ++----------- pkg/arvo/ted/merge.hoon | 208 ++++++++++++++++++++++++++++++++++ 8 files changed, 336 insertions(+), 79 deletions(-) create mode 100644 pkg/arvo/lib/clay-commit.hoon create mode 100644 pkg/arvo/ted/merge.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 8c1c1638d..ad48c3062 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4af34fec9a0a4a99b9c6294f8f1898dcfbdbb6b74a83ab77e2d49032532e53b2 -size 13112651 +oid sha256:cca578fefba7dba24856c63f9e907aee70505cf61a0fd404fb205575436be1a4 +size 13125460 diff --git a/pkg/arvo/lib/clay-commit.hoon b/pkg/arvo/lib/clay-commit.hoon new file mode 100644 index 000000000..47718c970 --- /dev/null +++ b/pkg/arvo/lib/clay-commit.hoon @@ -0,0 +1,80 @@ +/- spider +/+ strandio +=, strand=strand:spider +=, clay +|% +:: Produce an ankh +:: +++ checkout + |= [=ankh deletes=(set path) changes=(map path cage)] + ^- ^ankh + :: Delete + :: + =. ankh + =/ dels ~(tap in deletes) + |- ^- ^ankh + =* outer-loop $ + ?~ dels + ankh + =. ankh + |- ^- ^ankh + =* inner-loop $ + ?~ i.dels + ankh(fil ~) + %= ankh + dir + %+ ~(put by dir.ankh) i.i.dels + %= inner-loop + i.dels t.i.dels + ankh (~(gut by dir.ankh) i.i.dels *^ankh) + == + == + outer-loop(dels t.dels) + :: Add/change + :: + =/ cans=(list [=path =cage]) ~(tap by changes) + |- ^- ^ankh + =* outer-loop $ + ?~ cans + ankh + =. ankh + =/ orig-path path.i.cans + |- ^- ^ankh + =* inner-loop $ + ?~ path.i.cans + %= ankh + fil + `[(page-to-lobe [p q.q]:cage.i.cans) cage.i.cans] + == + %= ankh + dir + %+ ~(put by dir.ankh) i.path.i.cans + %= inner-loop + path.i.cans t.path.i.cans + ankh (~(gut by dir.ankh) i.path.i.cans *^ankh) + == + == + outer-loop(cans t.cans) +:: Produce a mime cache +:: +++ checkout-cache + |= [=desk deletes=(set path) changes=(map path cage)] + =/ m (strand ,(map path (unit mime))) + ^- form:m + ;< our=@p bind:m get-our:strandio + =/ mim-builds=(map path schematic:ford) + %- ~(run by changes) + |= =cage + [%cast [our desk] %mime %$ cage] + ;< mim-results=(map path cage) bind:m (build-cages:strandio mim-builds) + =/ can-mim=(map path (unit mime)) + %- ~(run by mim-results) + |= =cage + ?> ?=(%mime p.cage) + `!<(mime q.cage) + =/ del-mim=(map path (unit mime)) + (malt (turn ~(tap in deletes) |=(=path [path ~]))) + =/ new-mim=(map path (unit mime)) + (~(uni by del-mim) can-mim) + (pure:m new-mim) +-- diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index a8bbd7262..66f49111f 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -492,6 +492,29 @@ loop(results t.results) (pure:m produce) :: +:: Read from Clay +:: +++ warp + |= [=ship =riff:clay] + =/ m (strand ,riot:clay) + ;< ~ bind:m (send-raw-card %pass /warp %arvo %c %warp ship riff) + (take-writ /warp) +:: +:: Take Clay read result +:: +++ take-writ + |= =wire + =/ m (strand ,riot:clay) + ^- form:m + |= tin=strand-input:strand + ?+ in.tin `[%skip ~] + ~ `[%wait ~] + [~ %sign * %b %writ *] + ?. =(wire wire.u.in.tin) + `[%skip ~] + `[%done +>.sign-arvo.u.in.tin] + == +:: :: Queue on skip, try next on fail %ignore :: ++ main-loop diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index f82e661b1..20b5147ce 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -705,7 +705,7 @@ ?: ?=(%unto +>-.gift) [+>-.gift (symp +>+<.gift)] (symp +>-.gift) - duct + duct.move :: (take duct wire vane gift) :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 378401c62..86b7d3af2 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1122,6 +1122,7 @@ :: =/ ford-disc=disc:ford ?: =(p.ali-disc p.bob-disc) + ali-disc bob-disc |^ @@ -2943,7 +2944,6 @@ :: ++ print ^+ ..park - ~& > %print ?~ hun ..park %- emil @@ -3922,17 +3922,22 @@ ?: =(%black mod.rul) !in-list in-list - :: +read-s: produce yaki for given tako + :: +read-s: produce yaki or blob for given tako or lobe :: ++ read-s |= [yon=aeon pax=path] - ^- (unit (unit [%yaki (hypo yaki)])) - ?. ?=([* ~] pax) + ^- (unit (unit $%([%yaki (hypo yaki)] [%blob (hypo blob)]))) + ?. ?=([?(%yaki %blob) * ~] pax) `~ - =/ yak=(unit yaki) (~(get by hut.ran) (slav %uv i.pax)) - ?~ yak + ?: ?=(%yaki i.pax) + =/ yak=(unit yaki) (~(get by hut.ran) (slav %uv i.t.pax)) + ?~ yak + ~ + ``yaki+[-:!>(*yaki) u.yak] + =/ bol=(unit blob) (~(get by lat.ran) (slav %uv i.t.pax)) + ?~ bol ~ - ``yaki+`(hypo yaki)`[-:!>(*yaki) u.yak] + ``blob+[-:!>(*blob) u.bol] :: +read-t: produce the list of paths within a yaki with :pax as prefix :: ++ read-t diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index d4d814d31..7b299a580 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -2341,7 +2341,7 @@ $% {$a gift:able:ames} $: $b $% gift:able:behn - [%writ riot:clay] + [%writ p=riot:clay] $>(%mere gift:able:clay) $>(%unto gift:able:gall) == diff --git a/pkg/arvo/ted/commit.hoon b/pkg/arvo/ted/commit.hoon index 877539ba5..23285e658 100644 --- a/pkg/arvo/ted/commit.hoon +++ b/pkg/arvo/ted/commit.hoon @@ -2,7 +2,7 @@ :: else. :: /- spider -/+ strandio +/+ strandio, clay-commit =, strand=strand:spider =, clay ^- thread:spider @@ -35,8 +35,8 @@ :: =/ parent-tako=tako (~(got by hit.dome) let.dome) =/ all-lobes=(map path lobe) - =+ .^ parent-yaki=yaki %cs - /(scot %p our)/[desk]/(scot %da now)/(scot %uv parent-tako) + =+ .^ =parent=yaki %cs + /(scot %p our)/[desk]/(scot %da now)/yaki/(scot %uv parent-tako) == =/ after-deletes %- ~(dif by q.parent-yaki) @@ -44,7 +44,7 @@ %- ~(uni by after-deletes) (~(run by new-blobs) |=(=blob p.blob)) :: -:: XX should we get getting the time later, after all async? +:: XX should we be getting the time later, after all async? ;< now=@da bind:m get-time:strandio =/ new-yaki=yaki (make-yaki ~[parent-tako] all-lobes now) :: @@ -54,72 +54,13 @@ :- (~(put by hut:*rang) r.new-yaki new-yaki) (malt (turn ~(tap by new-blobs) |=([=path =blob] [p.blob blob]))) :: -:: Checkout ankh -:: -=/ =ankh ank.dome -=. ankh - =/ dels ~(tap in deletes) - |- ^- ^ankh - =* outer-loop $ - ?~ dels - ankh - |- ^- ^ankh - =* inner-loop $ - ?~ i.dels - outer-loop(dels t.dels, fil.ankh ~) - %= ankh - dir - %+ ~(put by dir.ankh) i.i.dels - %= inner-loop - i.dels t.i.dels - ankh (~(gut by dir.ankh) i.i.dels *^ankh) - == - == -=. ankh - =/ blobs=(list [=path =blob]) ~(tap by new-blobs) - |- ^- ^ankh - =* outer-loop $ - ?~ blobs - ankh - =/ orig-path path.i.blobs - |- ^- ^ankh - =* inner-loop $ - ?~ path.i.blobs - %= outer-loop - blobs t.blobs - fil.ankh - ?> ?=(%direct -.blob.i.blobs) - :+ ~ p.blob.i.blobs - (~(got by cast-results) orig-path) - == - %= ankh - dir - %+ ~(put by dir.ankh) i.path.i.blobs - %= inner-loop - path.i.blobs t.path.i.blobs - ankh (~(gut by dir.ankh) i.path.i.blobs *^ankh) - == - == -:: -:: Checkout cache -:: -=/ mim-builds=(map path schematic:ford) - %- ~(run by cast-results) - |= =cage - [%cast [our desk] %mime %$ cage] -;< mim-results=(map path cage) bind:m (build-cages:strandio mim-builds) -=/ can-mim=(map path (unit mime)) - %- ~(run by mim-results) - |= =cage - ?> ?=(%mime p.cage) - `!<(mime q.cage) -=/ del-mim=(map path (unit mime)) - (malt (turn ~(tap in deletes) |=(=path [path ~]))) -=/ new-mim=(map path (unit mime)) - (~(uni by del-mim) can-mim) +:: Checkout ankh and mime cache (derived state) :: +=/ =ankh (checkout:clay-commit ank.dome deletes cast-results) +;< mim=(map path (unit mime)) bind:m + (checkout-cache:clay-commit desk deletes cast-results) :: Send to clay :: -=/ args [desk r.new-yaki rang ankh new-mim] +=/ args [desk r.new-yaki rang ankh mim] ;< ~ bind:m (send-raw-card:strandio %pass /commit/[desk] %arvo %c %park args) (pure:m !>(~)) diff --git a/pkg/arvo/ted/merge.hoon b/pkg/arvo/ted/merge.hoon new file mode 100644 index 000000000..97389d9d7 --- /dev/null +++ b/pkg/arvo/ted/merge.hoon @@ -0,0 +1,208 @@ +:: Merge second desk into first +:: +/- spider +/+ strandio, clay-commit +=, strand=strand:spider +=, clay +^- thread:spider +|= arg=vase +=+ !<([=bob=desk =ali=ship =ali=desk =germ ~] arg) +=/ m (strand ,vase) +^- form:m +;< our=@p bind:m get-our:strandio +;< wen=@da bind:m get-time:strandio +|^ +:: +:: Fetch current states +:: +=/ start-path /(scot %p our)/[bob-desk]/(scot %da wen) +;< =ali=riot:clay bind:m + (warp:strandio ali-ship ali-desk `[%sing %v da+wen /]) +?> ?=(^ ali-riot) +=+ !<(=ali=dome q.r.u.ali-riot) +=/ ali-tako=tako (~(got by hit.ali-dome) let.ali-dome) +=+ .^(=ali=yaki %cs (weld start-path /yaki/(scot %uv ali-tako))) +=+ .^(=bob=dome %cv start-path) +=/ bob-tako=tako (~(got by hit.bob-dome) let.bob-dome) +=+ .^(=bob=yaki %cs (weld start-path /yaki/(scot %uv bob-tako))) +:: +;< =merge-result bind:m (merge ali-yaki bob-yaki) +?~ merge-result + (pure:m !>(~)) +=/ =rang + [(malt [r .]:new.u.merge-result ~) lat.u.merge-result] +;< [=ankh changes=(map path cage)] bind:m + (checkout bob-dome new.u.merge-result [deletes changes]:u.merge-result) +;< mim=(map path (unit mime)) bind:m + (checkout-cache:clay-commit bob-desk deletes.u.merge-result changes) +=/ args [bob-desk r.new.u.merge-result rang ankh mim] +;< ~ bind:m + (send-raw-card:strandio %pass /merg/[bob-desk]/[ali-desk] %arvo %c %park args) +(pure:m !>(~)) +:: ++$ merge-result + %- unit + $: conflicts=(set path) + bop=(map path cage) + new=yaki + deletes=(set path) + changes=(set path) + lat=(map lobe blob) + == +++ merge + |= [=ali=yaki =bob=yaki] + |^ + =/ m (strand ,merge-result) + ^- form:m + ?- germ + :: + :: If this is an %init merge, we set the ali's commit to be bob's. + :: + %init + %: pure:m + ~ + conflicts=~ + bop=~ + new=ali-yaki + deletes=~ + changes=~(key by q.ali-yaki) + lat=~ + == + :: + :: If this is a %this merge, we check to see if ali's and bob's commits + :: are the same, in which case we're done. Otherwise, we check to see + :: if ali's commit is in the ancestry of bob's, in which case we're + :: done. Otherwise, we create a new commit with bob's data plus ali + :: and bob as parents. + :: + %this + ?: =(r.ali-yaki r.bob-yaki) + (pure:m ~) + ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + (pure:m ~) + =/ new-yaki (make-yaki [r.bob-yaki r.ali-yaki ~] q.bob-yaki wen) + %: pure:m + ~ + conflicts=~ + bop=~ + new=new-yaki + deletes=~ + changes=~ + lat=~ + == + :: + :: If this is a %that merge, we check to see if ali's and bob's commits + :: are the same, in which case we're done. Otherwise, we create a new + :: commit with ali's data plus ali and bob as parents. + :: + %that + ?: =(r.ali-yaki r.bob-yaki) + (pure:m ~) + =/ new-yaki (make-yaki [r.bob-yaki r.ali-yaki ~] q.ali-yaki wen) + %: pure:m + ~ + conflicts=~ + bop=~ + new=new-yaki + deletes=get-deletes + changes=get-changes + lat=~ + == + :: + :: If this is a %fine merge, we check to see if ali's and bob's commits + :: are the same, in which case we're done. Otherwise, we check to see + :: if ali's commit is in the ancestry of bob's, in which case we're + :: done. Otherwise, we check to see if bob's commit is in the ancestry + :: of ali's. If not, this is not a fast-forward merge, so we error + :: out. If it is, we add ali's commit to bob's desk and checkout. + :: + :: + %fine + ?: =(r.ali-yaki r.bob-yaki) + (pure:m ~) + ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + (pure:m ~) + ?. (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) + (strand-fail:strandio %bad-fine-merge ~) + %: pure:m + ~ + conflicts=~ + bop=~ + new=ali-yaki + deletes=get-deletes + changes=get-changes + lat=~ + == + :: + ?(%meet %mate %meld) + ~& %merge-not-implemented + !! + == + :: + ++ reachable-takos + |= tak=tako + ^- (set tako) + =/ start-path /(scot %p our)/[bob-desk]/(scot %da wen) + |- ^- (set tako) + =+ .^(=yaki %cs (weld start-path /yaki/(scot %uv tak))) + %+ roll p.yaki + =< .(takos (~(put in *(set tako)) tak)) + |= [q=tako takos=(set tako)] + ?: (~(has in takos) q) :: already done + takos :: hence skip + (~(uni in takos) ^$(tak q)) :: otherwise traverse + :: + ++ get-deletes + %- silt ^- (list path) + %+ murn ~(tap by (~(uni by q.bob-yaki) q.ali-yaki)) + |= [=path =lobe] + ^- (unit ^path) + =/ a (~(get by q.ali-yaki) path) + =/ b (~(get by q.bob-yaki) path) + ?: |(=(a b) !=(~ a)) + ~ + `path + :: + ++ get-changes + %- silt ^- (list path) + %+ murn ~(tap by (~(uni by q.bob-yaki) q.ali-yaki)) + |= [=path =lobe] + ^- (unit ^path) + =/ a (~(get by q.ali-yaki) path) + =/ b (~(get by q.bob-yaki) path) + ?: |(=(a b) =(~ a)) + ~ + `path + -- +:: +++ checkout + |^ + |= [=bob=dome =yaki deletes=(set path) changes=(set path)] + =/ m (strand ,[ankh (map path cage)]) + ^- form:m + =/ start-path /(scot %p our)/[bob-desk]/(scot %da wen) + =/ builds + %- malt + %+ turn ~(tap in changes) + |= =path + [path (lobe-to-schematic start-path (~(got by q.yaki) path))] + ;< results=(map path cage) bind:m (build-cages:strandio builds) + (pure:m (checkout:clay-commit ank.bob-dome deletes results) results) + :: + ++ lobe-to-schematic + |= [=start=path =lobe] + ^- schematic:ford + =+ .^(=blob %cs (weld start-path /blob/(scot %uv lobe))) + =/ =disc:ford [our bob-desk] + ?- -.blob + %direct (page-to-schematic disc q.blob) + %delta [%pact disc $(lobe q.q.blob) (page-to-schematic disc r.blob)] + == + :: + ++ page-to-schematic + |= [=disc:ford =page] + ?. ?=(%hoon p.page) + [%volt disc page] + [%$ p.page [%atom %t ~] q.page] + -- +-- From d70431a6b08ac9fae5ac0923651e201125e426fd Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 27 Mar 2020 20:37:22 -0700 Subject: [PATCH 006/280] clay: add %cs for hash of yaki data --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 74 +++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 33 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ad48c3062..cae990840 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cca578fefba7dba24856c63f9e907aee70505cf61a0fd404fb205575436be1a4 -size 13125460 +oid sha256:297cc4a1c8cce6b7e7313e3665a24f425e9a150cd597e738f838c5b63978119a +size 13126555 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 86b7d3af2..8c3b5ba29 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3922,22 +3922,57 @@ ?: =(%black mod.rul) !in-list in-list + :: +content-hash: get hash of contents (%cz hash) + :: + ++ content-hash + |= [=yaki pax=path] + ^- @uvI + =+ len=(lent pax) + :: ~& read-z+[yon=yon qyt=~(wyt by q.yaki) pax=pax] + =/ descendants/(list (pair path lobe)) + :: ~& %turning + :: =- ~& %turned - + %+ turn + :: ~& %skimming + :: =- ~& %skimmed - + %+ skim ~(tap by (~(del by q.yaki) pax)) + |= {paf/path lob/lobe} + =(pax (scag len paf)) + |= {paf/path lob/lobe} + [(slag len paf) lob] + =+ us=(~(get by q.yaki) pax) + ?: &(?=(~ descendants) ?=(~ us)) + *@uvI + %+ roll + ^- (list (pair path lobe)) + [[~ ?~(us *lobe u.us)] descendants] + |=({{path lobe} @uvI} (shax (jam +<))) :: +read-s: produce yaki or blob for given tako or lobe :: ++ read-s |= [yon=aeon pax=path] - ^- (unit (unit $%([%yaki (hypo yaki)] [%blob (hypo blob)]))) - ?. ?=([?(%yaki %blob) * ~] pax) + ^- (unit (unit cage)) + ?. ?=([?(%yaki %blob %hash) * ~] pax) `~ - ?: ?=(%yaki i.pax) + ?- i.pax + %yaki =/ yak=(unit yaki) (~(get by hut.ran) (slav %uv i.t.pax)) ?~ yak ~ ``yaki+[-:!>(*yaki) u.yak] - =/ bol=(unit blob) (~(get by lat.ran) (slav %uv i.t.pax)) - ?~ bol - ~ - ``blob+[-:!>(*blob) u.bol] + :: + %blob + =/ bol=(unit blob) (~(get by lat.ran) (slav %uv i.t.pax)) + ?~ bol + ~ + ``blob+[-:!>(*blob) u.bol] + :: + %hash + =/ yak=(unit yaki) (~(get by hut.ran) (slav %uv i.t.pax)) + ?~ yak + ~ + ``uvi+[-:!>(*@uvI) (content-hash u.yak /)] + == :: +read-t: produce the list of paths within a yaki with :pax as prefix :: ++ read-t @@ -4065,30 +4100,7 @@ =+ tak=(~(get by hit.dom) yon) ?~ tak ~ - =+ yak=(tako-to-yaki u.tak) - =+ len=(lent pax) - :: ~& read-z+[yon=yon qyt=~(wyt by q.yak) pax=pax] - =/ descendants/(list (pair path lobe)) - :: ~& %turning - :: =- ~& %turned - - %+ turn - :: ~& %skimming - :: =- ~& %skimmed - - %+ skim ~(tap by (~(del by q.yak) pax)) - |= {paf/path lob/lobe} - =(pax (scag len paf)) - |= {paf/path lob/lobe} - [(slag len paf) lob] - =+ us=(~(get by q.yak) pax) - ^- (unit (unit {$uvi (hypo @uvI)})) - :^ ~ ~ %uvi - :- -:!>(*@uvI) - ?: &(?=(~ descendants) ?=(~ us)) - *@uvI - %+ roll - ^- (list (pair path lobe)) - [[~ ?~(us *lobe u.us)] descendants] - |=({{path lobe} @uvI} (shax (jam +<))) + [~ ~ %uvi -:!>(*@uvI) (content-hash (tako-to-yaki u.tak) pax)] :: :: Get a value at an aeon. :: From 17fa15336f4b59d96413f102572d044fc78dbb0e Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 10 Apr 2020 20:42:56 -0700 Subject: [PATCH 007/280] clay: fix %init for -merge --- pkg/arvo/app/spider.hoon | 2 +- pkg/arvo/lib/clay-commit.hoon | 2 +- pkg/arvo/sys/vane/clay.hoon | 1 - pkg/arvo/ted/commit.hoon | 2 +- pkg/arvo/ted/merge.hoon | 32 +++++++++++++++++++++++--------- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index cac00c660..bb2f434e0 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -388,7 +388,7 @@ ++ thread-fail |= [=yarn =term =tang] ^- (quip card ^state) - %- (slog leaf+"strand {} failed" leaf+ tang) + :: %- (slog leaf+"strand {} failed" leaf+ tang) =/ =tid (yarn-to-tid yarn) =/ fail-cards (thread-say-fail tid term tang) =^ cards state (thread-clean yarn) diff --git a/pkg/arvo/lib/clay-commit.hoon b/pkg/arvo/lib/clay-commit.hoon index 47718c970..7b08c7301 100644 --- a/pkg/arvo/lib/clay-commit.hoon +++ b/pkg/arvo/lib/clay-commit.hoon @@ -58,7 +58,7 @@ :: Produce a mime cache :: ++ checkout-cache - |= [=desk deletes=(set path) changes=(map path cage)] + |= [=ship =desk deletes=(set path) changes=(map path cage)] =/ m (strand ,(map path (unit mime))) ^- form:m ;< our=@p bind:m get-our:strandio diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 8c3b5ba29..eff634e53 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1122,7 +1122,6 @@ :: =/ ford-disc=disc:ford ?: =(p.ali-disc p.bob-disc) - ali-disc bob-disc |^ diff --git a/pkg/arvo/ted/commit.hoon b/pkg/arvo/ted/commit.hoon index 23285e658..5acaeedd1 100644 --- a/pkg/arvo/ted/commit.hoon +++ b/pkg/arvo/ted/commit.hoon @@ -58,7 +58,7 @@ :: =/ =ankh (checkout:clay-commit ank.dome deletes cast-results) ;< mim=(map path (unit mime)) bind:m - (checkout-cache:clay-commit desk deletes cast-results) + (checkout-cache:clay-commit our desk deletes cast-results) :: Send to clay :: =/ args [desk r.new-yaki rang ankh mim] diff --git a/pkg/arvo/ted/merge.hoon b/pkg/arvo/ted/merge.hoon index 97389d9d7..ad303ee8b 100644 --- a/pkg/arvo/ted/merge.hoon +++ b/pkg/arvo/ted/merge.hoon @@ -23,8 +23,11 @@ =/ ali-tako=tako (~(got by hit.ali-dome) let.ali-dome) =+ .^(=ali=yaki %cs (weld start-path /yaki/(scot %uv ali-tako))) =+ .^(=bob=dome %cv start-path) -=/ bob-tako=tako (~(got by hit.bob-dome) let.bob-dome) -=+ .^(=bob=yaki %cs (weld start-path /yaki/(scot %uv bob-tako))) +=/ bob-yaki=(unit yaki) + ?~ let.bob-dome + ~ + =/ bob-tako=tako (~(got by hit.bob-dome) let.bob-dome) + `.^(=bob=yaki %cs (weld start-path /yaki/(scot %uv bob-tako))) :: ;< =merge-result bind:m (merge ali-yaki bob-yaki) ?~ merge-result @@ -34,7 +37,7 @@ ;< [=ankh changes=(map path cage)] bind:m (checkout bob-dome new.u.merge-result [deletes changes]:u.merge-result) ;< mim=(map path (unit mime)) bind:m - (checkout-cache:clay-commit bob-desk deletes.u.merge-result changes) + (checkout-cache:clay-commit ali-ship ali-desk deletes.u.merge-result changes) =/ args [bob-desk r.new.u.merge-result rang ankh mim] ;< ~ bind:m (send-raw-card:strandio %pass /merg/[bob-desk]/[ali-desk] %arvo %c %park args) @@ -50,15 +53,13 @@ lat=(map lobe blob) == ++ merge - |= [=ali=yaki =bob=yaki] - |^ + |= [=ali=yaki bob-yaki=(unit yaki)] =/ m (strand ,merge-result) ^- form:m - ?- germ + ?: ?=(%init germ) :: :: If this is an %init merge, we set the ali's commit to be bob's. :: - %init %: pure:m ~ conflicts=~ @@ -68,6 +69,9 @@ changes=~(key by q.ali-yaki) lat=~ == + =/ bob-yaki (need bob-yaki) + |^ + ?- germ :: :: If this is a %this merge, we check to see if ali's and bob's commits :: are the same, in which case we're done. Otherwise, we check to see @@ -123,7 +127,9 @@ ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) (pure:m ~) ?. (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) - (strand-fail:strandio %bad-fine-merge ~) + %^ error %bad-fine-merge + leaf+"tried fast-forward but is not ancestor or descendant" + ~ %: pure:m ~ conflicts=~ @@ -193,7 +199,7 @@ |= [=start=path =lobe] ^- schematic:ford =+ .^(=blob %cs (weld start-path /blob/(scot %uv lobe))) - =/ =disc:ford [our bob-desk] + =/ =disc:ford [ali-ship ali-desk] ?- -.blob %direct (page-to-schematic disc q.blob) %delta [%pact disc $(lobe q.q.blob) (page-to-schematic disc r.blob)] @@ -205,4 +211,12 @@ [%volt disc page] [%$ p.page [%atom %t ~] q.page] -- +:: +++ error + |= [=term =tang] + %: strand-fail:strandio term + leaf+"failed merge from {}/{} to {}/{}" + leaf+"with strategy germ" + tang + == -- From 0c2eddd39ff7ee2c7342a53ad1ea5d02264ca42e Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 10 Apr 2020 22:38:10 -0700 Subject: [PATCH 008/280] clay: add %meet strategy to -merge --- pkg/arvo/ted/merge.hoon | 132 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/ted/merge.hoon b/pkg/arvo/ted/merge.hoon index ad303ee8b..54b149036 100644 --- a/pkg/arvo/ted/merge.hoon +++ b/pkg/arvo/ted/merge.hoon @@ -141,8 +141,57 @@ == :: ?(%meet %mate %meld) - ~& %merge-not-implemented - !! + ?: =(r.ali-yaki r.bob-yaki) + (pure:m ~) + ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + (pure:m ~) + ?: (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) + $(germ %fine) + =/ merge-points find-merge-points + ?~ merge-points + %^ error %merge-no-merge-base + leaf+"consider a %this or %that merge to get a mergebase" + ~ + =/ merge-point=yaki n.merge-points + ?. ?=(%meet germ) + ~& %merge-not-implemented + !! + =/ ali-diffs=cane (calc-diffs ali-yaki merge-point) + =/ bob-diffs=cane (calc-diffs bob-yaki merge-point) + =/ both-diffs=(map path *) + %- %~ int by + %- ~(uni by `(map path *)`new.ali-diffs) + %- ~(uni by `(map path *)`cal.ali-diffs) + %- ~(uni by `(map path *)`can.ali-diffs) + `(map path *)`old.ali-diffs + %- ~(uni by `(map path *)`new.bob-diffs) + %- ~(uni by `(map path *)`cal.bob-diffs) + %- ~(uni by `(map path *)`can.bob-diffs) + `(map path *)`old.bob-diffs + ?. =(~ both-diffs) + %: error %meet-conflict >~(key by both-diffs)< + leaf+"consider a %mate merge" ~ + == + =/ not-deleted=(map path lobe) + %+ roll ~(tap by (~(uni by old.ali-diffs) old.bob-diffs)) + =< .(not-deleted q.merge-point) + |= [[pax=path ~] not-deleted=(map path lobe)] + (~(del by not-deleted) pax) + =/ hat=(map path lobe) + %- ~(uni by not-deleted) + %- ~(uni by new.ali-diffs) + %- ~(uni by new.bob-diffs) + %- ~(uni by cal.ali-diffs) + cal.bob-diffs + %: pure:m + ~ + conflicts=~ + bop=~ + new=(make-yaki [r.bob-yaki r.ali-yaki ~] hat wen) + deletes=get-deletes + changes=get-changes + lat=~ + == == :: ++ reachable-takos @@ -179,6 +228,85 @@ ?: |(=(a b) =(~ a)) ~ `path + :: + :: Find the most recent common ancestor(s). + :: + :: Pretty sure this could be a lot more efficient. + :: + ++ find-merge-points + ^- (set yaki) + =/ start-path /(scot %p our)/[bob-desk]/(scot %da wen) + %- reduce-merge-points + =+ r=(reachable-takos r.ali-yaki) + |- ^- (set yaki) + ?: (~(has in r) r.bob-yaki) (~(put in *(set yaki)) bob-yaki) + %+ roll p.bob-yaki + |= [t=tako s=(set yaki)] + ?: (~(has in r) t) + (~(put in s) .^(yaki %cs (weld start-path /yaki/(scot %uv t)))) + (~(uni in s) ^$(bob-yaki .^(yaki %cs (weld start-path /yaki/(scot %uv t))))) + :: + :: Eliminate redundant merge-point candidates + :: + ++ reduce-merge-points + |= unk=(set yaki) + =| gud=(set yaki) + =/ zar=(map tako (set tako)) + %+ roll ~(tap in unk) + |= [yak=yaki qar=(map tako (set tako))] + (~(put by qar) r.yak (reachable-takos r.yak)) + |- + ^- (set yaki) + ?~ unk gud + =+ bun=(~(del in `(set yaki)`unk) n.unk) + ?: %+ levy ~(tap by (~(uni in gud) bun)) + |= yak=yaki + !(~(has in (~(got by zar) r.yak)) r.n.unk) + $(gud (~(put in gud) n.unk), unk bun) + $(unk bun) + :: + :: The set of changes between the mergebase and one of the desks being merged + :: + :: -- `new` is the set of files in the new desk and not in the mergebase. + :: -- `cal` is the set of changes in the new desk from the mergebase except + :: for any that are also in the other new desk. + :: -- `can` is the set of changes in the new desk from the mergebase that + :: are also in the other new desk (potential conflicts). + :: -- `old` is the set of files in the mergebase and not in the new desk. + :: + +$ cane + $: new/(map path lobe) + cal/(map path lobe) + can/(map path cage) + old/(map path ~) + == + :: + :: Calculate cane knowing there are no files changed by both desks + :: + ++ calc-diffs + |= [hed=yaki bas=yaki] + ^- cane + :* %- molt + %+ skip ~(tap by q.hed) + |= [pax=path lob=lobe] + (~(has by q.bas) pax) + :: + %- molt + %+ skip ~(tap by q.hed) + |= [pax=path lob=lobe] + =+ (~(get by q.bas) pax) + |(=(~ -) =([~ lob] -)) + :: + ~ + :: + %- malt ^- (list [path ~]) + %+ murn ~(tap by q.bas) + |= [pax=path lob=lobe] + ^- (unit (pair path ~)) + ?. =(~ (~(get by q.hed) pax)) + ~ + `[pax ~] + == -- :: ++ checkout From d04191320ae68cbf903f97d386cf7042c4e777a7 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 15 Apr 2020 16:24:48 -0700 Subject: [PATCH 009/280] clay: add +promote-ford --- bin/solid.pill | 4 +-- pkg/arvo/sys/vane/clay.hoon | 49 +++++++++++++++++++++++++++++++++++++ pkg/arvo/ted/merge.hoon | 17 +++++++------ 3 files changed, 60 insertions(+), 10 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index cae990840..a849dcc48 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:297cc4a1c8cce6b7e7313e3665a24f425e9a150cd597e738f838c5b63978119a -size 13126555 +oid sha256:2c98427abee9fee5206d47863a450e0e30aaba61fb687dc8b0fe4da19b7ab336 +size 13143510 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index eff634e53..1dda955d9 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -88,6 +88,7 @@ hit/(map aeon tako) :: versions by id lab/(map @tas aeon) :: labels mim/(map path mime) :: mime cache + fod/ford-cache :: ford cache == :: :: :: Commit state. @@ -107,6 +108,34 @@ mut/(list (trel path lobe cage)) :: mutations == :: :: +:: Ford cache +:: ++$ ford-cache + $: vases=(map path [res=vase dez=(set path)]) + marks=(map mark [res=dais dez=(set path)]) + casts=(map mars [res=tube dez=(set path)]) + == +:: $mars: mark conversion request +:: $tube: mark conversion gate ++$ mars [a=mark b=mark] ++$ tube $-(vase vase) +:: $dais: processed mark core +:: ++$ dais + $_ ^| + |_ sam=vase + ++ bunt sam + ++ diff |~(new=_sam *vase) + ++ form *mark + ++ join |~([a=vase b=vase] *(unit (unit vase))) + ++ mash + |~ [a=[ship desk diff=vase] b=[ship desk diff=vase]] + *(unit vase) + ++ pact |~(diff=vase sam) + ++ vale |~(noun sam) + ++ volt |~(noun sam) + -- +:: :: Hash of a blob, for lookup in the object store (lat.ran) :: ++ lobe @uvI :: blob ref @@ -2929,6 +2958,26 @@ == wake:ergo :: + ++ promote-ford + |= [=ford-cache deletes=(set path) changes=(map path (each page lobe))] + =/ invalid=(set path) (~(uni in deletes) ~(key by changes)) + =: vases.ford-cache ((invalidate path vase) vases.ford-cache invalid) + marks.ford-cache ((invalidate mark dais) marks.ford-cache invalid) + casts.ford-cache ((invalidate mars tube) casts.ford-cache invalid) + == + ford-cache + :: + ++ invalidate + |* [key=mold value=mold] + |= [cache=(map key [value dez=(set path)]) invalid=(set path)] + =/ builds=(list [key value dez=(set path)]) ~(tap by cache) + |- ^+ cache + ?~ builds + ~ + ?: ?=(^ (~(int in dez.i.builds) invalid)) + $(builds t.builds) + (~(put by $(builds t.builds)) i.builds) + :: ++ ergo ^+ ..park =/ must (must-ergo:util her syd mon (turn ~(tap by mim) head)) diff --git a/pkg/arvo/ted/merge.hoon b/pkg/arvo/ted/merge.hoon index 54b149036..54ae588c6 100644 --- a/pkg/arvo/ted/merge.hoon +++ b/pkg/arvo/ted/merge.hoon @@ -44,14 +44,15 @@ (pure:m !>(~)) :: +$ merge-result - %- unit - $: conflicts=(set path) - bop=(map path cage) - new=yaki - deletes=(set path) - changes=(set path) - lat=(map lobe blob) - == + %- unit + $: conflicts=(set path) + bop=(map path cage) + new=yaki + deletes=(set path) + changes=(set path) + lat=(map lobe blob) + == +:: ++ merge |= [=ali=yaki bob-yaki=(unit yaki)] =/ m (strand ,merge-result) From 310f5d19efa9ef8b4463315b2ab8a38deb0b7e06 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 15 Apr 2020 17:47:45 -0700 Subject: [PATCH 010/280] clay: add stubs for %a, %b, and %c cares --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/clay.hoon | 44 ++++++++++++++++++++++++++++++++++--- pkg/arvo/sys/zuse.hoon | 2 +- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a849dcc48..f49b870a3 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c98427abee9fee5206d47863a450e0e30aaba61fb687dc8b0fe4da19b7ab336 -size 13143510 +oid sha256:73eb5d108deabf4a97018f2bb3ef84ba687180eebde77c0b0c6d22955ce213b0 +size 13151294 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 1dda955d9..9f03073ef 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1964,6 +1964,9 @@ =/ m request-clad ^- form:m ?- p.p.rand + $a ~| %no-big-ford-builds-across-network-for-now !! + $b ~| %i-guess-you-ought-to-build-your-own-marks !! + $c ~| %casts-should-be-compiled-on-your-own-ship !! $d ~| %totally-temporary-error-please-replace-me !! $p ~| %requesting-foreign-permissions-is-invalid !! $s ~| %please-dont-get-your-takos-over-a-network !! @@ -1972,9 +1975,7 @@ $v ~| %weird-shouldnt-get-v-request-from-network !! $z ~| %its-prolly-not-reasonable-to-request-ankh !! $x (validate-x [p.p q.p q r]:rand) - :: - $y - (pure:m [p.r.rand !>(;;(arch q.r.rand))]) + $y (pure:m [p.r.rand !>(;;(arch q.r.rand))]) :: $w %- pure:m @@ -3899,6 +3900,40 @@ $delta (~(put in $(lob q.q.gar)) lob) == :: + ++ read-a + |= [=aeon =path] + ^- (unit (unit (each cage lobe))) + ?. =(aeon let.dom) + ~ + =/ vase=(unit [=vase *]) (~(get by vases.fod.dom) path) + ?~ vase + [~ ~] + [~ ~ %& %vase !>(vase.u.vase)] + :: + ++ read-b + |= [=aeon =path] + ^- (unit (unit (each cage lobe))) + ?. =(aeon let.dom) + ~ + ?. ?=([@ ~] path) + [~ ~] + =/ dais=(unit [=dais *]) (~(get by marks.fod.dom) i.path) + ?~ dais + [~ ~] + [~ ~ %& %dais !>(dais.u.dais)] + :: + ++ read-c + |= [=aeon =path] + ^- (unit (unit (each cage lobe))) + ?. =(aeon let.dom) + ~ + ?. ?=([@ @ ~] path) + [~ ~] + =/ tube=(unit [=tube *]) (~(get by casts.fod.dom) [i i.t]:path) + ?~ tube + [~ ~] + [~ ~ %& %tube !>(tube.u.tube)] + :: :: Gets the permissions that apply to a particular node. :: :: If the node has no permissions of its own, we use its parent's. @@ -4172,6 +4207,9 @@ ~&(%no-cd-path [~ ~]) [~ ~ %& %noun !>(~(key by dos.rom.ruf))] :: + %a (read-a yon path.mun) + %b (read-b yon path.mun) + %c (read-c yon path.mun) %p (read-p path.mun) %s (bind (read-s yon path.mun) (lift |=(a=cage [%& a]))) %t (bind (read-t yon path.mun) (lift |=(a=cage [%& a]))) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 7b299a580..8940a89a7 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -593,7 +593,7 @@ $% {$delta p/lobe q/{p/mark q/lobe} r/page} :: delta on q {$direct p/lobe q/page} :: immediate == :: - ++ care ?($d $p $s $t $u $v $w $x $y $z) :: clay submode + ++ care ?($a $b $c $d $p $s $t $u $v $w $x $y $z) :: clay submode ++ case :: ship desk case spur $% {$da p/@da} :: date {$tas p/@tas} :: label From 311cf5329c2cd5e119dee715283b1e2d394d69d2 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 15 Apr 2020 19:10:22 -0700 Subject: [PATCH 011/280] clay: integrate ford vase and mark without cache --- pkg/arvo/sys/vane/clay.hoon | 359 +++++++++++++++++++++++++++++++++++- 1 file changed, 349 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 9f03073ef..98cf4bdff 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2621,6 +2621,330 @@ -- -- -- +:: +++ fusion + => + |% + :: $pile: preprocessed hoon source file + :: + +$ pile + $: =mont + =hoon + == + :: $mont: imports declaration + :: + :: /- imports from /sur + :: /+ imports from /lib + :: /= imports from some other path + :: + +$ mont + $: sur=(list taut) + lib=(list taut) + raw=(list [face=term =path]) + == + :: $taut: file import from /lib or /sur + :: + +$ taut [face=(unit term) pax=term] + :: +an: $ankh interface door + :: + ++ an + |_ nak=ankh + :: +get: produce file at path + :: + ++ get + |= =path + ^- (unit cage) + ?~ path + ?~ fil.nak + ~ + `q.u.fil.nak + ?~ kid=(~(get by dir.nak) i.path) + ~ + $(nak u.kid, path t.path) + :: +get-fit: produce file at path with /'s maybe converted to -'s + :: + ++ get-fit + |= pax=path + ^- (unit path) + ?> ?=([* * ~] pax) + =- ?~(- ~ `[i.pax u.-]) + =. nak (~(got by dir.nak) i.pax) + ?^ got=(get t.pax) + (some t.pax) + =/ seg=tape (trip i.t.pax) + ?~ dex=(find "-" seg) + ~ + =/ hed (crip (scag u.dex seg)) + =/ tal (crip (slag +(u.dex) seg)) + $(pax /[hed]/[tal]) + -- + ++ with-face |=([face=@tas =vase] vase(p [%face face p.vase])) + ++ with-faces + =| res=(unit vase) + |= vaz=(list [face=@tas =vase]) + ^- vase + ?~ vaz (need res) + =/ faz (with-face i.vaz) + =. res `?~(res faz (slop faz u.res)) + $(vaz t.vaz) + -- + |% + ++ ford + => |% + +$ state + $: baked=(map path cage) + cache=ford-cache + stack=(list (set path)) + == + -- + |= $: =ankh + deletes=(set path) + changes=(map path (each page lobe)) + file-store=(map lobe blob) + =ford-cache + == + :: nub: internal mutable state for this computation + :: + =| nub=state + =. cache.nub ford-cache + |% + :: +pop-stack: pop build stack, copying deps downward + :: + ++ pop-stack + ^- [(set path) _stack.nub] + =^ top=(set path) stack.nub stack.nub + =? stack.nub ?=(^ stack.nub) + stack.nub(i (~(uni in i.stack.nub) top)) + [top stack.nub] + :: + ++ get-value + |= =path + ^- [(unit cage) state] + ?^ cage=(~(get by baked.nub) path) + [cage nub] + ?^ change=(~(get by changes) path) + =^ page nub + ?: ?=(%& -.u.change) + [p.u.change nub] + ~| %ugly-lobe^p.u.change^path + (lobe-to-page p.u.change) + =^ cage nub (validate-path path page) + [`cage nub] + ?: (~(has in deletes) path) + [~ nub] + [(~(get an ankh) path) nub] + :: +get-mark: build a mark definition + :: + ++ get-mark + |= mak=mark + ^- [dais state] + ?^ got=(~(get by marks.cache.nub) mak) + =? stack.nub ?=(^ stack.nub) + stack.nub(i (~(uni in i.stack.nub) dez.u.got)) + [res.u.got nub] + =. stack.nub [~ stack.nub] + =^ cor=vase nub (build-fit /mar/[mak]) + =; res=[=dais nub=state] + =. nub nub.res + =^ top stack.nub pop-stack + =. marks.cache.nub (~(put by marks.cache.nub) mak [dais.res top]) + [dais.res nub] + =/ gad=vase (slap cor %limb %grad) + ?@ q.gad + =+ !<(mok=mark gad) + =^ deg=dais nub $(mak mok) + =^ tub=tube nub (get-cast mak mok) + =^ but=tube nub (get-cast mok mak) + :_ nub + ^- dais + |_ sam=vase + ++ bunt (slap cor $+6) + ++ diff + |= new=vase + ^- vase + (~(diff deg (tub sam)) (tub new)) + ++ form form:deg + ++ join join:deg + ++ mash mash:deg + ++ pact + |= diff=vase + ^+ sam + (but (~(pact deg (tub sam)) diff)) + ++ vale + |= =noun + ^+ sam + (slam (slap cor ^~((ream 'noun:grab'))) !>(noun)) + ++ volt + |= =noun + ^+ sam + [p:bunt noun] + -- + :_ nub + =+ !<(fom=mark (slap gad %limb %form)) + ^- dais + |_ sam=vase + ++ bunt (slap cor $+6) + ++ diff + |= new=vase + ^- vase + %+ slap + (with-faces cor+cor sam+sam new+new ~) + ^~((ream '(diff:~(grad cor sam) new)')) + ++ form fom + ++ join + |= [a=vase b=vase] + ^- (unit (unit vase)) + ?: =(q.a q.b) + ~ + =; res `?~(q.res ~ `(slap res ^~((ream '?~(. !! u)')))) + (slam (slap cor ^~((ream 'join:grad'))) (slop a b)) + ++ mash + |= [a=[=ship =desk diff=vase] b=[=ship =desk diff=vase]] + ^- (unit vase) + ?: =(q.diff.a q.diff.b) + ~ + :- ~ + %+ slam (slap cor ^~((ream 'mash:grad'))) + %+ slop + :(slop !>(ship.a) !>(desk.a) diff.a) + :(slop !>(ship.b) !>(desk.b) diff.b) + ++ pact + |= diff=vase + ^+ sam + %+ slap + (with-faces cor+cor sam+sam diff+diff ~) + ^~((ream '(pact:~(grad cor sam) diff)')) + ++ vale + |= =noun + ^+ sam + (slam (slap cor ^~((ream 'noun:grab'))) !>(noun)) + ++ volt + |= =noun + ^+ sam + [p:bunt noun] + -- + :: + ++ get-cast + |= [a=mark b=mark] + ^- [tube state] + !! + ++ lobe-to-page + |= =lobe + ^- [page state] + =/ =blob (~(got by file-store) lobe) + |- ^- [page state] + ?- -.blob + %direct [q.blob nub] + %delta + =/ [[=mark =parent=^lobe] diff=page] [q r]:blob + =^ parent-page nub $(blob (~(got by file-store) parent-lobe)) + =^ =cage nub (run-pact parent-page diff) + [[p q.q]:cage nub] + == + ++ validate-path + |= [=path =page] + ^- [cage state] + !! + ++ cast-path + |= [=path =mark] + ^- [cage state] + !! + ++ run-pact + |= [old=page diff=page] + ^- [cage state] + !! + ++ build-file + |= =path + ^- [vase state] + ?^ got=(~(get by vases.cache.nub) path) + =? stack.nub ?=(^ stack.nub) + stack.nub(i (~(uni in i.stack.nub) dez.u.got)) + [res.u.got nub] + =. stack.nub [(sy path ~) stack.nub] + =^ cag=(unit cage) nub (get-value path) + ?~ cag ~|(no-file+path !!) + ?> =(%hoon p.u.cag) + =/ tex=tape (trip !<(@t q.u.cag)) + =/ =pile (parse-pile path tex) + =^ sut=vase nub run-reef + =^ sut=vase nub (run-tauts sut %sur sur.mont.pile) + =^ sut=vase nub (run-tauts sut %lib lib.mont.pile) + =^ sut=vase nub (run-raw sut raw.mont.pile) + =/ res=vase (slap sut hoon.pile) + =^ top stack.nub pop-stack + =. vases.cache.nub (~(put by vases.cache.nub) path [res top]) + [res nub] + :: + ++ parse-pile + |= [=path tex=tape] + ^- pile + ~| parse-fail+path :: TODO: better error reporting + =/ [=mont =nail] (parse-mont tex) + =/ [=hair res=(unit [src=(list hoon) ^nail])] + ((most gap tall:(vang & path)) nail) + [mont tssg+src:(need res)] + :: + ++ parse-mont + |= tex=tape + ^- [mont nail] + =/ [=hair res=(unit [=mont =nail])] (mont-rule [1 1] tex) + (need res) :: TODO: better error reporting + :: + ++ mont-rule + %+ ifix [gay gay] + %+ cook |=(mont +<) + ;~ plug + %+ cook |=((list (list taut)) (zing +<)) + %+ more gap + %+ ifix [;~(plug net hep gap) gap] + (most ;~(plug com gaw) taut-rule) + :: + %+ cook |=((list (list taut)) (zing +<)) + %+ more gap + %+ ifix [;~(plug net lus gap) gap] + (most ;~(plug com gaw) taut-rule) + :: + %+ cook |=((list [face=term =path]) +<) + %+ more gap + %+ ifix [;~(plug net tis gap) gap] + %+ cook |=([term path] +<) + ;~(plug sym ;~(pfix ;~(plug gap net) (more net urs:ab))) + == + :: + ++ taut-rule + %+ cook |=(taut +<) + ;~ pose + (stag ~ ;~(pfix tar sym)) + ;~(plug (stag ~ sym) ;~(pfix tis sym)) + (cook |=(a=term [`a a]) sym) + == + :: + ++ run-tauts + |= [sut=vase wer=?(%lib %sur) taz=(list taut)] + ^- [vase state] + ?~ taz [sut nub] + =^ pin=vase nub (build-fit /[wer]/[pax.i.taz]) + =? p.pin ?=(^ face.i.taz) [%face u.face.i.taz p.pin] + $(sut (slop pin sut), taz t.taz) + :: + ++ run-raw + |= [sut=vase raw=(list [face=term =path])] + ^- [vase state] + ?~ raw [sut nub] + =^ pin=vase nub (build-file path.i.raw) + =. p.pin [%face face.i.raw p.pin] + $(sut (slop pin sut), raw t.raw) + :: + ++ run-reef + ^- [vase state] + [!>(..zuse) nub] :: TODO implement + :: + ++ build-fit + |= pax=path + ^- [vase state] + (build-file ~|(no-file+pax (need (~(get-fit an ankh) pax)))) + -- + -- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 4cA, filesystem logic :: @@ -3900,15 +4224,28 @@ $delta (~(put in $(lob q.q.gar)) lob) == :: + :: Probably can get rid of the cache checks because they happen in + :: ford + :: ++ read-a |= [=aeon =path] ^- (unit (unit (each cage lobe))) ?. =(aeon let.dom) ~ - =/ vase=(unit [=vase *]) (~(get by vases.fod.dom) path) - ?~ vase + =/ cached=(unit [=vase *]) (~(get by vases.fod.dom) path) + ?^ cached + [~ ~ %& %vase !>(vase.u.cached)] + =/ x (read-x aeon path) + ?~ x + ~ + ?~ u.x [~ ~] - [~ ~ %& %vase !>(vase.u.vase)] + :: should never happen at current aeon + ?: ?=(%| -.u.u.x) + ~ + =/ [=vase =state:ford:fusion] + (build-file:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) path) + [~ ~ %& %vase !>(vase)] :: ++ read-b |= [=aeon =path] @@ -3917,10 +4254,12 @@ ~ ?. ?=([@ ~] path) [~ ~] - =/ dais=(unit [=dais *]) (~(get by marks.fod.dom) i.path) - ?~ dais - [~ ~] - [~ ~ %& %dais !>(dais.u.dais)] + =/ cached=(unit [=dais *]) (~(get by marks.fod.dom) i.path) + ?^ cached + [~ ~ %& %dais !>(dais.u.cached)] + =/ [=dais =state:ford:fusion] + (get-mark:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) i.path) + [~ ~ %& %dais !>(dais)] :: ++ read-c |= [=aeon =path] @@ -3929,10 +4268,10 @@ ~ ?. ?=([@ @ ~] path) [~ ~] - =/ tube=(unit [=tube *]) (~(get by casts.fod.dom) [i i.t]:path) - ?~ tube + =/ cached=(unit [=tube *]) (~(get by casts.fod.dom) [i i.t]:path) + ?~ cached [~ ~] - [~ ~ %& %tube !>(tube.u.tube)] + [~ ~ %& %tube !>(tube.u.cached)] :: :: Gets the permissions that apply to a particular node. :: From 6441116e9fa4ff5c22b5a8257128b2bfbfff5e7b Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 15 Apr 2020 19:55:41 -0700 Subject: [PATCH 012/280] clay: get-fit fix from ted --- pkg/arvo/sys/vane/clay.hoon | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 98cf4bdff..179a7f28f 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2666,10 +2666,16 @@ ++ get-fit |= pax=path ^- (unit path) + :: add the hoon extension to the result + :: + =- ?~(- ~ `(snoc u.- %hoon)) + |- ^- (unit path) ?> ?=([* * ~] pax) + :: put the prefix back on the result + :: =- ?~(- ~ `[i.pax u.-]) =. nak (~(got by dir.nak) i.pax) - ?^ got=(get t.pax) + ?^ got=(get (snoc t.pax %hoon)) (some t.pax) =/ seg=tape (trip i.t.pax) ?~ dex=(find "-" seg) From 522a7fb933cb4657e133c6067757c0a937336f4b Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 15 Apr 2020 20:12:47 -0700 Subject: [PATCH 013/280] clay: add -read to demonstrate live ford builds --- pkg/arvo/ted/read.hoon | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 pkg/arvo/ted/read.hoon diff --git a/pkg/arvo/ted/read.hoon b/pkg/arvo/ted/read.hoon new file mode 100644 index 000000000..9da53401c --- /dev/null +++ b/pkg/arvo/ted/read.hoon @@ -0,0 +1,20 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +:: Parse arguments as ship, desk, and path +:: +=+ !<([=target=path ~] arg) +:: Read the file, possibly asyncrhonously +:: +;< =bowl:spider bind:m get-bowl:strandio +;< =riot:clay bind:m + (warp:strandio our.bowl %home ~ %next %a [%da now.bowl] target-path) +?~ riot + ~& %nothing + (pure:m !>("nothing")) +%- (slog leaf+"got writ" (sell !<(vase q.r.u.riot)) ~) +(pure:m !<(vase q.r.u.riot)) From 35c39bf0764b228b4c41d841a2287fef11ea2dfc Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 08:45:48 -0400 Subject: [PATCH 014/280] ford-fusion: +get-cast compiles, initial tests pass --- pkg/arvo/gen/hello.hoon | 3 +- pkg/arvo/sys/vane/clay.hoon | 72 +++++++++++++++++++++++++++++-- pkg/arvo/tests/sys/vane/clay.hoon | 52 +++++++++++++++++++++- 3 files changed, 120 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/gen/hello.hoon b/pkg/arvo/gen/hello.hoon index 41a2c1cf8..49d320833 100644 --- a/pkg/arvo/gen/hello.hoon +++ b/pkg/arvo/gen/hello.hoon @@ -2,7 +2,8 @@ :: :::: /hoon/hello/gen :: -/? 310 +:: TODO: reinstate +::/? 310 :: :::: :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 179a7f28f..fff45bcd3 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2726,6 +2726,7 @@ ++ get-value |= =path ^- [(unit cage) state] + ~| %error-validating-path^path ?^ cage=(~(get by baked.nub) path) [cage nub] ?^ change=(~(get by changes) path) @@ -2744,17 +2745,18 @@ ++ get-mark |= mak=mark ^- [dais state] + ~| %error-building-mark^mak ?^ got=(~(get by marks.cache.nub) mak) =? stack.nub ?=(^ stack.nub) stack.nub(i (~(uni in i.stack.nub) dez.u.got)) [res.u.got nub] =. stack.nub [~ stack.nub] - =^ cor=vase nub (build-fit /mar/[mak]) =; res=[=dais nub=state] =. nub nub.res =^ top stack.nub pop-stack =. marks.cache.nub (~(put by marks.cache.nub) mak [dais.res top]) [dais.res nub] + =^ cor=vase nub (build-fit /mar/[mak]) =/ gad=vase (slap cor %limb %grad) ?@ q.gad =+ !<(mok=mark gad) @@ -2829,11 +2831,58 @@ ^+ sam [p:bunt noun] -- + :: +get-cast: produce a $tube mark conversion gate from .a to .b :: ++ get-cast |= [a=mark b=mark] ^- [tube state] - !! + ~| error-building-cast+[a b] + ?^ got=(~(get by casts.cache.nub) [a b]) + =? stack.nub ?=(^ stack.nub) + stack.nub(i (~(uni in i.stack.nub) dez.u.got)) + [res.u.got nub] + =. stack.nub [~ stack.nub] + =; res=[=tube nub=state] + =. nub nub.res + =^ top stack.nub pop-stack + =. casts.cache.nub (~(put by casts.cache.nub) [a b] [tube.res top]) + [tube.res nub] + :: try +grow + :: + =^ old=vase nub (build-fit /mar/[a]) + =/ row (mule |.((slap old (ream (cat 3 b ':grow'))))) + ?: ?=(%& -.row) + :_ nub + ^- tube + |= sam=vase + ^- vase + %+ slap + (with-faces old+old sam+sam ~) + (ream (cat 3 b ':~(grow old sam)')) + :: try direct +grab + :: + =^ new=vase nub (build-fit /mar/[b]) + =/ rab (mule |.((slap new (ream (cat 3 a ':grab'))))) + ?: &(?=(%& -.rab) ?=(^ q.p.rab)) + :_(nub |=(sam=vase (slam p.rab sam))) + :: try +jump + :: + =/ jum (mule |.((slap old (ream (cat 3 b ':jump'))))) + ?: ?=(%& -.jum) + (compose-casts a !<(mark p.jum) b) + :: try indirect +grab + :: + ?: ?=(%& -.rab) + (compose-casts a !<(mark p.rab) b) + ~|(no-cast-from+[a b] !!) + :: + ++ compose-casts + |= [x=mark y=mark z=mark] + ^- [tube state] + =^ uno=tube nub (get-cast x y) + =^ dos=tube nub (get-cast y z) + :_(nub |=(sam=vase (dos (uno sam)))) + :: ++ lobe-to-page |= =lobe ^- [page state] @@ -2847,10 +2896,17 @@ =^ =cage nub (run-pact parent-page diff) [[p q.q]:cage nub] == + :: ++ validate-path |= [=path =page] ^- [cage state] - !! + ?. =((head (flop path)) p.page) + !! :: TODO cast + ?: =(%hoon p.page) + :_(nub [%hoon -:!>(*@t) q.page]) + =^ =dais nub (get-mark p.page) + :_(nub [p.page (vale:dais q.page)]) + :: ++ cast-path |= [=path =mark] ^- [cage state] @@ -2861,6 +2917,7 @@ !! ++ build-file |= =path + ~| %error-building^path ^- [vase state] ?^ got=(~(get by vases.cache.nub) path) =? stack.nub ?=(^ stack.nub) @@ -2899,6 +2956,14 @@ ++ mont-rule %+ ifix [gay gay] %+ cook |=(mont +<) +::TODO: reinstate +:: ;~ pfix +:: :: parse optional /? and ignore +:: :: +:: ;~ pose +:: (cold ~ ;~(plug net wut gap dem)) +:: (easy ~) +:: == ;~ plug %+ cook |=((list (list taut)) (zing +<)) %+ more gap @@ -4587,7 +4652,6 @@ ruf=raft :: revision tree == :: |= [our=ship now=@da eny=@uvJ ski=sley] :: current invocation -^? :: opaque core |% :: ++ call :: handle request |= $: hen=duct diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 1ffe32653..95c7c91b4 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -1,14 +1,62 @@ -/+ *test, test-ford-external +/+ *test, test-ford-external, clay-raw=clay :: -/= clay-raw /: /===/sys/vane/clay /!noun/ +/= hello-gen /: /===/gen/hello /hoon/ +::/= clay-raw /: /===/sys/vane/clay /!noun/ :: !: =, format :: =/ test-pit=vase !>(..zuse) =/ clay-gate (clay-raw test-pit) +=/ fusion fusion:clay-gate :: |% +++ test-get-fit ^- tang + =/ =ankh:clay + :- fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %mar fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %foo fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %bar fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %hoon fil=`[*lobe:clay hoon+!>('baz')] dir=~ + == == == == + %+ expect-eq + !> `(unit path)`[~ /mar/foo/bar/hoon] + !> (~(get-fit an:fusion ankh) /mar/foo-bar) +:: +++ test-parse-pile ^- tang + %+ expect-eq + !> ^- pile:fusion + :- [~ ~ ~] + tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~ + !> (parse-pile:(ford):fusion /sur/foo/hoon ".") +:: +++ test-hello-gen ^- tang + =/ =ankh:clay + :- fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %gen fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %hello fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %hoon fil=`[*lobe:clay hoon+!>(hello-gen)] dir=~ + == == == + =/ ford + %: ford:fusion + ankh + deletes=~ + changes=(my [/gen/hello/hoon &+hoon+hello-gen]~) + file-store=~ + *ford-cache:fusion + == + =/ res=vase -:(build-file:ford /gen/hello/hoon) + %+ expect-eq + !> noun+'hello, bob' + (slap res (ream '(+ [*^ [%bob ~] ~])')) +:: ++ test-info ^- tang =^ results0 clay-gate %- clay-call :* From 5854162e74c8924ab448e5ce9e03cb2c5678ad76 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 08:56:06 -0400 Subject: [PATCH 015/280] ford-fusion: parse /? --- pkg/arvo/gen/hello.hoon | 2 +- pkg/arvo/sys/vane/clay.hoon | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/gen/hello.hoon b/pkg/arvo/gen/hello.hoon index 49d320833..b2a75750e 100644 --- a/pkg/arvo/gen/hello.hoon +++ b/pkg/arvo/gen/hello.hoon @@ -3,7 +3,7 @@ :::: /hoon/hello/gen :: :: TODO: reinstate -::/? 310 +/? 310 :: :::: :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index fff45bcd3..1d001329a 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2956,14 +2956,13 @@ ++ mont-rule %+ ifix [gay gay] %+ cook |=(mont +<) -::TODO: reinstate -:: ;~ pfix -:: :: parse optional /? and ignore -:: :: -:: ;~ pose -:: (cold ~ ;~(plug net wut gap dem)) -:: (easy ~) -:: == + ;~ pfix + :: parse optional /? and ignore + :: + ;~ pose + (cold ~ ;~(plug net wut gap dem gap)) + (easy ~) + == ;~ plug %+ cook |=((list (list taut)) (zing +<)) %+ more gap @@ -2980,7 +2979,7 @@ %+ ifix [;~(plug net tis gap) gap] %+ cook |=([term path] +<) ;~(plug sym ;~(pfix ;~(plug gap net) (more net urs:ab))) - == + == == :: ++ taut-rule %+ cook |=(taut +<) From b285ebe407750f2533ac1bdc1ffcda60feed3780 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 09:08:03 -0400 Subject: [PATCH 016/280] test: +expect-yes, +expect-crash --- pkg/arvo/lib/test.hoon | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/arvo/lib/test.hoon b/pkg/arvo/lib/test.hoon index 7e4eca44a..16d90cd5a 100644 --- a/pkg/arvo/lib/test.hoon +++ b/pkg/arvo/lib/test.hoon @@ -1,6 +1,20 @@ :: testing utilities meant to be directly used from files in %/tests :: |% +++ expect-yes + |= [message=tape actual=?] + ^- tang + ?: actual ~ + [leaf+message]~ +:: +++ expect-crash + |* [message=tape go=(trap)] + ^- tang + =/ res (mule go) + ?- -.res + %| ~ + %& ~[leaf+"expected crash" leaf+message] + == :: +expect-eq: compares :expected and :actual and pretty-prints the result :: ++ expect-eq From dcf2c0ec519bc9e382bd78b827eaf8122b2d1e07 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 09:08:18 -0400 Subject: [PATCH 017/280] ford-fusion: +test-parse-fail --- pkg/arvo/tests/sys/vane/clay.hoon | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 95c7c91b4..50f10f5e7 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -34,6 +34,10 @@ tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~ !> (parse-pile:(ford):fusion /sur/foo/hoon ".") :: +++ test-parse-fail ^- tang + %+ expect-crash "parsing should have failed" + |. (parse-pile:(ford):fusion /sur/foo/hoon "[") +:: ++ test-hello-gen ^- tang =/ =ankh:clay :- fil=~ From 6e12f71789351bb484d16e31d3373f99cbd4ba30 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 09:28:14 -0400 Subject: [PATCH 018/280] ford-fusion: +validate-path, +cast-path --- pkg/arvo/sys/vane/clay.hoon | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 1d001329a..ed0d08826 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2900,17 +2900,32 @@ ++ validate-path |= [=path =page] ^- [cage state] - ?. =((head (flop path)) p.page) - !! :: TODO cast + =/ mak=mark (head (flop path)) + ?: =(mak p.page) + (page-to-cage page) + =^ [mark vax=vase] nub (page-to-cage page) + =^ =tube nub (get-cast p.page mak) + :_(nub [mak (tube vax)]) + :: + ++ page-to-cage + |= =page + ^- [cage state] ?: =(%hoon p.page) :_(nub [%hoon -:!>(*@t) q.page]) =^ =dais nub (get-mark p.page) :_(nub [p.page (vale:dais q.page)]) :: ++ cast-path - |= [=path =mark] + |= [=path mak=mark] ^- [cage state] - !! + =^ cag=(unit cage) nub (get-value path) + ?~ cag ~|(cannot-resolve-path+path !!) + =/ mok (head (flop path)) + ?: =(mok mak) + [u.cag nub] + =^ =tube nub (get-cast mak mok) + :_(nub [mak (tube q.u.cag)]) + :: ++ run-pact |= [old=page diff=page] ^- [cage state] From 95f27d4a7b7132ae1dc0f5419ae3d86803b079f0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 09:38:34 -0400 Subject: [PATCH 019/280] ford-fusion: +run-pact compiles --- pkg/arvo/sys/vane/clay.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index ed0d08826..9bf62018a 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2929,7 +2929,10 @@ ++ run-pact |= [old=page diff=page] ^- [cage state] - !! + =^ dys=dais nub (get-mark p.old) + =^ syd=dais nub (get-mark p.diff) + :_(nub [p.old (~(pact dys (vale:dys q.old)) (vale:syd q.diff))]) + :: ++ build-file |= =path ~| %error-building^path From 241a7165d4828fc70d94ba1088609b6683ea5244 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 09:40:59 -0400 Subject: [PATCH 020/280] test: remove redundant helpers --- pkg/arvo/lib/test.hoon | 14 -------------- pkg/arvo/tests/sys/vane/clay.hoon | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/pkg/arvo/lib/test.hoon b/pkg/arvo/lib/test.hoon index 16d90cd5a..7e4eca44a 100644 --- a/pkg/arvo/lib/test.hoon +++ b/pkg/arvo/lib/test.hoon @@ -1,20 +1,6 @@ :: testing utilities meant to be directly used from files in %/tests :: |% -++ expect-yes - |= [message=tape actual=?] - ^- tang - ?: actual ~ - [leaf+message]~ -:: -++ expect-crash - |* [message=tape go=(trap)] - ^- tang - =/ res (mule go) - ?- -.res - %| ~ - %& ~[leaf+"expected crash" leaf+message] - == :: +expect-eq: compares :expected and :actual and pretty-prints the result :: ++ expect-eq diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 50f10f5e7..0608d677b 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -35,7 +35,7 @@ !> (parse-pile:(ford):fusion /sur/foo/hoon ".") :: ++ test-parse-fail ^- tang - %+ expect-crash "parsing should have failed" + %- expect-fail |. (parse-pile:(ford):fusion /sur/foo/hoon "[") :: ++ test-hello-gen ^- tang From ea23be39737e7bbe9ca15c51149b524d90a6df26 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 09:55:48 -0400 Subject: [PATCH 021/280] ford-fusion: report syntax errors --- pkg/arvo/sys/vane/clay.hoon | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 9bf62018a..20682a7a6 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2959,17 +2959,30 @@ ++ parse-pile |= [=path tex=tape] ^- pile - ~| parse-fail+path :: TODO: better error reporting - =/ [=mont =nail] (parse-mont tex) + =/ [=mont =nail] (parse-mont path tex) =/ [=hair res=(unit [src=(list hoon) ^nail])] ((most gap tall:(vang & path)) nail) - [mont tssg+src:(need res)] + ?^ res [mont tssg+src:(need res)] + %- mean + =/ lyn p.hair + =/ col q.hair + :~ leaf+"syntax error at [{} {}] in {}" + leaf+(trip (snag (dec lyn) (to-wain:format (crip tex)))) + leaf+(runt [(dec col) '-'] "^") + == :: ++ parse-mont - |= tex=tape + |= [=path tex=tape] ^- [mont nail] =/ [=hair res=(unit [=mont =nail])] (mont-rule [1 1] tex) - (need res) :: TODO: better error reporting + ?^ res u.res + %- mean + =/ lyn p.hair + =/ col q.hair + :~ leaf+"syntax error in imports at [{} {}] in {}" + leaf+(trip (snag (dec lyn) (to-wain:format (crip tex)))) + leaf+(runt [(dec col) '-'] "^") + == :: ++ mont-rule %+ ifix [gay gay] From 46ee902eaa1c03bd714cfe82487974c25b2a1d6c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 15:00:03 -0400 Subject: [PATCH 022/280] ford-fusion: hook up %cc scry to +get-cast --- pkg/arvo/sys/vane/clay.hoon | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 20682a7a6..5024ecda2 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -4370,9 +4370,11 @@ ?. ?=([@ @ ~] path) [~ ~] =/ cached=(unit [=tube *]) (~(get by casts.fod.dom) [i i.t]:path) - ?~ cached - [~ ~] - [~ ~ %& %tube !>(tube.u.cached)] + ?^ cached + [~ ~ %& %tube !>(tube.u.cached)] + =/ [=tube =state:ford:fusion] + (get-cast:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) [i i.t]:path) + [~ ~ %& %tube !>(tube)] :: :: Gets the permissions that apply to a particular node. :: From 3592b7e5bc6411db7da355bc02d657e474081db7 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 16:09:02 -0400 Subject: [PATCH 023/280] ford-fusion: minor +promote-ford cleanup --- pkg/arvo/sys/vane/clay.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 5024ecda2..10e33df56 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3386,12 +3386,12 @@ :: ++ promote-ford |= [=ford-cache deletes=(set path) changes=(map path (each page lobe))] + ^+ ford-cache =/ invalid=(set path) (~(uni in deletes) ~(key by changes)) - =: vases.ford-cache ((invalidate path vase) vases.ford-cache invalid) - marks.ford-cache ((invalidate mark dais) marks.ford-cache invalid) - casts.ford-cache ((invalidate mars tube) casts.ford-cache invalid) - == - ford-cache + :* ((invalidate path vase) vases.ford-cache invalid) + ((invalidate mark dais) marks.ford-cache invalid) + ((invalidate mars tube) casts.ford-cache invalid) + == :: ++ invalidate |* [key=mold value=mold] From af243189552dbd46c3eccbdb8b6dac51b36e157a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 16:30:55 -0400 Subject: [PATCH 024/280] ford-fusion: check for cycles --- pkg/arvo/sys/vane/clay.hoon | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 10e33df56..01efe2d21 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2697,10 +2697,17 @@ |% ++ ford => |% + +$ build + $% [%file =path] + [%mark =mark] + [%cast =mars] + [%vale =path] + == +$ state $: baked=(map path cage) cache=ford-cache stack=(list (set path)) + cycle=(set build) == -- |= $: =ankh @@ -2729,6 +2736,9 @@ ~| %error-validating-path^path ?^ cage=(~(get by baked.nub) path) [cage nub] + ?: (~(has in cycle.nub) vale+path) + ~|(cycle+vale+path^stack.nub !!) + =. cycle.nub (~(put in cycle.nub) vale+path) ?^ change=(~(get by changes) path) =^ page nub ?: ?=(%& -.u.change) @@ -2750,6 +2760,9 @@ =? stack.nub ?=(^ stack.nub) stack.nub(i (~(uni in i.stack.nub) dez.u.got)) [res.u.got nub] + ?: (~(has in cycle.nub) mark+mak) + ~|(cycle+mark+mak^stack.nub !!) + =. cycle.nub (~(put in cycle.nub) mark+mak) =. stack.nub [~ stack.nub] =; res=[=dais nub=state] =. nub nub.res @@ -2841,6 +2854,8 @@ =? stack.nub ?=(^ stack.nub) stack.nub(i (~(uni in i.stack.nub) dez.u.got)) [res.u.got nub] + ?: (~(has in cycle.nub) cast+[a b]) + ~|(cycle+cast+[a b]^stack.nub !!) =. stack.nub [~ stack.nub] =; res=[=tube nub=state] =. nub nub.res @@ -2941,6 +2956,9 @@ =? stack.nub ?=(^ stack.nub) stack.nub(i (~(uni in i.stack.nub) dez.u.got)) [res.u.got nub] + ?: (~(has in cycle.nub) file+path) + ~|(cycle+file+path^stack.nub !!) + =. cycle.nub (~(put in cycle.nub) file+path) =. stack.nub [(sy path ~) stack.nub] =^ cag=(unit cage) nub (get-value path) ?~ cag ~|(no-file+path !!) From c043f7872e1464b5d115ec32d887600b5a610539 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 16:36:16 -0400 Subject: [PATCH 025/280] ford-fusion: test-cycle --- pkg/arvo/tests/sys/vane/clay.hoon | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 0608d677b..94b75616b 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -34,6 +34,33 @@ tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~ !> (parse-pile:(ford):fusion /sur/foo/hoon ".") :: +++ test-cycle ^- tang + =/ source=@t + ''' + /+ self + . + ''' + =/ =ankh:clay + :- fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %lib fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %self fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %hoon fil=`[*lobe:clay hoon+!>(source)] dir=~ + == == == + %- expect-fail + |. + =/ ford + %: ford:fusion + ankh + deletes=~ + changes=~ + file-store=~ + *ford-cache:fusion + == + (build-file:ford /lib/self/hoon) +:: ++ test-parse-fail ^- tang %- expect-fail |. (parse-pile:(ford):fusion /sur/foo/hoon "[") From 2c5493492770045aa63692e183c272e982a3ac47 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 16:46:45 -0400 Subject: [PATCH 026/280] ford-fusion: test trivial file has no deps other than itself --- pkg/arvo/tests/sys/vane/clay.hoon | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 94b75616b..28e6a6c57 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -83,10 +83,16 @@ file-store=~ *ford-cache:fusion == - =/ res=vase -:(build-file:ford /gen/hello/hoon) - %+ expect-eq - !> noun+'hello, bob' - (slap res (ream '(+ [*^ [%bob ~] ~])')) + =/ [res=vase nub=state:ford:fusion] (build-file:ford /gen/hello/hoon) + ;: weld + %+ expect-eq + !> noun+'hello, bob' + (slap res (ream '(+ [*^ [%bob ~] ~])')) + :: + %+ expect-eq + !> (~(gas in *(set path)) /gen/hello/hoon ~) + !> dez:(~(got by vases.cache.nub) /gen/hello/hoon) + == :: ++ test-info ^- tang =^ results0 clay-gate From bc0238fb3a2e7b6d966bcf902eb5e8bbdf71aad6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 16 Apr 2020 16:58:45 -0400 Subject: [PATCH 027/280] ford-fusion: +test-strandio-lib --- pkg/arvo/tests/sys/vane/clay.hoon | 49 ++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 28e6a6c57..8df152d63 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -1,6 +1,9 @@ /+ *test, test-ford-external, clay-raw=clay :: -/= hello-gen /: /===/gen/hello /hoon/ +/= hello-gen /: /===/gen/hello /hoon/ +/= strandio-lib /: /===/lib/strandio /hoon/ +/= strand-lib /: /===/lib/strand /hoon/ +/= spider-sur /: /===/sur/spider /hoon/ ::/= clay-raw /: /===/sys/vane/clay /!noun/ :: !: @@ -94,6 +97,50 @@ !> dez:(~(got by vases.cache.nub) /gen/hello/hoon) == :: +++ test-strandio-lib ^- tang + =/ =ankh:clay + :- fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %lib fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %strandio fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %hoon fil=`[*lobe:clay hoon+!>(strandio-lib)] dir=~ + == + :: + :+ %strand fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %hoon fil=`[*lobe:clay hoon+!>(strand-lib)] dir=~ + == == + :: + :+ %sur fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %spider fil=~ + %- ~(gas by *(map @tas ankh:clay)) + :~ :+ %hoon fil=`[*lobe:clay hoon+!>(spider-sur)] dir=~ + == == == + =/ ford + %: ford:fusion + ankh + deletes=~ + changes=~ + file-store=~ + *ford-cache:fusion + == + =/ [res=vase nub=state:ford:fusion] (build-file:ford /lib/strandio/hoon) + ;: weld + %- expect + !>((slab %get-our -.res)) + :: + %+ expect-eq + !> %- ~(gas in *(set path)) + :~ /lib/strandio/hoon + /lib/strand/hoon + /sur/spider/hoon + == + !> dez:(~(got by vases.cache.nub) /lib/strandio/hoon) + == +:: ++ test-info ^- tang =^ results0 clay-gate %- clay-call :* From a479618a2395891ae4bd6f658892337ec60ed6a3 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 16 Apr 2020 14:05:19 -0700 Subject: [PATCH 028/280] clay: add +get-changes --- pkg/arvo/sys/vane/clay.hoon | 68 +++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 01efe2d21..2adfda1ec 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3392,7 +3392,6 @@ |= [=tako =rang =ankh mim=(map path (unit mime))] |^ ^+ ..park - =. ..park print =: ank.dom ankh let.dom +(let.dom) hit.dom (~(put by hit.dom) +(let.dom) tako) @@ -3400,8 +3399,41 @@ hut.ran (~(uni by hut.rang) hut.ran) lat.ran (~(uni by lat.rang) lat.ran) == + =/ [deletes=(set path) changes=(set path)] + =/ previous-yaki (aeon-to-yaki:ze (dec let.dom)) + =/ next-yaki (aeon-to-yaki:ze let.dom) + (get-changes previous-yaki next-yaki) + =. ..park (emil (print deletes changes)) + :: wake:ergo :: + :: Find which files changed or were deleted + :: + ++ get-changes + |= [old=yaki new=yaki] + :* %- silt ^- (list path) + %+ murn ~(tap by (~(uni by q.old) q.new)) + |= [=path =lobe] + ^- (unit ^path) + =/ a (~(get by q.new) path) + =/ b (~(get by q.old) path) + ?: |(=(a b) !=(~ a)) + ~ + `path + :: + %- silt ^- (list path) + %+ murn ~(tap by (~(uni by q.old) q.new)) + |= [=path =lobe] + ^- (unit ^path) + =/ a (~(get by q.new) path) + =/ b (~(get by q.old) path) + ?: |(=(a b) =(~ a)) + ~ + `path + == + :: + :: Keep any parts of the ford cache whose dependencies didn't change + :: ++ promote-ford |= [=ford-cache deletes=(set path) changes=(map path (each page lobe))] ^+ ford-cache @@ -3422,6 +3454,8 @@ $(builds t.builds) (~(put by $(builds t.builds)) i.builds) :: + :: Emit update to unix sync + :: ++ ergo ^+ ..park =/ must (must-ergo:util her syd mon (turn ~(tap by mim) head)) @@ -3434,21 +3468,25 @@ [(slag len pax) (~(got by mim) pax)] == :: + :: Print notification to console + :: ++ print - ^+ ..park + |= [deletes=(set path) changes=(set path)] + ^- (list move) + |^ ?~ hun - ..park - %- emil - %+ turn ~(tap by mim) - |= [=path change=(unit mime)] - =/ car=@tD - ?~ change - '-' - ?: (~(has by mim.dom) path) - ':' - '+' - =/ =tank - =/ pre=^path ~[(scot %p our) syd (scot %ud +(let.dom))] + ~ + %+ weld + %+ turn ~(tap in deletes) + |= =path + [u.hun %give %note '-' (path-to-tank path)] + %+ turn ~(tap in changes) + |= =path + [u.hun %give %note '+' (path-to-tank path)] + :: + ++ path-to-tank + |= =path + =/ pre=^path ~[(scot %p our) syd (scot %ud let.dom)] :+ %rose ["/" "/" ~] %+ turn (weld pre path) |= a=cord @@ -3456,7 +3494,7 @@ ?: ((sane %ta) a) [%leaf (trip a)] [%leaf (dash:us (trip a) '\'' ~)] - [u.hun %give %note car tank] + -- -- :: :: Set permissions for a node. From 92f8fad85d3e31c94a0cadaba26f8a5b5a4afc5a Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 16 Apr 2020 20:18:02 -0700 Subject: [PATCH 029/280] clay: write checkout-ankh and checkout-mime --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 190 ++++++++++++++++++++++++++++++++---- 2 files changed, 173 insertions(+), 21 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index f49b870a3..66b1fa0e3 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:73eb5d108deabf4a97018f2bb3ef84ba687180eebde77c0b0c6d22955ce213b0 -size 13151294 +oid sha256:a1d1cc1e3953dc2cbebe41b62a8a7594c04979e1d89aa00ca12d5f5a78037a6a +size 13267528 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 2adfda1ec..c452377c5 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2695,6 +2695,12 @@ $(vaz t.vaz) -- |% + :: +wrap: external wrapper + :: + ++ wrap + |* [* state:ford] + [+<- +<+>-] :: cache.state + :: ++ ford => |% +$ build @@ -2709,13 +2715,15 @@ stack=(list (set path)) cycle=(set build) == + +$ args + $: =ankh + deletes=(set path) + changes=(map path (each page lobe)) + file-store=(map lobe blob) + =ford-cache + == -- - |= $: =ankh - deletes=(set path) - changes=(map path (each page lobe)) - file-store=(map lobe blob) - =ford-cache - == + |= args :: nub: internal mutable state for this computation :: =| nub=state @@ -2938,7 +2946,8 @@ =/ mok (head (flop path)) ?: =(mok mak) [u.cag nub] - =^ =tube nub (get-cast mak mok) + =^ =tube nub (get-cast mok mak) + ~| error-casting+[path mok mak] :_(nub [mak (tube q.u.cag)]) :: ++ run-pact @@ -3389,23 +3398,53 @@ :: XX needs to check tako in rang :: ++ park - |= [=tako =rang =ankh mim=(map path (unit mime))] + :: |= [commit=yuki commit-store-adds=(map tako yaki) blob-store-adds=(map lobe blob)] |^ + |= [=tako =rang =ankh mim=(map path (unit mime))] ^+ ..park - =: ank.dom ankh - let.dom +(let.dom) + =: let.dom +(let.dom) hit.dom (~(put by hit.dom) +(let.dom) tako) - mim.dom (apply-changes-to-mim:util mim.dom mim) hut.ran (~(uni by hut.rang) hut.ran) lat.ran (~(uni by lat.rang) lat.ran) == - =/ [deletes=(set path) changes=(set path)] + =/ [deletes=(set path) changes=(map path (each page lobe))] =/ previous-yaki (aeon-to-yaki:ze (dec let.dom)) =/ next-yaki (aeon-to-yaki:ze let.dom) (get-changes previous-yaki next-yaki) - =. ..park (emil (print deletes changes)) + =. ..park (emil (print deletes ~(key by changes))) :: - wake:ergo + :: promote ford cache + :: promote and fill in ankh + :: promote and fill in mime cache + :: + =. fod.dom + (promote-ford fod.dom deletes ~(key by changes)) + =/ =args:ford:fusion + [ank.dom deletes changes lat.ran fod.dom] + :: + =/ try-checkout-ankh + (mule |.((checkout-ankh args deletes changes ank.dom))) + %- %- slog + ?- -.try-checkout-ankh + %& [leaf+"checked out ankh"]~ + %| [leaf+"fail to checkout ankh" p.try-checkout-ankh] + == + :: =^ ankh ford-cache.args + :: (checkout-ankh args deletes changes ank.dom) + =. ank.dom ankh + =/ try-checkout-mime + (mule |.((checkout-mime args deletes ~(key by changes)))) + %- %- slog + ?- -.try-checkout-mime + %& [leaf+"checked out mime"]~ + %| [leaf+"failed to checkout mime" p.try-checkout-mime] + == + :: =^ mim ford-cache.args + :: (checkout-mime args deletes ~(key by changes)) + =. mim.dom (apply-changes-to-mim mim.dom mim) + =. fod.dom ford-cache.args + :: + wake:(ergo mim) :: :: Find which files changed or were deleted :: @@ -3421,23 +3460,23 @@ ~ `path :: - %- silt ^- (list path) + %- silt ^- (list [path (each page lobe)]) %+ murn ~(tap by (~(uni by q.old) q.new)) |= [=path =lobe] - ^- (unit ^path) + ^- (unit [^path (each page ^lobe)]) =/ a (~(get by q.new) path) =/ b (~(get by q.old) path) ?: |(=(a b) =(~ a)) ~ - `path + `[path |+lobe] == :: :: Keep any parts of the ford cache whose dependencies didn't change :: ++ promote-ford - |= [=ford-cache deletes=(set path) changes=(map path (each page lobe))] + |= [=ford-cache deletes=(set path) changes=(set path)] ^+ ford-cache - =/ invalid=(set path) (~(uni in deletes) ~(key by changes)) + =/ invalid=(set path) (~(uni in deletes) changes) :* ((invalidate path vase) vases.ford-cache invalid) ((invalidate mark dais) marks.ford-cache invalid) ((invalidate mars tube) casts.ford-cache invalid) @@ -3454,9 +3493,122 @@ $(builds t.builds) (~(put by $(builds t.builds)) i.builds) :: + :: Update ankh + :: + ++ checkout-ankh + |= $: =ford=args:ford:fusion + deletes=(set path) + changes=(map path (each page lobe)) + =ankh + == + ^+ [ankh ford-cache.ford-args] + :: Delete + :: + =. ankh + =/ dels ~(tap in deletes) + |- ^- ^ankh + =* outer-loop $ + ?~ dels + ankh + =. ankh + |- ^- ^ankh + =* inner-loop $ + ?~ i.dels + ankh(fil ~) + %= ankh + dir + %+ ~(put by dir.ankh) i.i.dels + %= inner-loop + i.dels t.i.dels + ankh (~(gut by dir.ankh) i.i.dels *^ankh) + == + == + outer-loop(dels t.dels) + :: Add/change + :: + =/ cans=(list [=path change=(each page lobe)]) ~(tap by changes) + |- ^+ [ankh ford-cache.ford-args] + =* outer-loop $ + ?~ cans + [ankh ford-cache.ford-args] + =^ ankh ford-cache.ford-args + =/ orig-path path.i.cans + |- ^+ [ankh ford-cache.ford-args] + =* inner-loop $ + ?~ path.i.cans + =^ cage ford-cache.ford-args + ?- -.change.i.cans + %& + %- wrap:fusion + (page-to-cage:(ford:fusion ford-args) p.change.i.cans) + :: + %| + =^ page ford-cache.ford-args + %- wrap:fusion + (lobe-to-page:(ford:fusion ford-args) p.change.i.cans) + (wrap:fusion (page-to-cage:(ford:fusion ford-args) page)) + == + :_ ford-cache.ford-args + %= ankh + fil + :- ~ :_ cage + ?- -.change.i.cans + %| p.change.i.cans + %& + %- wrap:fusion + (page-to-lobe:(ford:fusion ford-args) p.change.i.cans) + == + == + =^ child-ankh ford-cache.ford-args + %= inner-loop + path.i.cans t.path.i.cans + ankh (~(gut by dir.ankh) i.path.i.cans *^ankh) + == + :- ankh(dir (~(put by dir.ankh) i.path.i.cans child-ankh)) + ford-cache.ford-args + outer-loop(cans t.cans) + :: + :: Update mime cache + :: + ++ checkout-mime + |= $: =ford=args:ford:fusion + deletes=(set path) + changes=(set path) + == + ^- [(map path (unit mime)) ford-cache] + =/ mim=(map path (unit mime)) + =/ dels=(list path) ~(tap by deletes) + |- ^- (map path (unit mime)) + ?~ dels + ~ + (~(put by $(dels t.dels)) i.dels ~) + =/ cans=(list path) ~(tap by changes) + |- ^- [(map path (unit mime)) ford-cache] + ?~ cans + [mim ford-cache.ford-args] + =^ cage ford-cache.ford-args + (wrap:fusion (cast-path:(ford:fusion ford-args) i.cans %mime)) + =^ mim ford-cache.ford-args $(cans t.cans) + [(~(put by mim) i.cans `!<(mime q.cage)) ford-cache.ford-args] + :: + :: Add or remove entries to the mime cache + :: + ++ apply-changes-to-mim + |= [mim=(map path mime) changes=(map path (unit mime))] + ^- (map path mime) + =/ changes-l=(list [pax=path change=(unit mime)]) + ~(tap by changes) + |- ^- (map path mime) + ?~ changes-l + mim + ?~ change.i.changes-l + $(changes-l t.changes-l, mim (~(del by mim) pax.i.changes-l)) + $(changes-l t.changes-l, mim (~(put by mim) [pax u.change]:i.changes-l)) + :: :: Emit update to unix sync :: ++ ergo + |= mim=(map path (unit mime)) ^+ ..park =/ must (must-ergo:util her syd mon (turn ~(tap by mim) head)) %- emil From fdcc80b1e297695b2597c5c75c5cef4d058a2885 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 17 Apr 2020 02:14:41 -0400 Subject: [PATCH 030/280] ford-fusion: use .baked.nub; fixes /mar/hoon dep cycle --- pkg/arvo/sys/vane/clay.hoon | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index c452377c5..58f911b4e 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2710,7 +2710,7 @@ [%vale =path] == +$ state - $: baked=(map path cage) + $: baked=(map path (unit cage)) cache=ford-cache stack=(list (set path)) cycle=(set build) @@ -2742,8 +2742,12 @@ |= =path ^- [(unit cage) state] ~| %error-validating-path^path - ?^ cage=(~(get by baked.nub) path) - [cage nub] + ?^ got=(~(get by baked.nub) path) + [u.got nub] + =; [res=(unit cage) bun=state] + =. nub bun + =. baked.nub (~(put by baked.nub) path res) + [res nub] ?: (~(has in cycle.nub) vale+path) ~|(cycle+vale+path^stack.nub !!) =. cycle.nub (~(put in cycle.nub) vale+path) From 1b27582e3a199a2710d09d73b50fab851977aaca Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 17 Apr 2020 02:23:19 -0400 Subject: [PATCH 031/280] ford-fusion: minor cleanup to +get-value --- pkg/arvo/mar/hoon.hoon | 1 - pkg/arvo/sys/vane/clay.hoon | 27 ++++++++++++--------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/pkg/arvo/mar/hoon.hoon b/pkg/arvo/mar/hoon.hoon index ade9f38bb..cd582f8a7 100644 --- a/pkg/arvo/mar/hoon.hoon +++ b/pkg/arvo/mar/hoon.hoon @@ -1,4 +1,3 @@ -:: :::: /hoon/hoon/mar :: /? 310 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 58f911b4e..7ece36772 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2710,7 +2710,7 @@ [%vale =path] == +$ state - $: baked=(map path (unit cage)) + $: baked=(map path cage) cache=ford-cache stack=(list (set path)) cycle=(set build) @@ -2740,11 +2740,11 @@ :: ++ get-value |= =path - ^- [(unit cage) state] + ^- [cage state] ~| %error-validating-path^path ?^ got=(~(get by baked.nub) path) [u.got nub] - =; [res=(unit cage) bun=state] + =; [res=cage bun=state] =. nub bun =. baked.nub (~(put by baked.nub) path res) [res nub] @@ -2758,10 +2758,9 @@ ~| %ugly-lobe^p.u.change^path (lobe-to-page p.u.change) =^ cage nub (validate-path path page) - [`cage nub] - ?: (~(has in deletes) path) - [~ nub] - [(~(get an ankh) path) nub] + [cage nub] + ?< (~(has in deletes) path) + :_(nub (need (~(get an ankh) path))) :: +get-mark: build a mark definition :: ++ get-mark @@ -2945,14 +2944,13 @@ ++ cast-path |= [=path mak=mark] ^- [cage state] - =^ cag=(unit cage) nub (get-value path) - ?~ cag ~|(cannot-resolve-path+path !!) + =^ cag=cage nub (get-value path) =/ mok (head (flop path)) ?: =(mok mak) - [u.cag nub] + [cag nub] =^ =tube nub (get-cast mok mak) ~| error-casting+[path mok mak] - :_(nub [mak (tube q.u.cag)]) + :_(nub [mak (tube q.cag)]) :: ++ run-pact |= [old=page diff=page] @@ -2973,10 +2971,9 @@ ~|(cycle+file+path^stack.nub !!) =. cycle.nub (~(put in cycle.nub) file+path) =. stack.nub [(sy path ~) stack.nub] - =^ cag=(unit cage) nub (get-value path) - ?~ cag ~|(no-file+path !!) - ?> =(%hoon p.u.cag) - =/ tex=tape (trip !<(@t q.u.cag)) + =^ cag=cage nub (get-value path) + ?> =(%hoon p.cag) + =/ tex=tape (trip !<(@t q.cag)) =/ =pile (parse-pile path tex) =^ sut=vase nub run-reef =^ sut=vase nub (run-tauts sut %sur sur.mont.pile) From 3d04695ca7681b70fc081bc2c2132ba1cd694fbc Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 17 Apr 2020 18:04:51 -0700 Subject: [PATCH 032/280] clay: use ford fusion for ankh and mime cache --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 80 +++++++++++++++---------------------- pkg/arvo/ted/read.hoon | 2 +- 3 files changed, 36 insertions(+), 50 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 66b1fa0e3..7301566f8 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1d1cc1e3953dc2cbebe41b62a8a7594c04979e1d89aa00ca12d5f5a78037a6a -size 13267528 +oid sha256:60b80820a1bccb36920f611dec217c73737d086cb3de688b439f4226bbe110aa +size 13264963 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 7ece36772..5721fa630 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3423,25 +3423,11 @@ =/ =args:ford:fusion [ank.dom deletes changes lat.ran fod.dom] :: - =/ try-checkout-ankh - (mule |.((checkout-ankh args deletes changes ank.dom))) - %- %- slog - ?- -.try-checkout-ankh - %& [leaf+"checked out ankh"]~ - %| [leaf+"fail to checkout ankh" p.try-checkout-ankh] - == - :: =^ ankh ford-cache.args - :: (checkout-ankh args deletes changes ank.dom) + =^ ankh ford-cache.args + (checkout-ankh args deletes changes ank.dom) =. ank.dom ankh - =/ try-checkout-mime - (mule |.((checkout-mime args deletes ~(key by changes)))) - %- %- slog - ?- -.try-checkout-mime - %& [leaf+"checked out mime"]~ - %| [leaf+"failed to checkout mime" p.try-checkout-mime] - == - :: =^ mim ford-cache.args - :: (checkout-mime args deletes ~(key by changes)) + =^ mim ford-cache.args + (checkout-mime args deletes ~(key by changes)) =. mim.dom (apply-changes-to-mim mim.dom mim) =. fod.dom ford-cache.args :: @@ -3532,41 +3518,41 @@ =* outer-loop $ ?~ cans [ankh ford-cache.ford-args] - =^ ankh ford-cache.ford-args - =/ orig-path path.i.cans + =^ new-ankh ford-cache.ford-args |- ^+ [ankh ford-cache.ford-args] =* inner-loop $ - ?~ path.i.cans - =^ cage ford-cache.ford-args - ?- -.change.i.cans - %& - %- wrap:fusion - (page-to-cage:(ford:fusion ford-args) p.change.i.cans) - :: - %| - =^ page ford-cache.ford-args - %- wrap:fusion - (lobe-to-page:(ford:fusion ford-args) p.change.i.cans) - (wrap:fusion (page-to-cage:(ford:fusion ford-args) page)) + ?^ path.i.cans + =^ child-ankh ford-cache.ford-args + %= inner-loop + path.i.cans t.path.i.cans + ankh (~(gut by dir.ankh) i.path.i.cans *^ankh) == - :_ ford-cache.ford-args - %= ankh - fil - :- ~ :_ cage - ?- -.change.i.cans - %| p.change.i.cans - %& + :- ankh(dir (~(put by dir.ankh) i.path.i.cans child-ankh)) + ford-cache.ford-args + =^ cage ford-cache.ford-args + ?- -.change.i.cans + %& + %- wrap:fusion + (page-to-cage:(ford:fusion ford-args) p.change.i.cans) + :: + %| + =^ page ford-cache.ford-args %- wrap:fusion - (page-to-lobe:(ford:fusion ford-args) p.change.i.cans) - == + (lobe-to-page:(ford:fusion ford-args) p.change.i.cans) + (wrap:fusion (page-to-cage:(ford:fusion ford-args) page)) == - =^ child-ankh ford-cache.ford-args - %= inner-loop - path.i.cans t.path.i.cans - ankh (~(gut by dir.ankh) i.path.i.cans *^ankh) + :_ ford-cache.ford-args + %= ankh + fil + :- ~ :_ cage + ?- -.change.i.cans + %| p.change.i.cans + %& + %- wrap:fusion + (page-to-lobe:(ford:fusion ford-args) p.change.i.cans) == - :- ankh(dir (~(put by dir.ankh) i.path.i.cans child-ankh)) - ford-cache.ford-args + == + =. ankh new-ankh outer-loop(cans t.cans) :: :: Update mime cache diff --git a/pkg/arvo/ted/read.hoon b/pkg/arvo/ted/read.hoon index 9da53401c..346b495fe 100644 --- a/pkg/arvo/ted/read.hoon +++ b/pkg/arvo/ted/read.hoon @@ -12,7 +12,7 @@ :: ;< =bowl:spider bind:m get-bowl:strandio ;< =riot:clay bind:m - (warp:strandio our.bowl %home ~ %next %a [%da now.bowl] target-path) + (warp:strandio our.bowl %home ~ %sing %a [%da now.bowl] target-path) ?~ riot ~& %nothing (pure:m !>("nothing")) From f36dc49ede8fa0f9fd3d2b7b04188bb5444262e1 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 17 Apr 2020 22:50:03 -0400 Subject: [PATCH 033/280] -build-file, -build-mark, -build-cast --- pkg/arvo/lib/strandio.hoon | 39 ++++++++++++++++++++++++++++++++++++- pkg/arvo/sys/vane/clay.hoon | 26 ++++--------------------- pkg/arvo/sys/zuse.hoon | 21 ++++++++++++++++++++ 3 files changed, 63 insertions(+), 23 deletions(-) diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 66f49111f..8b05e8f39 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -391,7 +391,6 @@ ?: ?=(%incomplete -.made-result) (strand-fail %ford-incomplete tang.made-result) (pure:m build-result.made-result) -:: :: Take ford build result :: ++ take-made-result @@ -406,7 +405,45 @@ `[%skip ~] `[%done result.sign-arvo.u.in.tin] == +:: +build-fail: build the source file at the specified $beam :: +++ build-file + |= [[=ship =desk =case] =spur] + =* arg +< + =/ m (strand ,vase) + ^- form:m + ;< =riot:clay bind:m + (warp ship desk ~ %sing %a case (flop spur)) + ?~ riot + (strand-fail %build-file >arg< ~) + ?> =(%vase p.r.u.riot) + (pure:m q.r.u.riot) +:: +build-mark: build a mark definition to a $dais +:: +++ build-mark + |= [[=ship =desk =case] mak=mark] + =* arg +< + =/ m (strand ,dais:clay) + ^- form:m + ;< =riot:clay bind:m + (warp ship desk ~ %sing %b case /[mak]) + ?~ riot + (strand-fail %build-mark >arg< ~) + ?> =(%dais p.r.u.riot) + (pure:m !<(dais:clay q.r.u.riot)) +:: +build-cast: build a mark conversion gate ($tube) +:: +++ build-cast + |= [[=ship =desk =case] =mars:clay] + =* arg +< + =/ m (strand ,tube:clay) + ^- form:m + ;< =riot:clay bind:m + (warp ship desk ~ %sing %c case /[a.mars]/[b.mars]) + ?~ riot + (strand-fail %build-cast >arg< ~) + ?> =(%tube p.r.u.riot) + (pure:m !<(tube:clay q.r.u.riot)) :: Run several taggged ford builds :: ++ build-map diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 5721fa630..2468cf100 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -115,26 +115,6 @@ marks=(map mark [res=dais dez=(set path)]) casts=(map mars [res=tube dez=(set path)]) == -:: $mars: mark conversion request -:: $tube: mark conversion gate -+$ mars [a=mark b=mark] -+$ tube $-(vase vase) -:: $dais: processed mark core -:: -+$ dais - $_ ^| - |_ sam=vase - ++ bunt sam - ++ diff |~(new=_sam *vase) - ++ form *mark - ++ join |~([a=vase b=vase] *(unit (unit vase))) - ++ mash - |~ [a=[ship desk diff=vase] b=[ship desk diff=vase]] - *(unit vase) - ++ pact |~(diff=vase sam) - ++ vale |~(noun sam) - ++ volt |~(noun sam) - -- :: :: Hash of a blob, for lookup in the object store (lat.ran) :: @@ -2944,12 +2924,13 @@ ++ cast-path |= [=path mak=mark] ^- [cage state] - =^ cag=cage nub (get-value path) =/ mok (head (flop path)) + ~| error-casting-path+[path mok mak] + =^ cag=cage nub (get-value path) ?: =(mok mak) [cag nub] =^ =tube nub (get-cast mok mak) - ~| error-casting+[path mok mak] + ~| error-running-cast+[path mok mak] :_(nub [mak (tube q.cag)]) :: ++ run-pact @@ -3574,6 +3555,7 @@ ?~ cans [mim ford-cache.ford-args] =^ cage ford-cache.ford-args + ~| mime-cast-fail+i.cans (wrap:fusion (cast-path:(ford:fusion ford-args) i.cans %mime)) =^ mim ford-cache.ford-args $(cans t.cans) [(~(put by mim) i.cans `!<(mime q.cage)) ford-cache.ford-args] diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 8940a89a7..9bb508da4 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -713,6 +713,27 @@ %^ cat 7 (sham [%yaki (roll p add) q t]) (sham [%tako (roll p add) q t]) [p q has t] + :: $mars: mark conversion request + :: $tube: mark conversion gate + :: + +$ mars [a=mark b=mark] + +$ tube $-(vase vase) + :: $dais: processed mark core + :: + +$ dais + $_ ^| + |_ sam=vase + ++ bunt sam + ++ diff |~(new=_sam *vase) + ++ form *mark + ++ join |~([a=vase b=vase] *(unit (unit vase))) + ++ mash + |~ [a=[ship desk diff=vase] b=[ship desk diff=vase]] + *(unit vase) + ++ pact |~(diff=vase sam) + ++ vale |~(noun sam) + ++ volt |~(noun sam) + -- -- ::clay :: :::: :::: ++dill :: (1d) console From 8f60c0e036d53cbf4928c0a51096c7b321954a52 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 18 Apr 2020 01:36:59 -0400 Subject: [PATCH 034/280] ford-fusion: update ankh before mime conversion --- pkg/arvo/sys/vane/clay.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 2468cf100..d5f9ffc15 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3406,6 +3406,7 @@ :: =^ ankh ford-cache.args (checkout-ankh args deletes changes ank.dom) + =. ankh.args ankh =. ank.dom ankh =^ mim ford-cache.args (checkout-mime args deletes ~(key by changes)) From 2dd78760f35bacc68ff0b58a7340943a10b9e6c4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 18 Apr 2020 02:09:51 -0400 Subject: [PATCH 035/280] fix +sloe for %hint'ed cores --- pkg/arvo/sys/hoon.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 70c2ab4a4..c69cb59f8 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -12071,6 +12071,7 @@ ^- (list term) ?+ typ ~ {$hold *} $(typ ~(repo ut typ)) + {$hint *} $(typ ~(repo ut typ)) {$core *} %- zing %+ turn ~(tap by q.r.q.typ) From 8d3a497bb92cc08b5645c9fec5b3d102e54b0dc1 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 18 Apr 2020 04:18:13 -0400 Subject: [PATCH 036/280] ford-fusion: add ~| with .changes and .deletes --- pkg/arvo/sys/vane/clay.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index d5f9ffc15..036ccbf7e 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3393,6 +3393,7 @@ =/ previous-yaki (aeon-to-yaki:ze (dec let.dom)) =/ next-yaki (aeon-to-yaki:ze let.dom) (get-changes previous-yaki next-yaki) + ~| [let.dom deletes=deletes changes=~(key by changes)] =. ..park (emil (print deletes ~(key by changes))) :: :: promote ford cache From a705954b08f959cd13611cfa1d5170f92fcd53e8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 18 Apr 2020 04:21:15 -0400 Subject: [PATCH 037/280] -test, -build-file, -build-mark, -build-cast --- pkg/arvo/lib/strandio.hoon | 2 +- pkg/arvo/lib/test/runner.hoon | 39 +++++++++++++++++++++++++++++++++++ pkg/arvo/ted/build-cast.hoon | 12 +++++++++++ pkg/arvo/ted/build-file.hoon | 11 ++++++++++ pkg/arvo/ted/build-mark.hoon | 12 +++++++++++ pkg/arvo/ted/test.hoon | 24 +++++++++++++++++++++ 6 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 pkg/arvo/ted/build-cast.hoon create mode 100644 pkg/arvo/ted/build-file.hoon create mode 100644 pkg/arvo/ted/build-mark.hoon create mode 100644 pkg/arvo/ted/test.hoon diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 8b05e8f39..3734776f6 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -417,7 +417,7 @@ ?~ riot (strand-fail %build-file >arg< ~) ?> =(%vase p.r.u.riot) - (pure:m q.r.u.riot) + (pure:m !<(vase q.r.u.riot)) :: +build-mark: build a mark definition to a $dais :: ++ build-mark diff --git a/pkg/arvo/lib/test/runner.hoon b/pkg/arvo/lib/test/runner.hoon index da61c3c74..75d6d2d5f 100644 --- a/pkg/arvo/lib/test/runner.hoon +++ b/pkg/arvo/lib/test/runner.hoon @@ -10,6 +10,45 @@ +$ test-func (trap tang) -- |% +++ run-test + :: executes an individual test. + |= [pax=path test=test-func] + ^- [ok=? =tang] + =+ name=(spud pax) + =+ run=(mule test) + ?- -.run + %| :- %| :: the stack is already flopped for output? + ;: weld + p.run + `tang`[[%leaf (weld "CRASHED " name)] ~] + == + %& ?: =(~ p.run) + &+[[%leaf (weld "OK " name)] ~] + :: Create a welded list of all failures indented. + :- %| + %- flop + ;: weld + `tang`[[%leaf (weld "FAILED " name)] ~] + ::TODO indent + :: %+ turn p:run + :: |= {i/tape} + :: ^- tank + :: [%leaf (weld " " i)] + p.run + == + == +:: +filter-tests-by-prefix +:: +++ filter-tests-by-prefix + |= [prefix=path tests=(list test)] + ^+ tests + :: + =/ prefix-length=@ud (lent prefix) + :: + %+ skim tests + :: + |= [=path *] + =(prefix (scag prefix-length path)) :: +resolve-test-paths: add test names to file paths to form full identifiers :: ++ resolve-test-paths diff --git a/pkg/arvo/ted/build-cast.hoon b/pkg/arvo/ted/build-cast.hoon new file mode 100644 index 000000000..808859fd0 --- /dev/null +++ b/pkg/arvo/ted/build-cast.hoon @@ -0,0 +1,12 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([a=mark b=mark ~] arg) +;< =bowl:spider bind:m get-bowl:strandio +=/ bek=beak [our q.byk da+now]:bowl +;< =tube:clay bind:m (build-cast:strandio bek a b) +(pure:m !>(tube)) diff --git a/pkg/arvo/ted/build-file.hoon b/pkg/arvo/ted/build-file.hoon new file mode 100644 index 000000000..a1a6d3ff7 --- /dev/null +++ b/pkg/arvo/ted/build-file.hoon @@ -0,0 +1,11 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([pax=path ~] arg) +;< =bowl:spider bind:m get-bowl:strandio +=/ bek=beak [our q.byk da+now]:bowl +(build-file:strandio bek (flop pax)) diff --git a/pkg/arvo/ted/build-mark.hoon b/pkg/arvo/ted/build-mark.hoon new file mode 100644 index 000000000..d65fc9d25 --- /dev/null +++ b/pkg/arvo/ted/build-mark.hoon @@ -0,0 +1,12 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([mak=mark ~] arg) +;< =bowl:spider bind:m get-bowl:strandio +=/ bek=beak [our q.byk da+now]:bowl +;< =dais:clay bind:m (build-mark:strandio bek mak) +(pure:m !>(dais)) diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon new file mode 100644 index 000000000..c9015d2fb --- /dev/null +++ b/pkg/arvo/ted/test.hoon @@ -0,0 +1,24 @@ +/- spider +/+ strandio, *test-runner +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=/ paz=(list path) (turn !<((list path) arg) |=(path [%tests +<])) +;< =bowl:spider bind:m get-bowl:strandio +=/ bek=beak [our q.byk da+now]:bowl +=| test-arms=(map path (list test-arm)) +|- ^- form:m +=* gather-tests $ +?^ paz + ;< cor=vase bind:m (build-file:strandio bek hoon+(flop i.paz)) + =. test-arms (~(put by test-arms) i.paz (get-test-arms cor)) + gather-tests(paz t.paz) +%- pure:m !> ^= ok +%+ roll (resolve-test-paths test-arms) +|= [[=path =test-func] ok=_`?`%&] +^+ ok +=/ res (run-test path test-func) +%- (slog (flop tang.res)) +&(ok ok.res) From 0e4fb5a4f406ea1fd78ed7de176c75819cb2b067 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 18 Apr 2020 19:53:45 -0400 Subject: [PATCH 038/280] -test /sys/vane/{ames,clay} --- pkg/arvo/sys/vane/clay.hoon | 142 ++-- pkg/arvo/tests/sys/vane/ames.hoon | 3 +- pkg/arvo/tests/sys/vane/clay.hoon | 1081 +++++++++++++++-------------- 3 files changed, 631 insertions(+), 595 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 036ccbf7e..f744e2640 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2607,20 +2607,17 @@ |% :: $pile: preprocessed hoon source file :: + :: /- sur-file :: surface imports from /sur + :: /+ lib-file :: library imports from /lib + :: /= face /path :: imports built hoon file at path + :: /* face %mark /path :: unbuilt file imports, as mark + :: +$ pile - $: =mont - =hoon - == - :: $mont: imports declaration - :: - :: /- imports from /sur - :: /+ imports from /lib - :: /= imports from some other path - :: - +$ mont $: sur=(list taut) lib=(list taut) raw=(list [face=term =path]) + bar=(list [face=term =mark =path]) + =hoon == :: $taut: file import from /lib or /sur :: @@ -2867,7 +2864,7 @@ (ream (cat 3 b ':~(grow old sam)')) :: try direct +grab :: - =^ new=vase nub (build-fit /mar/[b]) + =^ new=vase nub (build-fit /mar/[b]) =/ rab (mule |.((slap new (ream (cat 3 a ':grab'))))) ?: &(?=(%& -.rab) ?=(^ q.p.rab)) :_(nub |=(sam=vase (slam p.rab sam))) @@ -2942,8 +2939,8 @@ :: ++ build-file |= =path - ~| %error-building^path ^- [vase state] + ~| %error-building^path ?^ got=(~(get by vases.cache.nub) path) =? stack.nub ?=(^ stack.nub) stack.nub(i (~(uni in i.stack.nub) dez.u.got)) @@ -2957,45 +2954,33 @@ =/ tex=tape (trip !<(@t q.cag)) =/ =pile (parse-pile path tex) =^ sut=vase nub run-reef - =^ sut=vase nub (run-tauts sut %sur sur.mont.pile) - =^ sut=vase nub (run-tauts sut %lib lib.mont.pile) - =^ sut=vase nub (run-raw sut raw.mont.pile) + =^ sut=vase nub (run-tauts sut %sur sur.pile) + =^ sut=vase nub (run-tauts sut %lib lib.pile) + =^ sut=vase nub (run-raw sut raw.pile) + =^ sut=vase nub (run-bar sut bar.pile) =/ res=vase (slap sut hoon.pile) =^ top stack.nub pop-stack =. vases.cache.nub (~(put by vases.cache.nub) path [res top]) [res nub] :: ++ parse-pile - |= [=path tex=tape] + |= [pax=path tex=tape] ^- pile - =/ [=mont =nail] (parse-mont path tex) - =/ [=hair res=(unit [src=(list hoon) ^nail])] - ((most gap tall:(vang & path)) nail) - ?^ res [mont tssg+src:(need res)] + =/ [=hair res=(unit [=pile =nail])] ((pile-rule pax) [1 1] tex) + ?^ res pile.u.res %- mean =/ lyn p.hair =/ col q.hair - :~ leaf+"syntax error at [{} {}] in {}" + :~ leaf+"syntax error at [{} {}] in {}" leaf+(trip (snag (dec lyn) (to-wain:format (crip tex)))) leaf+(runt [(dec col) '-'] "^") == :: - ++ parse-mont - |= [=path tex=tape] - ^- [mont nail] - =/ [=hair res=(unit [=mont =nail])] (mont-rule [1 1] tex) - ?^ res u.res - %- mean - =/ lyn p.hair - =/ col q.hair - :~ leaf+"syntax error in imports at [{} {}] in {}" - leaf+(trip (snag (dec lyn) (to-wain:format (crip tex)))) - leaf+(runt [(dec col) '-'] "^") - == - :: - ++ mont-rule + ++ pile-rule + |= pax=path + %- full %+ ifix [gay gay] - %+ cook |=(mont +<) + %+ cook |=(pile +<) ;~ pfix :: parse optional /? and ignore :: @@ -3003,23 +2988,66 @@ (cold ~ ;~(plug net wut gap dem gap)) (easy ~) == - ;~ plug - %+ cook |=((list (list taut)) (zing +<)) - %+ more gap - %+ ifix [;~(plug net hep gap) gap] - (most ;~(plug com gaw) taut-rule) :: - %+ cook |=((list (list taut)) (zing +<)) - %+ more gap - %+ ifix [;~(plug net lus gap) gap] - (most ;~(plug com gaw) taut-rule) - :: - %+ cook |=((list [face=term =path]) +<) - %+ more gap - %+ ifix [;~(plug net tis gap) gap] - %+ cook |=([term path] +<) - ;~(plug sym ;~(pfix ;~(plug gap net) (more net urs:ab))) - == == + ;~ plug + ;~ pose + ;~ sfix + %+ cook |=((list (list taut)) (zing +<)) + %+ more gap + ;~ pfix ;~(plug net hep gap) + (most ;~(plug com gaw) taut-rule) + == + gap + == + (easy ~) + == + :: + ;~ pose + ;~ sfix + %+ cook |=((list (list taut)) (zing +<)) + %+ more gap + ;~ pfix ;~(plug net lus gap) + (most ;~(plug com gaw) taut-rule) + == + gap + == + (easy ~) + == + :: + ;~ pose + ;~ sfix + %+ cook |=((list [face=term =path]) +<) + %+ more gap + ;~ pfix ;~(plug net tis gap) + %+ cook |=([term path] +<) + ;~(plug sym ;~(pfix ;~(plug gap net) (more net urs:ab))) + == + gap + == + (easy ~) + == + :: + ;~ pose + ;~ sfix + %+ cook |=((list [face=term =mark =path]) +<) + %+ more gap + ;~ pfix ;~(plug net tar gap) + %+ cook |=([term mark path] +<) + ;~ plug + sym + ;~(pfix ;~(plug gap cen) sym) + ;~(pfix ;~(plug gap net) (more net urs:ab)) + == + == + gap + == + (easy ~) + == + :: + %+ cook |=(huz=(list hoon) `hoon`tssg+huz) + (most gap tall:(vang & pax)) + == + == :: ++ taut-rule %+ cook |=(taut +<) @@ -3041,10 +3069,18 @@ |= [sut=vase raw=(list [face=term =path])] ^- [vase state] ?~ raw [sut nub] - =^ pin=vase nub (build-file path.i.raw) + =^ pin=vase nub (build-file (snoc path.i.raw %hoon)) =. p.pin [%face face.i.raw p.pin] $(sut (slop pin sut), raw t.raw) :: + ++ run-bar + |= [sut=vase bar=(list [face=term =mark =path])] + ^- [vase state] + ?~ bar [sut nub] + =^ =cage nub (cast-path [path mark]:i.bar) + =. p.q.cage [%face face.i.bar p.q.cage] + $(sut (slop q.cage sut), bar t.bar) + :: ++ run-reef ^- [vase state] [!>(..zuse) nub] :: TODO implement diff --git a/pkg/arvo/tests/sys/vane/ames.hoon b/pkg/arvo/tests/sys/vane/ames.hoon index ae1ceb352..83bc5a4b5 100644 --- a/pkg/arvo/tests/sys/vane/ames.hoon +++ b/pkg/arvo/tests/sys/vane/ames.hoon @@ -1,6 +1,5 @@ /+ *test -/= ames /: /===/sys/vane/ames - /!noun/ +/= ames /sys/vane/ames :: construct some test fixtures :: =/ vane (ames !>(..zuse)) diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 8df152d63..eb545c10e 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -1,10 +1,9 @@ -/+ *test, test-ford-external, clay-raw=clay -:: -/= hello-gen /: /===/gen/hello /hoon/ -/= strandio-lib /: /===/lib/strandio /hoon/ -/= strand-lib /: /===/lib/strand /hoon/ -/= spider-sur /: /===/sur/spider /hoon/ -::/= clay-raw /: /===/sys/vane/clay /!noun/ +/+ *test, test-ford-external +/= clay-raw /sys/vane/clay +/* hello-gen %hoon /gen/hello/hoon +/* strandio-lib %hoon /lib/strandio/hoon +/* strand-lib %hoon /lib/strand/hoon +/* spider-sur %hoon /sur/spider/hoon :: !: =, format @@ -33,8 +32,9 @@ ++ test-parse-pile ^- tang %+ expect-eq !> ^- pile:fusion - :- [~ ~ ~] - tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~ + :* ~ ~ ~ ~ + tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~ + == !> (parse-pile:(ford):fusion /sur/foo/hoon ".") :: ++ test-cycle ^- tang @@ -140,535 +140,536 @@ == !> dez:(~(got by vases.cache.nub) /lib/strandio/hoon) == -:: -++ test-info ^- tang - =^ results0 clay-gate - %- clay-call :* - clay-gate - now=~1111.1.1 - scry=*sley - call-args=[duct=~[/init] -:!>(*task:able:clay) [%init ~nul]] - expected-moves=~ - == - :: - =^ results1 clay-gate - %- clay-call-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= call-args - :+ duct=~[/info] type=-:!>(*task:able:clay) - ^- task:able:clay - :+ %info %home - ^- nori:clay - :- %& - ^- soba:clay - :~ [/file1/noun `miso:clay`[%ins [%noun %noun 'file1']]] - [/file2/noun `miso:clay`[%ins [%noun %noun 'file2']]] - == - ^= move-comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - ^- tang - ;: weld - :: - ^- tang - :: - =/ move=move:clay-gate i.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/commit/home/inserts) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%f %build *] note) - [%leaf "bad move, not a %build: {}"]~ - :: - %+ weld - (expect-eq !>(%.n) !>(live.note)) - :: - %- expect-schematic:test-ford-external - :_ schematic.note - ^- schematic:ford - :+ %pin ~1111.1.1 - :- %list - :~ :- [%$ %path -:!>(*path) /file1/noun] - :^ %cast [~nul %home] %noun - [%$ %noun %noun 'file1'] - :: - :- [%$ %path -:!>(*path) /file2/noun] - :^ %cast [~nul %home] %noun - [%$ %noun %noun 'file2'] - == - == == - :: - :: inserting - :: - =^ results2 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/inserts - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - :* %f %made ~1111.1.1 %complete %success %list - ^- (list build-result:ford) - :~ :+ %success - [%success %$ %path -:!>(*path) /file1/noun] - [%success %cast %noun %noun 'file1'] - :: - :+ %success - [%success %$ %path -:!>(*path) /file2/noun] - [%success %cast %noun %noun 'file2'] - == == == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - %+ expect-eq - !> ^- move:clay-gate - :- duct=~[/info] - ^- (wind note:clay-gate gift:able:clay) - :+ %pass /commit/home/diffs - ^- note:clay-gate - :- %f - [%build live=%.n [%pin ~1111.1.1 [%list ~]]] - !> i.moves - == :: == - :: - :: diffing - :: - =^ results3 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/diffs - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - [%f %made ~1111.1.1 %complete %success %list ~] - == - ^= move-comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - %+ expect-eq - !> ^- move:clay-gate - :- duct=~[/info] - ^- (wind note:clay-gate gift:able:clay) - :+ %pass /commit/home/casts - ^- note:clay-gate - :- %f - [%build live=%.n [%pin ~1111.1.1 [%list ~]]] - !> i.moves - == - :: - :: castifying - :: - =^ results4 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/casts - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - [%f %made ~1111.1.1 %complete %success %list ~] - == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - =/ move=move:clay-gate i.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/commit/home/mutates) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%f %build *] note) - [%leaf "bad move, not a %build: {}"]~ - :: - %+ weld - (expect-eq !>(%.n) !>(live.note)) - :: - %- expect-schematic:test-ford-external - :_ schematic.note - ^- schematic:ford - [%pin ~1111.1.1 %list ~] - == - :: - :: mutating - :: - =^ results5 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/mutates - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - [%f %made ~1111.1.1 %complete %success %list ~] - == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - =/ move=move:clay-gate i.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/commit/home/checkout) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%f %build *] note) - [%leaf "bad move, not a %build: {}"]~ - :: - %+ weld - (expect-eq !>(%.n) !>(live.note)) - :: - %- expect-schematic:test-ford-external - :_ schematic.note - ^- schematic:ford - :- %list - ^- (list schematic:ford) - :~ :- :^ %$ %path-hash -:!>([*path *@uvI]) - :- /file1/noun - 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj.k8b3s.n5hlf.57i21.5m1nn.bhob7 - :: - [%volt [~nul %home] %noun 'file1'] - :: - :- :^ %$ %path-hash -:!>([*path *@uvI]) - :- /file2/noun - 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp.8ifgp.0ljbi.dqau7.7c0q0.fj144 - :: - [%volt [~nul %home] %noun 'file2'] - == == - :: - :: patching - :: - =^ results6 clay-gate - %- clay-take :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/checkout - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - :* %f %made ~1111.1.1 %complete %success %list - ^- (list build-result:ford) - :~ :+ %success - :* %success %$ %path-hash -:!>([*path *@uvI]) - /file1/noun - 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj. - k8b3s.n5hlf.57i21.5m1nn.bhob7 - == - [%success %volt %noun %noun 'file1'] - :: - :+ %success - :* %success %$ %path-hash -:!>([*path *@uvI]) - /file2/noun - 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp. - 8ifgp.0ljbi.dqau7.7c0q0.fj144 - == - [%success %volt %noun %noun 'file2'] - == == == - ^= expected-moves - :~ :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] - :~ [%leaf "~nul"] - [%leaf "home"] - [%leaf "1"] - [%leaf "file1"] - [%leaf "noun"] - == == - :: - :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] - :~ [%leaf "~nul"] - [%leaf "home"] - [%leaf "1"] - [%leaf "file2"] - [%leaf "noun"] - == == == == - :: make a second write request during the same arvo event - :: - :: This should produce a Behn timer at `now` to run the write - :: request. - :: - =^ results7 clay-gate - %- clay-call-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= call-args - :+ duct=~[/info2] type=-:!>(*task:able:clay) - ^- task:able:clay - :+ %info %home - ^- nori:clay - :- %& - ^- soba:clay - :~ [/file3/noun `miso:clay`[%ins [%noun %noun 'file3']]] - [/file4/noun `miso:clay`[%ins [%noun %noun 'file4']]] - == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {}"]~ - :: - =/ move=move:clay-gate i.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info2]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/queued-request) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%b %wait *] note) - [%leaf "bad move, not a %wait: {}"]~ - :: - (expect-eq !>(~1111.1.1) !>(p.note)) - == - :: - =^ results8 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~2222.2.2 - scry=*sley - ^= take-args - :* wire=/queued-request - duct=~[/info2] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - [%b %wake ~] - == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* * * ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - ^- tang - ;: weld - %+ expect-eq - !> ^- move:clay-gate - :- duct=~[/info2] - ^- (wind note:clay-gate gift:able:clay) - :+ %pass /castifying/~nul/home/~2222.2.2 - ^- note:clay-gate - :- %f - [%build live=%.n [%pin ~2222.2.2 [%list ~]]] - !> i.moves - :: - %+ expect-eq - !> ^- move:clay-gate - :- duct=~[/info2] - ^- (wind note:clay-gate gift:able:clay) - :+ %pass /diffing/~nul/home/~2222.2.2 - ^- note:clay-gate - :- %f - [%build live=%.n [%pin ~2222.2.2 [%list ~]]] - !> i.t.moves - :: - ^- tang - :: - =/ move=move:clay-gate i.t.t.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info2]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/inserting/~nul/home/~2222.2.2) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%f %build *] note) - [%leaf "bad move, not a %build: {}"]~ - :: - %+ weld - (expect-eq !>(%.n) !>(live.note)) - :: - %- expect-schematic:test-ford-external - :_ schematic.note - ^- schematic:ford - :+ %pin ~2222.2.2 - :- %list - :~ :- [%$ %path -:!>(*path) /file3/noun] - :^ %cast [~nul %home] %noun - [%$ %noun %noun 'file3'] - :: - :- [%$ %path -:!>(*path) /file4/noun] - :^ %cast [~nul %home] %noun - [%$ %noun %noun 'file4'] - == - == == - :: - ;: welp - results0 - results1 - results2 - results3 - results4 - results5 - results6 - results7 - == -:: |utilities: helper functions for testing -:: -:: TODO: make these utilities generic for any vane -:: -::+| utilities -:: -:: +clay-call: have clay run a +task and assert it produces :expected-moves7890 -:: -++ clay-call - |= $: clay-gate=_clay-gate - now=@da - scry=sley - call-args=[=duct =type wrapped-task=(hobo task:able:clay)] - expected-moves=(list move:clay-gate) - == - ^- [tang _clay-gate] - :: - =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) - :: - =^ moves clay-gate (call:clay-core [duct ~ type wrapped-task]:call-args) - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> moves - :: - [output clay-gate] -:: +clay-call-with-comparator: run a clay +task and test output moves -:: -++ clay-call-with-comparator - |= $: clay-gate=_clay-gate - now=@da - scry=sley - call-args=[=duct =type wrapped-task=(hobo task:able:clay)] - move-comparator=$-((list move:clay-gate) tang) - == - ^- [tang _clay-gate] - :: - =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) - :: - =^ moves clay-gate (call:clay-core [duct ~ type wrapped-task]:call-args) - :: - =/ output=tang (move-comparator moves) - :: - [output clay-gate] -:: +clay-take: have clay receive a +note and assert output moves -:: -++ clay-take - |= $: clay-gate=_clay-gate - now=@da - scry=sley - take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] - expected-moves=(list move:clay-gate) - == - ^- [tang _clay-gate] - :: - =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) - :: - =^ moves clay-gate (take:clay-core [wire duct ~ wrapped-sign]:take-args) - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> moves - :: - [output clay-gate] -:: +clay-take-with-comparator: have clay receive a +note and test output moves -:: -++ clay-take-with-comparator - |= $: clay-gate=_clay-gate - now=@da - scry=sley - take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] - move-comparator=$-((list move:clay-gate) tang) - == - ^- [tang _clay-gate] - :: - =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) - :: - =^ moves clay-gate (take:clay-core [wire duct ~ wrapped-sign]:take-args) - :: - =/ output=tang (move-comparator moves) - :: - [output clay-gate] -- +:: +::++ test-info ^- tang +:: =^ results0 clay-gate +:: %- clay-call :* +:: clay-gate +:: now=~1111.1.1 +:: scry=*sley +:: call-args=[duct=~[/init] -:!>(*task:able:clay) [%init ~nul]] +:: expected-moves=~ +:: == +:: :: +:: =^ results1 clay-gate +:: %- clay-call-with-comparator :* +:: clay-gate +:: now=~1111.1.1 +:: scry=*sley +:: ^= call-args +:: :+ duct=~[/info] type=-:!>(*task:able:clay) +:: ^- task:able:clay +:: :+ %info %home +:: ^- nori:clay +:: :- %& +:: ^- soba:clay +:: :~ [/file1/noun `miso:clay`[%ins [%noun %noun 'file1']]] +:: [/file2/noun `miso:clay`[%ins [%noun %noun 'file2']]] +:: == +:: ^= move-comparator +:: |= moves=(list move:clay-gate) +:: ^- tang +:: :: +:: ?. ?=([* ~] moves) +:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ +:: :: +:: ^- tang +:: ;: weld +:: :: +:: ^- tang +:: :: +:: =/ move=move:clay-gate i.moves +:: =/ =duct p.move +:: =/ card=(wind note:clay-gate gift:able:clay) q.move +:: :: +:: %+ weld +:: (expect-eq !>(~[/info]) !>(duct)) +:: :: +:: ?. ?=(%pass -.card) +:: [%leaf "bad move, not a %pass: {}"]~ +:: :: +:: =/ =wire p.card +:: :: +:: %+ weld +:: (expect-eq !>(/commit/home/inserts) !>(wire)) +:: :: +:: =/ note=note:clay-gate q.card +:: :: +:: ?. ?=([%f %build *] note) +:: [%leaf "bad move, not a %build: {}"]~ +:: :: +:: %+ weld +:: (expect-eq !>(%.n) !>(live.note)) +:: :: +:: %- expect-schematic:test-ford-external +:: :_ schematic.note +:: ^- schematic:ford +:: :+ %pin ~1111.1.1 +:: :- %list +:: :~ :- [%$ %path -:!>(*path) /file1/noun] +:: :^ %cast [~nul %home] %noun +:: [%$ %noun %noun 'file1'] +:: :: +:: :- [%$ %path -:!>(*path) /file2/noun] +:: :^ %cast [~nul %home] %noun +:: [%$ %noun %noun 'file2'] +:: == +:: == == +:: :: +:: :: inserting +:: :: +:: =^ results2 clay-gate +:: %- clay-take-with-comparator :* +:: clay-gate +:: now=~1111.1.1 +:: scry=*sley +:: ^= take-args +:: :* wire=/commit/home/inserts +:: duct=~[/info] +:: -:!>(*sign:clay-gate) +:: ^- sign:clay-gate +:: :* %f %made ~1111.1.1 %complete %success %list +:: ^- (list build-result:ford) +:: :~ :+ %success +:: [%success %$ %path -:!>(*path) /file1/noun] +:: [%success %cast %noun %noun 'file1'] +:: :: +:: :+ %success +:: [%success %$ %path -:!>(*path) /file2/noun] +:: [%success %cast %noun %noun 'file2'] +:: == == == +:: ^= comparator +:: |= moves=(list move:clay-gate) +:: ^- tang +:: :: +:: ?. ?=([* ~] moves) +:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ +:: :: +:: %+ expect-eq +:: !> ^- move:clay-gate +:: :- duct=~[/info] +:: ^- (wind note:clay-gate gift:able:clay) +:: :+ %pass /commit/home/diffs +:: ^- note:clay-gate +:: :- %f +:: [%build live=%.n [%pin ~1111.1.1 [%list ~]]] +:: !> i.moves +:: == :: == +:: :: +:: :: diffing +:: :: +:: =^ results3 clay-gate +:: %- clay-take-with-comparator :* +:: clay-gate +:: now=~1111.1.1 +:: scry=*sley +:: ^= take-args +:: :* wire=/commit/home/diffs +:: duct=~[/info] +:: -:!>(*sign:clay-gate) +:: ^- sign:clay-gate +:: [%f %made ~1111.1.1 %complete %success %list ~] +:: == +:: ^= move-comparator +:: |= moves=(list move:clay-gate) +:: ^- tang +:: :: +:: ?. ?=([* ~] moves) +:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ +:: :: +:: %+ expect-eq +:: !> ^- move:clay-gate +:: :- duct=~[/info] +:: ^- (wind note:clay-gate gift:able:clay) +:: :+ %pass /commit/home/casts +:: ^- note:clay-gate +:: :- %f +:: [%build live=%.n [%pin ~1111.1.1 [%list ~]]] +:: !> i.moves +:: == +:: :: +:: :: castifying +:: :: +:: =^ results4 clay-gate +:: %- clay-take-with-comparator :* +:: clay-gate +:: now=~1111.1.1 +:: scry=*sley +:: ^= take-args +:: :* wire=/commit/home/casts +:: duct=~[/info] +:: -:!>(*sign:clay-gate) +:: ^- sign:clay-gate +:: [%f %made ~1111.1.1 %complete %success %list ~] +:: == +:: ^= comparator +:: |= moves=(list move:clay-gate) +:: ^- tang +:: :: +:: ?. ?=([* ~] moves) +:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ +:: :: +:: =/ move=move:clay-gate i.moves +:: =/ =duct p.move +:: =/ card=(wind note:clay-gate gift:able:clay) q.move +:: :: +:: %+ weld +:: (expect-eq !>(~[/info]) !>(duct)) +:: :: +:: ?. ?=(%pass -.card) +:: [%leaf "bad move, not a %pass: {}"]~ +:: :: +:: =/ =wire p.card +:: :: +:: %+ weld +:: (expect-eq !>(/commit/home/mutates) !>(wire)) +:: :: +:: =/ note=note:clay-gate q.card +:: :: +:: ?. ?=([%f %build *] note) +:: [%leaf "bad move, not a %build: {}"]~ +:: :: +:: %+ weld +:: (expect-eq !>(%.n) !>(live.note)) +:: :: +:: %- expect-schematic:test-ford-external +:: :_ schematic.note +:: ^- schematic:ford +:: [%pin ~1111.1.1 %list ~] +:: == +:: :: +:: :: mutating +:: :: +:: =^ results5 clay-gate +:: %- clay-take-with-comparator :* +:: clay-gate +:: now=~1111.1.1 +:: scry=*sley +:: ^= take-args +:: :* wire=/commit/home/mutates +:: duct=~[/info] +:: -:!>(*sign:clay-gate) +:: ^- sign:clay-gate +:: [%f %made ~1111.1.1 %complete %success %list ~] +:: == +:: ^= comparator +:: |= moves=(list move:clay-gate) +:: ^- tang +:: :: +:: ?. ?=([* ~] moves) +:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ +:: :: +:: =/ move=move:clay-gate i.moves +:: =/ =duct p.move +:: =/ card=(wind note:clay-gate gift:able:clay) q.move +:: :: +:: %+ weld +:: (expect-eq !>(~[/info]) !>(duct)) +:: :: +:: ?. ?=(%pass -.card) +:: [%leaf "bad move, not a %pass: {}"]~ +:: :: +:: =/ =wire p.card +:: :: +:: %+ weld +:: (expect-eq !>(/commit/home/checkout) !>(wire)) +:: :: +:: =/ note=note:clay-gate q.card +:: :: +:: ?. ?=([%f %build *] note) +:: [%leaf "bad move, not a %build: {}"]~ +:: :: +:: %+ weld +:: (expect-eq !>(%.n) !>(live.note)) +:: :: +:: %- expect-schematic:test-ford-external +:: :_ schematic.note +:: ^- schematic:ford +:: :- %list +:: ^- (list schematic:ford) +:: :~ :- :^ %$ %path-hash -:!>([*path *@uvI]) +:: :- /file1/noun +:: 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj.k8b3s.n5hlf.57i21.5m1nn.bhob7 +:: :: +:: [%volt [~nul %home] %noun 'file1'] +:: :: +:: :- :^ %$ %path-hash -:!>([*path *@uvI]) +:: :- /file2/noun +:: 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp.8ifgp.0ljbi.dqau7.7c0q0.fj144 +:: :: +:: [%volt [~nul %home] %noun 'file2'] +:: == == +:: :: +:: :: patching +:: :: +:: =^ results6 clay-gate +:: %- clay-take :* +:: clay-gate +:: now=~1111.1.1 +:: scry=*sley +:: ^= take-args +:: :* wire=/commit/home/checkout +:: duct=~[/info] +:: -:!>(*sign:clay-gate) +:: ^- sign:clay-gate +:: :* %f %made ~1111.1.1 %complete %success %list +:: ^- (list build-result:ford) +:: :~ :+ %success +:: :* %success %$ %path-hash -:!>([*path *@uvI]) +:: /file1/noun +:: 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj. +:: k8b3s.n5hlf.57i21.5m1nn.bhob7 +:: == +:: [%success %volt %noun %noun 'file1'] +:: :: +:: :+ %success +:: :* %success %$ %path-hash -:!>([*path *@uvI]) +:: /file2/noun +:: 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp. +:: 8ifgp.0ljbi.dqau7.7c0q0.fj144 +:: == +:: [%success %volt %noun %noun 'file2'] +:: == == == +:: ^= expected-moves +:: :~ :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] +:: :~ [%leaf "~nul"] +:: [%leaf "home"] +:: [%leaf "1"] +:: [%leaf "file1"] +:: [%leaf "noun"] +:: == == +:: :: +:: :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] +:: :~ [%leaf "~nul"] +:: [%leaf "home"] +:: [%leaf "1"] +:: [%leaf "file2"] +:: [%leaf "noun"] +:: == == == == +:: :: make a second write request during the same arvo event +:: :: +:: :: This should produce a Behn timer at `now` to run the write +:: :: request. +:: :: +:: =^ results7 clay-gate +:: %- clay-call-with-comparator :* +:: clay-gate +:: now=~1111.1.1 +:: scry=*sley +:: ^= call-args +:: :+ duct=~[/info2] type=-:!>(*task:able:clay) +:: ^- task:able:clay +:: :+ %info %home +:: ^- nori:clay +:: :- %& +:: ^- soba:clay +:: :~ [/file3/noun `miso:clay`[%ins [%noun %noun 'file3']]] +:: [/file4/noun `miso:clay`[%ins [%noun %noun 'file4']]] +:: == +:: ^= comparator +:: |= moves=(list move:clay-gate) +:: ^- tang +:: :: +:: ?. ?=([* ~] moves) +:: [%leaf "wrong number of moves: {}"]~ +:: :: +:: =/ move=move:clay-gate i.moves +:: =/ =duct p.move +:: =/ card=(wind note:clay-gate gift:able:clay) q.move +:: :: +:: %+ weld +:: (expect-eq !>(~[/info2]) !>(duct)) +:: :: +:: ?. ?=(%pass -.card) +:: [%leaf "bad move, not a %pass: {}"]~ +:: :: +:: =/ =wire p.card +:: :: +:: %+ weld +:: (expect-eq !>(/queued-request) !>(wire)) +:: :: +:: =/ note=note:clay-gate q.card +:: :: +:: ?. ?=([%b %wait *] note) +:: [%leaf "bad move, not a %wait: {}"]~ +:: :: +:: (expect-eq !>(~1111.1.1) !>(p.note)) +:: == +:: :: +:: =^ results8 clay-gate +:: %- clay-take-with-comparator :* +:: clay-gate +:: now=~2222.2.2 +:: scry=*sley +:: ^= take-args +:: :* wire=/queued-request +:: duct=~[/info2] +:: -:!>(*sign:clay-gate) +:: ^- sign:clay-gate +:: [%b %wake ~] +:: == +:: ^= comparator +:: |= moves=(list move:clay-gate) +:: ^- tang +:: :: +:: ?. ?=([* * * ~] moves) +:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ +:: :: +:: ^- tang +:: ;: weld +:: %+ expect-eq +:: !> ^- move:clay-gate +:: :- duct=~[/info2] +:: ^- (wind note:clay-gate gift:able:clay) +:: :+ %pass /castifying/~nul/home/~2222.2.2 +:: ^- note:clay-gate +:: :- %f +:: [%build live=%.n [%pin ~2222.2.2 [%list ~]]] +:: !> i.moves +:: :: +:: %+ expect-eq +:: !> ^- move:clay-gate +:: :- duct=~[/info2] +:: ^- (wind note:clay-gate gift:able:clay) +:: :+ %pass /diffing/~nul/home/~2222.2.2 +:: ^- note:clay-gate +:: :- %f +:: [%build live=%.n [%pin ~2222.2.2 [%list ~]]] +:: !> i.t.moves +:: :: +:: ^- tang +:: :: +:: =/ move=move:clay-gate i.t.t.moves +:: =/ =duct p.move +:: =/ card=(wind note:clay-gate gift:able:clay) q.move +:: :: +:: %+ weld +:: (expect-eq !>(~[/info2]) !>(duct)) +:: :: +:: ?. ?=(%pass -.card) +:: [%leaf "bad move, not a %pass: {}"]~ +:: :: +:: =/ =wire p.card +:: :: +:: %+ weld +:: (expect-eq !>(/inserting/~nul/home/~2222.2.2) !>(wire)) +:: :: +:: =/ note=note:clay-gate q.card +:: :: +:: ?. ?=([%f %build *] note) +:: [%leaf "bad move, not a %build: {}"]~ +:: :: +:: %+ weld +:: (expect-eq !>(%.n) !>(live.note)) +:: :: +:: %- expect-schematic:test-ford-external +:: :_ schematic.note +:: ^- schematic:ford +:: :+ %pin ~2222.2.2 +:: :- %list +:: :~ :- [%$ %path -:!>(*path) /file3/noun] +:: :^ %cast [~nul %home] %noun +:: [%$ %noun %noun 'file3'] +:: :: +:: :- [%$ %path -:!>(*path) /file4/noun] +:: :^ %cast [~nul %home] %noun +:: [%$ %noun %noun 'file4'] +:: == +:: == == +:: :: +:: ;: welp +:: results0 +:: results1 +:: results2 +:: results3 +:: results4 +:: results5 +:: results6 +:: results7 +:: == +:::: |utilities: helper functions for testing +:::: +:::: TODO: make these utilities generic for any vane +:::: +::::+| utilities +:::: +:::: +clay-call: have clay run a +task and assert it produces :expected-moves7890 +:::: +::++ clay-call +:: |= $: clay-gate=_clay-gate +:: now=@da +:: scry=sley +:: call-args=[=duct =type wrapped-task=(hobo task:able:clay)] +:: expected-moves=(list move:clay-gate) +:: == +:: ^- [tang _clay-gate] +:: :: +:: =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) +:: :: +:: =^ moves clay-gate (call:clay-core [duct ~ type wrapped-task]:call-args) +:: :: +:: =/ output=tang +:: %+ expect-eq +:: !> expected-moves +:: !> moves +:: :: +:: [output clay-gate] +:::: +clay-call-with-comparator: run a clay +task and test output moves +:::: +::++ clay-call-with-comparator +:: |= $: clay-gate=_clay-gate +:: now=@da +:: scry=sley +:: call-args=[=duct =type wrapped-task=(hobo task:able:clay)] +:: move-comparator=$-((list move:clay-gate) tang) +:: == +:: ^- [tang _clay-gate] +:: :: +:: =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) +:: :: +:: =^ moves clay-gate (call:clay-core [duct ~ type wrapped-task]:call-args) +:: :: +:: =/ output=tang (move-comparator moves) +:: :: +:: [output clay-gate] +:::: +clay-take: have clay receive a +note and assert output moves +:::: +::++ clay-take +:: |= $: clay-gate=_clay-gate +:: now=@da +:: scry=sley +:: take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] +:: expected-moves=(list move:clay-gate) +:: == +:: ^- [tang _clay-gate] +:: :: +:: =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) +:: :: +:: =^ moves clay-gate (take:clay-core [wire duct ~ wrapped-sign]:take-args) +:: :: +:: =/ output=tang +:: %+ expect-eq +:: !> expected-moves +:: !> moves +:: :: +:: [output clay-gate] +:::: +clay-take-with-comparator: have clay receive a +note and test output moves +:::: +::++ clay-take-with-comparator +:: |= $: clay-gate=_clay-gate +:: now=@da +:: scry=sley +:: take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] +:: move-comparator=$-((list move:clay-gate) tang) +:: == +:: ^- [tang _clay-gate] +:: :: +:: =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) +:: :: +:: =^ moves clay-gate (take:clay-core [wire duct ~ wrapped-sign]:take-args) +:: :: +:: =/ output=tang (move-comparator moves) +:: :: +:: [output clay-gate] +::-- From 14f0e35c89603d1be01d3b620decb9b906c27cec Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 18 Apr 2020 20:01:26 -0400 Subject: [PATCH 039/280] ford-fusion: all vane tests pass --- pkg/arvo/tests/sys/vane/clay.hoon | 1063 +++-- pkg/arvo/tests/sys/vane/eyre.hoon | 3 +- pkg/arvo/tests/sys/vane/ford.hoon | 7066 ----------------------------- pkg/arvo/tests/sys/vane/gall.hoon | 3 +- pkg/arvo/tests/sys/vane/iris.hoon | 3 +- 5 files changed, 534 insertions(+), 7604 deletions(-) delete mode 100644 pkg/arvo/tests/sys/vane/ford.hoon diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index eb545c10e..0edfc6095 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -140,536 +140,535 @@ == !> dez:(~(got by vases.cache.nub) /lib/strandio/hoon) == --- :: -::++ test-info ^- tang -:: =^ results0 clay-gate -:: %- clay-call :* -:: clay-gate -:: now=~1111.1.1 -:: scry=*sley -:: call-args=[duct=~[/init] -:!>(*task:able:clay) [%init ~nul]] -:: expected-moves=~ -:: == -:: :: -:: =^ results1 clay-gate -:: %- clay-call-with-comparator :* -:: clay-gate -:: now=~1111.1.1 -:: scry=*sley -:: ^= call-args -:: :+ duct=~[/info] type=-:!>(*task:able:clay) -:: ^- task:able:clay -:: :+ %info %home -:: ^- nori:clay -:: :- %& -:: ^- soba:clay -:: :~ [/file1/noun `miso:clay`[%ins [%noun %noun 'file1']]] -:: [/file2/noun `miso:clay`[%ins [%noun %noun 'file2']]] -:: == -:: ^= move-comparator -:: |= moves=(list move:clay-gate) -:: ^- tang -:: :: -:: ?. ?=([* ~] moves) -:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ -:: :: -:: ^- tang -:: ;: weld -:: :: -:: ^- tang -:: :: -:: =/ move=move:clay-gate i.moves -:: =/ =duct p.move -:: =/ card=(wind note:clay-gate gift:able:clay) q.move -:: :: -:: %+ weld -:: (expect-eq !>(~[/info]) !>(duct)) -:: :: -:: ?. ?=(%pass -.card) -:: [%leaf "bad move, not a %pass: {}"]~ -:: :: -:: =/ =wire p.card -:: :: -:: %+ weld -:: (expect-eq !>(/commit/home/inserts) !>(wire)) -:: :: -:: =/ note=note:clay-gate q.card -:: :: -:: ?. ?=([%f %build *] note) -:: [%leaf "bad move, not a %build: {}"]~ -:: :: -:: %+ weld -:: (expect-eq !>(%.n) !>(live.note)) -:: :: -:: %- expect-schematic:test-ford-external -:: :_ schematic.note -:: ^- schematic:ford -:: :+ %pin ~1111.1.1 -:: :- %list -:: :~ :- [%$ %path -:!>(*path) /file1/noun] -:: :^ %cast [~nul %home] %noun -:: [%$ %noun %noun 'file1'] -:: :: -:: :- [%$ %path -:!>(*path) /file2/noun] -:: :^ %cast [~nul %home] %noun -:: [%$ %noun %noun 'file2'] -:: == -:: == == -:: :: -:: :: inserting -:: :: -:: =^ results2 clay-gate -:: %- clay-take-with-comparator :* -:: clay-gate -:: now=~1111.1.1 -:: scry=*sley -:: ^= take-args -:: :* wire=/commit/home/inserts -:: duct=~[/info] -:: -:!>(*sign:clay-gate) -:: ^- sign:clay-gate -:: :* %f %made ~1111.1.1 %complete %success %list -:: ^- (list build-result:ford) -:: :~ :+ %success -:: [%success %$ %path -:!>(*path) /file1/noun] -:: [%success %cast %noun %noun 'file1'] -:: :: -:: :+ %success -:: [%success %$ %path -:!>(*path) /file2/noun] -:: [%success %cast %noun %noun 'file2'] -:: == == == -:: ^= comparator -:: |= moves=(list move:clay-gate) -:: ^- tang -:: :: -:: ?. ?=([* ~] moves) -:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ -:: :: -:: %+ expect-eq -:: !> ^- move:clay-gate -:: :- duct=~[/info] -:: ^- (wind note:clay-gate gift:able:clay) -:: :+ %pass /commit/home/diffs -:: ^- note:clay-gate -:: :- %f -:: [%build live=%.n [%pin ~1111.1.1 [%list ~]]] -:: !> i.moves -:: == :: == -:: :: -:: :: diffing -:: :: -:: =^ results3 clay-gate -:: %- clay-take-with-comparator :* -:: clay-gate -:: now=~1111.1.1 -:: scry=*sley -:: ^= take-args -:: :* wire=/commit/home/diffs -:: duct=~[/info] -:: -:!>(*sign:clay-gate) -:: ^- sign:clay-gate -:: [%f %made ~1111.1.1 %complete %success %list ~] -:: == -:: ^= move-comparator -:: |= moves=(list move:clay-gate) -:: ^- tang -:: :: -:: ?. ?=([* ~] moves) -:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ -:: :: -:: %+ expect-eq -:: !> ^- move:clay-gate -:: :- duct=~[/info] -:: ^- (wind note:clay-gate gift:able:clay) -:: :+ %pass /commit/home/casts -:: ^- note:clay-gate -:: :- %f -:: [%build live=%.n [%pin ~1111.1.1 [%list ~]]] -:: !> i.moves -:: == -:: :: -:: :: castifying -:: :: -:: =^ results4 clay-gate -:: %- clay-take-with-comparator :* -:: clay-gate -:: now=~1111.1.1 -:: scry=*sley -:: ^= take-args -:: :* wire=/commit/home/casts -:: duct=~[/info] -:: -:!>(*sign:clay-gate) -:: ^- sign:clay-gate -:: [%f %made ~1111.1.1 %complete %success %list ~] -:: == -:: ^= comparator -:: |= moves=(list move:clay-gate) -:: ^- tang -:: :: -:: ?. ?=([* ~] moves) -:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ -:: :: -:: =/ move=move:clay-gate i.moves -:: =/ =duct p.move -:: =/ card=(wind note:clay-gate gift:able:clay) q.move -:: :: -:: %+ weld -:: (expect-eq !>(~[/info]) !>(duct)) -:: :: -:: ?. ?=(%pass -.card) -:: [%leaf "bad move, not a %pass: {}"]~ -:: :: -:: =/ =wire p.card -:: :: -:: %+ weld -:: (expect-eq !>(/commit/home/mutates) !>(wire)) -:: :: -:: =/ note=note:clay-gate q.card -:: :: -:: ?. ?=([%f %build *] note) -:: [%leaf "bad move, not a %build: {}"]~ -:: :: -:: %+ weld -:: (expect-eq !>(%.n) !>(live.note)) -:: :: -:: %- expect-schematic:test-ford-external -:: :_ schematic.note -:: ^- schematic:ford -:: [%pin ~1111.1.1 %list ~] -:: == -:: :: -:: :: mutating -:: :: -:: =^ results5 clay-gate -:: %- clay-take-with-comparator :* -:: clay-gate -:: now=~1111.1.1 -:: scry=*sley -:: ^= take-args -:: :* wire=/commit/home/mutates -:: duct=~[/info] -:: -:!>(*sign:clay-gate) -:: ^- sign:clay-gate -:: [%f %made ~1111.1.1 %complete %success %list ~] -:: == -:: ^= comparator -:: |= moves=(list move:clay-gate) -:: ^- tang -:: :: -:: ?. ?=([* ~] moves) -:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ -:: :: -:: =/ move=move:clay-gate i.moves -:: =/ =duct p.move -:: =/ card=(wind note:clay-gate gift:able:clay) q.move -:: :: -:: %+ weld -:: (expect-eq !>(~[/info]) !>(duct)) -:: :: -:: ?. ?=(%pass -.card) -:: [%leaf "bad move, not a %pass: {}"]~ -:: :: -:: =/ =wire p.card -:: :: -:: %+ weld -:: (expect-eq !>(/commit/home/checkout) !>(wire)) -:: :: -:: =/ note=note:clay-gate q.card -:: :: -:: ?. ?=([%f %build *] note) -:: [%leaf "bad move, not a %build: {}"]~ -:: :: -:: %+ weld -:: (expect-eq !>(%.n) !>(live.note)) -:: :: -:: %- expect-schematic:test-ford-external -:: :_ schematic.note -:: ^- schematic:ford -:: :- %list -:: ^- (list schematic:ford) -:: :~ :- :^ %$ %path-hash -:!>([*path *@uvI]) -:: :- /file1/noun -:: 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj.k8b3s.n5hlf.57i21.5m1nn.bhob7 -:: :: -:: [%volt [~nul %home] %noun 'file1'] -:: :: -:: :- :^ %$ %path-hash -:!>([*path *@uvI]) -:: :- /file2/noun -:: 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp.8ifgp.0ljbi.dqau7.7c0q0.fj144 -:: :: -:: [%volt [~nul %home] %noun 'file2'] -:: == == -:: :: -:: :: patching -:: :: -:: =^ results6 clay-gate -:: %- clay-take :* -:: clay-gate -:: now=~1111.1.1 -:: scry=*sley -:: ^= take-args -:: :* wire=/commit/home/checkout -:: duct=~[/info] -:: -:!>(*sign:clay-gate) -:: ^- sign:clay-gate -:: :* %f %made ~1111.1.1 %complete %success %list -:: ^- (list build-result:ford) -:: :~ :+ %success -:: :* %success %$ %path-hash -:!>([*path *@uvI]) -:: /file1/noun -:: 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj. -:: k8b3s.n5hlf.57i21.5m1nn.bhob7 -:: == -:: [%success %volt %noun %noun 'file1'] -:: :: -:: :+ %success -:: :* %success %$ %path-hash -:!>([*path *@uvI]) -:: /file2/noun -:: 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp. -:: 8ifgp.0ljbi.dqau7.7c0q0.fj144 -:: == -:: [%success %volt %noun %noun 'file2'] -:: == == == -:: ^= expected-moves -:: :~ :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] -:: :~ [%leaf "~nul"] -:: [%leaf "home"] -:: [%leaf "1"] -:: [%leaf "file1"] -:: [%leaf "noun"] -:: == == -:: :: -:: :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] -:: :~ [%leaf "~nul"] -:: [%leaf "home"] -:: [%leaf "1"] -:: [%leaf "file2"] -:: [%leaf "noun"] -:: == == == == -:: :: make a second write request during the same arvo event -:: :: -:: :: This should produce a Behn timer at `now` to run the write -:: :: request. -:: :: -:: =^ results7 clay-gate -:: %- clay-call-with-comparator :* -:: clay-gate -:: now=~1111.1.1 -:: scry=*sley -:: ^= call-args -:: :+ duct=~[/info2] type=-:!>(*task:able:clay) -:: ^- task:able:clay -:: :+ %info %home -:: ^- nori:clay -:: :- %& -:: ^- soba:clay -:: :~ [/file3/noun `miso:clay`[%ins [%noun %noun 'file3']]] -:: [/file4/noun `miso:clay`[%ins [%noun %noun 'file4']]] -:: == -:: ^= comparator -:: |= moves=(list move:clay-gate) -:: ^- tang -:: :: -:: ?. ?=([* ~] moves) -:: [%leaf "wrong number of moves: {}"]~ -:: :: -:: =/ move=move:clay-gate i.moves -:: =/ =duct p.move -:: =/ card=(wind note:clay-gate gift:able:clay) q.move -:: :: -:: %+ weld -:: (expect-eq !>(~[/info2]) !>(duct)) -:: :: -:: ?. ?=(%pass -.card) -:: [%leaf "bad move, not a %pass: {}"]~ -:: :: -:: =/ =wire p.card -:: :: -:: %+ weld -:: (expect-eq !>(/queued-request) !>(wire)) -:: :: -:: =/ note=note:clay-gate q.card -:: :: -:: ?. ?=([%b %wait *] note) -:: [%leaf "bad move, not a %wait: {}"]~ -:: :: -:: (expect-eq !>(~1111.1.1) !>(p.note)) -:: == -:: :: -:: =^ results8 clay-gate -:: %- clay-take-with-comparator :* -:: clay-gate -:: now=~2222.2.2 -:: scry=*sley -:: ^= take-args -:: :* wire=/queued-request -:: duct=~[/info2] -:: -:!>(*sign:clay-gate) -:: ^- sign:clay-gate -:: [%b %wake ~] -:: == -:: ^= comparator -:: |= moves=(list move:clay-gate) -:: ^- tang -:: :: -:: ?. ?=([* * * ~] moves) -:: [%leaf "wrong number of moves: {<(lent moves)>}"]~ -:: :: -:: ^- tang -:: ;: weld -:: %+ expect-eq -:: !> ^- move:clay-gate -:: :- duct=~[/info2] -:: ^- (wind note:clay-gate gift:able:clay) -:: :+ %pass /castifying/~nul/home/~2222.2.2 -:: ^- note:clay-gate -:: :- %f -:: [%build live=%.n [%pin ~2222.2.2 [%list ~]]] -:: !> i.moves -:: :: -:: %+ expect-eq -:: !> ^- move:clay-gate -:: :- duct=~[/info2] -:: ^- (wind note:clay-gate gift:able:clay) -:: :+ %pass /diffing/~nul/home/~2222.2.2 -:: ^- note:clay-gate -:: :- %f -:: [%build live=%.n [%pin ~2222.2.2 [%list ~]]] -:: !> i.t.moves -:: :: -:: ^- tang -:: :: -:: =/ move=move:clay-gate i.t.t.moves -:: =/ =duct p.move -:: =/ card=(wind note:clay-gate gift:able:clay) q.move -:: :: -:: %+ weld -:: (expect-eq !>(~[/info2]) !>(duct)) -:: :: -:: ?. ?=(%pass -.card) -:: [%leaf "bad move, not a %pass: {}"]~ -:: :: -:: =/ =wire p.card -:: :: -:: %+ weld -:: (expect-eq !>(/inserting/~nul/home/~2222.2.2) !>(wire)) -:: :: -:: =/ note=note:clay-gate q.card -:: :: -:: ?. ?=([%f %build *] note) -:: [%leaf "bad move, not a %build: {}"]~ -:: :: -:: %+ weld -:: (expect-eq !>(%.n) !>(live.note)) -:: :: -:: %- expect-schematic:test-ford-external -:: :_ schematic.note -:: ^- schematic:ford -:: :+ %pin ~2222.2.2 -:: :- %list -:: :~ :- [%$ %path -:!>(*path) /file3/noun] -:: :^ %cast [~nul %home] %noun -:: [%$ %noun %noun 'file3'] -:: :: -:: :- [%$ %path -:!>(*path) /file4/noun] -:: :^ %cast [~nul %home] %noun -:: [%$ %noun %noun 'file4'] -:: == -:: == == -:: :: -:: ;: welp -:: results0 -:: results1 -:: results2 -:: results3 -:: results4 -:: results5 -:: results6 -:: results7 -:: == -:::: |utilities: helper functions for testing -:::: -:::: TODO: make these utilities generic for any vane -:::: -::::+| utilities -:::: -:::: +clay-call: have clay run a +task and assert it produces :expected-moves7890 -:::: -::++ clay-call -:: |= $: clay-gate=_clay-gate -:: now=@da -:: scry=sley -:: call-args=[=duct =type wrapped-task=(hobo task:able:clay)] -:: expected-moves=(list move:clay-gate) -:: == -:: ^- [tang _clay-gate] -:: :: -:: =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) -:: :: -:: =^ moves clay-gate (call:clay-core [duct ~ type wrapped-task]:call-args) -:: :: -:: =/ output=tang -:: %+ expect-eq -:: !> expected-moves -:: !> moves -:: :: -:: [output clay-gate] -:::: +clay-call-with-comparator: run a clay +task and test output moves -:::: -::++ clay-call-with-comparator -:: |= $: clay-gate=_clay-gate -:: now=@da -:: scry=sley -:: call-args=[=duct =type wrapped-task=(hobo task:able:clay)] -:: move-comparator=$-((list move:clay-gate) tang) -:: == -:: ^- [tang _clay-gate] -:: :: -:: =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) -:: :: -:: =^ moves clay-gate (call:clay-core [duct ~ type wrapped-task]:call-args) -:: :: -:: =/ output=tang (move-comparator moves) -:: :: -:: [output clay-gate] -:::: +clay-take: have clay receive a +note and assert output moves -:::: -::++ clay-take -:: |= $: clay-gate=_clay-gate -:: now=@da -:: scry=sley -:: take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] -:: expected-moves=(list move:clay-gate) -:: == -:: ^- [tang _clay-gate] -:: :: -:: =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) -:: :: -:: =^ moves clay-gate (take:clay-core [wire duct ~ wrapped-sign]:take-args) -:: :: -:: =/ output=tang -:: %+ expect-eq -:: !> expected-moves -:: !> moves -:: :: -:: [output clay-gate] -:::: +clay-take-with-comparator: have clay receive a +note and test output moves -:::: -::++ clay-take-with-comparator -:: |= $: clay-gate=_clay-gate -:: now=@da -:: scry=sley -:: take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] -:: move-comparator=$-((list move:clay-gate) tang) -:: == -:: ^- [tang _clay-gate] -:: :: -:: =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) -:: :: -:: =^ moves clay-gate (take:clay-core [wire duct ~ wrapped-sign]:take-args) -:: :: -:: =/ output=tang (move-comparator moves) -:: :: -:: [output clay-gate] -::-- +++ test-info ^- tang + =^ results0 clay-gate + %- clay-call :* + clay-gate + now=~1111.1.1 + scry=*sley + call-args=[duct=~[/init] -:!>(*task:able:clay) [%init ~nul]] + expected-moves=~ + == + :: + =^ results1 clay-gate + %- clay-call-with-comparator :* + clay-gate + now=~1111.1.1 + scry=*sley + ^= call-args + :+ duct=~[/info] type=-:!>(*task:able:clay) + ^- task:able:clay + :+ %info %home + ^- nori:clay + :- %& + ^- soba:clay + :~ [/file1/noun `miso:clay`[%ins [%noun %noun 'file1']]] + [/file2/noun `miso:clay`[%ins [%noun %noun 'file2']]] + == + ^= move-comparator + |= moves=(list move:clay-gate) + ^- tang + :: + ?. ?=([* ~] moves) + [%leaf "wrong number of moves: {<(lent moves)>}"]~ + :: + ^- tang + ;: weld + :: + ^- tang + :: + =/ move=move:clay-gate i.moves + =/ =duct p.move + =/ card=(wind note:clay-gate gift:able:clay) q.move + :: + %+ weld + (expect-eq !>(~[/info]) !>(duct)) + :: + ?. ?=(%pass -.card) + [%leaf "bad move, not a %pass: {}"]~ + :: + =/ =wire p.card + :: + %+ weld + (expect-eq !>(/commit/home/inserts) !>(wire)) + :: + =/ note=note:clay-gate q.card + :: + ?. ?=([%f %build *] note) + [%leaf "bad move, not a %build: {}"]~ + :: + %+ weld + (expect-eq !>(%.n) !>(live.note)) + :: + %- expect-schematic:test-ford-external + :_ schematic.note + ^- schematic:ford + :+ %pin ~1111.1.1 + :- %list + :~ :- [%$ %path -:!>(*path) /file1/noun] + :^ %cast [~nul %home] %noun + [%$ %noun %noun 'file1'] + :: + :- [%$ %path -:!>(*path) /file2/noun] + :^ %cast [~nul %home] %noun + [%$ %noun %noun 'file2'] + == + == == + :: + :: inserting + :: + =^ results2 clay-gate + %- clay-take-with-comparator :* + clay-gate + now=~1111.1.1 + scry=*sley + ^= take-args + :* wire=/commit/home/inserts + duct=~[/info] + -:!>(*sign:clay-gate) + ^- sign:clay-gate + :* %f %made ~1111.1.1 %complete %success %list + ^- (list build-result:ford) + :~ :+ %success + [%success %$ %path -:!>(*path) /file1/noun] + [%success %cast %noun %noun 'file1'] + :: + :+ %success + [%success %$ %path -:!>(*path) /file2/noun] + [%success %cast %noun %noun 'file2'] + == == == + ^= comparator + |= moves=(list move:clay-gate) + ^- tang + :: + ?. ?=([* ~] moves) + [%leaf "wrong number of moves: {<(lent moves)>}"]~ + :: + %+ expect-eq + !> ^- move:clay-gate + :- duct=~[/info] + ^- (wind note:clay-gate gift:able:clay) + :+ %pass /commit/home/diffs + ^- note:clay-gate + :- %f + [%build live=%.n [%pin ~1111.1.1 [%list ~]]] + !> i.moves + == :: == + :: + :: diffing + :: + =^ results3 clay-gate + %- clay-take-with-comparator :* + clay-gate + now=~1111.1.1 + scry=*sley + ^= take-args + :* wire=/commit/home/diffs + duct=~[/info] + -:!>(*sign:clay-gate) + ^- sign:clay-gate + [%f %made ~1111.1.1 %complete %success %list ~] + == + ^= move-comparator + |= moves=(list move:clay-gate) + ^- tang + :: + ?. ?=([* ~] moves) + [%leaf "wrong number of moves: {<(lent moves)>}"]~ + :: + %+ expect-eq + !> ^- move:clay-gate + :- duct=~[/info] + ^- (wind note:clay-gate gift:able:clay) + :+ %pass /commit/home/casts + ^- note:clay-gate + :- %f + [%build live=%.n [%pin ~1111.1.1 [%list ~]]] + !> i.moves + == + :: + :: castifying + :: + =^ results4 clay-gate + %- clay-take-with-comparator :* + clay-gate + now=~1111.1.1 + scry=*sley + ^= take-args + :* wire=/commit/home/casts + duct=~[/info] + -:!>(*sign:clay-gate) + ^- sign:clay-gate + [%f %made ~1111.1.1 %complete %success %list ~] + == + ^= comparator + |= moves=(list move:clay-gate) + ^- tang + :: + ?. ?=([* ~] moves) + [%leaf "wrong number of moves: {<(lent moves)>}"]~ + :: + =/ move=move:clay-gate i.moves + =/ =duct p.move + =/ card=(wind note:clay-gate gift:able:clay) q.move + :: + %+ weld + (expect-eq !>(~[/info]) !>(duct)) + :: + ?. ?=(%pass -.card) + [%leaf "bad move, not a %pass: {}"]~ + :: + =/ =wire p.card + :: + %+ weld + (expect-eq !>(/commit/home/mutates) !>(wire)) + :: + =/ note=note:clay-gate q.card + :: + ?. ?=([%f %build *] note) + [%leaf "bad move, not a %build: {}"]~ + :: + %+ weld + (expect-eq !>(%.n) !>(live.note)) + :: + %- expect-schematic:test-ford-external + :_ schematic.note + ^- schematic:ford + [%pin ~1111.1.1 %list ~] + == + :: + :: mutating + :: + =^ results5 clay-gate + %- clay-take-with-comparator :* + clay-gate + now=~1111.1.1 + scry=*sley + ^= take-args + :* wire=/commit/home/mutates + duct=~[/info] + -:!>(*sign:clay-gate) + ^- sign:clay-gate + [%f %made ~1111.1.1 %complete %success %list ~] + == + ^= comparator + |= moves=(list move:clay-gate) + ^- tang + :: + ?. ?=([* ~] moves) + [%leaf "wrong number of moves: {<(lent moves)>}"]~ + :: + =/ move=move:clay-gate i.moves + =/ =duct p.move + =/ card=(wind note:clay-gate gift:able:clay) q.move + :: + %+ weld + (expect-eq !>(~[/info]) !>(duct)) + :: + ?. ?=(%pass -.card) + [%leaf "bad move, not a %pass: {}"]~ + :: + =/ =wire p.card + :: + %+ weld + (expect-eq !>(/commit/home/checkout) !>(wire)) + :: + =/ note=note:clay-gate q.card + :: + ?. ?=([%f %build *] note) + [%leaf "bad move, not a %build: {}"]~ + :: + %+ weld + (expect-eq !>(%.n) !>(live.note)) + :: + %- expect-schematic:test-ford-external + :_ schematic.note + ^- schematic:ford + :- %list + ^- (list schematic:ford) + :~ :- :^ %$ %path-hash -:!>([*path *@uvI]) + :- /file1/noun + 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj.k8b3s.n5hlf.57i21.5m1nn.bhob7 + :: + [%volt [~nul %home] %noun 'file1'] + :: + :- :^ %$ %path-hash -:!>([*path *@uvI]) + :- /file2/noun + 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp.8ifgp.0ljbi.dqau7.7c0q0.fj144 + :: + [%volt [~nul %home] %noun 'file2'] + == == + :: + :: patching + :: + =^ results6 clay-gate + %- clay-take :* + clay-gate + now=~1111.1.1 + scry=*sley + ^= take-args + :* wire=/commit/home/checkout + duct=~[/info] + -:!>(*sign:clay-gate) + ^- sign:clay-gate + :* %f %made ~1111.1.1 %complete %success %list + ^- (list build-result:ford) + :~ :+ %success + :* %success %$ %path-hash -:!>([*path *@uvI]) + /file1/noun + 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj. + k8b3s.n5hlf.57i21.5m1nn.bhob7 + == + [%success %volt %noun %noun 'file1'] + :: + :+ %success + :* %success %$ %path-hash -:!>([*path *@uvI]) + /file2/noun + 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp. + 8ifgp.0ljbi.dqau7.7c0q0.fj144 + == + [%success %volt %noun %noun 'file2'] + == == == + ^= expected-moves + :~ :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] + :~ [%leaf "~nul"] + [%leaf "home"] + [%leaf "1"] + [%leaf "file1"] + [%leaf "noun"] + == == + :: + :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] + :~ [%leaf "~nul"] + [%leaf "home"] + [%leaf "1"] + [%leaf "file2"] + [%leaf "noun"] + == == == == + :: make a second write request during the same arvo event + :: + :: This should produce a Behn timer at `now` to run the write + :: request. + :: + =^ results7 clay-gate + %- clay-call-with-comparator :* + clay-gate + now=~1111.1.1 + scry=*sley + ^= call-args + :+ duct=~[/info2] type=-:!>(*task:able:clay) + ^- task:able:clay + :+ %info %home + ^- nori:clay + :- %& + ^- soba:clay + :~ [/file3/noun `miso:clay`[%ins [%noun %noun 'file3']]] + [/file4/noun `miso:clay`[%ins [%noun %noun 'file4']]] + == + ^= comparator + |= moves=(list move:clay-gate) + ^- tang + :: + ?. ?=([* ~] moves) + [%leaf "wrong number of moves: {}"]~ + :: + =/ move=move:clay-gate i.moves + =/ =duct p.move + =/ card=(wind note:clay-gate gift:able:clay) q.move + :: + %+ weld + (expect-eq !>(~[/info2]) !>(duct)) + :: + ?. ?=(%pass -.card) + [%leaf "bad move, not a %pass: {}"]~ + :: + =/ =wire p.card + :: + %+ weld + (expect-eq !>(/queued-request) !>(wire)) + :: + =/ note=note:clay-gate q.card + :: + ?. ?=([%b %wait *] note) + [%leaf "bad move, not a %wait: {}"]~ + :: + (expect-eq !>(~1111.1.1) !>(p.note)) + == + :: + =^ results8 clay-gate + %- clay-take-with-comparator :* + clay-gate + now=~2222.2.2 + scry=*sley + ^= take-args + :* wire=/queued-request + duct=~[/info2] + -:!>(*sign:clay-gate) + ^- sign:clay-gate + [%b %wake ~] + == + ^= comparator + |= moves=(list move:clay-gate) + ^- tang + :: + ?. ?=([* * * ~] moves) + [%leaf "wrong number of moves: {<(lent moves)>}"]~ + :: + ^- tang + ;: weld + %+ expect-eq + !> ^- move:clay-gate + :- duct=~[/info2] + ^- (wind note:clay-gate gift:able:clay) + :+ %pass /castifying/~nul/home/~2222.2.2 + ^- note:clay-gate + :- %f + [%build live=%.n [%pin ~2222.2.2 [%list ~]]] + !> i.moves + :: + %+ expect-eq + !> ^- move:clay-gate + :- duct=~[/info2] + ^- (wind note:clay-gate gift:able:clay) + :+ %pass /diffing/~nul/home/~2222.2.2 + ^- note:clay-gate + :- %f + [%build live=%.n [%pin ~2222.2.2 [%list ~]]] + !> i.t.moves + :: + ^- tang + :: + =/ move=move:clay-gate i.t.t.moves + =/ =duct p.move + =/ card=(wind note:clay-gate gift:able:clay) q.move + :: + %+ weld + (expect-eq !>(~[/info2]) !>(duct)) + :: + ?. ?=(%pass -.card) + [%leaf "bad move, not a %pass: {}"]~ + :: + =/ =wire p.card + :: + %+ weld + (expect-eq !>(/inserting/~nul/home/~2222.2.2) !>(wire)) + :: + =/ note=note:clay-gate q.card + :: + ?. ?=([%f %build *] note) + [%leaf "bad move, not a %build: {}"]~ + :: + %+ weld + (expect-eq !>(%.n) !>(live.note)) + :: + %- expect-schematic:test-ford-external + :_ schematic.note + ^- schematic:ford + :+ %pin ~2222.2.2 + :- %list + :~ :- [%$ %path -:!>(*path) /file3/noun] + :^ %cast [~nul %home] %noun + [%$ %noun %noun 'file3'] + :: + :- [%$ %path -:!>(*path) /file4/noun] + :^ %cast [~nul %home] %noun + [%$ %noun %noun 'file4'] + == + == == + :: + ;: welp + results0 + results1 + results2 + results3 + results4 + results5 + results6 + results7 + == +:: |utilities: helper functions for testing +:: +:: TODO: make these utilities generic for any vane +:: +::+| utilities +:: +:: +clay-call: have clay run a +task and assert it produces :expected-moves7890 +:: +++ clay-call + |= $: clay-gate=_clay-gate + now=@da + scry=sley + call-args=[=duct =type wrapped-task=(hobo task:able:clay)] + expected-moves=(list move:clay-gate) + == + ^- [tang _clay-gate] + :: + =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) + :: + =^ moves clay-gate (call:clay-core [duct ~ type wrapped-task]:call-args) + :: + =/ output=tang + %+ expect-eq + !> expected-moves + !> moves + :: + [output clay-gate] +:: +clay-call-with-comparator: run a clay +task and test output moves +:: +++ clay-call-with-comparator + |= $: clay-gate=_clay-gate + now=@da + scry=sley + call-args=[=duct =type wrapped-task=(hobo task:able:clay)] + move-comparator=$-((list move:clay-gate) tang) + == + ^- [tang _clay-gate] + :: + =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) + :: + =^ moves clay-gate (call:clay-core [duct ~ type wrapped-task]:call-args) + :: + =/ output=tang (move-comparator moves) + :: + [output clay-gate] +:: +clay-take: have clay receive a +note and assert output moves +:: +++ clay-take + |= $: clay-gate=_clay-gate + now=@da + scry=sley + take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] + expected-moves=(list move:clay-gate) + == + ^- [tang _clay-gate] + :: + =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) + :: + =^ moves clay-gate (take:clay-core [wire duct ~ wrapped-sign]:take-args) + :: + =/ output=tang + %+ expect-eq + !> expected-moves + !> moves + :: + [output clay-gate] +:: +clay-take-with-comparator: have clay receive a +note and test output moves +:: +++ clay-take-with-comparator + |= $: clay-gate=_clay-gate + now=@da + scry=sley + take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] + move-comparator=$-((list move:clay-gate) tang) + == + ^- [tang _clay-gate] + :: + =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) + :: + =^ moves clay-gate (take:clay-core [wire duct ~ wrapped-sign]:take-args) + :: + =/ output=tang (move-comparator moves) + :: + [output clay-gate] +-- diff --git a/pkg/arvo/tests/sys/vane/eyre.hoon b/pkg/arvo/tests/sys/vane/eyre.hoon index 9d6d67a38..a9f26f00a 100644 --- a/pkg/arvo/tests/sys/vane/eyre.hoon +++ b/pkg/arvo/tests/sys/vane/eyre.hoon @@ -1,6 +1,5 @@ /+ *test, *test-ford-external -:: -/= http-server-raw /: /===/sys/vane/eyre /!noun/ +/= http-server-raw /sys/vane/eyre :: !: :: diff --git a/pkg/arvo/tests/sys/vane/ford.hoon b/pkg/arvo/tests/sys/vane/ford.hoon deleted file mode 100644 index 51b83dbfe..000000000 --- a/pkg/arvo/tests/sys/vane/ford.hoon +++ /dev/null @@ -1,7066 +0,0 @@ -/+ *test, *test-ford -:: -|% -++ test-tear ^- tang - :: - ;: welp - %+ expect-eq - !> ~['a' 'bc' 'de'] - !> (tear:ford-gate 'a-bc-de') - :: - %+ expect-eq - !> ~['abc'] - !> (tear:ford-gate 'abc') - :: - %+ expect-eq - !> ~['ab/c'] - !> (tear:ford-gate 'ab/c') - == -:: -++ test-unify-jugs ^- tang - :: - %+ expect-eq - !> ^- (jug @tas @ud) - (my ~[[%a (sy 1 2 ~)] [%b (sy 3 4 5 6 ~)] [%c (sy 7 8 ~)]]) - !> %+ unify-jugs:ford-gate - `(jug @tas @ud)`(my ~[[%a (sy 1 2 ~)] [%b (sy 3 4 ~)]]) - `(jug @tas @ud)`(my ~[[%b (sy 5 6 ~)] [%c (sy 7 8 ~)]]) -:: -++ test-resource-wire-encoding ^- tang - :: - ;: welp - %+ expect-eq - !> /cx/~nul/desk/~1234.5.6/bar/foo - !> ^- path - %- scry-request-to-path:ford-gate - [%c care=%x [[~nul %desk [%da ~1234.5.6]] /foo/bar]] - :: - %+ expect-eq - !> [%c care=%x [[~nul %desk [%da ~1234.5.6]] /foo/bar]] - !> %- need - (path-to-scry-request:ford-gate /cx/~nul/desk/~1234.5.6/bar/foo) - == -:: -++ test-parse-scaffold ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - "!. |=(a=@ud +(a))" - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - :: - %+ expect-eq - !> :- [1 19] - :- ~ - :_ [[1 19] ""] - ^- scaffold:ford-gate - :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=%309 - structures=~ - libraries=~ - cranes=~ - ^= sources - :~ :* %dbug [/~nul/desk/~1234.5.6/foo/bar [[1 1] [1 19]]] - (ream '!. |=(a=@ud +(a))') - == == == - !> parsed -:: -++ test-parse-scaffold-sur-libk ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /- struct, face=other - /+ library, *thing - !. - |=(a a) - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~[[`%struct %struct] [`%face %other]] - libraries=~[[`%library %library] [~ %thing]] - cranes=~ - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [3 1] [4 8]] - (ream '|=(a a)') - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-zuse-version ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /? 400 - !. - |=(a a) - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=400 - structures=~ - libraries=~ - cranes=~ - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 1] [3 8]] - (ream '|=(a a)') - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fssg ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /~ !. [a=1 b=3] - !. - |=(a b) - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fssg - %dbug - [/~nul/desk/~1234.5.6/foo/bar [1 5] [1 18]] - (ream '[a=1 b=3]') - == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 1] [3 8]] - (ream '|=(a b)') - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fsbc ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /$ !. |=(a a) - !. - |=(a b) - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsbc - %dbug - [/~nul/desk/~1234.5.6/foo/bar [1 5] [1 16]] - (ream '|=(a a)') - == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 1] [3 8]] - (ream '|=(a b)') - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fsbr ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /| /~ ~ - /~ ~ - == - 5 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsbr - :~ :* %fssg %dbug - [/~nul/desk/~1234.5.6/foo/bar [1 9] [1 10]] - [%bust %null] - == - :* %fssg %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 9] [2 10]] - [%bust %null] - == == == == - ^= sources - :~ [%dbug [/~nul/desk/~1234.5.6/foo/bar [4 1] [4 2]] [%sand %ud 5]] - == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fsts ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /= a /~ ~ - 5 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsts %a - %fssg %dbug [/~nul/desk/~1234.5.6/foo/bar [1 12] [1 13]] - [%bust %null] - == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 1] [2 2]] [%sand %ud 5] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fsdt ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /. /~ !. a=5 - /~ !. b=6 - == - 5 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsdt - :~ :* %fssg %dbug - [/~nul/desk/~1234.5.6/foo/bar [1 9] [1 16]] - (ream 'a=5') - == - :* %fssg %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 9] [2 16]] - (ream 'b=6') - == == == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [4 1] [4 2]] [%sand %ud 5] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fscm ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /, - /path/to/a - /~ !. a=5 - :: - /path/to/b - /~ !. b=6 - == - 1 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fscm - :~ :- /path/to/a - :* %fssg %dbug - [/~nul/desk/~1234.5.6/foo/bar [3 7] [3 14]] - (ream 'a=5') - == - :- /path/to/b - :* %fssg %dbug - [/~nul/desk/~1234.5.6/foo/bar [6 7] [6 14]] - (ream 'b=6') - == == == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [8 1] [8 2]] [%sand %ud 1] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fspm ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /= data /& mark /~ !. a=1 - 1 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsts %data - %fspm [%mark ~] - %fssg %dbug - [/~nul/desk/~1234.5.6/foo/bar [1 25] [1 32]] - (ream 'a=1') - == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 1] [2 2]] [%sand %ud 1] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fscb ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /_ /mark/ - 8 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fscb %fszy %mark - == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 1] [2 2]] [%sand %ud 8] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fssm ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /= data - /; !. |=(a=@u +(a)) - /~ !. 5 - 7 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsts %data - %fssm - :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 7] [2 24]] - (ream '|=(a=@u +(a))') - == - %fssg - :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [3 7] [3 12]] - (ream '5') - == == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [4 1] [4 2]] [%sand %ud 7] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fscl ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /= tests - /: /===/tests - /_ /mark/ - 3 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsts %tests - %fscl [[~ ~[~ ~ ~ [~ [%sand %tas 495.874.958.708]]]] ~] - %fscb %fszy %mark - == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [4 1] [4 2]] [%sand %ud 3] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fskt ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /= data - /^ (list @ud) - /. /~ 1 - /~ 2 - == - 6 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsts %data - %fskt - :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 7] [2 17]] - %make - :+ %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 8] [2 12]] - [%wing ~[%list]] - :~ :+ %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 13] [2 16]] - [%base [%atom %ud]] - == - == - %fsdt - :~ :- %fssg - :+ %dbug - [/~nul/desk/~1234.5.6/foo/bar [3 11] [3 12]] - [%sand %ud 1] - :: - :- %fssg - :+ %dbug - [/~nul/desk/~1234.5.6/foo/bar [4 11] [4 12]] - [%sand %ud 2] - == == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [6 1] [6 2]] [%sand %ud 6] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fszp ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /= data /!mark/ - 2 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsts %data - %fszp %mark - == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 1] [2 2]] [%sand %ud 2] - == == == - !> p.u.q.parsed -:: -++ test-parse-scaffold-crane-fszy ^- tang - :: - =/ parsed - %+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /bar/foo])) - [1 1] - """ - /= data /mark/ - 9 - """ - ?~ q.parsed - [%leaf "failed to parse at {}"]~ - %+ expect-eq - !> :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - ^= crane - :~ :* %fsts %data - %fszy %mark - == == - ^= sources - :~ :* %dbug - [/~nul/desk/~1234.5.6/foo/bar [2 1] [2 2]] [%sand %ud 9] - == == == - !> p.u.q.parsed -:: -++ test-literal ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: send a pinned literal, expects a %made response with pinned literal - :: - ^= call-args - [duct=~ type=~ %build live=%.n [%$ %noun !>(**)]] - :: - ^= moves - :~ :* duct=~ %give %made ~1234.5.6 - %complete %success %$ %noun !>(**) - == == - == - :: - %+ welp - results1 - (expect-ford-empty ford-gate ~nul) -:: -++ test-autocons-same ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: if we autocons the same schematic, we should get two of it as a result - :: - ^= call-args - :* duct=~ type=~ %build live=%.n - [[%$ %noun !>(**)] [%$ %noun !>(**)]] - == - :: - ^= moves - :~ :* duct=~ %give %made ~1234.5.6 %complete - %success - [%success %$ %noun !>(**)] - [%success %$ %noun !>(**)] - == == == - :: - %+ welp - results1 - (expect-ford-empty ford-gate ~nul) -:: -++ test-autocons-different ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: if we autocons different schematics, we get different values - :: - ^= call-args - :* duct=~ type=~ %build live=%.n - [[%$ %noun !>(42)] [%$ %noun !>(43)]] - == - :: - ^= moves - :~ :* duct=~ %give %made ~1234.5.6 %complete - %success - [%success %$ %noun !>(42)] - [%success %$ %noun !>(43)] - == == == - :: - %+ welp - results1 - (expect-ford-empty ford-gate ~nul) -:: -++ test-scry-clay-succeed ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-succeed ~1234.5.6 [%noun !>(42)]) - :: test a pinned scry which succeeds - :: - ^= call-args - :* duct=~ type=~ %build live=%.n - [%scry %c ren=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~ %give %made ~1234.5.6 %complete %success - [%scry %noun !>(42)] - == == == - :: - %+ welp - results1 - (expect-ford-empty ford-gate ~nul) -:: -++ test-scry-clay-fail ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-fail ~1234.5.6) - :: attempting to scry a path which fails should produce an error - :: - ^= call-args - :* duct=~ type=~ %build live=%.n - [%scry %c ren=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~ %give %made ~1234.5.6 %complete - %error - :~ leaf+"scry failed for" - leaf+"%cx /~nul/desk/~1234.5.6/foo/bar" - == == == == - :: - %+ weld - results1 - (expect-ford-empty ford-gate ~nul) -:: -++ test-scry-clay-block ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-block ~1234.5.6) - :: when we scry on a blocked path, expect a subscription move - :: - ^= call-args - :* duct=~ type=~ %build live=%.n - [%scry %c ren=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~ %pass - wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar - %c %warp ~nul %desk - ~ %sing %x [%da ~1234.5.6] /foo/bar - == == == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: when clay responds, send a %made - :: - ^= take-args - :* wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar duct=~ - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %writ ~ [%x [%da ~1234.5.6] %desk] /bar/foo %noun !>(42)] - == - :: - ^= moves - :~ :* duct=~ %give %made ~1234.5.6 %complete %success - [%scry %noun !>(42)] - == == == - :: - ;: welp - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-scry-clay-multiblock ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-block ~1234.5.6) - :: when we scry on a blocked path, expect a subscription move - :: - ^= call-args - :* duct=~[/one] type=~ %build live=%.n - [%scry %c ren=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/one] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar - %c %warp ~nul %desk - ~ %sing %x [%da ~1234.5.6] /foo/bar - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=(scry-block ~1234.5.6) - :: when we scry on a blocked path, expect a subscription move - :: - ^= call-args - :* duct=~[/two] type=~ %build live=%.n - [%pin ~1234.5.6 [%scry %c ren=%x rail=[[~nul %desk] /bar/foo]]] - == - :: - ^= moves ~ - == - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: when clay responds, send a %made - :: - ^= take-args - :* wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar duct=~ - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %writ ~ [%x [%da ~1234.5.6] %desk] /bar/foo %noun !>(42)] - == - :: - ^= moves - :~ :* duct=~[/two] %give %made ~1234.5.7 %complete %success - [%scry %noun !>(42)] - == - :* duct=~[/one] %give %made ~1234.5.6 %complete %success - [%scry %noun !>(42)] - == == == - :: - ;: welp - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-scry-clay-cancel ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-block ~1234.5.6) - :: when we scry on a blocked path, expect a subscription move - :: - ^= call-args - :* duct=~[/one] type=~ %build live=%.n - [%scry %c ren=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/one] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar - %c %warp ~nul %desk - ~ %sing %x [%da ~1234.5.6] /foo/bar - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/one] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/one] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-scry-clay-live ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-succeed ~1234.5.6 [%noun !>(42)]) - :: - ^= call-args - :* duct=~[/first] type=~ %build live=%.y - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/first] %give %made ~1234.5.6 %complete %success - [%scry %noun !>(42)] - == - :* duct=~[/first] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar]~)] - == == == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=(scry-succeed ~1234.5.7 [%noun !>(43)]) - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/first] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == - :: - ^= moves - :~ :* duct=~[/first] %give %made ~1234.5.7 %complete %success - [%scry %noun !>(43)] - == - :* duct=~[/first] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == == == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/first] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/first] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-scry-clay-live-again ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-succeed ~1234.5.6 [%noun !>(42)]) - :: perform a live scry, we should get a %made and a clay subscription - :: - ^= call-args - :* duct=~[/first] type=~ %build live=%.y - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/first] %give %made ~1234.5.6 %complete %success - [%scry %noun !>(42)] - == - :* duct=~[/first] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar]~)] - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=(scry-succeed ~1234.5.7 [%noun !>(42)]) - :: - ^= call-args - :* duct=~[/second] type=~ %build live=%.y - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/second] %give %made ~1234.5.7 %complete %success - [%scry %noun !>(42)] - == - :* duct=~[/second] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == == == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/first] type=~ %kill ~] - ^= moves - :~ :* duct=~[/first] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk ~ - == == == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.9 - scry=scry-is-forbidden - :: - call-args=[duct=~[/second] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/second] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: tests multiple subscriptions on the same resource at different times -:: -:: We can depend on the same paths but at different times. Make sure we can -:: block on /~nul/desk/~1234.5.7/... and /~nul/desk/~1234.5.8/... at the -:: same time. -:: -++ test-scry-clay-same-path ^- tang - :: - =/ scry-type=type [%atom %tas ~] - :: - =/ blocks=(set @da) (sy ~1234.5.7 ~1234.5.8 ~) - :: - =/ scry-schematic=schematic:ford-gate - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - =/ autocons=schematic:ford-gate - [[%pin ~1234.5.7 scry-schematic] [%pin ~1234.5.8 scry-schematic]] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-blocks blocks) - :: - call-args=[duct=~[/first] type=~ %build live=%.y autocons] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - %+ expect-eq - !> %- sy - :~ :* duct=~[/first] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.7/foo/bar - %c %warp ~nul %desk - `[%sing %x [%da ~1234.5.7] /foo/bar] - == - :* duct=~[/first] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.8/foo/bar - %c %warp ~nul %desk - `[%sing %x [%da ~1234.5.8] /foo/bar] - == == - !> (sy moves) - == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=(scry-blocks blocks) - :: - ^= take-args - :* wire=/scry-request/cx/~nul/desk/~1234.5.7/foo/bar duct=~[/first] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - :* %c %writ ~ [%x [%da ~1234.5.7] %desk] - /bar/foo %noun scry-type %seven - == - == - :: - expected-moves=~ - == - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.8 - scry=(scry-blocks blocks) - :: - ^= take-args - :* wire=/scry-request/cx/~nul/desk/~1234.5.8/foo/bar duct=~[/first] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - :* %c %writ ~ [%x [%da ~1234.5.8] %desk] - /bar/foo %noun scry-type %eight - == - == - :: - ^= expected-moves - ^- (list move:ford-gate) - :~ :* duct=~[/first] %give %made ~1234.5.6 %complete %success - [%success %scry %noun scry-type %seven] - [%success %scry %noun scry-type %eight] - == == == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.9 - scry=scry-is-forbidden - :: - call-args=[duct=~[/first] type=~ %kill ~] - :: - moves=~ - == - :: - ;: weld - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-pinned-in-past ^- tang - :: - =/ schematic [%pin ~1234.5.5 [%$ %noun !>(42)]] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - call-args=[duct=~[/pin] type=~ %build live=%.n schematic] - :: - ^= expected-moves - :~ :* duct=~[/pin] %give %made ~1234.5.6 %complete - %success %$ %noun !>(42) - == == == - results1 -:: -++ test-pinned-in-future ^- tang - :: - =/ schematic [%pin ~1234.5.7 [%$ %noun !>(42)]] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - call-args=[duct=~[/pin] type=~ %build live=%.n schematic] - :: - ^= expected-moves - :~ :* duct=~[/pin] %give %made ~1234.5.6 %complete - %success %$ %noun !>(42) - == == == - results1 -:: -++ test-pinned-in-pin ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=(scry-succeed ~1234.5.6 [%noun !>(42)]) - :: - ^= call-args - :* duct=~[/pinned-in-pin] type=~ %build live=%.n - %pin ~1234.5.7 - %pin ~1234.5.6 - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/pinned-in-pin] - %give %made ~1234.5.8 %complete - [%success %scry %noun !>(42)] - == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-pinned-in-live ^- tang - :: - =/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)]) - =/ scry-43 (scry-succeed ~1234.5.7 [%noun !>(43)]) - :: - =/ schematic=schematic:ford-gate - :* %same %pin ~1234.5.6 - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - == - :: - =/ build=build:ford-gate [~1234.5.6 schematic] - =/ result=build-result:ford-gate - [%success [%scry %noun !>(42)]] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-42 - :: - call-args=[duct=~[/live] type=~ %build live=%.y schematic] - moves=[duct=~[/live] %give %made ~1234.5.6 %complete result]~ - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/live] type=~ %kill ~] - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-live-build-that-blocks ^- tang - :: - =/ scry-blocked (scry-block ~1234.5.6) - =/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)]) - =/ scry-43 (scry-succeed ~1234.5.8 [%noun !>(43)]) - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-blocked - :: - ^= call-args - :* duct=~[/live] type=~ %build live=%.y - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/live] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar - %c %warp ~nul %desk - ~ %sing %x [%da ~1234.5.6] /foo/bar - == == == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=scry-42 - :: - ^= take-args - :* wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar duct=~[/live] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %writ ~ [%x [%da ~1234.5.6] %desk] /bar/foo %noun !>(42)] - == - :: - ^= moves - :~ :* duct=~[/live] %give %made ~1234.5.6 %complete %success - [%scry %noun !>(42)] - == - :* duct=~[/live] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar]~)] - == == == - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.8 - scry=scry-43 - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/live] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.8] (sy [%x /foo/bar]~)] - == - :: - ^= moves - :~ :* duct=~[/live] %give %made ~1234.5.8 %complete %success - [%scry %noun !>(43)] - == - :* duct=~[/live] %pass wire=/clay-sub/~nul/desk/~1234.5.8 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.8] (sy [%x /foo/bar]~)] - == == == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.9 - scry=scry-is-forbidden - :: - call-args=[duct=~[/live] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/live] %pass wire=/clay-sub/~nul/desk/~1234.5.8 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-live-and-once ^- tang - :: - =/ scry-blocked (scry-block ~1234.5.6) - =/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)]) - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-blocked - :: - ^= call-args - :* duct=~[/live] type=~ %build live=%.y - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/live] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar - %c %warp ~nul %desk - ~ %sing %x [%da ~1234.5.6] /foo/bar - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-blocked - :: - ^= call-args - :* duct=~[/once] type=~ %build live=%.n - [%pin ~1234.5.6 [%scry %c ren=%x rail=[[~nul %desk] /bar/foo]]] - == - :: - moves=~ - == - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - ^= take-args - :* wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar duct=~[/live] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %writ ~ [%x [%da ~1234.5.6] %desk] /bar/foo %noun !>(42)] - == - :: - ^= moves - :~ :* duct=~[/live] %give %made ~1234.5.6 %complete - [%success [%scry %noun !>(42)]] - == - :* duct=~[/live] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar]~)] - == - :* duct=~[/once] %give %made ~1234.5.7 %complete - [%success [%scry %noun !>(42)]] - == == == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.9 - scry=scry-is-forbidden - :: - call-args=[duct=~[/live] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/live] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-live-two-deep ^- tang - :: - =/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)]) - =/ scry-43 (scry-succeed ~1234.5.7 [%noun !>(43)]) - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-42 - :: - ^= call-args - :* duct=~[/two-deep-4u] type=~ %build live=%.y - [%same [%scry %c care=%x rail=[[~nul %desk] /bar/foo]]] - == - :: - ^= moves - :~ :* duct=~[/two-deep-4u] %give %made ~1234.5.6 %complete - %success [%scry %noun !>(42)] - == - :* duct=~[/two-deep-4u] %pass - wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar]~)] - == == == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=scry-43 - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/two-deep-4u] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == - :: - ^= moves - :~ :* duct=~[/two-deep-4u] %give %made ~1234.5.7 %complete - %success [%scry %noun !>(43)] - == - :* duct=~[/two-deep-4u] %pass - wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == == == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/two-deep-4u] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/two-deep-4u] %pass - wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-live-three-deep ^- tang - :: - =/ scry-type=type [%atom %tas ~] - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /bar/foo]] - [%noun scry-type %it-doesnt-matter] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /bar/foo]] - [%noun scry-type %changed] - == - :: - =/ scry (scry-with-results scry-results) - :: - =/ formula=hoon (ream '`@tas`%constant') - =/ subject-schematic=schematic:ford-gate - [%scry %c %x [~nul %desk] /bar/foo] - :: - =/ ride=schematic:ford-gate [%ride formula subject-schematic] - =/ same=schematic:ford-gate [%same ride] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/ride] type=~ %build live=%.y same] - :: - ^= moves - :~ :* duct=~[/ride] %give %made ~1234.5.6 %complete - [%success [%ride scry-type %constant]] - == - :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/ride] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == - :: - ^= moves - :~ :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/ride] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-live-triangle ^- tang - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /bar/foo]] - [%noun !>(%it-does-in-fact-matter)] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /bar/foo]] - [%noun !>(%changed)] - == - :: - =/ scry (scry-with-results scry-results) - :: - =/ formula=hoon (ream '`@tas`%constant') - =/ subject-schematic=schematic:ford-gate - [%scry %c %x [~nul %desk] /bar/foo] - :: - =/ ride-type=type [%atom %tas ~] - =/ ride=schematic:ford-gate [%ride formula subject-schematic] - =/ autocons=schematic:ford-gate [ride subject-schematic] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/ride] type=~ %build live=%.y autocons] - :: - ^= moves - :~ :* duct=~[/ride] %give %made ~1234.5.6 %complete %success - [%success [%ride ride-type %constant]] - [%success [%scry %noun !>(%it-does-in-fact-matter)]] - == - :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/ride] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == - :: - ^= moves - :~ :* duct=~[/ride] %give %made ~1234.5.7 %complete %success - [%success [%ride ride-type %constant]] - [%success [%scry %noun !>(%changed)]] - == - :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/ride] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: like +test-live-triangle, but with another pinned build -:: -:: Ensures that we deal with various issues with live builds which -:: were partially pinned and their interaction with other live builds. -:: -++ test-live-and-pinned-triangle ^- tang - :: - =/ scry-type=type [%atom %tas ~] - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /bar/foo]] - [%noun scry-type %it-does-in-fact-matter] - :: - :- [%cx [[~nul %home %da ~1234.5.7] /bar/foo]] - [%noun scry-type %it-does-in-fact-matter] - == - :: - =/ scry (scry-with-results scry-results) - :: - =/ formula=hoon (ream '`@tas`%constant') - =/ subject-schematic=schematic:ford-gate [%scry %c %x [~nul %home] /bar/foo] - :: - =/ ride-type=type [%atom %tas ~] - =/ ride=schematic:ford-gate [%ride formula subject-schematic] - =/ autocons=schematic:ford-gate [ride subject-schematic] - :: - =/ static=schematic:ford-gate [%same [%pin ~1234.5.6 autocons]] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/static] type=~ %build live=%.y static] - :: - ^= moves - :~ :* duct=~[/static] %give %made ~1234.5.6 %complete %success - [%success [%ride ride-type %constant]] - [%success [%scry %noun scry-type %it-does-in-fact-matter]] - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry - :: - call-args=[duct=~[/autocons] type=~ %build live=%.y autocons] - :: - ^= moves - :~ :* duct=~[/autocons] %give %made ~1234.5.7 %complete %success - [%success [%ride ride-type %constant]] - [%success [%scry %noun scry-type %it-does-in-fact-matter]] - == - :* duct=~[/autocons] %pass wire=/clay-sub/~nul/home/~1234.5.7 - %c %warp ~nul %home - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/static] type=~ %kill ~] - :: - moves=~ - == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.9 - scry=scry-is-forbidden - :: - call-args=[duct=~[/autocons] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/autocons] %pass wire=/clay-sub/~nul/home/~1234.5.7 - %c %warp ~nul %home ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-call ^- tang - :: - =/ sample-schematic=schematic:ford-gate [%$ %noun !>(5)] - =/ gate-schematic=schematic:ford-gate [%$ %noun !>(|=(a=@ud +(a)))] - =/ call-schematic=schematic:ford-gate - [%call gate-schematic sample-schematic] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - call-args=[duct=~[/call] type=~ %build live=%.y call-schematic] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %success %call *] i.moves) - :: - =/ result=vase |7:i.moves - :: - (expect-eq !>(6) result) - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/call] type=~ %kill ~] - :: - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-call-scry-succeed ^- tang - :: - =/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)]) - :: - =/ sample-schematic=schematic:ford-gate [%$ %noun !>(24)] - =/ gate-schematic=schematic:ford-gate - [%$ %noun !>(|=(a=@ud .^(@ud %cx /~nul/desk/~1234.5.6/foo/bar)))] - =/ call-schematic=schematic:ford-gate - [%call gate-schematic sample-schematic] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-42 - :: - call-args=[duct=~[/call] type=~ %build live=%.y call-schematic] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - :: - ?> ?=([* %give %made @da %complete %success %call *] i.moves) - :: - =/ result=vase |7:i.moves - :: - (expect-eq !>(42) result) - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/call] type=~ %kill ~] - :: - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -++ test-call-scry-fail ^- tang - :: - =/ scry-failed (scry-fail ~1234.5.6) - :: - =/ sample-schematic=schematic:ford-gate [%$ %noun !>(24)] - =/ gate-schematic=schematic:ford-gate - [%$ %noun !>(|=(a=@ud .^(@ud %cx /~nul/desk/~1234.5.6/foo/bar)))] - =/ call-schematic=schematic:ford-gate - [%call gate-schematic sample-schematic] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-failed - :: - call-args=[duct=~[/dead] type=~ %build live=%.y call-schematic] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %error *] i.moves) - :: compare the move to the expected move, omitting check on stack trace - :: - %+ expect-eq - !> :* duct=~[/dead] %give %made ~1234.5.6 %complete - [%error [leaf+"ford: %call execution failed:" ~]] - == - !> i.moves(|7 ~) - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/dead] type=~ %kill ~] - :: - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -:: -++ test-call-scry-block ^- tang - :: - =/ scry-blocked (scry-block ~1234.5.6) - :: - =/ sample-schematic=schematic:ford-gate [%$ %noun !>(24)] - =/ gate-schematic=schematic:ford-gate - [%$ %noun !>(|=(a=@ud .^(@ud %cx /~nul/desk/~1234.5.6/foo/bar)))] - =/ call-schematic=schematic:ford-gate - [%call gate-schematic sample-schematic] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-blocked - :: - call-args=[duct=~[/live] type=~ %build live=%.y call-schematic] - :: - ^= moves - :~ :* duct=~[/live] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar - %c %warp ~nul %desk - ~ %sing %x [%da ~1234.5.6] /foo/bar - == == == - :: - =^ results2 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.7 - scry=scry-blocked - :: - ^= call-args - :* wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar duct=~ - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %writ ~ [%x [%da ~1234.5.6] %desk] /bar/foo %noun !>(42)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %success %call *] i.moves) - :: - =/ result |7:i.moves - :: - (expect-eq !>(42) result) - == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/live] type=~ %kill ~] - moves=~ - == - :: - ;: weld - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: +test-call-scry-varies: call with an argument which varies -:: -:: This test reads the sample for a %call schematic from clay. This sample -:: is a date. Inside of the gate called, we scry on a path based on the -:: passed in sample date. -:: -++ test-call-scry-varies ^- tang - :: - =/ date-type=type [%atom %da ~] - =/ term-type=type [%atom %tas ~] - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /timer]] - [%noun date-type ~1234.5.6] - :: - :- [%cx [[~nul %desk %da ~1234.5.6] /result]] - [%noun term-type %first] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /timer]] - [%noun date-type ~1234.5.7] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /result]] - [%noun term-type %second] - == - :: - =/ scry (scry-with-results scry-results) - :: - =/ sample-schematic=schematic:ford-gate - [%scry [%c care=%x bel=[[~nul %desk] /timer]]] - =/ gate-schematic=schematic:ford-gate - [%$ %noun !>(|=(a=@da .^(@tas %cx /~nul/desk/(scot %da a)/result)))] - =/ call-schematic=schematic:ford-gate - [%call gate-schematic sample-schematic] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry - :: - ^= call-args - [duct=~[/call] type=~ %build live=%.y call-schematic] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(2 (lent moves)) - ?> ?=([^ ^ ~] moves) - ?> ?=([* %give %made @da %complete %success %call *] i.moves) - :: - %+ weld - =/ result |7:i.moves - (expect-eq !>(%first) result) - :: make sure the other move is a subscription - :: - %+ expect-eq - !> :* duct=~[/call] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /timer] ~)] - == - !> i.t.moves - == - :: - =^ results2 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.7 - scry=scry - :: - ^= call-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/call] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /timer]~)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(2 (lent moves)) - ?> ?=([^ ^ ~] moves) - ?> ?=([* %give %made @da %complete %success %call *] i.moves) - :: - %+ weld - =/ result |7:i.moves - (expect-eq !>(%second) result) - :: make sure the other move is a subscription - :: - %+ expect-eq - !> :* duct=~[/call] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /timer] ~)] - == - !> i.t.moves - == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/call] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/call] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-dude ^- tang - :: - =/ schematic=schematic:ford-gate - :* %dude >%test-no-error< - [%scry [%c care=%x bel=[[~nul %desk] /bar/foo]]] - == - :: - =/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)]) - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-42 - :: - call-args=[duct=~[/once] type=~ %build live=%.n schematic] - :: - ^= moves - :~ :* duct=~[/once] %give %made ~1234.5.6 %complete %success - [%scry %noun !>(42)] - == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-dude-error ^- tang - :: - =/ schematic=schematic:ford-gate - :* %dude >%in-the-error-message< - [%scry [%c care=%x bel=[[~nul %desk] /bar/foo]]] - == - :: - =/ scry-42 (scry-fail ~1234.5.6) - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-42 - :: - call-args=[duct=~[/once] type=~ %build live=%.n schematic] - :: - ^= moves - :~ :* duct=~[/once] %give %made ~1234.5.6 %complete - %error - :~ leaf+"%in-the-error-message" - leaf+"scry failed for" - leaf+"%cx /~nul/desk/~1234.5.6/foo/bar" - == == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-hood ^- tang - :: - =/ scry-type=type [%atom %tas ~] - =/ scry - %- scry-with-results - ^- (map [term beam] cage) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /hoon/bar/foo]] - :* %noun scry-type - '!. |=(a=@ud +(a))' - == - == - :: - =/ schematic=schematic:ford-gate [%hood [[~nul %desk] /hoon/bar/foo]] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/hood] type=~ %build live=%.y schematic] - :: - ^= moves - :~ :* duct=~[/hood] %give %made ~1234.5.6 - %complete %success %hood - :* source-rail=[[~nul %desk] /hoon/bar/foo] - zuse-version=309 - structures=~ - libraries=~ - cranes=~ - ^= sources - :~ :* %dbug - [/~nul/desk/0/foo/bar/hoon [1 1] [1 19]] - (ream '|=(a=@ud +(a))') - == == == == - :* duct=~[/hood] %pass /clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar/hoon] ~)] - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/hood] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/hood] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-slim ^- tang - :: - =/ formula=hoon (ream '(add 2 2)') - =/ subject-type=type -:!>(.) - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - ^= call-args - [duct=~[/dead] type=~ %build live=%.y [%slim subject-type formula]] - :: - ^= moves - :~ :* duct=~[/dead] %give %made ~1234.5.6 %complete - [%success [%slim (~(mint ut subject-type) [%noun formula])]] - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/dead] type=~ %kill ~] - :: - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-slit ^- tang - :: - =/ gate=vase (ride %noun '|=(a=@ud ["one" a])') - =/ sample=vase !>(42) - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - call-args=[duct=~[/slit] type=~ %build live=%.y [%slit gate sample]] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %success %slit *] i.moves) - :: we are expecting a type, and all we can do is ensure it nests in - :: the right type - :: - =/ expected-type=type -:!>([*tape *@ud]) - =/ actual-type=type |7:i.moves - %+ expect-eq - !> & - !> (~(nest ut actual-type) | expected-type) - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/slit] type=~ %kill ~] - :: - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-slit-error ^- tang - :: - =/ gate=vase (ride %noun '|=(a=@ud ["one" a])') - =/ sample=vase !>("a tape instead of @ud") - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - call-args=[duct=~[/slit] type=~ %build live=%.y [%slit gate sample]] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %error *] i.moves) - :: ignore last message; contains source positions in the stack trace - :: - =/ messages=tang (scag 4 `tang`|6:i.moves) - :: - %+ expect-eq - !> :~ [%palm ["." "-" "" ""] [%leaf "have"] [%leaf "\"\""] ~] - :~ %palm ["." "-" "" ""] - [%leaf "want"] - [%palm ["/" "" "" ""] [%leaf "a"] [%leaf "@ud"] ~] - == - [%leaf "ford: %slit failed:"] - [%leaf "nest-fail"] - == - !> messages - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/slit] type=~ %kill ~] - :: - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-ride ^- tang - :: - =/ fun |=(a=@ (add 2 a)) - =/ formula=hoon (ream '!: (fun 3)') - =/ subject-schematic=schematic:ford-gate [%$ %noun !>(.)] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - ^= call-args - :* duct=~[/dead] type=~ %build live=%.y - [%ride formula subject-schematic] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %success %ride *] i.moves) - :: - =/ result |7:i.moves - (expect-eq !>(5) result) - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/dead] type=~ %kill ~] - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-ride-scry-succeed ^- tang - :: - =/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)]) - :: - =/ formula=hoon (ream '!: .^(* %cx /~nul/desk/~1234.5.6/foo/bar)') - =/ subject-schematic=schematic:ford-gate [%$ %noun !>(.)] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-42 - :: - ^= call-args - :* duct=~[/dead] type=~ %build live=%.y - [%ride formula subject-schematic] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %success %ride *] i.moves) - :: - =/ result |7:i.moves - (expect-eq !>(42) result) - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/dead] type=~ %kill ~] - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-ride-scry-fail ^- tang - :: - =/ scry-failed (scry-fail ~1234.5.6) - :: - =/ formula=hoon (ream '!: .^(* %cx /~nul/desk/~1234.5.6/foo/bar)') - =/ subject-schematic=schematic:ford-gate [%$ %noun !>(.)] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-failed - :: - ^= call-args - :* duct=~[/dead] type=~ %build live=%.y - [%ride formula subject-schematic] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %error *] i.moves) - :: compare the move to the expected move, omitting check on stack trace - :: - %+ expect-eq - !> :* duct=~[/dead] %give %made ~1234.5.6 %complete - [%error [leaf+"ford: %ride failed to execute:" ~]] - == - !> i.moves(|7 ~) - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: - call-args=[duct=~[/dead] type=~ %kill ~] - moves=~ - == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-ride-scry-block ^- tang - :: - =/ scry-blocked (scry-block ~1234.5.6) - :: - =/ formula=hoon (ream '!: .^(* %cx /~nul/desk/~1234.5.6/foo/bar)') - =/ subject-schematic=schematic:ford-gate [%$ %noun !>(.)] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-blocked - :: - ^= call-args - :* duct=~[/live] type=~ %build live=%.y - [%ride formula subject-schematic] - == - :: - ^= moves - :~ :* duct=~[/live] %pass - wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar - %c %warp ~nul %desk - ~ %sing %x [%da ~1234.5.6] /foo/bar - == == == - :: - =^ results2 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.7 - :: TODO: using +scry-is-forbidden causes a bail: 4 - :: - scry=scry-blocked - :: - ^= take-args - :* wire=/scry-request/cx/~nul/desk/~1234.5.6/foo/bar duct=~[/live] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %writ ~ [%x [%da ~1234.5.6] %desk] /bar/foo %noun !>(42)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete %success %ride *] i.moves) - :: - =/ result |7:i.moves - (expect-eq !>(42) result) - == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/live] type=~ %kill ~] - moves=~ - == - :: - ;: weld - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-ride-scry-promote ^- tang - :: - =/ scry-type=type [%atom %tas ~] - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /bar/foo]] - [%noun scry-type %it-doesnt-matter] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /bar/foo]] - [%noun scry-type %changed] - == - :: - =/ scry (scry-with-results scry-results) - :: - =/ formula=hoon (ream '`@tas`%constant') - =/ subject-schematic=schematic:ford-gate [%scry %c %x [~nul %desk] /bar/foo] - :: - =/ ride=schematic:ford-gate [%ride formula subject-schematic] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/ride] type=~ %build live=%.y ride] - :: - ^= moves - :~ :* duct=~[/ride] %give %made ~1234.5.6 %complete - [%success [%ride scry-type %constant]] - == - :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/ride] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == - :: - ^= moves - :~ :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/ride] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-five-oh-fora ^- tang - :: - =/ scry-type=type - [%cell [%face %title [%atom %t ~]] [%face %contents -:!>("")]] - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /a/posts]] - [%noun scry-type [title='post-a' contents="post-a-contents"]] - :: - :- [%cx [[~nul %desk %da ~1234.5.6] /b/posts]] - [%noun scry-type [title='post-b' contents="post-b-contents"]] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /a/posts]] - [%noun scry-type [title='post-a' contents="post-a-contents"]] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /b/posts]] - [%noun scry-type [title='post-b' contents="post-b-contents"]] - :: - :- [%cx [[~nul %desk %da ~1234.5.8] /a/posts]] - [%noun scry-type [title='post-a' contents="post-a-contents-changed"]] - == - :: - =/ scry (scry-with-results scry-results) - :: - =/ post-a=schematic:ford-gate [%scry [%c %x [~nul %desk] /a/posts]] - =/ title-a=schematic:ford-gate [%ride (ream '!: title') post-a] - :: - =/ post-b=schematic:ford-gate [%scry [%c %x [~nul %desk] /b/posts]] - =/ title-b=schematic:ford-gate [%ride (ream '!: title') post-b] - :: - =/ sidebar=schematic:ford-gate [title-a title-b] - :: - =/ rendered-a=schematic:ford-gate [post-a sidebar] - =/ rendered-b=schematic:ford-gate [post-b sidebar] - :: first, ask ford to build rendered-a - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/post-a] type=~ %build live=%.y rendered-a] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> ?=([^ ^ ~] moves) - %+ welp - %- verify-post-made :* - move=i.moves - duct=~[/post-a] - type=scry-type - date=~1234.5.6 - title='post-a' - contents="post-a-contents" - == - %+ expect-eq - !> :* duct=~[/post-a] %pass - wire=/clay-sub/~nul/desk/~1234.5.6 %c %warp - ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /posts/a] [%x /posts/b] ~)] - == - !> i.t.moves - == - :: - =^ results2 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.7 - scry=scry - :: - call-args=[duct=~[/post-b] type=~ %build live=%.y rendered-b] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> ?=([^ ^ ~] moves) - %+ welp - %- verify-post-made :* - move=i.moves - duct=~[/post-b] - type=scry-type - date=~1234.5.7 - title='post-b' - contents="post-b-contents" - == - %+ expect-eq - !> :* duct=~[/post-b] %pass - wire=/clay-sub/~nul/desk/~1234.5.7 %c %warp - ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /posts/a] [%x /posts/b] ~)] - == - !> i.t.moves - == - :: - =^ results3 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.8 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/post-a] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.8] (sy [%x /posts/a]~)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> ?=([^ ^ ~] moves) - %+ welp - %- verify-post-made :* - move=i.moves - duct=~[/post-a] - type=scry-type - date=~1234.5.8 - title='post-a' - contents="post-a-contents-changed" - == - %+ expect-eq - !> :* duct=~[/post-a] %pass - wire=/clay-sub/~nul/desk/~1234.5.8 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.8] (sy [%x /posts/a] [%x /posts/b] ~)] - == - !> i.t.moves - == - :: - =^ results4 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.9 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.7 duct=~[/post-b] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.8] (sy [%x /posts/a]~)] - == - :: - moves=~ - == - :: - =^ results5 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.10 - scry=scry-is-forbidden - :: - call-args=[duct=~[/post-a] type=~ %kill ~] - :: - moves=~ - == - :: - =^ results6 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.11 - scry=scry-is-forbidden - :: - call-args=[duct=~[/post-b] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/post-a] %pass wire=/clay-sub/~nul/desk/~1234.5.8 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - results5 - results6 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-alts ^- tang - :: - =/ scry-type=type [%atom %tas ~] - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /one/scry]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /two/scry]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.7] /one/scry]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.7] /two/scry]] - `[%noun scry-type 'scry-two'] - :: - :- [%cx [[~nul %home %da ~1234.5.8] /one/scry]] - `[%noun scry-type 'scry-one'] - == - :: - =/ scry (scry-with-results-and-failures scry-results) - :: - =/ scry1=schematic:ford-gate [%scry [%c %x [~nul %home] /one/scry]] - =/ scry2=schematic:ford-gate [%scry [%c %x [~nul %home] /two/scry]] - =/ alts=schematic:ford-gate [%alts [scry1 scry2 ~]] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/alts] type=~ %build live=%.y alts] - :: - ^= moves - :~ :* duct=~[/alts] %give %made ~1234.5.6 %complete %error - :~ [%leaf "%alts: all options failed"] - [%leaf "option"] - :+ %rose [" " "\{" "}"] :~ - [%leaf "scry failed for"] - [%leaf "%cx /~nul/home/~1234.5.6/scry/one"] - == - [%leaf "option"] - :+ %rose [" " "\{" "}"] :~ - [%leaf "scry failed for"] - [%leaf "%cx /~nul/home/~1234.5.6/scry/two"] - == - == == - :* duct=~[/alts] %pass wire=/clay-sub/~nul/home/~1234.5.6 - %c %warp ~nul %home - `[%mult [%da ~1234.5.6] (sy [%x /scry/two] [%x /scry/one] ~)] - == == == - :: - =^ results2 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/home/~1234.5.6 duct=~[/alts] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /scry/two]~)] - == - :: - ^= moves - :~ :* duct=~[/alts] %give %made ~1234.5.7 %complete - %success %alts %success %scry %noun scry-type 'scry-two' - == - :* duct=~[/alts] %pass wire=/clay-sub/~nul/home/~1234.5.7 - %c %warp ~nul %home - `[%mult [%da ~1234.5.7] (sy [%x /scry/two] [%x /scry/one] ~)] - == == == - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.8 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/home/~1234.5.6 duct=~[/alts] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.8] (sy [%x /scry/one]~)] - == - :: - ^= moves - :~ :* duct=~[/alts] %give %made ~1234.5.8 %complete - %success %alts %success %scry %noun scry-type 'scry-one' - == - :* duct=~[/alts] %pass wire=/clay-sub/~nul/home/~1234.5.8 - %c %warp ~nul %home - `[%mult [%da ~1234.5.8] (sy [%x /scry/one] ~)] - == == == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.9 - scry=scry-is-forbidden - :: - call-args=[duct=~[/alts] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/alts] %pass wire=/clay-sub/~nul/home/~1234.5.8 - %c %warp ~nul %home ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-alts-and-live ^- tang - :: - =/ scry-type=type [%atom %tas ~] - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /one/scry]] - ~ - :: - :- [%cx [[~nul %desk %da ~1234.5.6] /two/scry]] - `[%noun scry-type 'scry-two'] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /one/scry]] - ~ - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /two/scry]] - `[%noun scry-type 'scry-two'] - :: - :- [%cx [[~nul %desk %da ~1234.5.8] /one/scry]] - `[%noun scry-type 'scry-one'] - == - :: - =/ scry (scry-with-results-and-failures scry-results) - :: - =/ scry2=schematic:ford-gate [%scry [%c %x [~nul %desk] /two/scry]] - =/ same=schematic:ford-gate [%same scry2] - :: depend on scry2 for the duration of the test - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/same] type=~ %build live=%.y same] - :: - ^= moves - :~ :* duct=~[/same] %give %made ~1234.5.6 %complete - %success %scry %noun scry-type 'scry-two' - == - :* duct=~[/same] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /scry/two] ~)] - == == == - :: - =/ scry1=schematic:ford-gate [%scry [%c %x [~nul %desk] /one/scry]] - =/ alts=schematic:ford-gate [%alts [scry1 scry2 ~]] - :: call the alts schematic - :: - :: The alts schematic should fail to read /scry/one, and should fallback - :: to /scry/two. - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry - :: - call-args=[duct=~[/alts] type=~ %build live=%.y alts] - :: - ^= moves - :~ :* duct=~[/alts] %give %made ~1234.5.7 %complete - %success %alts %success %scry %noun scry-type 'scry-two' - == - :* duct=~[/alts] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /scry/two] [%x /scry/one] ~)] - == == == - :: - :: tell ford that /scry/one exists now - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.8 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.7 duct=~[/alts] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.8] (sy [%x /scry/one]~)] - == - :: - ^= moves - :~ :* duct=~[/alts] %give %made ~1234.5.8 %complete - %success %alts %success %scry %noun scry-type 'scry-one' - == - :: we subscribe to both paths because /same still exists. - :: - :* duct=~[/alts] %pass wire=/clay-sub/~nul/desk/~1234.5.8 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.8] (sy [%x /scry/one] ~)] - == == == - :: - :: kill the /same build - :: - :: We should no longer subscribe to /scry/two in the resulting clay - :: subscription. - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.9 - scry=scry - :: - call-args=[duct=~[/same] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/same] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk ~ - == == == - :: - =^ results5 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.10 - scry=scry - :: - call-args=[duct=~[/alts] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/alts] %pass wire=/clay-sub/~nul/desk/~1234.5.8 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - results5 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-double-alts ^- tang - :: - =/ scry-type=type [%atom %tas ~] - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /one/scry]] - ~ - :- [%cx [[~nul %desk %da ~1234.5.6] /two/scry]] - `[%noun scry-type 'scry-two'] - :- [%cx [[~nul %desk %da ~1234.5.6] /three/scry]] - ~ - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /one/scry]] - ~ - :- [%cx [[~nul %desk %da ~1234.5.7] /two/scry]] - `[%noun scry-type 'scry-two'] - :- [%cx [[~nul %desk %da ~1234.5.7] /three/scry]] - ~ - :: - :- [%cx [[~nul %desk %da ~1234.5.8] /one/scry]] - ~ - :- [%cx [[~nul %desk %da ~1234.5.8] /two/scry]] - `[%noun scry-type 'scry-two'] - :- [%cx [[~nul %desk %da ~1234.5.8] /three/scry]] - `[%noun scry-type 'scry-three'] - :: - :- [%cx [[~nul %desk %da ~1234.5.9] /one/scry]] - `[%noun scry-type 'scry-one'] - :- [%cx [[~nul %desk %da ~1234.5.9] /two/scry]] - `[%noun scry-type 'scry-two-changed'] - :- [%cx [[~nul %desk %da ~1234.5.9] /three/scry]] - `[%noun scry-type 'scry-three'] - == - :: - =/ scry (scry-with-results-and-failures scry-results) - :: - =/ scry1=schematic:ford-gate [%scry [%c %x [~nul %desk] /one/scry]] - =/ scry2=schematic:ford-gate [%scry [%c %x [~nul %desk] /two/scry]] - =/ scry3=schematic:ford-gate [%scry [%c %x [~nul %desk] /three/scry]] - =/ alts1=schematic:ford-gate [%alts [scry1 scry2 ~]] - =/ alts2=schematic:ford-gate [%alts [scry3 scry2 ~]] - :: alts1 will depend on both scry1 and scry2 - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/first] type=~ %build live=%.y alts1] - :: - ^= moves - :~ :* duct=~[/first] %give %made ~1234.5.6 %complete - %success %alts %success %scry %noun scry-type 'scry-two' - == - :* duct=~[/first] %pass wire=/clay-sub/~nul/desk/~1234.5.6 - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /scry/one] [%x /scry/two] ~)] - == == == - :: alts2 will depend on both scry3 and scry2 - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry - :: - call-args=[duct=~[/second] type=~ %build live=%.y alts2] - :: - ^= moves - :~ :* duct=~[/second] %give %made ~1234.5.7 %complete - %success %alts %success %scry %noun scry-type 'scry-two' - == - :* duct=~[/second] %pass wire=/clay-sub/~nul/desk/~1234.5.7 - %c %warp ~nul %desk ~ %mult [%da ~1234.5.7] - (sy [%x /scry/two] [%x /scry/three] ~) - == == == - :: - :: alts2 should now just return 'scry-three' - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.8 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.7 duct=~[/second] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.8] (sy [%x /scry/three]~)] - == - :: - ^= moves - :~ :* duct=~[/second] %give %made ~1234.5.8 %complete - %success %alts %success %scry %noun scry-type 'scry-three' - == - :* duct=~[/second] %pass wire=/clay-sub/~nul/desk/~1234.5.8 - %c %warp ~nul %desk ~ %mult [%da ~1234.5.8] - (sy [%x /scry/three] ~) - == == == - :: - =^ results4 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.9 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk/~1234.5.6 duct=~[/first] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.9] (sy [%x /scry/one] [%x /scry/two] ~)] - == - :: - ^= moves - :~ :* duct=~[/first] %give %made ~1234.5.9 %complete - %success %alts %success %scry %noun scry-type 'scry-one' - == - :* duct=~[/first] %pass wire=/clay-sub/~nul/desk/~1234.5.9 - %c %warp ~nul %desk ~ %mult [%da ~1234.5.9] - (sy [%x /scry/one] ~) - == == == - :: - =^ results5 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.10 - scry=scry - :: - call-args=[duct=~[/first] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/first] %pass wire=/clay-sub/~nul/desk/~1234.5.9 - %c %warp ~nul %desk ~ - == == == - :: - =^ results6 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.11 - scry=scry - :: - call-args=[duct=~[/second] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/second] %pass wire=/clay-sub/~nul/desk/~1234.5.8 - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - results5 - results6 - (expect-ford-empty ford-gate ~nul) - == -:: +test-cache-reclamation-trivial: reclaim cache on a blank slate ford -:: -++ disabled-test-cache-reclamation-trivial - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: send a pinned literal, expects a %made response with pinned literal - :: - ^= call-args - [duct=~[/trivial] type=~ %build live=%.n [%$ %noun !>(**)]] - :: - ^= moves - :~ :* duct=~[/trivial] %give %made ~1234.5.6 - %complete %success %$ %noun !>(**) - == == - == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: ask ford to wipe its cache - :: - call-args=[duct=~[/trivial] type=~ %wipe 10] - :: cache wiping should never produce any moves - :: - moves=~ - == - :: - ;: welp - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ disabled-test-cache-reclamation-live-rebuild - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-succeed ~1234.5.6 [%noun !>(42)]) - :: - ^= call-args - :* duct=~[/build] type=~ %build live=%.y - [%scry %c care=%x rail=[[~nul %desk] /bar/foo]] - == - :: - ^= moves - :~ :* duct=~[/build] %give %made ~1234.5.6 %complete %success - [%scry %noun !>(42)] - == - :* duct=~[/build] %pass wire=/clay-sub/~nul/desk - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar]~)] - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: ask ford to wipe its cache - :: - call-args=[duct=~[/build] type=~ %wipe 10] - :: cache wiping should never produce any moves - :: - moves=~ - == - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=(scry-succeed ~1234.5.7 [%noun !>(43)]) - :: - ^= take-args - :* wire=/clay-sub/~nul/desk duct=~[/build] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == - :: - ^= moves - :~ :* duct=~[/build] %give %made ~1234.5.7 %complete %success - [%scry %noun !>(43)] - == - :* duct=~[/build] %pass wire=/clay-sub/~nul/desk - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == == == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/build] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/build] %pass wire=/clay-sub/~nul/desk - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: -++ disabled-test-cache-reclamation-live-promote - :: - =/ scry-type=type [%atom %tas ~] - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /bar/foo]] - [%noun scry-type %it-doesnt-matter] - :: - :- [%cx [[~nul %desk %da ~1234.5.7] /bar/foo]] - [%noun scry-type %changed] - == - :: - =/ scry (scry-with-results scry-results) - :: - =/ formula=hoon (ream '`@tas`%constant') - =/ subject-schematic=schematic:ford-gate - [%scry %c %x [~nul %desk] /bar/foo] - :: - =/ ride=schematic:ford-gate [%ride formula subject-schematic] - =/ same=schematic:ford-gate [%same ride] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/ride] type=~ %build live=%.y same] - :: - ^= moves - :~ :* duct=~[/ride] %give %made ~1234.5.6 %complete - [%success [%ride scry-type %constant]] - == - :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.7 - scry=scry-is-forbidden - :: ask ford to wipe its cache - :: - call-args=[duct=~[/ride] type=~ %wipe 10] - :: cache wiping should never produce any moves - :: - moves=~ - == - :: - =^ results3 ford-gate - %- ford-take :* - ford-gate - now=~1234.5.7 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk duct=~[/ride] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%x /foo/bar]~)] - == - :: - ^= moves - :~ :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk - %c %warp ~nul %desk - `[%mult [%da ~1234.5.7] (sy [%x /foo/bar] ~)] - == == == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/ride] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/ride] %pass wire=/clay-sub/~nul/desk - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: tests that doing a cache reclamation during the five-oh-fora rebuild works -:: -++ disabled-test-five-oh-cache-reclamation ^- tang - :: - =/ scry-type=type - [%cell [%face %title [%atom %t ~]] [%face %contents -:!>("")]] - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /a/posts]] - [%noun scry-type [title='post-a' contents="post-a-contents"]] - :: - :- [%cx [[~nul %desk %da ~1234.5.6] /b/posts]] - [%noun scry-type [title='post-b' contents="post-b-contents"]] - :: - :- [%cx [[~nul %desk %da ~1234.5.9] /a/posts]] - [%noun scry-type [title='post-a' contents="post-a-contents-changed"]] - :: - :: unchanged, but might be requested if cache entry gets wiped - :: - :- [%cx [[~nul %desk %da ~1234.5.9] /b/posts]] - [%noun scry-type [title='post-b' contents="post-b-contents"]] - == - :: - =/ scry (scry-with-results scry-results) - :: - =/ post-a=schematic:ford-gate [%scry [%c %x [~nul %desk] /a/posts]] - =/ title-a=schematic:ford-gate [%ride (ream '!: title') post-a] - :: - =/ post-b=schematic:ford-gate [%scry [%c %x [~nul %desk] /b/posts]] - =/ title-b=schematic:ford-gate [%ride (ream '!: title') post-b] - :: - =/ sidebar=schematic:ford-gate [title-a title-b] - :: - =/ rendered-a=schematic:ford-gate [post-a sidebar] - =/ rendered-b=schematic:ford-gate [post-b sidebar] - :: first, ask ford to build rendered-a - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry - :: - call-args=[duct=~[/post-a] type=~ %build live=%.y rendered-a] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> ?=([^ ^ ~] moves) - %+ welp - %- verify-post-made :* - move=i.moves - duct=~[/post-a] - type=scry-type - date=~1234.5.6 - title='post-a' - contents="post-a-contents" - == - %+ expect-eq - !> :* duct=~[/post-a] %pass wire=/clay-sub/~nul/desk - %c %warp ~nul %desk - `[%mult [%da ~1234.5.6] (sy [%x /posts/a] [%x /posts/b] ~)] - == - !> i.t.moves - == - :: - =^ results2 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.7 - scry=scry - :: - call-args=[duct=~[/post-b] type=~ %build live=%.y rendered-b] - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> ?=([^ ~] moves) - %- verify-post-made :* - move=i.moves - duct=~[/post-b] - type=scry-type - date=~1234.5.7 - title='post-b' - contents="post-b-contents" - == == - :: - =^ results3 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/wipe] type=~ %wipe 10] - moves=~ - == - :: - =^ results4 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.9 - scry=scry - :: - ^= take-args - :* wire=/clay-sub/~nul/desk duct=~[/post-a] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.9] (sy [%x /posts/a]~)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - =+ length=(lent moves) - :: deal with mug ordering - :: - :: This test depends on the mugs of types stored in ford, which is - :: dependent on the parse tree of this file. There are two valid - :: responses, one where we send a spurious move about %post-b - :: because it was the entry which was evicted from the cache and one - :: where we don't because it wasn't. Check both cases. - :: - ?: =(length 2) - :: the simple case where we don't send a spurious post-b %made - :: - ?> ?=([^ ^ ~] moves) - :: - %- verify-post-made :* - move=i.moves - duct=~[/post-a] - type=scry-type - date=~1234.5.9 - title='post-a' - contents="post-a-contents-changed" - == - :: the complex case - :: - :: Not only do we send a spurious %made, we don't have a set order - :: that these events happen in, so check both ways. - :: - ?> ?=([^ ^ ^ ~] moves) - :: - =/ post-a-first=tang - %+ welp - %- verify-post-made :* - move=i.moves - duct=~[/post-a] - type=scry-type - date=~1234.5.9 - title='post-a' - contents="post-a-contents-changed" - == - %- verify-post-made :* - move=i.t.moves - duct=~[/post-b] - type=scry-type - date=~1234.5.9 - title='post-b' - contents="post-b-contents" - == - :: if we got a ~ for post-a-first, everything is fine - :: - ?~ post-a-first - ~ - :: otherwise, its either post-b first or an error. - :: - :: Either way, return post-b first check. - :: - %+ welp - %- verify-post-made :* - move=i.moves - duct=~[/post-b] - type=scry-type - date=~1234.5.9 - title='post-b' - contents="post-b" - == - :: - %- verify-post-made :* - move=i.t.moves - duct=~[/post-a] - type=scry-type - date=~1234.5.9 - title='post-a' - contents="post-a-contents-changed" - == == - :: - =^ results5 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.10 - scry=scry-is-forbidden - :: - call-args=[duct=~[/post-b] type=~ %kill ~] - moves=~ - == - :: - =^ results6 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.11 - scry=scry-is-forbidden - :: - call-args=[duct=~[/post-a] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/post-a] %pass wire=/clay-sub/~nul/desk - %c %warp ~nul %desk ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - results5 - results6 - (expect-ford-empty ford-gate ~nul) - == -:: -++ disabled-test-reef-slow - :: - =/ hoon-parsed=hoon - (rain /~nul/base/~1234.5.6/sys/hoon/hoon hoon-scry) - ~& %parsed-hoon - :: - =/ arvo-parsed=hoon - (rain /~nul/base/~1234.5.6/sys/arvo/hoon arvo-scry) - ~& %parsed-arvo - :: - =/ zuse-parsed=hoon - (rain /~nul/base/~1234.5.6/sys/zuse/hoon zuse-scry) - ~& %parsed-zuse - :: - =/ pit=vase !>(~) - =/ hoon-compiled=vase (slap pit hoon-parsed) - ~& %hoon-compiled - =/ arvo-compiled=vase (slap (slot 7 hoon-compiled) arvo-parsed) - ~& %arvo-compiled - =/ pit-compiled=vase (slap arvo-compiled [%cnts ~[[%& 1] %is] ~]) - ~& %pit-compiled - =/ zuse-compiled=vase (slap pit-compiled zuse-parsed) - ~& %zuse-compiled - :: - =/ scry-results=(map [term beam] cage) (with-reef ~1234.5.6 ~) - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/reef] type=~ %build live=%.n - [%reef [~nul %base]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made *] i.moves) - =/ result result.p.card.i.moves - ?> ?=(%complete -.result) - ?> ?=([%success %reef *] +.result) - :: - =/ kernel=vase vase.build-result.result - :: - %+ weld - =/ result - q:(slym (slap (slap kernel [%limb %format]) [%limb %en-beam]) *beam) - %+ expect-eq - !> (en-beam *beam) - !> result - :: - %+ expect-eq - !> & - !> (slab %format p.kernel) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-reef-short-circuit ^- tang - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-reef ~1234.5.6) - :: - ^= call-args - :* duct=~[/reef] type=~ %build live=%.n - [%reef [~nul %home]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made *] i.moves) - =/ result result.p.card.i.moves - ?> ?=(%complete -.result) - ?> ?=([%success %reef *] +.result) - :: - =/ kernel=vase vase.build-result.result - :: - %+ weld - =/ result - q:(slym (slap (slap kernel [%limb %format]) [%limb %en-beam]) *beam) - %+ expect-eq - !> (en-beam *beam) - !> result - :: - %+ expect-eq - !> & - !> (slab %format p.kernel) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-path ^- tang - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %desk %da ~1234.5.6] /hoon/bar/foo/lib]] - `[%hoon !>(*hoon)] - :: - :- [%cx [[~nul %desk %da ~1234.5.6] /hoon/foo-bar/lib]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%path disc=[~nul %desk] prefix='lib' raw-path='foo-bar'] - == - :: - ^= moves - :~ :* duct=~[/path] %give %made ~1234.5.6 %complete - %success %path [[~nul %desk] /hoon/bar/foo/lib] - == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-plan-hoon ^- tang - :: - =/ =hoon (ream '`@tas`%constant') - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - ^= call-args - :* duct=~[/plan] type=~ %build live=%.n - %plan - source-path=[[~nul %home] /bar/foo] - query-string=`coin`[%$ *dime] - source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - cranes=~ - sources=[hoon]~ - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made *] i.moves) - =/ result result.p.card.i.moves - ?> ?=(%complete -.result) - ?> ?=([%success %plan *] +.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>(%constant) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core ^- tang - :: - =/ hoon-src '`@tas`%constant' - =/ hoon-src-type=type [%atom %$ ~] - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo-bar/lib]] - [%hoon hoon-src-type hoon-src] - == - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/foo-bar/lib]] - == - :: - ^= moves - :~ :* duct=~[/path] %give %made ~1234.5.6 %complete - %success %core [%atom %tas ~] %constant - == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-linker ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/data/sur]] - :- %hoon - :- hoon-src-type - ''' - |% - += data-type - [msg=tape count=@ud] - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/data/lib]] - :- %hoon - :- hoon-src-type - ''' - /- data - |% - ++ do - |= [a=data-type:data b=data-type:data] - ^- data-type:data - [(weld msg.a msg.b) (add count.a count.b)] - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /- *data - /+ combiner=data - (do:combiner `data-type`["one" 1] `data-type`["two" 2]) - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>(["onetwo" 3]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-multi-hoon ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - |% - += data-type - [msg=tape count=@ud] - -- - |% - ++ data - ^- data-type - ["one" 1] - -- - data - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>(["one" 1]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fsts-fssg ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= one /~ `@u`1 - /= two /~ `@u`2 - (add one two) - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>(3) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fsdt-fskt ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /^ (list @ud) - /. /~ 1 - /~ 2 - /~ 3 - == - (weld data [4 5 ~]) - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>([1 2 3 4 5 ~]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fskt-nest-fail ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /^ (list @u) - /~ 5 - data - ''' - == - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= moves - :~ :* duct=~[/path] %give %made ~1234.5.6 %complete %error - :~ :- %leaf - "ford: %core on /~nul/home/0/gen/program/hoon failed:" - [%leaf "/^ failed: nest-fail"] - == == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fssm ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /; |=(a=@u [a a ~]) - /~ 5 - data - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>([5 5 ~]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fsbr ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /| /^ (list @u) - /~ 5 - :: - /^ (list @u) - /~ [6 6 ~] - == - data - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>([6 6 ~]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fsbr-out-of-options ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /| /^ (list @u) - /~ 5 - :: - /^ @u - /~ [6 6 ~] - == - data - ''' - == - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= moves - :~ :* duct=~[/path] %give %made ~1234.5.6 %complete %error - :~ :- %leaf - "ford: %core on /~nul/home/0/gen/program/hoon failed:" - [%leaf "/| failed: out of options"] - == == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-plan-fszp-as-noun ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /!noun/ - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/other/lib]] - :- %hoon - :- hoon-src-type - ''' - [1 2 3 ~] - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - :* %plan [[~nul %home] /other/lib] *coin - :* source-rail=[[~nul %desk] /bar/foo] - zuse-version=309 - structures=~ - libraries=~ - cranes=[%fsts %data [%fszp %noun]]~ - sources=[%wing [%data]~]~ - == == == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %plan *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>([1 2 3 ~]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fszp-as-mark ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /: /===/lib/other - /!somemark/ - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/somemark/mar]] - :- %hoon - :- hoon-src-type - ''' - |_ [word=tape num=@] - ++ grab - |% - += noun [tape @] - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/other/lib]] - :- %hoon - :- hoon-src-type - ''' - ["five" 5] - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - %core [[~nul %home] /hoon/program/gen] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>(["five" 5]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fscl-fszp ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /: /===/data - /!noun/ - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/data]] - :- %hoon - :- hoon-src-type - ''' - [1 2 3 ~] - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>([1 2 3 ~]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fscm ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /: /===/data - /!noun/ - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/data]] - :- %hoon - :- hoon-src-type - ''' - /, /other - /~ a=[3 2 1 ~] - :: - /data - /~ a=[1 2 3 ~] - == - a - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>([1 2 3 ~]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-plan-fsbc ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/other/lib]] - :- %hoon - :- hoon-src-type - ''' - /= data /$ %+ cork fuel:html - |= gas/epic:eyre - [bem.gas (~(got by qix.gas) 'key')] - data - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - :* %plan [[~nul %home] /other/lib] - :~ %many - [%blob *cred:eyre] - [%$ [%t %key]] - [%$ [%t %value]] - [%$ %n ~] - == - :* source-rail=[[~nul %home] /hoon/other/lib] - zuse-version=309 - structures=~ - libraries=~ - cranes=[%fsts %data [%fszp %noun]]~ - sources=`(list hoon)`[[%wing [%data]~] ~] - == == == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %plan *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - %+ expect-eq - !>([[[~nul %home [%da ~1234.5.6]] /other/lib] %value]) - vase - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fscb ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /^ (map @ta @ud) - /: /===/data - /_ /!noun/ - data - ''' - :: - :- [%cy [[~nul %home %da ~1234.5.6] /data]] - :- %arch - :- arch-type - :- ~ - (my ~[[~.one ~] [~.two ~] [~.hoon ~]]) - :: - :- [%cy [[~nul %home %da ~1234.5.6] /one/data]] - :- %arch - :- arch-type - :- ~ - (my ~[[~.hoon ~]]) - :: - :- [%cy [[~nul %home %da ~1234.5.6] /two/data]] - :- %arch - :- arch-type - :- ~ - (my ~[[~.hoon ~]]) - :: - :: this "hoon" file should be filtered out - :: - :- [%cy [[~nul %home %da ~1234.5.6] /hoon/data]] - :- %arch - :- arch-type - :- fil=[~ u=0v6] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/one/data]] - :- %hoon - :- hoon-src-type - ''' - 1 - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/two/data]] - :- %hoon - :- hoon-src-type - ''' - 2 - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/gen]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - =/ expected (my [[%one 1] [%two 2] ~]) - (expect-eq !>(expected) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fspm ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /= data /&second&first&/~["four" 5 "six"] - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/first/mar]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - |_ [word=tape num=@] - ++ grab - |% - ++ noun |=([a=tape b=@ c=tape] [a b]) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/second/mar]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - |_ num=@ - ++ grab - |% - ++ first |=([a=tape b=@] b) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/noun/mar]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - %core [[~nul %home] /hoon/program/gen] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - (expect-eq !>(5) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-core-fszy-renderer ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/gen]] - :- %hoon - :- hoon-src-type - ''' - /= data /: /===/data - /foo/ - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/ren]] - :- %hoon - :- hoon-src-type - ''' - /= data /!noun/ - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/data]] - :- %hoon - :- hoon-src-type - ''' - [1 2 3 ~] - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - %core [[~nul %home] /hoon/program/gen] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - (expect-eq !>([1 2 3 ~]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-bunt ^- tang - :: - =/ hoon-src=@ta - ''' - |_ cell=^ - ++ grab - |% - ++ noun ^ - -- - -- - ''' - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - [%hoon !>(hoon-src)] - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%bunt [~nul %home] %foo] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %bunt *] build-result.result) - :: - =/ =vase q.cage.build-result.result - :: - (expect-eq !>([0 0]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-volt ^- tang - :: - =/ hoon-src=@ta - ''' - |_ cell=^ - ++ grab - |% - ++ noun ^ - -- - -- - ''' - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - [%hoon !>(hoon-src)] - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%volt [~nul %home] %foo [12 13]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %volt *] build-result.result) - :: - =/ =vase q.cage.build-result.result - :: - (expect-eq !>([12 13]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-vale ^- tang - :: - =/ hoon-src=@ta - ''' - |_ cell=^ - ++ grab - |% - ++ noun ^ - -- - -- - ''' - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - [%hoon !>(hoon-src)] - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%vale [~nul %home] %foo [12 13]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %vale *] build-result.result) - :: - =/ =vase q.cage.build-result.result - :: - (expect-eq !>([12 13]) vase) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-vale-error ^- tang - :: - =/ hoon-src=@ta - ''' - |_ cell=^ - ++ grab - |% - ++ noun ^ - -- - -- - ''' - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - [%hoon !>(hoon-src)] - == - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%vale [~nul %home] %foo 42] - == - :: - ^= moves - :~ :* duct=~[/path] %give %made ~1234.5.6 %complete %error - :~ :- %leaf - %+ weld - "ford: %vale failed: invalid input for mark: " - "/~nul/home/~1234.5.6/mar/foo/hoon" - :: - :- %leaf - "ford: %call execution failed:" - == == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-cast ^- tang - :: - =/ foo-mark-src=@ta - ''' - |_ cell=^ - ++ grab - |% - ++ bar ^ - -- - -- - ''' - :: - =/ bar-mark-src=@ta - ''' - |_ sample=[@ @] - ++ grab - |% - += noun [@ @] - -- - -- - ''' - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - `[%hoon hoon-src-type foo-mark-src] - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/bar/mar]] - `[%hoon hoon-src-type bar-mark-src] - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/noun/mar]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%cast [~nul %home] %foo [%vale [~nul %home] %bar [12 13]]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %cast *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %foo !>([12 13]) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-cast-grow ^- tang - :: - =/ foo-mark-src=@ta - ''' - |_ cell=^ - ++ grab - |% - ++ noun ^ - -- - -- - ''' - :: - =/ bar-mark-src=@ta - ''' - |_ sample=[@ @] - ++ grab - |% - += noun [@ @] - -- - ++ grow - |% - ++ foo sample - -- - -- - ''' - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - `[%hoon hoon-src-type foo-mark-src] - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/bar/mar]] - `[%hoon hoon-src-type bar-mark-src] - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/noun/mar]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%cast [~nul %home] %foo [%vale [~nul %home] %bar [12 13]]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %cast *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %foo !>([12 13]) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-mute ^- tang - :: - =/ atom-type=type [%atom %$ ~] - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - %mute subject=[%$ %foo !>([a=42 b=[43 c=44]])] - ^= mutations ^- (list [wing schematic:ford-gate]) - :~ - [~[%a] [%$ %noun atom-type 2]] - [~[%c %b] [%$ %noun atom-type 4]] - == == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %mute *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %foo !>([2 43 4]) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-bake-renderer ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] cage) - %+ with-reef ~1234.5.6 - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/ren]] - :- %hoon - :- hoon-src-type - ''' - /= data /!noun/ - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/data]] - :- %hoon - :- hoon-src-type - ''' - [1 2 3 ~] - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%bake %foo *coin `rail:ford-gate`[[~nul %home] /data]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %bake *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %foo !>([1 2 3 ~]) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-bake-mark ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results=(map [term beam] (unit cage)) - %+ with-reef-unit ~1234.5.6 - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ cell=^ - ++ grab - |% - ++ bar ^ - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/bar/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ sample=[@ @] - ++ grab - |% - += noun [@ @] - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/ren]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /bar/data]] - `[%bar !>([12 13])] - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/noun/mar]] - ~ - :: - :- [%cy [[~nul %home %da ~1234.5.6] /data]] - `[%arch !>(`arch`[fil=~ dir=(my [%bar ~]~)])] - :: - :- [%cy [[~nul %home %da ~1234.5.6] /bar/data]] - `[%arch !>(`arch`[fil=`*@uv dir=~])] - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%bake %foo *coin `rail:ford-gate`[[~nul %home] /data]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ~| build-result.result - ?> ?=([%success %bake *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %foo !>([12 13]) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: renderers can fail, and we should fall back to using the mark -:: -++ test-bake-mark-fallback ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ scry-results=(map [term beam] (unit cage)) - %+ with-reef-unit ~1234.5.6 - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/dat/ren]] - :^ ~ %hoon hoon-src-type - ''' - /= data /~ !! - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/dat/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ atom=@ - ++ grab - |% - ++ txt @ - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt/mar]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /txt/data]] - :^ ~ %txt hoon-src-type - ''' - one - ''' - :: - :- [%cy [[~nul %home %da ~1234.5.6] /data]] - `[%arch !>(`arch`[fil=~ dir=(my [%txt ~]~)])] - :: - :- [%cy [[~nul %home %da ~1234.5.6] /txt/data]] - `[%arch !>(`arch`[fil=`*@uv dir=~])] - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - [%bake %dat *coin `rail:ford-gate`[[~nul %home] /data]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %bake *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %dat !>('one') cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-diff ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - :+ %hoon hoon-src-type - ''' - |_ cell=^ - ++ grab - |% - ++ noun ^ - -- - ++ grad - |% - ++ diff |=(^ +<) - ++ form %foo - -- - -- - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - :^ %diff [~nul %home] - [%$ %foo !>([12 13])] - [%$ %foo !>([17 18])] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %diff *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %foo !>([17 18]) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-diff-form ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ txt=wain - ++ grab - |% - ++ noun wain - -- - ++ grad - |% - ++ form %txt-diff - ++ diff - |= other-txt=wain - ^- (urge:clay cord) - =, differ - (lusk txt other-txt (loss txt other-txt)) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt-diff/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ txt-diff=(urge:clay cord) - ++ grab - |% - ++ noun (urge:clay cord) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/diff/txt/mar]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - :^ %diff [~nul %home] - [%$ %txt !>(~[%a %b])] - [%$ %txt !>(~[%a %d])] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %diff *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %txt-diff !>(~[[%& 1] [%| ~[%b] ~[%d]]]) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-pact ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ txt=wain - ++ grab - |% - ++ noun wain - -- - ++ grad - |% - ++ form %txt-diff - ++ diff - |= other-txt=wain - ^- (urge:clay cord) - =, differ - (lusk txt other-txt (loss txt other-txt)) - ++ pact - |= diff=(urge:clay cord) - ^- wain - =, differ - (lurk txt diff) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt-diff/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ txt-diff=(urge:clay cord) - ++ grab - |% - ++ noun (urge:clay cord) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/diff/txt/mar]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - :^ %pact [~nul %home] - [%$ %txt !>(~[%a %b])] - [%$ %txt-diff !>(~[[%& 1] [%| ~[%b] ~[%d]]])] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %pact *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - (expect-cage %txt !>(~[%a %d]) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-pact-mark ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ txt=wain - ++ grab - |% - ++ noun wain - -- - ++ grad - |% - ++ form %txt-diff - ++ diff - |= other-txt=wain - ^- (urge:clay cord) - =, differ - (lusk txt other-txt (loss txt other-txt)) - ++ pact - |= diff=(urge:clay cord) - ^- wain - =, differ - (lurk txt diff) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ foo=@t - ++ grab - |% - ++ noun @t - ++ txt of-wain:format - -- - ++ grow - |% - ++ txt (to-wain:format foo) - -- - ++ grad %txt - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt-diff/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ txt-diff=(urge:clay cord) - ++ grab - |% - ++ noun (urge:clay cord) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/diff/txt/mar]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/noun/mar]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - :^ %pact [~nul %home] - :+ %$ %foo !> - ''' - a - b - ''' - [%$ %txt-diff !>(~[[%& 1] [%| ~[%b] ~[%d]]])] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %pact *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - =/ expected ''' - a - d - ''' - :: - (expect-cage %foo !>(expected) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-join ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt/mar]] - :^ ~ %hoon hoon-src-type - txt-scry - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt-diff/mar]] - :^ ~ %hoon hoon-src-type - diff-scry - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/diff/txt/mar]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - :^ %join [~nul %home] %txt - :: replace %a with %c on the first line - :: - :- [%$ %txt-diff !>(~[[%| ~[%a] ~[%c]] [%& 1]])] - :: replace %b with %d on the second line - :: - [%$ %txt-diff !>(~[[%& 1] [%| ~[%b] ~[%d]]])] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %join *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - =/ result=(urge:clay cord) ~[[%| ~[%a] ~[%c]] [%| ~[%b] ~[%d]]] - (expect-cage %txt-diff !>(result) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-join-grad ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt/mar]] - :^ ~ %hoon hoon-src-type - txt-scry - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt-diff/mar]] - :^ ~ %hoon hoon-src-type - diff-scry - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/diff/txt/mar]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/hoon/mar]] - :^ ~ %hoon hoon-src-type - ''' - |_ foo=@t - ++ grab - |% - ++ noun @t - ++ txt of-wain:format - -- - ++ grow - |% - ++ txt (to-wain:format foo) - -- - ++ grad %txt - -- - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - :^ %join [~nul %home] %hoon - :: replace %a with %c on the first line - :: - :- [%$ %txt-diff !>(~[[%| ~[%a] ~[%c]] [%& 1]])] - :: replace %b with %d on the second line - :: - [%$ %txt-diff !>(~[[%& 1] [%| ~[%b] ~[%d]]])] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %join *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - =/ result=(urge:clay cord) ~[[%| ~[%a] ~[%c]] [%| ~[%b] ~[%d]]] - (expect-cage %txt-diff !>(result) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-list ^- tang - :: - =/ ud-type=type [%atom %ud ~] - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - ^= call-args - :* duct=~[/count] type=~ %build live=%.n - %list - :~ [%$ %noun ud-type 1] - [%$ %noun ud-type 2] - [%$ %noun ud-type 3] - == == - :: - ^= moves - :~ :* duct=~[/count] %give %made ~1234.5.6 %complete - %success %list - :~ [%success %$ %noun ud-type 1] - [%success %$ %noun ud-type 2] - [%success %$ %noun ud-type 3] - == == == == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-mash ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt/mar]] - :^ ~ %hoon hoon-src-type - txt-scry - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt-diff/mar]] - :^ ~ %hoon hoon-src-type - diff-scry - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/diff/txt/mar]] - ~ - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/path] type=~ %build live=%.n - ^- schematic:ford-gate - :- %mash - :^ [~nul %home] %txt - :: replace %a with %c on the first line - :: - ^= first - :+ [~nul %home] %txt-diff - ^- schematic:ford-gate - [%$ %txt-diff !>(~[[%| ~[%a] ~[%c]] [%& 1]])] - :: replace %b with %d on the second line - :: - ^= second - :+ [~nul %home] %txt-diff - ^- schematic:ford-gate - [%$ %txt-diff !>(~[[%& 1] [%| ~[%b] ~[%d]]])] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=(^ moves) - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %mash *] build-result.result) - :: - =/ =cage cage.build-result.result - :: - =/ result=(urge:clay cord) ~[[%| ~[%a] ~[%c]] [%| ~[%b] ~[%d]]] - :: - (expect-cage %txt-diff !>(result) cage) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: tests multiple cores depending on a rich dependency tree -:: -:: Test why multiple app cores don't receive dependencies -:: -++ test-multi-core-same-dependency ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - :: - =/ scry-results=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/gh/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add sur-gh-two:gh lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/gh/sur]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [sur-gh-one=1 sur-gh-two=2 sur-gh-three=3] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/plan-acct/sur]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/acct/plan/sur]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [sur-plan-acct=1 sur-plan-acct=2] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/lib/old/lib]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/old-lib/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [old-lib-val=10 ~] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/parse/gh/lib]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/gh-parse/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /- gh - /+ old-lib - =, old-lib - [lib-gh-parse-val=(add old-lib-val sur-gh-three:gh) ~] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/connector/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /- gh - /+ old-lib - =, old-lib - [lib-connector-val=(add old-lib-val sur-gh-one:gh) ~] - ''' - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/gh] type=~ %build live=%.y - %core [[~nul %home] /hoon/gh/app] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(2 (lent moves)) - ?> ?=([^ ^ ~] moves) - ?> ?=([* %give %made @da %complete %success %core *] i.moves) - :: - =/ =vase vase.build-result.result.p.card.i.moves - :: - %+ weld - (expect-eq !>(13) vase) - :: - =/ files=(set [%x path]) - %- sy :~ - [%x /lib/old-lib/hoon] - [%x /sur/gh/hoon] - [%x /sur/plan-acct/hoon] - [%x /sur/plan/acct/hoon] - [%x /lib/old/lib/hoon] - [%x /app/gh/hoon] - [%x /lib/gh/parse/hoon] - [%x /lib/gh-parse/hoon] - [%x /lib/connector/hoon] - [%x /sys/hoon/hoon] - [%x /sys/arvo/hoon] - [%x /sys/zuse/hoon] - == - :: - %+ expect-eq - !> ^- move:ford-gate - :* duct=~[/gh] %pass wire=/clay-sub/~nul/home/~1234.5.6 - %c %warp ~nul %home - `[%mult [%da ~1234.5.6] files] - == - !> i.t.moves - == - :: add a gh2 app which is the same as gh; move dates forward - :: - :: gh2 is the same except for adding one instead of two. - =. scry-results - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/gh/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add sur-gh-two:gh lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/gh2/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add sur-gh-one:gh lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/gh/sur]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [sur-gh-one=1 sur-gh-two=2 sur-gh-three=3] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/plan-acct/sur]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/acct/plan/sur]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [sur-plan-acct=1 sur-plan-acct=2] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/lib/old/lib]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/old-lib/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [old-lib-val=10 ~] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/parse/gh/lib]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/gh-parse/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /- gh - /+ old-lib - =, old-lib - [lib-gh-parse-val=(add old-lib-val sur-gh-three:gh) ~] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/connector/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /- gh - /+ old-lib - =, old-lib - [lib-connector-val=(add old-lib-val sur-gh-one:gh) ~] - ''' - == - :: - =^ results2 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.7 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/gh2] type=~ %build live=%.y - %core [[~nul %home] /hoon/gh2/app] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(2 (lent moves)) - ?> ?=([^ ^ ~] moves) - ?> ?=([* %give %made @da %complete %success %core *] i.moves) - :: - =/ =vase vase.build-result.result.p.card.i.moves - :: - %+ weld - (expect-eq !>(12) vase) - :: - =/ files=(set [%x path]) - %- sy :~ - [%x /lib/old-lib/hoon] - [%x /sur/gh/hoon] - [%x /sur/plan-acct/hoon] - [%x /sur/plan/acct/hoon] - [%x /lib/old/lib/hoon] - [%x /app/gh2/hoon] - [%x /lib/gh/parse/hoon] - [%x /lib/gh-parse/hoon] - [%x /lib/connector/hoon] - [%x /sys/hoon/hoon] - [%x /sys/arvo/hoon] - [%x /sys/zuse/hoon] - == - :: - %+ expect-eq - !> ^- move:ford-gate - :* duct=~[/gh2] %pass wire=/clay-sub/~nul/home/~1234.5.7 - %c %warp ~nul %home - `[%mult [%da ~1234.5.7] files] - == - !> i.t.moves - == - :: - :: add a gh3 app which is the same as gh; move dates forward - :: - :: gh3 is the same except for adding zero instead of two. - =. scry-results - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/gh/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add sur-gh-two:gh lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/gh2/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add sur-gh-one:gh lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/gh3/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add 0 lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/gh/sur]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [sur-gh-one=1 sur-gh-two=2 sur-gh-three=3] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/plan-acct/sur]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/acct/plan/sur]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [sur-plan-acct=1 sur-plan-acct=2] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/lib/old/lib]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/old-lib/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [old-lib-val=10 ~] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/parse/gh/lib]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/gh-parse/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /- gh - /+ old-lib - =, old-lib - [lib-gh-parse-val=(add old-lib-val sur-gh-three:gh) ~] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/connector/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /- gh - /+ old-lib - =, old-lib - [lib-connector-val=(add old-lib-val sur-gh-one:gh) ~] - ''' - == - :: - =^ results3 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.8 - scry=(scry-with-results-and-failures scry-results) - :: - ^= call-args - :* duct=~[/gh3] type=~ %build live=%.y - %core [[~nul %home] /hoon/gh3/app] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(2 (lent moves)) - ?> ?=([^ ^ ~] moves) - ?> ?=([* %give %made @da %complete %success %core *] i.moves) - :: - =/ =vase vase.build-result.result.p.card.i.moves - :: - %+ weld - (expect-eq !>(11) vase) - :: - =/ files=(set [%x path]) - %- sy :~ - [%x /lib/old-lib/hoon] - [%x /sur/gh/hoon] - [%x /sur/plan-acct/hoon] - [%x /sur/plan/acct/hoon] - [%x /lib/old/lib/hoon] - [%x /app/gh3/hoon] - [%x /lib/gh/parse/hoon] - [%x /lib/gh-parse/hoon] - [%x /lib/connector/hoon] - [%x /sys/hoon/hoon] - [%x /sys/arvo/hoon] - [%x /sys/zuse/hoon] - == - :: - %+ expect-eq - !> ^- move:ford-gate - :* duct=~[/gh3] %pass wire=/clay-sub/~nul/home/~1234.5.8 - %c %warp ~nul %home - `[%mult [%da ~1234.5.8] files] - == - !> i.t.moves - == - :: - :: change the implementation of /lib/connector/hoon - :: - =. scry-results - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/gh/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add sur-gh-two:gh lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/gh2/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add sur-gh-one:gh lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/gh3/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /? 314 - /- gh, plan-acct - /+ gh-parse, connector - :: - (add 0 lib-connector-val:connector) - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/gh/sur]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [sur-gh-one=1 sur-gh-two=2 sur-gh-three=3] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/plan-acct/sur]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/acct/plan/sur]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [sur-plan-acct=1 sur-plan-acct=2] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/lib/old/lib]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/old-lib/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - [old-lib-val=10 ~] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/parse/gh/lib]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/gh-parse/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /- gh - /+ old-lib - =, old-lib - [lib-gh-parse-val=(add old-lib-val sur-gh-three:gh) ~] - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.9] /hoon/connector/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /- gh - /+ old-lib - =, old-lib - [lib-connector-val=(add old-lib-val 5) ~] - ''' - == - :: - =^ results4 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.9 - scry=(scry-with-results-and-failures scry-results) - :: - ^= take-args - :* wire=/clay-sub/~nul/home/~1234.5.6 duct=~[/gh] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.9] (sy [%x /lib/connector/hoon]~)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(2 (lent moves)) - ?> ?=([^ ^ ~] moves) - ?> ?=([* %give %made @da %complete %success %core *] i.moves) - :: - =/ =vase vase.build-result.result.p.card.i.moves - :: - =/ files=(set [%x path]) - %- sy :~ - [%x /lib/old-lib/hoon] - [%x /sur/gh/hoon] - [%x /sur/plan-acct/hoon] - [%x /sur/plan/acct/hoon] - [%x /lib/old/lib/hoon] - [%x /app/gh/hoon] - [%x /lib/gh/parse/hoon] - [%x /lib/gh-parse/hoon] - [%x /lib/connector/hoon] - [%x /sys/hoon/hoon] - [%x /sys/arvo/hoon] - [%x /sys/zuse/hoon] - == - :: - ;: weld - (expect-eq !>(~[/gh]) !>(duct.i.moves)) - (expect-eq !>(17) vase.build-result.result.p.card.i.moves) - :: - %+ expect-eq - !> ^- move:ford-gate - :* duct=~[/gh] %pass wire=/clay-sub/~nul/home/~1234.5.9 - %c %warp ~nul %home - `[%mult [%da ~1234.5.9] files] - == - !> i.t.moves - == == - :: - =^ results5 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.9 - scry=(scry-with-results-and-failures scry-results) - :: - ^= take-args - :* wire=/clay-sub/~nul/home/~1234.5.7 duct=~[/gh2] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.9] (sy [%x /lib/connector/hoon]~)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(2 (lent moves)) - ?> ?=([^ ^ ~] moves) - ?> ?=([* %give %made @da %complete %success %core *] i.moves) - :: - =/ =vase vase.build-result.result.p.card.i.moves - :: - =/ files=(set [%x path]) - %- sy :~ - [%x /lib/old-lib/hoon] - [%x /sur/gh/hoon] - [%x /sur/plan-acct/hoon] - [%x /sur/plan/acct/hoon] - [%x /lib/old/lib/hoon] - [%x /app/gh2/hoon] - [%x /lib/gh/parse/hoon] - [%x /lib/gh-parse/hoon] - [%x /lib/connector/hoon] - [%x /sys/hoon/hoon] - [%x /sys/arvo/hoon] - [%x /sys/zuse/hoon] - == - :: - ;: weld - (expect-eq !>(~[/gh2]) !>(duct.i.moves)) - (expect-eq !>(16) vase.build-result.result.p.card.i.moves) - :: - %+ expect-eq - !> ^- move:ford-gate - :* duct=~[/gh2] %pass wire=/clay-sub/~nul/home/~1234.5.9 - %c %warp ~nul %home - `[%mult [%da ~1234.5.9] files] - == - !> i.t.moves - == == - :: - =^ results6 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.9 - scry=(scry-with-results-and-failures scry-results) - :: - ^= take-args - :* wire=/clay-sub/~nul/home/~1234.5.8 duct=~[/gh3] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.9] (sy [%x /lib/connector/hoon]~)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(2 (lent moves)) - ?> ?=([^ ^ ~] moves) - ?> ?=([* %give %made @da %complete %success %core *] i.moves) - :: - =/ =vase vase.build-result.result.p.card.i.moves - :: - =/ files=(set [%x path]) - %- sy :~ - [%x /lib/old-lib/hoon] - [%x /sur/gh/hoon] - [%x /sur/plan-acct/hoon] - [%x /sur/plan/acct/hoon] - [%x /lib/old/lib/hoon] - [%x /app/gh3/hoon] - [%x /lib/gh/parse/hoon] - [%x /lib/gh-parse/hoon] - [%x /lib/connector/hoon] - [%x /sys/hoon/hoon] - [%x /sys/arvo/hoon] - [%x /sys/zuse/hoon] - == - :: - ;: weld - (expect-eq !>(~[/gh3]) !>(duct.i.moves)) - (expect-eq !>(15) vase.build-result.result.p.card.i.moves) - :: - %+ expect-eq - !> ^- move:ford-gate - :* duct=~[/gh3] %pass wire=/clay-sub/~nul/home/~1234.5.9 - %c %warp ~nul %home - `[%mult [%da ~1234.5.9] files] - == - !> i.t.moves - == == - :: - =^ results7 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.10 - scry=scry-is-forbidden - :: - call-args=[duct=~[/gh] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/gh] %pass /clay-sub/~nul/home/~1234.5.9 - %c %warp ~nul %home ~ - == == == - :: - =^ results8 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.11 - scry=scry-is-forbidden - :: - call-args=[duct=~[/gh2] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/gh2] %pass /clay-sub/~nul/home/~1234.5.9 - %c %warp ~nul %home ~ - == == == - :: - =^ results9 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.12 - scry=scry-is-forbidden - :: - call-args=[duct=~[/gh3] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/gh3] %pass /clay-sub/~nul/home/~1234.5.9 - %c %warp ~nul %home ~ - == == == - :: - ;: weld - results1 - results2 - results3 - results4 - results5 - results6 - results7 - results8 - results9 - (expect-ford-empty ford-gate ~nul) - == -:: tests that we can do the simple adjacent mark case, and that we use grab -:: when both available. -:: -++ test-walk-prefer-grab ^- tang - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results=(map [term beam] cage) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/one/mar]] - :- %hoon - :- hoon-src-type - ''' - |_ [a=tape b=@ud] - :: convert to - ++ grow - |% - ++ two [b a "grow"] - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/two/mar]] - :- %hoon - :- hoon-src-type - ''' - |_ [a=@ud b=tape c=type] - ++ grab - |% - ++ one |=([a=tape b=@ud] [b a "grab"]) - -- - -- - ''' - :: - :: todo: %cy looks funny here - :: - :: make sure we can deal with random not-hoon files in mar - :- [%cy [[~nul %home %da ~1234.5.6] /js/dummy/mar]] - :- %js - :- hoon-src-type - ''' - window.onload = function() - ''' - == - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results scry-results) - :: - ^= call-args - :* duct=~[/walk] type=~ %build live=%.y - %walk [~nul %home] %one %two - == - :: - ^= moves - :~ ^- move:ford-gate - :* duct=~[/walk] %give %made ~1234.5.6 - %complete %success %walk - [%grab %one %two]~ - == - ^- move:ford-gate - :* duct=~[/walk] %pass /clay-sub/~nul/home/~1234.5.6 - %c %warp ~nul %home ~ %mult [%da ~1234.5.6] - %- sy :~ - [%x /mar/two/hoon] - [%x /mar/one/hoon] - [%x /sys/hoon/hoon] - [%x /sys/arvo/hoon] - [%x /sys/zuse/hoon] - == == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - call-args=[duct=~[/walk] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/walk] %pass /clay-sub/~nul/home/~1234.5.6 - %c %warp ~nul %home ~ - == == == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-walk-large-graph ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results large-mark-graph) - :: - ^= call-args - :* duct=~[/walk] type=~ %build live=%.y - %walk [~nul %home] %one %four - == - :: - ^= moves - :~ ^- move:ford-gate - :* duct=~[/walk] %give %made ~1234.5.6 - %complete %success %walk - [[%grab %one %two] [%grab %two %four] ~] - == - ^- move:ford-gate - :* duct=~[/walk] %pass /clay-sub/~nul/home/~1234.5.6 - %c %warp ~nul %home ~ %mult [%da ~1234.5.6] - %- sy :~ - [%x /mar/one/hoon] - [%x /mar/two/hoon] - [%x /mar/four/hoon] - [%x /mar/five/hoon] - [%x /sys/hoon/hoon] - [%x /sys/arvo/hoon] - [%x /sys/zuse/hoon] - == == == == - :: - =^ results2 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - :: - call-args=[duct=~[/walk] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/walk] %pass /clay-sub/~nul/home/~1234.5.6 - %c %warp ~nul %home ~ - == == == - :: - ;: weld - results1 - results2 - (expect-ford-empty ford-gate ~nul) - == -:: +test-walk-large-graph, except we're going to shove data through it. -:: -++ test-cast-large-graph ^- tang - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results large-mark-graph) - :: - ^= call-args - :* duct=~[/large] type=~ %build live=%.n - [%cast [~nul %home] %four [%volt [~nul %home] %one ["one" 1]]] - == - ^= comparator - |= moves=(list move:ford-gate) - :: - ?> =(1 (lent moves)) - ?> ?=([^ ~] moves) - ?> ?=([* %give %made @da %complete %success %cast *] i.moves) - :: - =/ result=cage cage.build-result.result.p.card.i.moves - :: - (expect-cage %four !>(["grab" "one"]) result) - == - :: - ;: weld - results1 - (expect-ford-empty ford-gate ~nul) - == -:: -++ test-complex-live-cranes - ^- tang - :: set the build-cache to 2 to force eviction - :: - =^ results0 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.5 - scry=scry-is-forbidden - :: - call-args=[duct=~[/config] type=~ %keep [2.048 0]] - moves=~ - == - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ item-type=type -:!>([%item '']) - =/ arch-type=type -:!>(*arch) - :: - =/ scry-results1=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/program/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /+ things - /= data - /^ box:things - /; |= a=(map knot item:things) - [*config:things a] - /: /===/web /_ /item/ - :: - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/things/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - |% - +$ box [config (map knot item)] - +$ config [%config @t] - +$ item [%item @t] - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/item/mar]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /+ things - |_ item:things - :: convert to - ++ grab - |% - ++ noun item:things - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/item/ren]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.6] /item/data1/web]] - :- ~ - :- %item - :- item-type - [%item 'one'] - :: - :- [%cy [[~nul %home %da ~1234.5.6] /web]] - `[%arch !>(`arch`[fil=~ dir=(my [[%data1 ~] ~])])] - :: - :- [%cy [[~nul %home %da ~1234.5.6] /data1/web]] - `[%arch !>(`arch`[fil=~ dir=(my [%item ~]~)])] - :: - :- [%cy [[~nul %home %da ~1234.5.6] /item/data1/web]] - `[%arch !>(`arch`[fil=`0v1 dir=~])] - == - :: - =^ results1 ford-gate - %- ford-call-with-comparator :* - ford-gate - now=~1234.5.6 - scry=(scry-with-results-and-failures scry-results1) - :: - ^= call-args - ^- [=duct type=* wrapped-task=(hobo task:able:ford-gate)] - :* duct=~[/app] type=~ %build live=%.y - [%core source-path=`rail:ford-gate`[[~nul %home] /hoon/program/app]] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(2 (lent moves)) - ?> ?=(^ moves) - :: - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - =/ result=[[%config @t] (map knot [%item @t])] - :- [%config ''] - (my [%data1 [%item 'one']] ~) - :: - (expect-eq !>(result) vase) - :: - :: TODO: check the subscription? - == - :: - =/ scry-results2=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/program/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /+ things - /= data - /^ box:things - /; |= a=(map knot item:things) - [*config:things a] - /: /===/web /_ /item/ - :: - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/things/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - |% - +$ box [config (map knot item)] - +$ config [%config @t] - +$ item [%item @t] - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/item/mar]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /+ things - |_ item:things - :: convert to - ++ grab - |% - ++ noun item:things - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.7] /hoon/item/ren]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.7] /item/data1/web]] - :- ~ - :- %item - :- item-type - [%item 'one'] - :: - :- [%cx [[~nul %home %da ~1234.5.7] /item/data2/web]] - :- ~ - :- %item - :- item-type - [%item 'two'] - :: - :- [%cy [[~nul %home %da ~1234.5.7] /web]] - `[%arch !>(`arch`[fil=~ dir=(my [[%data1 ~] [%data2 ~] ~])])] - ::a - :- [%cy [[~nul %home %da ~1234.5.7] /data1/web]] - `[%arch !>(`arch`[fil=~ dir=(my [%item ~]~)])] - :: - :- [%cy [[~nul %home %da ~1234.5.7] /data2/web]] - `[%arch !>(`arch`[fil=~ dir=(my [%item ~]~)])] - - :- [%cy [[~nul %home %da ~1234.5.7] /item/data1/web]] - `[%arch !>(`arch`[fil=`0v1 dir=~])] - :: - :- [%cy [[~nul %home %da ~1234.5.7] /item/data2/web]] - `[%arch !>(`arch`[fil=`0v2 dir=~])] - == - :: - =^ results2 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.7 - scry=(scry-with-results-and-failures scry-results2) - :: - ^= take-args - :* wire=/clay-sub/~nul/home/~1234.5.6 duct=~[/app] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - [%c %wris [%da ~1234.5.7] (sy [%y /web]~)] - == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(2 (lent moves)) - ?> ?=(^ moves) - :: - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - =/ result=[[%config @t] (map knot [%item @t])] - :- [%config ''] - (my [%data1 [%item 'one']] [%data2 [%item 'two']] ~) - :: - (expect-eq !>(result) vase) - :: - :: TODO: check the subscription? - == - :: - =/ scry-results3=(map [term beam] (unit cage)) - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/program/app]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /+ things - /= data - /^ box:things - /; |= a=(map knot item:things) - [*config:things a] - /: /===/web /_ /item/ - :: - data - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/things/lib]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - |% - +$ box [config (map knot item)] - +$ config [%config @t] - +$ item [%item @t] - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/item/mar]] - :- ~ - :- %hoon - :- hoon-src-type - ''' - /+ things - |_ item:things - :: convert to - ++ grab - |% - ++ noun item:things - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.8] /hoon/item/ren]] - ~ - :: - :- [%cx [[~nul %home %da ~1234.5.8] /item/data1/web]] - :- ~ - :- %item - :- item-type - [%item 'one'] - :: - :- [%cx [[~nul %home %da ~1234.5.8] /item/data2/web]] - :- ~ - :- %item - :- item-type - [%item 'changed-two'] - :: - :- [%cy [[~nul %home %da ~1234.5.8] /web]] - `[%arch !>(`arch`[fil=~ dir=(my [[%data1 ~] [%data2 ~] ~])])] - ::a - :- [%cy [[~nul %home %da ~1234.5.8] /data1/web]] - `[%arch !>(`arch`[fil=~ dir=(my [%item ~]~)])] - :: - :- [%cy [[~nul %home %da ~1234.5.8] /data2/web]] - `[%arch !>(`arch`[fil=~ dir=(my [%item ~]~)])] - - :- [%cy [[~nul %home %da ~1234.5.8] /item/data1/web]] - `[%arch !>(`arch`[fil=`0v1 dir=~])] - :: - :- [%cy [[~nul %home %da ~1234.5.8] /item/data2/web]] - `[%arch !>(`arch`[fil=`0v222 dir=~])] - == - :: - =^ results3 ford-gate - %- ford-take-with-comparator :* - ford-gate - now=~1234.5.7 - scry=(scry-with-results-and-failures scry-results3) - :: - ^= take-args - :* wire=/clay-sub/~nul/home/~1234.5.7 duct=~[/app] - ^= wrapped-sign ^- (hypo sign:ford-gate) :- *type - :* %c %wris [%da ~1234.5.8] - (sy [%x /web/data2/item] [%y /web/data2/item] ~) - == == - :: - ^= comparator - |= moves=(list move:ford-gate) - ^- tang - :: - ?> =(2 (lent moves)) - ?> ?=(^ moves) - :: - ?> ?=([* %give %made @da %complete *] i.moves) - =/ result result.p.card.i.moves - ?> ?=([%success %core *] build-result.result) - :: - =/ =vase vase.build-result.result - :: - =/ result=[[%config @t] (map knot [%item @t])] - :- [%config ''] - (my [%data1 [%item 'one']] [%data2 [%item 'changed-two']] ~) - :: - (expect-eq !>(result) vase) - :: - :: TODO: check the subscription? - == - :: - =^ results4 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.8 - scry=scry-is-forbidden - :: - call-args=[duct=~[/app] type=~ %kill ~] - :: - ^= moves - :~ :* duct=~[/app] %pass wire=/clay-sub/~nul/home/~1234.5.8 - %c %warp ~nul %home ~ - == == == - :: - ;: weld - results0 - results1 - results2 - results3 - results4 - (expect-ford-empty ford-gate ~nul) - == -:: |data: shared data between cases -:: +| data -++ large-mark-graph - ^- (map [term beam] cage) - :: - =/ hoon-src-type=type [%atom %$ ~] - =/ arch-type=type -:!>(*arch) - :: - %- my :~ - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/one/mar]] - :- %hoon - :- hoon-src-type - ''' - |_ [a=tape b=@ud] - :: convert to - ++ grow - |% - ++ two [b a "grow"] - ++ five b - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/two/mar]] - :- %hoon - :- hoon-src-type - ''' - |_ [a=@ud b=tape c=tape] - ++ grab - |% - ++ one |=([a=tape b=@ud] [b a "grab"]) - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/three/mar]] - :- %hoon - :- hoon-src-type - ''' - |_ [b=tape c=tape] - ++ grab - |% - ++ one |=([a=tape b=@ud] [a "grab"]) - -- - ++ grow - |% - ++ two - [b c] - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/four/mar]] - :- %hoon - :- hoon-src-type - ''' - |_ [c=tape b=tape] - ++ grab - |% - ++ two - |= [a=@ud b=tape c=tape] - [c b] - -- - -- - ''' - :: - :- [%cx [[~nul %home %da ~1234.5.6] /hoon/five/mar]] - :- %hoon - :- hoon-src-type - ''' - |_ a=@u - ++ grab - |% - ++ four - :: ignore the value entirely - |= [c=tape b=tape] - 5 - -- - ++ grow - |% - ++ one - [a "empty" "grow"] - -- - -- - ''' - == --- diff --git a/pkg/arvo/tests/sys/vane/gall.hoon b/pkg/arvo/tests/sys/vane/gall.hoon index 3dc70c604..291574c37 100644 --- a/pkg/arvo/tests/sys/vane/gall.hoon +++ b/pkg/arvo/tests/sys/vane/gall.hoon @@ -1,6 +1,5 @@ /+ *test -:: -/= gall-raw /: /===/sys/vane/gall /!noun/ +/= gall-raw /sys/vane/gall :: =/ test-pit=vase !>(..zuse) =/ gall-gate (gall-raw test-pit) diff --git a/pkg/arvo/tests/sys/vane/iris.hoon b/pkg/arvo/tests/sys/vane/iris.hoon index b706bfce2..6ea991374 100644 --- a/pkg/arvo/tests/sys/vane/iris.hoon +++ b/pkg/arvo/tests/sys/vane/iris.hoon @@ -1,6 +1,5 @@ /+ *test -:: -/= http-client-raw /: /===/sys/vane/iris /!noun/ +/= http-client-raw /sys/vane/iris :: !: :: From 1f91676c97b7193f0c5ae10a09d0f4f8cddfd38b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 19 Apr 2020 04:58:12 -0400 Subject: [PATCH 040/280] ford-fusion: stateful %warp reads compile --- pkg/arvo/sys/vane/clay.hoon | 136 +++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 56 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index f744e2640..a073376ea 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3180,13 +3180,13 @@ :: ++ aver |= {for/(unit ship) mun/mood} - ^- (unit (unit (each cage lobe))) + ^- [(unit (unit (each cage lobe))) ford-cache] =+ ezy=?~(ref ~ (~(get by haw.u.ref) mun)) ?^ ezy - `(bind u.ezy |=(a/cage [%& a])) + :_(fod.dom.red `(bind u.ezy |=(a/cage [%& a]))) =+ nao=(case-to-aeon case.mun) :: ~& [%aver-mun nao [%from syd lim case.mun]] - ?~(nao ~ (read-at-aeon:ze for u.nao mun)) + ?~(nao [~ fod.dom.red] (read-at-aeon:ze for u.nao mun)) :: :: Queue a move. :: @@ -3751,8 +3751,8 @@ ++ start-request |= [for=(unit ship) rav=rave] ^+ ..start-request - =/ [new-sub=(unit rove) sub-results=(list sub-result)] - (try-fill-sub for (rave-to-rove rav)) + =^ [new-sub=(unit rove) sub-results=(list sub-result)] fod.dom + (try-fill-sub for (rave-to-rove rav)) =. ..start-request (send-sub-results sub-results [hen ~ ~]) ?~ new-sub ..start-request @@ -4150,8 +4150,8 @@ :: drop forgotten roves :: $(old-subs t.old-subs) - =/ [new-sub=(unit rove) sub-results=(list sub-result)] - (try-fill-sub wove.i.old-subs) + =^ [new-sub=(unit rove) sub-results=(list sub-result)] fod.dom + (try-fill-sub wove.i.old-subs) =. ..wake (send-sub-results sub-results ducts.i.old-subs) =. new-subs ?~ new-sub @@ -4163,7 +4163,7 @@ :: ++ try-fill-sub |= [for=(unit ship) rov=rove] - ^- [new-sub=(unit rove) (list sub-result)] + ^- [[new-sub=(unit rove) (list sub-result)] ford-cache] ?- -.rov %sing =/ cache-value=(unit (unit cage)) @@ -4171,6 +4171,7 @@ ?^ cache-value :: if we have a result in our cache, produce it :: + :_ fod.dom :- ~ ?~ u.cache-value [%blub ~]~ @@ -4179,10 +4180,10 @@ :: =/ aeon=(unit aeon) (case-to-aeon case.mood.rov) ?~ aeon - [`rov ~] + [[`rov ~] fod.dom] :: we have the appropriate aeon, so read in the data :: - =/ value=(unit (unit (each cage lobe))) + =^ value=(unit (unit (each cage lobe))) fod.dom (read-at-aeon:ze for u.aeon mood.rov) ?~ value :: We don't have the data directly, which is potentially @@ -4190,12 +4191,12 @@ :: ?: =(0 u.aeon) ~& [%clay-sing-indirect-data-0 `path`[syd '0' path.mood.rov]] - [~ ~] + [[~ ~] fod.dom] ~& [%clay-sing-indirect-data desk=syd mood=mood.rov aeon=u.aeon] - [`rov ~] + [[`rov ~] fod.dom] :: we have the data, so we produce the results :: - [~ [%balk u.value mood.rov]~] + [[~ [%balk u.value mood.rov]~] fod.dom] :: :: %next is just %mult with one path, so we pretend %next = %mult here. :: @@ -4219,41 +4220,48 @@ ?> ?=(%mult -.rov) :: we will either respond or store the maybe updated request. :: - =; res=(each (map mood (unit (each cage lobe))) rove) + =; [res=(each (map mood (unit (each cage lobe))) rove) fod=ford-cache] + :_ fod ?: ?=(%& -.res) (respond p.res) (store p.res) :: recurse here on next aeon if possible/needed. :: - |- ^- (each (map mood (unit (each cage lobe))) rove) + |- ^- [(each (map mood (unit (each cage lobe))) rove) ford-cache] :: if we don't have an aeon yet, see if we have one now. :: ?~ aeon.rov =/ aeon=(unit aeon) (case-to-aeon case.mool.rov) :: if we still don't, wait. :: - ?~ aeon |+rov + ?~ aeon [|+rov fod.dom] :: if we do, update the request and retry. :: $(aeon.rov `+(u.aeon), old-cach.rov ~, new-cach.rov ~) :: if old isn't complete, try filling in the gaps. :: - =? old-cach.rov !(complete old-cach.rov) + =^ o fod.dom + ?: (complete old-cach.rov) + [old-cach.rov fod.dom] (read-unknown mool.rov(case [%ud (dec u.aeon.rov)]) old-cach.rov) + =. old-cach.rov o :: if the next aeon we want to compare is in the future, wait again. :: =/ next-aeon=(unit aeon) (case-to-aeon [%ud u.aeon.rov]) - ?~ next-aeon |+rov + ?~ next-aeon [|+rov fod.dom] :: if new isn't complete, try filling in the gaps. :: - =? new-cach.rov !(complete new-cach.rov) + =^ n fod.dom + ?: (complete new-cach.rov) + [new-cach.rov fod.dom] (read-unknown mool.rov(case [%ud u.aeon.rov]) new-cach.rov) + =. new-cach.rov n :: if they're still not both complete, wait again. :: ?. ?& (complete old-cach.rov) (complete new-cach.rov) == - |+rov + [|+rov fod.dom] :: both complete, so check if anything has changed :: =/ changes=(map mood (unit (each cage lobe))) @@ -4292,7 +4300,7 @@ :: if there are any changes, send response. if none, move on to :: next aeon. :: - ?^ changes &+changes + ?^ changes [&+changes fod.dom] $(u.aeon.rov +(u.aeon.rov), new-cach.rov ~) :: :: check again later @@ -4337,6 +4345,7 @@ :: ++ read-unknown |= [=mool hav=(map (pair care path) cach)] + ^- [_hav ford-cache] =? hav ?=(~ hav) %- malt ^- (list (pair (pair care path) cach)) %+ turn @@ -4344,12 +4353,22 @@ |= [c=care p=path] ^- [[care path] cach] [[c p] ~] - %- ~(urn by hav) - |= [[c=care p=path] o=cach] - ?^(o o (aver for c case.mool p)) + |- ^+ [hav fod.dom] + ?~ hav [hav fod.dom] + =^ lef fod.dom $(hav l.hav) + =. l.hav lef + =^ rig fod.dom $(hav r.hav) + =. r.hav rig + =/ [[=care =path] =cach] n.hav + ?^ cach + [hav fod.dom] + =^ q fod.dom (aver for care case.mool path) + =. q.n.hav q + [hav fod.dom] -- :: %many + :_ fod.dom =/ from-aeon (case-to-aeon from.moat.rov) ?~ from-aeon :: haven't entered the relevant range, so do nothing @@ -4545,51 +4564,54 @@ :: ++ read-a |= [=aeon =path] - ^- (unit (unit (each cage lobe))) + ^- [(unit (unit (each cage lobe))) ford-cache] ?. =(aeon let.dom) - ~ + [~ fod.dom] =/ cached=(unit [=vase *]) (~(get by vases.fod.dom) path) ?^ cached - [~ ~ %& %vase !>(vase.u.cached)] + :_(fod.dom [~ ~ %& %vase !>(vase.u.cached)]) =/ x (read-x aeon path) ?~ x - ~ + [~ fod.dom] ?~ u.x - [~ ~] + [[~ ~] fod.dom] :: should never happen at current aeon ?: ?=(%| -.u.u.x) - ~ - =/ [=vase =state:ford:fusion] + [~ fod.dom] + =^ =vase fod.dom + %- wrap:fusion (build-file:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) path) - [~ ~ %& %vase !>(vase)] + :_(fod.dom [~ ~ %& %vase !>(vase)]) :: ++ read-b |= [=aeon =path] - ^- (unit (unit (each cage lobe))) + ^- [(unit (unit (each cage lobe))) ford-cache] ?. =(aeon let.dom) - ~ + [~ fod.dom] ?. ?=([@ ~] path) - [~ ~] + [[~ ~] fod.dom] =/ cached=(unit [=dais *]) (~(get by marks.fod.dom) i.path) ?^ cached - [~ ~ %& %dais !>(dais.u.cached)] - =/ [=dais =state:ford:fusion] + :_(fod.dom [~ ~ %& %dais !>(dais.u.cached)]) + =^ =dais fod.dom + %- wrap:fusion (get-mark:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) i.path) - [~ ~ %& %dais !>(dais)] + :_(fod.dom [~ ~ %& %dais !>(dais)]) :: ++ read-c |= [=aeon =path] - ^- (unit (unit (each cage lobe))) + ^- [(unit (unit (each cage lobe))) ford-cache] ?. =(aeon let.dom) - ~ + [~ fod.dom] ?. ?=([@ @ ~] path) - [~ ~] + [[~ ~] fod.dom] =/ cached=(unit [=tube *]) (~(get by casts.fod.dom) [i i.t]:path) ?^ cached - [~ ~ %& %tube !>(tube.u.cached)] - =/ [=tube =state:ford:fusion] + :_(fod.dom [~ ~ %& %tube !>(tube.u.cached)]) + =^ =tube fod.dom + %- wrap:fusion (get-cast:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) [i i.t]:path) - [~ ~ %& %tube !>(tube)] + :_(fod.dom [~ ~ %& %tube !>(tube)]) :: :: Gets the permissions that apply to a particular node. :: @@ -4851,11 +4873,13 @@ :: ++ read-at-aeon :: read-at-aeon:ze |= [for=(unit ship) yon=aeon mun=mood] :: seek and read - ^- (unit (unit (each cage lobe))) + ^- [(unit (unit (each cage lobe))) ford-cache] + =* fod fod.dom ?. |(?=(~ for) (may-read u.for care.mun yon path.mun)) - ~ + [~ fod] ?- care.mun %d + :_ fod :: XX this should only allow reads at the current date :: ?: !=(our her) @@ -4867,15 +4891,15 @@ %a (read-a yon path.mun) %b (read-b yon path.mun) %c (read-c yon path.mun) - %p (read-p path.mun) - %s (bind (read-s yon path.mun) (lift |=(a=cage [%& a]))) - %t (bind (read-t yon path.mun) (lift |=(a=cage [%& a]))) - %u (read-u yon path.mun) - %v (bind (read-v yon path.mun) (lift |=(a/cage [%& a]))) - %w (read-w case.mun) - %x (read-x yon path.mun) - %y (bind (read-y yon path.mun) (lift |=(a/cage [%& a]))) - %z (bind (read-z yon path.mun) (lift |=(a/cage [%& a]))) + %p :_(fod (read-p path.mun)) + %s :_(fod (bind (read-s yon path.mun) (lift |=(a=cage [%& a])))) + %t :_(fod (bind (read-t yon path.mun) (lift |=(a=cage [%& a])))) + %u :_(fod (read-u yon path.mun)) + %v :_(fod (bind (read-v yon path.mun) (lift |=(a/cage [%& a])))) + %w :_(fod (read-w case.mun)) + %x :_(fod (read-x yon path.mun)) + %y :_(fod (bind (read-y yon path.mun) (lift |=(a/cage [%& a])))) + %z :_(fod (bind (read-z yon path.mun) (lift |=(a/cage [%& a])))) == ++ zu zu:util -- @@ -5248,7 +5272,7 @@ ?: =(p.m his) ~ `p.m =/ den ((de our now ski [/scryduct ~] ruf) his syd) - =+ (aver:den for u.run u.luk tyl) + =+ -:(aver:den for u.run u.luk tyl) ?~ - - ?~ u.- - ?: ?=(%& -.u.u.-) ``p.u.u.- From 4bf854c18002114cc3accdc8dc83a945692042db Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 19 Apr 2020 05:11:01 -0400 Subject: [PATCH 041/280] WIP :spider2 using ford-fusion --- pkg/arvo/app/dojo.hoon | 8 ++-- pkg/arvo/lib/strandio.hoon | 15 ++++++++ pkg/arvo/ted/test.hoon | 76 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 92 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 09ff73f01..a15302951 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -346,7 +346,7 @@ ?: =(/wool u.pux) :: really shoud stop the thread as well :: - [%pass u.pux %agent [our.hid %spider] %leave ~] + [%pass u.pux %agent [our.hid %spider2] %leave ~] [%pass u.pux %arvo %f %kill ~] :: ++ dy-slam :: call by ford @@ -732,11 +732,11 @@ =. poy `+>+<.$(pux `/wool) =. +>+>.$ %- he-card - [%pass /wool %agent [our.hid %spider] %watch /thread-result/[tid]] + [%pass /wool %agent [our.hid %spider2] %watch /thread-result/[tid]] %- he-card =/ =cage :: also sub [%spider-start !>([~ `tid fil (dy-sore src)])] - [%pass /wool %agent [our.hid %spider] %poke cage] + [%pass /wool %agent [our.hid %spider2] %poke cage] :: ++ dy-make :: build step ^+ +> @@ -925,7 +925,7 @@ ?~ p.sign +>.$ =. +>.$ (he-diff(poy ~) %tan u.p.sign) - (he-card %pass /wool %agent [our.hid %spider] %leave ~) + (he-card %pass /wool %agent [our.hid %spider2] %leave ~) :: %watch-ack ?~ p.sign diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 3734776f6..39aa2b0bc 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -26,6 +26,12 @@ |= tin=strand-input:strand `[%done bowl.tin] :: +++ get-beak + =/ m (strand ,beak) + ^- form:m + |= tin=strand-input:strand + `[%done [our q.byk da+now]:bowl.tin] +:: ++ get-time =/ m (strand ,@da) ^- form:m @@ -537,6 +543,15 @@ ;< ~ bind:m (send-raw-card %pass /warp %arvo %c %warp ship riff) (take-writ /warp) :: +++ list-tree + |= [[=ship =desk =case:clay] =spur] + =* arg +< + =/ m (strand ,(list path)) + ;< =riot:clay bind:m (warp ship desk ~ %sing %t case (flop spur)) + ?~ riot + (strand-fail %list-tree >arg< ~) + (pure:m !<((list path) q.r.u.riot)) +:: :: Take Clay read result :: ++ take-writ diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index c9015d2fb..420483bab 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -1,13 +1,83 @@ /- spider -/+ strandio, *test-runner +/+ strandio =, strand=strand:spider +=> +|% +:: $test: a test with a fully resolved path +:: $test-arm: test with name (derived from its arm name in a test core) +:: $test-func: single test, as gate; sample is entropy, produces failures +:: ++$ test [=path func=test-func] ++$ test-arm [name=term func=test-func] ++$ test-func (trap tang) +-- +=> +|% +:: +run-test: execute an individual test +:: +++ run-test + |= [pax=path test=test-func] + ^- [ok=? =tang] + =+ name=(spud pax) + =+ run=(mule test) + ?- -.run + %| |+(welp p.run leaf+"CRASHED {name}" ~) + %& ?: =(~ p.run) + &+[leaf+"OK {name}"]~ + |+(flop `tang`[leaf+"FAILED {name}" p.run]) + == +:: +filter-tests-by-prefix: TODO document +:: +++ filter-tests-by-prefix + |= [prefix=path tests=(list test)] + ^+ tests + =/ prefix-length=@ud (lent prefix) + (skim tests |=([p=path *] =(prefix (scag prefix-length p)))) +:: +resolve-test-paths: add test names to file paths to form full identifiers +:: +++ resolve-test-paths + |= paths-to-tests=(map path (list test-arm)) + ^- (list test) + %- sort :_ |=([a=test b=test] !(aor path.a path.b)) + ^- (list test) + %- zing + %+ turn ~(tap by paths-to-tests) + |= [=path test-arms=(list test-arm)] + ^- (list test) + :: strip off leading 'tests' from :path + :: + =. path ?>(?=([%tests *] path) t.path) + :: for each test, add the test's name to :path + :: + %+ turn test-arms + |= =test-arm + ^- test + [(weld path /[name.test-arm]) func.test-arm] +:: +get-test-arms: convert test arms to functions and produce them +:: +++ get-test-arms + |= [typ=type cor=*] + ^- (list test-arm) + =/ arms=(list @tas) (sloe typ) + %+ turn (skim arms has-test-prefix) + |= name=term + ^- test-arm + =/ fire-arm=nock + ~| [%failed-to-compile-test-arm name] + q:(~(mint ut typ) p:!>(*tang) [%limb name]) + [name |.(;;(tang .*(cor fire-arm)))] +:: +has-test-prefix: does the arm define a test we should run? +:: +++ has-test-prefix + |= a=term ^- ? + =((end 3 5 a) 'test-') +-- ^- thread:spider |= arg=vase =/ m (strand ,vase) ^- form:m =/ paz=(list path) (turn !<((list path) arg) |=(path [%tests +<])) -;< =bowl:spider bind:m get-bowl:strandio -=/ bek=beak [our q.byk da+now]:bowl +;< bek=beak bind:m get-beak:strandio =| test-arms=(map path (list test-arm)) |- ^- form:m =* gather-tests $ From 47d1d31a8d904439745d795f9c710eb33d684d10 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 19 Apr 2020 05:17:48 -0400 Subject: [PATCH 042/280] WIP :spider2 (actually committed) and -tree (untested) --- pkg/arvo/app/spider2.hoon | 439 ++++++++++++++++++++++++++++++++++++++ pkg/arvo/ted/tree.hoon | 11 + 2 files changed, 450 insertions(+) create mode 100644 pkg/arvo/app/spider2.hoon create mode 100644 pkg/arvo/ted/tree.hoon diff --git a/pkg/arvo/app/spider2.hoon b/pkg/arvo/app/spider2.hoon new file mode 100644 index 000000000..5e2744390 --- /dev/null +++ b/pkg/arvo/app/spider2.hoon @@ -0,0 +1,439 @@ +/- spider +/+ libstrand=strand, default-agent, verb +=, strand=strand:libstrand +|% ++$ card card:agent:gall ++$ thread thread:spider ++$ tid tid:spider ++$ input input:spider ++$ yarn (list tid) ++$ thread-form _*eval-form:eval:(strand ,vase) ++$ trie + $~ [*thread-form ~] + [=thread-form kid=(map tid trie)] +:: ++$ trying ?(%find %build %none) ++$ state + $: starting=(map yarn [=trying =vase]) + running=trie + tid=(map tid yarn) + == +:: ++$ clean-slate + $: starting=(map yarn [=trying =vase]) + running=(list yarn) + tid=(map tid yarn) + == +:: ++$ start-args + [parent=(unit tid) use=(unit tid) file=term =vase] +-- +:: +:: Trie operations +:: +|% +++ get-yarn + |= [=trie =yarn] + ^- (unit =thread-form) + ?~ yarn + `thread-form.trie + =/ son (~(get by kid.trie) i.yarn) + ?~ son + ~ + $(trie u.son, yarn t.yarn) +:: +++ get-yarn-children + |= [=trie =yarn] + ^- (list ^yarn) + ?~ yarn + (turn (tap-yarn trie) head) + =/ son (~(get by kid.trie) i.yarn) + ?~ son + ~ + $(trie u.son, yarn t.yarn) +:: +:: +++ has-yarn + |= [=trie =yarn] + !=(~ (get-yarn trie yarn)) +:: +++ put-yarn + |= [=trie =yarn =thread-form] + ^+ trie + ?~ yarn + trie(thread-form thread-form) + =/ son (~(gut by kid.trie) i.yarn [*^thread-form ~]) + %= trie + kid + %+ ~(put by kid.trie) i.yarn + $(trie son, yarn t.yarn) + == +:: +++ del-yarn + |= [=trie =yarn] + ^+ trie + ?~ yarn + trie + |- + ?~ t.yarn + trie(kid (~(del by kid.trie) i.yarn)) + =/ son (~(get by kid.trie) i.yarn) + ?~ son + trie + %= trie + kid + %+ ~(put by kid.trie) i.yarn + $(trie u.son, yarn t.yarn) + == +:: +++ tap-yarn + =| =yarn + |= =trie + ^- (list [=^yarn =thread-form]) + %+ welp + ?~ yarn + ~ + [(flop yarn) thread-form.trie]~ + =/ kids ~(tap by kid.trie) + |- ^- (list [=^yarn =thread-form]) + ?~ kids + ~ + =/ next-1 ^$(yarn [p.i.kids yarn], trie q.i.kids) + =/ next-2 $(kids t.kids) + (welp next-1 next-2) +-- +:: +^- agent:gall +=| =state +=< + %+ verb | + |_ =bowl:gall + +* this . + spider-core +> + sc ~(. spider-core bowl) + def ~(. (default-agent this %|) bowl) + :: + ++ on-init on-init:def + ++ on-save clean-state:sc + ++ on-load + |= old-state=vase + =+ !<(=clean-slate old-state) + =. tid.state tid.clean-slate + =/ yarns=(list yarn) + %+ welp running.clean-slate + ~(tap in ~(key by starting.clean-slate)) + |- ^- (quip card _this) + ?~ yarns + `this + =^ cards-1 state + (handle-stop-thread:sc (yarn-to-tid i.yarns) |) + =^ cards-2 this + $(yarns t.yarns) + [(weld cards-1 cards-2) this] + :: + ++ on-poke + |= [=mark =vase] + ^- (quip card _this) + =^ cards state + ?+ mark (on-poke:def mark vase) + %spider-input (on-poke-input:sc !<(input vase)) + %spider-start (handle-start-thread:sc !<(start-args vase)) + %spider-stop (handle-stop-thread:sc !<([tid ?] vase)) + == + [cards this] + :: + ++ on-watch + |= =path + ^- (quip card _this) + =^ cards state + ?+ path (on-watch:def path) + [%thread @ *] (on-watch:sc t.path) + [%thread-result @ ~] (on-watch-result:sc i.t.path) + == + [cards this] + :: + ++ on-leave on-leave:def + ++ on-peek + |= =path + ^- (unit (unit cage)) + ?+ path (on-peek:def path) + [%x %tree ~] + ``noun+!>((turn (tap-yarn running.state) head)) + :: + [%x %starting @ ~] + ``noun+!>((has-yarn running.state (~(got by tid.state) i.t.t.path))) + :: + [%x %saxo @ ~] + ``noun+!>((~(got by tid.state) i.t.t.path)) + == + :: + ++ on-agent + |= [=wire =sign:agent:gall] + ^- (quip card _this) + =^ cards state + ?+ wire !! + [%thread @ *] (on-agent:sc i.t.wire t.t.wire sign) + == + [cards this] + :: + ++ on-arvo + |= [=wire =sign-arvo] + ^- (quip card _this) + =^ cards state + ?+ wire (on-arvo:def wire sign-arvo) + [%thread @ *] (handle-sign:sc i.t.wire t.t.wire sign-arvo) + [%build @ ~] (handle-build:sc i.t.wire sign-arvo) + == + [cards this] + :: On unexpected failure, kill all outstanding strands + :: + ++ on-fail + |= [=term =tang] + ^- (quip card _this) + %- (slog leaf+"spider crashed, killing all strands: {}" tang) + (on-load on-save) + -- +:: +|_ =bowl:gall +++ on-poke-input + |= input + =/ yarn (~(got by tid.state) tid) + (take-input yarn ~ %poke cage) +:: +++ on-watch + |= [=tid =path] + (take-input (~(got by tid.state) tid) ~ %watch path) +:: +++ on-watch-result + |= =tid + ^- (quip card ^state) + `state +:: +++ handle-sign + |= [=tid =wire =sign-arvo] + =/ yarn (~(get by tid.state) tid) + ?~ yarn + %- (slog leaf+"spider got sign for non-existent {}" ~) + `state + (take-input u.yarn ~ %sign wire sign-arvo) +:: +++ on-agent + |= [=tid =wire =sign:agent:gall] + =/ yarn (~(get by tid.state) tid) + ?~ yarn + %- (slog leaf+"spider got agent for non-existent {}" ~) + `state + (take-input u.yarn ~ %agent wire sign) +:: +++ handle-start-thread + |= [parent-tid=(unit tid) use=(unit tid) file=term =vase] + ^- (quip card ^state) + =/ parent-yarn=yarn + ?~ parent-tid + / + (~(got by tid.state) u.parent-tid) + =/ new-tid (fall use (scot %uv (sham eny.bowl))) + =/ =yarn (snoc parent-yarn new-tid) + :: + ?: (has-yarn running.state yarn) + ~| [%already-started yarn] + !! + ?: (~(has by starting.state) yarn) + ~| [%already-starting yarn] + !! + :: + =: starting.state (~(put by starting.state) yarn [%build vase]) + tid.state (~(put by tid.state) new-tid yarn) + == + :: TODO: - to / transformation + =/ =card + :+ %pass /build/[new-tid] + =/ =riff:clay [%home ~ %sing %a da+now.bowl /ted/[file]/hoon] + [%arvo %c %warp our.bowl riff] + [[card ~] state] +:: +++ handle-build + |= [=tid =sign-arvo] + ^- (quip card ^state) + =/ =yarn (~(got by tid.state) tid) + =. starting.state + (~(jab by starting.state) yarn |=([=trying =vase] [%none vase])) + ?> ?=([?(%b %c) %writ *] sign-arvo) + =/ =riot:clay p.sign-arvo + ?~ riot + (thread-fail-not-running tid %build-thread-error *tang) + ?. ?=(%noun p.r.u.riot) + (thread-fail-not-running tid %build-thread-strange >u.riot< ~) + =/ maybe-thread (mule |.(!<(thread q.r.u.riot))) + ?: ?=(%| -.maybe-thread) + (thread-fail-not-running tid %thread-not-thread ~) + (start-thread yarn p.maybe-thread) +:: +++ start-thread + |= [=yarn =thread] + ^- (quip card ^state) + =/ =vase vase:(~(got by starting.state) yarn) + ?< (has-yarn running.state yarn) + =/ m (strand ,^vase) + =/ res (mule |.((thread vase))) + ?: ?=(%| -.res) + (thread-fail-not-running (yarn-to-tid yarn) %false-start p.res) + =/ =eval-form:eval:m + (from-form:eval:m p.res) + =: starting.state (~(del by starting.state) yarn) + running.state (put-yarn running.state yarn eval-form) + == + (take-input yarn ~) +:: +++ handle-stop-thread + |= [=tid nice=?] + ^- (quip card ^state) + =/ =yarn (~(got by tid.state) tid) + ?: (has-yarn running.state yarn) + ?: nice + (thread-done yarn *vase) + (thread-fail yarn %cancelled ~) + ?: (~(has by starting.state) yarn) + (thread-fail-not-running tid %stopped-before-started ~) + ~& [%thread-not-started yarn] + ?: nice + (thread-done yarn *vase) + (thread-fail yarn %cancelled ~) +:: +++ take-input + |= [=yarn input=(unit input:strand)] + ^- (quip card ^state) + =/ m (strand ,vase) + ?. (has-yarn running.state yarn) + %- (slog leaf+"spider got input for non-existent {} 2" ~) + `state + =/ =eval-form:eval:m + thread-form:(need (get-yarn running.state yarn)) + =| cards=(list card) + |- ^- (quip card ^state) + =^ r=[cards=(list card) =eval-result:eval:m] eval-form + =/ out + %- mule |. + (take:eval:m eval-form (convert-bowl yarn bowl) input) + ?- -.out + %& p.out + %| [[~ [%fail %crash p.out]] eval-form] + == + =. running.state (put-yarn running.state yarn eval-form) + =/ =tid (yarn-to-tid yarn) + =. cards.r + %+ turn cards.r + |= =card + ^- ^card + ?+ card card + [%pass * *] [%pass [%thread tid p.card] q.card] + [%give ?(%fact %kick) *] + =- card(paths.p -) + %+ turn paths.p.card + |= =path + ^- ^path + [%thread tid path] + == + =. cards (weld cards cards.r) + =^ final-cards=(list card) state + ?- -.eval-result.r + %next `state + %fail (thread-fail yarn err.eval-result.r) + %done (thread-done yarn value.eval-result.r) + == + [(weld cards final-cards) state] +:: +++ thread-fail-not-running + |= [=tid =term =tang] + =/ =yarn (~(got by tid.state) tid) + :- (thread-say-fail tid term tang) + state(starting (~(del by starting.state) yarn)) +:: +++ thread-say-fail + |= [=tid =term =tang] + ^- (list card) + :~ [%give %fact ~[/thread-result/[tid]] %thread-fail !>([term tang])] + [%give %kick ~[/thread-result/[tid]] ~] + == +:: +++ thread-fail + |= [=yarn =term =tang] + ^- (quip card ^state) + :: %- (slog leaf+"strand {} failed" leaf+ tang) + =/ =tid (yarn-to-tid yarn) + =/ fail-cards (thread-say-fail tid term tang) + =^ cards state (thread-clean yarn) + [(weld fail-cards cards) state] +:: +++ thread-done + |= [=yarn =vase] + ^- (quip card ^state) + :: %- (slog leaf+"strand {} finished" (sell vase) ~) + =/ =tid (yarn-to-tid yarn) + =/ done-cards=(list card) + :~ [%give %fact ~[/thread-result/[tid]] %thread-done vase] + [%give %kick ~[/thread-result/[tid]] ~] + == + =^ cards state (thread-clean yarn) + [(weld done-cards cards) state] +:: +++ thread-clean + |= =yarn + ^- (quip card ^state) + =/ children=(list ^yarn) + [yarn (get-yarn-children running.state yarn)] + |- ^- (quip card ^state) + ?~ children + `state + =^ cards-children state $(children t.children) + =^ cards-our state + =/ =^yarn i.children + =/ =tid (yarn-to-tid yarn) + =: running.state (del-yarn running.state yarn) + tid.state (~(del by tid.state) tid) + == + :_ state + %+ murn ~(tap by wex.bowl) + |= [[=wire =ship =term] [acked=? =path]] + ^- (unit card) + ?. ?& ?=([%thread @ *] wire) + =(tid i.t.wire) + == + ~ + `[%pass wire %agent [ship term] %leave ~] + [(welp cards-children cards-our) state] +:: +++ convert-bowl + |= [=yarn =bowl:gall] + ^- bowl:spider + :* our.bowl + src.bowl + (yarn-to-tid yarn) + (yarn-to-parent yarn) + wex.bowl + sup.bowl + eny.bowl + now.bowl + byk.bowl + == +:: +++ yarn-to-tid + |= =yarn + ^- tid + =/ nary (flop yarn) + ?> ?=([@ *] nary) + i.nary +:: +++ yarn-to-parent + |= =yarn + ^- (unit tid) + =/ nary (flop yarn) + ?> ?=([@ *] nary) + ?~ t.nary + ~ + `i.t.nary +:: +++ clean-state + !> ^- clean-slate + state(running (turn (tap-yarn running.state) head)) +-- diff --git a/pkg/arvo/ted/tree.hoon b/pkg/arvo/ted/tree.hoon new file mode 100644 index 000000000..63dec6e08 --- /dev/null +++ b/pkg/arvo/ted/tree.hoon @@ -0,0 +1,11 @@ +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<([pax=path ~] arg) +;< bek=beak bind:m get-beak:strandio +;< paz=(list path) bind:m (list-tree:strandio bek (flop pax)) +(pure:m !>(paz)) From d1df818453ba3871fe917d16f8a10b37db547251 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 19 Apr 2020 23:25:46 -0400 Subject: [PATCH 043/280] :spider2 works with ford-fusion --- pkg/arvo/app/spider2.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/spider2.hoon b/pkg/arvo/app/spider2.hoon index 5e2744390..1a075ea3f 100644 --- a/pkg/arvo/app/spider2.hoon +++ b/pkg/arvo/app/spider2.hoon @@ -12,7 +12,7 @@ $~ [*thread-form ~] [=thread-form kid=(map tid trie)] :: -+$ trying ?(%find %build %none) ++$ trying ?(%build %none) +$ state $: starting=(map yarn [=trying =vase]) running=trie @@ -258,13 +258,14 @@ =/ =yarn (~(got by tid.state) tid) =. starting.state (~(jab by starting.state) yarn |=([=trying =vase] [%none vase])) + ~| sign+[- +<]:sign-arvo ?> ?=([?(%b %c) %writ *] sign-arvo) =/ =riot:clay p.sign-arvo ?~ riot (thread-fail-not-running tid %build-thread-error *tang) - ?. ?=(%noun p.r.u.riot) - (thread-fail-not-running tid %build-thread-strange >u.riot< ~) - =/ maybe-thread (mule |.(!<(thread q.r.u.riot))) + ?. ?=(%vase p.r.u.riot) + (thread-fail-not-running tid %build-thread-strange >[p q]:u.riot< ~) + =/ maybe-thread (mule |.(!<(thread !<(vase q.r.u.riot)))) ?: ?=(%| -.maybe-thread) (thread-fail-not-running tid %thread-not-thread ~) (start-thread yarn p.maybe-thread) From f3544067afa7678f20edf3109e1f8a8d207091e2 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 20 Apr 2020 01:33:29 -0400 Subject: [PATCH 044/280] -test: full path syntax --- pkg/arvo/lib/strandio.hoon | 15 ++++++++++++++ pkg/arvo/ted/test.hoon | 42 ++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 39aa2b0bc..dcd67c2f3 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -543,6 +543,21 @@ ;< ~ bind:m (send-raw-card %pass /warp %arvo %c %warp ship riff) (take-writ /warp) :: +++ read-file + |= [[=ship =desk =case:clay] =spur] + =* arg +< + =/ m (strand ,cage) + ;< =riot:clay bind:m (warp ship desk ~ %sing %x case (flop spur)) + ?~ riot + (strand-fail %read-file >arg< ~) + (pure:m r.u.riot) +:: +++ check-for-file + |= [[=ship =desk =case:clay] =spur] + =/ m (strand ,?) + ;< =riot:clay bind:m (warp ship desk ~ %sing %x case (flop spur)) + (pure:m ?=(^ riot)) +:: ++ list-tree |= [[=ship =desk =case:clay] =spur] =* arg +< diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index 420483bab..1c1563b22 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -71,6 +71,30 @@ ++ has-test-prefix |= a=term ^- ? =((end 3 5 a) 'test-') +:: +++ find-test-files + =| fiz=(set [=spur test=(unit term)]) + =/ m (strand ,_fiz) + |= [bek=beak paz=(list path)] + ^- form:m + =* loop $ + ?~ paz + (pure:m fiz) + =/ xap=path (flop i.paz) + ;< hav=? bind:m (check-for-file:strandio bek hoon+xap) + ?: hav + loop(paz t.paz, fiz (~(put in fiz) [hoon+xap ~])) + ;< fez=(list path) bind:m (list-tree:strandio bek xap) + ?. =(~ fez) + =/ foz (turn fez |=(path [(flop +<) ~])) + loop(paz t.paz, fiz (~(gas in fiz) foz)) + ~| bad-test-path+i.paz + =/ tex=term =-(?>(((sane %tas) -) -) (head xap)) + =/ xup=path (tail xap) + ;< hov=? bind:m (check-for-file:strandio bek hoon+xup) + ?. hov + ~|(no-tests-at-path+paz !!) + loop(paz t.paz, fiz (~(put in fiz) [hoon+xup `tex])) -- ^- thread:spider |= arg=vase @@ -78,13 +102,23 @@ ^- form:m =/ paz=(list path) (turn !<((list path) arg) |=(path [%tests +<])) ;< bek=beak bind:m get-beak:strandio +;< fiz=(set [=spur test=(unit term)]) bind:m (find-test-files bek paz) +=> .(fiz ~(tap in fiz)) =| test-arms=(map path (list test-arm)) |- ^- form:m =* gather-tests $ -?^ paz - ;< cor=vase bind:m (build-file:strandio bek hoon+(flop i.paz)) - =. test-arms (~(put by test-arms) i.paz (get-test-arms cor)) - gather-tests(paz t.paz) +?^ fiz + ~> %slog.0^leaf+"test: building {(spud (flop spur.i.fiz))}" + ;< cor=vase bind:m (build-file:strandio bek spur.i.fiz) + =/ arms=(list test-arm) (get-test-arms cor) + =? arms ?=(^ test.i.fiz) + |- ^+ arms + ?~ arms ~|(no-test-arm+i.fiz !!) + ?: =(name.i.arms u.test.i.fiz) + [i.arms]~ + $(arms t.arms) + =. test-arms (~(put by test-arms) (flop (tail spur.i.fiz)) arms) + gather-tests(fiz t.fiz) %- pure:m !> ^= ok %+ roll (resolve-test-paths test-arms) |= [[=path =test-func] ok=_`?`%&] From acaf5a12cfa0db8b19dcb754fec1c3101a6bb639 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 20 Apr 2020 02:41:20 -0400 Subject: [PATCH 045/280] -test: all tests pass; fixed clay +get-fit --- pkg/arvo/sys/vane/clay.hoon | 69 +++++++++++++++--------- pkg/arvo/tests/sys/vane/clay.hoon | 10 ++-- pkg/arvo/tests/sys/zuse/ordered-map.hoon | 3 +- 3 files changed, 51 insertions(+), 31 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index a073376ea..b6cdc34d1 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2638,28 +2638,46 @@ ?~ kid=(~(get by dir.nak) i.path) ~ $(nak u.kid, path t.path) - :: +get-fit: produce file at path with /'s maybe converted to -'s + :: +get-fit: produce path with suffix /'s maybe converted to -'s :: ++ get-fit - |= pax=path + |= [pre=@tas pax=@tas] ^- (unit path) - :: add the hoon extension to the result - :: - =- ?~(- ~ `(snoc u.- %hoon)) - |- ^- (unit path) - ?> ?=([* * ~] pax) - :: put the prefix back on the result - :: - =- ?~(- ~ `[i.pax u.-]) - =. nak (~(got by dir.nak) i.pax) - ?^ got=(get (snoc t.pax %hoon)) - (some t.pax) - =/ seg=tape (trip i.t.pax) - ?~ dex=(find "-" seg) + ?~ nuk=(~(get by dir.nak) pre) ~ - =/ hed (crip (scag u.dex seg)) - =/ tal (crip (slag +(u.dex) seg)) - $(pax /[hed]/[tal]) + =. nak u.nuk + =/ paz (segments pax) + |- ^- (unit path) + ?~ paz ~ + =/ pax (snoc i.paz %hoon) + ?^ (get pax) + `[pre pax] + $(paz t.paz) + :: +segments: compute all paths from :path-part, replacing some `/`s with `-`s + :: + :: For example, when passed a :path-part of 'foo-bar-baz', + :: the product will contain: + :: ``` + :: dojo> (segments 'foo-bar-baz') + :: ~[/foo/bar/baz /foo/bar-baz /foo-bar/baz /foo-bar-baz] + :: ``` + :: + ++ segments + |= suffix=@tas + ^- (list path) + =/ parser + (most hep (cook crip ;~(plug low (star ;~(pose low nud))))) + =/ torn=(list @tas) (fall (rush suffix parser) ~[suffix]) + |- ^- (list (list @tas)) + ?< ?=(~ torn) + ?: ?=([@ ~] torn) + ~[torn] + %- zing + %+ turn $(torn t.torn) + |= s=(list @tas) + ^- (list (list @tas)) + ?> ?=(^ s) + ~[[i.torn s] [(crip "{(trip i.torn)}-{(trip i.s)}") t.s]] -- ++ with-face |=([face=@tas =vase] vase(p [%face face p.vase])) ++ with-faces @@ -2757,7 +2775,7 @@ =^ top stack.nub pop-stack =. marks.cache.nub (~(put by marks.cache.nub) mak [dais.res top]) [dais.res nub] - =^ cor=vase nub (build-fit /mar/[mak]) + =^ cor=vase nub (build-fit %mar mak) =/ gad=vase (slap cor %limb %grad) ?@ q.gad =+ !<(mok=mark gad) @@ -2852,7 +2870,7 @@ [tube.res nub] :: try +grow :: - =^ old=vase nub (build-fit /mar/[a]) + =^ old=vase nub (build-fit %mar a) =/ row (mule |.((slap old (ream (cat 3 b ':grow'))))) ?: ?=(%& -.row) :_ nub @@ -2864,7 +2882,7 @@ (ream (cat 3 b ':~(grow old sam)')) :: try direct +grab :: - =^ new=vase nub (build-fit /mar/[b]) + =^ new=vase nub (build-fit %mar b) =/ rab (mule |.((slap new (ream (cat 3 a ':grab'))))) ?: &(?=(%& -.rab) ?=(^ q.p.rab)) :_(nub |=(sam=vase (slam p.rab sam))) @@ -3061,7 +3079,7 @@ |= [sut=vase wer=?(%lib %sur) taz=(list taut)] ^- [vase state] ?~ taz [sut nub] - =^ pin=vase nub (build-fit /[wer]/[pax.i.taz]) + =^ pin=vase nub (build-fit wer pax.i.taz) =? p.pin ?=(^ face.i.taz) [%face u.face.i.taz p.pin] $(sut (slop pin sut), taz t.taz) :: @@ -3084,11 +3102,14 @@ ++ run-reef ^- [vase state] [!>(..zuse) nub] :: TODO implement + :: +build-fit: build file at path, maybe converting '-'s to '/'s in path + :: + :: TODO: traverses the $ankh twice; could be optimized :: ++ build-fit - |= pax=path + |= [pre=@tas pax=@tas] ^- [vase state] - (build-file ~|(no-file+pax (need (~(get-fit an ankh) pax)))) + (build-file ~|(no-file+pax (need (~(get-fit an ankh) [pre pax])))) -- -- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 0edfc6095..5575973f9 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -17,17 +17,17 @@ =/ =ankh:clay :- fil=~ %- ~(gas by *(map @tas ankh:clay)) - :~ :+ %mar fil=~ + :~ :+ %lib fil=~ %- ~(gas by *(map @tas ankh:clay)) - :~ :+ %foo fil=~ + :~ :+ %language-server fil=~ %- ~(gas by *(map @tas ankh:clay)) - :~ :+ %bar fil=~ + :~ :+ %json fil=~ %- ~(gas by *(map @tas ankh:clay)) :~ :+ %hoon fil=`[*lobe:clay hoon+!>('baz')] dir=~ == == == == %+ expect-eq - !> `(unit path)`[~ /mar/foo/bar/hoon] - !> (~(get-fit an:fusion ankh) /mar/foo-bar) + !> `(unit path)`[~ /lib/language-server/json/hoon] + !> (~(get-fit an:fusion ankh) %lib %language-server-json) :: ++ test-parse-pile ^- tang %+ expect-eq diff --git a/pkg/arvo/tests/sys/zuse/ordered-map.hoon b/pkg/arvo/tests/sys/zuse/ordered-map.hoon index 02851e339..7764dc05b 100644 --- a/pkg/arvo/tests/sys/zuse/ordered-map.hoon +++ b/pkg/arvo/tests/sys/zuse/ordered-map.hoon @@ -1,8 +1,7 @@ :: TODO: move +ordered-map to zuse :: /+ *test -/= ames /: /===/sys/vane/ames - /!noun/ +/= ames /sys/vane/ames :: =/ items-from-keys |= keys=(list @ud) From ddc5b9e3f6baf0291e83da0f59bd41b83bee46e2 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 20 Apr 2020 22:55:40 -0400 Subject: [PATCH 046/280] kiln: fix |goad-gall --- pkg/arvo/lib/hood/kiln.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index f6e36ea1e..9c96ab7be 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -210,7 +210,7 @@ %kiln-keep-ford =;(f (f !<(_+<.f vase)) poke-keep-ford) %kiln-autoload =;(f (f !<(_+<.f vase)) poke-autoload) %kiln-overload =;(f (f !<(_+<.f vase)) poke-overload) - %kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-overload) + %kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-goad-gall) %kiln-wash-gall =;(f (f !<(_+<.f vase)) poke-wash-gall) %kiln-unmount =;(f (f !<(_+<.f vase)) poke-unmount) %kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync) From 8b4ad9bfc973826daf8d2661647cbe9ebaee2212 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 21 Apr 2020 00:22:54 -0400 Subject: [PATCH 047/280] :spider2 works with threads in subfolders --- pkg/arvo/app/spider2.hoon | 7 ++++--- pkg/arvo/sys/vane/clay.hoon | 25 ------------------------ pkg/arvo/sys/zuse.hoon | 39 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/pkg/arvo/app/spider2.hoon b/pkg/arvo/app/spider2.hoon index 1a075ea3f..3a3dca541 100644 --- a/pkg/arvo/app/spider2.hoon +++ b/pkg/arvo/app/spider2.hoon @@ -245,11 +245,12 @@ =: starting.state (~(put by starting.state) yarn [%build vase]) tid.state (~(put by tid.state) new-tid yarn) == - :: TODO: - to / transformation + =/ pax=path + ~| no-file-for-thread+file + (need (get-fit:clay [our q.byk da+now]:bowl %ted file)) =/ =card :+ %pass /build/[new-tid] - =/ =riff:clay [%home ~ %sing %a da+now.bowl /ted/[file]/hoon] - [%arvo %c %warp our.bowl riff] + [%arvo %c %warp our.bowl %home ~ %sing %a da+now.bowl pax] [[card ~] state] :: ++ handle-build diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index b6cdc34d1..7f7fa11ae 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2653,31 +2653,6 @@ ?^ (get pax) `[pre pax] $(paz t.paz) - :: +segments: compute all paths from :path-part, replacing some `/`s with `-`s - :: - :: For example, when passed a :path-part of 'foo-bar-baz', - :: the product will contain: - :: ``` - :: dojo> (segments 'foo-bar-baz') - :: ~[/foo/bar/baz /foo/bar-baz /foo-bar/baz /foo-bar-baz] - :: ``` - :: - ++ segments - |= suffix=@tas - ^- (list path) - =/ parser - (most hep (cook crip ;~(plug low (star ;~(pose low nud))))) - =/ torn=(list @tas) (fall (rush suffix parser) ~[suffix]) - |- ^- (list (list @tas)) - ?< ?=(~ torn) - ?: ?=([@ ~] torn) - ~[torn] - %- zing - %+ turn $(torn t.torn) - |= s=(list @tas) - ^- (list (list @tas)) - ?> ?=(^ s) - ~[[i.torn s] [(crip "{(trip i.torn)}-{(trip i.s)}") t.s]] -- ++ with-face |=([face=@tas =vase] vase(p [%face face p.vase])) ++ with-faces diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 9bb508da4..f41393eab 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -734,6 +734,45 @@ ++ vale |~(noun sam) ++ volt |~(noun sam) -- + :: + ++ get-fit + |= [bek=beak pre=@tas pax=@tas] + ^- (unit path) + =/ paz (segments pax) + |- ^- (unit path) + ?~ paz + ~ + =/ puz=path (snoc `path`[pre i.paz] %hoon) + =+ .^(=arch cy+[(scot %p p.bek) q.bek (scot r.bek) puz]) + ?^ fil.arch + `puz + $(paz t.paz) + :: +segments: compute all paths from :path-part, replacing some `/`s with `-`s + :: + :: For example, when passed a :path-part of 'foo-bar-baz', + :: the product will contain: + :: ``` + :: dojo> (segments 'foo-bar-baz') + :: ~[/foo-bar-baz /foo-bar/baz /foo/bar-baz /foo/bar/baz] + :: ``` + :: + ++ segments + |= suffix=@tas + ^- (list path) + =/ parser + (most hep (cook crip ;~(plug low (star ;~(pose low nud))))) + =/ torn=(list @tas) (fall (rush suffix parser) ~[suffix]) + %- flop + |- ^- (list (list @tas)) + ?< ?=(~ torn) + ?: ?=([@ ~] torn) + ~[torn] + %- zing + %+ turn $(torn t.torn) + |= s=(list @tas) + ^- (list (list @tas)) + ?> ?=(^ s) + ~[[i.torn s] [(crip "{(trip i.torn)}-{(trip i.s)}") t.s]] -- ::clay :: :::: :::: ++dill :: (1d) console From 69f809ff3e0a9ed7fcd43f8ae51312af4e6d9c63 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 21 Apr 2020 01:05:05 -0400 Subject: [PATCH 048/280] use fusion in :spider --- pkg/arvo/app/dojo.hoon | 8 +++--- pkg/arvo/app/spider.hoon | 61 +++++++++++----------------------------- 2 files changed, 21 insertions(+), 48 deletions(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index a15302951..09ff73f01 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -346,7 +346,7 @@ ?: =(/wool u.pux) :: really shoud stop the thread as well :: - [%pass u.pux %agent [our.hid %spider2] %leave ~] + [%pass u.pux %agent [our.hid %spider] %leave ~] [%pass u.pux %arvo %f %kill ~] :: ++ dy-slam :: call by ford @@ -732,11 +732,11 @@ =. poy `+>+<.$(pux `/wool) =. +>+>.$ %- he-card - [%pass /wool %agent [our.hid %spider2] %watch /thread-result/[tid]] + [%pass /wool %agent [our.hid %spider] %watch /thread-result/[tid]] %- he-card =/ =cage :: also sub [%spider-start !>([~ `tid fil (dy-sore src)])] - [%pass /wool %agent [our.hid %spider2] %poke cage] + [%pass /wool %agent [our.hid %spider] %poke cage] :: ++ dy-make :: build step ^+ +> @@ -925,7 +925,7 @@ ?~ p.sign +>.$ =. +>.$ (he-diff(poy ~) %tan u.p.sign) - (he-card %pass /wool %agent [our.hid %spider2] %leave ~) + (he-card %pass /wool %agent [our.hid %spider] %leave ~) :: %watch-ack ?~ p.sign diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index bb2f434e0..3a3dca541 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -12,7 +12,7 @@ $~ [*thread-form ~] [=thread-form kid=(map tid trie)] :: -+$ trying ?(%find %build %none) ++$ trying ?(%build %none) +$ state $: starting=(map yarn [=trying =vase]) running=trie @@ -182,7 +182,6 @@ =^ cards state ?+ wire (on-arvo:def wire sign-arvo) [%thread @ *] (handle-sign:sc i.t.wire t.t.wire sign-arvo) - [%find @ ~] (handle-find:sc i.t.wire sign-arvo) [%build @ ~] (handle-build:sc i.t.wire sign-arvo) == [cards this] @@ -243,33 +242,15 @@ ~| [%already-starting yarn] !! :: - =: starting.state (~(put by starting.state) yarn [%find vase]) + =: starting.state (~(put by starting.state) yarn [%build vase]) tid.state (~(put by tid.state) new-tid yarn) == + =/ pax=path + ~| no-file-for-thread+file + (need (get-fit:clay [our q.byk da+now]:bowl %ted file)) =/ =card - =/ =schematic:ford [%path [our.bowl %home] %ted file] - [%pass /find/[new-tid] %arvo %f %build live=%.n schematic] - [[card ~] state] -:: -++ handle-find - |= [=tid =sign-arvo] - ^- (quip card ^state) - =/ =yarn (~(got by tid.state) tid) - =. starting.state - (~(jab by starting.state) yarn |=([=trying =vase] [%none vase])) - ?> ?=([%f %made *] sign-arvo) - ?: ?=(%incomplete -.result.sign-arvo) - (thread-fail-not-running tid %find-thread-incomplete tang.result.sign-arvo) - =/ =build-result:ford build-result.result.sign-arvo - ?: ?=(%error -.build-result) - (thread-fail-not-running tid %find-thread-error message.build-result) - ?. ?=([%path *] +.build-result) - (thread-fail-not-running tid %find-thread-strange ~) - =. starting.state - (~(jab by starting.state) yarn |=([=trying =vase] [%build vase])) - =/ =card - =/ =schematic:ford [%core rail.build-result] - [%pass /build/[tid] %arvo %f %build live=%.n schematic] + :+ %pass /build/[new-tid] + [%arvo %c %warp our.bowl %home ~ %sing %a da+now.bowl pax] [[card ~] state] :: ++ handle-build @@ -278,16 +259,14 @@ =/ =yarn (~(got by tid.state) tid) =. starting.state (~(jab by starting.state) yarn |=([=trying =vase] [%none vase])) - ?> ?=([%f %made *] sign-arvo) - ?: ?=(%incomplete -.result.sign-arvo) - (thread-fail-not-running tid %build-thread-incomplete tang.result.sign-arvo) - =/ =build-result:ford build-result.result.sign-arvo - ?: ?=(%error -.build-result) - (thread-fail-not-running tid %build-thread-error message.build-result) - =/ =cage (result-to-cage:ford build-result) - ?. ?=(%noun p.cage) - (thread-fail-not-running tid %build-thread-strange >p.cage< ~) - =/ maybe-thread (mule |.(!<(thread q.cage))) + ~| sign+[- +<]:sign-arvo + ?> ?=([?(%b %c) %writ *] sign-arvo) + =/ =riot:clay p.sign-arvo + ?~ riot + (thread-fail-not-running tid %build-thread-error *tang) + ?. ?=(%vase p.r.u.riot) + (thread-fail-not-running tid %build-thread-strange >[p q]:u.riot< ~) + =/ maybe-thread (mule |.(!<(thread !<(vase q.r.u.riot)))) ?: ?=(%| -.maybe-thread) (thread-fail-not-running tid %thread-not-thread ~) (start-thread yarn p.maybe-thread) @@ -369,14 +348,8 @@ ++ thread-fail-not-running |= [=tid =term =tang] =/ =yarn (~(got by tid.state) tid) - :_ state(starting (~(del by starting.state) yarn)) - %- welp :_ (thread-say-fail tid term tang) - =/ =trying trying:(~(got by starting.state) yarn) - ?- trying - %find [%pass /find/[tid] %arvo %f %kill ~]~ - %build [%pass /build/[tid] %arvo %f %kill ~]~ - %none ~ - == + :- (thread-say-fail tid term tang) + state(starting (~(del by starting.state) yarn)) :: ++ thread-say-fail |= [=tid =term =tang] From e1146a820b95b4bcffaff11e85e5c9ad54c8f4b9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 21 Apr 2020 01:05:56 -0400 Subject: [PATCH 049/280] remove temporary :spider2 agent --- pkg/arvo/app/spider2.hoon | 441 -------------------------------------- 1 file changed, 441 deletions(-) delete mode 100644 pkg/arvo/app/spider2.hoon diff --git a/pkg/arvo/app/spider2.hoon b/pkg/arvo/app/spider2.hoon deleted file mode 100644 index 3a3dca541..000000000 --- a/pkg/arvo/app/spider2.hoon +++ /dev/null @@ -1,441 +0,0 @@ -/- spider -/+ libstrand=strand, default-agent, verb -=, strand=strand:libstrand -|% -+$ card card:agent:gall -+$ thread thread:spider -+$ tid tid:spider -+$ input input:spider -+$ yarn (list tid) -+$ thread-form _*eval-form:eval:(strand ,vase) -+$ trie - $~ [*thread-form ~] - [=thread-form kid=(map tid trie)] -:: -+$ trying ?(%build %none) -+$ state - $: starting=(map yarn [=trying =vase]) - running=trie - tid=(map tid yarn) - == -:: -+$ clean-slate - $: starting=(map yarn [=trying =vase]) - running=(list yarn) - tid=(map tid yarn) - == -:: -+$ start-args - [parent=(unit tid) use=(unit tid) file=term =vase] --- -:: -:: Trie operations -:: -|% -++ get-yarn - |= [=trie =yarn] - ^- (unit =thread-form) - ?~ yarn - `thread-form.trie - =/ son (~(get by kid.trie) i.yarn) - ?~ son - ~ - $(trie u.son, yarn t.yarn) -:: -++ get-yarn-children - |= [=trie =yarn] - ^- (list ^yarn) - ?~ yarn - (turn (tap-yarn trie) head) - =/ son (~(get by kid.trie) i.yarn) - ?~ son - ~ - $(trie u.son, yarn t.yarn) -:: -:: -++ has-yarn - |= [=trie =yarn] - !=(~ (get-yarn trie yarn)) -:: -++ put-yarn - |= [=trie =yarn =thread-form] - ^+ trie - ?~ yarn - trie(thread-form thread-form) - =/ son (~(gut by kid.trie) i.yarn [*^thread-form ~]) - %= trie - kid - %+ ~(put by kid.trie) i.yarn - $(trie son, yarn t.yarn) - == -:: -++ del-yarn - |= [=trie =yarn] - ^+ trie - ?~ yarn - trie - |- - ?~ t.yarn - trie(kid (~(del by kid.trie) i.yarn)) - =/ son (~(get by kid.trie) i.yarn) - ?~ son - trie - %= trie - kid - %+ ~(put by kid.trie) i.yarn - $(trie u.son, yarn t.yarn) - == -:: -++ tap-yarn - =| =yarn - |= =trie - ^- (list [=^yarn =thread-form]) - %+ welp - ?~ yarn - ~ - [(flop yarn) thread-form.trie]~ - =/ kids ~(tap by kid.trie) - |- ^- (list [=^yarn =thread-form]) - ?~ kids - ~ - =/ next-1 ^$(yarn [p.i.kids yarn], trie q.i.kids) - =/ next-2 $(kids t.kids) - (welp next-1 next-2) --- -:: -^- agent:gall -=| =state -=< - %+ verb | - |_ =bowl:gall - +* this . - spider-core +> - sc ~(. spider-core bowl) - def ~(. (default-agent this %|) bowl) - :: - ++ on-init on-init:def - ++ on-save clean-state:sc - ++ on-load - |= old-state=vase - =+ !<(=clean-slate old-state) - =. tid.state tid.clean-slate - =/ yarns=(list yarn) - %+ welp running.clean-slate - ~(tap in ~(key by starting.clean-slate)) - |- ^- (quip card _this) - ?~ yarns - `this - =^ cards-1 state - (handle-stop-thread:sc (yarn-to-tid i.yarns) |) - =^ cards-2 this - $(yarns t.yarns) - [(weld cards-1 cards-2) this] - :: - ++ on-poke - |= [=mark =vase] - ^- (quip card _this) - =^ cards state - ?+ mark (on-poke:def mark vase) - %spider-input (on-poke-input:sc !<(input vase)) - %spider-start (handle-start-thread:sc !<(start-args vase)) - %spider-stop (handle-stop-thread:sc !<([tid ?] vase)) - == - [cards this] - :: - ++ on-watch - |= =path - ^- (quip card _this) - =^ cards state - ?+ path (on-watch:def path) - [%thread @ *] (on-watch:sc t.path) - [%thread-result @ ~] (on-watch-result:sc i.t.path) - == - [cards this] - :: - ++ on-leave on-leave:def - ++ on-peek - |= =path - ^- (unit (unit cage)) - ?+ path (on-peek:def path) - [%x %tree ~] - ``noun+!>((turn (tap-yarn running.state) head)) - :: - [%x %starting @ ~] - ``noun+!>((has-yarn running.state (~(got by tid.state) i.t.t.path))) - :: - [%x %saxo @ ~] - ``noun+!>((~(got by tid.state) i.t.t.path)) - == - :: - ++ on-agent - |= [=wire =sign:agent:gall] - ^- (quip card _this) - =^ cards state - ?+ wire !! - [%thread @ *] (on-agent:sc i.t.wire t.t.wire sign) - == - [cards this] - :: - ++ on-arvo - |= [=wire =sign-arvo] - ^- (quip card _this) - =^ cards state - ?+ wire (on-arvo:def wire sign-arvo) - [%thread @ *] (handle-sign:sc i.t.wire t.t.wire sign-arvo) - [%build @ ~] (handle-build:sc i.t.wire sign-arvo) - == - [cards this] - :: On unexpected failure, kill all outstanding strands - :: - ++ on-fail - |= [=term =tang] - ^- (quip card _this) - %- (slog leaf+"spider crashed, killing all strands: {}" tang) - (on-load on-save) - -- -:: -|_ =bowl:gall -++ on-poke-input - |= input - =/ yarn (~(got by tid.state) tid) - (take-input yarn ~ %poke cage) -:: -++ on-watch - |= [=tid =path] - (take-input (~(got by tid.state) tid) ~ %watch path) -:: -++ on-watch-result - |= =tid - ^- (quip card ^state) - `state -:: -++ handle-sign - |= [=tid =wire =sign-arvo] - =/ yarn (~(get by tid.state) tid) - ?~ yarn - %- (slog leaf+"spider got sign for non-existent {}" ~) - `state - (take-input u.yarn ~ %sign wire sign-arvo) -:: -++ on-agent - |= [=tid =wire =sign:agent:gall] - =/ yarn (~(get by tid.state) tid) - ?~ yarn - %- (slog leaf+"spider got agent for non-existent {}" ~) - `state - (take-input u.yarn ~ %agent wire sign) -:: -++ handle-start-thread - |= [parent-tid=(unit tid) use=(unit tid) file=term =vase] - ^- (quip card ^state) - =/ parent-yarn=yarn - ?~ parent-tid - / - (~(got by tid.state) u.parent-tid) - =/ new-tid (fall use (scot %uv (sham eny.bowl))) - =/ =yarn (snoc parent-yarn new-tid) - :: - ?: (has-yarn running.state yarn) - ~| [%already-started yarn] - !! - ?: (~(has by starting.state) yarn) - ~| [%already-starting yarn] - !! - :: - =: starting.state (~(put by starting.state) yarn [%build vase]) - tid.state (~(put by tid.state) new-tid yarn) - == - =/ pax=path - ~| no-file-for-thread+file - (need (get-fit:clay [our q.byk da+now]:bowl %ted file)) - =/ =card - :+ %pass /build/[new-tid] - [%arvo %c %warp our.bowl %home ~ %sing %a da+now.bowl pax] - [[card ~] state] -:: -++ handle-build - |= [=tid =sign-arvo] - ^- (quip card ^state) - =/ =yarn (~(got by tid.state) tid) - =. starting.state - (~(jab by starting.state) yarn |=([=trying =vase] [%none vase])) - ~| sign+[- +<]:sign-arvo - ?> ?=([?(%b %c) %writ *] sign-arvo) - =/ =riot:clay p.sign-arvo - ?~ riot - (thread-fail-not-running tid %build-thread-error *tang) - ?. ?=(%vase p.r.u.riot) - (thread-fail-not-running tid %build-thread-strange >[p q]:u.riot< ~) - =/ maybe-thread (mule |.(!<(thread !<(vase q.r.u.riot)))) - ?: ?=(%| -.maybe-thread) - (thread-fail-not-running tid %thread-not-thread ~) - (start-thread yarn p.maybe-thread) -:: -++ start-thread - |= [=yarn =thread] - ^- (quip card ^state) - =/ =vase vase:(~(got by starting.state) yarn) - ?< (has-yarn running.state yarn) - =/ m (strand ,^vase) - =/ res (mule |.((thread vase))) - ?: ?=(%| -.res) - (thread-fail-not-running (yarn-to-tid yarn) %false-start p.res) - =/ =eval-form:eval:m - (from-form:eval:m p.res) - =: starting.state (~(del by starting.state) yarn) - running.state (put-yarn running.state yarn eval-form) - == - (take-input yarn ~) -:: -++ handle-stop-thread - |= [=tid nice=?] - ^- (quip card ^state) - =/ =yarn (~(got by tid.state) tid) - ?: (has-yarn running.state yarn) - ?: nice - (thread-done yarn *vase) - (thread-fail yarn %cancelled ~) - ?: (~(has by starting.state) yarn) - (thread-fail-not-running tid %stopped-before-started ~) - ~& [%thread-not-started yarn] - ?: nice - (thread-done yarn *vase) - (thread-fail yarn %cancelled ~) -:: -++ take-input - |= [=yarn input=(unit input:strand)] - ^- (quip card ^state) - =/ m (strand ,vase) - ?. (has-yarn running.state yarn) - %- (slog leaf+"spider got input for non-existent {} 2" ~) - `state - =/ =eval-form:eval:m - thread-form:(need (get-yarn running.state yarn)) - =| cards=(list card) - |- ^- (quip card ^state) - =^ r=[cards=(list card) =eval-result:eval:m] eval-form - =/ out - %- mule |. - (take:eval:m eval-form (convert-bowl yarn bowl) input) - ?- -.out - %& p.out - %| [[~ [%fail %crash p.out]] eval-form] - == - =. running.state (put-yarn running.state yarn eval-form) - =/ =tid (yarn-to-tid yarn) - =. cards.r - %+ turn cards.r - |= =card - ^- ^card - ?+ card card - [%pass * *] [%pass [%thread tid p.card] q.card] - [%give ?(%fact %kick) *] - =- card(paths.p -) - %+ turn paths.p.card - |= =path - ^- ^path - [%thread tid path] - == - =. cards (weld cards cards.r) - =^ final-cards=(list card) state - ?- -.eval-result.r - %next `state - %fail (thread-fail yarn err.eval-result.r) - %done (thread-done yarn value.eval-result.r) - == - [(weld cards final-cards) state] -:: -++ thread-fail-not-running - |= [=tid =term =tang] - =/ =yarn (~(got by tid.state) tid) - :- (thread-say-fail tid term tang) - state(starting (~(del by starting.state) yarn)) -:: -++ thread-say-fail - |= [=tid =term =tang] - ^- (list card) - :~ [%give %fact ~[/thread-result/[tid]] %thread-fail !>([term tang])] - [%give %kick ~[/thread-result/[tid]] ~] - == -:: -++ thread-fail - |= [=yarn =term =tang] - ^- (quip card ^state) - :: %- (slog leaf+"strand {} failed" leaf+ tang) - =/ =tid (yarn-to-tid yarn) - =/ fail-cards (thread-say-fail tid term tang) - =^ cards state (thread-clean yarn) - [(weld fail-cards cards) state] -:: -++ thread-done - |= [=yarn =vase] - ^- (quip card ^state) - :: %- (slog leaf+"strand {} finished" (sell vase) ~) - =/ =tid (yarn-to-tid yarn) - =/ done-cards=(list card) - :~ [%give %fact ~[/thread-result/[tid]] %thread-done vase] - [%give %kick ~[/thread-result/[tid]] ~] - == - =^ cards state (thread-clean yarn) - [(weld done-cards cards) state] -:: -++ thread-clean - |= =yarn - ^- (quip card ^state) - =/ children=(list ^yarn) - [yarn (get-yarn-children running.state yarn)] - |- ^- (quip card ^state) - ?~ children - `state - =^ cards-children state $(children t.children) - =^ cards-our state - =/ =^yarn i.children - =/ =tid (yarn-to-tid yarn) - =: running.state (del-yarn running.state yarn) - tid.state (~(del by tid.state) tid) - == - :_ state - %+ murn ~(tap by wex.bowl) - |= [[=wire =ship =term] [acked=? =path]] - ^- (unit card) - ?. ?& ?=([%thread @ *] wire) - =(tid i.t.wire) - == - ~ - `[%pass wire %agent [ship term] %leave ~] - [(welp cards-children cards-our) state] -:: -++ convert-bowl - |= [=yarn =bowl:gall] - ^- bowl:spider - :* our.bowl - src.bowl - (yarn-to-tid yarn) - (yarn-to-parent yarn) - wex.bowl - sup.bowl - eny.bowl - now.bowl - byk.bowl - == -:: -++ yarn-to-tid - |= =yarn - ^- tid - =/ nary (flop yarn) - ?> ?=([@ *] nary) - i.nary -:: -++ yarn-to-parent - |= =yarn - ^- (unit tid) - =/ nary (flop yarn) - ?> ?=([@ *] nary) - ?~ t.nary - ~ - `i.t.nary -:: -++ clean-state - !> ^- clean-slate - state(running (turn (tap-yarn running.state) head)) --- From 9b0cb85a023ecd18695c2c3b42bd100fcba4a3af Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 21 Apr 2020 18:50:47 -0400 Subject: [PATCH 050/280] gall: clean up API, remove empty caches from state. --- pkg/arvo/lib/hood/drum.hoon | 2 +- pkg/arvo/lib/hood/kiln.hoon | 3 - pkg/arvo/sys/vane/dill.hoon | 2 +- pkg/arvo/sys/vane/gall.hoon | 176 ++++++++++++++++-------------------- pkg/arvo/sys/zuse.hoon | 3 +- 5 files changed, 79 insertions(+), 107 deletions(-) diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 29918fc48..0e65b28c3 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -339,7 +339,7 @@ =. +>.$ (se-text "activated app {(trip p.wel)}/{(trip q.wel)}") %- se-emit(fur (~(put by fur) q.wel ~)) =/ =wire [%drum p.wel q.wel ~] - [%pass wire %arvo %g %conf [our.hid q.wel] our.hid p.wel] + [%pass wire %arvo %g %conf q.wel] :: ++ se-adze :: update connections ^+ . diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 9c96ab7be..bed6538bc 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -211,7 +211,6 @@ %kiln-autoload =;(f (f !<(_+<.f vase)) poke-autoload) %kiln-overload =;(f (f !<(_+<.f vase)) poke-overload) %kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-goad-gall) - %kiln-wash-gall =;(f (f !<(_+<.f vase)) poke-wash-gall) %kiln-unmount =;(f (f !<(_+<.f vase)) poke-unmount) %kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync) %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) @@ -314,8 +313,6 @@ |= [force=? agent=(unit dude:gall)] abet:(emit %pass /kiln %arvo %g %goad force agent) :: -++ poke-wash-gall |=(* abet:(emit %pass /kiln %arvo %g [%wash ~])) -:: ++ done |= {way/wire saw/(unit error:ames)} ~? ?=(^ saw) [%kiln-nack u.saw] diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index a3597c737..66f335c3e 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -362,7 +362,7 @@ =/ myt (flop (fall tem ~)) =/ can (clan:title our) =. tem ~ - =. +> (pass / [%g %conf [[our ram] our %home]]) + =. +> (pass / %g %conf ram) =. +> (sync %home our %base) =? +> ?=(?($earl $duke $king) can) (sync %base (sein our) %kids) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 927f25510..6f25583be 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -55,7 +55,7 @@ ++ state $: :: state version :: - %4 + %5 :: agents by ship :: =agents @@ -102,10 +102,7 @@ :: +running-agent: agent state :: ++ running-agent - $: :: cache - :: - cache=worm - :: control duct + $: :: control duct :: control-duct=duct :: unstopped @@ -280,7 +277,7 @@ :: ++ mo-receive-core ~/ %mo-receive-core - |= [=term =beak =made-result:ford] + |= [dap=term bek=beak =made-result:ford] ^+ mo-core :: ?: ?=([%incomplete *] made-result) @@ -293,59 +290,40 @@ :: =/ =cage (result-to-cage:ford build-result) =/ result-vase q.cage - =/ maybe-agent=(unit running-agent) - (~(get by running.agents.state) term) - :: - ?^ maybe-agent - =/ agent u.maybe-agent(beak beak) + ?^ existing=(~(get by running.agents.state) dap) =. running.agents.state - (~(put by running.agents.state) term agent) + (~(put by running.agents.state) dap u.existing(beak bek)) =/ =routes [disclosing=~ attributing=our] - =/ app (ap-abed:ap term routes) - =. app (ap-reinstall:app result-vase) - ap-abet:app + =/ ap-core (ap-abed:ap dap routes) + =. ap-core (ap-reinstall:ap-core result-vase) + ap-abet:ap-core :: =/ maybe-new-agent (mule |.(!<(agent result-vase))) ?: ?=(%| -.maybe-new-agent) - =/ err [[%leaf "{}: not valid agent"] p.maybe-new-agent] + =/ err [[%leaf "{}: not valid agent"] p.maybe-new-agent] (mo-give %onto %.n err) - =. mo-core (mo-new-agent term beak p.maybe-new-agent) + :: + =. running.agents.state + %+ ~(put by running.agents.state) dap + =/ default-agent *running-agent + default-agent(control-duct hen, beak bek, agent p.maybe-new-agent) + :: =/ old mo-core =/ wag =/ =routes [disclosing=~ attributing=our] - =/ app (ap-abed:ap term routes) - (ap-upgrade-state:app ~) + =/ ap-core (ap-abed:ap dap routes) + (ap-upgrade-state:ap-core ~) :: =/ maybe-tang -.wag - =/ app +.wag + =/ ap-core +.wag ?^ maybe-tang =. mo-core old (mo-give %onto %.n u.maybe-tang) :: - =. mo-core ap-abet:app - =. mo-core (mo-clear-queue term) - =/ =suss [term %boot now] + =. mo-core ap-abet:ap-core + =. mo-core (mo-clear-queue dap) + =/ =suss [dap %boot now] (mo-give %onto [%.y suss]) - :: +mo-new-agent: create a new agent and add it to %gall's state. - :: - :: %gall maintains a collection of running agents. This arm creates a - :: new one with the provided name, beak, and state (held in a vase). - :: - ++ mo-new-agent - |= [=term =beak =agent] - ^+ mo-core - :: - =/ running-agent - =/ default-agent *running-agent - %_ default-agent - control-duct hen - beak beak - agent agent - == - :: - %_ mo-core - running.agents.state (~(put by running.agents.state) term running-agent) - == :: +mo-send-foreign-request: handle local request to .ship :: ++ mo-send-foreign-request @@ -944,7 +922,7 @@ %pass =/ =duct system-duct.agents.state =/ =wire p.card - =/ =neat:agent q.card + =/ =neat q.card =. wire ?: ?=(%agent -.neat) :: remove `our` in next breach after 2019/12 and reflect in @@ -956,13 +934,9 @@ =. wire [%use agent-name wire] =/ =note-arvo - ?- -.neat - %arvo note-arvo.neat - %agent - =/ =task:able - =/ =sock [our ship.neat] - [%deal sock [name deal]:neat] - [%g task] + ?- -.neat + %arvo note-arvo.neat + %agent [%g %deal [our ship.neat] [name deal]:neat] == [duct %pass wire note-arvo]~ == @@ -1486,49 +1460,22 @@ ~| [%gall-call-failed duct q.hic] =/ =task:able ((harden task:able) q.hic) :: - =/ initialised (mo-abed:mo duct) + =/ mo-core (mo-abed:mo duct) ?- -.task - %conf - =/ =dock p.task - =/ =ship p.dock - ?. =(our ship) - ~& [%gall-not-ours ship] - [~ gall-payload] - :: - => (mo-boot:initialised q.dock q.task) - mo-abet - :: + %conf mo-abet:(mo-boot:mo-core dap.task our %home) %deal =/ =sock p.task =/ =term q.task =/ =deal r.task ?. =(q.sock our) ?> =(p.sock our) - => (mo-send-foreign-request:initialised q.sock term deal) - mo-abet - :: - => (mo-handle-local:initialised p.sock term deal) - mo-abet - :: - %goad - mo-abet:(mo-goad:initialised force.task agent.task) - :: - %init - =/ payload gall-payload(system-duct.agents.state duct) - [~ payload] - :: - %trim - :: reuse %wash task to clear caches on memory-pressure - :: - :: XX cancel subscriptions if =(0 trim-priority) ? - :: - ~> %slog.[0 leaf+"gall: trim: clearing caches"] - =/ =move [duct %pass / %g [%wash ~]] - [[move ~] gall-payload] - :: - %vega - [~ gall-payload] + mo-abet:(mo-send-foreign-request:mo-core q.sock term deal) + mo-abet:(mo-handle-local:mo-core p.sock term deal) :: + %goad mo-abet:(mo-goad:mo-core force.task agent.task) + %init [~ gall-payload(system-duct.agents.state duct)] + %trim [~ gall-payload] + %vega [~ gall-payload] %plea =/ =ship ship.task =/ =path path.plea.task @@ -1539,15 +1486,8 @@ =/ agent-name i.t.path :: =/ =ames-request ;;(ames-request noun) - => (mo-handle-ames-request:initialised ship agent-name ames-request) + => (mo-handle-ames-request:mo-core ship agent-name ames-request) mo-abet - :: - %wash - =. running.agents.state - %- ~(run by running.agents.state) - |= =running-agent - running-agent(cache *worm) - [~ gall-payload] :: %wegh =/ blocked @@ -1587,24 +1527,60 @@ =? all-state ?=(%3 -.all-state) (state-3-to-4 all-state) :: - ?> ?=(%4 -.all-state) + =? all-state ?=(%4 -.all-state) + (state-4-to-5 all-state) + :: + ?> ?=(%5 -.all-state) gall-payload(state all-state) :: :: +all-state: upgrade path :: - ++ all-state $%(state-0 state-1 state-2 state-3 ^state) + ++ all-state $%(state-0 state-1 state-2 state-3 state-4 ^state) + :: + ++ state-4-to-5 + |= =state-4 + ^- ^state + %= state-4 + - %5 + running.agents-4 + (~(run by running.agents-4.state-4) |=(running-agent-3 +<+)) + == + :: + ++ state-4 + $: %4 + agents-4=agents-3 :: agents-3 is unchanged in state-4 + == :: ++ state-3-to-4 |= =state-3 - ^- ^state + ^- state-4 %= state-3 - %4 - outstanding.agents ~ + outstanding.agents-3 ~ == :: ++ state-3 $: %3 - =agents + =agents-3 + == + :: + ++ agents-3 + $: system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + running=(map term running-agent-3) + blocked=(map term blocked) + == + :: + ++ running-agent-3 + $: cache=worm + control-duct=duct + live=? + =stats + =subscribers + =agent + =beak + marks=(map duct mark) == :: ++ state-2-to-3 @@ -1615,7 +1591,7 @@ running.agents-2 %- ~(run by running.agents-2.state-2) |= =running-agent-2 - ^- running-agent + ^- running-agent-3 %= running-agent-2 agent-2 (agent-2-to-3 agent-2.running-agent-2) == diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index f41393eab..b2e505927 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1898,14 +1898,13 @@ == :: ++ task :: incoming request $~ [%vega ~] :: - $% [$conf p=dock q=dock] :: configure app + $% [%conf dap=term] :: start agent [$deal p=sock q=term r=deal] :: full transmission [%goad force=? agent=(unit dude)] :: rebuild agent(s) $>(%init vane-task) :: set owner $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade $>(%plea vane-task) :: network request - [%wash ~] :: clear caches $>(%wegh vane-task) :: report memory == :: -- ::able From 3beb6ee65bbc28579dbc5c8ed9986993a6ed68c6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 22 Apr 2020 01:37:12 -0400 Subject: [PATCH 051/280] WIP gall: partial fusion conversion; compiles --- pkg/arvo/sys/vane/gall.hoon | 747 ++++++++++++++---------------- pkg/arvo/tests/sys/vane/gall.hoon | 6 +- 2 files changed, 348 insertions(+), 405 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 6f25583be..71ece1c6b 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -4,14 +4,76 @@ :::: |= pit=vase =, gall -=> =~ +=> |% +:: +move: Arvo-level move +:: ++$ move [=duct move=(wind note-arvo gift-arvo)] +:: +state-5: overall gall state, versioned +:: ++$ state-5 [%5 state] +:: +state: overall gall state +:: +:: system-duct: TODO document +:: outstanding: outstanding request queue +:: contacts: other ships we're in communication with +:: yokes: running agents +:: blocked: moves to agents that haven't been started yet +:: ++$ state + $: system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + yokes=(map term yoke) + blocked=(map term (qeu blocked-move)) + == +:: +watches: subscribers and publications +:: +:: TODO: rename this, to $ties? +:: TODO: rename $boat and $bitt and document +:: ++$ watches [inbound=bitt outbound=boat] +:: +routes: new cuff; TODO: document +:: ++$ routes + $: disclosing=(unit (set ship)) + attributing=ship + == +:: +yoke: agent runner state +:: +:: control-duct: TODO document +:: live: is this agent running? TODO document better +:: stats: TODO document +:: watches: incoming and outgoing subscription state +:: agent: agent core +:: beak: compilation source +:: marks: mark conversion requests +:: ++$ yoke + $: control-duct=duct + live=? + =stats + =watches + =agent + =beak + marks=(map duct mark) + == +:: +blocked-move: enqueued move to an agent +:: ++$ blocked-move [=duct =routes =deal] +:: +stats: statistics +:: +:: change: how many moves this agent has processed +:: eny: entropy +:: time: date of current event processing +:: ++$ stats [change=@ud eny=@uvJ time=@da] :: +ames-response: network response message (%boon) :: :: %d: fact :: %x: quit :: -++ ames-response ++$ ames-response $% [%d =mark noun=*] [%x ~] == @@ -22,7 +84,7 @@ :: %s: watch :: %u: leave :: -++ ames-request ++$ ames-request $% [%m =mark noun=*] [%l =mark =path] [%s =path] @@ -33,7 +95,7 @@ :: Used in wires to identify the kind of remote request we made. :: Bijective with the tags of $ames-request. :: -++ remote-request ++$ remote-request $? %watch %watch-as %poke @@ -41,121 +103,8 @@ %missing == -- -|% -:: +move: Arvo-level move -:: -++ move - $: =duct - move=(wind note-arvo gift-arvo) - == --- -|% -:: +state: all state -:: -++ state - $: :: state version - :: - %5 - :: agents by ship - :: - =agents - == -:: +subscribers: subscriber data -:: -++ subscribers - $: :: incoming subscribers - :: - incoming=bitt - :: outgoing subscribers - :: - outgoing=boat - == -:: +agents: ship state -:: -++ agents - $: :: system duct - :: - system-duct=duct - :: outstanding request queue - :: - outstanding=(map [wire duct] (qeu remote-request)) - :: foreign contacts - :: - contacts=(set ship) - :: running agents - :: - running=(map term running-agent) - :: waiting queue - :: - blocked=(map term blocked) - == -:: +routes: new cuff -:: -++ routes - $: :: disclosing to - :: - disclosing=(unit (set ship)) - :: attributed to - :: - attributing=ship - == -:: +running-agent: agent state -:: -++ running-agent - $: :: control duct - :: - control-duct=duct - :: unstopped - :: - live=? - :: statistics - :: - =stats - :: subscribers - :: - =subscribers - :: agent core - :: - =agent - :: update control - :: - =beak - :: req'd translations - :: - marks=(map duct mark) - == -:: +blocked: blocked tasks -:: -++ blocked (qeu (trel duct routes deal)) -:: +stats: statistics -:: -++ stats - $: :: change number - :: - change=@ud - :: entropy - :: - eny=@uvJ - :: time - :: - time=@da - == --- -. == -=| =state -|= $: :: identity - :: - our=ship - :: urban time - :: - now=@da - :: entropy - :: - eny=@uvJ - :: activate - :: - ski=sley - == +=| state=state-5 +|= [our=ship now=@da eny=@uvJ ski=sley] ~% %gall-top ..is ~ |% :: +gall-payload: gall payload @@ -168,101 +117,47 @@ :: ++ mo ~% %gall-mo +> ~ - |_ - $: hen=duct - moves=(list move) - == + |_ [hen=duct moves=(list move)] + :: +mo-abed: initialise state with the provided duct + :: +mo-abet: finalize, reversing moves + :: +mo-pass: prepend a standard %pass to the current list of moves + :: +mo-give: prepend a standard %give to the current list of moves + :: ++ mo-core . - :: +mo-abed: initialise state with the provided duct. - :: - ++ mo-abed - |= =duct - ^+ mo-core - :: - mo-core(hen duct) - :: +mo-abet: resolve moves. - :: - ++ mo-abet - ^- [(list move) _gall-payload] - :: - =/ resolved (flop moves) - [resolved gall-payload] - :: + ++ mo-abed |=(hun=duct mo-core(hen hun)) + ++ mo-abet [(flop moves) gall-payload] + ++ mo-pass |=(p=[wire note-arvo] mo-core(moves [[hen pass+p] moves])) + ++ mo-give |=(g=gift:able mo-core(moves [[hen give+g] moves])) :: +mo-boot: ask %ford to build us a core for the specified agent. :: ++ mo-boot - |= [=term =ship =desk] + |= [dap=term =ship =desk] ^+ mo-core - :: =/ =case [%da now] - =/ =wire - =/ ship (scot %p ship) - =/ case (scot case) - /sys/cor/[term]/[ship]/[desk]/[case] - :: - =/ =note-arvo - =/ =schematic:ford [%core [ship desk] /hoon/[term]/app] - [%f %build live=%.y schematic] - :: - (mo-pass wire note-arvo) - :: + ?~ pax=(get-fit:clay [ship desk case] %app dap) + (mo-give %onto |+[leaf+"gall: no file for agent {}"]~) + =/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]/(scot case) + (mo-pass wire %c %warp ship desk ~ %sing %a case u.pax) :: +mo-reboot: ask %ford to rebuild the specified agent :: ++ mo-reboot - |= [force=? =term =ship] + |= [dap=term =ship] ^+ mo-core - =/ gent (~(got by running.agents.state) term) - =. hen control-duct.gent + =/ gent (~(got by yokes.state) dap) =* desk q.beak.gent - :: if we're forcing a reboot, we don't try to %kill the old build - :: - ?: force - (mo-boot term ship desk) - :: - =/ =wire - =/ ship (scot %p ship) - =/ case (scot r.beak.gent) - /sys/cor/[term]/[ship]/[desk]/[case] - %. [term ship desk] - =< mo-boot - =/ =note-arvo [%f %kill ~] - (mo-pass wire note-arvo) - :: + (mo-boot:(mo-abed control-duct.gent) dap ship desk) :: +mo-goad: rebuild agent(s) :: ++ mo-goad - |= [force=? agent=(unit dude)] + |= agent=(unit dude) ^+ mo-core ?^ agent ~| goad-gone+u.agent - (mo-reboot force u.agent our) - :: - =/ agents=(list term) - ~(tap in ~(key by running.agents.state)) + (mo-reboot u.agent our) + =/ agents=(list term) ~(tap in ~(key by yokes.state)) |- ^+ mo-core - ?~ agents - mo-core - %= $ - agents t.agents - ..mo-core (mo-reboot force i.agents our) - == - :: - :: +mo-pass: prepend a standard %pass to the current list of moves. - :: - ++ mo-pass - |= pass=(pair wire note-arvo) - ^+ mo-core - :: - =/ =move [hen [%pass pass]] - mo-core(moves [move moves]) - :: +mo-give: prepend a standard %give to the current list of moves. - :: - ++ mo-give - |= =gift:able - ^+ mo-core - :: - =/ =move [hen [%give gift]] - mo-core(moves [move moves]) + ?~ agents mo-core + $(agents t.agents, mo-core (mo-reboot i.agents our)) :: +mo-receive-core: receives an app core built by %ford. :: :: Presuming we receive a good core, we first check to see if the agent @@ -277,36 +172,31 @@ :: ++ mo-receive-core ~/ %mo-receive-core - |= [dap=term bek=beak =made-result:ford] + |= [dap=term bek=beak =rant:clay] ^+ mo-core :: - ?: ?=([%incomplete *] made-result) - (mo-give %onto %.n tang.made-result) + =/ =cage r.rant + ?. =(%vase p.cage) + (mo-give %onto |+[leaf+"gall: bizarre mark {} for agent {}"]~) :: - =/ build-result build-result.made-result - :: - ?: ?=([%error *] build-result) - (mo-give %onto %.n message.build-result) - :: - =/ =cage (result-to-cage:ford build-result) - =/ result-vase q.cage - ?^ existing=(~(get by running.agents.state) dap) - =. running.agents.state - (~(put by running.agents.state) dap u.existing(beak bek)) - =/ =routes [disclosing=~ attributing=our] - =/ ap-core (ap-abed:ap dap routes) - =. ap-core (ap-reinstall:ap-core result-vase) - ap-abet:ap-core - :: - =/ maybe-new-agent (mule |.(!<(agent result-vase))) + =/ maybe-new-agent (mule |.(!<(agent !<(vase q.cage)))) ?: ?=(%| -.maybe-new-agent) =/ err [[%leaf "{}: not valid agent"] p.maybe-new-agent] (mo-give %onto %.n err) + =/ =agent p.maybe-new-agent :: - =. running.agents.state - %+ ~(put by running.agents.state) dap - =/ default-agent *running-agent - default-agent(control-duct hen, beak bek, agent p.maybe-new-agent) + ?^ existing=(~(get by yokes.state) dap) + =. yokes.state + (~(put by yokes.state) dap u.existing(beak bek)) + =/ =routes [disclosing=~ attributing=our] + =/ ap-core (ap-abed:ap dap routes) + =. ap-core (ap-reinstall:ap-core agent) + ap-abet:ap-core + :: + =. yokes.state + %+ ~(put by yokes.state) dap + =/ default-yoke *yoke + default-yoke(control-duct hen, beak bek, agent agent) :: =/ old mo-core =/ wag @@ -348,10 +238,10 @@ =/ =path /ge/[foreign-agent] [%a %plea ship %g path ames-request] :: - =. outstanding.agents.state + =. outstanding.state =/ stand - (~(gut by outstanding.agents.state) [wire hen] *(qeu remote-request)) - (~(put by outstanding.agents.state) [wire hen] (~(put to stand) -.deal)) + (~(gut by outstanding.state) [wire hen] *(qeu remote-request)) + (~(put by outstanding.state) [wire hen] (~(put to stand) -.deal)) (mo-pass wire note-arvo) :: +mo-track-ship: subscribe to ames and jael for notices about .ship :: @@ -360,19 +250,19 @@ ^+ mo-core :: if already contacted, no-op :: - ?: (~(has in contacts.agents.state) ship) + ?: (~(has in contacts.state) ship) mo-core :: first contact; update state and subscribe to notifications :: - =. contacts.agents.state (~(put in contacts.agents.state) ship) + =. contacts.state (~(put in contacts.state) ship) :: ask ames to track .ship's connectivity :: - =. moves [[system-duct.agents.state %pass /sys/lag %a %heed ship] moves] + =. moves [[system-duct.state %pass /sys/lag %a %heed ship] moves] :: ask jael to track .ship's breaches :: =/ =note-arvo [%j %public-keys (silt ship ~)] =. moves - [[system-duct.agents.state %pass /sys/era note-arvo] moves] + [[system-duct.state %pass /sys/era note-arvo] moves] mo-core :: +mo-untrack-ship: cancel subscriptions to ames and jael for .ship :: @@ -381,17 +271,17 @@ ^+ mo-core :: if already canceled, no-op :: - ?. (~(has in contacts.agents.state) ship) + ?. (~(has in contacts.state) ship) mo-core :: delete .ship from state and kill subscriptions :: - =. contacts.agents.state (~(del in contacts.agents.state) ship) + =. contacts.state (~(del in contacts.state) ship) :: - =. moves [[system-duct.agents.state %pass /sys/lag %a %jilt ship] moves] + =. moves [[system-duct.state %pass /sys/lag %a %jilt ship] moves] :: =/ =note-arvo [%j %nuke (silt ship ~)] =. moves - [[system-duct.agents.state %pass /sys/era note-arvo] moves] + [[system-duct.state %pass /sys/era note-arvo] moves] mo-core :: +mo-breach: ship breached, so forget about them :: @@ -399,7 +289,8 @@ |= =ship ^+ mo-core =. mo-core (mo-untrack-ship ship) - =/ agents=(list [name=term =running-agent]) ~(tap by running.agents.state) + =. mo-core (mo-filter-queue ship) + =/ agents=(list [name=term =yoke]) ~(tap by yokes.state) |- ^+ mo-core ?~ agents mo-core @@ -444,14 +335,12 @@ ^+ mo-core :: ?> ?=([%cor @ @ @ @ ~] path) - ?> ?=([%f %made *] sign-arvo) - =/ beak-path t.t.path - =/ =beak - =/ =ship (slav %p i.beak-path) - =/ =desk i.t.beak-path - =/ =case [%da (slav %da i.t.t.beak-path)] - [ship desk case] - (mo-receive-core i.t.path beak result.sign-arvo) + =/ [dap=term her=@ta desk=@ta dat=@ta ~] t.path + =/ =beak [(slav %p her) desk da+(slav da+dat)] + ?> ?=([?(%b %c) %writ *] sign-arvo) + ?^ p.sign-arvo + (mo-receive-core dap beak u.p.sign-arvo) + (mo-give %onto |+[leaf+"gall: failed to build agent {}"]~) :: +mo-handle-sys-lag: handle an ames %clog notification :: ++ mo-handle-sys-lag @@ -461,7 +350,7 @@ ?> ?=([%lag ~] path) ?> ?=([%a %clog *] sign-arvo) :: - =/ agents=(list term) ~(tap in ~(key by running.agents.state)) + =/ agents=(list term) ~(tap in ~(key by yokes.state)) |- ^+ mo-core ?~ agents mo-core :: @@ -587,22 +476,22 @@ :: ?+ sign-arvo !! [%a %done *] - =^ remote-request outstanding.agents.state + =^ remote-request outstanding.state ?~ t.t.t.wire =/ full-wire sys+wire =/ stand - %+ ~(gut by outstanding.agents.state) [full-wire hen] + %+ ~(gut by outstanding.state) [full-wire hen] :: default is do nothing; should only hit if cleared queue :: in +load 3-to-4 :: (~(put to *(qeu remote-request)) %missing) - ~| [full-wire=full-wire hen=hen stand=stand outs=outstanding.agents.state] + ~| [full-wire=full-wire hen=hen stand=stand outs=outstanding.state] =^ rr stand ~(get to stand) - [rr (~(put by outstanding.agents.state) [full-wire hen] stand)] + [rr (~(put by outstanding.state) [full-wire hen] stand)] :: non-null case of wire is old, remove on next breach after :: 2019/12 :: - [;;(remote-request i.t.t.t.wire) outstanding.agents.state] + [;;(remote-request i.t.t.t.wire) outstanding.state] :: =/ err=(unit tang) ?~ error=error.sign-arvo @@ -675,59 +564,125 @@ :: +mo-clear-queue: clear blocked tasks from the specified running agent. :: ++ mo-clear-queue - |= =term + |= dap=term ^+ mo-core - :: - ?. (~(has by running.agents.state) term) + ?. (~(has by yokes.state) dap) mo-core - =/ maybe-blocked (~(get by blocked.agents.state) term) - ?~ maybe-blocked + ?~ maybe-blocked=(~(get by blocked.state) dap) mo-core - :: - =/ =blocked u.maybe-blocked - :: + =/ blocked=(qeu blocked-move) u.maybe-blocked |- ^+ mo-core ?: =(~ blocked) - =/ blocked (~(del by blocked.agents.state) term) - %_ mo-core - blocked.agents.state blocked - == - =^ task blocked [p q]:~(get to blocked) - =/ =duct p.task - =/ =routes q.task - =/ =deal r.task - :: + =. blocked.state (~(del by blocked.state) dap) + mo-core + =^ [=duct =routes =deal] blocked ~(get to blocked) =/ move =/ =sock [attributing.routes our] - =/ card [%slip %g %deal sock term deal] + =/ card [%slip %g %deal sock dap deal] [duct card] $(moves [move moves]) + :: +mo-filter-queue: remove all blocked tasks from ship. + :: + ++ mo-filter-queue + |= =ship + =/ agents=(list [name=term blocked=(qeu blocked-move)]) + ~(tap by blocked.state) + =| new-agents=(map term (qeu blocked-move)) + |- ^+ mo-core + ?~ agents + mo-core(blocked.state new-agents) + =| new-blocked=(qeu blocked-move) + |- ^+ mo-core + ?: =(~ blocked.i.agents) + ?~ new-blocked + ^$(agents t.agents) + %= ^$ + agents t.agents + new-agents (~(put by new-agents) name.i.agents new-blocked) + == + =^ mov=blocked-move blocked.i.agents ~(get to blocked.i.agents) + =? new-blocked !=(ship attributing.routes.mov) + (~(put to new-blocked) mov) + $ :: +mo-beak: assemble a beak for the specified agent. :: ++ mo-beak - |= =term + |= dap=term ^- beak + ?^ yoke=(~(get by yokes.state) dap) + beak.u.yoke + :: XX this fallback is necessary, as .term could be either the source + :: or the destination app. ie, it might not exist locally ... :: - ?~ running=(~(get by running.agents.state) term) - :: XX this fallback is necessary, as .term could be either the source - :: or the destination app. ie, it might not exist locally ... - :: - [our %home %da now] - beak.u.running + [our %home %da now] :: +mo-peek: call to +ap-peek (which is not accessible outside of +mo). :: ++ mo-peek ~/ %mo-peek - |= [agent=term =routes =term =path] + |= [dap=term =routes care=term =path] ^- (unit (unit cage)) :: - =/ app (ap-abed:ap agent routes) - (ap-peek:app term path) + =/ app (ap-abed:ap dap routes) + (ap-peek:app care dap path) :: +mo-apply: apply the supplied action to the specified agent. :: ++ mo-apply |= [agent=term =routes =deal] ^+ mo-core + :: TODO: Remove this horrific hack when ford pinto comes! + => |% + +$ serial @uvH + :: + +$ letter + $% [%text text=cord] + [%url url=cord] + [%code expression=cord output=(list tank)] + [%me narrative=cord] + == + :: + +$ envelope + $: uid=serial + number=@ + author=ship + when=time + =letter + == + :: + +$ config + $: length=@ + read=@ + == + :: + +$ mailbox + $: =config + envelopes=(list envelope) + == + :: + +$ inbox (map path mailbox) + :: + +$ chat-configs (map path config) + :: + +$ chat-base + $% [%create =path] + [%delete =path] + [%message =path =envelope] + [%read =path] + == + :: + +$ chat-action + $% :: %messages: append a list of messages to mailbox + :: + [%messages =path envelopes=(list envelope)] + chat-base + == + :: + +$ chat-update + $% [%keys keys=(set path)] + [%config =path =config] + [%messages =path start=@ud end=@ud envelopes=(list envelope)] + chat-base + == + -- :: =/ =path =/ ship (scot %p attributing.routes) @@ -738,9 +693,23 @@ [p q]:beak :: ?: ?=(%raw-poke -.deal) - =/ =schematic:ford [%vale ship-desk +.deal] - =/ =note-arvo [%f %build live=%.n schematic] - (mo-pass path note-arvo) + :: TODO: Remove this horrific hack when ford pinto comes! + ?+ mark.deal + =/ =schematic:ford [%vale ship-desk +.deal] + =/ =note-arvo [%f %build live=%.n schematic] + (mo-pass path note-arvo) + :: + %chat-action + =/ chat-act=(unit chat-action) ((soft chat-action) noun.deal) + ?~ chat-act + ~& gall-raw-chat-poke-failed+[agent attributing.routes] + mo-core + =/ =cage [%chat-action !>(u.chat-act)] + =/ new-deal=^deal [%poke cage] + =/ app (ap-abed:ap agent routes) + =. app (ap-apply:app new-deal) + ap-abet:app + == :: ?: ?=(%poke-as -.deal) =/ =schematic:ford [%cast ship-desk mark.deal [%$ cage.deal]] @@ -760,19 +729,19 @@ ^+ mo-core :: =/ =routes [disclosing=~ attributing=ship] - =/ is-running (~(has by running.agents.state) agent) - =/ is-blocked (~(has by blocked.agents.state) agent) + =/ is-running (~(has by yokes.state) agent) + =/ is-blocked (~(has by blocked.state) agent) :: ?: |(!is-running is-blocked) - =/ =blocked - =/ waiting (~(get by blocked.agents.state) agent) - =/ deals (fall waiting *blocked) + =/ blocked=(qeu blocked-move) + =/ waiting (~(get by blocked.state) agent) + =/ deals (fall waiting *(qeu blocked-move)) =/ deal [hen routes deal] (~(put to deals) deal) :: %- (slog leaf+"gall: not running {} yet, got {<-.deal>}" ~) %_ mo-core - blocked.agents.state (~(put by blocked.agents.state) agent blocked) + blocked.state (~(put by blocked.state) agent blocked) == (mo-apply agent routes deal) :: +mo-handle-ames-request: handle %ames request message. @@ -800,7 +769,6 @@ ++ mo-handle-ames-response |= =ames-response ^+ mo-core - :: ?- -.ames-response :: %d: diff; ask ford to validate .noun as .mark :: @@ -811,7 +779,6 @@ =/ =note-arvo =/ =disc:ford [our %home] [%f %build live=%.n %vale disc [mark noun]:ames-response] - :: (mo-pass wire note-arvo) :: :: %x: kick; tell agent the publisher canceled the subscription @@ -831,7 +798,7 @@ agent-duct=duct agent-moves=(list move) agent-config=(list (each suss tang)) - current-agent=running-agent + current-agent=yoke == ++ ap-core . :: +ap-abed: initialise state for an agent, with the supplied routes. @@ -844,8 +811,8 @@ |= [=term =routes] ^+ ap-core :: - =/ =running-agent - =/ running (~(got by running.agents.state) term) + =/ =yoke + =/ running (~(got by yokes.state) term) =/ =stats :+ +(change.stats.running) (shaz (mix (add term change.stats.running) eny)) @@ -854,7 +821,7 @@ :: =. agent-name term =. agent-routes routes - =. current-agent running-agent + =. current-agent yoke =. agent-duct hen ap-core :: +ap-abet: resolve moves. @@ -862,15 +829,15 @@ ++ ap-abet ^+ mo-core :: - =/ running (~(put by running.agents.state) agent-name current-agent) + =/ running (~(put by yokes.state) agent-name current-agent) =/ moves =/ giver |=(report=(each suss tang) [hen %give %onto report]) =/ from-suss (turn agent-config giver) :(weld agent-moves from-suss moves) :: %_ mo-core - running.agents.state running - moves moves + yokes.state running + moves moves == :: +ap-from-internal: internal move to move. :: @@ -891,7 +858,7 @@ =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ship.gift) %+ turn ducts |= =duct - ~? &(=(duct system-duct.agents.state) !=(agent-name %hood)) + ~? &(=(duct system-duct.state) !=(agent-name %hood)) [%agent-giving-on-system-duct agent-name -.gift] [duct %give %unto %kick ~] :: @@ -902,7 +869,7 @@ =/ =cage cage.gift %+ turn ducts |= =duct - ~? &(=(duct system-duct.agents.state) !=(agent-name %hood)) + ~? &(=(duct system-duct.state) !=(agent-name %hood)) [%agent-giving-on-system-duct agent-name -.gift] ^- move =/ =mark @@ -920,7 +887,7 @@ [duct %pass path note-arvo] :: %pass - =/ =duct system-duct.agents.state + =/ =duct system-duct.state =/ =wire p.card =/ =neat q.card =. wire @@ -946,7 +913,7 @@ |= =ship ^+ ap-core =/ in=(list [=duct =^ship =path]) - ~(tap by incoming.subscribers.current-agent) + ~(tap by inbound.watches.current-agent) |- ^+ ap-core ?^ in =? ap-core =(ship ship.i.in) @@ -955,13 +922,13 @@ $(in t.in) :: =/ out=(list [[=wire =^ship =term] ? =path]) - ~(tap by outgoing.subscribers.current-agent) + ~(tap by outbound.watches.current-agent) |- ^+ ap-core ?~ out ap-core =? ap-core =(ship ship.i.out) =/ core - =. agent-duct system-duct.agents.state + =. agent-duct system-duct.state =/ way [%out (scot %p ship) term.i.out wire.i.out] (ap-specific-take way %kick ~) core(agent-duct agent-duct) @@ -978,7 +945,7 @@ ^+ ap-core :: =/ in=(list [=duct =^ship =path]) - ~(tap by incoming.subscribers.current-agent) + ~(tap by inbound.watches.current-agent) |- ^+ ap-core ?~ in ap-core :: @@ -1008,7 +975,7 @@ ^- (list duct) ?: &(?=(~ target-path) ?=(~ target-ship)) ~[agent-duct] - %+ murn ~(tap by incoming.subscribers.current-agent) + %+ murn ~(tap by inbound.watches.current-agent) |= [=duct =ship =path] ^- (unit ^duct) ?~ target-ship @@ -1088,8 +1055,8 @@ attributing.agent-routes :: guest agent-name :: agent == :: - :* wex=outgoing.subscribers.current-agent :: outgoing - sup=incoming.subscribers.current-agent :: incoming + :* wex=outbound.watches.current-agent :: outgoing + sup=inbound.watches.current-agent :: incoming == :: :* act=change.stats.current-agent :: tick eny=eny.stats.current-agent :: nonce @@ -1109,25 +1076,15 @@ :: ++ ap-reinstall ~/ %ap-reinstall - |= =vase + |= =agent ^+ ap-core :: - =/ maybe-agent (mule |.(!<(agent vase))) - ?: ?=(%| -.maybe-agent) - (ap-error %new-core-not-agent p.maybe-agent) - :: - =/ prep - =/ =agent p.maybe-agent - =/ running - %- some - ~(on-save agent.current-agent ap-construct-bowl) - =/ installed ap-install(agent.current-agent agent) - (installed running) - :: - =^ maybe-tang ap-core prep - ?~ maybe-tang + =/ old-state=vase ~(on-save agent.current-agent ap-construct-bowl) + =^ error ap-core + (ap-install(agent.current-agent agent) `old-state) + ?~ error ap-core - (ap-error %load-failed u.maybe-tang) + (ap-error %load-failed u.error) :: +ap-subscribe-as: apply %watch-as. :: ++ ap-subscribe-as @@ -1144,8 +1101,8 @@ ^+ ap-core :: =/ incoming [attributing.agent-routes pax] - =. incoming.subscribers.current-agent - (~(put by incoming.subscribers.current-agent) agent-duct incoming) + =. inbound.watches.current-agent + (~(put by inbound.watches.current-agent) agent-duct incoming) :: =^ maybe-tang ap-core %+ ap-ingest %watch-ack |. @@ -1202,26 +1159,26 @@ =/ agent-wire t.t.t.wire :: if subscription ack or close, handle before calling user code :: - =? outgoing.subscribers.current-agent ?=(%kick -.sign) - %- ~(del by outgoing.subscribers.current-agent) + =? outbound.watches.current-agent ?=(%kick -.sign) + %- ~(del by outbound.watches.current-agent) [agent-wire dock] ?: ?& ?=(%watch-ack -.sign) - !(~(has by outgoing.subscribers.current-agent) [agent-wire dock]) + !(~(has by outbound.watches.current-agent) [agent-wire dock]) == %- %: slog leaf+"{}: got ack for nonexistent subscription" leaf+"{}: {}" >wire=wire< - >out=outgoing.subscribers.current-agent< + >out=outbound.watches.current-agent< ~ == ap-core :: - =? outgoing.subscribers.current-agent ?=(%watch-ack -.sign) + =? outbound.watches.current-agent ?=(%watch-ack -.sign) ?^ p.sign - %- ~(del by outgoing.subscribers.current-agent) + %- ~(del by outbound.watches.current-agent) [agent-wire dock] - %+ ~(jab by outgoing.subscribers.current-agent) [agent-wire dock] + %+ ~(jab by outbound.watches.current-agent) [agent-wire dock] |= [acked=? =path] =. . ?. acked @@ -1245,13 +1202,13 @@ :: +ap-install: install wrapper. :: ++ ap-install - |= maybe-vase=(unit vase) + |= old-agent-state=(unit vase) ^- [(unit tang) _ap-core] :: - =^ maybe-tang ap-core (ap-upgrade-state maybe-vase) + =^ maybe-tang ap-core (ap-upgrade-state old-agent-state) :: - =/ new-agent-config - =/ =term ?~(maybe-vase %boot %bump) + =. agent-config + =/ =term ?~(old-agent-state %boot %bump) =/ possibly-suss ?~ maybe-tang =/ =suss [agent-name term now] @@ -1259,10 +1216,7 @@ [%.n u.maybe-tang] [possibly-suss agent-config] :: - =/ next - ap-core(agent-config new-agent-config) - :: - [maybe-tang next] + [maybe-tang ap-core] :: +ap-upgrade-state: low-level install. :: ++ ap-upgrade-state @@ -1282,8 +1236,8 @@ ^+ ap-core :: %= ap-core - incoming.subscribers.current-agent - (~(del by incoming.subscribers.current-agent) agent-duct) + inbound.watches.current-agent + (~(del by inbound.watches.current-agent) agent-duct) == :: +ap-load-delete: load delete. :: @@ -1291,13 +1245,13 @@ ^+ ap-core :: =/ maybe-incoming - (~(get by incoming.subscribers.current-agent) agent-duct) + (~(get by inbound.watches.current-agent) agent-duct) ?~ maybe-incoming ap-core :: =/ incoming u.maybe-incoming - =. incoming.subscribers.current-agent - (~(del by incoming.subscribers.current-agent) agent-duct) + =. inbound.watches.current-agent + (~(del by inbound.watches.current-agent) agent-duct) :: =^ maybe-tang ap-core %+ ap-ingest ~ |. @@ -1390,10 +1344,10 @@ :: =. agent.current-agent +.p.result =/ moves (zing (turn -.p.result ap-from-internal)) - =. incoming.subscribers.current-agent + =. inbound.watches.current-agent (ap-handle-kicks moves) (ap-handle-peers moves) - :: +ap-handle-kicks: handle cancels of incoming subscriptions + :: +ap-handle-kicks: handle cancels of inbound.watches :: ++ ap-handle-kicks ~/ %ap-handle-kicks @@ -1409,8 +1363,8 @@ :: =/ quit-map=bitt (malt (turn quits |=(=duct [duct *[ship path]]))) - (~(dif by incoming.subscribers.current-agent) quit-map) - :: +ap-handle-peers: handle new outgoing subscriptions + (~(dif by inbound.watches.current-agent) quit-map) + :: +ap-handle-peers: handle new outbound.watches :: ++ ap-handle-peers ~/ %ap-handle-peers @@ -1426,8 +1380,8 @@ ?> ?=([%use @ @ %out @ @ *] wire) =/ short-wire t.t.t.t.t.t.wire =/ =dock [q.p q]:q.move.move - =. outgoing.subscribers.current-agent - (~(del by outgoing.subscribers.current-agent) [short-wire dock]) + =. outbound.watches.current-agent + (~(del by outbound.watches.current-agent) [short-wire dock]) $(moves t.moves, new-moves [move new-moves]) ?. ?=([* %pass * %g %deal * * %watch *] move) $(moves t.moves, new-moves [move new-moves]) @@ -1436,15 +1390,15 @@ =/ short-wire t.t.t.t.t.t.wire =/ =dock [q.p q]:q.move.move =/ =path path.r.q.move.move - ?: (~(has by outgoing.subscribers.current-agent) short-wire dock) + ?: (~(has by outbound.watches.current-agent) short-wire dock) =. ap-core =/ =tang ~[leaf+"subscribe wire not unique" >agent-name< >short-wire< >dock<] - %- (slog >out=outgoing.subscribers.current-agent< tang) + %- (slog >out=outbound.watches.current-agent< tang) (ap-error %watch-not-unique tang) $(moves t.moves) - =. outgoing.subscribers.current-agent - (~(put by outgoing.subscribers.current-agent) [short-wire dock] [| path]) + =. outbound.watches.current-agent + (~(put by outbound.watches.current-agent) [short-wire dock] [| path]) $(moves t.moves, new-moves [move new-moves]) -- -- @@ -1464,18 +1418,14 @@ ?- -.task %conf mo-abet:(mo-boot:mo-core dap.task our %home) %deal - =/ =sock p.task - =/ =term q.task - =/ =deal r.task + =/ [=sock =term =deal] [p q r]:task ?. =(q.sock our) ?> =(p.sock our) mo-abet:(mo-send-foreign-request:mo-core q.sock term deal) mo-abet:(mo-handle-local:mo-core p.sock term deal) :: - %goad mo-abet:(mo-goad:mo-core force.task agent.task) - %init [~ gall-payload(system-duct.agents.state duct)] - %trim [~ gall-payload] - %vega [~ gall-payload] + %goad mo-abet:(mo-goad:mo-core agent.task) + %init [~ gall-payload(system-duct.state duct)] %plea =/ =ship ship.task =/ =path path.plea.task @@ -1489,18 +1439,21 @@ => (mo-handle-ames-request:mo-core ship agent-name ames-request) mo-abet :: + %sear mo-abet:(mo-filter-queue:mo-core ship.task) + %trim [~ gall-payload] + %vega [~ gall-payload] %wegh =/ blocked - =/ queued (~(run by blocked.agents.state) |=(blocked [%.y +<])) + =/ queued (~(run by blocked.state) |=((qeu blocked-move) [%.y +<])) (sort ~(tap by queued) aor) :: =/ running - =/ active (~(run by running.agents.state) |=(running-agent [%.y +<])) + =/ active (~(run by yokes.state) |=(yoke [%.y +<])) (sort ~(tap by active) aor) :: =/ =mass :+ %gall %.n - :~ [%foreign %.y contacts.agents.state] + :~ [%foreign %.y contacts.state] [%blocked %.n blocked] [%active %.n running] [%dot %.y state] @@ -1535,15 +1488,15 @@ :: :: +all-state: upgrade path :: - ++ all-state $%(state-0 state-1 state-2 state-3 state-4 ^state) + ++ all-state $%(state-0 state-1 state-2 state-3 state-4 state-5) :: ++ state-4-to-5 |= =state-4 - ^- ^state + ^- state-5 %= state-4 - %5 running.agents-4 - (~(run by running.agents-4.state-4) |=(running-agent-3 +<+)) + (~(run by running.agents-4.state-4) |=(yoke-3 +<+)) == :: ++ state-4 @@ -1568,16 +1521,16 @@ $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) - running=(map term running-agent-3) - blocked=(map term blocked) + running=(map term yoke-3) + blocked=(map term (qeu blocked-move)) == :: - ++ running-agent-3 + ++ yoke-3 $: cache=worm control-duct=duct live=? =stats - =subscribers + =watches =agent =beak marks=(map duct mark) @@ -1590,10 +1543,10 @@ - %3 running.agents-2 %- ~(run by running.agents-2.state-2) - |= =running-agent-2 - ^- running-agent-3 - %= running-agent-2 - agent-2 (agent-2-to-3 agent-2.running-agent-2) + |= =yoke-2 + ^- yoke-3 + %= yoke-2 + agent-2 (agent-2-to-3 agent-2.yoke-2) == == :: @@ -1669,16 +1622,16 @@ $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) - running=(map term running-agent-2) - blocked=(map term blocked) + running=(map term yoke-2) + blocked=(map term (qeu blocked-move)) == :: - ++ running-agent-2 + ++ yoke-2 $: cache=worm control-duct=duct live=? =stats - =subscribers + =watches =agent-2 =beak marks=(map duct mark) @@ -1757,8 +1710,8 @@ ++ agents-1 $: system-duct=duct contacts=(set ship) - running=(map term running-agent-2) - blocked=(map term blocked) + running=(map term yoke-2) + blocked=(map term (qeu blocked-move)) == :: ++ state-0-to-1 @@ -1768,10 +1721,10 @@ - %1 running.agents-0 %- ~(run by running.agents-0.state-0) - |= =running-agent-0 - ^- running-agent-2 - %= running-agent-0 - agent-0 (agent-0-to-1 agent-0.running-agent-0) + |= =yoke-0 + ^- yoke-2 + %= yoke-0 + agent-0 (agent-0-to-1 agent-0.yoke-0) == == :: @@ -1837,16 +1790,16 @@ ++ agents-0 $: system-duct=duct contacts=(set ship) - running=(map term running-agent-0) - blocked=(map term blocked) + running=(map term yoke-0) + blocked=(map term (qeu blocked-move)) == :: - ++ running-agent-0 + ++ yoke-0 $: cache=worm control-duct=duct live=? =stats - =subscribers + =watches =agent-0 =beak marks=(map duct mark) @@ -1926,36 +1879,28 @@ :: ++ scry ~/ %gall-scry - |= [fur=(unit (set monk)) =term =shop =desk =coin =path] + |= [fur=(unit (set monk)) care=term =shop dap=desk =coin =path] ^- (unit (unit cage)) ?. ?=(%.y -.shop) ~ - :: =/ =ship p.shop - ?: ?& =(%u term) + ?: ?& =(%u care) =(~ path) =([%$ %da now] coin) =(our ship) == - =/ =vase !>((~(has by running.agents.state) desk)) - =/ =cage [%noun vase] - (some (some cage)) + [~ ~ noun+!>((~(has by yokes.state) dap))] :: ?. =(our ship) ~ - :: ?. =([%$ %da now] coin) ~ - :: - ?. (~(has by running.agents.state) desk) - (some ~) - :: + ?. (~(has by yokes.state) dap) + [~ ~] ?. ?=(^ path) ~ - :: - =/ initialised mo-abed:mo =/ =routes [~ ship] - (mo-peek:initialised desk routes term path) + (mo-peek:mo dap routes care path) :: +stay: save without cache :: ++ stay state @@ -1971,11 +1916,11 @@ ~| [%gall-take-failed wire] :: ?> ?=([?(%sys %use) *] wire) - =/ initialised (mo-abed:mo duct) + =/ mo-core (mo-abed:mo duct) =/ =sign-arvo q.hin => ?- i.wire - %sys (mo-handle-sys:initialised t.wire sign-arvo) - %use (mo-handle-use:initialised t.wire hin) + %sys (mo-handle-sys:mo-core t.wire sign-arvo) + %use (mo-handle-use:mo-core t.wire hin) == mo-abet -- diff --git a/pkg/arvo/tests/sys/vane/gall.hoon b/pkg/arvo/tests/sys/vane/gall.hoon index 291574c37..4fff5dc60 100644 --- a/pkg/arvo/tests/sys/vane/gall.hoon +++ b/pkg/arvo/tests/sys/vane/gall.hoon @@ -24,7 +24,7 @@ (gall-call gall-gate time *sley call-args expected-moves) :: results -:: +test-conf: test %conf +:: +test-conf: test %conf: TODO: fix :: ++ test-conf ^- tang @@ -36,9 +36,7 @@ :: =/ call-args =/ =type -:!>(*task:able:gall) - =/ =task:able:gall - =/ =dock [ship term] - [%conf dock dock] + =/ =task:able:gall [%conf term] [duct type task] :: =/ =move:gall-gate From 627bb565c28d1752f18085340e6e0f4b2a16a00a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 22 Apr 2020 05:27:36 -0400 Subject: [PATCH 052/280] boots off gall using fusion to build apps; some app errors on boot, but usable --- bin/solid.pill | 4 +- pkg/arvo/app/chat-view.hoon | 83 +++++++++--------- .../img/{touch_icon.png => touch-icon.png} | Bin pkg/arvo/app/clock.hoon | 10 +-- pkg/arvo/app/contact-view.hoon | 70 +++++++-------- .../app/contacts/img/{Home.png => home.png} | Bin .../app/contacts/img/{Tile.png => tile.png} | Bin pkg/arvo/app/hood.hoon | 4 +- pkg/arvo/app/launch.hoon | 32 +++---- pkg/arvo/app/lens.hoon | 4 +- pkg/arvo/app/link-view.hoon | 8 +- pkg/arvo/app/publish.hoon | 68 +++++++------- pkg/arvo/app/soto.hoon | 51 +++++------ pkg/arvo/app/weather.hoon | 17 ++-- pkg/arvo/sys/vane/gall.hoon | 25 ++---- pkg/arvo/sys/zuse.hoon | 1 + pkg/arvo/tests/sys/vane/clay.hoon | 36 ++++++++ 17 files changed, 204 insertions(+), 209 deletions(-) rename pkg/arvo/app/chat/img/{touch_icon.png => touch-icon.png} (100%) rename pkg/arvo/app/contacts/img/{Home.png => home.png} (100%) rename pkg/arvo/app/contacts/img/{Tile.png => tile.png} (100%) diff --git a/bin/solid.pill b/bin/solid.pill index 7301566f8..d87457a0e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:60b80820a1bccb36920f611dec217c73737d086cb3de688b439f4226bbe110aa -size 13264963 +oid sha256:180cfdd68c9b438764bb5b79f4af9117eac66a81e3bf5b0888eee9f242cf8935 +size 13316363 diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index 7fdb6aa0b..5c0d239cc 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -1,47 +1,50 @@ :: chat-view: sets up chat JS client, paginates data, and combines commands :: into semantic actions for the UI :: -/- *permission-store, - *permission-hook, - *group-store, - *invite-store, - *metadata-store, - *permission-group-hook, - *chat-hook, - *metadata-hook -/+ *server, *chat-json, default-agent, verb, dbug -/= index - /^ octs - /; as-octs:mimes:html - /: /===/app/chat/index - /| /html/ - /~ ~ - == -/= tile-js - /^ octs - /; as-octs:mimes:html - /: /===/app/chat/js/tile - /| /js/ - /~ ~ - == -/= script - /^ octs - /; as-octs:mimes:html - /: /===/app/chat/js/index - /| /js/ - /~ ~ - == -/= style - /^ octs - /; as-octs:mimes:html - /: /===/app/chat/css/index - /| /css/ - /~ ~ - == -/= chat-png - /^ (map knot @) - /: /===/app/chat/img /_ /png/ +/- *permission-store +/- *permission-hook +/- *group-store +/- *invite-store +/- *metadata-store +/- *permission-group-hook +/- *chat-hook +/- *metadata-hook :: +/+ *server, *chat-json, default-agent, verb, dbug +:: +/* index-html %html /app/chat/index/html +/* index-js %js /app/chat/js/index/js +/* tile-js-raw %js /app/chat/js/tile/js +/* index-css %css /app/chat/css/index/css +:: +/* chatswitcherclosed-png %png /app/chat/img/chatswitcherclosed/png +/* chatswitcherlink-png %png /app/chat/img/chatswitcherlink/png +/* home-png %png /app/chat/img/home/png +/* icon-home-png %png /app/chat/img/icon-home/png +/* popout-png %png /app/chat/img/popout/png +/* search-png %png /app/chat/img/search/png +/* send-png %png /app/chat/img/send/png +/* tile-png %png /app/chat/img/tile/png +/* touch-icon-png %png /app/chat/img/touch-icon/png +:: +=/ as-octs as-octs:mimes:html +=/ index (as-octs index-html) +=/ script (as-octs index-js) +=/ tile-js (as-octs tile-js-raw) +=/ style (as-octs index-css) +:: +=/ chat-png=(map knot @) + %- ~(gas by *(map knot @)) + :~ chatswitcherclosed+chatswitcherclosed-png + chatswitcherlink+chatswitcherlink-png + home+home-png + icon-home+icon-home-png + popout+popout-png + search+search-png + send+send-png + tile+tile-png + touch-icon+touch-icon-png + == |% +$ card card:agent:gall :: diff --git a/pkg/arvo/app/chat/img/touch_icon.png b/pkg/arvo/app/chat/img/touch-icon.png similarity index 100% rename from pkg/arvo/app/chat/img/touch_icon.png rename to pkg/arvo/app/chat/img/touch-icon.png diff --git a/pkg/arvo/app/clock.hoon b/pkg/arvo/app/clock.hoon index 8d45bec83..de9d83741 100644 --- a/pkg/arvo/app/clock.hoon +++ b/pkg/arvo/app/clock.hoon @@ -1,11 +1,7 @@ /+ *server, default-agent, verb -/= tile-js - /^ octs - /; as-octs:mimes:html - /: /===/app/clock/js/tile - /| /js/ - /~ ~ - == +/* tile %js /app/clock/js/tile/js +=/ as-octs as-octs:mimes:html +=/ tile-js (as-octs tile) =, format :: |% diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index 65edebd63..1f456ff24 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -1,47 +1,37 @@ :: contact-view: sets up contact JS client and combines commands :: into semantic actions for the UI :: -/- *group-store, - *group-hook, - *invite-store, - *contact-hook, - *metadata-store, - *metadata-hook, - *permission-group-hook, - *permission-hook -/+ *server, *contact-json, default-agent, dbug -/= index - /^ octs - /; as-octs:mimes:html - /: /===/app/contacts/index - /| /html/ - /~ ~ - == -/= tile-js - /^ octs - /; as-octs:mimes:html - /: /===/app/contacts/js/tile - /| /js/ - /~ ~ - == -/= script - /^ octs - /; as-octs:mimes:html - /: /===/app/contacts/js/index - /| /js/ - /~ ~ - == -/= style - /^ octs - /; as-octs:mimes:html - /: /===/app/contacts/css/index - /| /css/ - /~ ~ - == -/= contact-png - /^ (map knot @) - /: /===/app/contacts/img /_ /png/ +/- *group-store +/- *group-hook +/- *invite-store +/- *contact-hook +/- *metadata-store +/- *metadata-hook +/- *permission-group-hook +/- *permission-hook :: +/+ *server, *contact-json, default-agent, dbug +:: +/* index-html %html /app/contacts/index/html +/* index-js %js /app/contacts/js/index/js +/* tile-js %js /app/contacts/js/tile/js +/* index-css %css /app/contacts/css/index/css +/* home-png %png /app/contacts/img/home/png +/* tile-png %png /app/contacts/img/tile/png +/* search-png %png /app/contacts/img/search/png +:: +=/ as-octs as-octs:mimes:html +=/ index (as-octs index-html) +=/ script (as-octs index-js) +=/ tile-js (as-octs tile-js) +=/ style (as-octs index-css) +:: +=/ contact-png=(map knot @) + %- ~(gas by *(map knot @)) + :~ home+home-png + tile+tile-png + search+search-png + == |% +$ card card:agent:gall -- diff --git a/pkg/arvo/app/contacts/img/Home.png b/pkg/arvo/app/contacts/img/home.png similarity index 100% rename from pkg/arvo/app/contacts/img/Home.png rename to pkg/arvo/app/contacts/img/home.png diff --git a/pkg/arvo/app/contacts/img/Tile.png b/pkg/arvo/app/contacts/img/tile.png similarity index 100% rename from pkg/arvo/app/contacts/img/Tile.png rename to pkg/arvo/app/contacts/img/tile.png diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 7b489b7c0..d418315cb 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -3,7 +3,7 @@ :: :: :: /? 310 :: zuse version /- *sole -/+ sole, :: libraries +/+ sole :: libraries :: XX these should really be separate apps, as :: none of them interact with each other in :: any fashion; however, to reduce boot-time @@ -12,7 +12,7 @@ :: they have been bundled into :hood :: :: |command handlers - hood-helm, hood-kiln, hood-drum, hood-write +/+ hood-helm, hood-kiln, hood-drum, hood-write :: :: :: :::: :: :: :: :: :: diff --git a/pkg/arvo/app/launch.hoon b/pkg/arvo/app/launch.hoon index 1d039968d..fa9fc6f0f 100644 --- a/pkg/arvo/app/launch.hoon +++ b/pkg/arvo/app/launch.hoon @@ -1,26 +1,20 @@ /- launch /+ *server, default-agent, dbug +/= index /app/launch/index +/* index-js %js /app/launch/js/index/js +/* index-css %css /app/launch/css/index/css +/* home-png %png /app/launch/img/home/png +/* favicon-png %png /app/launch/img/favicon/png :: -/= index - /^ $-(marl manx) - /: /===/app/launch/index /!noun/ -/= script - /^ octs - /; as-octs:mimes:html - /: /===/app/launch/js/index - /| /js/ - /~ ~ +=/ as-octs as-octs:mimes:html +=/ script (as-octs index-js) +=/ style (as-octs index-css) +:: +=/ launch-png=(map knot @) + %- ~(gas by *(map knot @)) + :~ home+home-png + favicon+favicon-png == -/= style - /^ octs - /; as-octs:mimes:html - /: /===/app/launch/css/index - /| /css/ - /~ ~ - == -/= launch-png - /^ (map knot @) - /: /===/app/launch/img /_ /png/ :: |% +$ versioned-state diff --git a/pkg/arvo/app/lens.hoon b/pkg/arvo/app/lens.hoon index b9e3d4685..73004cb27 100644 --- a/pkg/arvo/app/lens.hoon +++ b/pkg/arvo/app/lens.hoon @@ -1,7 +1,6 @@ /- lens, *sole /+ base64, *server, default-agent -/= lens-mark /: /===/mar/lens/command - /!noun/ +/= lens-mark /mar/lens/command :: TODO: ask clay to build a $tube =, format |% :: +lens-out: json or named octet-stream @@ -15,7 +14,6 @@ job=(unit [eyre-id=@ta com=command:lens]) == == -:: -- :: =| =state diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index 94c6a9778..96e0a417d 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -10,10 +10,10 @@ :: /json/[n]/submission/[wood-url]/[some-group] nth matching submission :: /json/seen mark-as-read updates :: -/- *link-view, - *invite-store, group-store, - group-hook, permission-hook, permission-group-hook, - metadata-hook, contact-view +/- *link-view +/- *invite-store, group-store +/- group-hook, permission-hook, permission-group-hook +/- metadata-hook, contact-view /+ *link, metadata, *server, default-agent, verb, dbug :: |% diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index 78abb7aad..166eb8c5c 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -1,44 +1,42 @@ +/- *publish +/- *group-store +/- *group-hook +/- *permission-hook +/- *permission-group-hook +/- *permission-store +/- *invite-store +/- *metadata-store +/- *metadata-hook :: -/- *publish, - *group-store, - *group-hook, - *permission-hook, - *permission-group-hook, - *permission-store, - *invite-store, - *metadata-store, - *metadata-hook /+ *server, *publish, cram, default-agent, dbug :: -/= index - /^ $-(json manx) - /: /===/app/publish/index /!noun/ +/= index /app/publish/index :: -/= js - /^ octs - /; as-octs:mimes:html - /| /: /===/app/publish/js/index /js/ - /~ ~ +/* index-js %js /app/publish/js/index/js +/* tile-js-raw %js /app/publish/js/tile/js +/* index-css %css /app/publish/css/index/css +/* home-png %png /app/publish/img/home/png +/* popout-png %png /app/publish/img/popout/png +/* search-png %png /app/publish/img/search/png +/* switcherclosed-png %png /app/publish/img/switcherclosed/png +/* switcheropen-png %png /app/publish/img/switcheropen/png +/* tile-png %png /app/publish/img/tile/png +:: +=/ as-octs as-octs:mimes:html +=/ tile-js (as-octs tile-js-raw) +=/ js (as-octs index-js) +=/ css (as-octs index-css) +:: +=/ images=(map knot @) + %- ~(gas by *(map knot @)) + :~ home+home-png + popout+popout-png + search+search-png + switcherclosed+switcherclosed-png + switcheropen+switcheropen-png + tile+tile-png == :: -/= css - /^ octs - /; as-octs:mimes:html - /| /: /===/app/publish/css/index /css/ - /~ ~ - == -:: -/= tile-js - /^ octs - /; as-octs:mimes:html - /| /: /===/app/publish/js/tile /js/ - /~ ~ - == -:: -/= images - /^ (map knot @) - /: /===/app/publish/img /_ /png/ -:: |% +$ card card:agent:gall :: diff --git a/pkg/arvo/app/soto.hoon b/pkg/arvo/app/soto.hoon index 88c7c929e..611364e90 100644 --- a/pkg/arvo/app/soto.hoon +++ b/pkg/arvo/app/soto.hoon @@ -4,37 +4,28 @@ :: /- sole /+ *server, *soto, default-agent -/= index - /^ octs - /; as-octs:mimes:html - /: /===/app/soto/index - /| /html/ - /~ ~ +:: +/* index-html %html /app/soto/index/html +/* index-js %js /app/soto/js/index/js +/* tile-js-raw %js /app/soto/js/tile/js +/* index-css %css /app/soto/css/index/css +:: +/* home-png %png /app/soto/img/home/png +/* popout-png %png /app/soto/img/popout/png +/* tile-png %png /app/soto/img/tile/png +:: +=/ as-octs as-octs:mimes:html +=/ index (as-octs index-html) +=/ script (as-octs index-js) +=/ tile-js (as-octs tile-js-raw) +=/ style (as-octs index-css) +:: +=/ soto-png=(map knot @) + %- ~(gas by *(map knot @)) + :~ home+home-png + popout+popout-png + tile+tile-png == -/= tile-js - /^ octs - /; as-octs:mimes:html - /: /===/app/soto/js/tile - /| /js/ - /~ ~ - == -/= script - /^ octs - /; as-octs:mimes:html - /: /===/app/soto/js/index - /| /js/ - /~ ~ - == -/= style - /^ octs - /; as-octs:mimes:html - /: /===/app/soto/css/index - /| /css/ - /~ ~ - == -/= soto-png - /^ (map knot @) - /: /===/app/soto/img /_ /png/ :: |% +$ card card:agent:gall diff --git a/pkg/arvo/app/weather.hoon b/pkg/arvo/app/weather.hoon index 7eaedc2a5..e3a55295a 100644 --- a/pkg/arvo/app/weather.hoon +++ b/pkg/arvo/app/weather.hoon @@ -1,16 +1,11 @@ /+ *server, *server, default-agent, dbug -/= tile-js - /^ octs - /; as-octs:mimes:html - /: /===/app/weather/js/tile - /| /js/ - /~ ~ - == -/= weather-png - /^ (map knot @) - /: /===/app/weather/img /_ /png/ -=, format +/* tile-js-raw %js /app/weather/js/tile/js +=/ as-octs as-octs:mimes:html +=/ tile-js (as-octs tile-js-raw) :: +=/ weather-png=(map knot @) ~ +:: +=, format |% :: +$ card card:agent:gall diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 71ece1c6b..10b351e09 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -134,10 +134,8 @@ |= [dap=term =ship =desk] ^+ mo-core =/ =case [%da now] - ?~ pax=(get-fit:clay [ship desk case] %app dap) - (mo-give %onto |+[leaf+"gall: no file for agent {}"]~) =/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]/(scot case) - (mo-pass wire %c %warp ship desk ~ %sing %a case u.pax) + (mo-pass wire %c %warp ship desk ~ %sing %a case /app/[dap]/hoon) :: +mo-reboot: ask %ford to rebuild the specified agent :: ++ mo-reboot @@ -627,7 +625,7 @@ :: +mo-apply: apply the supplied action to the specified agent. :: ++ mo-apply - |= [agent=term =routes =deal] + |= [dap=term =routes =deal] ^+ mo-core :: TODO: Remove this horrific hack when ford pinto comes! => |% @@ -684,39 +682,34 @@ == -- :: - =/ =path - =/ ship (scot %p attributing.routes) - /sys/val/[ship]/[agent] - :: - =/ ship-desk - =/ =beak (mo-beak agent) - [p q]:beak + =/ =path /sys/val/(scot %p attributing.routes)/[dap] + =/ [=ship =desk] [p q]:(mo-beak dap) :: ?: ?=(%raw-poke -.deal) :: TODO: Remove this horrific hack when ford pinto comes! ?+ mark.deal - =/ =schematic:ford [%vale ship-desk +.deal] + =/ =schematic:ford [%vale ship^desk +.deal] =/ =note-arvo [%f %build live=%.n schematic] (mo-pass path note-arvo) :: %chat-action =/ chat-act=(unit chat-action) ((soft chat-action) noun.deal) ?~ chat-act - ~& gall-raw-chat-poke-failed+[agent attributing.routes] + ~& gall-raw-chat-poke-failed+[dap attributing.routes] mo-core =/ =cage [%chat-action !>(u.chat-act)] =/ new-deal=^deal [%poke cage] - =/ app (ap-abed:ap agent routes) + =/ app (ap-abed:ap dap routes) =. app (ap-apply:app new-deal) ap-abet:app == :: ?: ?=(%poke-as -.deal) - =/ =schematic:ford [%cast ship-desk mark.deal [%$ cage.deal]] + =/ =schematic:ford [%cast ship^desk mark.deal [%$ cage.deal]] =/ =note-arvo [%f %build live=%.n schematic] (mo-pass path note-arvo) :: - =/ app (ap-abed:ap agent routes) + =/ app (ap-abed:ap dap routes) =. app (ap-apply:app deal) ap-abet:app :: +mo-handle-local: handle locally. diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index b2e505927..21f42f900 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1901,6 +1901,7 @@ $% [%conf dap=term] :: start agent [$deal p=sock q=term r=deal] :: full transmission [%goad force=? agent=(unit dude)] :: rebuild agent(s) + [%sear =ship] :: clear pending queues $>(%init vane-task) :: set owner $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 5575973f9..4fb609e21 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -37,6 +37,42 @@ == !> (parse-pile:(ford):fusion /sur/foo/hoon ".") :: +++ test-parse-multiline-faslus ^- tang + =/ src + """ + :: :: :: + :::: /hoon/hood/app :: :: + :: :: :: + /? 310 :: zuse version + /- *sole + /+ sole :: libraries + :: XX these should really be separate apps, as + :: none of them interact with each other in + :: any fashion; however, to reduce boot-time + :: complexity and work around the current + :: non-functionality of end-to-end acknowledgments, + :: they have been bundled into :hood + :: + :: |command handlers + /+ hood-helm, hood-kiln, hood-drum, hood-write + :: :: :: + . + """ + %+ expect-eq + !> ^- pile:fusion + :* sur=`(list taut:fusion)`[~ %sole]~ + ^= lib ^- (list taut:fusion) + :~ [`%sole %sole] + [`%hood-helm %hood-helm] + [`%hood-kiln %hood-kiln] + [`%hood-drum %hood-drum] + [`%hood-write %hood-write] + == + raw=~ bar=~ + hoon=tssg+[p:(need q:(tall:(vang & /app/hood/hoon) [17 1] "."))]~ + == + !> (parse-pile:(ford):fusion /app/hood/hoon src) +:: ++ test-cycle ^- tang =/ source=@t ''' From 5231031b603cec5788becc4e13f8c25a6119fc79 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 22 Apr 2020 05:44:21 -0400 Subject: [PATCH 053/280] lowercase image files --- ...hatSwitcherClosed.png => chatswitcherclosed.png} | Bin .../{ChatSwitcherLink.png => chatswitcherlink.png} | Bin pkg/arvo/app/chat/img/{Home.png => home.png} | Bin .../app/chat/img/{Icon-Home.png => icon-home.png} | Bin pkg/arvo/app/chat/img/{Send.png => send.png} | Bin pkg/arvo/app/chat/img/{Tile.png => tile.png} | Bin .../app/launch/img/{Favicon.png => favicon.png} | Bin pkg/arvo/app/launch/img/{Home.png => home.png} | Bin pkg/arvo/app/link/img/{Home.png => home.png} | Bin .../img/{SwitcherClosed.png => switcherclosed.png} | Bin .../link/img/{SwitcherOpen.png => switcheropen.png} | Bin pkg/arvo/app/link/img/{Tile.png => tile.png} | Bin pkg/arvo/app/publish/img/{Home.png => home.png} | Bin .../img/{SwitcherClosed.png => switcherclosed.png} | Bin .../img/{SwitcherOpen.png => switcheropen.png} | Bin pkg/arvo/app/soto/img/{Home.png => home.png} | Bin pkg/arvo/app/soto/img/{Tile.png => tile.png} | Bin 17 files changed, 0 insertions(+), 0 deletions(-) rename pkg/arvo/app/chat/img/{ChatSwitcherClosed.png => chatswitcherclosed.png} (100%) rename pkg/arvo/app/chat/img/{ChatSwitcherLink.png => chatswitcherlink.png} (100%) rename pkg/arvo/app/chat/img/{Home.png => home.png} (100%) rename pkg/arvo/app/chat/img/{Icon-Home.png => icon-home.png} (100%) rename pkg/arvo/app/chat/img/{Send.png => send.png} (100%) rename pkg/arvo/app/chat/img/{Tile.png => tile.png} (100%) rename pkg/arvo/app/launch/img/{Favicon.png => favicon.png} (100%) rename pkg/arvo/app/launch/img/{Home.png => home.png} (100%) rename pkg/arvo/app/link/img/{Home.png => home.png} (100%) rename pkg/arvo/app/link/img/{SwitcherClosed.png => switcherclosed.png} (100%) rename pkg/arvo/app/link/img/{SwitcherOpen.png => switcheropen.png} (100%) rename pkg/arvo/app/link/img/{Tile.png => tile.png} (100%) rename pkg/arvo/app/publish/img/{Home.png => home.png} (100%) rename pkg/arvo/app/publish/img/{SwitcherClosed.png => switcherclosed.png} (100%) rename pkg/arvo/app/publish/img/{SwitcherOpen.png => switcheropen.png} (100%) rename pkg/arvo/app/soto/img/{Home.png => home.png} (100%) rename pkg/arvo/app/soto/img/{Tile.png => tile.png} (100%) diff --git a/pkg/arvo/app/chat/img/ChatSwitcherClosed.png b/pkg/arvo/app/chat/img/chatswitcherclosed.png similarity index 100% rename from pkg/arvo/app/chat/img/ChatSwitcherClosed.png rename to pkg/arvo/app/chat/img/chatswitcherclosed.png diff --git a/pkg/arvo/app/chat/img/ChatSwitcherLink.png b/pkg/arvo/app/chat/img/chatswitcherlink.png similarity index 100% rename from pkg/arvo/app/chat/img/ChatSwitcherLink.png rename to pkg/arvo/app/chat/img/chatswitcherlink.png diff --git a/pkg/arvo/app/chat/img/Home.png b/pkg/arvo/app/chat/img/home.png similarity index 100% rename from pkg/arvo/app/chat/img/Home.png rename to pkg/arvo/app/chat/img/home.png diff --git a/pkg/arvo/app/chat/img/Icon-Home.png b/pkg/arvo/app/chat/img/icon-home.png similarity index 100% rename from pkg/arvo/app/chat/img/Icon-Home.png rename to pkg/arvo/app/chat/img/icon-home.png diff --git a/pkg/arvo/app/chat/img/Send.png b/pkg/arvo/app/chat/img/send.png similarity index 100% rename from pkg/arvo/app/chat/img/Send.png rename to pkg/arvo/app/chat/img/send.png diff --git a/pkg/arvo/app/chat/img/Tile.png b/pkg/arvo/app/chat/img/tile.png similarity index 100% rename from pkg/arvo/app/chat/img/Tile.png rename to pkg/arvo/app/chat/img/tile.png diff --git a/pkg/arvo/app/launch/img/Favicon.png b/pkg/arvo/app/launch/img/favicon.png similarity index 100% rename from pkg/arvo/app/launch/img/Favicon.png rename to pkg/arvo/app/launch/img/favicon.png diff --git a/pkg/arvo/app/launch/img/Home.png b/pkg/arvo/app/launch/img/home.png similarity index 100% rename from pkg/arvo/app/launch/img/Home.png rename to pkg/arvo/app/launch/img/home.png diff --git a/pkg/arvo/app/link/img/Home.png b/pkg/arvo/app/link/img/home.png similarity index 100% rename from pkg/arvo/app/link/img/Home.png rename to pkg/arvo/app/link/img/home.png diff --git a/pkg/arvo/app/link/img/SwitcherClosed.png b/pkg/arvo/app/link/img/switcherclosed.png similarity index 100% rename from pkg/arvo/app/link/img/SwitcherClosed.png rename to pkg/arvo/app/link/img/switcherclosed.png diff --git a/pkg/arvo/app/link/img/SwitcherOpen.png b/pkg/arvo/app/link/img/switcheropen.png similarity index 100% rename from pkg/arvo/app/link/img/SwitcherOpen.png rename to pkg/arvo/app/link/img/switcheropen.png diff --git a/pkg/arvo/app/link/img/Tile.png b/pkg/arvo/app/link/img/tile.png similarity index 100% rename from pkg/arvo/app/link/img/Tile.png rename to pkg/arvo/app/link/img/tile.png diff --git a/pkg/arvo/app/publish/img/Home.png b/pkg/arvo/app/publish/img/home.png similarity index 100% rename from pkg/arvo/app/publish/img/Home.png rename to pkg/arvo/app/publish/img/home.png diff --git a/pkg/arvo/app/publish/img/SwitcherClosed.png b/pkg/arvo/app/publish/img/switcherclosed.png similarity index 100% rename from pkg/arvo/app/publish/img/SwitcherClosed.png rename to pkg/arvo/app/publish/img/switcherclosed.png diff --git a/pkg/arvo/app/publish/img/SwitcherOpen.png b/pkg/arvo/app/publish/img/switcheropen.png similarity index 100% rename from pkg/arvo/app/publish/img/SwitcherOpen.png rename to pkg/arvo/app/publish/img/switcheropen.png diff --git a/pkg/arvo/app/soto/img/Home.png b/pkg/arvo/app/soto/img/home.png similarity index 100% rename from pkg/arvo/app/soto/img/Home.png rename to pkg/arvo/app/soto/img/home.png diff --git a/pkg/arvo/app/soto/img/Tile.png b/pkg/arvo/app/soto/img/tile.png similarity index 100% rename from pkg/arvo/app/soto/img/Tile.png rename to pkg/arvo/app/soto/img/tile.png From d7215321d3ce7a8c171fbf377b90318912bd6a41 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 22 Apr 2020 06:49:23 -0400 Subject: [PATCH 054/280] gall: fix scry bug --- pkg/arvo/sys/vane/gall.hoon | 40 +++++++++---------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 10b351e09..d27f94d6c 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -621,7 +621,7 @@ ^- (unit (unit cage)) :: =/ app (ap-abed:ap dap routes) - (ap-peek:app care dap path) + (ap-peek:app care path) :: +mo-apply: apply the supplied action to the specified agent. :: ++ mo-apply @@ -801,18 +801,18 @@ :: ++ ap-abed ~/ %ap-abed - |= [=term =routes] + |= [dap=term =routes] ^+ ap-core :: =/ =yoke - =/ running (~(got by yokes.state) term) + =/ running (~(got by yokes.state) dap) =/ =stats :+ +(change.stats.running) - (shaz (mix (add term change.stats.running) eny)) + (shaz (mix (add dap change.stats.running) eny)) now running(stats stats) :: - =. agent-name term + =. agent-name dap =. agent-routes routes =. current-agent yoke =. agent-duct hen @@ -987,7 +987,6 @@ ++ ap-apply |= =deal ^+ ap-core - :: ?- -.deal %watch-as (ap-subscribe-as +.deal) %poke (ap-poke +.deal) @@ -1000,23 +999,13 @@ :: ++ ap-peek ~/ %ap-peek - |= [=term tyl=path] + |= [care=term tyl=path] ^- (unit (unit cage)) + :: strip trailing mark off path for %x scrys :: - =/ marked - ?. ?=(%x term) - [mark=%$ tyl=tyl] - :: - =/ =path (flop tyl) - ?> ?=(^ path) - [mark=i.path tyl=(flop t.path)] - :: - =/ =mark mark.marked - =/ tyl tyl.marked - :: + =? tyl ?=(%x care) (flop (tail (flop tyl))) =/ peek-result=(each (unit (unit cage)) tang) - (ap-mule-peek |.((on-peek:ap-agent-core [term tyl]))) - :: + (ap-mule-peek |.((on-peek:ap-agent-core [care tyl]))) ?- -.peek-result %& p.peek-result %| ((slog leaf+"peek bad result" p.peek-result) [~ ~]) @@ -1027,7 +1016,6 @@ ~/ %ap-update-subscription |= [is-ok=? =other=ship other-agent=term =wire] ^+ ap-core - :: ?: is-ok ap-core (ap-kill-down wire [other-ship other-agent]) @@ -1036,7 +1024,6 @@ ++ ap-give |= =gift:agent ^+ ap-core - :: =/ internal-moves (weld (ap-from-internal %give gift) agent-moves) ap-core(agent-moves internal-moves) @@ -1061,7 +1048,6 @@ ++ ap-pass |= [=path =neat] ^+ ap-core - :: =/ internal-moves (ap-from-internal %pass path neat) ap-core(agent-moves (weld internal-moves agent-moves)) @@ -1071,7 +1057,6 @@ ~/ %ap-reinstall |= =agent ^+ ap-core - :: =/ old-state=vase ~(on-save agent.current-agent ap-construct-bowl) =^ error ap-core (ap-install(agent.current-agent agent) `old-state) @@ -1083,7 +1068,6 @@ ++ ap-subscribe-as |= [=mark =path] ^+ ap-core - :: =. marks.current-agent (~(put by marks.current-agent) agent-duct mark) (ap-subscribe path) :: +ap-subscribe: apply %watch. @@ -1092,11 +1076,9 @@ ~/ %ap-subscribe |= pax=path ^+ ap-core - :: =/ incoming [attributing.agent-routes pax] =. inbound.watches.current-agent (~(put by inbound.watches.current-agent) agent-duct incoming) - :: =^ maybe-tang ap-core %+ ap-ingest %watch-ack |. (on-watch:ap-agent-core pax) @@ -1109,7 +1091,6 @@ ~/ %ap-poke |= =cage ^+ ap-core - :: =^ maybe-tang ap-core %+ ap-ingest %poke-ack |. (on-poke:ap-agent-core cage) @@ -1119,7 +1100,6 @@ ++ ap-error |= [=term =tang] ^+ ap-core - :: =/ form |=(=tank [%rose [~ "! " ~] tank ~]) =^ maybe-tang ap-core %+ ap-ingest ~ |. @@ -1131,7 +1111,6 @@ ~/ %ap-generic-take |= [=wire =sign-arvo] ^+ ap-core - :: =^ maybe-tang ap-core %+ ap-ingest ~ |. (on-arvo:ap-agent-core wire sign-arvo) @@ -1143,7 +1122,6 @@ ++ ap-specific-take |= [=wire =sign:agent] ^+ ap-core - :: ~| wire=wire ?> ?=([%out @ @ *] wire) =/ other-ship (slav %p i.t.wire) From 09b1606ca6624c27f6626065a469561a2f795f62 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 22 Apr 2020 17:41:25 -0400 Subject: [PATCH 055/280] soto: whitespace cleanup --- pkg/arvo/app/soto.hoon | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/app/soto.hoon b/pkg/arvo/app/soto.hoon index 611364e90..f050adc63 100644 --- a/pkg/arvo/app/soto.hoon +++ b/pkg/arvo/app/soto.hoon @@ -5,14 +5,14 @@ /- sole /+ *server, *soto, default-agent :: -/* index-html %html /app/soto/index/html -/* index-js %js /app/soto/js/index/js -/* tile-js-raw %js /app/soto/js/tile/js -/* index-css %css /app/soto/css/index/css +/* index-html %html /app/soto/index/html +/* index-js %js /app/soto/js/index/js +/* tile-js-raw %js /app/soto/js/tile/js +/* index-css %css /app/soto/css/index/css :: -/* home-png %png /app/soto/img/home/png -/* popout-png %png /app/soto/img/popout/png -/* tile-png %png /app/soto/img/tile/png +/* home-png %png /app/soto/img/home/png +/* popout-png %png /app/soto/img/popout/png +/* tile-png %png /app/soto/img/tile/png :: =/ as-octs as-octs:mimes:html =/ index (as-octs index-html) From bd8a0fe9e753a57ddfd5e6e97c41cfdf214855c9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 22 Apr 2020 22:35:04 -0400 Subject: [PATCH 056/280] Revert "lowercase image files" This reverts commit 5231031b603cec5788becc4e13f8c25a6119fc79. --- ...hatswitcherclosed.png => ChatSwitcherClosed.png} | Bin .../{chatswitcherlink.png => ChatSwitcherLink.png} | Bin pkg/arvo/app/chat/img/{home.png => Home.png} | Bin .../app/chat/img/{icon-home.png => Icon-Home.png} | Bin pkg/arvo/app/chat/img/{send.png => Send.png} | Bin pkg/arvo/app/chat/img/{tile.png => Tile.png} | Bin .../app/launch/img/{favicon.png => Favicon.png} | Bin pkg/arvo/app/launch/img/{home.png => Home.png} | Bin pkg/arvo/app/link/img/{home.png => Home.png} | Bin .../img/{switcherclosed.png => SwitcherClosed.png} | Bin .../link/img/{switcheropen.png => SwitcherOpen.png} | Bin pkg/arvo/app/link/img/{tile.png => Tile.png} | Bin pkg/arvo/app/publish/img/{home.png => Home.png} | Bin .../img/{switcherclosed.png => SwitcherClosed.png} | Bin .../img/{switcheropen.png => SwitcherOpen.png} | Bin pkg/arvo/app/soto/img/{home.png => Home.png} | Bin pkg/arvo/app/soto/img/{tile.png => Tile.png} | Bin 17 files changed, 0 insertions(+), 0 deletions(-) rename pkg/arvo/app/chat/img/{chatswitcherclosed.png => ChatSwitcherClosed.png} (100%) rename pkg/arvo/app/chat/img/{chatswitcherlink.png => ChatSwitcherLink.png} (100%) rename pkg/arvo/app/chat/img/{home.png => Home.png} (100%) rename pkg/arvo/app/chat/img/{icon-home.png => Icon-Home.png} (100%) rename pkg/arvo/app/chat/img/{send.png => Send.png} (100%) rename pkg/arvo/app/chat/img/{tile.png => Tile.png} (100%) rename pkg/arvo/app/launch/img/{favicon.png => Favicon.png} (100%) rename pkg/arvo/app/launch/img/{home.png => Home.png} (100%) rename pkg/arvo/app/link/img/{home.png => Home.png} (100%) rename pkg/arvo/app/link/img/{switcherclosed.png => SwitcherClosed.png} (100%) rename pkg/arvo/app/link/img/{switcheropen.png => SwitcherOpen.png} (100%) rename pkg/arvo/app/link/img/{tile.png => Tile.png} (100%) rename pkg/arvo/app/publish/img/{home.png => Home.png} (100%) rename pkg/arvo/app/publish/img/{switcherclosed.png => SwitcherClosed.png} (100%) rename pkg/arvo/app/publish/img/{switcheropen.png => SwitcherOpen.png} (100%) rename pkg/arvo/app/soto/img/{home.png => Home.png} (100%) rename pkg/arvo/app/soto/img/{tile.png => Tile.png} (100%) diff --git a/pkg/arvo/app/chat/img/chatswitcherclosed.png b/pkg/arvo/app/chat/img/ChatSwitcherClosed.png similarity index 100% rename from pkg/arvo/app/chat/img/chatswitcherclosed.png rename to pkg/arvo/app/chat/img/ChatSwitcherClosed.png diff --git a/pkg/arvo/app/chat/img/chatswitcherlink.png b/pkg/arvo/app/chat/img/ChatSwitcherLink.png similarity index 100% rename from pkg/arvo/app/chat/img/chatswitcherlink.png rename to pkg/arvo/app/chat/img/ChatSwitcherLink.png diff --git a/pkg/arvo/app/chat/img/home.png b/pkg/arvo/app/chat/img/Home.png similarity index 100% rename from pkg/arvo/app/chat/img/home.png rename to pkg/arvo/app/chat/img/Home.png diff --git a/pkg/arvo/app/chat/img/icon-home.png b/pkg/arvo/app/chat/img/Icon-Home.png similarity index 100% rename from pkg/arvo/app/chat/img/icon-home.png rename to pkg/arvo/app/chat/img/Icon-Home.png diff --git a/pkg/arvo/app/chat/img/send.png b/pkg/arvo/app/chat/img/Send.png similarity index 100% rename from pkg/arvo/app/chat/img/send.png rename to pkg/arvo/app/chat/img/Send.png diff --git a/pkg/arvo/app/chat/img/tile.png b/pkg/arvo/app/chat/img/Tile.png similarity index 100% rename from pkg/arvo/app/chat/img/tile.png rename to pkg/arvo/app/chat/img/Tile.png diff --git a/pkg/arvo/app/launch/img/favicon.png b/pkg/arvo/app/launch/img/Favicon.png similarity index 100% rename from pkg/arvo/app/launch/img/favicon.png rename to pkg/arvo/app/launch/img/Favicon.png diff --git a/pkg/arvo/app/launch/img/home.png b/pkg/arvo/app/launch/img/Home.png similarity index 100% rename from pkg/arvo/app/launch/img/home.png rename to pkg/arvo/app/launch/img/Home.png diff --git a/pkg/arvo/app/link/img/home.png b/pkg/arvo/app/link/img/Home.png similarity index 100% rename from pkg/arvo/app/link/img/home.png rename to pkg/arvo/app/link/img/Home.png diff --git a/pkg/arvo/app/link/img/switcherclosed.png b/pkg/arvo/app/link/img/SwitcherClosed.png similarity index 100% rename from pkg/arvo/app/link/img/switcherclosed.png rename to pkg/arvo/app/link/img/SwitcherClosed.png diff --git a/pkg/arvo/app/link/img/switcheropen.png b/pkg/arvo/app/link/img/SwitcherOpen.png similarity index 100% rename from pkg/arvo/app/link/img/switcheropen.png rename to pkg/arvo/app/link/img/SwitcherOpen.png diff --git a/pkg/arvo/app/link/img/tile.png b/pkg/arvo/app/link/img/Tile.png similarity index 100% rename from pkg/arvo/app/link/img/tile.png rename to pkg/arvo/app/link/img/Tile.png diff --git a/pkg/arvo/app/publish/img/home.png b/pkg/arvo/app/publish/img/Home.png similarity index 100% rename from pkg/arvo/app/publish/img/home.png rename to pkg/arvo/app/publish/img/Home.png diff --git a/pkg/arvo/app/publish/img/switcherclosed.png b/pkg/arvo/app/publish/img/SwitcherClosed.png similarity index 100% rename from pkg/arvo/app/publish/img/switcherclosed.png rename to pkg/arvo/app/publish/img/SwitcherClosed.png diff --git a/pkg/arvo/app/publish/img/switcheropen.png b/pkg/arvo/app/publish/img/SwitcherOpen.png similarity index 100% rename from pkg/arvo/app/publish/img/switcheropen.png rename to pkg/arvo/app/publish/img/SwitcherOpen.png diff --git a/pkg/arvo/app/soto/img/home.png b/pkg/arvo/app/soto/img/Home.png similarity index 100% rename from pkg/arvo/app/soto/img/home.png rename to pkg/arvo/app/soto/img/Home.png diff --git a/pkg/arvo/app/soto/img/tile.png b/pkg/arvo/app/soto/img/Tile.png similarity index 100% rename from pkg/arvo/app/soto/img/tile.png rename to pkg/arvo/app/soto/img/Tile.png From 2f652856660ab4984bcbdeb3798d0d2fa0aa3b1f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 23 Apr 2020 01:18:53 -0400 Subject: [PATCH 057/280] Revert "Revert "lowercase image files"" This reverts commit bd8a0fe9e753a57ddfd5e6e97c41cfdf214855c9. --- ...hatSwitcherClosed.png => chatswitcherclosed.png} | Bin .../{ChatSwitcherLink.png => chatswitcherlink.png} | Bin pkg/arvo/app/chat/img/{Home.png => home.png} | Bin .../app/chat/img/{Icon-Home.png => icon-home.png} | Bin pkg/arvo/app/chat/img/{Send.png => send.png} | Bin pkg/arvo/app/chat/img/{Tile.png => tile.png} | Bin .../app/launch/img/{Favicon.png => favicon.png} | Bin pkg/arvo/app/launch/img/{Home.png => home.png} | Bin pkg/arvo/app/link/img/{Home.png => home.png} | Bin .../img/{SwitcherClosed.png => switcherclosed.png} | Bin .../link/img/{SwitcherOpen.png => switcheropen.png} | Bin pkg/arvo/app/link/img/{Tile.png => tile.png} | Bin pkg/arvo/app/publish/img/{Home.png => home.png} | Bin .../img/{SwitcherClosed.png => switcherclosed.png} | Bin .../img/{SwitcherOpen.png => switcheropen.png} | Bin pkg/arvo/app/soto/img/{Home.png => home.png} | Bin pkg/arvo/app/soto/img/{Tile.png => tile.png} | Bin 17 files changed, 0 insertions(+), 0 deletions(-) rename pkg/arvo/app/chat/img/{ChatSwitcherClosed.png => chatswitcherclosed.png} (100%) rename pkg/arvo/app/chat/img/{ChatSwitcherLink.png => chatswitcherlink.png} (100%) rename pkg/arvo/app/chat/img/{Home.png => home.png} (100%) rename pkg/arvo/app/chat/img/{Icon-Home.png => icon-home.png} (100%) rename pkg/arvo/app/chat/img/{Send.png => send.png} (100%) rename pkg/arvo/app/chat/img/{Tile.png => tile.png} (100%) rename pkg/arvo/app/launch/img/{Favicon.png => favicon.png} (100%) rename pkg/arvo/app/launch/img/{Home.png => home.png} (100%) rename pkg/arvo/app/link/img/{Home.png => home.png} (100%) rename pkg/arvo/app/link/img/{SwitcherClosed.png => switcherclosed.png} (100%) rename pkg/arvo/app/link/img/{SwitcherOpen.png => switcheropen.png} (100%) rename pkg/arvo/app/link/img/{Tile.png => tile.png} (100%) rename pkg/arvo/app/publish/img/{Home.png => home.png} (100%) rename pkg/arvo/app/publish/img/{SwitcherClosed.png => switcherclosed.png} (100%) rename pkg/arvo/app/publish/img/{SwitcherOpen.png => switcheropen.png} (100%) rename pkg/arvo/app/soto/img/{Home.png => home.png} (100%) rename pkg/arvo/app/soto/img/{Tile.png => tile.png} (100%) diff --git a/pkg/arvo/app/chat/img/ChatSwitcherClosed.png b/pkg/arvo/app/chat/img/chatswitcherclosed.png similarity index 100% rename from pkg/arvo/app/chat/img/ChatSwitcherClosed.png rename to pkg/arvo/app/chat/img/chatswitcherclosed.png diff --git a/pkg/arvo/app/chat/img/ChatSwitcherLink.png b/pkg/arvo/app/chat/img/chatswitcherlink.png similarity index 100% rename from pkg/arvo/app/chat/img/ChatSwitcherLink.png rename to pkg/arvo/app/chat/img/chatswitcherlink.png diff --git a/pkg/arvo/app/chat/img/Home.png b/pkg/arvo/app/chat/img/home.png similarity index 100% rename from pkg/arvo/app/chat/img/Home.png rename to pkg/arvo/app/chat/img/home.png diff --git a/pkg/arvo/app/chat/img/Icon-Home.png b/pkg/arvo/app/chat/img/icon-home.png similarity index 100% rename from pkg/arvo/app/chat/img/Icon-Home.png rename to pkg/arvo/app/chat/img/icon-home.png diff --git a/pkg/arvo/app/chat/img/Send.png b/pkg/arvo/app/chat/img/send.png similarity index 100% rename from pkg/arvo/app/chat/img/Send.png rename to pkg/arvo/app/chat/img/send.png diff --git a/pkg/arvo/app/chat/img/Tile.png b/pkg/arvo/app/chat/img/tile.png similarity index 100% rename from pkg/arvo/app/chat/img/Tile.png rename to pkg/arvo/app/chat/img/tile.png diff --git a/pkg/arvo/app/launch/img/Favicon.png b/pkg/arvo/app/launch/img/favicon.png similarity index 100% rename from pkg/arvo/app/launch/img/Favicon.png rename to pkg/arvo/app/launch/img/favicon.png diff --git a/pkg/arvo/app/launch/img/Home.png b/pkg/arvo/app/launch/img/home.png similarity index 100% rename from pkg/arvo/app/launch/img/Home.png rename to pkg/arvo/app/launch/img/home.png diff --git a/pkg/arvo/app/link/img/Home.png b/pkg/arvo/app/link/img/home.png similarity index 100% rename from pkg/arvo/app/link/img/Home.png rename to pkg/arvo/app/link/img/home.png diff --git a/pkg/arvo/app/link/img/SwitcherClosed.png b/pkg/arvo/app/link/img/switcherclosed.png similarity index 100% rename from pkg/arvo/app/link/img/SwitcherClosed.png rename to pkg/arvo/app/link/img/switcherclosed.png diff --git a/pkg/arvo/app/link/img/SwitcherOpen.png b/pkg/arvo/app/link/img/switcheropen.png similarity index 100% rename from pkg/arvo/app/link/img/SwitcherOpen.png rename to pkg/arvo/app/link/img/switcheropen.png diff --git a/pkg/arvo/app/link/img/Tile.png b/pkg/arvo/app/link/img/tile.png similarity index 100% rename from pkg/arvo/app/link/img/Tile.png rename to pkg/arvo/app/link/img/tile.png diff --git a/pkg/arvo/app/publish/img/Home.png b/pkg/arvo/app/publish/img/home.png similarity index 100% rename from pkg/arvo/app/publish/img/Home.png rename to pkg/arvo/app/publish/img/home.png diff --git a/pkg/arvo/app/publish/img/SwitcherClosed.png b/pkg/arvo/app/publish/img/switcherclosed.png similarity index 100% rename from pkg/arvo/app/publish/img/SwitcherClosed.png rename to pkg/arvo/app/publish/img/switcherclosed.png diff --git a/pkg/arvo/app/publish/img/SwitcherOpen.png b/pkg/arvo/app/publish/img/switcheropen.png similarity index 100% rename from pkg/arvo/app/publish/img/SwitcherOpen.png rename to pkg/arvo/app/publish/img/switcheropen.png diff --git a/pkg/arvo/app/soto/img/Home.png b/pkg/arvo/app/soto/img/home.png similarity index 100% rename from pkg/arvo/app/soto/img/Home.png rename to pkg/arvo/app/soto/img/home.png diff --git a/pkg/arvo/app/soto/img/Tile.png b/pkg/arvo/app/soto/img/tile.png similarity index 100% rename from pkg/arvo/app/soto/img/Tile.png rename to pkg/arvo/app/soto/img/tile.png From e10bc43c4ad8aa9d53844188f10aa3f2b5f8e777 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 23 Apr 2020 01:51:34 -0400 Subject: [PATCH 058/280] app/: images load in web client again --- pkg/arvo/app/chat-view.hoon | 20 ++++++++++---------- pkg/arvo/app/contact-view.hoon | 11 ++++++----- pkg/arvo/app/launch.hoon | 13 +++++++------ pkg/arvo/app/link-view.hoon | 8 +++++++- pkg/arvo/app/publish.hoon | 15 ++++++++------- pkg/arvo/app/soto.hoon | 11 ++++++----- 6 files changed, 44 insertions(+), 34 deletions(-) diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index 5c0d239cc..fd6222cc5 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -33,17 +33,17 @@ =/ tile-js (as-octs tile-js-raw) =/ style (as-octs index-css) :: -=/ chat-png=(map knot @) - %- ~(gas by *(map knot @)) - :~ chatswitcherclosed+chatswitcherclosed-png - chatswitcherlink+chatswitcherlink-png - home+home-png - icon-home+icon-home-png +=/ chat-png=(map @t octs) + =- (~(run by -) as-octs:mimes:html) + %- ~(gas by *(map @t @)) + :~ [%'ChatSwitcherClosed' chatswitcherclosed-png] + [%'ChatSwitcherLink' chatswitcherlink-png] + [%'Home' home-png] + [%'Tile' tile-png] + [%'Send' send-png] + [%'touch_icon' touch-icon-png] popout+popout-png search+search-png - send+send-png - tile+tile-png - touch-icon+touch-icon-png == |% +$ card card:agent:gall @@ -176,7 +176,7 @@ =/ img (~(get by chat-png) name) ?~ img not-found:gen - (png-response:gen (as-octs:mimes:html u.img)) + (png-response:gen u.img) :: [%'~chat' %paginate @t @t *] =/ start (need (rush i.t.t.site.url dem)) diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index 1f456ff24..aceaaa3be 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -26,10 +26,11 @@ =/ tile-js (as-octs tile-js) =/ style (as-octs index-css) :: -=/ contact-png=(map knot @) - %- ~(gas by *(map knot @)) - :~ home+home-png - tile+tile-png +=/ contact-png=(map @t octs) + =- (~(run by -) as-octs:mimes:html) + %- ~(gas by *(map @t @)) + :~ [%'Home' home-png] + [%'Tile' tile-png] search+search-png == |% @@ -167,7 +168,7 @@ [%'~groups' %js %index ~] (js-response:gen script) [%'~groups' %js %tile ~] (js-response:gen tile-js) [%'~groups' %img *] - (png-response:gen (as-octs:mimes:html (~(got by contact-png) `@ta`name))) + (png-response:gen (~(got by contact-png) name)) :: :: avatar images :: diff --git a/pkg/arvo/app/launch.hoon b/pkg/arvo/app/launch.hoon index fa9fc6f0f..85fd50030 100644 --- a/pkg/arvo/app/launch.hoon +++ b/pkg/arvo/app/launch.hoon @@ -10,10 +10,11 @@ =/ script (as-octs index-js) =/ style (as-octs index-css) :: -=/ launch-png=(map knot @) - %- ~(gas by *(map knot @)) - :~ home+home-png - favicon+favicon-png +=/ launch-png=(map @t octs) + =- (~(run by -) as-octs:mimes:html) + %- ~(gas by *(map @t @)) + :~ [%'Home' home-png] + [%'Favicon' favicon-png] == :: |% @@ -101,10 +102,10 @@ (js-response:gen script) :: [%'~launch' %img *] :: images - =/ img=(unit @) (~(get by launch-png) `@ta`name) + =/ img=(unit octs) (~(get by launch-png) name) ?~ img not-found:gen - (png-response:gen (as-octs:mimes:html u.img)) + (png-response:gen u.img) :: [%'~modulo' %session ~] =/ session-js diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index 96e0a417d..62c9a87d7 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -210,7 +210,13 @@ $(request-line [[`%html ~[%'~link' 'index']] args.request-line]) =/ file=(unit octs) ?. ?=([%'~link' *] site.request-line) ~ - (get-file-at /app/link [t.site u.ext]:request-line) + =/ fil=path + ?: =(/img/'Tile' t.site.request-line) + /img/tile :: XX capitalization hack + ?: =(/img/'Home' t.site.request-line) + /img/home :: XX capitalization hack + t.site.request-line + (get-file-at /app/link fil u.ext.request-line) ?~ file not-found:gen ?+ u.ext.request-line not-found:gen %html (html-response:gen u.file) diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index 166eb8c5c..9896f8a63 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -27,13 +27,14 @@ =/ js (as-octs index-js) =/ css (as-octs index-css) :: -=/ images=(map knot @) - %- ~(gas by *(map knot @)) - :~ home+home-png +=/ images=(map @t octs) + =- (~(run by -) as-octs:mimes:html) + %- ~(gas by *(map @t @)) + :~ [%'Home' home-png] popout+popout-png search+search-png - switcherclosed+switcherclosed-png - switcheropen+switcheropen-png + ['%SwitcherClosed' switcherclosed-png] + ['%SwitcherOpen' switcheropen-png] tile+tile-png == :: @@ -1610,10 +1611,10 @@ :: [[[~ %png] [%'~publish' @t ~]] ~] =/ filename=@t i.t.site.url - =/ img=(unit @t) (~(get by images) filename) + =/ img=(unit octs) (~(get by images) filename) ?~ img not-found:gen - (png-response:gen (as-octs:mimes:html u.img)) + (png-response:gen u.img) :: [[[~ %css] [%'~publish' %index ~]] ~] (css-response:gen css) diff --git a/pkg/arvo/app/soto.hoon b/pkg/arvo/app/soto.hoon index f050adc63..051790dae 100644 --- a/pkg/arvo/app/soto.hoon +++ b/pkg/arvo/app/soto.hoon @@ -20,11 +20,12 @@ =/ tile-js (as-octs tile-js-raw) =/ style (as-octs index-css) :: -=/ soto-png=(map knot @) - %- ~(gas by *(map knot @)) - :~ home+home-png +=/ soto-png=(map @t octs) + =- (~(run by -) as-octs:mimes:html) + %- ~(gas by *(map @t @)) + :~ [%'Home' home-png] popout+popout-png - tile+tile-png + [%'Tile' tile-png] == :: |% @@ -92,7 +93,7 @@ =/ img (~(get by soto-png) filename) ?~ img not-found:gen - (png-response:gen (as-octs:mimes:html u.img)) + (png-response:gen u.img) == :: ++ on-watch From fa0e019ddf4bba9e95ddcd91f4fc4ea7af39076f Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 22 Apr 2020 20:07:41 -0700 Subject: [PATCH 059/280] clay: change %park interface to not take caches Now a full commit is synchronous. -commit will be assimilated back into clay. --- bin/solid.pill | 4 +- pkg/arvo/mar/mime.hoon | 1 + pkg/arvo/sys/vane/clay.hoon | 123 +++++++++++++++++++++--------------- pkg/arvo/sys/zuse.hoon | 7 +- pkg/arvo/ted/commit.hoon | 45 +++---------- 5 files changed, 91 insertions(+), 89 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d87457a0e..976a930ef 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:180cfdd68c9b438764bb5b79f4af9117eac66a81e3bf5b0888eee9f242cf8935 -size 13316363 +oid sha256:1031dc68b42322ae2ce2cd899895497d2eb575438cd09f4d5a674c23ca74808d +size 13109651 diff --git a/pkg/arvo/mar/mime.hoon b/pkg/arvo/mar/mime.hoon index 83bf17128..7ca373bce 100644 --- a/pkg/arvo/mar/mime.hoon +++ b/pkg/arvo/mar/mime.hoon @@ -5,6 +5,7 @@ :: |_ own/mime ++ grow + ^? |% ++ jam `@`q.q.own -- diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 7f7fa11ae..0122bcfb8 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2115,6 +2115,10 @@ :: ++ util |% + :: Hash a page to get a lobe. + :: + ++ page-to-lobe |=(page (shax (jam +<))) + :: :: Takes a list of changed paths and finds those paths that are inside a :: mount point (listed in `mon`). :: @@ -2854,7 +2858,8 @@ ^- vase %+ slap (with-faces old+old sam+sam ~) - (ream (cat 3 b ':~(grow old sam)')) + %- ream + :((cury cat 3) '!: ~! old=old ~! sam=sam ' b ':~(grow old sam)') :: try direct +grab :: =^ new=vase nub (build-fit %mar b) @@ -3410,22 +3415,19 @@ :: :: XX needs to check that head is ancestor of tako :: XX needs to check tako in rang + :: XX needs to check that commit doesn't have same date :: ++ park - :: |= [commit=yuki commit-store-adds=(map tako yaki) blob-store-adds=(map lobe blob)] |^ - |= [=tako =rang =ankh mim=(map path (unit mime))] + |= [=yuki =rang] ^+ ..park - =: let.dom +(let.dom) - hit.dom (~(put by hit.dom) +(let.dom) tako) - hut.ran (~(uni by hut.rang) hut.ran) + =: hut.ran (~(uni by hut.rang) hut.ran) lat.ran (~(uni by lat.rang) lat.ran) == =/ [deletes=(set path) changes=(map path (each page lobe))] - =/ previous-yaki (aeon-to-yaki:ze (dec let.dom)) - =/ next-yaki (aeon-to-yaki:ze let.dom) - (get-changes previous-yaki next-yaki) - ~| [let.dom deletes=deletes changes=~(key by changes)] + =/ previous-yaki (aeon-to-yaki:ze let.dom) + (get-changes q.previous-yaki q.yuki) + ~| [from=let.dom deletes=deletes changes=~(key by changes)] =. ..park (emil (print deletes ~(key by changes))) :: :: promote ford cache @@ -3437,8 +3439,30 @@ =/ =args:ford:fusion [ank.dom deletes changes lat.ran fod.dom] :: + =^ change-cages ford-cache.args + (checkout-changes args q.yuki) + =/ new-blobs=(map lobe blob) + %- malt + %+ turn ~(tap by change-cages) + |= [=path =lobe =cage] + [lobe %direct lobe [p q.q]:cage] + =/ data=(map path lobe) + %- ~(urn by q.yuki) + |= [=path value=(each page lobe)] + ?- -.value + %| p.value + %& lobe:(~(got by change-cages) path) + == + =/ =yaki (make-yaki p.yuki data now) + =: let.dom +(let.dom) + hit.dom (~(put by hit.dom) +(let.dom) r.yaki) + hut.ran (~(put by hut.ran) r.yaki yaki) + lat.ran (~(uni by new-blobs) lat.ran) + == + =. file-store.args lat.ran + :: =^ ankh ford-cache.args - (checkout-ankh args deletes changes ank.dom) + (checkout-ankh args deletes change-cages ank.dom) =. ankh.args ankh =. ank.dom ankh =^ mim ford-cache.args @@ -3451,26 +3475,28 @@ :: Find which files changed or were deleted :: ++ get-changes - |= [old=yaki new=yaki] + |= [old=(map path lobe) new=(map path (each page lobe))] + =/ old=(map path (each page lobe)) + (~(run by old) |=(=lobe |+lobe)) :* %- silt ^- (list path) - %+ murn ~(tap by (~(uni by q.old) q.new)) - |= [=path =lobe] + %+ murn ~(tap by (~(uni by old) new)) + |= [=path *] ^- (unit ^path) - =/ a (~(get by q.new) path) - =/ b (~(get by q.old) path) + =/ a (~(get by new) path) + =/ b (~(get by old) path) ?: |(=(a b) !=(~ a)) ~ `path :: %- silt ^- (list [path (each page lobe)]) - %+ murn ~(tap by (~(uni by q.old) q.new)) - |= [=path =lobe] - ^- (unit [^path (each page ^lobe)]) - =/ a (~(get by q.new) path) - =/ b (~(get by q.old) path) - ?: |(=(a b) =(~ a)) + %+ murn ~(tap by (~(uni by old) new)) + |= [=path *] + ^- (unit [^path (each page lobe)]) + =/ a (~(get by new) path) + =/ b (~(get by old) path) + ?: |(=(a b) ?=(~ a)) ~ - `[path |+lobe] + `[path u.a] == :: :: Keep any parts of the ford cache whose dependencies didn't change @@ -3495,12 +3521,31 @@ $(builds t.builds) (~(put by $(builds t.builds)) i.builds) :: + :: Updated q.yaki + :: + ++ checkout-changes + |= [=ford=args:ford:fusion changes=(map path (each page lobe))] + =/ cans=(list [=path change=(each page lobe)]) ~(tap by changes) + |- ^- [(map path [=lobe =cage]) ford-cache] + ?~ cans + [~ ford-cache.ford-args] + =^ cage ford-cache.ford-args + %- wrap:fusion + (get-value:(ford:fusion ford-args) path.i.cans) + =/ =lobe + ?- -.change.i.cans + %| p.change.i.cans + %& (page-to-lobe:util p.change.i.cans) + == + =^ so-far ford-cache.ford-args $(cans t.cans) + [(~(put by so-far) path.i.cans lobe cage) ford-cache.ford-args] + :: :: Update ankh :: ++ checkout-ankh |= $: =ford=args:ford:fusion deletes=(set path) - changes=(map path (each page lobe)) + changes=(map path [lobe cage]) =ankh == ^+ [ankh ford-cache.ford-args] @@ -3528,7 +3573,7 @@ outer-loop(dels t.dels) :: Add/change :: - =/ cans=(list [=path change=(each page lobe)]) ~(tap by changes) + =/ cans=(list [=path =lobe =cage]) ~(tap by changes) |- ^+ [ankh ford-cache.ford-args] =* outer-loop $ ?~ cans @@ -3542,31 +3587,9 @@ path.i.cans t.path.i.cans ankh (~(gut by dir.ankh) i.path.i.cans *^ankh) == - :- ankh(dir (~(put by dir.ankh) i.path.i.cans child-ankh)) + :- child-ankh(dir (~(put by dir.ankh) i.path.i.cans child-ankh)) ford-cache.ford-args - =^ cage ford-cache.ford-args - ?- -.change.i.cans - %& - %- wrap:fusion - (page-to-cage:(ford:fusion ford-args) p.change.i.cans) - :: - %| - =^ page ford-cache.ford-args - %- wrap:fusion - (lobe-to-page:(ford:fusion ford-args) p.change.i.cans) - (wrap:fusion (page-to-cage:(ford:fusion ford-args) page)) - == - :_ ford-cache.ford-args - %= ankh - fil - :- ~ :_ cage - ?- -.change.i.cans - %| p.change.i.cans - %& - %- wrap:fusion - (page-to-lobe:(ford:fusion ford-args) p.change.i.cans) - == - == + [ankh(fil `[lobe.i.cans cage.i.cans]) ford-cache.ford-args] =. ankh new-ankh outer-loop(cans t.cans) :: @@ -5180,7 +5203,7 @@ %park =^ mos ruf =/ den ((de our now ski hen ruf) our des.req) - abet:(park:den [tak ran ank mim]:req) + abet:(park:den [yuk ran]:req) [mos ..^$] :: %perm diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 21f42f900..5d33ab420 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -567,8 +567,7 @@ {$mont des/desk bem/beam} :: mount to unix {$dirk des/desk} :: mark mount dirty {$ogre pot/$@(desk beam)} :: delete mount point - {$park des/desk tak/tako ran/rang ank/ankh mim/(map path (unit mime))} - :: plumbing commit + {$park des/desk yuk/yuki ran/rang} :: plumbing commit {$perm des/desk pax/path rit/rite} :: change permissions $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade @@ -693,6 +692,10 @@ == :: ++ urge |*(a/mold (list (unce a))) :: list change ++ whom (each ship @ta) :: ship or named crew + ++ yuki :: commit + $: p/(list tako) :: parents + q/(map path (each page lobe)) :: namespace + == :: ++ yaki :: commit $: p/(list tako) :: parents q/(map path lobe) :: namespace diff --git a/pkg/arvo/ted/commit.hoon b/pkg/arvo/ted/commit.hoon index 5acaeedd1..6df99408f 100644 --- a/pkg/arvo/ted/commit.hoon +++ b/pkg/arvo/ted/commit.hoon @@ -11,56 +11,31 @@ =/ m (strand ,vase) ^- form:m :: -:: Cast to expected marks -:: -;< our=@p bind:m get-our:strandio -=/ cast-builds=(map path schematic:ford) - %- ~(urn by changes) - |= [=path =cage] - [%cast [our desk] =>((flop path) ?~(. %$ i)) %$ cage] -;< cast-results=(map path cage) bind:m (build-cages:strandio cast-builds) -:: :: Fetch current state :: +;< our=@p bind:m get-our:strandio ;< now=@da bind:m get-time:strandio =+ .^(=dome %cv /(scot %p our)/[desk]/(scot %da now)) :: -:: Apply changes to current state to create new yaki -:: -=/ new-blobs=(map path blob) - %- ~(run by cast-results) - |= =cage - =/ =page [p q.q]:cage - [%direct (page-to-lobe page) page] +:: Apply changes to current state to create new yuki :: =/ parent-tako=tako (~(got by hit.dome) let.dome) -=/ all-lobes=(map path lobe) +=/ data=(map path (each page lobe)) =+ .^ =parent=yaki %cs /(scot %p our)/[desk]/(scot %da now)/yaki/(scot %uv parent-tako) == =/ after-deletes %- ~(dif by q.parent-yaki) (malt (turn ~(tap in deletes) |=(=path [path *lobe]))) - %- ~(uni by after-deletes) - (~(run by new-blobs) |=(=blob p.blob)) + =/ after=(map path (each page lobe)) + (~(run by after-deletes) |=(=lobe |+lobe)) + %- ~(uni by after) + ^- (map path (each page lobe)) + (~(run by changes) |=(=cage &+[p q.q]:cage)) +=/ =yuki [~[parent-tako] data] :: -:: XX should we be getting the time later, after all async? -;< now=@da bind:m get-time:strandio -=/ new-yaki=yaki (make-yaki ~[parent-tako] all-lobes now) -:: -:: Apply new blobs and yaki to rang -:: -=/ =rang - :- (~(put by hut:*rang) r.new-yaki new-yaki) - (malt (turn ~(tap by new-blobs) |=([=path =blob] [p.blob blob]))) -:: -:: Checkout ankh and mime cache (derived state) -:: -=/ =ankh (checkout:clay-commit ank.dome deletes cast-results) -;< mim=(map path (unit mime)) bind:m - (checkout-cache:clay-commit our desk deletes cast-results) :: Send to clay :: -=/ args [desk r.new-yaki rang ankh mim] +=/ args [desk yuki *rang] ;< ~ bind:m (send-raw-card:strandio %pass /commit/[desk] %arvo %c %park args) (pure:m !>(~)) From 42bab4ecfbd1d5b3fc3d6b7ee6e74a7e2074661b Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 23 Apr 2020 17:12:23 -0700 Subject: [PATCH 060/280] clay: move -commit back into clay --- bin/solid.pill | 4 +-- pkg/arvo/sys/vane/clay.hoon | 56 ++++++++++++++++--------------------- pkg/arvo/ted/commit.hoon | 41 --------------------------- 3 files changed, 26 insertions(+), 75 deletions(-) delete mode 100644 pkg/arvo/ted/commit.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 976a930ef..8679b4d87 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1031dc68b42322ae2ce2cd899895497d2eb575438cd09f4d5a674c23ca74808d -size 13109651 +oid sha256:4e77c2d0e00d0fcea95fa5243b2e82a799be6732307989407eff463ef56e6f72 +size 13107095 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 0122bcfb8..de65ff1db 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -540,9 +540,6 @@ $: %f :: by %ford $>(%made gift:able:ford) :: == :: - $: %g :: by %gall - $>(%unto gift:able:gall) :: - == :: $: %j :: by %jael $>(%public-keys gift:able:jael) :: == :: @@ -3409,6 +3406,25 @@ == == :: + :: Porcelain commit + :: + ++ info + |= [deletes=(set path) changes=(map path cage)] + =/ parent-tako=tako (aeon-to-tako:ze let.dom) + =/ data=(map path (each page lobe)) + =/ parent-yaki (tako-to-yaki:ze parent-tako) + =/ after-deletes + %- ~(dif by q.parent-yaki) + (malt (turn ~(tap in deletes) |=(=path [path *lobe]))) + =/ after=(map path (each page lobe)) + (~(run by after-deletes) |=(=lobe |+lobe)) + %- ~(uni by after) + ^- (map path (each page lobe)) + (~(run by changes) |=(=cage &+[p q.q]:cage)) + :: + =/ =yuki [~[parent-tako] data] + (park yuki *rang) + :: :: Plumbing commit :: :: Guaranteed to finish in one event. @@ -5089,7 +5105,6 @@ :: %into =. hez.ruf `hen - :_ ..^$ =+ bem=(~(get by mon.ruf) des.req) ?: &(?=(~ bem) !=(%$ des.req)) ~|([%bad-mount-point-from-unix des.req] !!) @@ -5109,16 +5124,16 @@ ?=(%mime p.p.b) ?=([%hoon ~] (slag (dec (lent a)) a)) == + :_ ..^$ :~ [hen %pass /one %c %info q.bem %& one] [hen %pass /two %c %info q.bem %& two] == =+ yak=(~(got by hut.ran.ruf) (~(got by hit.dom.u.dos) let.dom.u.dos)) =+ cos=(mode-to-commit q.yak (flop s.bem) all.req fis.req) - =+ tid=:((cury cat 3) 'clay--' des.req '--' (scot %uv eny)) - =+ arg=[~ `tid %commit !>([q.bem [- + ~]:cos])] - :~ [hen %pass /both %g %deal [our our] %spider %watch /thread-result/[tid]] - [hen %pass /both %g %deal [our our] %spider %poke %spider-start !>(arg)] - == + =^ mos ruf + =/ den ((de our now ski hen ruf) our des.req) + abet:(info:den cos) + [mos ..^$] :: %merg :: direct state up ?: =(%$ des.req) @@ -5452,29 +5467,6 @@ [~ ..^$] :: %note [[hen %give +.q.hin]~ ..^$] - %unto - ?- -.p.q.hin - %kick [~ ..^$] - %poke-ack - ?~ p.p.q.hin - [~ ..^$] - [[hen %slip %d %flog %crud %into u.p.p.q.hin]~ ..^$] - :: - %watch-ack - ?~ p.p.q.hin - [~ ..^$] - [[hen %slip %d %flog %crud %into u.p.p.q.hin]~ ..^$] - :: - %fact - :_ ..^$ - ?+ p.cage.p.q.hin [hen %slip %d %flog %crud %into >%strange-into< ~]~ - %thread-done ~ - %thread-fail - =+ !<([=term =tang] q.cage.p.q.hin) - [hen %slip %d %flog %crud %into >term< tang]~ - == - == - :: %wake :: TODO: handle behn errors :: diff --git a/pkg/arvo/ted/commit.hoon b/pkg/arvo/ted/commit.hoon deleted file mode 100644 index 6df99408f..000000000 --- a/pkg/arvo/ted/commit.hoon +++ /dev/null @@ -1,41 +0,0 @@ -:: Delete `deletes`, insert/change `changes`, and don't touch anything -:: else. -:: -/- spider -/+ strandio, clay-commit -=, strand=strand:spider -=, clay -^- thread:spider -|= arg=vase -=+ !<([=desk deletes=(set path) changes=(map path cage) ~] arg) -=/ m (strand ,vase) -^- form:m -:: -:: Fetch current state -:: -;< our=@p bind:m get-our:strandio -;< now=@da bind:m get-time:strandio -=+ .^(=dome %cv /(scot %p our)/[desk]/(scot %da now)) -:: -:: Apply changes to current state to create new yuki -:: -=/ parent-tako=tako (~(got by hit.dome) let.dome) -=/ data=(map path (each page lobe)) - =+ .^ =parent=yaki %cs - /(scot %p our)/[desk]/(scot %da now)/yaki/(scot %uv parent-tako) - == - =/ after-deletes - %- ~(dif by q.parent-yaki) - (malt (turn ~(tap in deletes) |=(=path [path *lobe]))) - =/ after=(map path (each page lobe)) - (~(run by after-deletes) |=(=lobe |+lobe)) - %- ~(uni by after) - ^- (map path (each page lobe)) - (~(run by changes) |=(=cage &+[p q.q]:cage)) -=/ =yuki [~[parent-tako] data] -:: -:: Send to clay -:: -=/ args [desk yuki *rang] -;< ~ bind:m (send-raw-card:strandio %pass /commit/[desk] %arvo %c %park args) -(pure:m !>(~)) From e7bf9cc190e9bdb9a529a995bd5bb90033f37732 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 23 Apr 2020 19:07:33 -0700 Subject: [PATCH 061/280] ph: fix now that ford builds are often dripped --- pkg/arvo/app/goad.hoon | 2 +- pkg/arvo/app/spider.hoon | 7 +++++-- pkg/arvo/lib/ph/io.hoon | 8 ++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/app/goad.hoon b/pkg/arvo/app/goad.hoon index b3b04f030..27c8739a3 100644 --- a/pkg/arvo/app/goad.hoon +++ b/pkg/arvo/app/goad.hoon @@ -23,7 +23,7 @@ ++ on-init :: subscribe to /sys and do initial goad :: - [[(warp bowl) (wait bowl) ~] this] + [[(warp bowl) ~] this] :: ++ on-save on-save:def ++ on-load on-load:def diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index 3a3dca541..ece6fe71d 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -87,9 +87,10 @@ == :: ++ tap-yarn - =| =yarn |= =trie - ^- (list [=^yarn =thread-form]) + %- flop :: preorder + =| =yarn + |- ^- (list [=^yarn =thread-form]) %+ welp ?~ yarn ~ @@ -134,6 +135,8 @@ ++ on-poke |= [=mark =vase] ^- (quip card _this) + ?: ?=(%spider-kill mark) + (on-load on-save) =^ cards state ?+ mark (on-poke:def mark vase) %spider-input (on-poke-input:sc !<(input vase)) diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon index 3f750c7b0..e5dca66ac 100644 --- a/pkg/arvo/lib/ph/io.hoon +++ b/pkg/arvo/lib/ph/io.hoon @@ -46,7 +46,11 @@ :: probably the best option because the thread can delay until it :: gets a positive ack on the subscription. :: - ;< ~ bind:m (sleep ~s0) + :: Threads might not get built until a %writ is dripped back to + :: spider. Drips are at +(now), so we sleep until two clicks in the + :: future. + :: + ;< ~ bind:m (sleep `@dr`2) (pure:m ~) :: ++ end-test @@ -150,7 +154,7 @@ :: hit the first of these cases, and other ships will hit the :: second. :: - ?: ?| (f "clay: committed initial filesystem (all)") + ?: ?| (f ":dojo>") (f "is your neighbor") == (pure:m ~) From d3b5fba8646ed7bdc8d5fc4d39187abda7b09bf4 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 24 Apr 2020 12:17:22 -0700 Subject: [PATCH 062/280] clay: prepare for switching first commit to fusion Can't be done right now because get-fit doesn't look at the incoming changes. --- pkg/arvo/sys/vane/clay.hoon | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index de65ff1db..ffc8bfe01 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3410,6 +3410,12 @@ :: ++ info |= [deletes=(set path) changes=(map path cage)] + ?: =(0 let.dom) + ?> ?=(~ deletes) + =/ data=(map path (each page lobe)) + (~(run by changes) |=(=cage &+[p q.q]:cage)) + (park [~ data] *rang) + :: =/ parent-tako=tako (aeon-to-tako:ze let.dom) =/ data=(map path (each page lobe)) =/ parent-yaki (tako-to-yaki:ze parent-tako) @@ -3441,7 +3447,10 @@ lat.ran (~(uni by lat.rang) lat.ran) == =/ [deletes=(set path) changes=(map path (each page lobe))] - =/ previous-yaki (aeon-to-yaki:ze let.dom) + =/ previous-yaki + ?: =(0 let.dom) + *yaki + (aeon-to-yaki:ze let.dom) (get-changes q.previous-yaki q.yuki) ~| [from=let.dom deletes=deletes changes=~(key by changes)] =. ..park (emil (print deletes ~(key by changes))) @@ -3504,7 +3513,7 @@ ~ `path :: - %- silt ^- (list [path (each page lobe)]) + %- malt ^- (list [path (each page lobe)]) %+ murn ~(tap by (~(uni by old) new)) |= [=path *] ^- (unit [^path (each page lobe)]) @@ -5128,8 +5137,11 @@ :~ [hen %pass /one %c %info q.bem %& one] [hen %pass /two %c %info q.bem %& two] == - =+ yak=(~(got by hut.ran.ruf) (~(got by hit.dom.u.dos) let.dom.u.dos)) - =+ cos=(mode-to-commit q.yak (flop s.bem) all.req fis.req) + =/ =yaki + ?: =(0 let.dom.u.dos) + *yaki + (~(got by hut.ran.ruf) (~(got by hit.dom.u.dos) let.dom.u.dos)) + =+ cos=(mode-to-commit q.yaki (flop s.bem) all.req fis.req) =^ mos ruf =/ den ((de our now ski hen ruf) our des.req) abet:(info:den cos) From dca81a2ee2353e18914ee69e91de690b1af37f27 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 24 Apr 2020 17:44:29 -0700 Subject: [PATCH 063/280] clay: prepare for kernel updates --- bin/solid.pill | 4 +- pkg/arvo/lib/ph/io.hoon | 19 ++++- pkg/arvo/sys/vane/clay.hoon | 149 ++++++++++++++++++++++++++++++++++-- pkg/arvo/sys/zuse.hoon | 1 + 4 files changed, 162 insertions(+), 11 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 8679b4d87..d51066f30 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e77c2d0e00d0fcea95fa5243b2e82a799be6732307989407eff463ef56e6f72 -size 13107095 +oid sha256:a121bee8b108c9faad1e6110d6a5e254f1543345892c9503dc6361dd5ff86e31 +size 13132967 diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon index e5dca66ac..3e18f821f 100644 --- a/pkg/arvo/lib/ph/io.hoon +++ b/pkg/arvo/lib/ph/io.hoon @@ -216,13 +216,20 @@ |= [her=ship =desk extra=@t] =/ m (strand ,@t) ^- form:m + (touch her desk /sur/aquarium/hoon extra) +:: +:: Modify path on the given ship +:: +++ touch + |= [her=ship =desk pax=path extra=@t] + =/ m (strand ,@t) + ^- form:m ~& > "touching file on {}/{}" ;< ~ bind:m (mount her desk) ;< our=@p bind:m get-our ;< now=@da bind:m get-time =/ host-pax - /(scot %p our)/home/(scot %da now)/sur/aquarium/hoon - =/ pax /sur/aquarium/hoon + (weld /(scot %p our)/home/(scot %da now) pax) =/ aqua-pax ;: weld /i/(scot %p her)/cx/(scot %p her)/[desk]/(scot %da now) @@ -241,6 +248,13 @@ ++ check-file-touched |= [=ship =desk warped=@t] =/ m (strand ,~) + (check-touched ship desk /sur/aquarium/hoon warped) +:: +:: Check path on the given desk has the given contents. +:: +++ check-touched + |= [=ship =desk pax=path warped=@t] + =/ m (strand ,~) ~& > "checking file touched on {}/{}" ;< ~ bind:m (mount ship desk) ^- form:m @@ -254,7 +268,6 @@ :: ?. &(=(ship her) ?=(?(%init %ergo %doze) -.q.unix-effect)) loop - =/ pax /sur/aquarium/hoon =/ aqua-pax ;: weld /i/(scot %p ship)/cx/(scot %p ship)/[desk]/(scot %da now) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index ffc8bfe01..f1008d2d3 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -155,6 +155,7 @@ cez=(map @ta crew) :: permission groups cue=(qeu [=duct =task:able]) :: queued requests act=active-write :: active write + pud=(unit [=desk =yuki]) :: pending update == :: :: :: Currently active write @@ -492,6 +493,7 @@ $: %c :: to %clay $> $? %info :: internal edit %merg :: merge desks + %pork :: %warp :: %werp :: == :: @@ -3414,7 +3416,7 @@ ?> ?=(~ deletes) =/ data=(map path (each page lobe)) (~(run by changes) |=(=cage &+[p q.q]:cage)) - (park [~ data] *rang) + (park | [~ data] *rang) :: =/ parent-tako=tako (aeon-to-tako:ze let.dom) =/ data=(map path (each page lobe)) @@ -3429,7 +3431,7 @@ (~(run by changes) |=(=cage &+[p q.q]:cage)) :: =/ =yuki [~[parent-tako] data] - (park yuki *rang) + (park | yuki *rang) :: :: Plumbing commit :: @@ -3441,7 +3443,7 @@ :: ++ park |^ - |= [=yuki =rang] + |= [updated=? =yuki =rang] ^+ ..park =: hut.ran (~(uni by hut.rang) hut.ran) lat.ran (~(uni by lat.rang) lat.ran) @@ -3453,7 +3455,6 @@ (aeon-to-yaki:ze let.dom) (get-changes q.previous-yaki q.yuki) ~| [from=let.dom deletes=deletes changes=~(key by changes)] - =. ..park (emil (print deletes ~(key by changes))) :: :: promote ford cache :: promote and fill in ankh @@ -3464,8 +3465,12 @@ =/ =args:ford:fusion [ank.dom deletes changes lat.ran fod.dom] :: + :: ?: &(!updated !=(~ (need-sys-update changes))) + :: (sys-update args yuki changes) + =. ..park (emil (print deletes ~(key by changes))) =^ change-cages ford-cache.args - (checkout-changes args q.yuki) + (checkout-changes args changes) + :: =/ cont (sane-changes changes change-cages) =/ new-blobs=(map lobe blob) %- malt %+ turn ~(tap by change-cages) @@ -3488,6 +3493,7 @@ :: =^ ankh ford-cache.args (checkout-ankh args deletes change-cages ank.dom) + :: =/ null (sane-ankh cont ankh) =. ankh.args ankh =. ank.dom ankh =^ mim ford-cache.args @@ -3698,6 +3704,129 @@ [%leaf (trip a)] [%leaf (dash:us (trip a) '\'' ~)] -- + :: + :: Check sanity + :: + ++ sane-changes + |= $: changes=(map path (each page lobe)) + change-cages=(map path [lobe cage]) + == + ^- [(map path [lobe cage]) args:ford:fusion] + =/ =yaki (~(got by hut.ran) (~(got by hit.dom) let.dom)) + :: Assert all new lobes are reachable + :: + =/ files=(list [=path =lobe]) ~(tap by q.yaki) + |- ^+ *sane-changes + ?^ files + ?. (~(has by lat.ran) lobe.i.files) + ~| missing-lobe=[path lobe] + !! + $(files t.files) + :: + =/ all-changes=(map path (each page lobe)) + =/ original=(map path (each page lobe)) + (~(run by q.yaki) |=(=lobe |+lobe)) + (~(uni by original) changes) + =/ =args:ford:fusion + [*ankh ~ all-changes lat.ran *ford-cache] + =^ all-change-cages ford-cache.args + (checkout-changes args all-changes) + =/ ccs=(list [=path =lobe =cage]) ~(tap by change-cages) + |- ^+ *sane-changes + ?^ ccs + ?. =(`cage.i.ccs (~(get by all-change-cages) path.i.ccs)) + ~| not-same-cages+path + !! + $(ccs t.ccs) + [all-change-cages args] + :: + ++ sane-ankh + |= $: [change-cages=(map path [lobe cage]) =ford=args:ford:fusion] + =test=ankh + == + =^ ankh ford-cache.ford-args + (checkout-ankh ford-args ~ change-cages *ankh) + ?. =(ankh test-ankh) + ~| %not-same-ankh + !! + ~ + :: + :: Find /sys changes + :: + ++ need-sys-update + |= changes=(map path (each page lobe)) + ^- (map path (each page lobe)) + ~+ + %- malt + %+ skim ~(tap by changes) + |= [=path *] + ?| =(/sys/hoon/hoon path) + =(/sys/arvo/hoon path) + =(/sys/zuse/hoon path) + =(/sys/vane (scag 2 path)) + == + :: + :: Delay current update until sys update is complete + :: + ++ sys-update + |= [=ford=args:ford:fusion =yuki changes=(map path (each page lobe))] + ^+ ..park + =/ updates (need-sys-update changes) + :: Don't save ford cache so it gets properly handled when we + :: restart the commit + :: + =^ updates-cages=(map path [lobe cage]) ford-cache.ford-args + (checkout-changes ford-args updates) + ?> =(~ pud) + =. pud `[syd yuki] + |^ ?: (~(has by updates) /sys/hoon/hoon) + reset + ?: (~(has by updates) /sys/arvo/hoon) + reset + ?: (~(has by updates) /sys/zuse/hoon) + reboot + reload-all + :: + ++ reset + =^ hoon=cage ford-cache.ford-args + %- wrap:fusion + (get-value:(ford:fusion ford-args) /sys/hoon/hoon) + =^ arvo=cage ford-cache.ford-args + %- wrap:fusion + (get-value:(ford:fusion ford-args) /sys/arvo/hoon) + =. ..park + %- emit + [hen %pass /reset %d %flog %lyra !<(@t q.hoon) !<(@t q.arvo)] + reboot + :: + ++ reboot + =^ zuse=cage ford-cache.ford-args + %- wrap:fusion + (get-value:(ford:fusion ford-args) /sys/zuse/hoon) + =. ..park + %- emit + [hen %pass /reboot %d %flog %veer %$ /sys/zuse/hoon !<(@t q.zuse)] + reload-all + :: + ++ reload-all + =/ vanes=(list term) + ~[%ames %behn %clay %dill %eyre %ford %gall %iris %jael] + |- ^+ ..park + ?~ vanes + (emit hen %slip %c %pork ~) + =. ..park (reload i.vanes) + $(vanes t.vanes) + :: + ++ reload + |= =term + =^ vane=cage ford-cache.ford-args + %- wrap:fusion + (get-value:(ford:fusion ford-args) /sys/vane/[term]/hoon) + %- emit + =/ tip (end 3 1 term) + =/ =path /sys/vane/[term]/hoon + [hen %pass /reload %d %flog %veer tip path !<(@t q.vane)] + -- -- :: :: Set permissions for a node. @@ -5230,7 +5359,15 @@ %park =^ mos ruf =/ den ((de our now ski hen ruf) our des.req) - abet:(park:den [yuk ran]:req) + abet:(park:den | [yuk ran]:req) + [mos ..^$] + :: + %pork + =/ [syd=desk =yuki] (need pud.ruf) + =. pud.ruf ~ + =^ mos ruf + =/ den ((de our now ski hen ruf) our syd) + abet:(park:den & yuki *rang) [mos ..^$] :: %perm diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 5d33ab420..240065ed1 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -569,6 +569,7 @@ {$ogre pot/$@(desk beam)} :: delete mount point {$park des/desk yuk/yuki ran/rang} :: plumbing commit {$perm des/desk pax/path rit/rite} :: change permissions + {$pork ~} :: resume commit $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade {$warp wer/ship rif/riff} :: internal file req From 48caee7579198a6e6f20b1185335fbc0294d871f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 27 Apr 2020 20:39:18 -0400 Subject: [PATCH 064/280] clay: fix +build-fit --- pkg/arvo/sys/vane/clay.hoon | 43 +++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index f1008d2d3..a9f95bd25 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2641,21 +2641,6 @@ ?~ kid=(~(get by dir.nak) i.path) ~ $(nak u.kid, path t.path) - :: +get-fit: produce path with suffix /'s maybe converted to -'s - :: - ++ get-fit - |= [pre=@tas pax=@tas] - ^- (unit path) - ?~ nuk=(~(get by dir.nak) pre) - ~ - =. nak u.nuk - =/ paz (segments pax) - |- ^- (unit path) - ?~ paz ~ - =/ pax (snoc i.paz %hoon) - ?^ (get pax) - `[pre pax] - $(paz t.paz) -- ++ with-face |=([face=@tas =vase] vase(p [%face face p.vase])) ++ with-faces @@ -3083,12 +3068,34 @@ [!>(..zuse) nub] :: TODO implement :: +build-fit: build file at path, maybe converting '-'s to '/'s in path :: - :: TODO: traverses the $ankh twice; could be optimized - :: ++ build-fit |= [pre=@tas pax=@tas] ^- [vase state] - (build-file ~|(no-file+pax (need (~(get-fit an ankh) [pre pax])))) + (build-file (fit-path pre pax)) + :: + :: +fit-path: find path, maybe converting '-'s to '/'s + :: + :: Try '-' before '/', applied left-to-right through the path, + :: e.g. 'a-foo/bar' takes precedence over 'a/foo-bar'. + :: + ++ fit-path + |= [pre=@tas pax=@tas] + ^- path + =/ paz (segments pax) + |- ^- path + ?~ paz ~|(no-file+pre^pax !!) + =/ pux=path pre^(snoc i.paz %hoon) + ?: (~(has in deletes) pux) + ~& path-in-deletes+pux + $(paz t.paz) + ?: (~(has by changes) pux) + ~& path-in-changes+pux + pux + ?^ (~(get an ankh) pux) + ~& path-in-ankh+pux + pux + ~& path-not-in-ankh+pux + $(paz t.paz) -- -- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: From 80541b39aa445e14c020329b03a724f26f27cb71 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 24 Apr 2020 00:13:19 -0400 Subject: [PATCH 065/280] gall: live update agents --- pkg/arvo/app/goad.hoon | 39 ++-------------------------- pkg/arvo/sys/vane/gall.hoon | 52 +++++++++++++++++++++++++++++++------ pkg/arvo/sys/zuse.hoon | 3 ++- 3 files changed, 48 insertions(+), 46 deletions(-) diff --git a/pkg/arvo/app/goad.hoon b/pkg/arvo/app/goad.hoon index 27c8739a3..b90a0f0e2 100644 --- a/pkg/arvo/app/goad.hoon +++ b/pkg/arvo/app/goad.hoon @@ -3,28 +3,15 @@ ^- agent:gall => |% - ++ warp - |= =bowl:gall - [%pass /clay %arvo %c %warp our.bowl %home ~ %next %z da+now.bowl /sys] - :: - ++ wait - |= =bowl:gall - [%pass /behn %arvo %b %wait +(now.bowl)] - :: ++ goad |= force=? :~ [%pass /gall %arvo %g %goad force ~] == -- -:: |_ =bowl:gall +* this . def ~(. (default-agent this %|) bowl) -++ on-init - :: subscribe to /sys and do initial goad - :: - [[(warp bowl) ~] this] -:: +++ on-init on-init:def ++ on-save on-save:def ++ on-load on-load:def ++ on-poke @@ -39,28 +26,6 @@ ++ on-leave on-leave:def ++ on-peek on-peek:def ++ on-agent on-agent:def -++ on-arvo - |= [=wire =sign-arvo] - ?+ wire (on-arvo:def wire sign-arvo) - [%clay ~] - :: on writ, wait - :: - ?> ?=(%writ +<.sign-arvo) - :_ this - :~ (warp bowl) - (wait bowl) - == - :: - [%behn ~] - :: on wake, goad - :: - ?> ?=(%wake +<.sign-arvo) - ?^ error.sign-arvo - :_ this :_ ~ - [%pass /dill %arvo %d %flog %crud %goad-fail u.error.sign-arvo] - %- (slog leaf+"goad: recompiling all apps" ~) - [(goad &) this] - == -:: +++ on-arvo on-arvo:def ++ on-fail on-fail:def -- diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index d27f94d6c..f3b5d693d 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -170,12 +170,11 @@ :: ++ mo-receive-core ~/ %mo-receive-core - |= [dap=term bek=beak =rant:clay] + |= [dap=term bek=beak =cage] ^+ mo-core :: - =/ =cage r.rant ?. =(%vase p.cage) - (mo-give %onto |+[leaf+"gall: bizarre mark {} for agent {}"]~) + (mo-give %onto |+[leaf+"gall: bad mark {} for agent {}"]~) :: =/ maybe-new-agent (mule |.(!<(agent !<(vase q.cage)))) ?: ?=(%| -.maybe-new-agent) @@ -212,6 +211,22 @@ =. mo-core (mo-clear-queue dap) =/ =suss [dap %boot now] (mo-give %onto [%.y suss]) + :: +mo-subscribe-to-agent-builds: request agent update notices + :: + ++ mo-subscribe-to-agent-builds + |= date=@da + ^+ mo-core + =. mo-core (mo-abed system-duct.state) + =/ =wire /sys/lyv :: TODO: add $aeon to wire as sanity check + =. mo-core (mo-pass /sys/lyv %c %warp our %home ~) + =/ =mool:clay + :- da+date + %- ~(gas in *(set [care:clay path])) + %+ turn ~(tap in ~(key by yokes.state)) + |= dap=term + ^- [care:clay path] + [%a /app/[dap]/hoon] + (mo-pass wire %c %warp our %home ~ %mult mool) :: +mo-send-foreign-request: handle local request to .ship :: ++ mo-send-foreign-request @@ -307,6 +322,7 @@ ^+ mo-core :: ?+ -.path !! + %lyv (mo-handle-sys-lyv path sign-arvo) %era (mo-handle-sys-era path sign-arvo) %cor (mo-handle-sys-cor path sign-arvo) %lag (mo-handle-sys-lag path sign-arvo) @@ -326,7 +342,7 @@ ?. ?=(%breach -.public-keys-result.sign-arvo) mo-core (mo-breach who.public-keys-result.sign-arvo) - :: +mo-handle-sys-cor: receive a cor from %ford. + :: +mo-handle-sys-cor: receive a built agent from %clay :: ++ mo-handle-sys-cor |= [=path =sign-arvo] @@ -334,11 +350,30 @@ :: ?> ?=([%cor @ @ @ @ ~] path) =/ [dap=term her=@ta desk=@ta dat=@ta ~] t.path - =/ =beak [(slav %p her) desk da+(slav da+dat)] + =/ tim (slav da+dat) + =/ =beak [(slav %p her) desk da+tim] ?> ?=([?(%b %c) %writ *] sign-arvo) ?^ p.sign-arvo - (mo-receive-core dap beak u.p.sign-arvo) + =. mo-core (mo-receive-core dap beak r.u.p.sign-arvo) + (mo-subscribe-to-agent-builds tim) (mo-give %onto |+[leaf+"gall: failed to build agent {}"]~) + :: + :: + ++ mo-handle-sys-lyv + |= [=path =sign-arvo] + ^+ mo-core + ?> ?=([%lyv ~] path) + ?> ?=([?(%b %c) %wris *] sign-arvo) + =/ bek=beak [our %home p.sign-arvo] + =/ nex=(list [=care:clay =^path]) ~(tap in q.sign-arvo) + =; cor (mo-subscribe-to-agent-builds:cor p.p.sign-arvo) + %+ roll nex + |= [[=care:clay =^path] cor=_mo-core] + ^+ cor + ?> =(%a care) + =/ dap dap:;;([%app dap=@tas %hoon ~] path) + =/ cage (need (need (ski [%141 %noun] ~ %ca bek (flop path)))) + (mo-receive-core:cor dap bek cage) :: +mo-handle-sys-lag: handle an ames %clog notification :: ++ mo-handle-sys-lag @@ -1832,7 +1867,8 @@ $% {$a gift:able:ames} $: $b $% gift:able:behn - [%writ riot:clay] + $>(%wris gift:able:clay) + $>(%writ gift:able:clay) $>(%mere gift:able:clay) $>(%unto gift:able:gall) == @@ -1882,7 +1918,7 @@ |= [=wire =duct dud=(unit goof) hin=(hypo sign-arvo)] ^- [(list move) _gall-payload] ?^ dud - ~|(%gall-take-dud (mean tang.u.dud)) + ~&(%gall-take-dud ((slog tang.u.dud) [~ gall-payload])) :: ~| [%gall-take-failed wire] :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 240065ed1..5c879f54a 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -2405,7 +2405,8 @@ $% {$a gift:able:ames} $: $b $% gift:able:behn - [%writ p=riot:clay] + $>(%wris gift:able:clay) + $>(%writ gift:able:clay) $>(%mere gift:able:clay) $>(%unto gift:able:gall) == From 3eac215a1c9bf8d1b0ba9c5cf26122ca71bd01a2 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 28 Apr 2020 00:52:07 -0400 Subject: [PATCH 066/280] clay: fix %mime->%hoon bootstrapping --- pkg/arvo/sys/vane/clay.hoon | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index a9f95bd25..a1663133c 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2699,7 +2699,7 @@ ++ get-value |= =path ^- [cage state] - ~| %error-validating-path^path + ~| %error-validating^path ?^ got=(~(get by baked.nub) path) [u.got nub] =; [res=cage bun=state] @@ -2715,7 +2715,7 @@ [p.u.change nub] ~| %ugly-lobe^p.u.change^path (lobe-to-page p.u.change) - =^ cage nub (validate-path path page) + =^ cage nub (validate-page path page) [cage nub] ?< (~(has in deletes) path) :_(nub (need (~(get an ankh) path))) @@ -2819,6 +2819,11 @@ |= [a=mark b=mark] ^- [tube state] ~| error-building-cast+[a b] + ?: =([%mime %hoon] [a b]) + :_ nub + |= sam=vase + =+ !<(=mime sam) + !>(q.q.mime) ?^ got=(~(get by casts.cache.nub) [a b]) =? stack.nub ?=(^ stack.nub) stack.nub(i (~(uni in i.stack.nub) dez.u.got)) @@ -2882,9 +2887,10 @@ [[p q.q]:cage nub] == :: - ++ validate-path + ++ validate-page |= [=path =page] ^- [cage state] + ~| validate-page-fail+path^from+p.page =/ mak=mark (head (flop path)) ?: =(mak p.page) (page-to-cage page) @@ -2897,6 +2903,8 @@ ^- [cage state] ?: =(%hoon p.page) :_(nub [%hoon -:!>(*@t) q.page]) + ?: =(%mime p.page) + :_(nub [%mime !>(;;(mime q.page))]) =^ =dais nub (get-mark p.page) :_(nub [p.page (vale:dais q.page)]) :: @@ -3086,15 +3094,11 @@ ?~ paz ~|(no-file+pre^pax !!) =/ pux=path pre^(snoc i.paz %hoon) ?: (~(has in deletes) pux) - ~& path-in-deletes+pux $(paz t.paz) ?: (~(has by changes) pux) - ~& path-in-changes+pux pux ?^ (~(get an ankh) pux) - ~& path-in-ankh+pux pux - ~& path-not-in-ankh+pux $(paz t.paz) -- -- From 0a906dc29709b7f3c74bfead2e928273b2c584fd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 28 Apr 2020 05:56:28 -0400 Subject: [PATCH 067/280] clay: use %mime cache on %into --- pkg/arvo/sys/vane/clay.hoon | 135 ++++++++++++++++++++---------------- 1 file changed, 77 insertions(+), 58 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index a1663133c..31c3257b5 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -566,6 +566,52 @@ ^- form:m |= clad-input [[path note]~ ~ %done ~] +:: By convention: paf == (weld pax pat) +:: +++ mode-to-commit + |= [hat=(map path lobe) pax=path all=? mod=mode] + ^- [deletes=(set path) changes=(map path cage)] + =/ deletes + %- silt + %+ turn + ^- (list path) + %+ weld + ^- (list path) + %+ murn mod + |= [pat=path mim=(unit mime)] + ^- (unit path) + ?^ mim + ~ + `pat + ^- (list path) + ?. all + ~ + =+ mad=(malt mod) + =+ len=(lent pax) + =/ descendants=(list path) + %+ turn + %+ skim ~(tap by hat) + |= [paf=path lob=lobe] + =(pax (scag len paf)) + |= [paf=path lob=lobe] + (slag len paf) + %+ skim + descendants + |= pat=path + (~(has by mad) pat) + |= pat=path + (weld pax pat) + :: + =/ changes + %- malt + %+ murn mod + |= [pat=path mim=(unit mime)] + ^- (unit [path cage]) + ?~ mim + ~ + `[(weld pax pat) %mime !>(u.mim)] + :: + [deletes changes] :: :: Wait for ford to respond :: @@ -2162,14 +2208,13 @@ ++ apply-changes-to-mim |= [mim=(map path mime) changes=(map path (unit mime))] ^- (map path mime) - =/ changes-l=(list [pax=path change=(unit mime)]) - ~(tap by changes) + =/ caz=(list [pax=path change=(unit mime)]) ~(tap by changes) |- ^- (map path mime) - ?~ changes-l + ?~ caz mim - ?~ change.i.changes-l - $(changes-l t.changes-l, mim (~(del by mim) pax.i.changes-l)) - $(changes-l t.changes-l, mim (~(put by mim) [pax u.change]:i.changes-l)) + ?~ change.i.caz + $(caz t.caz, mim (~(del by mim) pax.i.caz)) + $(caz t.caz, mim (~(put by mim) [pax u.change]:i.caz)) :: :: Create a schematic to validate a page. :: @@ -3423,6 +3468,7 @@ :: ++ info |= [deletes=(set path) changes=(map path cage)] + ^+ ..park ?: =(0 let.dom) ?> ?=(~ deletes) =/ data=(map path (each page lobe)) @@ -3444,6 +3490,29 @@ =/ =yuki [~[parent-tako] data] (park | yuki *rang) :: + :: Unix commit + :: + ++ into + |= [pax=path all=? mod=(list [pax=path mim=(unit mime)])] + ^+ ..park + :: filter out unchanged, cached %mime values + :: + =. mod + %+ skip mod + |= [pax=path mim=(unit mime)] + ?~ mim + | + ?~ mum=(~(get by mim.dom) pax) + | + :: TODO: check mimetype + :: + =(q.u.mim q.u.mum) + =/ =yaki + ?: =(0 let.dom) + *yaki + (~(got by hut.ran) (~(got by hit.dom) let.dom)) + (info (mode-to-commit q.yaki pax all mod)) + :: :: Plumbing commit :: :: Guaranteed to finish in one event. @@ -3509,6 +3578,7 @@ =. ank.dom ankh =^ mim ford-cache.args (checkout-mime args deletes ~(key by changes)) + ~& mim+~(key by mim) =. mim.dom (apply-changes-to-mim mim.dom mim) =. fod.dom ford-cache.args :: @@ -5277,14 +5347,9 @@ :~ [hen %pass /one %c %info q.bem %& one] [hen %pass /two %c %info q.bem %& two] == - =/ =yaki - ?: =(0 let.dom.u.dos) - *yaki - (~(got by hut.ran.ruf) (~(got by hit.dom.u.dos) let.dom.u.dos)) - =+ cos=(mode-to-commit q.yaki (flop s.bem) all.req fis.req) =^ mos ruf =/ den ((de our now ski hen ruf) our des.req) - abet:(info:den cos) + abet:(into:den (flop s.bem) all.req fis.req) [mos ..^$] :: %merg :: direct state up @@ -5674,52 +5739,6 @@ ^- rand [p q [p q.q]:r] :: -:: By convention: paf == (weld pax pat) -:: -++ mode-to-commit - |= [hat=(map path lobe) pax=path all=? mod=mode] - ^- [deletes=(set path) changes=(map path cage)] - =/ deletes - %- silt - %+ turn - ^- (list path) - %+ weld - ^- (list path) - %+ murn mod - |= [pat=path mim=(unit mime)] - ^- (unit path) - ?^ mim - ~ - `pat - ^- (list path) - ?. all - ~ - =+ mad=(malt mod) - =+ len=(lent pax) - =/ descendants=(list path) - %+ turn - %+ skim ~(tap by hat) - |= [paf=path lob=lobe] - =(pax (scag len paf)) - |= [paf=path lob=lobe] - (slag len paf) - %+ skim - descendants - |= pat=path - (~(has by mad) pat) - |= pat=path - (weld pax pat) - :: - =/ changes - %- malt - %+ murn mod - |= [pat=path mim=(unit mime)] - ^- (unit [path cage]) - ?~ mim - ~ - `[(weld pax pat) %mime !>(u.mim)] - :: - [deletes changes] :: ++ mode-to-soba |= {hat/(map path lobe) pax/path all/? mod/mode} From 004d0624da76417190bc572d3661e460f404e32a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 28 Apr 2020 06:23:53 -0400 Subject: [PATCH 068/280] clay: remove stray print --- pkg/arvo/sys/vane/clay.hoon | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 31c3257b5..a13778b71 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3578,7 +3578,6 @@ =. ank.dom ankh =^ mim ford-cache.args (checkout-mime args deletes ~(key by changes)) - ~& mim+~(key by mim) =. mim.dom (apply-changes-to-mim mim.dom mim) =. fod.dom ford-cache.args :: From 87818b8795c2f6e864f11b380dfedb595565efa1 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 28 Apr 2020 06:37:43 -0400 Subject: [PATCH 069/280] clay: report cache sizes in |mass --- pkg/arvo/sys/vane/clay.hoon | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index a13778b71..ea7adf75e 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -5493,7 +5493,15 @@ :_ ..^$ :_ ~ :^ hen %give %mass :+ %clay %| - :~ domestic+&+rom.ruf + =/ domestic + %+ turn (sort ~(tap by dos.rom.ruf) aor) + |= [=desk =dojo] + :+ desk %| + :~ ankh+&+ank.dom.dojo + mime+&+mim.dom.dojo + ford+&+fod.dom.dojo + == + :~ domestic+|+domestic foreign+&+hoy.ruf :+ %object-store %| :~ commits+&+hut.ran.ruf From 22aa98e7174d4e700aa222c150c499312d3629c5 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 24 Apr 2020 04:31:27 -0400 Subject: [PATCH 070/280] gall: WIP use ford fusion for mark casting --- pkg/arvo/sys/vane/gall.hoon | 349 ++++++++++++++++++++---------------- 1 file changed, 193 insertions(+), 156 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index f3b5d693d..ad34b7092 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -11,7 +11,7 @@ +$ move [=duct move=(wind note-arvo gift-arvo)] :: +state-5: overall gall state, versioned :: -+$ state-5 [%5 state] ++$ state-6 [%6 state] :: +state: overall gall state :: :: system-duct: TODO document @@ -47,7 +47,8 @@ :: watches: incoming and outgoing subscription state :: agent: agent core :: beak: compilation source -:: marks: mark conversion requests +:: marks: mark conversion configuration +:: casts: enqueueed mark conversion requests :: +$ yoke $: control-duct=duct @@ -57,6 +58,7 @@ =agent =beak marks=(map duct mark) + casts=(qeu [=mars:clay =vase]) == :: +blocked-move: enqueued move to an agent :: @@ -103,7 +105,7 @@ %missing == -- -=| state=state-5 +=| state=state-6 |= [our=ship now=@da eny=@uvJ ski=sley] ~% %gall-top ..is ~ |% @@ -403,18 +405,13 @@ ^+ mo-core :: ?> ?=([%pel @ ~] path) - ?> ?=([%f %made *] sign-arvo) - :: - ?- result.sign-arvo - [%incomplete *] - (mo-give %unto %poke-ack `tang.result.sign-arvo) - :: - [%complete %error *] - (mo-give %unto %poke-ack `message.build-result.result.sign-arvo) - :: - [%complete %success *] - (mo-give %unto %fact (result-to-cage:ford build-result.result.sign-arvo)) - == + ?> ?=([?(%b %c) %writ *] sign-arvo) + =/ dap=term i.t.path + =/ =routes [disclosing=~ attributing=our] :: TODO is this right? + %+ mo-give %unto + ?~ p.sign-arvo + poke-ack+`[leaf+"gall: fact cast failed for agent {}"]~ + fact+r.u.p.sign-arvo :: +mo-handle-sys-rep: reverse request. :: :: On receipt of a valid +sign from %ford, sets state to the @@ -753,36 +750,34 @@ :: Otherwise simply apply the action to the agent. :: ++ mo-handle-local - |= [=ship agent=term =deal] + |= [=ship dap=term =deal] ^+ mo-core :: =/ =routes [disclosing=~ attributing=ship] - =/ is-running (~(has by yokes.state) agent) - =/ is-blocked (~(has by blocked.state) agent) + =/ is-running (~(has by yokes.state) dap) + =/ is-blocked (~(has by blocked.state) dap) :: - ?: |(!is-running is-blocked) - =/ blocked=(qeu blocked-move) - =/ waiting (~(get by blocked.state) agent) - =/ deals (fall waiting *(qeu blocked-move)) - =/ deal [hen routes deal] - (~(put to deals) deal) - :: - %- (slog leaf+"gall: not running {} yet, got {<-.deal>}" ~) - %_ mo-core - blocked.state (~(put by blocked.state) agent blocked) - == - (mo-apply agent routes deal) + ?: &(is-running !is-blocked) + (mo-apply dap routes deal) + :: + %- (slog leaf+"gall: not running {} yet, got {<-.deal>}" ~) + =. blocked.state + %+ ~(put by blocked.state) dap + ^- (qeu blocked-move) + %. [hen routes deal] + ~(put to (~(gut by blocked.state) dap *(qeu blocked-move))) + mo-core :: +mo-handle-ames-request: handle %ames request message. :: ++ mo-handle-ames-request - |= [=ship agent-name=term =ames-request] + |= [=ship dap=term =ames-request] ^+ mo-core :: %u/%leave gets automatically acked :: =. mo-core (mo-track-ship ship) =? mo-core ?=(%u -.ames-request) (mo-give %done ~) :: - =/ =wire /sys/req/(scot %p ship)/[agent-name] + =/ =wire /sys/req/(scot %p ship)/[dap] :: =/ =deal ?- -.ames-request @@ -791,7 +786,7 @@ %s [%watch path.ames-request] %u [%leave ~] == - (mo-pass wire %g %deal [ship our] agent-name deal) + (mo-pass wire %g %deal [ship our] dap deal) :: +mo-handle-ames-response: handle ames response message. :: ++ mo-handle-ames-response @@ -821,12 +816,12 @@ :: ++ ap ~% %gall-ap +> ~ - |_ $: agent-name=term - agent-routes=routes - agent-duct=duct - agent-moves=(list move) - agent-config=(list (each suss tang)) - current-agent=yoke + |_ $: ap-name=term + ap-routes=routes + ap-duct=duct + ap-moves=(list move) + ap-config=(list (each suss tang)) + ap-yoke=yoke == ++ ap-core . :: +ap-abed: initialise state for an agent, with the supplied routes. @@ -847,21 +842,21 @@ now running(stats stats) :: - =. agent-name dap - =. agent-routes routes - =. current-agent yoke - =. agent-duct hen + =. ap-name dap + =. ap-routes routes + =. ap-yoke yoke + =. ap-duct hen ap-core :: +ap-abet: resolve moves. :: ++ ap-abet ^+ mo-core :: - =/ running (~(put by yokes.state) agent-name current-agent) + =/ running (~(put by yokes.state) ap-name ap-yoke) =/ moves =/ giver |=(report=(each suss tang) [hen %give %onto report]) - =/ from-suss (turn agent-config giver) - :(weld agent-moves from-suss moves) + =/ from-suss (turn ap-config giver) + :(weld ap-moves from-suss moves) :: %_ mo-core yokes.state running @@ -875,7 +870,7 @@ ++ ap-from-internal ~/ %ap-from-internal |= card=(wind neat gift:agent) - ^- (list move) + ^- [(list move) _ap-core] :: ?- -.card %slip !! @@ -883,36 +878,37 @@ %give =/ =gift:agent p.card ?: ?=(%kick -.gift) - =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ship.gift) - %+ turn ducts + :_ ap-core + %+ turn (ap-ducts-from-paths paths.gift ship.gift) |= =duct - ~? &(=(duct system-duct.state) !=(agent-name %hood)) - [%agent-giving-on-system-duct agent-name -.gift] + ^- move + ~? &(=(duct system-duct.state) !=(ap-name %hood)) + [%agent-giving-on-system-duct ap-name -.gift] [duct %give %unto %kick ~] :: ?. ?=(%fact -.gift) - [agent-duct %give %unto gift]~ + :_(ap-core [ap-duct %give %unto gift]~) :: - =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ~) + =/ dux=(list duct) (ap-ducts-from-paths paths.gift ~) =/ =cage cage.gift - %+ turn ducts - |= =duct - ~? &(=(duct system-duct.state) !=(agent-name %hood)) - [%agent-giving-on-system-duct agent-name -.gift] - ^- move - =/ =mark - (~(gut by marks.current-agent) duct p.cage) - :: + =| fex=(list move) + |- ^+ [fex ap-core] + ?~ dux + [fex ap-core] + ~? &(=(i.dux system-duct.state) !=(ap-name %hood)) + [%agent-giving-on-system-duct ap-name -.gift] + =/ =mark (~(gut by marks.ap-yoke) i.dux p.cage) ?: =(mark p.cage) - [duct %give %unto %fact cage.gift] - =/ =path /sys/pel/[agent-name] - =/ =note-arvo - =/ =schematic:ford - =/ =beak (mo-beak agent-name) - [%cast [p q]:beak mark [%$ cage]] - [%f %build live=%.n schematic] - :: - [duct %pass path note-arvo] + $(dux t.dux, fex :_(fex [i.dux %give %unto %fact cage])) + =/ =mars:clay [p.cage mark] + =. casts.ap-yoke (~(put to casts.ap-yoke) [mars q.cage]) + =/ =move + =/ =wire /sys/pel/[ap-name] + =/ [=ship =desk =case:clay] (mo-beak ap-name) + =/ =note-arvo + [%c %warp ship desk ~ %sing %c case /[a.mars]/[b.mars]] + [i.dux %pass wire note-arvo] + $(dux t.dux, fex [move fex]) :: %pass =/ =duct system-duct.state @@ -925,15 +921,15 @@ :: :- (scot %p our) [%out (scot %p ship.neat) name.neat wire] - [(scot %p attributing.agent-routes) wire] + [(scot %p attributing.ap-routes) wire] =. wire - [%use agent-name wire] + [%use ap-name wire] =/ =note-arvo ?- -.neat %arvo note-arvo.neat %agent [%g %deal [our ship.neat] [name deal]:neat] == - [duct %pass wire note-arvo]~ + :_(ap-core [duct %pass wire note-arvo]~) == :: +ap-breach: ship breached, so forget about them :: @@ -941,25 +937,25 @@ |= =ship ^+ ap-core =/ in=(list [=duct =^ship =path]) - ~(tap by inbound.watches.current-agent) + ~(tap by inbound.watches.ap-yoke) |- ^+ ap-core ?^ in =? ap-core =(ship ship.i.in) - =/ core ap-load-delete(agent-duct duct.i.in) - core(agent-duct agent-duct) + =/ core ap-load-delete(ap-duct duct.i.in) + core(ap-duct ap-duct) $(in t.in) :: =/ out=(list [[=wire =^ship =term] ? =path]) - ~(tap by outbound.watches.current-agent) + ~(tap by outbound.watches.ap-yoke) |- ^+ ap-core ?~ out ap-core =? ap-core =(ship ship.i.out) =/ core - =. agent-duct system-duct.state + =. ap-duct system-duct.state =/ way [%out (scot %p ship) term.i.out wire.i.out] (ap-specific-take way %kick ~) - core(agent-duct agent-duct) + core(ap-duct ap-duct) $(out t.out) :: +ap-clog: handle %clog notification from ames :: @@ -973,25 +969,25 @@ ^+ ap-core :: =/ in=(list [=duct =^ship =path]) - ~(tap by inbound.watches.current-agent) + ~(tap by inbound.watches.ap-yoke) |- ^+ ap-core ?~ in ap-core :: =? ap-core =(ship ship.i.in) - =/ core ap-kill-up(agent-duct duct.i.in) - core(agent-duct agent-duct) + =/ core ap-kill-up(ap-duct duct.i.in) + core(ap-duct ap-duct) $(in t.in) :: +ap-agent-core: agent core with current bowl and state :: ++ ap-agent-core - ~(. agent.current-agent ap-construct-bowl) + ~(. agent.ap-yoke ap-construct-bowl) :: +ap-ducts-from-paths: get ducts subscribed to paths :: ++ ap-ducts-from-paths |= [target-paths=(list path) target-ship=(unit ship)] ^- (list duct) ?: &(?=(~ target-paths) ?=(~ target-ship)) - ~[agent-duct] + ~[ap-duct] %- zing %+ turn target-paths |= =path @@ -1002,8 +998,8 @@ |= [target-path=(unit path) target-ship=(unit ship)] ^- (list duct) ?: &(?=(~ target-path) ?=(~ target-ship)) - ~[agent-duct] - %+ murn ~(tap by inbound.watches.current-agent) + ~[ap-duct] + %+ murn ~(tap by inbound.watches.ap-yoke) |= [=duct =ship =path] ^- (unit ^duct) ?~ target-ship @@ -1059,42 +1055,40 @@ ++ ap-give |= =gift:agent ^+ ap-core - =/ internal-moves - (weld (ap-from-internal %give gift) agent-moves) - ap-core(agent-moves internal-moves) - :: +ap-construct-bowl: set up bowl. - :: - ++ ap-construct-bowl - ^- bowl - :* :* our :: host - attributing.agent-routes :: guest - agent-name :: agent - == :: - :* wex=outbound.watches.current-agent :: outgoing - sup=inbound.watches.current-agent :: incoming - == :: - :* act=change.stats.current-agent :: tick - eny=eny.stats.current-agent :: nonce - now=time.stats.current-agent :: time - byk=beak.current-agent :: source - == == + =^ internal-moves ap-core (ap-from-internal %give gift) + ap-core(ap-moves (weld internal-moves ap-moves)) :: +ap-pass: request action. :: ++ ap-pass |= [=path =neat] ^+ ap-core - =/ internal-moves - (ap-from-internal %pass path neat) - ap-core(agent-moves (weld internal-moves agent-moves)) + =^ internal-moves ap-core (ap-from-internal %pass path neat) + ap-core(ap-moves (weld internal-moves ap-moves)) + :: +ap-construct-bowl: set up bowl. + :: + ++ ap-construct-bowl + ^- bowl + :* :* our :: host + attributing.ap-routes :: guest + ap-name :: agent + == :: + :* wex=outbound.watches.ap-yoke :: outgoing + sup=inbound.watches.ap-yoke :: incoming + == :: + :* act=change.stats.ap-yoke :: tick + eny=eny.stats.ap-yoke :: nonce + now=time.stats.ap-yoke :: time + byk=beak.ap-yoke :: source + == == :: +ap-reinstall: reinstall. :: ++ ap-reinstall ~/ %ap-reinstall |= =agent ^+ ap-core - =/ old-state=vase ~(on-save agent.current-agent ap-construct-bowl) + =/ old-state=vase ~(on-save agent.ap-yoke ap-construct-bowl) =^ error ap-core - (ap-install(agent.current-agent agent) `old-state) + (ap-install(agent.ap-yoke agent) `old-state) ?~ error ap-core (ap-error %load-failed u.error) @@ -1103,7 +1097,7 @@ ++ ap-subscribe-as |= [=mark =path] ^+ ap-core - =. marks.current-agent (~(put by marks.current-agent) agent-duct mark) + =. marks.ap-yoke (~(put by marks.ap-yoke) ap-duct mark) (ap-subscribe path) :: +ap-subscribe: apply %watch. :: @@ -1111,9 +1105,9 @@ ~/ %ap-subscribe |= pax=path ^+ ap-core - =/ incoming [attributing.agent-routes pax] - =. inbound.watches.current-agent - (~(put by inbound.watches.current-agent) agent-duct incoming) + =/ incoming [attributing.ap-routes pax] + =. inbound.watches.ap-yoke + (~(put by inbound.watches.ap-yoke) ap-duct incoming) =^ maybe-tang ap-core %+ ap-ingest %watch-ack |. (on-watch:ap-agent-core pax) @@ -1165,32 +1159,32 @@ =/ agent-wire t.t.t.wire :: if subscription ack or close, handle before calling user code :: - =? outbound.watches.current-agent ?=(%kick -.sign) - %- ~(del by outbound.watches.current-agent) + =? outbound.watches.ap-yoke ?=(%kick -.sign) + %- ~(del by outbound.watches.ap-yoke) [agent-wire dock] ?: ?& ?=(%watch-ack -.sign) - !(~(has by outbound.watches.current-agent) [agent-wire dock]) + !(~(has by outbound.watches.ap-yoke) [agent-wire dock]) == %- %: slog - leaf+"{}: got ack for nonexistent subscription" + leaf+"{}: got ack for nonexistent subscription" leaf+"{}: {}" >wire=wire< - >out=outbound.watches.current-agent< + >out=outbound.watches.ap-yoke< ~ == ap-core :: - =? outbound.watches.current-agent ?=(%watch-ack -.sign) + =? outbound.watches.ap-yoke ?=(%watch-ack -.sign) ?^ p.sign - %- ~(del by outbound.watches.current-agent) + %- ~(del by outbound.watches.ap-yoke) [agent-wire dock] - %+ ~(jab by outbound.watches.current-agent) [agent-wire dock] + %+ ~(jab by outbound.watches.ap-yoke) [agent-wire dock] |= [acked=? =path] =. . ?. acked . %- =/ =tape - "{}: received 2nd watch-ack on {}" + "{}: received 2nd watch-ack on {}" (slog leaf+tape ~) . [& path] @@ -1213,14 +1207,14 @@ :: =^ maybe-tang ap-core (ap-upgrade-state old-agent-state) :: - =. agent-config + =. ap-config =/ =term ?~(old-agent-state %boot %bump) =/ possibly-suss ?~ maybe-tang - =/ =suss [agent-name term now] + =/ =suss [ap-name term now] [%.y suss] [%.n u.maybe-tang] - [possibly-suss agent-config] + [possibly-suss ap-config] :: [maybe-tang ap-core] :: +ap-upgrade-state: low-level install. @@ -1242,8 +1236,8 @@ ^+ ap-core :: %= ap-core - inbound.watches.current-agent - (~(del by inbound.watches.current-agent) agent-duct) + inbound.watches.ap-yoke + (~(del by inbound.watches.ap-yoke) ap-duct) == :: +ap-load-delete: load delete. :: @@ -1251,13 +1245,13 @@ ^+ ap-core :: =/ maybe-incoming - (~(get by inbound.watches.current-agent) agent-duct) + (~(get by inbound.watches.ap-yoke) ap-duct) ?~ maybe-incoming ap-core :: =/ incoming u.maybe-incoming - =. inbound.watches.current-agent - (~(del by inbound.watches.current-agent) agent-duct) + =. inbound.watches.ap-yoke + (~(del by inbound.watches.ap-yoke) ap-duct) :: =^ maybe-tang ap-core %+ ap-ingest ~ |. @@ -1326,18 +1320,13 @@ ?: ?=(%& -.result) ~ `p.result - =/ ack-moves=(list move) - %- zing - %- turn :_ ap-from-internal - ^- (list card:agent) + =^ ack-moves=(list move) ap-core ?- ack - ~ ~ - %poke-ack [%give %poke-ack maybe-tang]~ - %watch-ack [%give %watch-ack maybe-tang]~ + ~ [~ ap-core] + %poke-ack (ap-from-internal %give %poke-ack maybe-tang) + %watch-ack (ap-from-internal %give %watch-ack maybe-tang) == - :: - =. agent-moves - :(weld (flop new-moves) ack-moves agent-moves) + =. ap-moves :(weld (flop new-moves) ack-moves ap-moves) [maybe-tang ap-core] :: +ap-handle-result: handle result. :: @@ -1348,9 +1337,16 @@ ?: ?=(%| -.result) `ap-core :: - =. agent.current-agent +.p.result - =/ moves (zing (turn -.p.result ap-from-internal)) - =. inbound.watches.current-agent + =^ caz=(list card:agent) agent.ap-yoke p.result + =^ moves ap-core + =| fex=(list move) + |- ^+ [fex ap-core] + ?~ caz [fex ap-core] + =^ fax ap-core (ap-from-internal i.caz) + =. fex (weld fex fax) + $(caz t.caz) + :: + =. inbound.watches.ap-yoke (ap-handle-kicks moves) (ap-handle-peers moves) :: +ap-handle-kicks: handle cancels of inbound.watches @@ -1369,7 +1365,7 @@ :: =/ quit-map=bitt (malt (turn quits |=(=duct [duct *[ship path]]))) - (~(dif by inbound.watches.current-agent) quit-map) + (~(dif by inbound.watches.ap-yoke) quit-map) :: +ap-handle-peers: handle new outbound.watches :: ++ ap-handle-peers @@ -1386,8 +1382,8 @@ ?> ?=([%use @ @ %out @ @ *] wire) =/ short-wire t.t.t.t.t.t.wire =/ =dock [q.p q]:q.move.move - =. outbound.watches.current-agent - (~(del by outbound.watches.current-agent) [short-wire dock]) + =. outbound.watches.ap-yoke + (~(del by outbound.watches.ap-yoke) [short-wire dock]) $(moves t.moves, new-moves [move new-moves]) ?. ?=([* %pass * %g %deal * * %watch *] move) $(moves t.moves, new-moves [move new-moves]) @@ -1396,15 +1392,15 @@ =/ short-wire t.t.t.t.t.t.wire =/ =dock [q.p q]:q.move.move =/ =path path.r.q.move.move - ?: (~(has by outbound.watches.current-agent) short-wire dock) + ?: (~(has by outbound.watches.ap-yoke) short-wire dock) =. ap-core =/ =tang - ~[leaf+"subscribe wire not unique" >agent-name< >short-wire< >dock<] - %- (slog >out=outbound.watches.current-agent< tang) + ~[leaf+"subscribe wire not unique" >ap-name< >short-wire< >dock<] + %- (slog >out=outbound.watches.ap-yoke< tang) (ap-error %watch-not-unique tang) $(moves t.moves) - =. outbound.watches.current-agent - (~(put by outbound.watches.current-agent) [short-wire dock] [| path]) + =. outbound.watches.ap-yoke + (~(put by outbound.watches.ap-yoke) [short-wire dock] [| path]) $(moves t.moves, new-moves [move new-moves]) -- -- @@ -1439,10 +1435,10 @@ :: ~| [ship=ship plea-path=path] ?> ?=([%ge @ ~] path) - =/ agent-name i.t.path + =/ ap-name i.t.path :: =/ =ames-request ;;(ames-request noun) - => (mo-handle-ames-request:mo-core ship agent-name ames-request) + => (mo-handle-ames-request:mo-core ship ap-name ames-request) mo-abet :: %sear mo-abet:(mo-filter-queue:mo-core ship.task) @@ -1489,12 +1485,53 @@ =? all-state ?=(%4 -.all-state) (state-4-to-5 all-state) :: - ?> ?=(%5 -.all-state) + =? all-state ?=(%5 -.all-state) + (state-5-to-6 all-state) + :: + ?> ?=(%6 -.all-state) gall-payload(state all-state) :: :: +all-state: upgrade path :: - ++ all-state $%(state-0 state-1 state-2 state-3 state-4 state-5) + ++ all-state + $%(state-0 state-1 state-2 state-3 state-4 state-5 state-6) + :: + ++ state-5-to-6 + |= =state-5 + ^- state-6 + %= state-5 + - %6 + yokes.agents-5 + %- ~(run by yokes.agents-5.state-5) + |= yoke-5 + ^- yoke + :* control-duct live stats watches agent beak marks + casts=~ + == + == + :: + ++ state-5 + $: %5 + =agents-5 + == + :: + ++ agents-5 + $: system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + yokes=(map term yoke-5) + blocked=(map term (qeu blocked-move)) + == + :: + ++ yoke-5 + $: control-duct=duct + live=? + =stats + =watches + =agent + =beak + marks=(map duct mark) + == :: ++ state-4-to-5 |= =state-4 From 7133e50ef3abff3bb013d8c12e993d72647f00a0 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 28 Apr 2020 18:13:30 -0700 Subject: [PATCH 071/280] clay: make first commits use fusion --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/clay.hoon | 19 ++++--------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d51066f30..c575256bb 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a121bee8b108c9faad1e6110d6a5e254f1543345892c9503dc6361dd5ff86e31 -size 13132967 +oid sha256:7426196bd7ff53743488f7f8c4a287eac4b4bee499f680582dac73e82226fb46 +size 13143129 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index ea7adf75e..7144d2b3f 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3765,6 +3765,8 @@ |^ ?~ hun ~ + ?: =(0 let.dom) + ~ %+ weld %+ turn ~(tap in deletes) |= =path @@ -3775,7 +3777,7 @@ :: ++ path-to-tank |= =path - =/ pre=^path ~[(scot %p our) syd (scot %ud let.dom)] + =/ pre=^path ~[(scot %p our) syd (scot %ud +(let.dom))] :+ %rose ["/" "/" ~] %+ turn (weld pre path) |= a=cord @@ -5333,21 +5335,8 @@ =/ dos (~(get by dos.rom.ruf) q.bem) ?~ dos !! :: fire next in queue - ?: =(0 let.dom.u.dos) - =+ cos=(mode-to-soba ~ s.bem all.req fis.req) - =/ [one=soba two=soba] - %+ skid cos - |= [a=path b=miso] - ?& ?=(%ins -.b) - ?=(%mime p.p.b) - ?=([%hoon ~] (slag (dec (lent a)) a)) - == - :_ ..^$ - :~ [hen %pass /one %c %info q.bem %& one] - [hen %pass /two %c %info q.bem %& two] - == =^ mos ruf - =/ den ((de our now ski hen ruf) our des.req) + =/ den ((de our now ski hen ruf) our q.bem) abet:(into:den (flop s.bem) all.req fis.req) [mos ..^$] :: From c5d7473cf7d3c4399ac2d24db1c5c932f790b731 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 28 Apr 2020 20:33:12 -0700 Subject: [PATCH 072/280] clay: recurse properly --- pkg/arvo/sys/vane/clay.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 7144d2b3f..3dc7ac1ae 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3698,7 +3698,7 @@ path.i.cans t.path.i.cans ankh (~(gut by dir.ankh) i.path.i.cans *^ankh) == - :- child-ankh(dir (~(put by dir.ankh) i.path.i.cans child-ankh)) + :- ankh(dir (~(put by dir.ankh) i.path.i.cans child-ankh)) ford-cache.ford-args [ankh(fil `[lobe.i.cans cage.i.cans]) ford-cache.ford-args] =. ankh new-ankh From 06c0d55a1ea2cd4f0e27f96a744cb2db8f1eaa2d Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 28 Apr 2020 22:34:48 -0700 Subject: [PATCH 073/280] clay: working sanity checks for ankh --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 85 ++++++++++++++++++++++++++++--------- 2 files changed, 67 insertions(+), 22 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index c575256bb..08ef1bb2a 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7426196bd7ff53743488f7f8c4a287eac4b4bee499f680582dac73e82226fb46 -size 13143129 +oid sha256:bfdea141b5c28a037952fa06fbe350090b58eb4bd3c8fd7124d75a49ccd50d07 +size 13151591 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 3dc7ac1ae..29261f06f 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3547,10 +3547,11 @@ :: :: ?: &(!updated !=(~ (need-sys-update changes))) :: (sys-update args yuki changes) + :: =. ..park (emil (print deletes ~(key by changes))) =^ change-cages ford-cache.args (checkout-changes args changes) - :: =/ cont (sane-changes changes change-cages) + :: =/ sane-cont (sane-changes changes change-cages) =/ new-blobs=(map lobe blob) %- malt %+ turn ~(tap by change-cages) @@ -3573,7 +3574,7 @@ :: =^ ankh ford-cache.args (checkout-ankh args deletes change-cages ank.dom) - :: =/ null (sane-ankh cont ankh) + :: =/ null (sane-ankh sane-cont ankh) =. ankh.args ankh =. ank.dom ankh =^ mim ford-cache.args @@ -3646,7 +3647,10 @@ =/ =lobe ?- -.change.i.cans %| p.change.i.cans - %& (page-to-lobe:util p.change.i.cans) + :: Don't use p.change.i.cans because that's before casting to + :: the correct mark. + :: + %& (page-to-lobe:util [p q.q]:cage) == =^ so-far ford-cache.ford-args $(cans t.cans) [(~(put by so-far) path.i.cans lobe cage) ford-cache.ford-args] @@ -3793,17 +3797,36 @@ |= $: changes=(map path (each page lobe)) change-cages=(map path [lobe cage]) == - ^- [(map path [lobe cage]) args:ford:fusion] - =/ =yaki (~(got by hut.ran) (~(got by hit.dom) let.dom)) + ^- (unit [(map path [lobe cage]) args:ford:fusion]) + =/ tak=(unit tako) (~(get by hit.dom) let.dom) + ?~ tak + ~ + =/ =yaki (~(got by hut.ran) u.tak) + :: Assert all blobs hash to their lobe + :: + =/ foo + %- ~(urn by lat.ran) + |= [=lobe =blob] + ?: ?=(%delta -.blob) + ~ + =/ actual-lobe=^lobe `@uv`(page-to-lobe q.blob) + ~| [lobe p.blob actual-lobe] + ?> &(=(lobe p.blob) =(lobe actual-lobe)) + ~ :: Assert all new lobes are reachable :: - =/ files=(list [=path =lobe]) ~(tap by q.yaki) - |- ^+ *sane-changes - ?^ files - ?. (~(has by lat.ran) lobe.i.files) - ~| missing-lobe=[path lobe] - !! - $(files t.files) + :: XX Needs to run after dome is updated + :: + :: =/ files=(list [=path =lobe]) ~(tap by q.yaki) + :: |- ^+ *sane-changes + :: ?^ files + :: ?. (~(has by lat.ran) lobe.i.files) + :: ~| missing-lobe=[path lobe] + :: !! + :: $(files t.files) + :: Assert we calculated the same change-cages w/o cache + :: + :: XX remove deletes :: =/ all-changes=(map path (each page lobe)) =/ original=(map path (each page lobe)) @@ -3816,22 +3839,44 @@ =/ ccs=(list [=path =lobe =cage]) ~(tap by change-cages) |- ^+ *sane-changes ?^ ccs - ?. =(`cage.i.ccs (~(get by all-change-cages) path.i.ccs)) - ~| not-same-cages+path + ?. =(`[lobe cage]:i.ccs (~(get by all-change-cages) path.i.ccs)) + ~| not-same-cages+path.i.ccs !! $(ccs t.ccs) - [all-change-cages args] + `[all-change-cages args] :: ++ sane-ankh - |= $: [change-cages=(map path [lobe cage]) =ford=args:ford:fusion] + |= $: $= cont + (unit [all-changes=(map path [lobe cage]) =ford=args:ford:fusion]) =test=ankh == + ?~ cont + ~ + =+ u.cont =^ ankh ford-cache.ford-args - (checkout-ankh ford-args ~ change-cages *ankh) - ?. =(ankh test-ankh) - ~| %not-same-ankh + (checkout-ankh ford-args ~ all-changes *ankh) + =| =path + |- ^- ~ + =* loop $ + =/ fil (bind fil.ankh |=([=lobe =cage] [lobe p.cage q.q.cage])) + =/ test (bind fil.ankh |=([=lobe =cage] [lobe p.cage q.q.cage])) + ?. =(fil test) + ~| [%not-same-file path ?=(~ fil.ankh) ?=(~ fil.test-ankh)] + ~| ?~(fil.ankh ~ [[p p.q]:u.fil.ankh `@uv`(page-to-lobe [p q.q]:q.u.fil.ankh)]) + ~| ?~(fil.test-ankh ~ [[p p.q]:u.fil.test-ankh `@uv`(page-to-lobe [p q.q]:q.u.fil.test-ankh)]) !! - ~ + ?. =(~(key by dir.ankh) ~(key by dir.test-ankh)) + ~| [%not-same-children path ~(key by dir.ankh) ~(key by dir.test-ankh)] + !! + =< ~ + %+ turn ~(tap by dir.ankh) + |= [=@ta =child=^ankh] + ~| sane-ankh=[path ta] + %= loop + path (snoc path ta) + ankh child-ankh + test-ankh (~(got by dir.test-ankh) ta) + == :: :: Find /sys changes :: From 1ae66bd098e45d44e00a4a7a998ac7263626f5fa Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 29 Apr 2020 14:50:30 -0700 Subject: [PATCH 074/280] clay: clean up sanity checks --- pkg/arvo/sys/vane/clay.hoon | 38 ++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 29261f06f..2a086e5cf 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3522,6 +3522,7 @@ :: XX needs to check that commit doesn't have same date :: ++ park + =/ check-sane | |^ |= [updated=? =yuki =rang] ^+ ..park @@ -3551,7 +3552,7 @@ =. ..park (emil (print deletes ~(key by changes))) =^ change-cages ford-cache.args (checkout-changes args changes) - :: =/ sane-cont (sane-changes changes change-cages) + =/ sane-continuation (sane-changes changes change-cages) =/ new-blobs=(map lobe blob) %- malt %+ turn ~(tap by change-cages) @@ -3574,7 +3575,7 @@ :: =^ ankh ford-cache.args (checkout-ankh args deletes change-cages ank.dom) - :: =/ null (sane-ankh sane-cont ankh) + =/ null (sane-ankh sane-continuation ankh) =. ankh.args ankh =. ank.dom ankh =^ mim ford-cache.args @@ -3798,6 +3799,8 @@ change-cages=(map path [lobe cage]) == ^- (unit [(map path [lobe cage]) args:ford:fusion]) + ?. check-sane + ~ =/ tak=(unit tako) (~(get by hit.dom) let.dom) ?~ tak ~ @@ -3813,17 +3816,6 @@ ~| [lobe p.blob actual-lobe] ?> &(=(lobe p.blob) =(lobe actual-lobe)) ~ - :: Assert all new lobes are reachable - :: - :: XX Needs to run after dome is updated - :: - :: =/ files=(list [=path =lobe]) ~(tap by q.yaki) - :: |- ^+ *sane-changes - :: ?^ files - :: ?. (~(has by lat.ran) lobe.i.files) - :: ~| missing-lobe=[path lobe] - :: !! - :: $(files t.files) :: Assert we calculated the same change-cages w/o cache :: :: XX remove deletes @@ -3850,6 +3842,26 @@ (unit [all-changes=(map path [lobe cage]) =ford=args:ford:fusion]) =test=ankh == + ?. check-sane + ~ + :: Assert all new lobes are reachable. + :: + :: Needs to run after dome is updated + :: + =/ tak=(unit tako) (~(get by hit.dom) let.dom) + ?~ tak + ~ + =/ =yaki (~(got by hut.ran) u.tak) + =/ files=(list [=path =lobe]) ~(tap by q.yaki) + |- ^+ *sane-ankh + ?^ files + ?. (~(has by lat.ran) lobe.i.files) + ~| missing-lobe=[path lobe] + !! + $(files t.files) + :: + :: Assert we can rebuild the ankh + :: ?~ cont ~ =+ u.cont From ad52fdb248d9c4f91c1ea81701ff7b0bffc3197e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 29 Apr 2020 18:02:47 -0400 Subject: [PATCH 075/280] test: remove broken clay +test-get-fit --- pkg/arvo/tests/sys/vane/clay.hoon | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 4fb609e21..36453db0b 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -13,22 +13,6 @@ =/ fusion fusion:clay-gate :: |% -++ test-get-fit ^- tang - =/ =ankh:clay - :- fil=~ - %- ~(gas by *(map @tas ankh:clay)) - :~ :+ %lib fil=~ - %- ~(gas by *(map @tas ankh:clay)) - :~ :+ %language-server fil=~ - %- ~(gas by *(map @tas ankh:clay)) - :~ :+ %json fil=~ - %- ~(gas by *(map @tas ankh:clay)) - :~ :+ %hoon fil=`[*lobe:clay hoon+!>('baz')] dir=~ - == == == == - %+ expect-eq - !> `(unit path)`[~ /lib/language-server/json/hoon] - !> (~(get-fit an:fusion ankh) %lib %language-server-json) -:: ++ test-parse-pile ^- tang %+ expect-eq !> ^- pile:fusion From a25a899050fe9d9615e537bbe9e75485dc47e003 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 29 Apr 2020 18:11:37 -0400 Subject: [PATCH 076/280] test: fix gall +test-conf --- pkg/arvo/tests/sys/vane/gall.hoon | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/gall.hoon b/pkg/arvo/tests/sys/vane/gall.hoon index 4fff5dc60..bbc930bbc 100644 --- a/pkg/arvo/tests/sys/vane/gall.hoon +++ b/pkg/arvo/tests/sys/vane/gall.hoon @@ -31,21 +31,19 @@ :: =/ =duct ~[/init] =/ time (add ~1111.1.1 ~s1) - =/ =term %my-agent + =/ dap=term %my-agent =/ ship ~nec :: =/ call-args =/ =type -:!>(*task:able:gall) - =/ =task:able:gall [%conf term] + =/ =task:able:gall [%conf dap] [duct type task] :: =/ =move:gall-gate - =/ =path /sys/cor/[term]/(scot %p ship)/[term]/(scot %da time) + =/ =wire /sys/cor/[dap]/(scot %p ship)/home/(scot %da time) =/ =note-arvo - =/ =schematic:ford [%core [ship term] /hoon/[term]/app] - =/ =task:able:ford [%build %.y schematic] - [%f task] - [duct %pass path note-arvo] + [%c %warp ship %home ~ %sing %a da+time /app/[dap]/hoon] + [duct %pass wire note-arvo] :: =/ expected-moves=(list move:gall-gate) ~[move] :: From 65766a73e2140fefb028a2796940546ce9978830 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 29 Apr 2020 17:38:24 -0700 Subject: [PATCH 077/280] clay: port -merge to fusion --- bin/solid.pill | 4 +- pkg/arvo/lib/clay-commit.hoon | 80 ---------------------- pkg/arvo/sys/vane/clay.hoon | 29 ++++---- pkg/arvo/sys/zuse.hoon | 5 +- pkg/arvo/ted/merge.hoon | 122 ++++++---------------------------- 5 files changed, 43 insertions(+), 197 deletions(-) delete mode 100644 pkg/arvo/lib/clay-commit.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 08ef1bb2a..b05984e23 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfdea141b5c28a037952fa06fbe350090b58eb4bd3c8fd7124d75a49ccd50d07 -size 13151591 +oid sha256:dfefbd6a561182f85a68c3a26a128168d7a70c17df0be5224bf2c8560a86ecbe +size 13157380 diff --git a/pkg/arvo/lib/clay-commit.hoon b/pkg/arvo/lib/clay-commit.hoon deleted file mode 100644 index 7b08c7301..000000000 --- a/pkg/arvo/lib/clay-commit.hoon +++ /dev/null @@ -1,80 +0,0 @@ -/- spider -/+ strandio -=, strand=strand:spider -=, clay -|% -:: Produce an ankh -:: -++ checkout - |= [=ankh deletes=(set path) changes=(map path cage)] - ^- ^ankh - :: Delete - :: - =. ankh - =/ dels ~(tap in deletes) - |- ^- ^ankh - =* outer-loop $ - ?~ dels - ankh - =. ankh - |- ^- ^ankh - =* inner-loop $ - ?~ i.dels - ankh(fil ~) - %= ankh - dir - %+ ~(put by dir.ankh) i.i.dels - %= inner-loop - i.dels t.i.dels - ankh (~(gut by dir.ankh) i.i.dels *^ankh) - == - == - outer-loop(dels t.dels) - :: Add/change - :: - =/ cans=(list [=path =cage]) ~(tap by changes) - |- ^- ^ankh - =* outer-loop $ - ?~ cans - ankh - =. ankh - =/ orig-path path.i.cans - |- ^- ^ankh - =* inner-loop $ - ?~ path.i.cans - %= ankh - fil - `[(page-to-lobe [p q.q]:cage.i.cans) cage.i.cans] - == - %= ankh - dir - %+ ~(put by dir.ankh) i.path.i.cans - %= inner-loop - path.i.cans t.path.i.cans - ankh (~(gut by dir.ankh) i.path.i.cans *^ankh) - == - == - outer-loop(cans t.cans) -:: Produce a mime cache -:: -++ checkout-cache - |= [=ship =desk deletes=(set path) changes=(map path cage)] - =/ m (strand ,(map path (unit mime))) - ^- form:m - ;< our=@p bind:m get-our:strandio - =/ mim-builds=(map path schematic:ford) - %- ~(run by changes) - |= =cage - [%cast [our desk] %mime %$ cage] - ;< mim-results=(map path cage) bind:m (build-cages:strandio mim-builds) - =/ can-mim=(map path (unit mime)) - %- ~(run by mim-results) - |= =cage - ?> ?=(%mime p.cage) - `!<(mime q.cage) - =/ del-mim=(map path (unit mime)) - (malt (turn ~(tap in deletes) |=(=path [path ~]))) - =/ new-mim=(map path (unit mime)) - (~(uni by del-mim) can-mim) - (pure:m new-mim) --- diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 2a086e5cf..e4397c73e 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -155,7 +155,7 @@ cez=(map @ta crew) :: permission groups cue=(qeu [=duct =task:able]) :: queued requests act=active-write :: active write - pud=(unit [=desk =yuki]) :: pending update + pud=(unit [=desk =yoki]) :: pending update == :: :: :: Currently active write @@ -3473,7 +3473,7 @@ ?> ?=(~ deletes) =/ data=(map path (each page lobe)) (~(run by changes) |=(=cage &+[p q.q]:cage)) - (park | [~ data] *rang) + (park | &+[~ data] *rang) :: =/ parent-tako=tako (aeon-to-tako:ze let.dom) =/ data=(map path (each page lobe)) @@ -3488,7 +3488,7 @@ (~(run by changes) |=(=cage &+[p q.q]:cage)) :: =/ =yuki [~[parent-tako] data] - (park | yuki *rang) + (park | &+yuki *rang) :: :: Unix commit :: @@ -3524,17 +3524,22 @@ ++ park =/ check-sane | |^ - |= [updated=? =yuki =rang] + |= [updated=? =yoki =rang] ^+ ..park =: hut.ran (~(uni by hut.rang) hut.ran) lat.ran (~(uni by lat.rang) lat.ran) == + =/ new-data=(map path (each page lobe)) + ?- -.yoki + %& q.p.yoki + %| (~(run by q.p.yoki) |=(=lobe |+lobe)) + == =/ [deletes=(set path) changes=(map path (each page lobe))] =/ previous-yaki ?: =(0 let.dom) *yaki (aeon-to-yaki:ze let.dom) - (get-changes q.previous-yaki q.yuki) + (get-changes q.previous-yaki new-data) ~| [from=let.dom deletes=deletes changes=~(key by changes)] :: :: promote ford cache @@ -3559,13 +3564,13 @@ |= [=path =lobe =cage] [lobe %direct lobe [p q.q]:cage] =/ data=(map path lobe) - %- ~(urn by q.yuki) + %- ~(urn by new-data) |= [=path value=(each page lobe)] ?- -.value %| p.value %& lobe:(~(got by change-cages) path) == - =/ =yaki (make-yaki p.yuki data now) + =/ =yaki (make-yaki p.p.yoki data now) =: let.dom +(let.dom) hit.dom (~(put by hit.dom) +(let.dom) r.yaki) hut.ran (~(put by hut.ran) r.yaki yaki) @@ -3908,7 +3913,7 @@ :: Delay current update until sys update is complete :: ++ sys-update - |= [=ford=args:ford:fusion =yuki changes=(map path (each page lobe))] + |= [=ford=args:ford:fusion =yoki changes=(map path (each page lobe))] ^+ ..park =/ updates (need-sys-update changes) :: Don't save ford cache so it gets properly handled when we @@ -3917,7 +3922,7 @@ =^ updates-cages=(map path [lobe cage]) ford-cache.ford-args (checkout-changes ford-args updates) ?> =(~ pud) - =. pud `[syd yuki] + =. pud `[syd yoki] |^ ?: (~(has by updates) /sys/hoon/hoon) reset ?: (~(has by updates) /sys/arvo/hoon) @@ -5480,15 +5485,15 @@ %park =^ mos ruf =/ den ((de our now ski hen ruf) our des.req) - abet:(park:den | [yuk ran]:req) + abet:(park:den | [yok ran]:req) [mos ..^$] :: %pork - =/ [syd=desk =yuki] (need pud.ruf) + =/ [syd=desk =yoki] (need pud.ruf) =. pud.ruf ~ =^ mos ruf =/ den ((de our now ski hen ruf) our syd) - abet:(park:den & yuki *rang) + abet:(park:den & yoki *rang) [mos ..^$] :: %perm diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 5c879f54a..a66a7d683 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -567,7 +567,7 @@ {$mont des/desk bem/beam} :: mount to unix {$dirk des/desk} :: mark mount dirty {$ogre pot/$@(desk beam)} :: delete mount point - {$park des/desk yuk/yuki ran/rang} :: plumbing commit + {$park des/desk yok/yoki ran/rang} :: synchronous commit {$perm des/desk pax/path rit/rite} :: change permissions {$pork ~} :: resume commit $>(%trim vane-task) :: trim state @@ -693,7 +693,8 @@ == :: ++ urge |*(a/mold (list (unce a))) :: list change ++ whom (each ship @ta) :: ship or named crew - ++ yuki :: commit + ++ yoki (each yuki yaki) :: commit + ++ yuki :: proto-commit $: p/(list tako) :: parents q/(map path (each page lobe)) :: namespace == :: diff --git a/pkg/arvo/ted/merge.hoon b/pkg/arvo/ted/merge.hoon index 54ae588c6..f5fe338cc 100644 --- a/pkg/arvo/ted/merge.hoon +++ b/pkg/arvo/ted/merge.hoon @@ -1,7 +1,7 @@ :: Merge second desk into first :: /- spider -/+ strandio, clay-commit +/+ strandio =, strand=strand:spider =, clay ^- thread:spider @@ -10,14 +10,16 @@ =/ m (strand ,vase) ^- form:m ;< our=@p bind:m get-our:strandio -;< wen=@da bind:m get-time:strandio -|^ +;< now=@da bind:m get-time:strandio :: :: Fetch current states :: -=/ start-path /(scot %p our)/[bob-desk]/(scot %da wen) +=/ start-path /(scot %p our)/[bob-desk]/(scot %da now) ;< =ali=riot:clay bind:m - (warp:strandio ali-ship ali-desk `[%sing %v da+wen /]) + (warp:strandio ali-ship ali-desk `[%sing %v da+now /]) +:: +;< wen=@da bind:m get-time:strandio +|^ ?> ?=(^ ali-riot) =+ !<(=ali=dome q.r.u.ali-riot) =/ ali-tako=tako (~(got by hit.ali-dome) let.ali-dome) @@ -32,13 +34,8 @@ ;< =merge-result bind:m (merge ali-yaki bob-yaki) ?~ merge-result (pure:m !>(~)) -=/ =rang - [(malt [r .]:new.u.merge-result ~) lat.u.merge-result] -;< [=ankh changes=(map path cage)] bind:m - (checkout bob-dome new.u.merge-result [deletes changes]:u.merge-result) -;< mim=(map path (unit mime)) bind:m - (checkout-cache:clay-commit ali-ship ali-desk deletes.u.merge-result changes) -=/ args [bob-desk r.new.u.merge-result rang ankh mim] +=/ =rang [~ lat.u.merge-result] +=/ args [bob-desk new.u.merge-result rang] ;< ~ bind:m (send-raw-card:strandio %pass /merg/[bob-desk]/[ali-desk] %arvo %c %park args) (pure:m !>(~)) @@ -46,10 +43,7 @@ +$ merge-result %- unit $: conflicts=(set path) - bop=(map path cage) - new=yaki - deletes=(set path) - changes=(set path) + new=yoki lat=(map lobe blob) == :: @@ -57,19 +51,12 @@ |= [=ali=yaki bob-yaki=(unit yaki)] =/ m (strand ,merge-result) ^- form:m - ?: ?=(%init germ) :: :: If this is an %init merge, we set the ali's commit to be bob's. :: - %: pure:m - ~ - conflicts=~ - bop=~ - new=ali-yaki - deletes=~ - changes=~(key by q.ali-yaki) - lat=~ - == + ?: ?=(%init germ) + (pure:m ~ conflicts=~ new=|+ali-yaki lat=~) + :: =/ bob-yaki (need bob-yaki) |^ ?- germ @@ -85,14 +72,10 @@ (pure:m ~) ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) (pure:m ~) - =/ new-yaki (make-yaki [r.bob-yaki r.ali-yaki ~] q.bob-yaki wen) %: pure:m ~ conflicts=~ - bop=~ - new=new-yaki - deletes=~ - changes=~ + new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki q.bob-yaki)] lat=~ == :: @@ -103,14 +86,10 @@ %that ?: =(r.ali-yaki r.bob-yaki) (pure:m ~) - =/ new-yaki (make-yaki [r.bob-yaki r.ali-yaki ~] q.ali-yaki wen) %: pure:m ~ conflicts=~ - bop=~ - new=new-yaki - deletes=get-deletes - changes=get-changes + new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki q.ali-yaki)] lat=~ == :: @@ -131,15 +110,7 @@ %^ error %bad-fine-merge leaf+"tried fast-forward but is not ancestor or descendant" ~ - %: pure:m - ~ - conflicts=~ - bop=~ - new=ali-yaki - deletes=get-deletes - changes=get-changes - lat=~ - == + (pure:m ~ conflicts=~ new=|+ali-yaki lat=~) :: ?(%meet %mate %meld) ?: =(r.ali-yaki r.bob-yaki) @@ -187,10 +158,7 @@ %: pure:m ~ conflicts=~ - bop=~ - new=(make-yaki [r.bob-yaki r.ali-yaki ~] hat wen) - deletes=get-deletes - changes=get-changes + new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki hat)] lat=~ == == @@ -208,28 +176,6 @@ takos :: hence skip (~(uni in takos) ^$(tak q)) :: otherwise traverse :: - ++ get-deletes - %- silt ^- (list path) - %+ murn ~(tap by (~(uni by q.bob-yaki) q.ali-yaki)) - |= [=path =lobe] - ^- (unit ^path) - =/ a (~(get by q.ali-yaki) path) - =/ b (~(get by q.bob-yaki) path) - ?: |(=(a b) !=(~ a)) - ~ - `path - :: - ++ get-changes - %- silt ^- (list path) - %+ murn ~(tap by (~(uni by q.bob-yaki) q.ali-yaki)) - |= [=path =lobe] - ^- (unit ^path) - =/ a (~(get by q.ali-yaki) path) - =/ b (~(get by q.bob-yaki) path) - ?: |(=(a b) =(~ a)) - ~ - `path - :: :: Find the most recent common ancestor(s). :: :: Pretty sure this could be a lot more efficient. @@ -308,37 +254,11 @@ ~ `[pax ~] == - -- -:: -++ checkout - |^ - |= [=bob=dome =yaki deletes=(set path) changes=(set path)] - =/ m (strand ,[ankh (map path cage)]) - ^- form:m - =/ start-path /(scot %p our)/[bob-desk]/(scot %da wen) - =/ builds - %- malt - %+ turn ~(tap in changes) - |= =path - [path (lobe-to-schematic start-path (~(got by q.yaki) path))] - ;< results=(map path cage) bind:m (build-cages:strandio builds) - (pure:m (checkout:clay-commit ank.bob-dome deletes results) results) :: - ++ lobe-to-schematic - |= [=start=path =lobe] - ^- schematic:ford - =+ .^(=blob %cs (weld start-path /blob/(scot %uv lobe))) - =/ =disc:ford [ali-ship ali-desk] - ?- -.blob - %direct (page-to-schematic disc q.blob) - %delta [%pact disc $(lobe q.q.blob) (page-to-schematic disc r.blob)] - == - :: - ++ page-to-schematic - |= [=disc:ford =page] - ?. ?=(%hoon p.page) - [%volt disc page] - [%$ p.page [%atom %t ~] q.page] + ++ to-yuki + |= m=(map path lobe) + ^- (map path (each page lobe)) + (~(run by m) |=(=lobe |+lobe)) -- :: ++ error From 7645b32f72f43517ff2c40846606665e9eead873 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 30 Apr 2020 02:00:57 -0400 Subject: [PATCH 078/280] Revert "gall: WIP use ford fusion for mark casting" This reverts commit 22aa98e7174d4e700aa222c150c499312d3629c5. --- pkg/arvo/sys/vane/gall.hoon | 343 ++++++++++++++++-------------------- 1 file changed, 153 insertions(+), 190 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index ad34b7092..f3b5d693d 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -11,7 +11,7 @@ +$ move [=duct move=(wind note-arvo gift-arvo)] :: +state-5: overall gall state, versioned :: -+$ state-6 [%6 state] ++$ state-5 [%5 state] :: +state: overall gall state :: :: system-duct: TODO document @@ -47,8 +47,7 @@ :: watches: incoming and outgoing subscription state :: agent: agent core :: beak: compilation source -:: marks: mark conversion configuration -:: casts: enqueueed mark conversion requests +:: marks: mark conversion requests :: +$ yoke $: control-duct=duct @@ -58,7 +57,6 @@ =agent =beak marks=(map duct mark) - casts=(qeu [=mars:clay =vase]) == :: +blocked-move: enqueued move to an agent :: @@ -105,7 +103,7 @@ %missing == -- -=| state=state-6 +=| state=state-5 |= [our=ship now=@da eny=@uvJ ski=sley] ~% %gall-top ..is ~ |% @@ -405,13 +403,18 @@ ^+ mo-core :: ?> ?=([%pel @ ~] path) - ?> ?=([?(%b %c) %writ *] sign-arvo) - =/ dap=term i.t.path - =/ =routes [disclosing=~ attributing=our] :: TODO is this right? - %+ mo-give %unto - ?~ p.sign-arvo - poke-ack+`[leaf+"gall: fact cast failed for agent {}"]~ - fact+r.u.p.sign-arvo + ?> ?=([%f %made *] sign-arvo) + :: + ?- result.sign-arvo + [%incomplete *] + (mo-give %unto %poke-ack `tang.result.sign-arvo) + :: + [%complete %error *] + (mo-give %unto %poke-ack `message.build-result.result.sign-arvo) + :: + [%complete %success *] + (mo-give %unto %fact (result-to-cage:ford build-result.result.sign-arvo)) + == :: +mo-handle-sys-rep: reverse request. :: :: On receipt of a valid +sign from %ford, sets state to the @@ -750,34 +753,36 @@ :: Otherwise simply apply the action to the agent. :: ++ mo-handle-local - |= [=ship dap=term =deal] + |= [=ship agent=term =deal] ^+ mo-core :: =/ =routes [disclosing=~ attributing=ship] - =/ is-running (~(has by yokes.state) dap) - =/ is-blocked (~(has by blocked.state) dap) + =/ is-running (~(has by yokes.state) agent) + =/ is-blocked (~(has by blocked.state) agent) :: - ?: &(is-running !is-blocked) - (mo-apply dap routes deal) - :: - %- (slog leaf+"gall: not running {} yet, got {<-.deal>}" ~) - =. blocked.state - %+ ~(put by blocked.state) dap - ^- (qeu blocked-move) - %. [hen routes deal] - ~(put to (~(gut by blocked.state) dap *(qeu blocked-move))) - mo-core + ?: |(!is-running is-blocked) + =/ blocked=(qeu blocked-move) + =/ waiting (~(get by blocked.state) agent) + =/ deals (fall waiting *(qeu blocked-move)) + =/ deal [hen routes deal] + (~(put to deals) deal) + :: + %- (slog leaf+"gall: not running {} yet, got {<-.deal>}" ~) + %_ mo-core + blocked.state (~(put by blocked.state) agent blocked) + == + (mo-apply agent routes deal) :: +mo-handle-ames-request: handle %ames request message. :: ++ mo-handle-ames-request - |= [=ship dap=term =ames-request] + |= [=ship agent-name=term =ames-request] ^+ mo-core :: %u/%leave gets automatically acked :: =. mo-core (mo-track-ship ship) =? mo-core ?=(%u -.ames-request) (mo-give %done ~) :: - =/ =wire /sys/req/(scot %p ship)/[dap] + =/ =wire /sys/req/(scot %p ship)/[agent-name] :: =/ =deal ?- -.ames-request @@ -786,7 +791,7 @@ %s [%watch path.ames-request] %u [%leave ~] == - (mo-pass wire %g %deal [ship our] dap deal) + (mo-pass wire %g %deal [ship our] agent-name deal) :: +mo-handle-ames-response: handle ames response message. :: ++ mo-handle-ames-response @@ -816,12 +821,12 @@ :: ++ ap ~% %gall-ap +> ~ - |_ $: ap-name=term - ap-routes=routes - ap-duct=duct - ap-moves=(list move) - ap-config=(list (each suss tang)) - ap-yoke=yoke + |_ $: agent-name=term + agent-routes=routes + agent-duct=duct + agent-moves=(list move) + agent-config=(list (each suss tang)) + current-agent=yoke == ++ ap-core . :: +ap-abed: initialise state for an agent, with the supplied routes. @@ -842,21 +847,21 @@ now running(stats stats) :: - =. ap-name dap - =. ap-routes routes - =. ap-yoke yoke - =. ap-duct hen + =. agent-name dap + =. agent-routes routes + =. current-agent yoke + =. agent-duct hen ap-core :: +ap-abet: resolve moves. :: ++ ap-abet ^+ mo-core :: - =/ running (~(put by yokes.state) ap-name ap-yoke) + =/ running (~(put by yokes.state) agent-name current-agent) =/ moves =/ giver |=(report=(each suss tang) [hen %give %onto report]) - =/ from-suss (turn ap-config giver) - :(weld ap-moves from-suss moves) + =/ from-suss (turn agent-config giver) + :(weld agent-moves from-suss moves) :: %_ mo-core yokes.state running @@ -870,7 +875,7 @@ ++ ap-from-internal ~/ %ap-from-internal |= card=(wind neat gift:agent) - ^- [(list move) _ap-core] + ^- (list move) :: ?- -.card %slip !! @@ -878,37 +883,36 @@ %give =/ =gift:agent p.card ?: ?=(%kick -.gift) - :_ ap-core - %+ turn (ap-ducts-from-paths paths.gift ship.gift) + =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ship.gift) + %+ turn ducts |= =duct - ^- move - ~? &(=(duct system-duct.state) !=(ap-name %hood)) - [%agent-giving-on-system-duct ap-name -.gift] + ~? &(=(duct system-duct.state) !=(agent-name %hood)) + [%agent-giving-on-system-duct agent-name -.gift] [duct %give %unto %kick ~] :: ?. ?=(%fact -.gift) - :_(ap-core [ap-duct %give %unto gift]~) + [agent-duct %give %unto gift]~ :: - =/ dux=(list duct) (ap-ducts-from-paths paths.gift ~) + =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ~) =/ =cage cage.gift - =| fex=(list move) - |- ^+ [fex ap-core] - ?~ dux - [fex ap-core] - ~? &(=(i.dux system-duct.state) !=(ap-name %hood)) - [%agent-giving-on-system-duct ap-name -.gift] - =/ =mark (~(gut by marks.ap-yoke) i.dux p.cage) + %+ turn ducts + |= =duct + ~? &(=(duct system-duct.state) !=(agent-name %hood)) + [%agent-giving-on-system-duct agent-name -.gift] + ^- move + =/ =mark + (~(gut by marks.current-agent) duct p.cage) + :: ?: =(mark p.cage) - $(dux t.dux, fex :_(fex [i.dux %give %unto %fact cage])) - =/ =mars:clay [p.cage mark] - =. casts.ap-yoke (~(put to casts.ap-yoke) [mars q.cage]) - =/ =move - =/ =wire /sys/pel/[ap-name] - =/ [=ship =desk =case:clay] (mo-beak ap-name) - =/ =note-arvo - [%c %warp ship desk ~ %sing %c case /[a.mars]/[b.mars]] - [i.dux %pass wire note-arvo] - $(dux t.dux, fex [move fex]) + [duct %give %unto %fact cage.gift] + =/ =path /sys/pel/[agent-name] + =/ =note-arvo + =/ =schematic:ford + =/ =beak (mo-beak agent-name) + [%cast [p q]:beak mark [%$ cage]] + [%f %build live=%.n schematic] + :: + [duct %pass path note-arvo] :: %pass =/ =duct system-duct.state @@ -921,15 +925,15 @@ :: :- (scot %p our) [%out (scot %p ship.neat) name.neat wire] - [(scot %p attributing.ap-routes) wire] + [(scot %p attributing.agent-routes) wire] =. wire - [%use ap-name wire] + [%use agent-name wire] =/ =note-arvo ?- -.neat %arvo note-arvo.neat %agent [%g %deal [our ship.neat] [name deal]:neat] == - :_(ap-core [duct %pass wire note-arvo]~) + [duct %pass wire note-arvo]~ == :: +ap-breach: ship breached, so forget about them :: @@ -937,25 +941,25 @@ |= =ship ^+ ap-core =/ in=(list [=duct =^ship =path]) - ~(tap by inbound.watches.ap-yoke) + ~(tap by inbound.watches.current-agent) |- ^+ ap-core ?^ in =? ap-core =(ship ship.i.in) - =/ core ap-load-delete(ap-duct duct.i.in) - core(ap-duct ap-duct) + =/ core ap-load-delete(agent-duct duct.i.in) + core(agent-duct agent-duct) $(in t.in) :: =/ out=(list [[=wire =^ship =term] ? =path]) - ~(tap by outbound.watches.ap-yoke) + ~(tap by outbound.watches.current-agent) |- ^+ ap-core ?~ out ap-core =? ap-core =(ship ship.i.out) =/ core - =. ap-duct system-duct.state + =. agent-duct system-duct.state =/ way [%out (scot %p ship) term.i.out wire.i.out] (ap-specific-take way %kick ~) - core(ap-duct ap-duct) + core(agent-duct agent-duct) $(out t.out) :: +ap-clog: handle %clog notification from ames :: @@ -969,25 +973,25 @@ ^+ ap-core :: =/ in=(list [=duct =^ship =path]) - ~(tap by inbound.watches.ap-yoke) + ~(tap by inbound.watches.current-agent) |- ^+ ap-core ?~ in ap-core :: =? ap-core =(ship ship.i.in) - =/ core ap-kill-up(ap-duct duct.i.in) - core(ap-duct ap-duct) + =/ core ap-kill-up(agent-duct duct.i.in) + core(agent-duct agent-duct) $(in t.in) :: +ap-agent-core: agent core with current bowl and state :: ++ ap-agent-core - ~(. agent.ap-yoke ap-construct-bowl) + ~(. agent.current-agent ap-construct-bowl) :: +ap-ducts-from-paths: get ducts subscribed to paths :: ++ ap-ducts-from-paths |= [target-paths=(list path) target-ship=(unit ship)] ^- (list duct) ?: &(?=(~ target-paths) ?=(~ target-ship)) - ~[ap-duct] + ~[agent-duct] %- zing %+ turn target-paths |= =path @@ -998,8 +1002,8 @@ |= [target-path=(unit path) target-ship=(unit ship)] ^- (list duct) ?: &(?=(~ target-path) ?=(~ target-ship)) - ~[ap-duct] - %+ murn ~(tap by inbound.watches.ap-yoke) + ~[agent-duct] + %+ murn ~(tap by inbound.watches.current-agent) |= [=duct =ship =path] ^- (unit ^duct) ?~ target-ship @@ -1055,40 +1059,42 @@ ++ ap-give |= =gift:agent ^+ ap-core - =^ internal-moves ap-core (ap-from-internal %give gift) - ap-core(ap-moves (weld internal-moves ap-moves)) - :: +ap-pass: request action. - :: - ++ ap-pass - |= [=path =neat] - ^+ ap-core - =^ internal-moves ap-core (ap-from-internal %pass path neat) - ap-core(ap-moves (weld internal-moves ap-moves)) + =/ internal-moves + (weld (ap-from-internal %give gift) agent-moves) + ap-core(agent-moves internal-moves) :: +ap-construct-bowl: set up bowl. :: ++ ap-construct-bowl ^- bowl :* :* our :: host - attributing.ap-routes :: guest - ap-name :: agent + attributing.agent-routes :: guest + agent-name :: agent == :: - :* wex=outbound.watches.ap-yoke :: outgoing - sup=inbound.watches.ap-yoke :: incoming + :* wex=outbound.watches.current-agent :: outgoing + sup=inbound.watches.current-agent :: incoming == :: - :* act=change.stats.ap-yoke :: tick - eny=eny.stats.ap-yoke :: nonce - now=time.stats.ap-yoke :: time - byk=beak.ap-yoke :: source + :* act=change.stats.current-agent :: tick + eny=eny.stats.current-agent :: nonce + now=time.stats.current-agent :: time + byk=beak.current-agent :: source == == + :: +ap-pass: request action. + :: + ++ ap-pass + |= [=path =neat] + ^+ ap-core + =/ internal-moves + (ap-from-internal %pass path neat) + ap-core(agent-moves (weld internal-moves agent-moves)) :: +ap-reinstall: reinstall. :: ++ ap-reinstall ~/ %ap-reinstall |= =agent ^+ ap-core - =/ old-state=vase ~(on-save agent.ap-yoke ap-construct-bowl) + =/ old-state=vase ~(on-save agent.current-agent ap-construct-bowl) =^ error ap-core - (ap-install(agent.ap-yoke agent) `old-state) + (ap-install(agent.current-agent agent) `old-state) ?~ error ap-core (ap-error %load-failed u.error) @@ -1097,7 +1103,7 @@ ++ ap-subscribe-as |= [=mark =path] ^+ ap-core - =. marks.ap-yoke (~(put by marks.ap-yoke) ap-duct mark) + =. marks.current-agent (~(put by marks.current-agent) agent-duct mark) (ap-subscribe path) :: +ap-subscribe: apply %watch. :: @@ -1105,9 +1111,9 @@ ~/ %ap-subscribe |= pax=path ^+ ap-core - =/ incoming [attributing.ap-routes pax] - =. inbound.watches.ap-yoke - (~(put by inbound.watches.ap-yoke) ap-duct incoming) + =/ incoming [attributing.agent-routes pax] + =. inbound.watches.current-agent + (~(put by inbound.watches.current-agent) agent-duct incoming) =^ maybe-tang ap-core %+ ap-ingest %watch-ack |. (on-watch:ap-agent-core pax) @@ -1159,32 +1165,32 @@ =/ agent-wire t.t.t.wire :: if subscription ack or close, handle before calling user code :: - =? outbound.watches.ap-yoke ?=(%kick -.sign) - %- ~(del by outbound.watches.ap-yoke) + =? outbound.watches.current-agent ?=(%kick -.sign) + %- ~(del by outbound.watches.current-agent) [agent-wire dock] ?: ?& ?=(%watch-ack -.sign) - !(~(has by outbound.watches.ap-yoke) [agent-wire dock]) + !(~(has by outbound.watches.current-agent) [agent-wire dock]) == %- %: slog - leaf+"{}: got ack for nonexistent subscription" + leaf+"{}: got ack for nonexistent subscription" leaf+"{}: {}" >wire=wire< - >out=outbound.watches.ap-yoke< + >out=outbound.watches.current-agent< ~ == ap-core :: - =? outbound.watches.ap-yoke ?=(%watch-ack -.sign) + =? outbound.watches.current-agent ?=(%watch-ack -.sign) ?^ p.sign - %- ~(del by outbound.watches.ap-yoke) + %- ~(del by outbound.watches.current-agent) [agent-wire dock] - %+ ~(jab by outbound.watches.ap-yoke) [agent-wire dock] + %+ ~(jab by outbound.watches.current-agent) [agent-wire dock] |= [acked=? =path] =. . ?. acked . %- =/ =tape - "{}: received 2nd watch-ack on {}" + "{}: received 2nd watch-ack on {}" (slog leaf+tape ~) . [& path] @@ -1207,14 +1213,14 @@ :: =^ maybe-tang ap-core (ap-upgrade-state old-agent-state) :: - =. ap-config + =. agent-config =/ =term ?~(old-agent-state %boot %bump) =/ possibly-suss ?~ maybe-tang - =/ =suss [ap-name term now] + =/ =suss [agent-name term now] [%.y suss] [%.n u.maybe-tang] - [possibly-suss ap-config] + [possibly-suss agent-config] :: [maybe-tang ap-core] :: +ap-upgrade-state: low-level install. @@ -1236,8 +1242,8 @@ ^+ ap-core :: %= ap-core - inbound.watches.ap-yoke - (~(del by inbound.watches.ap-yoke) ap-duct) + inbound.watches.current-agent + (~(del by inbound.watches.current-agent) agent-duct) == :: +ap-load-delete: load delete. :: @@ -1245,13 +1251,13 @@ ^+ ap-core :: =/ maybe-incoming - (~(get by inbound.watches.ap-yoke) ap-duct) + (~(get by inbound.watches.current-agent) agent-duct) ?~ maybe-incoming ap-core :: =/ incoming u.maybe-incoming - =. inbound.watches.ap-yoke - (~(del by inbound.watches.ap-yoke) ap-duct) + =. inbound.watches.current-agent + (~(del by inbound.watches.current-agent) agent-duct) :: =^ maybe-tang ap-core %+ ap-ingest ~ |. @@ -1320,13 +1326,18 @@ ?: ?=(%& -.result) ~ `p.result - =^ ack-moves=(list move) ap-core + =/ ack-moves=(list move) + %- zing + %- turn :_ ap-from-internal + ^- (list card:agent) ?- ack - ~ [~ ap-core] - %poke-ack (ap-from-internal %give %poke-ack maybe-tang) - %watch-ack (ap-from-internal %give %watch-ack maybe-tang) + ~ ~ + %poke-ack [%give %poke-ack maybe-tang]~ + %watch-ack [%give %watch-ack maybe-tang]~ == - =. ap-moves :(weld (flop new-moves) ack-moves ap-moves) + :: + =. agent-moves + :(weld (flop new-moves) ack-moves agent-moves) [maybe-tang ap-core] :: +ap-handle-result: handle result. :: @@ -1337,16 +1348,9 @@ ?: ?=(%| -.result) `ap-core :: - =^ caz=(list card:agent) agent.ap-yoke p.result - =^ moves ap-core - =| fex=(list move) - |- ^+ [fex ap-core] - ?~ caz [fex ap-core] - =^ fax ap-core (ap-from-internal i.caz) - =. fex (weld fex fax) - $(caz t.caz) - :: - =. inbound.watches.ap-yoke + =. agent.current-agent +.p.result + =/ moves (zing (turn -.p.result ap-from-internal)) + =. inbound.watches.current-agent (ap-handle-kicks moves) (ap-handle-peers moves) :: +ap-handle-kicks: handle cancels of inbound.watches @@ -1365,7 +1369,7 @@ :: =/ quit-map=bitt (malt (turn quits |=(=duct [duct *[ship path]]))) - (~(dif by inbound.watches.ap-yoke) quit-map) + (~(dif by inbound.watches.current-agent) quit-map) :: +ap-handle-peers: handle new outbound.watches :: ++ ap-handle-peers @@ -1382,8 +1386,8 @@ ?> ?=([%use @ @ %out @ @ *] wire) =/ short-wire t.t.t.t.t.t.wire =/ =dock [q.p q]:q.move.move - =. outbound.watches.ap-yoke - (~(del by outbound.watches.ap-yoke) [short-wire dock]) + =. outbound.watches.current-agent + (~(del by outbound.watches.current-agent) [short-wire dock]) $(moves t.moves, new-moves [move new-moves]) ?. ?=([* %pass * %g %deal * * %watch *] move) $(moves t.moves, new-moves [move new-moves]) @@ -1392,15 +1396,15 @@ =/ short-wire t.t.t.t.t.t.wire =/ =dock [q.p q]:q.move.move =/ =path path.r.q.move.move - ?: (~(has by outbound.watches.ap-yoke) short-wire dock) + ?: (~(has by outbound.watches.current-agent) short-wire dock) =. ap-core =/ =tang - ~[leaf+"subscribe wire not unique" >ap-name< >short-wire< >dock<] - %- (slog >out=outbound.watches.ap-yoke< tang) + ~[leaf+"subscribe wire not unique" >agent-name< >short-wire< >dock<] + %- (slog >out=outbound.watches.current-agent< tang) (ap-error %watch-not-unique tang) $(moves t.moves) - =. outbound.watches.ap-yoke - (~(put by outbound.watches.ap-yoke) [short-wire dock] [| path]) + =. outbound.watches.current-agent + (~(put by outbound.watches.current-agent) [short-wire dock] [| path]) $(moves t.moves, new-moves [move new-moves]) -- -- @@ -1435,10 +1439,10 @@ :: ~| [ship=ship plea-path=path] ?> ?=([%ge @ ~] path) - =/ ap-name i.t.path + =/ agent-name i.t.path :: =/ =ames-request ;;(ames-request noun) - => (mo-handle-ames-request:mo-core ship ap-name ames-request) + => (mo-handle-ames-request:mo-core ship agent-name ames-request) mo-abet :: %sear mo-abet:(mo-filter-queue:mo-core ship.task) @@ -1485,53 +1489,12 @@ =? all-state ?=(%4 -.all-state) (state-4-to-5 all-state) :: - =? all-state ?=(%5 -.all-state) - (state-5-to-6 all-state) - :: - ?> ?=(%6 -.all-state) + ?> ?=(%5 -.all-state) gall-payload(state all-state) :: :: +all-state: upgrade path :: - ++ all-state - $%(state-0 state-1 state-2 state-3 state-4 state-5 state-6) - :: - ++ state-5-to-6 - |= =state-5 - ^- state-6 - %= state-5 - - %6 - yokes.agents-5 - %- ~(run by yokes.agents-5.state-5) - |= yoke-5 - ^- yoke - :* control-duct live stats watches agent beak marks - casts=~ - == - == - :: - ++ state-5 - $: %5 - =agents-5 - == - :: - ++ agents-5 - $: system-duct=duct - outstanding=(map [wire duct] (qeu remote-request)) - contacts=(set ship) - yokes=(map term yoke-5) - blocked=(map term (qeu blocked-move)) - == - :: - ++ yoke-5 - $: control-duct=duct - live=? - =stats - =watches - =agent - =beak - marks=(map duct mark) - == + ++ all-state $%(state-0 state-1 state-2 state-3 state-4 state-5) :: ++ state-4-to-5 |= =state-4 From c08161af7d2b0f2b286e5574096a4cfa0dc5f102 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 30 Apr 2020 04:15:28 -0400 Subject: [PATCH 079/280] gall: scry and warp to /nowhere --- pkg/arvo/sys/vane/gall.hoon | 327 +++++++++++++----------------------- 1 file changed, 118 insertions(+), 209 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index f3b5d693d..1b3b96790 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -326,10 +326,7 @@ %era (mo-handle-sys-era path sign-arvo) %cor (mo-handle-sys-cor path sign-arvo) %lag (mo-handle-sys-lag path sign-arvo) - %pel (mo-handle-sys-pel path sign-arvo) - %rep (mo-handle-sys-rep path sign-arvo) %req (mo-handle-sys-req path sign-arvo) - %val (mo-handle-sys-val path sign-arvo) %way (mo-handle-sys-way path sign-arvo) == :: +mo-handle-sys-era: receive update about contact @@ -393,51 +390,6 @@ ap-abet:(ap-clog:app ship.sign-arvo) :: $(agents t.agents) - :: +mo-handle-sys-pel: translated peer. - :: - :: Validates a received %ford result and %gives an internal - :: %fact. - :: - ++ mo-handle-sys-pel - |= [=path =sign-arvo] - ^+ mo-core - :: - ?> ?=([%pel @ ~] path) - ?> ?=([%f %made *] sign-arvo) - :: - ?- result.sign-arvo - [%incomplete *] - (mo-give %unto %poke-ack `tang.result.sign-arvo) - :: - [%complete %error *] - (mo-give %unto %poke-ack `message.build-result.result.sign-arvo) - :: - [%complete %success *] - (mo-give %unto %fact (result-to-cage:ford build-result.result.sign-arvo)) - == - :: +mo-handle-sys-rep: reverse request. - :: - :: On receipt of a valid +sign from %ford, sets state to the - :: appropriate duct and gives an internal %fact - :: containing the +sign payload. - :: - ++ mo-handle-sys-rep - |= [=path =sign-arvo] - ^+ mo-core - :: - ?> ?=([%rep ~] path) - ?> ?=([%f %made *] sign-arvo) - :: - ?- result.sign-arvo - [%incomplete *] - (mo-give %done `[%gall-fail tang.result.sign-arvo]) - :: - [%complete %error *] - (mo-give %done `[%gall-fail message.build-result.result.sign-arvo]) - :: - [%complete %success *] - (mo-give %unto %fact (result-to-cage:ford build-result.result.sign-arvo)) - == :: +mo-handle-sys-req: TODO description :: :: TODO: what should we do if the remote nacks our %pull? @@ -472,32 +424,6 @@ `[%watch-ack u.p.sign] (mo-give %done err) == - :: +mo-handle-sys-val: inbound validate. - :: - :: Validates an incoming +sign from %ford and applies it to the - :: specified agent. - :: - ++ mo-handle-sys-val - |= [=path =sign-arvo] - ^+ mo-core - :: - ?> ?=([%val @ @ ~] path) - ?> ?=([%f %made *] sign-arvo) - =/ =ship (slav %p i.t.path) - =/ =term i.t.t.path - ?: ?=([%incomplete *] result.sign-arvo) - =/ err (some tang.result.sign-arvo) - (mo-give %unto %poke-ack err) - :: - =/ build-result build-result.result.sign-arvo - ?: ?=([%error *] build-result) - =/ err (some message.build-result) - (mo-give %unto %poke-ack err) - :: - =/ =routes [disclosing=~ attributing=ship] - =/ =cage (result-to-cage:ford build-result) - =/ =deal [%poke cage] - (mo-apply term routes deal) :: +mo-handle-sys-way: handle response to outgoing remote request :: ++ mo-handle-sys-way @@ -662,88 +588,55 @@ ++ mo-apply |= [dap=term =routes =deal] ^+ mo-core - :: TODO: Remove this horrific hack when ford pinto comes! - => |% - +$ serial @uvH - :: - +$ letter - $% [%text text=cord] - [%url url=cord] - [%code expression=cord output=(list tank)] - [%me narrative=cord] - == - :: - +$ envelope - $: uid=serial - number=@ - author=ship - when=time - =letter - == - :: - +$ config - $: length=@ - read=@ - == - :: - +$ mailbox - $: =config - envelopes=(list envelope) - == - :: - +$ inbox (map path mailbox) - :: - +$ chat-configs (map path config) - :: - +$ chat-base - $% [%create =path] - [%delete =path] - [%message =path =envelope] - [%read =path] - == - :: - +$ chat-action - $% :: %messages: append a list of messages to mailbox - :: - [%messages =path envelopes=(list envelope)] - chat-base - == - :: - +$ chat-update - $% [%keys keys=(set path)] - [%config =path =config] - [%messages =path start=@ud end=@ud envelopes=(list envelope)] - chat-base - == - -- + ?- -.deal + ?(%watch %watch-as %leave %poke) + (mo-apply-sure dap routes deal) :: - =/ =path /sys/val/(scot %p attributing.routes)/[dap] - =/ [=ship =desk] [p q]:(mo-beak dap) - :: - ?: ?=(%raw-poke -.deal) - :: TODO: Remove this horrific hack when ford pinto comes! - ?+ mark.deal - =/ =schematic:ford [%vale ship^desk +.deal] - =/ =note-arvo [%f %build live=%.n schematic] - (mo-pass path note-arvo) + %raw-poke + =/ =case:clay da+now + =/ sky (ski [%141 %noun] ~ %cb [our %home case] /[mark.deal]) + ?- sky + ?(~ [~ ~]) + =/ ror "gall: raw-poke fail :{(trip dap)} {}" + (mo-give %unto %poke-ack `[leaf+ror]~) :: - %chat-action - =/ chat-act=(unit chat-action) ((soft chat-action) noun.deal) - ?~ chat-act - ~& gall-raw-chat-poke-failed+[dap attributing.routes] - mo-core - =/ =cage [%chat-action !>(u.chat-act)] - =/ new-deal=^deal [%poke cage] - =/ app (ap-abed:ap dap routes) - =. app (ap-apply:app new-deal) - ap-abet:app + [~ ~ *] + =+ !<(=dais:clay q.u.u.sky) + =/ res (mule |.((vale:dais noun.deal))) + ?: ?=(%| -.res) + =/ ror "gall: raw-poke vale fail :{(trip dap)} {}" + (mo-give %unto %poke-ack `[leaf+ror p.res]) + =. mo-core + %+ mo-pass /nowhere + [%c %warp our %home ~ %sing %b case /[mark.deal]] + (mo-apply-sure dap routes [%poke mark.deal p.res]) == :: - ?: ?=(%poke-as -.deal) - =/ =schematic:ford [%cast ship^desk mark.deal [%$ cage.deal]] - =/ =note-arvo [%f %build live=%.n schematic] - (mo-pass path note-arvo) - :: + %poke-as + =/ =case:clay da+now + =/ =mars:clay [p.cage mark]:deal + =/ sky (ski [%141 %noun] ~ %cc [our %home case] /[a.mars]/[b.mars]) + ?- sky + ?(~ [~ ~]) + =/ ror "gall: poke cast fail :{(trip dap)} {}" + (mo-give %unto %poke-ack `[leaf+ror]~) + :: + [~ ~ *] + =+ !<(=tube:clay q.u.u.sky) + =/ res (mule |.((tube q.cage.deal))) + ?: ?=(%| -.res) + =/ ror "gall: poke-as cast fail :{(trip dap)} {}" + (mo-give %unto %poke-ack `[leaf+ror p.res]) + =. mo-core + %+ mo-pass /nowhere + [%c %warp our %home ~ %sing %c case /[a.mars]/[b.mars]] + (mo-apply-sure dap routes [%poke mark.deal p.res]) + == + == + :: + ++ mo-apply-sure + |= [dap=term =routes =deal] + ^+ mo-core =/ app (ap-abed:ap dap routes) =. app (ap-apply:app deal) ap-abet:app @@ -798,16 +691,27 @@ |= =ames-response ^+ mo-core ?- -.ames-response - :: %d: diff; ask ford to validate .noun as .mark + :: %d: diff; ask clay to validate .noun as .mark :: %d - =/ =wire /sys/rep - :: agents load their code from the %home desk, including marks + =/ =case:clay da+now + =/ sky (ski [%141 %noun] ~ %cb [our %home case] /[mark.ames-response]) + ?- sky + ?(~ [~ ~]) + =/ ror "gall: ames mark fail {}" + (mo-give %done `vale+[leaf+ror]~) :: - =/ =note-arvo - =/ =disc:ford [our %home] - [%f %build live=%.n %vale disc [mark noun]:ames-response] - (mo-pass wire note-arvo) + [~ ~ *] + =+ !<(=dais:clay q.u.u.sky) + =/ res (mule |.((vale:dais noun.ames-response))) + ?: ?=(%| -.res) + =/ ror "gall: ames vale fail {}" + (mo-give %done `vale+[leaf+ror p.res]) + =. mo-core + %+ mo-pass /nowhere + [%c %warp our %home ~ %sing %b case /[mark.ames-response]] + (mo-give %unto %fact mark.ames-response p.res) + == :: :: %x: kick; tell agent the publisher canceled the subscription :: @@ -829,6 +733,7 @@ current-agent=yoke == ++ ap-core . + ++ ap-emit |=(=move ap-core(agent-moves [move agent-moves])) :: +ap-abed: initialise state for an agent, with the supplied routes. :: :: The agent must already be running in +gall -- here we simply update @@ -875,7 +780,7 @@ ++ ap-from-internal ~/ %ap-from-internal |= card=(wind neat gift:agent) - ^- (list move) + ^+ ap-core :: ?- -.card %slip !! @@ -884,35 +789,46 @@ =/ =gift:agent p.card ?: ?=(%kick -.gift) =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ship.gift) - %+ turn ducts - |= =duct - ~? &(=(duct system-duct.state) !=(agent-name %hood)) - [%agent-giving-on-system-duct agent-name -.gift] - [duct %give %unto %kick ~] + =. agent-moves + =- (weld - agent-moves) + %+ turn ducts + |= =duct + ~? &(=(duct system-duct.state) !=(agent-name %hood)) + [%agent-giving-on-system-duct agent-name -.gift] + [duct %give %unto %kick ~] + ap-core :: ?. ?=(%fact -.gift) - [agent-duct %give %unto gift]~ + (ap-emit [agent-duct %give %unto gift]) :: - =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ~) =/ =cage cage.gift - %+ turn ducts - |= =duct - ~? &(=(duct system-duct.state) !=(agent-name %hood)) + =/ dux=(list duct) (ap-ducts-from-paths paths.gift ~) + |- ^+ ap-core + ?~ dux ap-core + ~? &(=(i.dux system-duct.state) !=(agent-name %hood)) [%agent-giving-on-system-duct agent-name -.gift] - ^- move =/ =mark - (~(gut by marks.current-agent) duct p.cage) + (~(gut by marks.current-agent) i.dux p.cage) :: ?: =(mark p.cage) - [duct %give %unto %fact cage.gift] - =/ =path /sys/pel/[agent-name] - =/ =note-arvo - =/ =schematic:ford - =/ =beak (mo-beak agent-name) - [%cast [p q]:beak mark [%$ cage]] - [%f %build live=%.n schematic] - :: - [duct %pass path note-arvo] + (ap-emit [i.dux %give %unto %fact cage.gift]) + =/ =mars:clay [p.cage mark] + =/ =case:clay da+now + =/ bek=beak [our %home case] + =/ sky (ski [%141 %noun] ~ %cc bek /[a.mars]/[b.mars]) + ?- sky + ?(~ [~ ~]) ap-kill-up + [~ ~ *] + =+ !<(=tube:clay q.u.u.sky) + =/ res (mule |.((tube q.cage))) + ?: ?=(%| -.res) + ap-kill-up + =. ap-core + %- ap-emit + :^ i.dux %pass /nowhere + [%c %warp our %home ~ %sing %c case /[a.mars]/[b.mars]] + (ap-emit [i.dux %give %unto %fact b.mars p.res]) + == :: %pass =/ =duct system-duct.state @@ -926,14 +842,13 @@ :- (scot %p our) [%out (scot %p ship.neat) name.neat wire] [(scot %p attributing.agent-routes) wire] - =. wire - [%use agent-name wire] + =. wire [%use agent-name wire] =/ =note-arvo ?- -.neat %arvo note-arvo.neat %agent [%g %deal [our ship.neat] [name deal]:neat] == - [duct %pass wire note-arvo]~ + (ap-emit [duct %pass wire note-arvo]) == :: +ap-breach: ship breached, so forget about them :: @@ -1054,14 +969,6 @@ ?: is-ok ap-core (ap-kill-down wire [other-ship other-agent]) - :: +ap-give: return result. - :: - ++ ap-give - |= =gift:agent - ^+ ap-core - =/ internal-moves - (weld (ap-from-internal %give gift) agent-moves) - ap-core(agent-moves internal-moves) :: +ap-construct-bowl: set up bowl. :: ++ ap-construct-bowl @@ -1078,14 +985,18 @@ now=time.stats.current-agent :: time byk=beak.current-agent :: source == == + :: +ap-give: return result. + :: + ++ ap-give + |= =gift:agent + ^+ ap-core + (ap-from-internal %give gift) :: +ap-pass: request action. :: ++ ap-pass |= [=path =neat] ^+ ap-core - =/ internal-moves - (ap-from-internal %pass path neat) - ap-core(agent-moves (weld internal-moves agent-moves)) + (ap-from-internal %pass path neat) :: +ap-reinstall: reinstall. :: ++ ap-reinstall @@ -1326,19 +1237,12 @@ ?: ?=(%& -.result) ~ `p.result - =/ ack-moves=(list move) - %- zing - %- turn :_ ap-from-internal - ^- (list card:agent) - ?- ack - ~ ~ - %poke-ack [%give %poke-ack maybe-tang]~ - %watch-ack [%give %watch-ack maybe-tang]~ - == - :: - =. agent-moves - :(weld (flop new-moves) ack-moves agent-moves) - [maybe-tang ap-core] + :- maybe-tang + ?- ack + ~ ap-core + %poke-ack (ap-give %poke-ack maybe-tang) + %watch-ack (ap-give %watch-ack maybe-tang) + == :: +ap-handle-result: handle result. :: ++ ap-handle-result @@ -1349,7 +1253,10 @@ `ap-core :: =. agent.current-agent +.p.result - =/ moves (zing (turn -.p.result ap-from-internal)) + =. ap-core + %+ roll -.p.result + |= [=card:agent cor=_ap-core] + (ap-from-internal:cor card) =. inbound.watches.current-agent (ap-handle-kicks moves) (ap-handle-peers moves) @@ -1919,6 +1826,8 @@ ^- [(list move) _gall-payload] ?^ dud ~&(%gall-take-dud ((slog tang.u.dud) [~ gall-payload])) + ?: =(/nowhere wire) + [~ gall-payload] :: ~| [%gall-take-failed wire] :: From 1d5dfe394f471d0b9d1d341dbbfcd87e2884b84f Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 30 Apr 2020 23:14:16 -0700 Subject: [PATCH 080/280] gall: port mark operations to fusion Gall no longer refers to Ford Turbo --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 17 +++-- pkg/arvo/sys/vane/gall.hoon | 125 ++++++++++++++++++++++-------------- 3 files changed, 90 insertions(+), 56 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index b05984e23..378cfdfe5 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dfefbd6a561182f85a68c3a26a128168d7a70c17df0be5224bf2c8560a86ecbe -size 13157380 +oid sha256:880523cb6208ad651d2fcef792c2b43e9dbf2d8721f9e3cafdf81be120e78c33 +size 13150614 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index e4397c73e..9c1368f25 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2614,6 +2614,8 @@ ?~ lob [~ ~] =+ mar=(lobe-to-mark u.lob) + :: should convert any lobe to cage + :: ?. ?=($hoon mar) [~ ~ %| u.lob] :^ ~ ~ %& @@ -2899,7 +2901,7 @@ =^ new=vase nub (build-fit %mar b) =/ rab (mule |.((slap new (ream (cat 3 a ':grab'))))) ?: &(?=(%& -.rab) ?=(^ q.p.rab)) - :_(nub |=(sam=vase (slam p.rab sam))) + :_(nub |=(sam=vase ~|([%grab a b] (slam p.rab sam)))) :: try +jump :: =/ jum (mule |.((slap old (ream (cat 3 b ':jump'))))) @@ -5589,10 +5591,15 @@ ?: =(p.m his) ~ `p.m =/ den ((de our now ski [/scryduct ~] ruf) his syd) - =+ -:(aver:den for u.run u.luk tyl) - ?~ - - - ?~ u.- - - ?: ?=(%& -.u.u.-) ``p.u.u.- + =/ result (mule |.(-:(aver:den for u.run u.luk tyl))) + ?: ?=(%| -.result) + %- (slog >%clay-scry-fail< p.result) + ~ + ?~ p.result ~ + ?~ u.p.result [~ ~] + :: should convert %| case to cage + :: + ?: ?=(%& -.u.u.p.result) ``p.u.u.p.result ~ :: ++ stay [ver ruf] diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 1b3b96790..f9588f0be 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -240,7 +240,7 @@ ?- -.deal %poke [%m p.cage.deal q.q.cage.deal] %leave [%u ~] - %watch-as [%l deal] + %watch-as [%l [mark path]:deal] %watch [%s path.deal] == :: @@ -583,7 +583,6 @@ :: =/ app (ap-abed:ap dap routes) (ap-peek:app care path) - :: +mo-apply: apply the supplied action to the specified agent. :: ++ mo-apply |= [dap=term =routes =deal] @@ -615,7 +614,8 @@ %poke-as =/ =case:clay da+now =/ =mars:clay [p.cage mark]:deal - =/ sky (ski [%141 %noun] ~ %cc [our %home case] /[a.mars]/[b.mars]) + =/ mars-path /[a.mars]/[b.mars] + =/ sky (ski [%141 %noun] ~ %cc [our %home case] (flop mars-path)) ?- sky ?(~ [~ ~]) =/ ror "gall: poke cast fail :{(trip dap)} {}" @@ -733,7 +733,6 @@ current-agent=yoke == ++ ap-core . - ++ ap-emit |=(=move ap-core(agent-moves [move agent-moves])) :: +ap-abed: initialise state for an agent, with the supplied routes. :: :: The agent must already be running in +gall -- here we simply update @@ -780,7 +779,7 @@ ++ ap-from-internal ~/ %ap-from-internal |= card=(wind neat gift:agent) - ^+ ap-core + ^- (list move) :: ?- -.card %slip !! @@ -789,45 +788,47 @@ =/ =gift:agent p.card ?: ?=(%kick -.gift) =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ship.gift) - =. agent-moves - =- (weld - agent-moves) - %+ turn ducts - |= =duct - ~? &(=(duct system-duct.state) !=(agent-name %hood)) - [%agent-giving-on-system-duct agent-name -.gift] - [duct %give %unto %kick ~] - ap-core + %+ turn ducts + |= =duct + ~? &(=(duct system-duct.state) !=(agent-name %hood)) + [%agent-giving-on-system-duct agent-name -.gift] + [duct %give %unto %kick ~] :: ?. ?=(%fact -.gift) - (ap-emit [agent-duct %give %unto gift]) + [agent-duct %give %unto gift]~ :: + =/ ducts=(list duct) (ap-ducts-from-paths paths.gift ~) =/ =cage cage.gift - =/ dux=(list duct) (ap-ducts-from-paths paths.gift ~) - |- ^+ ap-core - ?~ dux ap-core - ~? &(=(i.dux system-duct.state) !=(agent-name %hood)) + %- zing + %+ turn ducts + |= =duct + ~? &(=(duct system-duct.state) !=(agent-name %hood)) [%agent-giving-on-system-duct agent-name -.gift] + ^- (list move) =/ =mark - (~(gut by marks.current-agent) i.dux p.cage) + (~(gut by marks.current-agent) duct p.cage) :: ?: =(mark p.cage) - (ap-emit [i.dux %give %unto %fact cage.gift]) + [duct %give %unto %fact cage.gift]~ =/ =mars:clay [p.cage mark] =/ =case:clay da+now =/ bek=beak [our %home case] - =/ sky (ski [%141 %noun] ~ %cc bek /[a.mars]/[b.mars]) + =/ mars-path /[a.mars]/[b.mars] + =/ sky (ski [%141 %noun] ~ %cc bek (flop mars-path)) ?- sky - ?(~ [~ ~]) ap-kill-up + ?(~ [~ ~]) + %- (slog leaf+"watch-as fact conversion find-fail" >sky< ~) + (ap-kill-up-slip duct) + :: [~ ~ *] =+ !<(=tube:clay q.u.u.sky) =/ res (mule |.((tube q.cage))) ?: ?=(%| -.res) - ap-kill-up - =. ap-core - %- ap-emit - :^ i.dux %pass /nowhere - [%c %warp our %home ~ %sing %c case /[a.mars]/[b.mars]] - (ap-emit [i.dux %give %unto %fact b.mars p.res]) + %- (slog leaf+"watch-as fact conversion failure" p.res) + (ap-kill-up-slip duct) + :~ [duct %pass /nowhere %c %warp our %home ~ %sing %c case mars-path] + [duct %give %unto %fact b.mars p.res] + == == :: %pass @@ -848,7 +849,7 @@ %arvo note-arvo.neat %agent [%g %deal [our ship.neat] [name deal]:neat] == - (ap-emit [duct %pass wire note-arvo]) + [duct %pass wire note-arvo]~ == :: +ap-breach: ship breached, so forget about them :: @@ -969,6 +970,14 @@ ?: is-ok ap-core (ap-kill-down wire [other-ship other-agent]) + :: +ap-give: return result. + :: + ++ ap-give + |= =gift:agent + ^+ ap-core + =/ internal-moves + (weld (ap-from-internal %give gift) agent-moves) + ap-core(agent-moves internal-moves) :: +ap-construct-bowl: set up bowl. :: ++ ap-construct-bowl @@ -985,18 +994,14 @@ now=time.stats.current-agent :: time byk=beak.current-agent :: source == == - :: +ap-give: return result. - :: - ++ ap-give - |= =gift:agent - ^+ ap-core - (ap-from-internal %give gift) :: +ap-pass: request action. :: ++ ap-pass |= [=path =neat] ^+ ap-core - (ap-from-internal %pass path neat) + =/ internal-moves + (ap-from-internal %pass path neat) + ap-core(agent-moves (weld internal-moves agent-moves)) :: +ap-reinstall: reinstall. :: ++ ap-reinstall @@ -1183,6 +1188,20 @@ :: => ap-load-delete (ap-give %kick ~ ~) + :: +ap-kill-up-slip: 2-sided kill from publisher side by slip + :: + :: +ap-kill-up is reentrant if you call it in the + :: middle of processing another deal + :: + :: Should probably call +ap-error with error message + :: + ++ ap-kill-up-slip + |= =duct + ^- (list move) + :: + :~ [duct %slip %g %deal [our our] agent-name %leave ~] + [duct %give %unto %kick ~] + == :: +ap-kill-down: 2-sided kill from subscriber side :: :: Must process leave first in case kick handler rewatches. @@ -1237,12 +1256,19 @@ ?: ?=(%& -.result) ~ `p.result - :- maybe-tang - ?- ack - ~ ap-core - %poke-ack (ap-give %poke-ack maybe-tang) - %watch-ack (ap-give %watch-ack maybe-tang) - == + =/ ack-moves=(list move) + %- zing + %- turn :_ ap-from-internal + ^- (list card:agent) + ?- ack + ~ ~ + %poke-ack [%give %poke-ack maybe-tang]~ + %watch-ack [%give %watch-ack maybe-tang]~ + == + :: + =. agent-moves + :(weld (flop new-moves) ack-moves agent-moves) + [maybe-tang ap-core] :: +ap-handle-result: handle result. :: ++ ap-handle-result @@ -1253,10 +1279,7 @@ `ap-core :: =. agent.current-agent +.p.result - =. ap-core - %+ roll -.p.result - |= [=card:agent cor=_ap-core] - (ap-from-internal:cor card) + =/ moves (zing (turn -.p.result ap-from-internal)) =. inbound.watches.current-agent (ap-handle-kicks moves) (ap-handle-peers moves) @@ -1296,19 +1319,23 @@ =. outbound.watches.current-agent (~(del by outbound.watches.current-agent) [short-wire dock]) $(moves t.moves, new-moves [move new-moves]) - ?. ?=([* %pass * %g %deal * * %watch *] move) + ?. ?=([* %pass * %g %deal * * ?(%watch %watch-as) *] move) $(moves t.moves, new-moves [move new-moves]) =/ =wire p.move.move ?> ?=([%use @ @ %out @ @ *] wire) =/ short-wire t.t.t.t.t.t.wire =/ =dock [q.p q]:q.move.move - =/ =path path.r.q.move.move + =/ =path + ?- -.r.q.move.move + %watch path.r.q.move.move + %watch-as path.r.q.move.move + == ?: (~(has by outbound.watches.current-agent) short-wire dock) =. ap-core =/ =tang ~[leaf+"subscribe wire not unique" >agent-name< >short-wire< >dock<] %- (slog >out=outbound.watches.current-agent< tang) - (ap-error %watch-not-unique tang) + (ap-error %watch-not-unique tang) :: reentrant, maybe bad? $(moves t.moves) =. outbound.watches.current-agent (~(put by outbound.watches.current-agent) [short-wire dock] [| path]) From 5a0fd2b65312d089087837f23c8026b6e2f313ca Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 4 May 2020 06:57:32 -0400 Subject: [PATCH 081/280] dojo: use ford-fusion; missing /- and /+ --- pkg/arvo/app/dojo.hoon | 259 ++++++++++++++++++++++++----------------- 1 file changed, 153 insertions(+), 106 deletions(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 09ff73f01..71ed7109f 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -99,6 +99,17 @@ -- => |% +:: TODO: move to zuse? copied from clay +:: +++ with-face |=([face=@tas =vase] vase(p [%face face p.vase])) +++ with-faces + =| res=(unit vase) + |= vaz=(list [face=@tas =vase]) + ^- vase + ?~ vaz (need res) + =/ faz (with-face i.vaz) + =. res `?~(res faz (slop faz u.res)) + $(vaz t.vaz) :: |parser-at: parsers for dojo expressions using :dir as working directory :: ++ parser-at @@ -320,14 +331,15 @@ |_ dojo-project :: ++ dy-abet +>(poy `+<) :: resolve ++ dy-amok +>(poy ~) :: terminate - ++ dy-ford :: send work to ford - |= [way=wire schematic=schematic:ford] + :: +dy-sing: make a clay read request + :: + ++ dy-sing + |= [way=wire =care:clay =path] ^+ +>+> - ?> ?=($~ pux) - :: pin all builds to :now.hid so they don't get cached forever - :: + ?> ?=(~ pux) %- he-card(poy `+>+<(pux `way)) - [%pass way %arvo %f %build live=%.n schematic] + =/ [=ship =desk =case:clay] he-beak + [%pass way %arvo %c %warp ship desk ~ %sing care case path] :: ++ dy-request |= [way=wire =request:http] @@ -349,11 +361,6 @@ [%pass u.pux %agent [our.hid %spider] %leave ~] [%pass u.pux %arvo %f %kill ~] :: - ++ dy-slam :: call by ford - |= {way/wire gat/vase sam/vase} - ^+ +>+> - (dy-ford way `schematic:ford`[%call [%$ %noun gat] [%$ %noun sam]]) - :: ++ dy-errd :: reject change, abet |= {rev/(unit sole-edit) err/@u} ^+ +>+> @@ -478,7 +485,11 @@ ?: |(?=(^ per) ?=(^ pux) ?=(~ pro)) ~& %dy-no-prompt (dy-diff %bel ~) - (dy-slam /dial u.pro !>(txt)) + =/ res (mule |.((slam u.pro !>(txt)))) + ?: ?=(%| -.res) + %- (slog >%dy-done< p.res) + (dy-rash %bel ~) :: TODO: or +dy-abet(per ~) ? + (dy-made-dial %noun p.res) :: ++ dy-cast |* {typ/_* bun/vase} @@ -636,7 +647,12 @@ ~& %dy-edit-busy =^ lic say (~(transmit sole say) dat) (dy-diff %mor [%det lic] [%bel ~] ~) - (dy-slam(per `dat) /edit u.pro !>((tufa buf.say))) + => .(per `dat) + =/ res (mule |.((slam u.pro !>((tufa buf.say))))) + ?: ?=(%| -.res) + %- (slog >%dy-edit< p.res) + (dy-rash %bel ~) :: TODO: or +dy-abet(per ~) ? + (dy-made-edit %noun p.res) :: ++ dy-type :: sole action |= act/sole-action @@ -656,43 +672,66 @@ !>(~) (slop (dy-vase p.i.src) $(src t.src)) :: - ++ dy-silk-vase |=(vax/vase [%$ %noun vax]) :: vase to silk - ++ dy-silk-sources :: arglist to silk - |= src/(list dojo-source) - ^- schematic:ford - [%$ %noun (dy-sore src)] - :: - ++ dy-silk-config :: configure - |= {cay/cage cig/dojo-config} - ^- [wire schematic:ford] + ++ dy-run-generator + |= [cay=cage cig=dojo-config] + ^+ +>+> ?. (~(nest ut [%cell [%atom %$ ~] %noun]) | p.q.cay) - :: - :: naked gate + ~& p.q.cay + :: naked generator; takes one argument :: ?. &(?=({* ~} p.cig) ?=(~ q.cig)) ~|(%one-argument !!) - :- /noun - :+ %call [%$ %noun q.cay] - [%$ %noun (dy-vase p.i.p.cig)] - :: + =/ res (mule |.((slop !>(%noun) (slam q.cay (dy-vase p.i.p.cig))))) + ?: ?=(%| -.res) + (he-diff(poy ~) %tan p.res) :: TODO: or +dy-rash ? + (dy-hand %noun p.res) :: normal generator :: - :- ?+ -.q.q.cay ~|(%bad-gen ~_((sell (slot 2 q.cay)) !!)) - $say /gent - $ask /dial + :: A normal generator takes as arguments: + :: - event args: date, entropy, beak (network location) + :: - positional arguments, as a list + :: - optional keyword arguments, as name-value pairs + :: + :: The generator is a pair of a result mark and a gate. + :: TODO: handle %ask generators + :: + =/ wat (mule |.(!<(?(%ask %say) (slot 2 q.cay)))) + ?: ?=(%| -.wat) + (he-diff(poy ~) %tan p.wat) + =- =/ res (mule -) + ?: ?=(%| -.res) + (he-diff(poy ~) %tan p.res) + ?- p.wat + %ask (dy-made-dial %noun p.res) + %say (dy-made-gent %noun p.res) == - =+ gat=(slot 3 q.cay) - :+ %call [%$ %noun gat] - :+ [%$ %noun !>([now=now.hid eny=eny.hid bec=he-beak])] - (dy-silk-sources p.cig) - :+ %mute [%$ %noun (fall (slew 27 gat) !>(~))] - ^- (list [wing schematic:ford]) - %+ turn ~(tap by q.cig) - |= {a/term b/(unit dojo-source)} - ^- [wing schematic:ford] - :- [a ~] - :+ %$ %noun - ?~(b !>([~ ~]) (dy-vase p.u.b)) + |. ^- vase + =/ gat + %+ slap + %- with-faces :~ + gat+(slot 3 q.cay) + ven+!>([now=now.hid eny=eny.hid bec=he-beak]) + sor+(dy-sore p.cig) + == + ^~((ream 'gat(+<- ven, +<+< sor)')) + =? gat !=(~ q.cig) + =/ soz=(list [var=term vax=vase]) + %+ turn ~(tap by q.cig) + |= [var=term val=(unit dojo-source)] + ^- [term vase] + :- var + ?~ val + !>([~ ~]) + (dy-vase p.u.val) + %+ slap + (with-faces gat+gat rep+(with-faces soz) ~) + :+ %cncb ~[%gat] + ^- (list [wing hoon]) + %+ turn soz + |= [var=term vax=vase] + ^- [wing hoon] + [~[var &+27 %gat] [%wing var %rep ~]] + (slap gat ^~((ream '(.)'))) :: ++ dy-made-dial :: dialog product |= cag/cage @@ -741,51 +780,80 @@ ++ dy-make :: build step ^+ +> ?> ?=(^ cud) - =+ bil=q.u.cud :: XX =* - ?: ?=($ur -.bil) - (dy-request /hand `request:http`[%'GET' p.bil ~ ~]) - ?: ?=($te -.bil) - (dy-wool-poke p.bil q.bil) - %- dy-ford - ^- [path schematic:ford] - ?- -.bil - $ge (dy-silk-config (dy-cage p.p.p.bil) q.p.bil) - $dv [/hand [%core [he-disc (weld /hoon (flop p.bil))]]] - $ex [/hand (dy-mare p.bil)] - $sa [/hand [%bunt he-disc p.bil]] - $as [/hand [%cast he-disc p.bil [%$ (dy-cage p.q.bil)]]] - $do [/hand [%call (dy-mare p.bil) [%$ (dy-cage p.q.bil)]]] - $tu :- /hand - :+ %$ %noun - |- ^- vase - ?~ p.bil !! - =+ hed=(dy-vase p.i.p.bil) - ?~ t.p.bil hed - (slop hed $(p.bil t.p.bil)) + =/ bil q.u.cud + ?- -.bil + %ur (dy-request /hand `request:http`[%'GET' p.bil ~ ~]) + %te (dy-wool-poke p.bil q.bil) + %ex (dy-mere p.bil) + %dv (dy-sing /hand %a (snoc p.bil %hoon)) + %ge (dy-run-generator (dy-cage p.p.p.bil) q.p.bil) + %sa + =+ .^(=dais:clay cb+(en-beam:format he-beak /[p.bil])) + (dy-hand p.bil bunt:dais) + :: + %as + =/ cag=cage (dy-cage p.q.bil) + =+ .^(=tube:clay cc+(en-beam:format he-beak /[p.bil]/[p.cag])) + (dy-hand p.bil (tube q.cag)) + :: + %do + =/ gat (dy-eval p.bil) + ?: ?=(%| -.gat) + (he-diff(poy ~) %tan p.gat) + =/ res (mule |.((slam q.p.gat (dy-vase p.q.bil)))) + ?: ?=(%| -.res) + (he-diff(poy ~) %tan p.res) + (dy-hand %noun p.res) + :: + %tu + %+ dy-hand %noun + |- ^- vase + ?~ p.bil !! + =/ hed (dy-vase p.i.p.bil) + ?~ t.p.bil hed + (slop hed $(p.bil t.p.bil)) == + :: +dy-hoon-var: if input is a dojo variable lookup, perform it :: - ++ dy-hoon-mark :: XX architect + :: If the expression is a bare reference to a Dojo variable, + :: produce that variable's value; otherwise, produce ~. + :: + ++ dy-hoon-var =+ ^= ope |= gen/hoon ^- hoon ?: ?=(?($sgld $sgbn) -.gen) $(gen q.gen) =+ ~(open ap gen) ?.(=(gen -) $(gen -) gen) - |= gen/hoon ^- (unit mark) + |= gen/hoon ^- (unit cage) =. gen (ope gen) ?: ?=({$cnts {@ ~} ~} gen) - (bind (~(get by var) i.p.gen) head) + (~(get by var) i.p.gen) ~ + :: +dy-mere: execute hoon and complete construction step :: - ++ dy-mare :: build expression - |= gen/hoon - ^- schematic:ford - =+ too=(dy-hoon-mark gen) - =- ?~(too - [%cast he-disc u.too -]) - :+ %ride gen - :- [%$ he-hoon-head] - :^ %plan he-rail `coin`blob+** - `scaffold:ford`[he-rail zuse sur lib ~ ~] + ++ dy-mere + |= =hoon + =/ res (dy-eval hoon) + ?: ?=(%| -.res) + (he-diff(poy ~) %tan p.res) + (dy-hand p.res) + :: +dy-eval: run hoon source against the dojo subject + :: + :: TODO: use /lib and /sur imports to construct subject + :: + ++ dy-eval + |= =hoon + ^- (each cage tang) + ?^ val=(dy-hoon-var hoon) + &+u.val + %- mule |. + :- %hoon + =/ vaz=(list [term vase]) + (turn ~(tap by var) |=([lal=term cag=cage] [lal q.cag])) + =/ sut (slop !>([our=our now=now eny=eny]:hid) !>(..zuse)) + =? sut ?=(^ vaz) (slop (with-faces vaz) sut) + (slap sut hoon) :: ++ dy-step :: advance project |= nex/@ud @@ -874,38 +942,17 @@ :- %pro [& %$ (weld he-prow ?~(buf "> " "< "))] :: - ++ he-made :: result from ford - |= $: way=wire - date=@da - $= result - $% [%complete build-result=build-result:ford] - [%incomplete =tang] - == == + ++ he-writ + |= [way=wire =riot:clay] ^+ +> ?> ?=(^ poy) =< he-pine - ?- -.result - %incomplete - (he-diff(poy ~) %tan tang.result) - :: - %complete - ?- -.build-result.result - :: - %success - :: - %. (result-to-cage:ford build-result.result) - =+ dye=~(. dy u.poy(pux ~)) - ?+ way !! - {$hand ~} dy-hand:dye - {$dial ~} dy-made-dial:dye - {$gent ~} dy-made-gent:dye - {$noun ~} dy-made-noun:dye - {$edit ~} dy-made-edit:dye - == - :: - %error - (he-diff(poy ~) %tan message.build-result.result) - == == + ?~ riot + (he-diff(poy ~) %tan >%build-fail< >(spud way)< ~) + =+ dye=~(. dy u.poy(pux ~)) + ?+ way !! + [%hand ~] (dy-hand:dye noun+!<(vase q.r.u.riot)) + == :: ++ he-unto :: result from agent |= {way/wire cit/sign:agent:gall} @@ -1300,7 +1347,7 @@ =^ moves state =< he-abet ?+ +<.sign-arvo ~|([%dojo-bad-take +<.sign-arvo] !!) - %made (he-made:he-full t.wire +>.sign-arvo) + %writ (he-writ:he-full t.wire +>.sign-arvo) %http-response (he-http-response:he-full t.wire +>.sign-arvo) == [moves ..on-init] From 8693bcbea8e816af163530aeb7ec94e171e33398 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 4 May 2020 07:17:38 -0400 Subject: [PATCH 082/280] dojo: minor cleanup --- pkg/arvo/app/dojo.hoon | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 71ed7109f..eec9c490e 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -676,7 +676,6 @@ |= [cay=cage cig=dojo-config] ^+ +>+> ?. (~(nest ut [%cell [%atom %$ ~] %noun]) | p.q.cay) - ~& p.q.cay :: naked generator; takes one argument :: ?. &(?=({* ~} p.cig) ?=(~ q.cig)) @@ -785,7 +784,7 @@ %ur (dy-request /hand `request:http`[%'GET' p.bil ~ ~]) %te (dy-wool-poke p.bil q.bil) %ex (dy-mere p.bil) - %dv (dy-sing /hand %a (snoc p.bil %hoon)) + %dv (dy-sing hand+p.bil %a (snoc p.bil %hoon)) %ge (dy-run-generator (dy-cage p.p.p.bil) q.p.bil) %sa =+ .^(=dais:clay cb+(en-beam:format he-beak /[p.bil])) @@ -947,11 +946,11 @@ ^+ +> ?> ?=(^ poy) =< he-pine - ?~ riot - (he-diff(poy ~) %tan >%build-fail< >(spud way)< ~) - =+ dye=~(. dy u.poy(pux ~)) - ?+ way !! - [%hand ~] (dy-hand:dye noun+!<(vase q.r.u.riot)) + ?+ way !! + [%hand *] + ?~ riot + (he-diff(poy ~) %tan >%generator-build-fail< >(snoc t.way %hoon)< ~) + (~(dy-hand dy u.poy(pux ~)) noun+!<(vase q.r.u.riot)) == :: ++ he-unto :: result from agent From ccaa1e41ef5cc5990b0c71fea5a7bf70336c9fcd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 4 May 2020 23:20:41 -0400 Subject: [PATCH 083/280] :test: use ford fusion --- pkg/arvo/app/test.hoon | 220 +++++++++++++++++------------------------ 1 file changed, 89 insertions(+), 131 deletions(-) diff --git a/pkg/arvo/app/test.hoon b/pkg/arvo/app/test.hoon index 000f41803..07cf19106 100644 --- a/pkg/arvo/app/test.hoon +++ b/pkg/arvo/app/test.hoon @@ -1,40 +1,19 @@ /+ default-agent -:: +!: |% +$ card card:agent:gall -+$ test - $% [%arvo ~] ::UNIMPLEMENTED - [%marks ~] ::UNIMPLEMENTED - [%cores p=path] - [%hoons p=path] - [%names p=path] - [%renders p=path] ++$ test ?(%agents %marks) ++$ state + $: app=(set path) + app-ok=? + mar=(set path) + mar-ok=? == -- -:: -|% -++ join - |= {a/cord b/(list cord)} - ?~ b '' - (rap 3 |-([i.b ?~(t.b ~ [a $(b t.b)])])) -:: -++ fake-fcgi [%many [%blob *cred:eyre] $+[%n ~] ~] -++ build-core - |= [=disc:ford a=spur b=(list spur)] - ^- card - ~& >> (flop a) - :* %pass a-core+a - %arvo %f %build - live=| - ^- schematic:ford - :- [%core disc %hoon a] - [%$ %cont !>(b)] - == --- -:: =, ford =, format ^- agent:gall +=| =state |_ =bowl:gall +* this . def ~(. (default-agent this %|) bowl) @@ -44,121 +23,100 @@ ++ on-load on-load:def ++ on-poke |= [=mark =vase] - :_ this + ^- [(list card) _this] |^ - =+ !<(a=test vase) - ?- -.a - %arvo ~|(%stub !!) ::basically double solid? - %hoons ~&((list-hoons p.a ~) ~) - %names ~&((list-names p.a) ~) - %marks ~|(%stub !!) ::TODO restore historical handler - %renders ~&(%all-renderers-are-disabled ~) - %cores - =/ spurs [- +]:(list-hoons p.a skip=(sy /sys /ren /tests ~)) - [(build-core [p q]:byk.bowl spurs) ~] + =+ !<(=test vase) + ?- test + %marks test-marks + %agents test-agents == :: - ++ now-beak %_(byk.bowl r [%da now.bowl]) - ++ list-hoons - |= [under=path skipping=(set spur)] ^- (list spur) - =/ sup (flop under) - ~& [%findining-hoons under=under] - |- ^- (list spur) - %- zing - %+ turn - =- (sort ~(tap by -) aor) - dir:.^(arch %cy (en-beam now-beak sup)) - |= [a=knot ~] ^- (list spur) - =. sup [a sup] - ?: (~(has in skipping) (flop sup)) - ~&(> [(flop sup) %out-of-scope] ~) - =/ ded (~(get by skip-completely) (flop sup)) - ?^ ded - ~&(> [(flop sup) %skipped `tape`u.ded] ~) - ?~ [fil:.^(arch %cy (en-beam now-beak [%hoon sup]))] - ^$ - ~& (flop sup) - [sup ^$] - :: - ++ list-names - |= a/path ^- (list term) - =/ hon (list-hoons a ~) - %+ turn hon - |= b=spur - (join '-' (slag 1 (flop b))) - :: - ++ skip-completely - ^~ ^- (map path tape) - %- my :~ ::TODO don't hardcode - :- /ren/run "not meant to be called except on a (different) hoon file" - :- /ren/test-gen "temporarily disabled" + ++ test-marks + =| fex=(list card) + ^+ [fex this] + ?> =(~ mar.state) + =. mar-ok.state %.y + =+ .^(paz=(list path) ct+(en-beam now-beak /mar)) + |- ^+ [fex this] + ?~ paz [fex this] + =/ xap=path (flop i.paz) + ?. ?=([%hoon *] xap) + $(paz t.paz) + =/ mak=^mark + %- crip + %+ turn (tail (spud (tail (flop (tail xap))))) + |=(c=@tD `@tD`?:(=('/' c) '-' c)) + =/ sing=card + :+ %pass /build/mar/[mak] + [%arvo %c %warp our.bowl %home ~ %sing %b da+now.bowl /[mak]] + %_ $ + paz t.paz + fex [sing fex] + mar.state (~(put in mar.state) /mar/[mak]) == + :: + ++ test-agents + =| fex=(list card) + ^+ [fex this] + ?> =(~ app.state) + =. app-ok.state %.y + =+ .^(app-arch=arch cy+(en-beam now-beak /app)) + =/ daz ~(tap in ~(key by dir.app-arch)) + |- ^+ [fex this] + ?~ daz [fex this] + =/ dap-pax=path /app/[i.daz]/hoon + =/ dap-arch .^(arch cy+(en-beam now-beak (flop dap-pax))) + ?~ fil.dap-arch + $(daz t.daz) + =/ sing=card + :+ %pass /build/app/[i.daz] + [%arvo %c %warp our.bowl %home ~ %sing %a da+now.bowl dap-pax] + %_ $ + daz t.daz + fex [sing fex] + app.state (~(put in app.state) /app/[i.daz]) + == + :: + ++ now-beak %_(byk.bowl r [%da now.bowl]) -- -:: -:: ++ on-watch on-watch:def ++ on-leave on-leave:def ++ on-peek on-peek:def ++ on-agent on-agent:def ++ on-arvo |= [=wire =sign-arvo] - |^ - :_ this - ^- (list card) - ?. ?=([%a-core *] wire) + ^- [(list card) _this] + ?. ?=([%build *] wire) (on-arvo:def wire sign-arvo) - ?. ?=(%made +<.sign-arvo) + ?. ?=(%writ +<.sign-arvo) (on-arvo:def wire sign-arvo) - =/ =spur t.wire - =/ res result.sign-arvo - ?: ?=([%incomplete *] res) - ~& incomplete-core+spur - ((slog tang.res) ~) - ?. ?=([%complete %success *] res) - ~& unsuccessful-core+spur - ((slog message.build-result.res) ~) - ?> ?=(^ +<.build-result.res) - %- (slog (report-error spur head.build-result.res)) - =/ nex=(list ^spur) - =< p - ;; [%success %$ %cont * p=(list ^spur)] - tail.build-result.res - ?~ nex ~&(%cores-tested ~) - [(build-core [p q]:byk.bowl nex) ~] + =/ =path t.wire + ?+ path ~|(path+path !!) + [%app *] + =/ ok ?=(^ p.sign-arvo) + ~& ?: ok + agent-built+path + agent-failed+path + =? app-ok.state !ok %.n + =. app.state (~(del in app.state) path) + ~? =(~ app.state) + ?: app-ok.state + %all-agents-built + %some-agents-failed + [~ this] :: - ++ report-error - |= [=spur bud=build-result] - ^- tang - =/ should-fail (~(get by failing) (flop spur)) - ?- -.bud - %success - ?~ should-fail ~ - :~ leaf+"warn: expected failure, {<`tape`u.should-fail>}" - leaf+"warn: built succesfully" - ?: ?=(%bake +<.bud) - (sell q.cage.bud) - ?> ?=(%core +<.bud) - (sell vase.bud) - == - :: - %error - ?^ should-fail - ~[>[%failed-known `tape`(weld "TODO: " u.should-fail)]<] - (flop message.bud) - == - :: - ++ failing - ^~ ^- (map path tape) - %- my :~ ::TODO don't hardcode - :: - :- /gen/al "compiler types out-of-date" - :- /gen/musk "compiler types out-of-date" - :: - :- /gen/cosmetic "incomplete" - :- /gen/lust "incomplete" - :- /gen/scantastic "incomplete" - == - -- -:: + [%mar *] + =/ ok ?=(^ p.sign-arvo) + ~& ?: ok + mark-built+path + mark-failed+path + =? mar-ok.state !ok %.n + =. mar.state (~(del in mar.state) path) + ~? =(~ mar.state) + ?: mar-ok.state + %all-marks-built + %some-marks-failed + [~ this] + == ++ on-fail on-fail:def -- From 8abdd3d066e6974b3969957007675cdbf357253d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 4 May 2020 23:21:05 -0400 Subject: [PATCH 084/280] mar: all marks build; added +grad and +noun:grow to many --- pkg/arvo/mar/acme/order.hoon | 5 +++++ pkg/arvo/mar/azimuth/update.hoon | 5 +++++ pkg/arvo/mar/chat/action.hoon | 5 +++++ pkg/arvo/mar/chat/config.hoon | 2 ++ pkg/arvo/mar/chat/configs.hoon | 2 ++ pkg/arvo/mar/chat/hook-action.hoon | 5 +++++ pkg/arvo/mar/chat/hook-update.hoon | 2 ++ pkg/arvo/mar/chat/initial.hoon | 2 ++ pkg/arvo/mar/chat/update.hoon | 2 ++ pkg/arvo/mar/chat/view-action.hoon | 5 +++++ pkg/arvo/mar/contact/action.hoon | 5 +++++ pkg/arvo/mar/contact/initial.hoon | 2 ++ pkg/arvo/mar/contact/update.hoon | 2 ++ pkg/arvo/mar/dill/belt.hoon | 5 +++++ pkg/arvo/mar/dill/blit.hoon | 2 ++ pkg/arvo/mar/dns/address.hoon | 5 +++++ pkg/arvo/mar/dns/binding.hoon | 5 +++++ pkg/arvo/mar/dns/complete.hoon | 5 +++++ pkg/arvo/mar/drum-put.hoon | 5 +++++ pkg/arvo/mar/elem.hoon | 2 +- pkg/arvo/mar/eth-watcher-poke.hoon | 5 +++++ pkg/arvo/mar/front.hoon | 2 ++ pkg/arvo/mar/group/action.hoon | 5 +++++ pkg/arvo/mar/group/hook-action.hoon | 5 +++++ pkg/arvo/mar/group/initial.hoon | 2 ++ pkg/arvo/mar/group/update.hoon | 2 ++ pkg/arvo/mar/helm-hi.hoon | 1 + pkg/arvo/mar/htm.hoon | 1 + pkg/arvo/mar/httr.hoon | 2 ++ pkg/arvo/mar/hymn.hoon | 1 + pkg/arvo/mar/invite/action.hoon | 5 +++++ pkg/arvo/mar/invite/initial.hoon | 2 ++ pkg/arvo/mar/invite/update.hoon | 2 ++ pkg/arvo/mar/json/rpc/response.hoon | 5 +++++ pkg/arvo/mar/language-server/rpc/notification.hoon | 2 ++ pkg/arvo/mar/language-server/rpc/request.hoon | 5 +++++ pkg/arvo/mar/language-server/rpc/response.hoon | 2 ++ pkg/arvo/mar/launch/action.hoon | 5 +++++ pkg/arvo/mar/lens/command.hoon | 5 +++++ pkg/arvo/mar/link/action.hoon | 1 + pkg/arvo/mar/link/initial.hoon | 1 + pkg/arvo/mar/link/listen-poke.hoon | 1 + pkg/arvo/mar/link/update.hoon | 1 + pkg/arvo/mar/link/view-action.hoon | 10 +++++----- pkg/arvo/mar/metadata/action.hoon | 5 +++++ pkg/arvo/mar/metadata/update.hoon | 2 ++ pkg/arvo/mar/noun.hoon | 7 +++++++ pkg/arvo/mar/path.hoon | 5 +++++ pkg/arvo/mar/permission/action.hoon | 5 +++++ pkg/arvo/mar/permission/group-hook-action.hoon | 5 +++++ pkg/arvo/mar/permission/hook-action.hoon | 5 +++++ pkg/arvo/mar/permission/initial.hoon | 2 ++ pkg/arvo/mar/permission/update.hoon | 2 ++ pkg/arvo/mar/publish/action.hoon | 2 ++ pkg/arvo/mar/publish/notebook-delta.hoon | 5 +++++ pkg/arvo/mar/publish/primary-delta.hoon | 2 ++ pkg/arvo/mar/purl.hoon | 8 ++++++-- pkg/arvo/mar/snip.hoon | 1 + pkg/arvo/mar/sole/action.hoon | 5 +++++ pkg/arvo/mar/sole/effect.hoon | 2 ++ pkg/arvo/mar/tang.hoon | 3 ++- pkg/arvo/mar/txt-diff.hoon | 5 +++++ pkg/arvo/mar/urb.hoon | 1 + pkg/arvo/mar/urbit.hoon | 5 +++++ pkg/arvo/mar/x-htm.hoon | 1 + pkg/arvo/mar/x-htm/elem.hoon | 12 ++++++++++-- pkg/arvo/mar/xml.hoon | 1 + 67 files changed, 226 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/mar/acme/order.hoon b/pkg/arvo/mar/acme/order.hoon index a43c30cc6..17a9a01b2 100644 --- a/pkg/arvo/mar/acme/order.hoon +++ b/pkg/arvo/mar/acme/order.hoon @@ -2,6 +2,11 @@ :::: /mar/acme/order/hoon :: |_ a=(set (list @t)) +++ grad %noun +++ grow + |% + ++ noun a + -- ++ grab |% ++ noun (set (list @t)) diff --git a/pkg/arvo/mar/azimuth/update.hoon b/pkg/arvo/mar/azimuth/update.hoon index 45b0e6727..580a8d761 100644 --- a/pkg/arvo/mar/azimuth/update.hoon +++ b/pkg/arvo/mar/azimuth/update.hoon @@ -1,6 +1,11 @@ :: |_ upd=update:azimuth :: +++ grad %noun +++ grow + |% + ++ noun upd + -- ++ grab :: convert from |% ++ noun update:azimuth :: from %noun diff --git a/pkg/arvo/mar/chat/action.hoon b/pkg/arvo/mar/chat/action.hoon index 7d1b7a985..a4353ad5c 100644 --- a/pkg/arvo/mar/chat/action.hoon +++ b/pkg/arvo/mar/chat/action.hoon @@ -1,6 +1,11 @@ /+ *chat-json =, dejs:format |_ act=chat-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun chat-action diff --git a/pkg/arvo/mar/chat/config.hoon b/pkg/arvo/mar/chat/config.hoon index 3ee5c1cd1..9b26bfc54 100644 --- a/pkg/arvo/mar/chat/config.hoon +++ b/pkg/arvo/mar/chat/config.hoon @@ -1,8 +1,10 @@ /+ *chat-json |_ cfg=config :: +++ grad %noun ++ grow |% + ++ noun cfg ++ json (conf cfg) -- :: diff --git a/pkg/arvo/mar/chat/configs.hoon b/pkg/arvo/mar/chat/configs.hoon index aaf682e9a..f4d56ac64 100644 --- a/pkg/arvo/mar/chat/configs.hoon +++ b/pkg/arvo/mar/chat/configs.hoon @@ -1,8 +1,10 @@ /+ *chat-json |_ cfg=(map path config) :: +++ grad %noun ++ grow |% + ++ noun cfg ++ json (configs-to-json cfg) -- :: diff --git a/pkg/arvo/mar/chat/hook-action.hoon b/pkg/arvo/mar/chat/hook-action.hoon index 77e5b247b..59e4c0516 100644 --- a/pkg/arvo/mar/chat/hook-action.hoon +++ b/pkg/arvo/mar/chat/hook-action.hoon @@ -1,5 +1,10 @@ /+ *chat-json |_ act=chat-hook-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun chat-hook-action diff --git a/pkg/arvo/mar/chat/hook-update.hoon b/pkg/arvo/mar/chat/hook-update.hoon index 71d117ee4..57ee6f8e2 100644 --- a/pkg/arvo/mar/chat/hook-update.hoon +++ b/pkg/arvo/mar/chat/hook-update.hoon @@ -1,7 +1,9 @@ /+ *chat-json |_ upd=chat-hook-update +++ grad %noun ++ grow |% + ++ noun upd ++ json (hook-update-to-json upd) -- :: diff --git a/pkg/arvo/mar/chat/initial.hoon b/pkg/arvo/mar/chat/initial.hoon index d19b0884f..96dc7cba5 100644 --- a/pkg/arvo/mar/chat/initial.hoon +++ b/pkg/arvo/mar/chat/initial.hoon @@ -1,8 +1,10 @@ /+ *chat-json |_ box=inbox :: +++ grad %noun ++ grow |% + ++ noun box ++ json (inbox-to-json box) -- :: diff --git a/pkg/arvo/mar/chat/update.hoon b/pkg/arvo/mar/chat/update.hoon index 9a6a3d49f..197b26503 100644 --- a/pkg/arvo/mar/chat/update.hoon +++ b/pkg/arvo/mar/chat/update.hoon @@ -1,7 +1,9 @@ /+ *chat-json |_ upd=chat-update +++ grad %noun ++ grow |% + ++ noun upd ++ json (update-to-json upd) -- :: diff --git a/pkg/arvo/mar/chat/view-action.hoon b/pkg/arvo/mar/chat/view-action.hoon index a87889eda..0c20509eb 100644 --- a/pkg/arvo/mar/chat/view-action.hoon +++ b/pkg/arvo/mar/chat/view-action.hoon @@ -1,6 +1,11 @@ /+ *chat-json =, dejs:format |_ act=chat-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun chat-view-action diff --git a/pkg/arvo/mar/contact/action.hoon b/pkg/arvo/mar/contact/action.hoon index c280b6e13..a756fb810 100644 --- a/pkg/arvo/mar/contact/action.hoon +++ b/pkg/arvo/mar/contact/action.hoon @@ -1,5 +1,10 @@ /+ *contact-json |_ act=contact-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun contact-action diff --git a/pkg/arvo/mar/contact/initial.hoon b/pkg/arvo/mar/contact/initial.hoon index 837a105a5..0bf1d3e8d 100644 --- a/pkg/arvo/mar/contact/initial.hoon +++ b/pkg/arvo/mar/contact/initial.hoon @@ -1,8 +1,10 @@ /+ *contact-json |_ rolo=rolodex :: +++ grad %noun ++ grow |% + ++ noun +<.grow ++ json (rolodex-to-json rolo) -- :: diff --git a/pkg/arvo/mar/contact/update.hoon b/pkg/arvo/mar/contact/update.hoon index b53a54f99..75e593125 100644 --- a/pkg/arvo/mar/contact/update.hoon +++ b/pkg/arvo/mar/contact/update.hoon @@ -1,7 +1,9 @@ /+ *contact-json |_ upd=contact-update +++ grad %noun ++ grow |% + ++ noun upd ++ json (update-to-json upd) -- :: diff --git a/pkg/arvo/mar/dill/belt.hoon b/pkg/arvo/mar/dill/belt.hoon index 36493d256..05a2ddb9d 100644 --- a/pkg/arvo/mar/dill/belt.hoon +++ b/pkg/arvo/mar/dill/belt.hoon @@ -9,6 +9,11 @@ =, sole |_ dill-belt:dill :: +++ grad %noun +++ grow + |% + ++ noun +<.grow + -- ++ grab :: convert from |% ++ json diff --git a/pkg/arvo/mar/dill/blit.hoon b/pkg/arvo/mar/dill/blit.hoon index 699f5906e..2dc0acd7a 100644 --- a/pkg/arvo/mar/dill/blit.hoon +++ b/pkg/arvo/mar/dill/blit.hoon @@ -6,6 +6,7 @@ =, sole =, enjs:format |_ dib/dill-blit:dill +++ grad %noun :: ++ grab :: convert from |% @@ -13,6 +14,7 @@ -- ++ grow |% + ++ noun dib ++ json ^- ^json ?+ -.dib ~|(unsupported-blit+-.dib !!) diff --git a/pkg/arvo/mar/dns/address.hoon b/pkg/arvo/mar/dns/address.hoon index 51fc29ad8..c8e709f13 100644 --- a/pkg/arvo/mar/dns/address.hoon +++ b/pkg/arvo/mar/dns/address.hoon @@ -1,5 +1,10 @@ /- *dns |_ address +++ grad %noun +++ grow + |% + ++ noun +<.grow + -- ++ grab |% ++ noun address diff --git a/pkg/arvo/mar/dns/binding.hoon b/pkg/arvo/mar/dns/binding.hoon index ec9f5b66e..6f10d17f5 100644 --- a/pkg/arvo/mar/dns/binding.hoon +++ b/pkg/arvo/mar/dns/binding.hoon @@ -1,5 +1,10 @@ /- *dns |_ binding +++ grad %noun +++ grow + |% + ++ noun +<.grow + -- ++ grab |% ++ noun binding diff --git a/pkg/arvo/mar/dns/complete.hoon b/pkg/arvo/mar/dns/complete.hoon index 9b22572bc..cbe67c6f0 100644 --- a/pkg/arvo/mar/dns/complete.hoon +++ b/pkg/arvo/mar/dns/complete.hoon @@ -1,5 +1,10 @@ /- *dns |_ [ship binding] +++ grad %noun +++ grow + |% + ++ noun +<.grow + -- ++ grab |% +$ noun [ship binding] diff --git a/pkg/arvo/mar/drum-put.hoon b/pkg/arvo/mar/drum-put.hoon index d1dc4b86a..956c3f4b1 100644 --- a/pkg/arvo/mar/drum-put.hoon +++ b/pkg/arvo/mar/drum-put.hoon @@ -4,6 +4,11 @@ /? 310 |_ {path @} :: +++ grad %noun +++ grow + |% + ++ noun +<.grow + -- ++ grab :: convert from |% ++ noun {path @} :: clam from %noun diff --git a/pkg/arvo/mar/elem.hoon b/pkg/arvo/mar/elem.hoon index eccb4a580..b8fb3a7fd 100644 --- a/pkg/arvo/mar/elem.hoon +++ b/pkg/arvo/mar/elem.hoon @@ -6,13 +6,13 @@ =, html |_ own/manx :: +++ grad %mime ++ grow :: convert to |% ++ hymn ;html:(head body:"+{own}") :: convert to %hymn ++ html (crip (en-xml hymn)) :: convert to %html ++ mime [/text/html (as-octs html)] :: convert to %mime -- -++ garb /snip :: grabbed by ++ grab |% :: convert from ++ noun manx :: clam from %noun -- -- diff --git a/pkg/arvo/mar/eth-watcher-poke.hoon b/pkg/arvo/mar/eth-watcher-poke.hoon index b1658d2c1..798acc4b4 100644 --- a/pkg/arvo/mar/eth-watcher-poke.hoon +++ b/pkg/arvo/mar/eth-watcher-poke.hoon @@ -1,5 +1,10 @@ /- *eth-watcher |_ poke +++ grad %noun +++ grow + |% + ++ noun +<.grow + -- ++ grab |% ++ noun poke diff --git a/pkg/arvo/mar/front.hoon b/pkg/arvo/mar/front.hoon index 1a636649f..c0e61be06 100644 --- a/pkg/arvo/mar/front.hoon +++ b/pkg/arvo/mar/front.hoon @@ -7,8 +7,10 @@ :: |_ all/(map knot cord) :: +++ grad %noun ++ grow :: convert to |% + ++ noun all ++ json :- %o %- ~(run by all) diff --git a/pkg/arvo/mar/group/action.hoon b/pkg/arvo/mar/group/action.hoon index 1534ff941..b351bd7c8 100644 --- a/pkg/arvo/mar/group/action.hoon +++ b/pkg/arvo/mar/group/action.hoon @@ -1,6 +1,11 @@ /+ *group-json =, dejs:format |_ act=group-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun group-action diff --git a/pkg/arvo/mar/group/hook-action.hoon b/pkg/arvo/mar/group/hook-action.hoon index d5c0892a6..8a5a250e8 100644 --- a/pkg/arvo/mar/group/hook-action.hoon +++ b/pkg/arvo/mar/group/hook-action.hoon @@ -1,6 +1,11 @@ /- *group-hook =, dejs:format |_ act=group-hook-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun group-hook-action diff --git a/pkg/arvo/mar/group/initial.hoon b/pkg/arvo/mar/group/initial.hoon index 947ba554c..154693650 100644 --- a/pkg/arvo/mar/group/initial.hoon +++ b/pkg/arvo/mar/group/initial.hoon @@ -1,8 +1,10 @@ /+ *group-json |_ grp=groups :: +++ grad %noun ++ grow |% + ++ noun grp ++ json (groups-to-json grp) -- :: diff --git a/pkg/arvo/mar/group/update.hoon b/pkg/arvo/mar/group/update.hoon index 43bdb20a2..e3ee09454 100644 --- a/pkg/arvo/mar/group/update.hoon +++ b/pkg/arvo/mar/group/update.hoon @@ -1,11 +1,13 @@ /+ *group-json |_ upd=group-update +++ grad %noun ++ grab |% ++ noun group-update -- ++ grow |% + ++ noun upd ++ json =, enjs:format ^- ^json diff --git a/pkg/arvo/mar/helm-hi.hoon b/pkg/arvo/mar/helm-hi.hoon index 345fdcd31..940c91cfe 100644 --- a/pkg/arvo/mar/helm-hi.hoon +++ b/pkg/arvo/mar/helm-hi.hoon @@ -6,6 +6,7 @@ =, format |_ txt/cord :: +++ grad %mime ++ grab :: convert from |% ++ noun @t :: clam from %noun diff --git a/pkg/arvo/mar/htm.hoon b/pkg/arvo/mar/htm.hoon index 80f4f6bf1..4816236e3 100644 --- a/pkg/arvo/mar/htm.hoon +++ b/pkg/arvo/mar/htm.hoon @@ -4,6 +4,7 @@ /? 310 |_ own/manx :: +++ grad %noun ++ grow :: convert to |% ++ hymn own diff --git a/pkg/arvo/mar/httr.hoon b/pkg/arvo/mar/httr.hoon index 2a54a26a7..f9ae1fb0a 100644 --- a/pkg/arvo/mar/httr.hoon +++ b/pkg/arvo/mar/httr.hoon @@ -7,10 +7,12 @@ =, format =, html |_ hit/httr +++ grad %noun ++ grow |% ++ wall (turn wain trip) ++ wain (to-wain cord) ++ json (need (de-json cord)) ++ cord q:octs + ++ noun hit ++ octs ~| hit ?> =(2 (div p.hit 100)) diff --git a/pkg/arvo/mar/hymn.hoon b/pkg/arvo/mar/hymn.hoon index 50005b6f5..a56e3a0cf 100644 --- a/pkg/arvo/mar/hymn.hoon +++ b/pkg/arvo/mar/hymn.hoon @@ -6,6 +6,7 @@ =, html |_ own/manx :: +++ grad %mime ++ grow :: convert to |% ++ html (crip (en-xml own)) :: convert to %html diff --git a/pkg/arvo/mar/invite/action.hoon b/pkg/arvo/mar/invite/action.hoon index 5265671c2..a0baf8b6d 100644 --- a/pkg/arvo/mar/invite/action.hoon +++ b/pkg/arvo/mar/invite/action.hoon @@ -1,6 +1,11 @@ /+ *invite-json =, dejs:format |_ act=invite-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun invite-action diff --git a/pkg/arvo/mar/invite/initial.hoon b/pkg/arvo/mar/invite/initial.hoon index a9cdab6c0..8b9b4ec01 100644 --- a/pkg/arvo/mar/invite/initial.hoon +++ b/pkg/arvo/mar/invite/initial.hoon @@ -1,8 +1,10 @@ /+ *invite-json |_ inv=invites :: +++ grad %noun ++ grow |% + ++ noun inv ++ json (invites-to-json inv) -- :: diff --git a/pkg/arvo/mar/invite/update.hoon b/pkg/arvo/mar/invite/update.hoon index 7ee747de9..534e304d8 100644 --- a/pkg/arvo/mar/invite/update.hoon +++ b/pkg/arvo/mar/invite/update.hoon @@ -1,7 +1,9 @@ /+ *invite-json |_ upd=invite-update +++ grad %noun ++ grow |% + ++ noun upd ++ json (update-to-json upd) -- :: diff --git a/pkg/arvo/mar/json/rpc/response.hoon b/pkg/arvo/mar/json/rpc/response.hoon index 17134ffdb..9f91469d0 100644 --- a/pkg/arvo/mar/json/rpc/response.hoon +++ b/pkg/arvo/mar/json/rpc/response.hoon @@ -3,6 +3,11 @@ :: |_ res=response :: +++ grad %noun +++ grow + |% + ++ noun res + -- ++ grab :: convert from |% ++ noun response :: from noun diff --git a/pkg/arvo/mar/language-server/rpc/notification.hoon b/pkg/arvo/mar/language-server/rpc/notification.hoon index 9f47189db..88fdaa8c1 100644 --- a/pkg/arvo/mar/language-server/rpc/notification.hoon +++ b/pkg/arvo/mar/language-server/rpc/notification.hoon @@ -1,6 +1,7 @@ /- *language-server /+ lsp-json=language-server-json |_ not=all:notification +++ grad %noun ++ grab |% ++ noun not @@ -10,6 +11,7 @@ -- ++ grow |% + ++ noun not ++ json (notification:enjs:lsp-json not) -- diff --git a/pkg/arvo/mar/language-server/rpc/request.hoon b/pkg/arvo/mar/language-server/rpc/request.hoon index 80efda887..48db6b7ea 100644 --- a/pkg/arvo/mar/language-server/rpc/request.hoon +++ b/pkg/arvo/mar/language-server/rpc/request.hoon @@ -1,6 +1,11 @@ /- *language-server /+ lsp-json=language-server-json |_ req=all:request +++ grad %noun +++ grow + |% + ++ noun req + -- ++ grab |% ++ noun req diff --git a/pkg/arvo/mar/language-server/rpc/response.hoon b/pkg/arvo/mar/language-server/rpc/response.hoon index c2390e875..f82408b87 100644 --- a/pkg/arvo/mar/language-server/rpc/response.hoon +++ b/pkg/arvo/mar/language-server/rpc/response.hoon @@ -2,8 +2,10 @@ /+ lsp=language-server-json |_ res=all:response :: +++ grad %noun ++ grow |% + ++ noun res ++ json (response:enjs:lsp res) -- :: diff --git a/pkg/arvo/mar/launch/action.hoon b/pkg/arvo/mar/launch/action.hoon index cfa0d8cb0..83609921a 100644 --- a/pkg/arvo/mar/launch/action.hoon +++ b/pkg/arvo/mar/launch/action.hoon @@ -2,6 +2,11 @@ :: |_ act=action:launch :: +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun action:launch diff --git a/pkg/arvo/mar/lens/command.hoon b/pkg/arvo/mar/lens/command.hoon index 908078027..b8f0532f2 100644 --- a/pkg/arvo/mar/lens/command.hoon +++ b/pkg/arvo/mar/lens/command.hoon @@ -1,5 +1,10 @@ /- lens |_ com/command:lens +++ grad %noun +++ grow + |% + ++ noun com + -- ++ grab |% ++ noun command:lens diff --git a/pkg/arvo/mar/link/action.hoon b/pkg/arvo/mar/link/action.hoon index 608d4c475..9143a97f7 100644 --- a/pkg/arvo/mar/link/action.hoon +++ b/pkg/arvo/mar/link/action.hoon @@ -3,6 +3,7 @@ ::TODO this should include json conversion once mark performance improves /+ *link |_ =action +++ grad %noun ++ grow |% ++ noun action diff --git a/pkg/arvo/mar/link/initial.hoon b/pkg/arvo/mar/link/initial.hoon index ad73c1667..8db29a858 100644 --- a/pkg/arvo/mar/link/initial.hoon +++ b/pkg/arvo/mar/link/initial.hoon @@ -2,6 +2,7 @@ :: /- *link |_ =initial +++ grad %noun ++ grow |% ++ noun initial diff --git a/pkg/arvo/mar/link/listen-poke.hoon b/pkg/arvo/mar/link/listen-poke.hoon index b7ece7a38..14e44e8c1 100644 --- a/pkg/arvo/mar/link/listen-poke.hoon +++ b/pkg/arvo/mar/link/listen-poke.hoon @@ -1,6 +1,7 @@ :: link-listen-poke: prod another listener into paying attention :: |_ =path +++ grad %noun ++ grow |% ++ noun path diff --git a/pkg/arvo/mar/link/update.hoon b/pkg/arvo/mar/link/update.hoon index f48600d77..963f23414 100644 --- a/pkg/arvo/mar/link/update.hoon +++ b/pkg/arvo/mar/link/update.hoon @@ -2,6 +2,7 @@ :: /- *link |_ =update +++ grad %noun ++ grow |% ++ noun update diff --git a/pkg/arvo/mar/link/view-action.hoon b/pkg/arvo/mar/link/view-action.hoon index f32241a34..c17d5e875 100644 --- a/pkg/arvo/mar/link/view-action.hoon +++ b/pkg/arvo/mar/link/view-action.hoon @@ -1,6 +1,11 @@ /- *link-view =, dejs:format |_ act=view-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun view-action @@ -34,9 +39,4 @@ (cu sy (ar (su ;~(pfix sig fed:ag)))) -- -- -:: -++ grow - |% - ++ noun act - -- -- diff --git a/pkg/arvo/mar/metadata/action.hoon b/pkg/arvo/mar/metadata/action.hoon index 396979bf4..e7a7668e1 100644 --- a/pkg/arvo/mar/metadata/action.hoon +++ b/pkg/arvo/mar/metadata/action.hoon @@ -1,6 +1,11 @@ /+ *metadata-json =, dejs:format |_ act=metadata-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun metadata-action diff --git a/pkg/arvo/mar/metadata/update.hoon b/pkg/arvo/mar/metadata/update.hoon index 653ea91a1..aed47bd2d 100644 --- a/pkg/arvo/mar/metadata/update.hoon +++ b/pkg/arvo/mar/metadata/update.hoon @@ -1,7 +1,9 @@ /+ *metadata-json |_ upd=metadata-update +++ grad %noun ++ grow |% + ++ noun upd ++ json (update-to-json upd) -- :: diff --git a/pkg/arvo/mar/noun.hoon b/pkg/arvo/mar/noun.hoon index e80ac367b..906ab5432 100644 --- a/pkg/arvo/mar/noun.hoon +++ b/pkg/arvo/mar/noun.hoon @@ -8,4 +8,11 @@ ++ grab |% ++ noun * -- +++ grad + |% + ++ form %noun + ++ diff |=(* +<) + ++ pact |=(* +<) + ++ join |=([* *] *(unit *)) + -- -- diff --git a/pkg/arvo/mar/path.hoon b/pkg/arvo/mar/path.hoon index f9c4cac06..d3952babb 100644 --- a/pkg/arvo/mar/path.hoon +++ b/pkg/arvo/mar/path.hoon @@ -1,4 +1,9 @@ |_ pax/path +++ grad %noun +++ grow + |% + ++ noun pax + -- ++ grab |% ++ noun path diff --git a/pkg/arvo/mar/permission/action.hoon b/pkg/arvo/mar/permission/action.hoon index f316b3d71..a5670a551 100644 --- a/pkg/arvo/mar/permission/action.hoon +++ b/pkg/arvo/mar/permission/action.hoon @@ -1,6 +1,11 @@ /+ *permission-json =, dejs:format |_ act=permission-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun permission-action diff --git a/pkg/arvo/mar/permission/group-hook-action.hoon b/pkg/arvo/mar/permission/group-hook-action.hoon index e80a0e38f..f68dc793e 100644 --- a/pkg/arvo/mar/permission/group-hook-action.hoon +++ b/pkg/arvo/mar/permission/group-hook-action.hoon @@ -1,6 +1,11 @@ /- *permission-group-hook /+ *permission-json |_ act=permission-group-hook-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun permission-group-hook-action diff --git a/pkg/arvo/mar/permission/hook-action.hoon b/pkg/arvo/mar/permission/hook-action.hoon index 44df95f95..3706fee33 100644 --- a/pkg/arvo/mar/permission/hook-action.hoon +++ b/pkg/arvo/mar/permission/hook-action.hoon @@ -1,5 +1,10 @@ /- *permission-hook |_ act=permission-hook-action +++ grad %noun +++ grow + |% + ++ noun act + -- ++ grab |% ++ noun permission-hook-action diff --git a/pkg/arvo/mar/permission/initial.hoon b/pkg/arvo/mar/permission/initial.hoon index 212b05d39..545201f8c 100644 --- a/pkg/arvo/mar/permission/initial.hoon +++ b/pkg/arvo/mar/permission/initial.hoon @@ -1,8 +1,10 @@ /+ *permission-json |_ pem=permission-map :: +++ grad %noun ++ grow |% + ++ noun pem ++ json (permission-to-json pem) -- :: diff --git a/pkg/arvo/mar/permission/update.hoon b/pkg/arvo/mar/permission/update.hoon index 93ff85f59..10f49bfde 100644 --- a/pkg/arvo/mar/permission/update.hoon +++ b/pkg/arvo/mar/permission/update.hoon @@ -1,8 +1,10 @@ /+ *permission-json |_ upd=permission-update :: +++ grad %noun ++ grow |% + ++ noun upd ++ json =, enjs:format ^- ^json diff --git a/pkg/arvo/mar/publish/action.hoon b/pkg/arvo/mar/publish/action.hoon index 1e98af820..ce9b3c355 100644 --- a/pkg/arvo/mar/publish/action.hoon +++ b/pkg/arvo/mar/publish/action.hoon @@ -6,8 +6,10 @@ :: |_ act=action :: +++ grad %noun ++ grow |% + ++ noun act ++ tank >act< -- :: diff --git a/pkg/arvo/mar/publish/notebook-delta.hoon b/pkg/arvo/mar/publish/notebook-delta.hoon index 76d693efc..59c73a003 100644 --- a/pkg/arvo/mar/publish/notebook-delta.hoon +++ b/pkg/arvo/mar/publish/notebook-delta.hoon @@ -6,6 +6,11 @@ :: |_ del=notebook-delta :: +++ grad %noun +++ grow + |% + ++ noun del + -- ++ grab |% ++ noun notebook-delta diff --git a/pkg/arvo/mar/publish/primary-delta.hoon b/pkg/arvo/mar/publish/primary-delta.hoon index b0d45ef20..a0eb913b7 100644 --- a/pkg/arvo/mar/publish/primary-delta.hoon +++ b/pkg/arvo/mar/publish/primary-delta.hoon @@ -6,12 +6,14 @@ :: |_ del=primary-delta :: +++ grad %noun ++ grab |% ++ noun primary-delta -- ++ grow |% + ++ noun del ++ json %+ frond:enjs:format -.del ?- -.del diff --git a/pkg/arvo/mar/purl.hoon b/pkg/arvo/mar/purl.hoon index 72714c132..148ef1d74 100644 --- a/pkg/arvo/mar/purl.hoon +++ b/pkg/arvo/mar/purl.hoon @@ -4,9 +4,13 @@ /? 310 =, eyre |_ url/purl +++ grad %noun :: -++ grow |% ++ hiss [url %get ~ ~] - -- +++ grow + |% + ++ noun url + ++ hiss [url %get ~ ~] + -- ++ grab :: convert from |% ++ noun purl :: clam from %noun diff --git a/pkg/arvo/mar/snip.hoon b/pkg/arvo/mar/snip.hoon index 5f6cdf183..e6eb3225e 100644 --- a/pkg/arvo/mar/snip.hoon +++ b/pkg/arvo/mar/snip.hoon @@ -43,6 +43,7 @@ :: =, mimes:html |_ {hed/marl tal/marl} +++ grad %mime :: ++ grow :: convert to |% diff --git a/pkg/arvo/mar/sole/action.hoon b/pkg/arvo/mar/sole/action.hoon index ebde86216..58c87cbe7 100644 --- a/pkg/arvo/mar/sole/action.hoon +++ b/pkg/arvo/mar/sole/action.hoon @@ -9,6 +9,11 @@ =, sole |_ sole-action :: +++ grad %noun +++ grow + |% + ++ noun +<.grad + -- ++ grab :: convert from |% ++ json diff --git a/pkg/arvo/mar/sole/effect.hoon b/pkg/arvo/mar/sole/effect.hoon index 34bfee687..edf4f6457 100644 --- a/pkg/arvo/mar/sole/effect.hoon +++ b/pkg/arvo/mar/sole/effect.hoon @@ -43,6 +43,7 @@ :: |_ sef/sole-effect :: +++ grad %noun ++ grab :: convert from |% ++ noun sole-effect :: clam from %noun @@ -50,6 +51,7 @@ ++ grow =, enjs |% + ++ noun sef ++ json ^- ^json ?+ -.sef diff --git a/pkg/arvo/mar/tang.hoon b/pkg/arvo/mar/tang.hoon index 0fa3471a5..684751543 100644 --- a/pkg/arvo/mar/tang.hoon +++ b/pkg/arvo/mar/tang.hoon @@ -5,9 +5,10 @@ :: =, format |_ tan/(list tank) -:: +++ grad %noun ++ grow |% + ++ noun tan ++ elem =- ;pre:code:"{(of-wall -)}" ^- wall %- zing ^- (list wall) diff --git a/pkg/arvo/mar/txt-diff.hoon b/pkg/arvo/mar/txt-diff.hoon index e457594b0..5471acc16 100644 --- a/pkg/arvo/mar/txt-diff.hoon +++ b/pkg/arvo/mar/txt-diff.hoon @@ -4,6 +4,11 @@ /? 310 |_ txt-diff/(urge:clay cord) :: +++ grad %noun +++ grow + |% + ++ noun txt-diff + -- ++ grab :: convert from |% ++ noun (urge:clay cord) :: make from %noun diff --git a/pkg/arvo/mar/urb.hoon b/pkg/arvo/mar/urb.hoon index d1edbfb00..a579ee01f 100644 --- a/pkg/arvo/mar/urb.hoon +++ b/pkg/arvo/mar/urb.hoon @@ -6,6 +6,7 @@ =, html |_ own/manx :: +++ grad %mime ++ grow :: convert to |% ++ hymn ;html:(head body:"+{own}") :: convert to %hymn diff --git a/pkg/arvo/mar/urbit.hoon b/pkg/arvo/mar/urbit.hoon index 901d8807e..9b7bb4e1c 100644 --- a/pkg/arvo/mar/urbit.hoon +++ b/pkg/arvo/mar/urbit.hoon @@ -9,4 +9,9 @@ |% ++ noun @p -- +++ grow + |% + ++ noun her + -- +++ grad %noun -- diff --git a/pkg/arvo/mar/x-htm.hoon b/pkg/arvo/mar/x-htm.hoon index 0bdff8444..fbf289591 100644 --- a/pkg/arvo/mar/x-htm.hoon +++ b/pkg/arvo/mar/x-htm.hoon @@ -1,4 +1,5 @@ |_ a=manx +++ grad %noun ++ grab |% ++ noun manx diff --git a/pkg/arvo/mar/x-htm/elem.hoon b/pkg/arvo/mar/x-htm/elem.hoon index c0210fd11..93ff4dbdc 100644 --- a/pkg/arvo/mar/x-htm/elem.hoon +++ b/pkg/arvo/mar/x-htm/elem.hoon @@ -1,3 +1,11 @@ |_ a=manx -++ grab |% ++ noun manx --- -- +++ grad %noun +++ grab + |% + ++ noun manx + -- +++ grow + |% + ++ noun a + -- +-- diff --git a/pkg/arvo/mar/xml.hoon b/pkg/arvo/mar/xml.hoon index 26ed90e50..01ac140fb 100644 --- a/pkg/arvo/mar/xml.hoon +++ b/pkg/arvo/mar/xml.hoon @@ -9,6 +9,7 @@ =, html |_ xml/@t :: +++ grad %mime ++ grow :: convert to |% :: ++ mime [/application/xml (as-octs xml)] :: to %mime From 8fc787b0ca1a57abc8dc8ab8a8c8cdf162b030ed Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 5 May 2020 01:28:37 -0400 Subject: [PATCH 085/280] eyre: use ford-fusion; compiles, untested --- pkg/arvo/sys/vane/eyre.hoon | 144 +++++++++++------------------------- 1 file changed, 44 insertions(+), 100 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index c23727521..2dba8b927 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -19,7 +19,7 @@ :: card=(wind note gift:able) == -:: +note: private request from http-server to another vane +:: +note: private request from eyre to another vane :: +$ note $% :: %b: to behn @@ -37,14 +37,6 @@ :: $% [%flog =flog:dill] == == - :: %f: to ford - :: - $: %f - :: - :: - $% [%build live=? schematic=schematic:ford] - [%kill ~] - == == :: %g: to gall :: $: %g @@ -52,7 +44,7 @@ :: $>(%deal task:able:gall) == == -:: +sign: private response from another vane to ford +:: +sign: private response from another vane to eyre :: +$ sign $% :: %b: from behn @@ -62,13 +54,6 @@ :: $% [%wake error=(unit tang)] == == - :: %f: from ford - :: - $: %f - :: - :: - $% [%made date=@da result=made-result:ford] - == == :: %g: from gall :: $: %g @@ -127,7 +112,7 @@ :: +outstanding-connection: open http connections not fully complete: :: :: This refers to outstanding connections where the connection to -:: outside is opened and we are currently waiting on ford or an app to +:: outside is opened and we are currently waiting on an app to :: produce the results. :: +$ outstanding-connection @@ -932,19 +917,48 @@ (~(put by connections.state) duct connection) :: ?- -.action - :: %gen + =/ bek=beak [our desk.generator.action da+now] + =/ sup=spur (flop path.generator.action) + =/ ski (scry [%141 %noun] ~ %ca bek sup) + =/ gat=vase !<(vase q:(need (need ski))) + =/ res=(each vase tang) + %- mule |. + %+ slam + %+ slam gat + !>([now=now eny=eny bek=bek]) + !>([authenticated request]) + ?: ?=(%| -.res) + =+ connection=(~(got by connections.state) duct) + %^ return-static-data-on-duct 500 'text/html' + %: internal-server-error + authenticated.inbound-request.connection + url.request.inbound-request.connection + p.res + == + =/ result !<(simple-payload:http p.res) + :: ensure we have a valid content-length header :: - =- [[duct %pass /run-build %f %build live=%.n schematic=-]~ state] + :: We pass on the response and the headers the generator produces, but + :: ensure that we have a single content-length header set correctly in + :: the returned if this has a body, and has no content-length if there + :: is no body returned to the client. :: - :+ %call - :+ %call - [%core [[our desk.generator.action] (flop path.generator.action)]] - :: TODO: Figure out what goes in generators. We need to slop the - :: prelude with the arguments passed in. + =. headers.response-header.result + ?~ data.result + (delete-header:http 'content-length' headers.response-header.result) :: - [%$ %noun !>([[now=now eny=eny bek=[our desk.generator.action [%da now]]] ~ ~])] - [%$ %noun !>([authenticated request])] + %^ set-header:http 'content-length' + (crip (format-ud-as-integer p.u.data.result)) + headers.response-header.result + :: + %- handle-response + ^- http-event:http + :* %start + response-header.result + data.result + complete=%.y + == :: %app :_ state @@ -989,11 +1003,7 @@ =. connections.state (~(del by connections.state) duct) :: ?- -.action.u.connection - :: - %gen - :_ state - [duct %pass /run-build %f %kill ~]~ - :: + %gen [~ state] %app :_ state :_ ~ @@ -1002,12 +1012,8 @@ %leave ~ == :: - %authentication - [~ state] - :: - %channel - on-cancel-request:by-channel - :: + %authentication [~ state] + %channel on-cancel-request:by-channel %four-oh-four :: it should be impossible for a 404 page to be asynchronous :: @@ -1761,58 +1767,6 @@ :: [duc %pass channel-wire [%g %deal [our ship] app %leave ~]] -- - :: +handle-ford-response: translates a ford response for the outside world - :: - ++ handle-ford-response - |= made-result=made-result:ford - ^- [(list move) server-state] - :: - =+ connection=(~(got by connections.state) duct) - :: - ?: ?=(%incomplete -.made-result) - %^ return-static-data-on-duct 500 'text/html' - :: - %- internal-server-error :* - authenticated.inbound-request.connection - url.request.inbound-request.connection - tang.made-result - == - :: - ?: ?=(%error -.build-result.made-result) - %^ return-static-data-on-duct 500 'text/html' - :: - %- internal-server-error :* - authenticated.inbound-request.connection - url.request.inbound-request.connection - message.build-result.made-result - == - :: - =/ =cage (result-to-cage:ford build-result.made-result) - :: - =/ result=simple-payload:http ;;(simple-payload:http q.q.cage) - :: ensure we have a valid content-length header - :: - :: We pass on the response and the headers the generator produces, but - :: ensure that we have a single content-length header set correctly in - :: the returned if this has a body, and has no content-length if there - :: is no body returned to the client. - :: - =. headers.response-header.result - ?~ data.result - (delete-header:http 'content-length' headers.response-header.result) - :: - %^ set-header:http 'content-length' - (crip (format-ud-as-integer p.u.data.result)) - headers.response-header.result - :: - %- handle-response - :: - ^- http-event:http - :* %start - response-header.result - data.result - complete=%.y - == :: +handle-gall-error: a call to +poke-http-response resulted in a %coup :: ++ handle-gall-error @@ -2274,7 +2228,6 @@ :: %run-app-request run-app-request %watch-response watch-response - %run-build run-build %channel channel %acme acme-ack == @@ -2344,15 +2297,6 @@ (handle-response http-event) [moves http-server-gate] :: - ++ run-build - :: - ?> ?=([%f %made *] sign) - :: - =/ event-args [[our eny duct now scry-gate] server-state.ax] - =/ handle-ford-response handle-ford-response:(per-server-event event-args) - =^ moves server-state.ax (handle-ford-response result.sign) - [moves http-server-gate] - :: ++ channel :: =/ event-args [[our eny duct now scry-gate] server-state.ax] From 58d3820e413b08482f9ce23713c2c6f9b2b5539e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 5 May 2020 02:31:35 -0400 Subject: [PATCH 086/280] clay: track /{mar,lib,sur} dependencies properly --- pkg/arvo/sys/vane/clay.hoon | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 9c1368f25..212c6f383 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3621,10 +3621,30 @@ :: :: Keep any parts of the ford cache whose dependencies didn't change :: + :: Make sure to invalidate any paths whose '-'s or '/'s could be + :: converted in an import; i.e. /mar, /lib, and /sur hoon files. + :: ++ promote-ford |= [=ford-cache deletes=(set path) changes=(set path)] ^+ ford-cache =/ invalid=(set path) (~(uni in deletes) changes) + =. invalid + %- ~(gas in invalid) + %- zing + %+ turn ~(tap in invalid) + |= pax=path + ^- (list path) + =/ xap=path (flop pax) + ?. &(=(%hoon (head xap)) ?=([?(%mar %sur %lib) @ @ *] pax)) + ~ + =- (turn - |=(suf=path [i.pax (snoc suf %hoon)])) + %- segments + %- crip + =/ xup (tail xap) :: lose %hoon extension + =/ pux (tail (flop xup)) :: lose static prefix + %+ turn (tail (spud pux)) :: lose leading '/' + |=(c=@tD `@tD`?:(=('/' c) '-' c)) :: convert '/' to '-' + :: :* ((invalidate path vase) vases.ford-cache invalid) ((invalidate mark dais) marks.ford-cache invalid) ((invalidate mars tube) casts.ford-cache invalid) From 3ad411646b5d5d76b0464f90aaab2ed4cc45eb6c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 5 May 2020 18:24:16 -0400 Subject: [PATCH 087/280] clay: fix %sole-effect->%json conversion --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/clay.hoon | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 378cfdfe5..2e7ab4b67 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:880523cb6208ad651d2fcef792c2b43e9dbf2d8721f9e3cafdf81be120e78c33 -size 13150614 +oid sha256:35f37d5c98a4f7b81e633179d27d458ed5b09a106d45ef4581f4e982923bb02b +size 13198731 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 212c6f383..37a8a553d 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2883,11 +2883,16 @@ =^ top stack.nub pop-stack =. casts.cache.nub (~(put by casts.cache.nub) [a b] [tube.res top]) [tube.res nub] - :: try +grow + :: try +grow; is there a +grow core with a .b arm? :: =^ old=vase nub (build-fit %mar a) - =/ row (mule |.((slap old (ream (cat 3 b ':grow'))))) - ?: ?=(%& -.row) + ?: =/ ram (mule |.((slap old ^~((ream 'grow'))))) + ?: ?=(%| -.ram) %.n + =/ lab (mule |.((slab b p.p.ram))) + ?: ?=(%| -.lab) %.n + p.lab + :: +grow core has .b arm; use that + :: :_ nub ^- tube |= sam=vase From 339e4e34ced46646efe0a986b5817ec416e750fb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 6 May 2020 01:09:35 -0400 Subject: [PATCH 088/280] clay: fix %mime->%html mark conversion --- pkg/arvo/mar/html.hoon | 6 ++++-- pkg/arvo/mar/mime.hoon | 3 +++ pkg/arvo/sys/vane/clay.hoon | 9 +++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/mar/html.hoon b/pkg/arvo/mar/html.hoon index e2a7af113..c6aeef3bc 100644 --- a/pkg/arvo/mar/html.hoon +++ b/pkg/arvo/mar/html.hoon @@ -6,14 +6,16 @@ :::: compute :: =, html +^| |_ htm/@t -:: ++ grow :: convert to + ^? |% :: ++ mime [/text/html (met 3 htm) htm] :: to %mime ++ hymn (need (de-xml htm)) :: to %hymn -- :: -++ grab |% :: convert from +++ grab ^? + |% :: convert from ++ noun @t :: clam from %noun ++ mime |=({p/mite q/octs} q.q) :: retrieve form $mime -- diff --git a/pkg/arvo/mar/mime.hoon b/pkg/arvo/mar/mime.hoon index 7ca373bce..f5b1850a0 100644 --- a/pkg/arvo/mar/mime.hoon +++ b/pkg/arvo/mar/mime.hoon @@ -3,6 +3,7 @@ :: /? 310 :: +^| |_ own/mime ++ grow ^? @@ -11,12 +12,14 @@ -- :: ++ grab :: convert from + ^? |% +$ noun mime :: clam from %noun ++ tape |=(a/_"" [/application/x-urb-unknown (as-octt:mimes:html a)]) -- ++ grad + ^? |% ++ form %mime ++ diff |=(mime +<) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 37a8a553d..35f20239f 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2888,7 +2888,7 @@ =^ old=vase nub (build-fit %mar a) ?: =/ ram (mule |.((slap old ^~((ream 'grow'))))) ?: ?=(%| -.ram) %.n - =/ lab (mule |.((slab b p.p.ram))) + =/ lab (mule |.((slob b p.p.ram))) ?: ?=(%| -.lab) %.n p.lab :: +grow core has .b arm; use that @@ -2900,7 +2900,12 @@ %+ slap (with-faces old+old sam+sam ~) %- ream - :((cury cat 3) '!: ~! old=old ~! sam=sam ' b ':~(grow old sam)') + ;: (cury cat 3) + '!: ' + '~! old=old ' + '~! sam=sam ' + b ':~(grow old sam)' + == :: try direct +grab :: =^ new=vase nub (build-fit %mar b) From ea75255290e2c9d6b5930be57b3c14c790fc1e70 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 6 May 2020 09:02:11 -0400 Subject: [PATCH 089/280] arvo: synchronous updates compile; untested --- pkg/arvo/sys/arvo.hoon | 415 +++++++++++++++++++---------------------- 1 file changed, 192 insertions(+), 223 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 20b5147ce..43e3e5466 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -532,22 +532,26 @@ => |% :: $germ: worklist source and bar stack :: $plan: worklist + :: $debt: in-progress state :: +$ germ [vane=term bars=(list duct)] +$ plan (pair germ (list move)) + +$ debt + $: :: run: list of worklists + :: out: pending output + :: gem: worklist metadata + :: dud: propagate error + :: + run=(list plan) + out=(list ovum) + gem=germ + dud=(unit goof) + == -- :: ~% %le +>+> ~ - =| $: :: run: list of worklists - :: out: pending output - :: gem: worklist metadata - :: dud: propagate error - :: - run=(list plan) - out=(list ovum) - gem=germ - dud=(unit goof) - == + =| debt + =* nub - :: |_ $: our=ship now=@da @@ -557,13 +561,27 @@ van=(map term vane) == +* this . + ++ abed |=(nib=debt this(nub nib)) :: +abet: finalize loop :: + :: .ovo: optional effect to arvo itself + :: + :: If ovo is ~, the loop is over; produce ova. + :: Else, produce u.ovo and the unfinished .nub internal state. + :: ++ abet - ^- (pair (list ovum) (list (pair term vane))) - :- (flop out) - %+ sort - ~(tap by van) + |= ovo=(unit ovum) + ^- $: %+ each (list ovum) + $: fec=ovum + nub=debt + == + van=(list (pair term vane)) + == + :- ?~ ovo + &+(flop out) + |+[u.ovo nub] + :: + %+ sort ~(tap by van) |=([[a=@tas *] [b=@tas *]] (aor a b)) :: +emit: enqueue a worklist with source :: @@ -621,20 +639,24 @@ :: +loop: until done :: ++ loop - ^+ this + ^- abet ?~ run - this + (abet ~) ?: =(~ q.i.run) :: XX TMI loop(run t.run) =. dud ~ =. gem p.i.run - =^ mov q.i.run q.i.run - loop:(step mov) + =^ mov=move q.i.run q.i.run + => .(run `(list plan)`run) :: XX TMI + =^ ovo=(unit ovum) this (step mov) + ?~ ovo + loop + (abet `u.ovo) :: +step: advance the loop one step by routing a move :: ++ step |= =move - ^+ this + ^- [(unit ovum) _this] :: ~? &(!lac ?=(^ dud)) %goof :: @@ -660,7 +682,7 @@ :: :: cons source onto wire, and wire onto duct :: - (call [[vane.gem wire] duct] vane task) + `(call [[vane.gem wire] duct] vane task) :: :: %slip: lateral move :: @@ -673,7 +695,7 @@ :- (runt [(lent bars.gem) '|'] "") [%slip vane.gem (symp +>-.task) duct] :: - (call duct vane task) + `(call duct vane task) :: :: %give: return move :: @@ -707,7 +729,7 @@ (symp +>-.gift) duct.move :: - (take duct wire vane gift) + `(take duct wire vane gift) :: :: %hurl: action with error :: @@ -739,8 +761,11 @@ :: ++ xeno |= [=wire gift=maze] - ^+ this - this(out [[wire ;;(card q.p.gift)] out]) + ^- [(unit ovum) _this] + =/ ovo=ovum [wire ;;(card q.p.gift)] + ?: ?=(?(%lyra %veer %wack) -.card.ovo) + [`ovo this] + [~ this(out [ovo out])] :: +call: advance to target :: ++ call @@ -909,9 +934,9 @@ ++ peek |=(* ~) :: 46 :: ++ poke |= * :: 47 - ^- [(list ovum) *] + ^- [(list) *] => .(+< ;;([now=@da ovo=ovum] +<)) - ^- [(list ovum) *] + ^- [(list) *] =. +>.$ ?+ -.q.ovo :: ignore unrecognized @@ -928,8 +953,9 @@ ?^ who u.who =/ fip=ship (dec (bex 128)) - ~>(%slog.[0 leaf+"arvo: larval identity {(scow %p fip)}"] fip) - =. ..veer (veer our now q.ovo) + ~> %slog.[0 leaf+"arvo: larval identity {(scow %p fip)}"] + fip + =. soul (veer our now q.ovo) +>.$(bod ?^(bod bod `bud.^poke)) :: add entropy :: @@ -968,247 +994,188 @@ bud=vase :: %zuse vanes=(list [label=@tas =vane]) :: modules == :: -=< :: Arvo structural interface - :: - |% - ++ come |= [@ @ @ (list ovum) vise pone] :: 4 - ^- [(list ovum) _+>] - ~& %hoon-come - =^ rey +>+ (^come +<) - [rey +>.$] - :: - ++ load |= [@ @ @ (list ovum) vase pane] :: 10 - ^- [(list ovum) _+>] - ~& %hoon-load - =^ rey +>+ (^load +<) - [rey +>.$] - :: - ++ peek |= * :: 46 - =/ rob (^peek ;;([@da path] +<)) - ?~ rob ~ - ?~ u.rob ~ - [~ u.u.rob] - :: - ++ poke |= * :: 47 - => .(+< ;;([now=@da ovo=ovum] +<)) - =^ ova +>+.$ (^poke now ovo) - =| out=(list ovum) - |- ^- [(list ovum) *] - ?~ ova - [(flop out) +>.^$] - :: upgrade the kernel - :: - ?: ?=(%lyra -.q.i.ova) - %+ fall - (vega now t.ova ;;([@ @] +.q.i.ova)) - [~ +>.^$] - :: iterate over effects, handling those on arvo proper - :: and passing the rest through as output - :: - =^ vov +>+.^$ (feck now i.ova) - =? out ?=(^ vov) [+.vov out] - $(ova t.ova) - :: - ++ wish |=(* (^wish ;;(@ta +<))) :: 22 - -- -:: Arvo implementation core +:: produce an interface that vere understands +:: +=< arvo +:: soul: arvo implementation core :: |% -++ come :: load incompatible - |= [who=ship now=@da yen=@ ova=(list ovum) dub=vise nyf=pone] - ^+ [ova +>] - =/ fyn (turn nyf |=([a=@tas b=vise] [a (slim b)])) - (load who now yen ova (slim dub) fyn) +++ soul . +:: arvo: structural interface core :: -++ load :: load compatible - |= [who=ship now=@da yen=@ ova=(list ovum) dub=vase nyf=pane] - ^+ [ova +>] +++ arvo + |% + ++ come |= [@ @ @ pram vise pone] :: 4 + (come:soul +<) + :: + ++ load |= [@ @ @ pram vase pane] :: 10 + (load:soul +<) + :: + ++ peek |= * :: 46 + =/ rob (^peek ;;([@da path] +<)) + ?~ rob ~ + ?~ u.rob ~ + [~ u.u.rob] + :: + ++ poke |= * :: 47 + => .(+< ;;([now=@da ovo=ovum] +<)) + (poke:soul now ovo) + :: + ++ wish |=(* (^wish ;;(@ta +<))) :: 22 + -- +:: $pram: upgradeable state +:: +dram: upgrade $pram, compatible +:: ++$ pram + $% [%345 nub=debt:le:part] + (list ovum) + == +++ dram + |= ram=pram + ^- pram + ?: ?=([%345 *] pram) + ram + =| nub=debt:le:part + [%345 nub(out ;;((list ovum) ram))] +:: $prim: old $pram +:: +drum: upgrade $prim to $pram, incompatible +:: ++$ prim pram +++ drum |=(prim +<) +:: +come: load incompatible +:: +++ come + |= [who=ship now=@da yen=@ rim=prim dub=vise nyf=pone] + ^- [(list) *] + =/ fyn (turn nyf |=([a=@tas b=vise] [a (slim b)])) + =/ rum (drum rim) + (load who now yen rum (slim dub) fyn) +:: +load: load compatible +:: +++ load + |= [who=ship now=@da yen=@ ram=pram dub=vase nyf=pane] + ^- [(list) *] =: our who eny yen bud dub vanes (turn nyf |=({a/@tas b/vise} [a [b *worm]])) == - =| out=(list ovum) - |- ^- [(list ovum) _+>.^$] - ?~ ova - [(flop out) +>.^$] - :: iterate over effects, handling those on arvo proper - :: and passing the rest through as output - :: - :: In practice, the pending effects after an upgrade - :: are the %veer moves to install %zuse and the vanes, - :: plus a %vega notification that the upgrade is complete. - :: - :: N.B. this implementation assumes that %vega will be - :: at the end of :ova. - :: - ?: ?=(%vega -.q.i.ova) - =^ zef=(list ovum) vanes - =< abet:loop - %. i.ova - %~ spam le:part - [our now eny lac vil (~(gas by *(map term vane)) vanes)] - :: - $(out [i.ova out], ova (weld t.ova zef)) - :: - =^ vov +>.^$ (feck now i.ova) - =? out ?=(^ vov) [+.vov out] - $(ova t.ova) + =. ram (dram ram) + ?> ?=([%345 *] ram) + (leap now (lead now `nub.ram)) +:: +peek: external inspect :: -++ peek :: external inspect +++ peek |= {now/@da hap/path} ^- (unit (unit)) ?~ hap [~ ~ hoon-version] - %. [[151 %noun] hap] - %- sloy - %~ peek le:part - [our now eny lac vil (~(gas by *(map term vane)) vanes)] + ((sloy peek:(lead now ~)) [[151 %noun] hap]) +:: +poke: external apply :: -++ poke :: external apply +++ poke |= [now=@da ovo=ovum] =. eny (shaz (cat 3 eny now)) - ^- [(list ovum) _+>.$] - :: - :: These external events are actually effects on arvo proper. - :: They can also be produced as the effects of other events. - :: In either case, they fall through here to be handled - :: after the fact in +feck. - :: - ?: ?=(?(%veer %verb %wack %warn) -.q.ovo) - [[ovo ~] +>.$] + |- ^- [(list) *] + ?+ -.q.ovo + :: Normal events are routed to a single vane + :: + (leap now (poke:(lead now ~) (dint p.ovo) ovo)) + :: Process these events just as if they had come from a vane :: + ?(%lyra %veer %verb %wack) + (feck now ovo *debt:le:part) :: These external events (currently only %trim) are global :: notifications, spammed to every vane :: - ?: ?=(%trim -.q.ovo) + %trim => .(ovo ;;((pair wire [%trim p=@ud]) ovo)) - =^ zef vanes - ^- (pair (list ovum) (list (pair term vane))) - =< abet:loop - %. ovo - %~ spam le:part - [our now eny lac vil (~(gas by *(map term vane)) vanes)] + =^ zef vanes loop:(spam:(lead now ~) ovo) :: clear compiler caches if high-priority :: =? vanes =(0 p.q.ovo) ~> %slog.[0 leaf+"arvo: trim: clearing caches"] (turn vanes |=([a=@tas =vane] [a vase.vane *worm])) - [zef +>.$] - :: + ?: ?=(%& -.zef) + [zef arvo] + (feck now [fec nub]:p.zef) :: Error notifications are unwrapped and routed as usual :: - ?: ?=(%crud p.q.ovo) + %crud ?. ?=(^ q.q.ovo) ~|([%unknown-crud q.ovo] !!) :: - =^ zef vanes - =* el - ~(. le:part [our now eny lac vil (~(gas by *(map term vane)) vanes)]) + %+ leap now + ?@ -.q.q.ovo + :: legacy %crud, directly routed :: - =< abet:loop - ?@ -.q.q.ovo - :: - :: legacy %crud, directly routed - :: - (poke:el (dint p.ovo) ovo) - :: - :: modern %crud, unwrapped and routed w/ $goof - :: - =/ =goof ;;(goof -.q.q.ovo) - =/ =curd ;;(curd +.q.q.ovo) - (crud:el (dint p.ovo) goof p.ovo curd) + (poke:(lead now ~) (dint p.ovo) ovo) + :: modern %crud, unwrapped and routed w/ $goof :: - [zef +>.$] - :: Normal events are routed to a single vane - :: - =^ zef vanes - =< abet:loop - %. [(dint p.ovo) ovo] - %~ poke le:part - [our now eny lac vil (~(gas by *(map term vane)) vanes)] - :: - [zef +>.$] -:: +feck: handle an arvo effect + =/ =goof ;;(goof -.q.q.ovo) + =/ =curd ;;(curd +.q.q.ovo) + (crud:(lead now ~) (dint p.ovo) goof p.ovo curd) + == +:: +lead: initialize +le core +:: +++ lead + |= [now=@da nub=(unit debt:le:part)] + ^+ le:part + =; el + ?~ nub el + (abed:el u.nub) + ~(. le:part our now eny lac vil (~(gas by *(map term vane)) vanes)) +:: +leap: run vane loop and handle effects +:: +++ leap + |= [now=@da el=_le:part] + ^- [(list) *] + =^ zef vanes loop:el + ?: ?=(%& -.zef) + [zef arvo] + (feck now [fec nub]:p.zef) +:: +feck: handle an effect from a vane :: ++ feck - |= [now=@da ovo=ovum] - ^- [(unit ovum) _+>.$] - ?+ -.q.ovo - :: pass through unrecognized effect - :: - [[~ ovo] +>.$] - :: toggle event verbose event printfs + |= [now=@da ovo=ovum nub=debt:le:part] + ^- [(list) *] + ?: ?=(%lyra -.q.ovo) + (vega now nub ;;([@ @] +.q.ovo)) + ?+ -.q.ovo ~|(bad-fec+-.q.ovo !!) + :: %verb: toggle event verbose event printfs :: - %verb - [~ +>.$(lac !lac)] - :: install %zuse or vane + %verb (leap(lac !lac) now (lead now `nub)) + :: %veer: install %zuse or vane :: %veer - [~ (veer our now q.ovo)] - :: add data to memory profile + =. soul (veer our now q.ovo) + (leap now (lead now `nub)) + :: %mass: add data to memory profile :: - %mass - =. q.q.ovo - :- %userspace - :- %| - :~ hoon+&+pit - zuse+&+bud - :+ %caches %| - %+ turn - %+ sort vanes - |=([a=[lab=@tas *] b=[lab=@tas *]] (aor lab.a lab.b)) - |=([label=@tas =vane] [(cat 3 %vane- label) %& worm.vane]) - q.q.ovo - :+ %vases %| - %+ turn - %+ sort vanes - |=([a=[lab=@tas *] b=[lab=@tas *]] (aor lab.a lab.b)) - |=([label=@tas =vane] [(cat 3 %vane- label) %& vase.vane]) - dot+&+. - == - [[~ ovo] +>.$] - :: add entropy + %mass !! :: XX convert %mass to a spam + :: %wack: add entropy :: %wack ?> ?=(@ q.q.ovo) =. eny (shaz (cat 3 eny q.q.ovo)) - [~ +>.$] - :: learn of event-replacement failure - :: - %warn - :_ +>.$ - ?. ?=(^ +.q.ovo) - ~ - =/ msg=tape - :(weld "(for %" (trip (symp +<.q.ovo)) ") failed") - ~> %slog.[0 leaf+(weld "arvo: replacement event " msg)] - ?: lac - ~ - =/ rep - %- mule |. - ((slog (tang +>.q.ovo)) ~) - ?.(?=(%& -.rep) ~ p.rep) + (leap now (lead now `nub)) == +:: +vega: reboot kernel :: -++ vega :: reboot kernel +++ vega |= $: :: now: current date :: ova: actions to process after reboot + :: nub: vane continuation state :: hun: hoon.hoon source :: arv: arvo.hoon source :: now=@da - ova=(list ovum) + nub=debt:le:part hun=@t van=@t == - ^- (unit (pair (list ovum) *)) - :: virtualize; dump error if we fail - :: - =- ?:(?=(%| -.res) ((slog p.res) ~) `p.res) - ^= res %- mule |. :: produce a new kernel and an effect list :: - ^- (pair (list ovum) *) + ^- [(list) *] :: compile the hoon.hoon source with the current compiler :: =/ raw @@ -1264,9 +1231,7 @@ :* our now eny - :: tack a notification onto the pending effects - :: - (weld ova [`ovum`[//arvo %vega ~] ~]) + nub bud (turn vanes |=([label=@tas =vane] [label vase.vane])) == @@ -1275,7 +1240,7 @@ =/ out (slum gat sam) :: add types to the product :: - [((list ovum) -.out) +.out] + ;;([(list) *] out) :: +veer: install %zuse or a vane :: :: Identity is in the sample so the larval stage @@ -1283,15 +1248,16 @@ :: ++ veer |= [who=ship now=@da fav=curd] + ^+ soul => .(fav ;;({$veer lal/@ta pax/path txt/@t} fav)) - =- ?:(?=(%| -.res) ((slog p.res) +>.$) p.res) + =- ?:(?=(%| -.res) ((slog p.res) soul) p.res) ^= res %- mule |. ?: =(%$ lal.fav) ~& [%tang pax.fav `@p`(mug txt.fav)] =+ gen=(rain pax.fav txt.fav) =+ vax=(slap pit gen) - +>.^$(bud vax) - %_ +>.^$ + soul(bud vax) + %_ soul vanes |- ^+ vanes ?~ vanes @@ -1306,10 +1272,13 @@ :_ t.vanes :- label.i.vanes ~| [%failed-vane-activation now lal.fav] - vane:(ruck:(vent who lal.fav vil bud [vase.vane.i.vanes *worm]) pax.fav txt.fav) + =< vane + %. [pax txt]:fav + ruck:(vent who lal.fav vil bud [vase.vane.i.vanes *worm]) == +:: +wish: external compute :: -++ wish :: external compute +++ wish |= txt/@ q:(slap bud (ream txt)) -- From a3846d6e039144fb5dec297f87dcb8fd9f5fb2d8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 6 May 2020 12:33:42 -0400 Subject: [PATCH 090/280] arvo: fix boot bugs --- bin/solid.pill | 4 +-- pkg/arvo/app/aqua.hoon | 4 ++- pkg/arvo/sys/arvo.hoon | 60 ++++++++++++++++++++++++------------------ 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 2e7ab4b67..4c9598731 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35f37d5c98a4f7b81e633179d27d458ed5b09a106d45ef4581f4e982923bb02b -size 13198731 +oid sha256:0af672290640049b6cb522f0ed71bf0171e18e11f4b526d319bf47cf71f0dd4f +size 13357516 diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index b10b9556a..cacb97283 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -163,7 +163,9 @@ $ =. snap +.p.poke-result =. ..abet-pe (publish-event tym ue) - =. ..abet-pe (handle-effects ((list ovum) -.p.poke-result)) + =. ..abet-pe + ~| ova=-.p.poke-result + (handle-effects ;;((list ovum) -.p.poke-result)) $ :: :: Peek diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 43e3e5466..2d8e748a6 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1,8 +1,9 @@ :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::: :::::: Postface :::::: :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: -~> %slog.[0 leaf+"%arvo-assembly"] -=- ~> %slog.[0 leaf+"%arvo-assembled"] +!: +~> %slog.[0 leaf+"arvo: assembly"] +=- ~> %slog.[0 leaf+"arvo: assembled"] - =< :: :: Arvo formal interface @@ -14,7 +15,7 @@ :: |= [now=@da ovo=*] ^- * - ~> %slog.[0 leaf+"arvo-event"] + ~> %slog.[0 leaf+"arvo: formal event"] .(+> +:(poke now ovo)) :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::: :::::: volume 3, Arvo models and skeleton :::::: @@ -103,7 +104,8 @@ (pair cord (each * (list mass))) +$ monk (each ship (pair @tas @ta)) +$ move [=duct =ball] -+$ ovum (pair wire curd) ++$ ovum $~ [/ %$ **] + (pair wire curd) :: +$ scry-sample [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path] @@ -170,7 +172,7 @@ == -- => -~% %hex +> ~ +~% %hex ..ut ~ |% :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 3bE, Arvo core :: @@ -257,7 +259,7 @@ +$ ovum [=wire =card] -- :: - ~% %part +> ~ + ~% %part ..part ~ |% :: +| %utilities @@ -537,6 +539,7 @@ +$ germ [vane=term bars=(list duct)] +$ plan (pair germ (list move)) +$ debt + $~ [~ ~ *germ ~] $: :: run: list of worklists :: out: pending output :: gem: worklist metadata @@ -549,7 +552,7 @@ == -- :: - ~% %le +>+> ~ + ~% %le part ~ =| debt =* nub - :: @@ -934,9 +937,9 @@ ++ peek |=(* ~) :: 46 :: ++ poke |= * :: 47 - ^- [(list) *] + ^- [(list ovum) *] => .(+< ;;([now=@da ovo=ovum] +<)) - ^- [(list) *] + ^- [(list ovum) *] =. +>.$ ?+ -.q.ovo :: ignore unrecognized @@ -975,9 +978,11 @@ ?. &(?=(^ who) ?=(^ eny) ?=(^ bod)) [~ +>.$] ~> %slog.[0 leaf+"arvo: metamorphosis"] + =- ~> %slog.[0 leaf+"arvo: metamorphosed"] + - =/ nyf (turn vanes.^poke |=([label=@tas =vane] [label vase.vane])) - (load u.who now u.eny ova=~ u.bod nyf) + (load u.who now u.eny *pram u.bod nyf) :: ++ wish |= txt=* :: 22 ?> ?=(@ txt) @@ -1027,15 +1032,17 @@ :: +dram: upgrade $pram, compatible :: +$ pram + $~ [%345 nub=*debt:le:part] $% [%345 nub=debt:le:part] (list ovum) == ++ dram |= ram=pram ^- pram - ?: ?=([%345 *] pram) + ?: ?=([%345 *] ram) ram =| nub=debt:le:part + ~| ram+ram [%345 nub(out ;;((list ovum) ram))] :: $prim: old $pram :: +drum: upgrade $prim to $pram, incompatible @@ -1046,7 +1053,7 @@ :: ++ come |= [who=ship now=@da yen=@ rim=prim dub=vise nyf=pone] - ^- [(list) *] + ^- [(list ovum) *] =/ fyn (turn nyf |=([a=@tas b=vise] [a (slim b)])) =/ rum (drum rim) (load who now yen rum (slim dub) fyn) @@ -1054,7 +1061,7 @@ :: ++ load |= [who=ship now=@da yen=@ ram=pram dub=vase nyf=pane] - ^- [(list) *] + ^- [(list ovum) *] =: our who eny yen bud dub @@ -1075,7 +1082,8 @@ ++ poke |= [now=@da ovo=ovum] =. eny (shaz (cat 3 eny now)) - |- ^- [(list) *] + ~| poke+-.q.ovo + |- ^- [(list ovum) *] ?+ -.q.ovo :: Normal events are routed to a single vane :: @@ -1096,7 +1104,7 @@ ~> %slog.[0 leaf+"arvo: trim: clearing caches"] (turn vanes |=([a=@tas =vane] [a vase.vane *worm])) ?: ?=(%& -.zef) - [zef arvo] + [p.zef arvo] (feck now [fec nub]:p.zef) :: Error notifications are unwrapped and routed as usual :: @@ -1120,6 +1128,7 @@ ++ lead |= [now=@da nub=(unit debt:le:part)] ^+ le:part + ~| lead+.?(nub) =; el ?~ nub el (abed:el u.nub) @@ -1128,16 +1137,18 @@ :: ++ leap |= [now=@da el=_le:part] - ^- [(list) *] + ^- [(list ovum) *] + ~| %leap =^ zef vanes loop:el ?: ?=(%& -.zef) - [zef arvo] + [p.zef arvo] (feck now [fec nub]:p.zef) :: +feck: handle an effect from a vane :: ++ feck |= [now=@da ovo=ovum nub=debt:le:part] - ^- [(list) *] + ^- [(list ovum) *] + ~| feck+-.q.ovo ?: ?=(%lyra -.q.ovo) (vega now nub ;;([@ @] +.q.ovo)) ?+ -.q.ovo ~|(bad-fec+-.q.ovo !!) @@ -1175,7 +1186,7 @@ == :: produce a new kernel and an effect list :: - ^- [(list) *] + ^- [(list ovum) *] :: compile the hoon.hoon source with the current compiler :: =/ raw @@ -1240,7 +1251,7 @@ =/ out (slum gat sam) :: add types to the product :: - ;;([(list) *] out) + ;;([(list ovum) *] out) :: +veer: install %zuse or a vane :: :: Identity is in the sample so the larval stage @@ -1250,10 +1261,9 @@ |= [who=ship now=@da fav=curd] ^+ soul => .(fav ;;({$veer lal/@ta pax/path txt/@t} fav)) - =- ?:(?=(%| -.res) ((slog p.res) soul) p.res) - ^= res %- mule |. + ~| veer+lal.fav ?: =(%$ lal.fav) - ~& [%tang pax.fav `@p`(mug txt.fav)] + ~> %slog.[0 leaf+"zuse: {(scow p+(mug txt.fav))}"] =+ gen=(rain pax.fav txt.fav) =+ vax=(slap pit gen) soul(bud vax) @@ -1261,14 +1271,14 @@ vanes |- ^+ vanes ?~ vanes - ~& [%vane `@tas`lal.fav pax.fav `@p`(mug txt.fav)] + ~> %slog.[0 leaf+"{(trip lal.fav)}: {(scow p+(mug txt.fav))}"] =+ vin=(vint who lal.fav vil bud pax.fav txt.fav) ?~ vin vanes [[lal.fav vane:u.vin] vanes] ?. =(lal.fav label.i.vanes) [i.vanes $(vanes t.vanes)] - ~& [%vane `@tas`lal.fav pax.fav `@p`(mug txt.fav)] + ~> %slog.[0 leaf+"{(trip lal.fav)}: {(scow p+(mug txt.fav))}"] :_ t.vanes :- label.i.vanes ~| [%failed-vane-activation now lal.fav] From 63b77c1b7f1f8679ff2a8fc87081a5b1e6c97bb6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 6 May 2020 13:11:51 -0400 Subject: [PATCH 091/280] arvo: WIP trying to get |reset working --- pkg/arvo/sys/arvo.hoon | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 2d8e748a6..548d30fa6 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1174,7 +1174,6 @@ :: ++ vega |= $: :: now: current date - :: ova: actions to process after reboot :: nub: vane continuation state :: hun: hoon.hoon source :: arv: arvo.hoon source @@ -1242,7 +1241,7 @@ :* our now eny - nub + 345+nub bud (turn vanes |=([label=@tas =vane] [label vase.vane])) == From a064afbd8983a9f51bb3871d2603ea202f877bb4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 7 May 2020 04:51:08 -0400 Subject: [PATCH 092/280] /sys: |mass works again --- pkg/arvo/sys/arvo.hoon | 61 +++++++++-- pkg/arvo/sys/vane/ames.hoon | 22 ++-- pkg/arvo/sys/vane/behn.hoon | 16 +-- pkg/arvo/sys/vane/clay.hoon | 42 ++++---- pkg/arvo/sys/vane/dill.hoon | 202 +++++++----------------------------- pkg/arvo/sys/vane/eyre.hoon | 23 ++-- pkg/arvo/sys/vane/ford.hoon | 20 ++-- pkg/arvo/sys/vane/gall.hoon | 34 +++--- pkg/arvo/sys/vane/iris.hoon | 28 +++-- pkg/arvo/sys/vane/jael.hoon | 20 ++-- pkg/arvo/sys/zuse.hoon | 37 +------ 11 files changed, 176 insertions(+), 329 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 548d30fa6..f460929f2 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -104,8 +104,7 @@ (pair cord (each * (list mass))) +$ monk (each ship (pair @tas @ta)) +$ move [=duct =ball] -+$ ovum $~ [/ %$ **] - (pair wire curd) ++$ ovum (pair wire curd) :: +$ scry-sample [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path] @@ -742,6 +741,30 @@ ball.move wite.ball.move == == + :: +whey: measure memory usage + :: + ++ whey + ^- (list mass) + =/ von + %+ turn + (sort ~(tap by van) |=([[a=@tas *] [b=@tas *]] (aor a b))) + |=([lal=@tas =vane] (cat 3 %vane- lal)^vane) + :: + :~ :+ %reports %| + %+ turn von + =/ bem=beam [[our %home da+now] /whey] + |= [lal=@tas =vane] + =/ met (need (need (peek ** ~ lal bem))) + lal^|+;;((list mass) q.q.met) + :: + :+ %caches %| + %+ turn von + |=([lal=@tas =vane] lal^&+worm.vane) + :: + :+ %dregs %| + %+ turn von + |=([lal=@tas =vane] lal^&+vase.vane) + == :: +peek: read from the entire namespace :: ++ peek @@ -752,7 +775,6 @@ :: XX identity is defaulted to ship from beam :: => .(fur ?^(fur fur `[[%& p.bed] ~ ~])) - :: :: XX vane and care are concatenated :: =/ lal (end 3 1 ron) @@ -766,7 +788,7 @@ |= [=wire gift=maze] ^- [(unit ovum) _this] =/ ovo=ovum [wire ;;(card q.p.gift)] - ?: ?=(?(%lyra %veer %wack) -.card.ovo) + ?: ?=(?(%lyra %veer %wack %verb %whey) -.card.ovo) [`ovo this] [~ this(out [ovo out])] :: +call: advance to target @@ -1041,8 +1063,8 @@ ^- pram ?: ?=([%345 *] ram) ram - =| nub=debt:le:part ~| ram+ram + =| nub=debt:le:part [%345 nub(out ;;((list ovum) ram))] :: $prim: old $pram :: +drum: upgrade $prim to $pram, incompatible @@ -1054,6 +1076,7 @@ ++ come |= [who=ship now=@da yen=@ rim=prim dub=vise nyf=pone] ^- [(list ovum) *] + ~| %come =/ fyn (turn nyf |=([a=@tas b=vise] [a (slim b)])) =/ rum (drum rim) (load who now yen rum (slim dub) fyn) @@ -1062,6 +1085,7 @@ ++ load |= [who=ship now=@da yen=@ ram=pram dub=vase nyf=pane] ^- [(list ovum) *] + ~| %load =: our who eny yen bud dub @@ -1076,6 +1100,8 @@ |= {now/@da hap/path} ^- (unit (unit)) ?~ hap [~ ~ hoon-version] + ?: =(hap /whey) + ``mass+(whey now) ((sloy peek:(lead now ~)) [[151 %noun] hap]) :: +poke: external apply :: @@ -1090,8 +1116,7 @@ (leap now (poke:(lead now ~) (dint p.ovo) ovo)) :: Process these events just as if they had come from a vane :: - ?(%lyra %veer %verb %wack) - (feck now ovo *debt:le:part) + ?(%lyra %veer %verb %wack %whey) (feck now ovo *debt:le:part) :: These external events (currently only %trim) are global :: notifications, spammed to every vane :: @@ -1143,6 +1168,16 @@ ?: ?=(%& -.zef) [p.zef arvo] (feck now [fec nub]:p.zef) +:: +whey: report memory usage +:: +++ whey + |= now=@da + ^- mass + :+ %arvo %| + :~ hoon+&+pit + zuse+&+bud + vane+|+whey:(lead now ~) + == :: +feck: handle an effect from a vane :: ++ feck @@ -1152,17 +1187,21 @@ ?: ?=(%lyra -.q.ovo) (vega now nub ;;([@ @] +.q.ovo)) ?+ -.q.ovo ~|(bad-fec+-.q.ovo !!) + :: produce memory usage report + :: + %whey + =. out.nub [[p.ovo mass+(whey now)] out.nub] + (leap now (lead now `nub)) :: %verb: toggle event verbose event printfs :: - %verb (leap(lac !lac) now (lead now `nub)) + %verb + =. lac !lac + (leap now (lead now `nub)) :: %veer: install %zuse or vane :: %veer =. soul (veer our now q.ovo) (leap now (lead now `nub)) - :: %mass: add data to memory profile - :: - %mass !! :: XX convert %mass to a spam :: %wack: add entropy :: %wack diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 8399cbbdd..4ba5b4d3a 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1095,7 +1095,6 @@ %sift (on-sift:event-core ships.task) %spew (on-spew:event-core veb.task) %vega on-vega:event-core - %wegh on-wegh:event-core %plea (on-plea:event-core [ship plea]:task) == :: @@ -1195,6 +1194,13 @@ ?. =(%$ ren) [~ ~] ?. =([%& our] why) [~ ~] + ?: =(tyl /whey) + =/ maz=(list mass) + =+ [known alien]=(skid ~(val by peers.ames-state) |=(^ =(%known +<-))) + :~ peers-known+&+known + peers-alien+&+alien + == + ``mass+!>(maz) ?+ syd ~ %peer ?. ?=([@ ~] tyl) [~ ~] @@ -1836,20 +1842,6 @@ ^+ event-core :: (emit unix-duct.ames-state %give %turf turfs) - :: +on-wegh: produce memory usage report - :: - ++ on-wegh - ^+ event-core - :: - =+ [known alien]=(skid ~(tap by peers.ames-state) |=(^ =(%known +<-))) - :: - %- emit - :^ duct %give %mass - :+ %ames %| - :~ peers-known+&+known - peers-alien+&+alien - dot+&+ames-state - == :: +on-born: handle unix process restart :: ++ on-born diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index ac49f777f..3359d9d00 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -135,16 +135,6 @@ :: =< set-unix-wake (emit-vane-wake(timers.state t.timers.state) duct.i.timers.state ~) - :: +wegh: produce memory usage report for |mass - :: - ++ wegh - ^+ [moves state] - :_ state :_ ~ - :^ duct %give %mass - :+ %behn %| - :~ timers+&+timers.state - dot+&+state - == :: %utilities :: ::+| @@ -277,7 +267,6 @@ %vega vega:event-core %wait (wait:event-core date=p.task) %wake (wake:event-core error=~) - %wegh wegh:event-core == [moves behn-gate] :: +load: migrate an old state to a new behn version @@ -298,6 +287,11 @@ :: ?. ?=(%& -.why) ~ + ?: &(=(ren %$) =(tyl /whey)) + =/ maz=(list mass) + :~ timers+&+timers.state + == + ``mass+!>(maz) [~ ~ %tank !>(>timers<)] :: ++ stay state diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 35f20239f..770124e00 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -5571,27 +5571,6 @@ [%foreign-warp (scot %p her) t.pax] [hen %pass wire %c %werp her our ryf] == - :: - %wegh - :_ ..^$ :_ ~ - :^ hen %give %mass - :+ %clay %| - =/ domestic - %+ turn (sort ~(tap by dos.rom.ruf) aor) - |= [=desk =dojo] - :+ desk %| - :~ ankh+&+ank.dom.dojo - mime+&+mim.dom.dojo - ford+&+fod.dom.dojo - == - :~ domestic+|+domestic - foreign+&+hoy.ruf - :+ %object-store %| - :~ commits+&+hut.ran.ruf - blobs+&+lat.ran.ruf - == - dot+&+ruf - == == :: ++ load @@ -5604,6 +5583,8 @@ ^- (unit (unit cage)) ?. ?=(%& -.why) ~ =* his p.why + ?: &(=(ren %$) =(tyl /whey)) + ``mass+!>(whey) :: ~& scry+[ren `path`[(scot %p his) syd ~(rent co lot) tyl]] :: =- ~& %scry-done - =+ luk=?.(?=(%$ -.lot) ~ ((soft case) p.lot)) @@ -5873,4 +5854,23 @@ ?~ - `[paf %ins %mime -:!>(*mime) u.mim] `[paf %mut %mime -:!>(*mime) u.mim] +:: +whey: produce memory usage report +:: +++ whey + ^- (list mass) + =/ domestic + %+ turn (sort ~(tap by dos.rom.ruf) aor) + |= [=desk =dojo] + :+ desk %| + :~ ankh+&+ank.dom.dojo + mime+&+mim.dom.dojo + ford+&+fod.dom.dojo + == + :~ domestic+|+domestic + foreign+&+hoy.ruf + :+ %object-store %| + :~ commits+&+hut.ran.ruf + blobs+&+lat.ran.ruf + == + == -- diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 66f335c3e..b3290067f 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -8,21 +8,10 @@ -- :: => |% :: console protocol ++ axle :: - $: $2 :: + $: %3 :: hey/(unit duct) :: default duct dug/(map duct axon) :: conversations lit/? :: boot in lite mode - dog/_| :: auto-goad - $= hef :: other weights - $: a/(unit mass) :: - b/(unit mass) :: - c/(unit mass) :: - e/(unit mass) :: - f/(unit mass) :: - g/(unit mass) :: - i/(unit mass) :: - j/(unit mass) :: - == :: $= veb :: vane verbosities $~ (~(put by *(map @tas log-level)) %hole %soft) :: quiet packet crashes (map @tas log-level) :: @@ -43,20 +32,10 @@ ++ move {p/duct q/(wind note gift:able)} :: local move ++ note :: out request $-> $~ [%d %verb ~] :: - $% $: %a :: - $>(%wegh task:able:ames) :: - == :: - $: %b :: - $> $? %wait :: - %wegh :: - == :: - task:able:behn :: - == :: - $: %c :: + $% $: %c :: $> $? %merg :: merge desks %perm :: change permissions %warp :: wait for clay hack - %wegh :: memory measure == :: task:able:clay :: == :: @@ -71,46 +50,27 @@ == :: task:able:dill :: == :: - $: %e :: - $>(%wegh task:able:eyre) :: - == :: - $: %f :: - $>(%wegh task:able:ford) :: - == :: $: %g :: $> $? %conf :: %deal :: %goad :: - %wegh :: == :: task:able:gall :: == :: - $: %i :: - $>(%wegh task:able:iris) :: - == :: $: %j :: $> $? %dawn :: %fake :: - %wegh :: == :: task:able:jael :: == == :: ++ sign :: in result $<- $~ [%j %init *@p] :: - $% $: %a :: - $% $>(%mass gift:able:ames) :: - == == :: - $: %b :: - $% $> $? %mass :: - %wake :: - == :: - gift:able:behn :: - $>(%writ gift:able:clay) :: XX %slip + $% $: %b :: + $% $>(%writ gift:able:clay) :: XX %slip $>(%mere gift:able:clay) :: XX %slip == == :: $: %c :: - $> $? %mass :: - %mere :: + $> $? %mere :: %note :: %writ :: == :: @@ -119,25 +79,14 @@ $: %d :: $>(%blit gift:able:dill) :: == :: - $: %e :: - $>(%mass gift:able:eyre) :: - == :: - $: %f :: - $>(%mass gift:able:ford) :: - == :: $: %g :: - $> $? %mass :: - %onto :: + $> $? %onto :: %unto :: == :: gift:able:gall :: == :: - $: %i :: - $>(%mass gift:able:iris) :: - == :: $: %j :: $> $? %init :: - %mass :: == :: gift:able:jael :: == == :: @@ -154,52 +103,19 @@ ^- {(list move) axle} [(flop moz) all(dug (~(put by dug.all) hen +<+))] :: - ++ auto :: stage automation - ^+ . - ?. dog.all . - =. dog.all | - (pass /auto/one [%b %wait +(now)]) - :: - ++ auto-wake :: resume automation - |= [=wire error=(unit tang)] - ?+ wire - ?~ error - ~|(behn-bad-wake+wire !!) - (crud %wake u.error) - :: - [%auto %one ~] - ?~ error - ~& %behn-goad - (pass / [%g %goad force=| ~]) - :: %goad crashed, wait again, then force - :: - ~& %behn-goad-retry - %. [/auto/two [%b %wait +(now)]] - pass:(crud %goad u.error) - :: - [%auto %two ~] - ?~ error - ~& %behn-goad-again - (pass / [%g %goad force=& ~]) - :: %goad crashed again, bail out - :: - ~& %behn-goad-fail - (crud %goad u.error) - == - :: ++ call :: receive input |= kyz/task:able ^+ +> ?+ -.kyz ~& [%strange-kiss -.kyz] +> $flow +> $harm +> - $hail auto:(send %hey ~) + $hail (send %hey ~) $belt (send `dill-belt`p.kyz) $text (from %out (tuba p.kyz)) $crud :: (send `dill-belt`[%cru p.kyz q.kyz]) (crud p.kyz q.kyz) $blew (send %rez p.p.kyz q.p.kyz) - $heft heft + $heft (dump %whey ~) $lyra (dump kyz) $pack (dump kyz) $veer (dump kyz) @@ -334,17 +250,6 @@ ~ '9' == -- - :: - ++ heft - =< (pass /heft/ames [%a %wegh ~]) - =< (pass /heft/behn [%b %wegh ~]) - =< (pass /heft/clay [%c %wegh ~]) - =< (pass /heft/eyre [%e %wegh ~]) - =< (pass /heft/ford [%f %wegh ~]) - =< (pass /heft/gall [%g %wegh ~]) - =< (pass /heft/iris [%i %wegh ~]) - =< (pass /heft/jael [%j %wegh ~]) - . :: XX move :: ++ sein @@ -410,9 +315,6 @@ |= {tea/wire sih/sign} ^+ +> ?- sih - {?($a $b $c $e $f $g $i $j) $mass *} - (wegh -.sih p.sih) - :: [%j %init *] :: pass thru to unix :: @@ -449,58 +351,7 @@ :: {$d $blit *} (done +.sih) - :: - {$b $wake *} - (auto-wake tea error.sih) == - :: +wegh: receive a memory report from a vane and maybe emit full report - :: - ++ wegh - |= [lal=?(%a %b %c %e %f %g %i %j) mas=mass] - ^+ +> - :: update our listing of vane responses with this new one - :: - =. hef.all - ?- lal - %a ~?(?=(^ a.hef.all) %double-mass-a hef.all(a `mas)) - %b ~?(?=(^ b.hef.all) %double-mass-b hef.all(b `mas)) - %c ~?(?=(^ c.hef.all) %double-mass-c hef.all(c `mas)) - %e ~?(?=(^ e.hef.all) %double-mass-e hef.all(e `mas)) - %f ~?(?=(^ f.hef.all) %double-mass-f hef.all(f `mas)) - %g ~?(?=(^ g.hef.all) %double-mass-g hef.all(g `mas)) - %i ~?(?=(^ i.hef.all) %double-mass-i hef.all(i `mas)) - %j ~?(?=(^ j.hef.all) %double-mass-j hef.all(j `mas)) - == - :: if not all vanes have responded yet, no-op - :: - ?. ?& ?=(^ a.hef.all) - ?=(^ b.hef.all) - ?=(^ c.hef.all) - ?=(^ e.hef.all) - ?=(^ f.hef.all) - ?=(^ g.hef.all) - ?=(^ i.hef.all) - ?=(^ j.hef.all) - == - +>.$ - :: clear vane reports from our state before weighing ourself - :: - :: Otherwise, the state of vanes printed after this one get absorbed - :: into Dill's %dot catchall report. - :: - =/ ven=(list mass) ~[u.a u.b u.c u.e u.f u.g u.i u.j]:hef.all - => .(hef.all [~ ~ ~ ~ ~ ~ ~ ~]) - :: wegh ourself now that our state doesn't include other masses - :: - =/ self=mass - :+ %dill %| - :~ hey+&+hey.all - dug+&+dug.all - dot+&+all - == - :: produce the memory report for all vanes - :: - (done %mass %vanes %| [self ven]) -- :: ++ ax :: make ++as @@ -591,7 +442,7 @@ => |% :: without .dog :: - ++ axle-one + ++ axle-1 $: $1 hey/(unit duct) dug/(map duct axon) @@ -610,15 +461,36 @@ $~ (~(put by *(map @tas log-level)) %hole %soft) (map @tas log-level) == + ++ axle-2 + $: %2 + hey/(unit duct) + dug/(map duct axon) + lit/? + dog/_| + $= hef + $: a/(unit mass) + b/(unit mass) + c/(unit mass) + e/(unit mass) + f/(unit mass) + g/(unit mass) + i/(unit mass) + j/(unit mass) + == + $= veb + $~ (~(put by *(map @tas log-level)) %hole %soft) + (map @tas log-level) + == :: - ++ axle-both - $%(axle-one axle) + ++ axle-any + $%(axle-1 axle-2 axle) -- :: - |= old=axle-both + |= old=axle-any ?- -.old %1 $(old [%2 [hey dug lit dog=& hef veb]:old]) - %2 ..^$(all old) + %2 $(old [%3 [hey dug lit veb]:old]) + %3 ..^$(all old) == :: ++ scry @@ -626,6 +498,12 @@ ^- (unit (unit cage)) ?. ?=(%& -.why) ~ =* his p.why + ?: &(=(ren %$) =(tyl /whey)) + =/ maz=(list mass) + :~ hey+&+hey.all + dug+&+dug.all + == + ``mass+!>(maz) [~ ~] :: ++ stay all diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 2dba8b927..21b5ced7c 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -2186,20 +2186,6 @@ %disconnect =. server-state.ax (remove-binding:server binding.task) [~ http-server-gate] - :: - %wegh - :_ http-server-gate - :~ :* duct - %give - %mass - ^- mass - :+ %eyre %| - :~ bindings+&+bindings.server-state.ax - auth+&+authentication-state.server-state.ax - connections+&+connections.server-state.ax - channels+&+channel-state.server-state.ax - axle+&+ax - == == == == :: ++ take @@ -2404,6 +2390,15 @@ =* who p.why ?. ?=(%$ ren) [~ ~] + ?: =(tyl /whey) + =/ maz=(list mass) + :~ bindings+&+bindings.server-state.ax + auth+&+authentication-state.server-state.ax + connections+&+connections.server-state.ax + channels+&+channel-state.server-state.ax + axle+&+ax + == + ``mass+!>(maz) ?. ?=(%$ -.lot) [~ ~] ?. ?=(%host syd) diff --git a/pkg/arvo/sys/vane/ford.hoon b/pkg/arvo/sys/vane/ford.hoon index 827a77b63..f1c92925c 100644 --- a/pkg/arvo/sys/vane/ford.hoon +++ b/pkg/arvo/sys/vane/ford.hoon @@ -6206,17 +6206,6 @@ =. state.ax (wipe:this-event percent-to-remove.task) :: [~ ford-gate] - :: - %wegh - :_ ford-gate - :_ ~ - :^ duct %give %mass - ^- mass - :+ %ford %| - :~ builds+&+builds.state.ax - compiler-cache+&+compiler-cache.state.ax - dot+&+ax - == == :: +take: receive a response from another vane :: @@ -6361,6 +6350,11 @@ :: +scry: request a path in the urbit namespace :: ++ scry - |= * - [~ ~] + |= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path} + ^- (unit (unit cage)) + ?. ?=(%& -.why) ~ + =* his p.why + ?: &(=(ren %$) =(tyl /whey)) + ``mass+!>([state+&+ax]~) + ~ -- diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index f9588f0be..6ce5ef6a3 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1382,24 +1382,6 @@ %sear mo-abet:(mo-filter-queue:mo-core ship.task) %trim [~ gall-payload] %vega [~ gall-payload] - %wegh - =/ blocked - =/ queued (~(run by blocked.state) |=((qeu blocked-move) [%.y +<])) - (sort ~(tap by queued) aor) - :: - =/ running - =/ active (~(run by yokes.state) |=(yoke [%.y +<])) - (sort ~(tap by active) aor) - :: - =/ =mass - :+ %gall %.n - :~ [%foreign %.y contacts.state] - [%blocked %.n blocked] - [%active %.n running] - [%dot %.y state] - == - :: - [[duct %give %mass mass]~ gall-payload] == :: +load: recreate vane :: @@ -1825,6 +1807,22 @@ ?. ?=(%.y -.shop) ~ =/ =ship p.shop + ?: &(=(care %$) =(path /whey)) + =/ blocked + =/ queued (~(run by blocked.state) |=((qeu blocked-move) [%.y +<])) + (sort ~(tap by queued) aor) + :: + =/ running + =/ active (~(run by yokes.state) |=(yoke [%.y +<])) + (sort ~(tap by active) aor) + :: + =/ maz=(list mass) + :~ [%foreign %.y contacts.state] + [%blocked %.n blocked] + [%active %.n running] + == + ``mass+!>(maz) + :: ?: ?& =(%u care) =(~ path) =([%$ %da now] coin) diff --git a/pkg/arvo/sys/vane/iris.hoon b/pkg/arvo/sys/vane/iris.hoon index 15890e55f..0cc5de7bd 100644 --- a/pkg/arvo/sys/vane/iris.hoon +++ b/pkg/arvo/sys/vane/iris.hoon @@ -366,20 +366,6 @@ %receive =^ moves state.ax (receive:client +.task) [moves light-gate] - :: - %wegh - :_ light-gate - :~ :* duct - %give - %mass - ^- mass - :+ %iris %| - :~ nex+&+next-id.state.ax - outbound+&+outbound-duct.state.ax - by-id+&+connection-by-id.state.ax - by-duct+&+connection-by-duct.state.ax - axle+&+ax - == == == == :: http-client issues no requests to other vanes :: @@ -404,6 +390,18 @@ :: +scry: request a path in the urbit namespace :: ++ scry - |= * + |= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path} + ^- (unit (unit cage)) + ?. ?=(%& -.why) ~ + =* his p.why + ?: &(=(ren %$) =(tyl /whey)) + =/ maz=(list mass) + :~ nex+&+next-id.state.ax + outbound+&+outbound-duct.state.ax + by-id+&+connection-by-id.state.ax + by-duct+&+connection-by-duct.state.ax + axle+&+ax + == + ``mass+!>(maz) [~ ~] -- diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 3f38d5d9f..3584a29ae 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -488,20 +488,6 @@ :: %private-keys (curd abet:~(private-keys ~(feed su hen our now pki etn) hen)) - :: - %wegh - %_ +> - moz - :_ moz - ^- move - :^ hen %give %mass - ^- mass - :+ %jael %| - :~ pki+&+pki - etn+&+etn - dot+&+lex - == - == :: :: authenticated remote request :: {$west p/ship q/path r/*} @@ -1009,6 +995,12 @@ :: ?. =(lot [%$ %da now]) ~ ?. =(%$ ren) [~ ~] + ?: =(tyl /whey) + =/ maz=(list mass) + :~ pki+&+pki.lex + etn+&+etn.lex + == + ``mass+!>(maz) ?+ syd ~ :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index a66a7d683..23858b081 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -211,9 +211,6 @@ :: kernel upgraded :: [%vega ~] - :: produce labeled state (for memory measurement) - :: - [%wegh ~] :: receive message via %ames :: :: TODO: move .vane from $plea to here @@ -396,7 +393,6 @@ :: %sift: limit verbosity to .ships :: %spew: set verbosity toggles :: %vega: kernel reload notification - :: %wegh: request for memory usage report :: +$ task $% [%hear =lane =blob] @@ -411,7 +407,6 @@ [%sift ships=(list ship)] [%spew veb=(list verb)] $>(%vega vane-task) - $>(%wegh vane-task) == :: $gift: effect from ames :: @@ -425,7 +420,6 @@ :: :: System and Lifecycle Gifts :: - :: %mass: memory usage report :: %turf: domain report, relayed from jael :: +$ gift @@ -435,7 +429,6 @@ [%lost ~] [%send =lane =blob] :: - [%mass p=mass] [%turf turfs=(list turf)] == -- ::able @@ -503,7 +496,6 @@ |% ++ gift :: out result <-$ $% [%doze p=(unit @da)] :: next alarm - [%mass p=mass] :: memory usage [%wake error=(unit tang)] :: wakeup or failed [%meta p=vase] == @@ -518,7 +510,6 @@ $>(%vega vane-task) :: report upgrade [%wait p=@da] :: set alarm [%wake ~] :: timer activate - $>(%wegh vane-task) :: report memory == -- ::able -- ::behn @@ -540,7 +531,6 @@ {$ergo p/@tas q/mode} :: version update {$hill p/(list @tas)} :: mount points [%done error=(unit error:ames)] :: ames message (n)ack - {$mass p/mass} :: memory usage {$mere p/(each (set path) (pair term tang))} :: merge result {$note p/@tD q/tank} :: debug message {$ogre p/@tas} :: delete mount point @@ -574,7 +564,6 @@ $>(%vega vane-task) :: report upgrade {$warp wer/ship rif/riff} :: internal file req {$werp who/ship wer/ship rif/riff} :: external file req - $>(%wegh vane-task) :: report memory $>(%plea vane-task) :: ames request == :: -- ::able @@ -796,10 +785,10 @@ {$init p/@p} :: set owner {$logo ~} :: logout {$lyra p/@t q/@t} :: upgrade kernel - {$mass p/mass} :: memory usage {$pack ~} :: compact memory {$veer p/@ta q/path r/@t} :: install vane {$verb ~} :: verbose mode + [%whey ~] :: memory report == :: ++ task :: in request ->$ $~ [%vega ~] :: @@ -910,9 +899,6 @@ :: not allowed. :: [%bound accepted=? =binding] - :: memory usage report - :: - [%mass p=mass] == :: ++ task @@ -959,9 +945,6 @@ :: the first place. :: [%disconnect =binding] - :: memory usage request - :: - $>(%wegh vane-task) == :: -- @@ -1215,9 +1198,6 @@ :: %vega: report kernel upgrade :: $>(%vega vane-task) - :: %wegh: produce memory usage information - :: - $>(%wegh vane-task) :: %wipe: wipes stored builds :: [%wipe percent-to-remove=@ud] @@ -1225,10 +1205,7 @@ :: +gift:able:ford: responses from ford :: += gift - $% :: %mass: memory usage; response to %wegh +task - :: - [%mass p=mass] - :: %made: build result; response to %build +task + $% :: %made: build result; response to %build +task :: $: %made :: date: formal date of the build @@ -1897,7 +1874,6 @@ ++ gift :: outgoing result $% [%boon payload=*] :: ames response [%done error=(unit error:ames)] :: ames message (n)ack - [%mass p=mass] :: memory usage [%onto p=(each suss tang)] :: about agent [%unto p=sign:agent] :: == :: @@ -1911,7 +1887,6 @@ $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade $>(%plea vane-task) :: network request - $>(%wegh vane-task) :: report memory == :: -- ::able ++ bitt (map duct (pair ship path)) :: incoming subs @@ -2043,9 +2018,6 @@ :: %response: response to the caller :: [%http-response =client-response] - :: memory usage report - :: - [%mass p=mass] == :: ++ task @@ -2071,9 +2043,6 @@ :: receives http data from outside :: [%receive id=@ud =http-event:http] - :: memory usage request - :: - $>(%wegh vane-task) == -- :: +client-response: one or more client responses given to the caller @@ -2157,7 +2126,6 @@ :: :: ++ gift :: out result <-$ $% [%init p=ship] :: report install unix - [%mass p=mass] :: memory usage report [%done error=(unit error:ames)] :: ames message (n)ack [%boon payload=*] :: ames response [%private-keys =life vein=(map life ring)] :: private keys @@ -2183,7 +2151,6 @@ $>(%trim vane-task) :: trim state [%turf ~] :: view domains $>(%vega vane-task) :: report upgrade - $>(%wegh vane-task) :: memory usage request $>(%plea vane-task) :: ames request == :: :: From 7493fd4fd9e1f2d5537c202621e13126cb356e5d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 7 May 2020 05:00:11 -0400 Subject: [PATCH 093/280] arvo: handle %warn event --- pkg/arvo/sys/arvo.hoon | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index f460929f2..891057202 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1114,6 +1114,11 @@ :: Normal events are routed to a single vane :: (leap now (poke:(lead now ~) (dint p.ovo) ovo)) + :: Print warning and no-op. + :: + %warn + =+ (mule |.(((slog ;;(tank q.q.ovo) ~) ~))) + [~ arvo] :: Process these events just as if they had come from a vane :: ?(%lyra %veer %verb %wack %whey) (feck now ovo *debt:le:part) From 9dea282d5d5bb550879419279280f541167aaf26 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 7 May 2020 05:10:43 -0400 Subject: [PATCH 094/280] arvo: minor cleanup --- pkg/arvo/sys/arvo.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 891057202..309527bdc 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -3,8 +3,7 @@ :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: !: ~> %slog.[0 leaf+"arvo: assembly"] -=- ~> %slog.[0 leaf+"arvo: assembled"] - - +~< %slog.[0 leaf+"arvo: assembled"] =< :: :: Arvo formal interface :: @@ -1000,8 +999,7 @@ ?. &(?=(^ who) ?=(^ eny) ?=(^ bod)) [~ +>.$] ~> %slog.[0 leaf+"arvo: metamorphosis"] - =- ~> %slog.[0 leaf+"arvo: metamorphosed"] - - + ~< %slog.[0 leaf+"arvo: metamorphosed"] =/ nyf (turn vanes.^poke |=([label=@tas =vane] [label vase.vane])) (load u.who now u.eny *pram u.bod nyf) @@ -1117,7 +1115,9 @@ :: Print warning and no-op. :: %warn - =+ (mule |.(((slog ;;(tank q.q.ovo) ~) ~))) + ?: =(%& -:(mule |.(((slog ;;(tank q.q.ovo) ~) ~)))) + [~ arvo] + ~> %slog.[0 leaf+"arvo: %warn print-fail"] [~ arvo] :: Process these events just as if they had come from a vane :: From ea2386b36c0499f592ea95c620ea87548f604c39 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 7 May 2020 23:58:03 -0400 Subject: [PATCH 095/280] clay: stop the %drip --- pkg/arvo/lib/strandio.hoon | 2 +- pkg/arvo/sys/vane/clay.hoon | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index dcd67c2f3..60f123214 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -576,7 +576,7 @@ |= tin=strand-input:strand ?+ in.tin `[%skip ~] ~ `[%wait ~] - [~ %sign * %b %writ *] + [~ %sign * ?(%b %c) %writ *] ?. =(wire wire.u.in.tin) `[%skip ~] `[%done +>.sign-arvo.u.in.tin] diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 770124e00..43a11e549 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3299,10 +3299,7 @@ |= {hen/duct mun/mood dat/(each cage lobe)} ^+ +> ?: ?=(%& -.dat) - %- emit - :* hen %slip %b %drip - !>([%writ ~ [care.mun case.mun syd] path.mun p.dat]) - == + (emit hen %give %writ ~ [care.mun case.mun syd] path.mun p.dat) %- emit :* hen %pass [%blab care.mun (scot case.mun) syd path.mun] %f %build live=%.n %pin @@ -3321,7 +3318,7 @@ :: translate the case to a date :: =/ cas [%da (case-to-date case.n.das)] - =- (emit hen %slip %b %drip !>([%wris cas -])) + =- (emit hen %give %wris cas -) (~(run in `(set mood)`das) |=(m/mood [care.m path.m])) :: :: Give next step in a subscription. @@ -3339,7 +3336,7 @@ :: ++ blub |= hen/duct - (emit hen %slip %b %drip !>([%writ ~])) + (emit hen %give %writ ~) :: :: Lifts a function so that a single result can be fanned out over a set of :: subscriber ducts. @@ -4178,7 +4175,7 @@ |= err=(pair term tang) ^+ +> =. +>.$ - (emit [hen %slip %b %drip !>([%mere %| err])]) + (emit hen %give %mere %| err) finish-write :: :: Release effects and apply state changes @@ -4186,7 +4183,7 @@ ++ done-merge |= [conflicts=(set path) =dome =rang] ^+ +> - =. +>.$ (emit [hen %slip %b %drip !>([%mere %& conflicts])]) + =. +>.$ (emit hen %give %mere %& conflicts) =: dom dome hut.ran (~(uni by hut.rang) hut.ran) lat.ran (~(uni by lat.rang) lat.ran) @@ -5670,14 +5667,13 @@ ~> %mean.|.((made-result-as-error:ford result.q.hin)) !! :: interpolate ford fail into stack trace :_ ..^$ :_ ~ - :* hen %slip %b %drip !> - :* %writ ~ + :* hen %give %writ ~ ^- [care case @tas] [i.t.tea ;;(case +>:(slay i.t.t.tea)) i.t.t.t.tea] :: `path`t.t.t.t.tea `cage`(result-to-cage:ford build-result.result.q.hin) - == == + == :: ?: ?=([%warp-index @ @ @ ~] tea) ?+ +<.q.hin ~| %clay-warp-index-strange !! @@ -5731,9 +5727,7 @@ :: ~& [%sunk-wove desk (print-wove wove) ducts] ~(tap in ducts) =/ cancel-moves=(list move) - %+ turn cancel-ducts - |= =duct - [duct %slip %b %drip !>([%writ ~])] + (turn cancel-ducts |=(=duct [duct %give %writ ~])) :: Clear ford cache :: =/ clear-ford-cache-moves=(list move) From ff8b427de973b6681d2e2a4450de898da0060eb3 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 8 May 2020 00:23:51 -0400 Subject: [PATCH 096/280] :language-server: fix mint-vain from zuse change --- pkg/arvo/app/language-server.hoon | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/arvo/app/language-server.hoon b/pkg/arvo/app/language-server.hoon index 26eb6e06f..e976d62b9 100644 --- a/pkg/arvo/app/language-server.hoon +++ b/pkg/arvo/app/language-server.hoon @@ -242,8 +242,7 @@ ++ handle-build |= [=path =gift:able:ford] ^- (quip card _state) - ?. ?=([%made *] gift) - [~ state] + ?> ?=([%made *] gift) ?. ?=([%complete *] result.gift) [~ state] =/ uri=@t From bf965a26ea08359f128b0c8a1eaa5605eab2cdd2 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 8 May 2020 14:26:45 +1000 Subject: [PATCH 097/280] links: rename files to namespacing convention --- pkg/arvo/app/link-listen-hook.hoon | 2 +- pkg/arvo/app/link-proxy-hook.hoon | 2 +- pkg/arvo/app/link-store.hoon | 2 +- pkg/arvo/app/link-view.hoon | 2 +- pkg/arvo/gen/link-store/note.hoon | 2 +- pkg/arvo/gen/link-store/save.hoon | 2 +- pkg/arvo/lib/{link.hoon => link-store.hoon} | 2 +- pkg/arvo/mar/link/action.hoon | 2 +- pkg/arvo/mar/link/initial.hoon | 2 +- pkg/arvo/mar/link/update.hoon | 2 +- pkg/arvo/sur/link-store.hoon | 49 +++++++++++++++++++++ pkg/arvo/sur/link.hoon | 44 ------------------ 12 files changed, 59 insertions(+), 54 deletions(-) rename pkg/arvo/lib/{link.hoon => link-store.hoon} (99%) create mode 100644 pkg/arvo/sur/link-store.hoon diff --git a/pkg/arvo/app/link-listen-hook.hoon b/pkg/arvo/app/link-listen-hook.hoon index 8cc921d4b..36279eb8e 100644 --- a/pkg/arvo/app/link-listen-hook.hoon +++ b/pkg/arvo/app/link-listen-hook.hoon @@ -14,7 +14,7 @@ :: to expede this process, we prod other potential listeners when we add :: them to our metadata+groups definition. :: -/- link-listen-hook, *metadata-store, *link, group-store +/- *link, link-listen-hook, *metadata-store, *link-store, group-store /+ mdl=metadata, default-agent, verb, dbug :: ~% %link-listen-hook-top ..is ~ diff --git a/pkg/arvo/app/link-proxy-hook.hoon b/pkg/arvo/app/link-proxy-hook.hoon index 2c89c90d0..e9671916d 100644 --- a/pkg/arvo/app/link-proxy-hook.hoon +++ b/pkg/arvo/app/link-proxy-hook.hoon @@ -20,7 +20,7 @@ :: to touch are +permitted, +initial-response, & +kick-proxies. :: /- group-store, *metadata-store -/+ *link, metadata, default-agent, verb, dbug +/+ *link-store, metadata, default-agent, verb, dbug ~% %link-proxy-hook-top ..is ~ |% +$ state-0 diff --git a/pkg/arvo/app/link-store.hoon b/pkg/arvo/app/link-store.hoon index 9828e5731..082bb5106 100644 --- a/pkg/arvo/app/link-store.hoon +++ b/pkg/arvo/app/link-store.hoon @@ -50,7 +50,7 @@ :: ? :: /seen/wood-url/some-path have we seen this here :: -/+ *link, default-agent, verb, dbug +/+ *link-store, default-agent, verb, dbug :: |% +$ state-0 diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index b7c46a00f..5b2a8fb38 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -15,7 +15,7 @@ link-listen-hook, group-hook, permission-hook, permission-group-hook, metadata-hook, contact-view -/+ *link, metadata, *server, default-agent, verb, dbug +/+ *link-store, metadata, *server, default-agent, verb, dbug ~% %link-view-top ..is ~ :: |% diff --git a/pkg/arvo/gen/link-store/note.hoon b/pkg/arvo/gen/link-store/note.hoon index 7f26a3b59..a3d169a33 100644 --- a/pkg/arvo/gen/link-store/note.hoon +++ b/pkg/arvo/gen/link-store/note.hoon @@ -1,6 +1,6 @@ :: link-store|note: write a note on a link in a path :: -/- *link +/- *link-store :- %say |= $: [now=@da eny=@uvJ =beak] [[=path =url note=@t ~] ~] diff --git a/pkg/arvo/gen/link-store/save.hoon b/pkg/arvo/gen/link-store/save.hoon index 3a3304b3d..4a192d0be 100644 --- a/pkg/arvo/gen/link-store/save.hoon +++ b/pkg/arvo/gen/link-store/save.hoon @@ -1,6 +1,6 @@ :: link-store|save: save a link to a path :: -/- *link +/- *link-store :- %say |= $: [now=@da eny=@uvJ =beak] [[=path title=@t =url ~] ~] diff --git a/pkg/arvo/lib/link.hoon b/pkg/arvo/lib/link-store.hoon similarity index 99% rename from pkg/arvo/lib/link.hoon rename to pkg/arvo/lib/link-store.hoon index 599e0f077..4983ef1cd 100644 --- a/pkg/arvo/lib/link.hoon +++ b/pkg/arvo/lib/link-store.hoon @@ -1,6 +1,6 @@ :: link: social bookmarking :: -/- *link +/- *link-store :: |% ++ site-from-url diff --git a/pkg/arvo/mar/link/action.hoon b/pkg/arvo/mar/link/action.hoon index 608d4c475..d9be57b19 100644 --- a/pkg/arvo/mar/link/action.hoon +++ b/pkg/arvo/mar/link/action.hoon @@ -1,7 +1,7 @@ :: link: subscription updates :: ::TODO this should include json conversion once mark performance improves -/+ *link +/+ *link-store |_ =action ++ grow |% diff --git a/pkg/arvo/mar/link/initial.hoon b/pkg/arvo/mar/link/initial.hoon index ad73c1667..18380b9dc 100644 --- a/pkg/arvo/mar/link/initial.hoon +++ b/pkg/arvo/mar/link/initial.hoon @@ -1,6 +1,6 @@ :: link: initial subscription result :: -/- *link +/- *link-store |_ =initial ++ grow |% diff --git a/pkg/arvo/mar/link/update.hoon b/pkg/arvo/mar/link/update.hoon index f48600d77..a60b30604 100644 --- a/pkg/arvo/mar/link/update.hoon +++ b/pkg/arvo/mar/link/update.hoon @@ -1,6 +1,6 @@ :: link: subscription updates :: -/- *link +/- *link-store |_ =update ++ grow |% diff --git a/pkg/arvo/sur/link-store.hoon b/pkg/arvo/sur/link-store.hoon new file mode 100644 index 000000000..a76cbbd4c --- /dev/null +++ b/pkg/arvo/sur/link-store.hoon @@ -0,0 +1,49 @@ +:: link-store: store specific types +:: +/- *link +|% +:: +:: +action: local actions +:: ++$ action + $% :: user actions + :: + :: %save: save page to path on our ship + :: + [%save =path title=@t =url] + :: %note: save a note for a url + :: + [%note =path =url udon=@t] + :: %seen: mark item as read (~ for all in path) + :: + [%seen =path url=(unit url)] + :: hook actions + :: + :: %hear: hear about page at path on other ship + :: + [%hear =path submission] + :: %read: hear about note on url from ship + :: + [%read =path =url comment] + == +:: +:: +initial: local result +:: ++$ initial + $% [%local-pages pages=(map path pages)] + [%submissions submissions=(map path submissions)] + [%annotations notes=(per-path-url notes)] + [%discussions comments=(per-path-url comments)] + == +:: +update: local updates +:: +::NOTE we include paths/urls to support the "subscribed to all" case +:: ++$ update + $% [%local-pages =path =pages] + [%submissions =path =submissions] + [%annotations =path =url =notes] + [%discussions =path =url =comments] + [%observation =path urls=(set url)] + == +-- diff --git a/pkg/arvo/sur/link.hoon b/pkg/arvo/sur/link.hoon index bfa4d0498..20b30a98c 100644 --- a/pkg/arvo/sur/link.hoon +++ b/pkg/arvo/sur/link.hoon @@ -46,48 +46,4 @@ ++ per-path-url |$ [value] (map path (map url value)) -:: -:: +action: local actions -:: -+$ action - $% :: user actions - :: - :: %save: save page to path on our ship - :: - [%save =path title=@t =url] - :: %note: save a note for a url - :: - [%note =path =url udon=@t] - :: %seen: mark item as read (~ for all in path) - :: - [%seen =path url=(unit url)] - :: hook actions - :: - :: %hear: hear about page at path on other ship - :: - [%hear =path submission] - :: %read: hear about note on url from ship - :: - [%read =path =url comment] - == -:: -:: +initial: local result -:: -+$ initial - $% [%local-pages pages=(map path pages)] - [%submissions submissions=(map path submissions)] - [%annotations notes=(per-path-url notes)] - [%discussions comments=(per-path-url comments)] - == -:: +update: local updates -:: -::NOTE we include paths/urls to support the "subscribed to all" case -:: -+$ update - $% [%local-pages =path =pages] - [%submissions =path =submissions] - [%annotations =path =url =notes] - [%discussions =path =url =comments] - [%observation =path urls=(set url)] - == -- From 9588542ed415f816d94b0f441a08efa01c8f5d2b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 8 May 2020 01:29:25 -0400 Subject: [PATCH 098/280] eyre: fix tests --- pkg/arvo/sys/vane/eyre.hoon | 4 +- pkg/arvo/tests/sys/vane/eyre.hoon | 763 ++++++++++++++---------------- 2 files changed, 359 insertions(+), 408 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 21b5ced7c..0a9979b59 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -921,7 +921,9 @@ =/ bek=beak [our desk.generator.action da+now] =/ sup=spur (flop path.generator.action) =/ ski (scry [%141 %noun] ~ %ca bek sup) - =/ gat=vase !<(vase q:(need (need ski))) + =/ cag=cage (need (need ski)) + ?> =(%vase p.cag) + =/ gat=vase !<(vase q.cag) =/ res=(each vase tang) %- mule |. %+ slam diff --git a/pkg/arvo/tests/sys/vane/eyre.hoon b/pkg/arvo/tests/sys/vane/eyre.hoon index a9f26f00a..41c2955ea 100644 --- a/pkg/arvo/tests/sys/vane/eyre.hoon +++ b/pkg/arvo/tests/sys/vane/eyre.hoon @@ -1,17 +1,17 @@ /+ *test, *test-ford-external -/= http-server-raw /sys/vane/eyre +/= eyre-raw /sys/vane/eyre :: !: :: =/ test-pit=vase !>(..zuse) -=/ http-server-gate (http-server-raw test-pit) +=/ eyre-gate (eyre-raw test-pit) =/ eyre-id '~.eyre_0v4.elsnk.20412.0h04v.50lom.5lq0o' :: |% ++ test-init - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -22,9 +22,9 @@ :: ++ test-duplicate-bindings :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -32,9 +32,9 @@ == :: app1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] @@ -42,9 +42,9 @@ == :: app2 tries to bind to the same path and fails :: - =^ results3 http-server-gate - %- http-server-call :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.3 scry=scry-provides-code call-args=[duct=~[/app2] ~ [%connect [~ /] %app2]] @@ -59,9 +59,9 @@ :: ++ test-remove-binding :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -69,9 +69,9 @@ == :: app1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] @@ -79,9 +79,9 @@ == :: app1 unbinds :: - =^ results3 http-server-gate - %- http-server-call :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.3 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%disconnect [~ /]]] @@ -89,9 +89,9 @@ == :: app2 binds successfully :: - =^ results4 http-server-gate - %- http-server-call :* - http-server-gate + =^ results4 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.4 scry=scry-provides-code call-args=[duct=~[/app2] ~ [%connect [~ /] %app2]] @@ -110,30 +110,30 @@ :: %+ expect-eq !>(%.y) - !>((host-matches:http-server-gate ~ `'example.com')) + !>((host-matches:eyre-gate ~ `'example.com')) :: %+ expect-eq !>(%.y) - !>((host-matches:http-server-gate ~ ~)) + !>((host-matches:eyre-gate ~ ~)) :: %+ expect-eq !>(%.n) - !>((host-matches:http-server-gate `'example.com' ~)) + !>((host-matches:eyre-gate `'example.com' ~)) :: %+ expect-eq !>(%.y) - !>((host-matches:http-server-gate `'example.com' `'example.com')) + !>((host-matches:eyre-gate `'example.com' `'example.com')) :: %+ expect-eq !>(%.n) - !>((host-matches:http-server-gate `'example.com' `'blah.com')) + !>((host-matches:eyre-gate `'example.com' `'blah.com')) == :: ++ test-cant-remove-other-ducts-binding :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -141,9 +141,9 @@ == :: app1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] @@ -151,9 +151,9 @@ == :: app2 tries to steal the binding by disconnecting the path :: - =^ results3 http-server-gate - %- http-server-call :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.3 scry=scry-provides-code call-args=[duct=~[/app2] ~ [%disconnect [~ /]]] @@ -161,9 +161,9 @@ == :: app2 doesn't bind successfully because it couldn't remove app1's binding :: - =^ results4 http-server-gate - %- http-server-call :* - http-server-gate + =^ results4 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.4 scry=scry-provides-code call-args=[duct=~[/app2] ~ [%connect [~ /] %app2]] @@ -180,9 +180,9 @@ :: ++ test-builtin-four-oh-four :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -190,9 +190,9 @@ == :: when there's no configuration and nothing matches, expect 404 :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code ^= call-args @@ -203,7 +203,7 @@ [%'GET' '/' ~ ~] == ^= expectec-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-blah] %give %response @@ -212,7 +212,7 @@ %+ complete-http-start-event :- 404 ['content-type' 'text/html']~ - [~ (error-page:http-server-gate 404 %.n '/' ~)] + [~ (error-page:eyre-gate 404 %.n '/' ~)] == == == :: @@ -223,9 +223,9 @@ :: ++ test-basic-app-request :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -233,9 +233,9 @@ == :: app1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] @@ -243,9 +243,9 @@ == :: outside requests a path that app1 has bound to :: - =^ results3 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=~1111.1.3 scry=scry-provides-code ^= call-args @@ -256,15 +256,15 @@ [%'GET' '/' ~ ~] == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([* * ~] moves) [%leaf "wrong number of moves: {<(lent moves)>}"]~ :: :: - =/ move-1=move:http-server-gate i.moves - =/ move-2=move:http-server-gate i.t.moves + =/ move-1=move:eyre-gate i.moves + =/ move-2=move:eyre-gate i.t.moves :: %+ weld (expect-eq !>(~[/http-blah]) !>(duct.move-1)) @@ -289,14 +289,14 @@ == :: theoretical outside response :: - =^ results4 http-server-gate - %- http-server-take :* - http-server-gate + =^ results4 eyre-gate + %- eyre-take :* + eyre-gate now=~1111.1.4 scry=scry-provides-code ^= take-args :* wire=/watch-response/[eyre-id] duct=~[/http-blah] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type :* %g %unto %fact %http-response-header @@ -317,9 +317,9 @@ :: ++ test-app-error :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -327,9 +327,9 @@ == :: app1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] @@ -337,9 +337,9 @@ == :: outside requests a path that app1 has bound to :: - =^ results3 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=~1111.1.3 scry=scry-provides-code ^= call-args @@ -350,15 +350,15 @@ [%'GET' '/' ~ ~] == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([* * ~] moves) [[%leaf "wrong number of moves: {<(lent moves)>}"] >moves< ~] :: :: - =/ move-1=move:http-server-gate i.moves - =/ move-2=move:http-server-gate i.t.moves + =/ move-1=move:eyre-gate i.moves + =/ move-2=move:eyre-gate i.t.moves :: %+ weld (expect-eq !>(~[/http-blah]) !>(duct.move-1)) @@ -384,14 +384,14 @@ == :: the poke fails. we should relay this to the client :: - =^ results4 http-server-gate - %- http-server-take :* - http-server-gate + =^ results4 eyre-gate + %- eyre-take :* + eyre-gate now=~1111.1.4 scry=scry-provides-code ^= take-args :* wire=/run-app-request/app1 duct=~[/http-blah] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type :* %g %unto %poke-ack ~ :~ [%leaf "/~zod/...../app1:<[1 1].[1 20]>"] @@ -409,7 +409,7 @@ %+ complete-http-start-event :- 500 ['content-type' 'text/html']~ - [~ (internal-server-error:http-server-gate %.n '/' ~)] + [~ (internal-server-error:eyre-gate %.n '/' ~)] == == == :: ;: weld @@ -421,9 +421,9 @@ :: ++ test-multipart-app-request :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -431,9 +431,9 @@ == :: app1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] @@ -441,9 +441,9 @@ == :: outside requests a path that app1 has bound to :: - =^ results3 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=~1111.1.3 scry=scry-provides-code ^= call-args @@ -454,15 +454,15 @@ [%'GET' '/' ~ ~] == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([* * ~] moves) [%leaf "wrong number of moves: {<(lent moves)>}"]~ :: :: - =/ move-1=move:http-server-gate i.moves - =/ move-2=move:http-server-gate i.t.moves + =/ move-1=move:eyre-gate i.moves + =/ move-2=move:eyre-gate i.t.moves :: %+ weld (expect-eq !>(~[/http-blah]) !>(duct.move-1)) @@ -487,14 +487,14 @@ == :: theoretical outside response :: - =^ results4 http-server-gate - %- http-server-take :* - http-server-gate + =^ results4 eyre-gate + %- eyre-take :* + eyre-gate now=~1111.1.4 scry=scry-provides-code ^= take-args :* wire=/watch-response/[eyre-id] duct=~[/http-blah] - ^- (hypo sign:http-server-gate) :- *type + ^- (hypo sign:eyre-gate) :- *type :* %g %unto %fact %http-response-header !>([200 ['content-type' 'text/html']~]) @@ -506,14 +506,14 @@ == == == :: theoretical outside response :: - =^ results5 http-server-gate - %- http-server-take :* - http-server-gate + =^ results5 eyre-gate + %- eyre-take :* + eyre-gate now=~1111.1.4 scry=scry-provides-code ^= take-args :* wire=/watch-response/[eyre-id] duct=~[/http-blah] - ^- (hypo sign:http-server-gate) :- *type + ^- (hypo sign:eyre-gate) :- *type :* %g %unto %fact %http-response-data !>(`(as-octs:mimes:html 'ya!')) @@ -536,9 +536,9 @@ :: ++ test-login-handler-full-path :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -546,9 +546,9 @@ == :: app1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%connect [~ /'~landscape'] %app1]] @@ -556,9 +556,9 @@ == :: outside requests a path that app1 has bound to :: - =^ results3 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=~1111.1.3 scry=scry-provides-code ^= call-args @@ -569,15 +569,15 @@ [%'GET' '/~landscape/inner-path' ~ ~] == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([* * ~] moves) [%leaf "wrong number of moves: {<(lent moves)>}"]~ :: :: - =/ move-1=move:http-server-gate i.moves - =/ move-2=move:http-server-gate i.t.moves + =/ move-1=move:eyre-gate i.moves + =/ move-2=move:eyre-gate i.t.moves :: %+ weld (expect-eq !>(~[/http-blah]) !>(duct.move-1)) @@ -602,14 +602,14 @@ == :: app then gives a redirect to Eyre :: - =^ results4 http-server-gate - %- http-server-take :* - http-server-gate + =^ results4 eyre-gate + %- eyre-take :* + eyre-gate now=~1111.1.4 scry=scry-provides-code ^= take-args :* wire=/watch-response/[eyre-id] duct=~[/http-blah] - ^- (hypo sign:http-server-gate) :- *type + ^- (hypo sign:eyre-gate) :- *type :* %g %unto %fact %http-response-header !>([307 ['location' '/~/login?redirect=/~landscape/inner-path']~]) @@ -621,21 +621,21 @@ == == == :: the browser then fetches the login page :: - =^ results5 http-server-gate + =^ results5 eyre-gate %- perform-authentication :* - http-server-gate + eyre-gate now=~1111.1.5 scry=scry-provides-code == :: going back to the original url will acknowledge the authentication cookie :: - =^ results6 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results6 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=~1111.1.5..1.0.0 scry=scry-provides-code ^= call-args - ^- [=duct type=* wrapped-task=(hobo task:able:http-server-gate)] + ^- [=duct type=* wrapped-task=(hobo task:able:eyre-gate)] :* duct=~[/http-blah] ~ %request %.n @@ -646,15 +646,15 @@ ~ == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([* * ~] moves) [%leaf "wrong number of moves: {<(lent moves)>}"]~ :: :: - =/ move-1=move:http-server-gate i.moves - =/ move-2=move:http-server-gate i.t.moves + =/ move-1=move:eyre-gate i.moves + =/ move-2=move:eyre-gate i.t.moves :: %+ weld (expect-eq !>(~[/http-blah]) !>(duct.move-1)) @@ -700,9 +700,9 @@ :: ++ test-generator :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -710,9 +710,9 @@ == :: gen1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/gen1] ~ [%serve [~ /] [%home /gen/handler/hoon ~]]] @@ -720,9 +720,9 @@ == :: outside requests a path that app1 has bound to :: - =^ results3 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.3 scry=scry-provides-code ^= call-args @@ -732,95 +732,39 @@ [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~] == - ^= comparator - |= moves=(list move:http-server-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - :: - =/ move=move:http-server-gate i.moves - =/ =duct duct.move - =/ card=(wind note:http-server-gate gift:able:http-server-gate) card.move - :: - ?. ?=(%pass -.card) - [%leaf "not a %pass"]~ - ?. ?=([%f %build *] q.card) - [%leaf "not a ford build"]~ - :: - %+ weld - %+ expect-eq - !> /run-build - !> p.card - :: - %+ expect-schematic - :+ %call - :+ %call - [%core [[~nul %home] /hoon/handler/gen]] - [%$ %noun !>([[~1111.1.3 0xdead.beef [~nul %home [%da ~1111.1.3]]] ~ ~])] - [%$ %noun !>([%.n [%'GET' '/' ~ ~]])] - :: - schematic.q.card + ^= expected-moves + :~ :+ ~[/http-blah] %give + [%response %start [404 headers=~] data=~ complete=%.y] + == == - :: ford response (time assumes nothing blocked) - :: - =^ results4 http-server-gate - %- http-server-take :* - http-server-gate - now=~1111.1.3 - scry=scry-provides-code - ^= take-args - :* wire=/run-build duct=~[/http-blah] - ^- (hypo sign:http-server-gate) - :- *type - :^ %f %made ~1111.1.3 - ^- made-result:ford - :- %complete - ^- build-result:ford - :^ %success %cast %mime - !> - :- [200 ['content-type' 'text/plain']~] - `(as-octs:mimes:html 'one two three') - == - ^= expected-move - :~ :* duct=~[/http-blah] %give %response - %start - :: - %+ complete-http-start-event - :- 200 - ['content-type' 'text/plain']~ - `[13 'one two three'] - == == == :: ;: weld results1 results2 results3 - results4 == :: ++ test-simplified-url-parser ;: weld %+ expect-eq !> `[[%site 'localhost'] [~ 8.000]] - !> (rush 'localhost:8000' simplified-url-parser:http-server-gate) + !> (rush 'localhost:8000' simplified-url-parser:eyre-gate) :: %+ expect-eq !> `[[%ip .192.168.1.1] ~] - !> (rush '192.168.1.1' simplified-url-parser:http-server-gate) + !> (rush '192.168.1.1' simplified-url-parser:eyre-gate) == :: ++ test-parse-channel-request ;: weld %+ expect-eq !> `[%ack 5]~ - !> %- parse-channel-request:http-server-gate + !> %- parse-channel-request:eyre-gate (need (de-json:html '[{"action": "ack", "event-id": 5}]')) :: %+ expect-eq !> `[%poke 0 ~nec %app1 %app-type [%n '5']]~ - !> %- parse-channel-request:http-server-gate + !> %- parse-channel-request:eyre-gate %- need %- de-json:html ''' [{"action": "poke", @@ -833,7 +777,7 @@ :: %+ expect-eq !> `[%subscribe 1 ~sampyl-sipnym %hall /this/path]~ - !> %- parse-channel-request:http-server-gate + !> %- parse-channel-request:eyre-gate %- need %- de-json:html ''' [{"action": "subscribe", @@ -845,7 +789,7 @@ :: %+ expect-eq !> `[%unsubscribe 2 1]~ - !> %- parse-channel-request:http-server-gate + !> %- parse-channel-request:eyre-gate %- need %- de-json:html ''' [{"action": "unsubscribe", @@ -855,19 +799,19 @@ :: %+ expect-eq !> ~ - !> %- parse-channel-request:http-server-gate + !> %- parse-channel-request:eyre-gate %- need %- de-json:html '[{"noaction": "noaction"}]' :: %+ expect-eq !> ~ - !> %- parse-channel-request:http-server-gate + !> %- parse-channel-request:eyre-gate %- need %- de-json:html '[{"action": "bad-action"}]' :: %+ expect-eq !> ~ - !> %- parse-channel-request:http-server-gate + !> %- parse-channel-request:eyre-gate %- need %- de-json:html '[{"action": "ack", "event-id": 5}, {"action": "bad-action"}]' :: @@ -876,7 +820,7 @@ :~ [%ack 9] [%poke 3 ~bud %wut %wut-type [%a [%n '2'] [%n '1'] ~]] == - !> %- parse-channel-request:http-server-gate + !> %- parse-channel-request:eyre-gate %- need %- de-json:html ''' [{"action": "ack", "event-id": 9}, @@ -891,18 +835,18 @@ :: ++ test-channel-reject-unauthenticated :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] expected-moves=~ == :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code ^= call-args @@ -913,7 +857,7 @@ [%'PUT' '/~/channel/1234567890abcdef' ~ ~] == ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-blah] %give %response @@ -923,7 +867,7 @@ :- 403 ['content-type' 'text/html']~ :- ~ - %- error-page:http-server-gate :* + %- error-page:eyre-gate :* 403 %.n '/~/channel/1234567890abcdef' @@ -938,22 +882,22 @@ == :: ++ test-channel-open-never-used-expire - =^ results1 http-server-gate (perform-init-start-channel http-server-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) :: the behn timer wakes us up; we cancel our subscription :: - =^ results2 http-server-gate - %- http-server-take-with-comparator :* - http-server-gate + =^ results2 eyre-gate + %- eyre-take-with-comparator :* + eyre-gate now=(add ~1111.1.2 ~h12) scry=scry-provides-code ^= take-args :* wire=/channel/timeout/'0123456789abcdef' duct=~[/http-blah] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%b %wake ~] == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ~] moves) @@ -974,17 +918,17 @@ ++ test-channel-results-before-open :: common initialization :: - =^ results1 http-server-gate (perform-init-start-channel http-server-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) :: poke gets a success message :: - =^ results2 http-server-gate - %- http-server-take :* - http-server-gate + =^ results2 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m1) scry=scry-provides-code ^= take-args :* wire=/channel/poke/'0123456789abcdef'/'0' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %poke-ack ~] == @@ -992,14 +936,14 @@ == :: subscription gets a success message :: - =^ results3 http-server-gate - %- http-server-take :* - http-server-gate + =^ results3 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m1) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'1' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %watch-ack ~] == @@ -1007,14 +951,14 @@ == :: subscription gets a result :: - =^ results4 http-server-gate - %- http-server-take :* - http-server-gate + =^ results4 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m2) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'1' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %fact %json !>(`json`[%a [%n '1'] [%n '2'] ~])] == @@ -1024,9 +968,9 @@ :: :: send the channel a poke and a subscription request :: - =^ results5 http-server-gate - %- http-server-call :* - http-server-gate + =^ results5 eyre-gate + %- eyre-call :* + eyre-gate now=(add ~1111.1.2 ~m3) scry=scry-provides-code ^= call-args @@ -1040,7 +984,7 @@ ~ == ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-get-open] %pass /channel/heartbeat/'0123456789abcdef' @@ -1081,14 +1025,14 @@ == == == :: we get a cancel when we notice the client has disconnected :: - =^ results6 http-server-gate - %- http-server-call :* - http-server-gate + =^ results6 eyre-gate + %- eyre-call :* + eyre-gate now=(add ~1111.1.2 ~m4) scry=scry-provides-code call-args=[duct=~[/http-get-open] ~ %cancel-request ~] ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :: closing the channel cancels the sse heartbeat :: (initialized in results5 above) and restarts the timeout timer :: @@ -1115,16 +1059,16 @@ ++ test-channel-second-get-updates-timer :: common initialization :: - =^ results1 http-server-gate (perform-init-start-channel http-server-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) :: perform another poke to a different app :: :: Since we haven't connected with a GET, the old timer should be canceled :: and a new one should be set. :: send the channel a poke and a subscription request :: - =^ results2 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=(add ~1111.1.2 ~m1) scry=scry-provides-code ^= call-args @@ -1148,7 +1092,7 @@ ''' == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ^ ^ ^ ~] moves) @@ -1189,17 +1133,17 @@ ++ test-channel-unsubscribe-stops-events :: common initialization :: - =^ results1 http-server-gate (perform-init-start-channel http-server-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) :: poke gets a success message :: - =^ results2 http-server-gate - %- http-server-take :* - http-server-gate + =^ results2 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m1) scry=scry-provides-code ^= take-args :* wire=/channel/poke/'0123456789abcdef'/'0' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %poke-ack ~] == @@ -1207,14 +1151,14 @@ == :: subscription gets a success message :: - =^ results3 http-server-gate - %- http-server-take :* - http-server-gate + =^ results3 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m2) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'1' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %watch-ack ~] == @@ -1222,9 +1166,9 @@ == :: sending an unsubscribe sends an unsubscribe to gall :: - =^ results4 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results4 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=(add ~1111.1.2 ~m3) scry=scry-provides-code ^= call-args @@ -1246,7 +1190,7 @@ ''' == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ^ ^ ^ ~] moves) @@ -1290,17 +1234,17 @@ ++ test-channel-double-subscription-works :: common initialization :: - =^ results1 http-server-gate (perform-init-start-channel http-server-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) :: poke gets a success message :: - =^ results2 http-server-gate - %- http-server-take :* - http-server-gate + =^ results2 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m1) scry=scry-provides-code ^= take-args :* wire=/channel/poke/'0123456789abcdef'/'0' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %poke-ack ~] == @@ -1308,14 +1252,14 @@ == :: subscription gets a success message :: - =^ results3 http-server-gate - %- http-server-take :* - http-server-gate + =^ results3 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m2) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'1' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %watch-ack ~] == @@ -1323,9 +1267,9 @@ == :: now make a second subscription from the client on the same path :: - =^ results3 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=(add ~1111.1.2 ~m3) scry=scry-provides-code ^= call-args @@ -1349,7 +1293,7 @@ ''' == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ^ ^ ^ ~] moves) @@ -1383,14 +1327,14 @@ == == :: subscription gets a result (on the id 1) :: - =^ results4 http-server-gate - %- http-server-take :* - http-server-gate + =^ results4 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m2) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'1' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %fact %json !>(`json`[%a [%n '1'] [%n '2'] ~])] == @@ -1398,14 +1342,14 @@ == :: subscription gets a result (on the id 2) :: - =^ results5 http-server-gate - %- http-server-take :* - http-server-gate + =^ results5 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m2) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'2' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %fact %json !>(`json`[%a [%n '1'] [%n '2'] ~])] == @@ -1413,9 +1357,9 @@ == :: open up the channel :: - =^ results6 http-server-gate - %- http-server-call :* - http-server-gate + =^ results6 eyre-gate + %- eyre-call :* + eyre-gate now=(add ~1111.1.2 ~m3) scry=scry-provides-code ^= call-args @@ -1429,7 +1373,7 @@ ~ == ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-get-open] %pass /channel/heartbeat/'0123456789abcdef' @@ -1473,9 +1417,9 @@ == == == :: we can close the first channel without closing the second :: - =^ results7 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results7 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=(add ~1111.1.2 ~m3) scry=scry-provides-code ^= call-args @@ -1497,7 +1441,7 @@ ''' == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ^ ~] moves) @@ -1519,19 +1463,19 @@ :: This just tests that closing one of the two subscriptions doesn't :: unsubscribe to the other. :: - =^ results8 http-server-gate - %- http-server-take-with-comparator :* - http-server-gate + =^ results8 eyre-gate + %- eyre-take-with-comparator :* + eyre-gate now=(add ~1111.1.2 ~m2) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'2' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %fact %json !>(`json`[%a [%n '1'] [%n '2'] ~])] == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ~] moves) @@ -1570,24 +1514,24 @@ =. q (~(put to q) [3 ~]) =. q (~(put to q) [4 ~]) :: - =. q (prune-events:http-server-gate q 3) + =. q (prune-events:eyre-gate q 3) :: (expect-eq !>([~ [4 ~]]) !>(~(top to q))) :: ++ test-channel-sends-unacknowledged-events-on-reconnection :: common initialization :: - =^ results1 http-server-gate (perform-init-start-channel http-server-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) :: poke gets a success message :: - =^ results2 http-server-gate - %- http-server-take :* - http-server-gate + =^ results2 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m1) scry=scry-provides-code ^= take-args :* wire=/channel/poke/'0123456789abcdef'/'0' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %poke-ack ~] == @@ -1595,14 +1539,14 @@ == :: subscription gets a success message :: - =^ results3 http-server-gate - %- http-server-take :* - http-server-gate + =^ results3 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m2) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'1' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %watch-ack ~] == @@ -1610,13 +1554,13 @@ == :: opens the http channel :: - =^ results4 http-server-gate - %- http-server-call :* - http-server-gate + =^ results4 eyre-gate + %- eyre-call :* + eyre-gate now=(add ~1111.1.2 ~m3) scry=scry-provides-code ^= call-args - ^- [duct * (hobo task:able:http-server-gate)] + ^- [duct * (hobo task:able:eyre-gate)] :* duct=~[/http-get-open] ~ %request %.n @@ -1627,7 +1571,7 @@ ~ == ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-get-open] %pass /channel/heartbeat/'0123456789abcdef' @@ -1665,19 +1609,19 @@ == == == :: first subscription result gets sent to the user :: - =^ results5 http-server-gate - %- http-server-take :* - http-server-gate + =^ results5 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m4) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'1' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %fact %json !>(`json`[%a [%n '1'] ~])] == ^= moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-get-open] %give %response @@ -1696,9 +1640,9 @@ :: :: send the channel a poke and a subscription request :: - =^ results6 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results6 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=(add ~1111.1.2 ~m5) scry=scry-provides-code ^= call-args @@ -1719,7 +1663,7 @@ ''' == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ~] moves) @@ -1731,14 +1675,14 @@ == :: the client connection is detected to be broken :: - =^ results7 http-server-gate - %- http-server-call :* - http-server-gate + =^ results7 eyre-gate + %- eyre-call :* + eyre-gate now=(add ~1111.1.2 ~m6) scry=scry-provides-code call-args=[duct=~[/http-get-open] ~ %cancel-request ~] ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :: closing the channel cancels the sse heartbeat :: (initialized in results4 above) and restarts the timeout timer :: @@ -1753,14 +1697,14 @@ == :: another subscription result while the user is disconnected :: - =^ results8 http-server-gate - %- http-server-take :* - http-server-gate + =^ results8 eyre-gate + %- eyre-take :* + eyre-gate now=(add ~1111.1.2 ~m7) scry=scry-provides-code ^= take-args :* wire=/channel/subscription/'0123456789abcdef'/'1' duct=~[/http-put-request] - ^- (hypo sign:http-server-gate) + ^- (hypo sign:eyre-gate) :- *type [%g %unto %fact %json !>(`json`[%a [%n '2'] ~])] == @@ -1771,9 +1715,9 @@ :: Because the client has acknowledged up to event 1, we should start the connection by :: resending events 2 and 3. :: - =^ results9 http-server-gate - %- http-server-call :* - http-server-gate + =^ results9 eyre-gate + %- eyre-call :* + eyre-gate now=(add ~1111.1.2 ~m8) scry=scry-provides-code ^= call-args @@ -1787,7 +1731,7 @@ ~ == ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-get-open] %pass /channel/heartbeat/'0123456789abcdef' @@ -1840,9 +1784,9 @@ :: ++ test-born-sends-pending-cancels :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -1850,9 +1794,9 @@ == :: app1 binds successfully :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.2 scry=scry-provides-code call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] @@ -1862,9 +1806,9 @@ :: :: outside requests a path that app1 has bound to :: - =^ results3 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=~1111.1.3 scry=scry-provides-code ^= call-args @@ -1875,14 +1819,14 @@ [%'GET' '/' ~ ~] == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([* * ~] moves) [%leaf "wrong number of moves: {<(lent moves)>}"]~ :: - =/ move-1=move:http-server-gate i.moves - =/ move-2=move:http-server-gate i.t.moves + =/ move-1=move:eyre-gate i.moves + =/ move-2=move:eyre-gate i.t.moves :: %+ weld (expect-eq !>(~[/http-blah]) !>(duct.move-1)) @@ -1908,14 +1852,14 @@ :: but app1 doesn't respond before our urbit gets shut down. ensure we send :: cancels on open connections. :: - =^ results4 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results4 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=~1111.1.4 scry=scry-provides-code call-args=[duct=~[/born] ~ [%born ~]] ^= expected-moves - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ^ ~] moves) @@ -1924,9 +1868,9 @@ :: we don't care about the first one, which is just a static :: configuration move. :: - =/ move=move:http-server-gate i.t.moves + =/ move=move:eyre-gate i.t.moves =/ =duct duct.move - =/ card=(wind note:http-server-gate gift:able:http-server-gate) card.move + =/ card=(wind note:eyre-gate gift:able:eyre-gate) card.move :: %+ weld (expect-eq !>(~[/http-blah]) !>(duct)) @@ -1944,83 +1888,85 @@ results4 == :: -++ http-server-call - |= $: http-server-gate=_http-server-gate +++ eyre-call + |= $: eyre-gate=_eyre-gate now=@da scry=sley - call-args=[=duct type=* wrapped-task=(hobo task:able:http-server-gate)] - expected-moves=(list move:http-server-gate) + call-args=[=duct type=* wrapped-task=(hobo task:able:eyre-gate)] + expected-moves=(list move:eyre-gate) == - ^- [tang _http-server-gate] + ^- [tang _eyre-gate] :: - =/ http-server-core (http-server-gate our=~nul now=now eny=`@uvJ`0xdead.beef scry=scry) + =/ eyre-core + (eyre-gate our=~nul now=now eny=`@uvJ`0xdead.beef scry=scry) :: - =^ moves http-server-gate (call:http-server-core [duct ~ type wrapped-task]:call-args) + =^ moves eyre-gate + (call:eyre-core [duct ~ type wrapped-task]:call-args) :: =/ output=tang %+ expect-eq !> expected-moves !> moves :: - [output http-server-gate] + [output eyre-gate] :: -++ http-server-call-with-comparator - |= $: http-server-gate=_http-server-gate +++ eyre-call-with-comparator + |= $: eyre-gate=_eyre-gate now=@da scry=sley - call-args=[=duct type=* wrapped-task=(hobo task:able:http-server-gate)] - move-comparator=$-((list move:http-server-gate) tang) + call-args=[=duct type=* wrapped-task=(hobo task:able:eyre-gate)] + move-comparator=$-((list move:eyre-gate) tang) == - ^- [tang _http-server-gate] + ^- [tang _eyre-gate] :: - =/ http-server-core (http-server-gate our=~nul now=now eny=`@uvJ`0xdead.beef scry=scry) + =/ eyre-core (eyre-gate our=~nul now=now eny=`@uvJ`0xdead.beef scry=scry) :: - =^ moves http-server-gate (call:http-server-core [duct ~ type wrapped-task]:call-args) + =^ moves eyre-gate (call:eyre-core [duct ~ type wrapped-task]:call-args) :: =/ output=tang (move-comparator moves) :: - [output http-server-gate] + [output eyre-gate] :: -++ http-server-take - |= $: http-server-gate=_http-server-gate +++ eyre-take + |= $: eyre-gate=_eyre-gate now=@da scry=sley - take-args=[=wire =duct wrapped-sign=(hypo sign:http-server-gate)] - expected-moves=(list move:http-server-gate) + take-args=[=wire =duct wrapped-sign=(hypo sign:eyre-gate)] + expected-moves=(list move:eyre-gate) == - ^- [tang _http-server-gate] + ^- [tang _eyre-gate] :: - =/ http-server-core (http-server-gate our=~nul now=now eny=`@uvJ`0xdead.beef scry=scry) + =/ eyre-core (eyre-gate our=~nul now=now eny=`@uvJ`0xdead.beef scry=scry) :: - =^ moves http-server-gate (take:http-server-core [wire duct ~ wrapped-sign]:take-args) + =^ moves eyre-gate (take:eyre-core [wire duct ~ wrapped-sign]:take-args) :: =/ output=tang %+ expect-eq !> expected-moves !> moves :: - [output http-server-gate] + [output eyre-gate] :: -++ http-server-take-with-comparator - |= $: http-server-gate=_http-server-gate +++ eyre-take-with-comparator + |= $: eyre-gate=_eyre-gate now=@da scry=sley - take-args=[=wire =duct wrapped-sign=(hypo sign:http-server-gate)] - move-comparator=$-((list move:http-server-gate) tang) + take-args=[=wire =duct wrapped-sign=(hypo sign:eyre-gate)] + move-comparator=$-((list move:eyre-gate) tang) == - ^- [tang _http-server-gate] + ^- [tang _eyre-gate] :: - =/ http-server-core (http-server-gate our=~nul now=now eny=`@uvJ`0xdead.beef scry=scry) + =/ eyre-core (eyre-gate our=~nul now=now eny=`@uvJ`0xdead.beef scry=scry) :: - =^ moves http-server-gate (take:http-server-core [wire duct ~ wrapped-sign]:take-args) + =^ moves eyre-gate (take:eyre-core [wire duct ~ wrapped-sign]:take-args) :: =/ output=tang (move-comparator moves) :: - [output http-server-gate] + [output eyre-gate] :: ++ expect-gall-deal |= $: expected=[wire=path id=sock app=term =deal:gall] - actual=(wind note:http-server-gate gift:able:http-server-gate) + actual=(wind note:eyre-gate gift:able:eyre-gate) == ^- tang :: @@ -2030,7 +1976,7 @@ %+ weld (expect-eq !>(wire.expected) !>(p.actual)) :: - =/ note=note:http-server-gate q.actual + =/ note=note:eyre-gate q.actual ?. ?=([%g %deal *] note) [%leaf "bad move, not a %deal: {}"]~ :: @@ -2094,16 +2040,16 @@ :: +perform-authentication: goes through the authentication flow :: ++ perform-authentication - |= $: http-server-gate=_http-server-gate + |= $: eyre-gate=_eyre-gate start-now=@da scry=sley == - ^- [tang _http-server-gate] + ^- [tang _eyre-gate] :: the browser then fetches the login page :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=start-now scry=scry-provides-code ^= call-args @@ -2114,7 +2060,7 @@ [%'GET' '/~/login?redirect=/~landscape/inner-path' ~ ~] == ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-blah] %give %response @@ -2123,14 +2069,14 @@ %+ complete-http-start-event :- 200 ['content-type' 'text/html']~ - [~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)] + [~ (login-page:eyre-gate `'/~landscape/inner-path' ~nul)] == == == :: a response post redirects back to the application, setting cookie :: - =^ results2 http-server-gate - %- http-server-call :* - http-server-gate + =^ results2 eyre-gate + %- eyre-call :* + eyre-gate now=(add start-now ~m1) scry=scry-provides-code ^= call-args @@ -2146,7 +2092,7 @@ 'password=lidlut-tabwed-pillex-ridrup&redirect=/~landscape' == ^= expected-moves - ^- (list move:http-server-gate) + ^- (list move:eyre-gate) :~ :* duct=~[/http-blah] %give %response @@ -2161,19 +2107,19 @@ == == == :: - :_ http-server-gate + :_ eyre-gate (weld results1 results2) :: performs all initialization and an initial PUT. :: ++ perform-init-start-channel - |= $: http-server-gate=_http-server-gate + |= $: eyre-gate=_eyre-gate scry=sley == - ^- [tang _http-server-gate] + ^- [tang _eyre-gate] :: - =^ results1 http-server-gate - %- http-server-call :* - http-server-gate + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate now=~1111.1.1 scry=scry-provides-code call-args=[duct=~[/init] ~ [%init ~nul]] @@ -2181,17 +2127,17 @@ == :: ensure there's an authenticated session :: - =^ results2 http-server-gate + =^ results2 eyre-gate %- perform-authentication :* - http-server-gate + eyre-gate now=~1111.1.2 scry=scry-provides-code == :: send the channel a poke and a subscription request :: - =^ results3 http-server-gate - %- http-server-call-with-comparator :* - http-server-gate + =^ results3 eyre-gate + %- eyre-call-with-comparator :* + eyre-gate now=~1111.1.2 scry=scry-provides-code ^= call-args @@ -2221,7 +2167,7 @@ ''' == ^= comparator - |= moves=(list move:http-server-gate) + |= moves=(list move:eyre-gate) ^- tang :: ?. ?=([^ ^ ^ ^ ~] moves) @@ -2254,12 +2200,15 @@ !> i.t.t.t.moves == == :: - :_ http-server-gate + :_ eyre-gate :(weld results1 results2 results3) :: ++ scry-provides-code ^- sley |= [* (unit (set monk)) =term =beam] ^- (unit (unit cage)) + ?: &(=(%ca term) =(/hoon/handler/gen s.beam)) + :+ ~ ~ + vase+!>(!>(|=(* |=(* [[%404 ~] ~])))) :: ?> =(%j term) ?> =(~nul p.beam) From 2be61eaac9a1f67b69cd494f645bb181da796f04 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 8 May 2020 01:29:47 -0400 Subject: [PATCH 099/280] /mar: all marks build --- pkg/arvo/mar/htm.hoon | 1 + pkg/arvo/mar/x-htm.hoon | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/arvo/mar/htm.hoon b/pkg/arvo/mar/htm.hoon index 4816236e3..98f2ab819 100644 --- a/pkg/arvo/mar/htm.hoon +++ b/pkg/arvo/mar/htm.hoon @@ -7,6 +7,7 @@ ++ grad %noun ++ grow :: convert to |% + ++ noun own ++ hymn own -- ++ grab |% :: convert from diff --git a/pkg/arvo/mar/x-htm.hoon b/pkg/arvo/mar/x-htm.hoon index fbf289591..c4c1a6b20 100644 --- a/pkg/arvo/mar/x-htm.hoon +++ b/pkg/arvo/mar/x-htm.hoon @@ -7,5 +7,6 @@ ++ grow |% ++ htm a + ++ noun a -- -- From edfcb389dbeb1e67a8fe1a1fc9ffde22a77bea8e Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 8 May 2020 15:33:04 +1000 Subject: [PATCH 100/280] links: namespace store types and lib --- pkg/arvo/app/link-listen-hook.hoon | 22 +++++++++-------- pkg/arvo/app/link-proxy-hook.hoon | 6 ++--- pkg/arvo/app/link-store.hoon | 39 +++++++++++++++--------------- pkg/arvo/app/link-view.hoon | 36 +++++++++++++-------------- pkg/arvo/lib/link-store.hoon | 9 ++++--- pkg/arvo/mar/link/action.hoon | 2 +- pkg/arvo/sur/link-store.hoon | 1 + 7 files changed, 61 insertions(+), 54 deletions(-) diff --git a/pkg/arvo/app/link-listen-hook.hoon b/pkg/arvo/app/link-listen-hook.hoon index 36279eb8e..614e2c26c 100644 --- a/pkg/arvo/app/link-listen-hook.hoon +++ b/pkg/arvo/app/link-listen-hook.hoon @@ -14,8 +14,8 @@ :: to expede this process, we prod other potential listeners when we add :: them to our metadata+groups definition. :: -/- *link, link-listen-hook, *metadata-store, *link-store, group-store -/+ mdl=metadata, default-agent, verb, dbug +/- *link, link-listen-hook, *metadata-store, group-store +/+ mdl=metadata, default-agent, verb, dbug, store=link-store :: ~% %link-listen-hook-top ..is ~ |% @@ -500,11 +500,11 @@ ?+ mark ~|([dap.bowl %unexpected-mark mark] !!) %link-initial %- handle-link-initial - [who.target where.target !<(initial vase)] + [who.target where.target !<(initial:store vase)] :: %link-update %- handle-link-update - [who.target where.target !<(update vase)] + [who.target where.target !<(update:store vase)] == == :: @@ -546,7 +546,7 @@ group-path :: ++ do-link-action - |= [=wire =action] + |= [=wire =action:store] ^- card :* %pass wire @@ -558,7 +558,7 @@ == :: ++ handle-link-initial - |= [who=ship where=path =initial] + |= [who=ship where=path =initial:store] ^- (quip card _state) ?> =(src.bowl who) ?+ -.initial ~|([dap.bowl %unexpected-initial -.initial] !!) @@ -580,7 +580,7 @@ == :: ++ handle-link-update - |= [who=ship where=path =update] + |= [who=ship where=path =update:store] ^- (quip card _state) ?> =(src.bowl who) :_ state @@ -594,11 +594,13 @@ :: %annotations %+ turn notes.update - |= =note + |= =^note ^- card + ~! who + ~! note %+ do-link-action - [%forward %annotation (scot %p who) where] - [%read where url.update who note] + `wire`[%forward %annotation (scot %p who) where] + `action:store`[%read where url.update `comment`[who note]] == :: ++ take-forward-sign diff --git a/pkg/arvo/app/link-proxy-hook.hoon b/pkg/arvo/app/link-proxy-hook.hoon index e9671916d..aeaa4b247 100644 --- a/pkg/arvo/app/link-proxy-hook.hoon +++ b/pkg/arvo/app/link-proxy-hook.hoon @@ -19,8 +19,8 @@ :: when adding support for new paths, the only things you'll likely want :: to touch are +permitted, +initial-response, & +kick-proxies. :: -/- group-store, *metadata-store -/+ *link-store, metadata, default-agent, verb, dbug +/- *link, group-store, *metadata-store +/+ store=link-store, metadata, default-agent, verb, dbug ~% %link-proxy-hook-top ..is ~ |% +$ state-0 @@ -269,7 +269,7 @@ ++ initial-response |= =path ^- card - =; =initial + =; =initial:store [%give %fact ~ %link-initial !>(initial)] ?+ path !! [%local-pages ^] diff --git a/pkg/arvo/app/link-store.hoon b/pkg/arvo/app/link-store.hoon index 082bb5106..fed3d1206 100644 --- a/pkg/arvo/app/link-store.hoon +++ b/pkg/arvo/app/link-store.hoon @@ -50,7 +50,8 @@ :: ? :: /seen/wood-url/some-path have we seen this here :: -/+ *link-store, default-agent, verb, dbug +/- *link +/+ store=link-store, default-agent, verb, dbug :: |% +$ state-0 @@ -101,8 +102,8 @@ =^ cards state ?+ mark (on-poke:def mark vase) ::TODO move json conversion into mark once mark performance improves - %json (do-action:do (action:de-json !<(json vase))) - %link-action (do-action:do !<(action vase)) + %json (do-action:do (action:dejs:store !<(json vase))) + %link-action (do-action:do !<(action:store vase)) == [cards this] :: @@ -121,7 +122,7 @@ :: [%y ?(%annotations %discussions) *] =/ [spath=^path surl=url] - (break-discussion-path t.t.path) + (break-discussion-path:store t.t.path) =- ``noun+!>(-) :: ?: =(~ surl) @@ -174,22 +175,22 @@ |^ ?+ path (on-watch:def path) [%local-pages *] %+ give %link-initial - ^- initial + ^- initial:store [%local-pages (get-local-pages:do t.path)] :: [%submissions *] %+ give %link-initial - ^- initial + ^- initial:store [%submissions (get-submissions:do t.path)] :: [%annotations *] %+ give %link-initial - ^- initial + ^- initial:store [%annotations (get-annotations:do t.path)] :: [%discussions *] %+ give %link-initial - ^- initial + ^- initial:store [%discussions (get-discussions:do t.path)] :: [%seen ~] @@ -218,7 +219,7 @@ :: writing :: ++ do-action - |= =action + |= =action:store ^- (quip card _state) ?- -.action %save (save-page +.action) @@ -284,8 +285,8 @@ :+ %give %fact :+ :~ /annotations [%annotations %$ path] - [%annotations (build-discussion-path url)] - [%annotations (build-discussion-path path url)] + [%annotations (build-discussion-path:store url)] + [%annotations (build-discussion-path:store path url)] == %link-update !>([%annotations path url [note]~]) @@ -324,11 +325,11 @@ ?: ?=(^ (find ~[submission] submissions.links)) [| submissions.links] :- & - (submissions:merge submissions.links ~[submission]) + (submissions:merge:store submissions.links ~[submission]) =. by-group (~(put by by-group) path links) :: add submission to global sites :: - =/ =site (site-from-url url.submission) + =/ =site (site-from-url:store url.submission) =. by-site (~(add ja by-site) site [path submission]) :: send updates to subscribers :: @@ -354,7 +355,7 @@ ?: ?=(^ (find ~[comment] comments.discussion)) [| comments.discussion] :- & - (comments:merge comments.discussion ~[comment]) + (comments:merge:store comments.discussion ~[comment]) =. urls (~(put by urls) url discussion) =. discussions (~(put by discussions) path urls) :: send updates to subscribers @@ -365,8 +366,8 @@ :+ %give %fact :+ :~ /discussions [%discussions '' path] - [%discussions (build-discussion-path url)] - [%discussions (build-discussion-path path url)] + [%discussions (build-discussion-path:store url)] + [%discussions (build-discussion-path:store path url)] == %link-update !>([%discussions path url [comment]~]) @@ -420,7 +421,7 @@ |= =path ^- ? =/ [=^path =url] - (break-discussion-path path) + (break-discussion-path:store path) %. url %~ has in seen:(~(gut by by-group) path *links) @@ -430,7 +431,7 @@ |= =path ^- (per-path-url notes) =/ args=[=^path =url] - (break-discussion-path path) + (break-discussion-path:store path) |^ ?~ path :: all paths :: @@ -460,7 +461,7 @@ |= =path ^- (per-path-url comments) =/ args=[=^path =url] - (break-discussion-path path) + (break-discussion-path:store path) |^ ?~ path :: all paths :: diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index 5b2a8fb38..c8943b288 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -10,12 +10,12 @@ :: /json/[n]/submission/[wood-url]/[collection] nth matching submission :: /json/seen mark-as-read updates :: -/- *link-view, +/- *link, *link-view, *invite-store, group-store, link-listen-hook, group-hook, permission-hook, permission-group-hook, metadata-hook, contact-view -/+ *link-store, metadata, *server, default-agent, verb, dbug +/+ store=link-store, metadata, *server, default-agent, verb, dbug ~% %link-view-top ..is ~ :: |% @@ -77,7 +77,7 @@ handle-http-request:do :: %link-action - [(handle-action:do !<(action vase)) ~] + [(handle-action:do !<(action:store vase)) ~] :: %link-view-action (handle-view-action:do !<(view-action vase)) @@ -107,11 +107,11 @@ :: [%submission @ ^] :_ this - (give-specific-submission:do p (break-discussion-path t.t.t.path)) + (give-specific-submission:do p (break-discussion-path:store t.t.t.path)) :: [%discussions @ ^] :_ this - (give-initial-discussions:do p (break-discussion-path t.t.t.path)) + (give-initial-discussions:do p (break-discussion-path:store t.t.t.path)) == :: ++ on-agent @@ -135,7 +135,7 @@ :: %link-update :_ this - :- (send-update:do !<(update vase)) + :- (send-update:do !<(update:store vase)) ?: =(/discussions wire) ~ ~[give-tile-data:do] == @@ -268,7 +268,7 @@ == :: ++ handle-action - |= =action + |= =action:store ^- card [%pass /action %agent [our.bowl %link-store] %poke %link-action !>(action)] :: @@ -533,7 +533,7 @@ submissions |= =submission ^- json - =/ =json (submission:en-json submission) + =/ =json (submission:enjs:store submission) ?> ?=([%o *] json) :: add in seen status :: @@ -541,7 +541,7 @@ %+ ~(put by p.json) 'seen' :- %b %+ scry-for ? - [%seen (build-discussion-path path url.submission)] + [%seen (build-discussion-path:store path url.submission)] :: add in comment count :: =; comment-count=@ud @@ -554,7 +554,7 @@ =- (~(got by (~(got by -) path)) url.submission) %+ scry-for (per-path-url comments) :- %discussions - (build-discussion-path path url.submission) + (build-discussion-path:store path url.submission) :: ++ give-specific-submission |= [n=@ud =path =url] @@ -565,7 +565,7 @@ ^- json =; sub=(unit submission) ?~ sub ~ - (submission:en-json u.sub) + (submission:enjs:store u.sub) =/ =submissions =- (~(got by -) path) %+ scry-for (map ^path submissions) @@ -590,30 +590,30 @@ %+ get-paginated `p =- (~(got by (~(got by -) path)) url) %+ scry-for (per-path-url comments) - [%discussions (build-discussion-path path url)] - comment:en-json + [%discussions (build-discussion-path:store path url)] + comment:enjs:store :: ++ send-update - |= =update + |= =update:store ^- card ?+ -.update ~|([dap.bowl %unexpected-update -.update] !!) %submissions %+ give-json - (update:en-json update) + (update:enjs:store update) :~ /json/0/submissions (weld /json/0/submissions path.update) == :: %discussions %+ give-json - (update:en-json update) + (update:enjs:store update) :_ ~ %+ weld /json/0/discussions - (build-discussion-path [path url]:update) + (build-discussion-path:store [path url]:update) :: %observation %+ give-json - (update:en-json update) + (update:enjs:store update) ~[/json/seen] == :: diff --git a/pkg/arvo/lib/link-store.hoon b/pkg/arvo/lib/link-store.hoon index 4983ef1cd..85098aad5 100644 --- a/pkg/arvo/lib/link-store.hoon +++ b/pkg/arvo/lib/link-store.hoon @@ -1,7 +1,10 @@ :: link: social bookmarking :: -/- *link-store +/- sur=link-store, *link :: +^? +=< [. sur] +=, sur |% ++ site-from-url |= =url @@ -92,7 +95,7 @@ [a b] -- :: -++ en-json +++ enjs =, enjs:format |% ++ update @@ -166,7 +169,7 @@ == -- :: -++ de-json +++ dejs =, dejs:format |% :: +action: json into action diff --git a/pkg/arvo/mar/link/action.hoon b/pkg/arvo/mar/link/action.hoon index d9be57b19..13a8ff0f2 100644 --- a/pkg/arvo/mar/link/action.hoon +++ b/pkg/arvo/mar/link/action.hoon @@ -11,6 +11,6 @@ ++ grab |% ++ noun ^action - ++ json action:de-json + ++ json action:dejs -- -- diff --git a/pkg/arvo/sur/link-store.hoon b/pkg/arvo/sur/link-store.hoon index a76cbbd4c..264619039 100644 --- a/pkg/arvo/sur/link-store.hoon +++ b/pkg/arvo/sur/link-store.hoon @@ -1,6 +1,7 @@ :: link-store: store specific types :: /- *link +^? |% :: :: +action: local actions From f64c8f05edeeab4005a2484b92f1f11b26dc938f Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 8 May 2020 15:40:23 +1000 Subject: [PATCH 101/280] links: namespace listen-hook types and lib --- pkg/arvo/app/link-listen-hook.hoon | 8 ++++---- pkg/arvo/app/link-view.hoon | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/app/link-listen-hook.hoon b/pkg/arvo/app/link-listen-hook.hoon index 614e2c26c..15af6d3df 100644 --- a/pkg/arvo/app/link-listen-hook.hoon +++ b/pkg/arvo/app/link-listen-hook.hoon @@ -14,7 +14,7 @@ :: to expede this process, we prod other potential listeners when we add :: them to our metadata+groups definition. :: -/- *link, link-listen-hook, *metadata-store, group-store +/- *link, listen-hook=link-listen-hook, *metadata-store, group-store /+ mdl=metadata, default-agent, verb, dbug, store=link-store :: ~% %link-listen-hook-top ..is ~ @@ -167,7 +167,7 @@ ?> (team:title [our src]:bowl) =^ cards state ~| p.vase - (handle-listen-action:do !<(action:link-listen-hook vase)) + (handle-listen-action:do !<(action:listen-hook vase)) [cards this] == :: @@ -218,7 +218,7 @@ :: user actions & updates :: ++ handle-listen-action - |= =action:link-listen-hook + |= =action:listen-hook ^- (quip card _state) ::NOTE no-opping where appropriate happens further down the call stack. :: we *could* no-op here, as %watch when we're already listening should @@ -250,7 +250,7 @@ $(cards (weld cards more-cards), groups t.groups) :: ++ send-update - |= =update:link-listen-hook + |= =update:listen-hook ^- card [%give %fact ~[/listening] %link-listen-update !>(update)] :: diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index c8943b288..f117d2b78 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -12,7 +12,7 @@ :: /- *link, *link-view, *invite-store, group-store, - link-listen-hook, + listen-hook=link-listen-hook, group-hook, permission-hook, permission-group-hook, metadata-hook, contact-view /+ store=link-store, metadata, *server, default-agent, verb, dbug @@ -320,7 +320,7 @@ :: %^ do-poke %link-listen-hook %link-listen-action - !> ^- action:link-listen-hook + !> ^- action:listen-hook [%watch path] == ?: ?=(%group -.members) ~ From 2946eb55cbd50b3bc5466643c0fe1da82e7e34ab Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 8 May 2020 16:07:44 +1000 Subject: [PATCH 102/280] links: namespace view types --- pkg/arvo/app/link-view.hoon | 8 ++++---- pkg/arvo/mar/link/view-action.hoon | 4 ++-- pkg/arvo/sur/link-view.hoon | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index f117d2b78..59f74566b 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -10,7 +10,7 @@ :: /json/[n]/submission/[wood-url]/[collection] nth matching submission :: /json/seen mark-as-read updates :: -/- *link, *link-view, +/- *link, view=link-view, *invite-store, group-store, listen-hook=link-listen-hook, group-hook, permission-hook, permission-group-hook, @@ -80,7 +80,7 @@ [(handle-action:do !<(action:store vase)) ~] :: %link-view-action - (handle-view-action:do !<(view-action vase)) + (handle-view-action:do !<(action:view vase)) == :: ++ on-watch @@ -273,7 +273,7 @@ [%pass /action %agent [our.bowl %link-store] %poke %link-action !>(action)] :: ++ handle-view-action - |= act=view-action + |= act=action:view ^- (list card) ?- -.act %create (handle-create +.act) @@ -282,7 +282,7 @@ == :: ++ handle-create - |= [=path title=@t description=@t members=create-members real-group=?] + |= [=path title=@t description=@t members=create-members:view real-group=?] ^- (list card) =/ group-path=^path ?- -.members diff --git a/pkg/arvo/mar/link/view-action.hoon b/pkg/arvo/mar/link/view-action.hoon index f32241a34..b8e7e7969 100644 --- a/pkg/arvo/mar/link/view-action.hoon +++ b/pkg/arvo/mar/link/view-action.hoon @@ -1,9 +1,9 @@ /- *link-view =, dejs:format -|_ act=view-action +|_ act=action ++ grab |% - ++ noun view-action + ++ noun action ++ json |^ %- of :~ %create^create diff --git a/pkg/arvo/sur/link-view.hoon b/pkg/arvo/sur/link-view.hoon index ae1d40221..db3e2f4a9 100644 --- a/pkg/arvo/sur/link-view.hoon +++ b/pkg/arvo/sur/link-view.hoon @@ -1,7 +1,7 @@ :: link-view: encapsulating link management :: |% -++ view-action +++ action $% :: %create: create a new link collection :: :: with specified metadata and group. %ships creates a new group, From b32ca5d222f16512d6b7723f869aaa84aa1bf07e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 8 May 2020 02:18:24 -0400 Subject: [PATCH 103/280] /sys: kernel upgrades seem to work --- pkg/arvo/sys/arvo.hoon | 17 +++++++++++------ pkg/arvo/sys/vane/clay.hoon | 4 ++-- pkg/arvo/sys/vane/dill.hoon | 4 ---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 309527bdc..db44fecc9 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1233,7 +1233,7 @@ :: compile the hoon.hoon source with the current compiler :: =/ raw - ~& [%hoon-compile `@p`(mug hun)] + ~> %slog.[0 leaf+"vega: compiling hoon"] (ride %noun hun) :: activate the new compiler gate, producing +ride :: @@ -1249,6 +1249,7 @@ :: => ?: =(nex hoon-version) [hot=`*`raw .] + ~> %slog.[0 leaf+"vega: recompiling hoon {}k"] ~& [%hoon-compile-upgrade nex] =/ hot (slum cop [%noun hun]) .(cop .*(0 +.hot)) @@ -1261,15 +1262,17 @@ :: compile arvo :: =/ rav - ~& [%arvo-compile `@p`(mug hyp) `@p`(mug van)] + ~> %slog.[0 leaf+"vega: compiling kernel {(scow %p (mug hyp))}"] (slum cop [hyp van]) :: activate arvo, and extract the arvo core from the outer gate :: + ~> %slog.[0 leaf+"vega: extracting core"] =/ voc .*(hoc [%7 +.rav %0 7]) :: entry gate: ++load for the normal case, ++come for upgrade :: =/ gat =/ arm ?:(=(nex hoon-version) 'load' 'come') + ~> %slog.[0 leaf+"vega: +{(trip arm)}"] :: compute the type of the arvo.hoon core :: =/ vip -:(slum cop [-.rav '+>']) @@ -1291,6 +1294,8 @@ == :: call into the new kernel :: + ~> %slog.[0 leaf+"vega: evolving"] + ~< %slog.[0 leaf+"vega: evolution"] =/ out (slum gat sam) :: add types to the product :: @@ -1303,8 +1308,8 @@ ++ veer |= [who=ship now=@da fav=curd] ^+ soul - => .(fav ;;({$veer lal/@ta pax/path txt/@t} fav)) - ~| veer+lal.fav + => .(fav ;;({$veer lal/@tas pax/path txt/@t} fav)) + ~| veer+[lal.fav pax.fav] ?: =(%$ lal.fav) ~> %slog.[0 leaf+"zuse: {(scow p+(mug txt.fav))}"] =+ gen=(rain pax.fav txt.fav) @@ -1314,14 +1319,14 @@ vanes |- ^+ vanes ?~ vanes - ~> %slog.[0 leaf+"{(trip lal.fav)}: {(scow p+(mug txt.fav))}"] + ~> %slog.[0 leaf+"vane: {} {(scow p+(mug txt.fav))}"] =+ vin=(vint who lal.fav vil bud pax.fav txt.fav) ?~ vin vanes [[lal.fav vane:u.vin] vanes] ?. =(lal.fav label.i.vanes) [i.vanes $(vanes t.vanes)] - ~> %slog.[0 leaf+"{(trip lal.fav)}: {(scow p+(mug txt.fav))}"] + ~> %slog.[0 leaf+"vane: {} {(scow p+(mug txt.fav))}"] :_ t.vanes :- label.i.vanes ~| [%failed-vane-activation now lal.fav] diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 43a11e549..f43a81521 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3560,8 +3560,8 @@ =/ =args:ford:fusion [ank.dom deletes changes lat.ran fod.dom] :: - :: ?: &(!updated !=(~ (need-sys-update changes))) - :: (sys-update args yuki changes) + ?: &(!updated !=(~ (need-sys-update changes))) + (sys-update args yoki changes) :: =. ..park (emil (print deletes ~(key by changes))) =^ change-cages ford-cache.args diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index b3290067f..5e9b46251 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -275,7 +275,6 @@ :: make kids desk publicly readable, so syncs work. :: (show %kids):(sync %kids our %base) - =. +> autoload =. +> hood-set-boot-apps =. +> peer |- ^+ +>+ @@ -308,9 +307,6 @@ |= syn/{desk ship desk} (deal /sync [%poke %hood-sync -:!>(syn) syn]) :: - ++ autoload - (deal /autoload [%poke %kiln-start-autoload [%atom %n `~] ~]) - :: ++ take :: receive |= {tea/wire sih/sign} ^+ +> From 717d6e1b70c19e4d22a2f7482e98a91f29c794b5 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 8 May 2020 06:02:54 -0400 Subject: [PATCH 104/280] arvo: unvirtualize vane installation --- pkg/arvo/sys/arvo.hoon | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index db44fecc9..d5fbab248 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -844,8 +844,6 @@ ++ ruck :: update vase |= {pax/path txt/@ta} ^+ +> - =- ?:(?=(%| -.res) ((slog p.res) +>.$) p.res) - ^= res %- mule |. :: XX should use real entropy and the real date :: =/ arg=vane-sample @@ -895,13 +893,11 @@ pax=path txt=@ta == - =- ?:(?=(%| -.res) ((slog p.res) ~) (some p.res)) - ^= res %- mule |. ~| [%failed-vint lal] =+ gen=(rain pax txt) - ~& [%vane-parsed `@p`(mug gen)] + ~> %slog.[0 leaf+"vane: parsed {(scow p+(mug gen))}"] =+ pro=(vent who lal vil bud [(slym (slap bud gen) bud) *worm]) - ~& [%vane-compiled `@p`(mug pro)] + ~> %slog.[0 leaf+"vane: compiled {(scow p+(mug pro))}"] prime:pro :: ++ viol :: vane tools @@ -1303,13 +1299,13 @@ :: +veer: install %zuse or a vane :: :: Identity is in the sample so the larval stage -:: can use this as well. +:: can use this too. :: ++ veer |= [who=ship now=@da fav=curd] ^+ soul - => .(fav ;;({$veer lal/@tas pax/path txt/@t} fav)) - ~| veer+[lal.fav pax.fav] + => .(fav ;;([%veer lal=@tas pax=path txt=@t] fav)) + ~| veer+[lal pax]:fav ?: =(%$ lal.fav) ~> %slog.[0 leaf+"zuse: {(scow p+(mug txt.fav))}"] =+ gen=(rain pax.fav txt.fav) @@ -1320,10 +1316,8 @@ |- ^+ vanes ?~ vanes ~> %slog.[0 leaf+"vane: {} {(scow p+(mug txt.fav))}"] - =+ vin=(vint who lal.fav vil bud pax.fav txt.fav) - ?~ vin - vanes - [[lal.fav vane:u.vin] vanes] + =/ vin (vint who lal.fav vil bud pax.fav txt.fav) + [[lal.fav vane.vin] vanes] ?. =(lal.fav label.i.vanes) [i.vanes $(vanes t.vanes)] ~> %slog.[0 leaf+"vane: {} {(scow p+(mug txt.fav))}"] From b6dcb65061240df9a2be11a0a95c0d6258a5bd94 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 8 May 2020 06:03:29 -0400 Subject: [PATCH 105/280] clay: rebuild desk on zuse change --- pkg/arvo/sys/vane/clay.hoon | 54 ++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index f43a81521..730e33e48 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2515,10 +2515,11 @@ dom(lab (~(put by lab.dom) lab let.dom)) :: :: Apply a list of changes against the current state and produce - :: the new state. + :: the new state. Initial and post-kernel-upgrade commits rebuild + :: from scratch. :: ++ apply-changes :: apply-changes - |= [change-files=(list [p=path q=misu])] + |= change-files=(list [p=path q=misu]) ^- (map path blob) =+ ^= old-files :: current state ?: =(let.dom 0) :: initial commit @@ -3543,12 +3544,12 @@ %& q.p.yoki %| (~(run by q.p.yoki) |=(=lobe |+lobe)) == + =/ old-lobes=(map path lobe) + ?: =(0 let.dom) + ~ + q:(aeon-to-yaki:ze let.dom) =/ [deletes=(set path) changes=(map path (each page lobe))] - =/ previous-yaki - ?: =(0 let.dom) - *yaki - (aeon-to-yaki:ze let.dom) - (get-changes q.previous-yaki new-data) + (get-changes old-lobes new-data) ~| [from=let.dom deletes=deletes changes=~(key by changes)] :: :: promote ford cache @@ -3560,10 +3561,18 @@ =/ =args:ford:fusion [ank.dom deletes changes lat.ran fod.dom] :: - ?: &(!updated !=(~ (need-sys-update changes))) + =/ sys-changes (need-sys-update changes) + ?: &(!updated !=(~ sys-changes)) (sys-update args yoki changes) - :: =. ..park (emil (print deletes ~(key by changes))) + :: clear caches if zuse reloaded + :: + =/ is-zuse-new=? &(updated (was-zuse-updated sys-changes)) + =? fod.dom is-zuse-new *ford-cache + =? ank.dom is-zuse-new *ankh + =? changes is-zuse-new + (changes-for-upgrade old-lobes deletes changes) + :: =^ change-cages ford-cache.args (checkout-changes args changes) =/ sane-continuation (sane-changes changes change-cages) @@ -3603,6 +3612,7 @@ :: ++ get-changes |= [old=(map path lobe) new=(map path (each page lobe))] + ^- [deletes=(set path) changes=(map path (each page lobe))] =/ old=(map path (each page lobe)) (~(run by old) |=(=lobe |+lobe)) :* %- silt ^- (list path) @@ -3625,6 +3635,20 @@ ~ `[path u.a] == + :: Find all files for full desk rebuild + :: + ++ changes-for-upgrade + |= $: old=(map path lobe) + deletes=(set path) + changes=(map path (each page lobe)) + == + ^+ changes + =. old + %+ roll ~(tap in deletes) + |= [pax=path old=_old] + (~(del by old) pax) + =/ pre=_changes (~(run by old) |=(lob=lobe |+lob)) + (~(uni by pre) changes) :: :: Keep any parts of the ford cache whose dependencies didn't change :: @@ -3677,6 +3701,7 @@ ?~ cans [~ ford-cache.ford-args] =^ cage ford-cache.ford-args + ~> %slog.[0 leaf+"clay: validating {(spud path.i.cans)}"] %- wrap:fusion (get-value:(ford:fusion ford-args) path.i.cans) =/ =lobe @@ -3939,6 +3964,17 @@ =(/sys/vane (scag 2 path)) == :: + :: Did the standard library reload? + :: + ++ was-zuse-updated + |= changes=(map path (each page lobe)) + ^- ? + ~+ + ?| (~(has by changes) /sys/hoon/hoon) + (~(has by changes) /sys/arvo/hoon) + (~(has by changes) /sys/zuse/hoon) + == + :: :: Delay current update until sys update is complete :: ++ sys-update From 5dce103fe07721ea4976f2ad5ce5021a448e4492 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sat, 9 May 2020 09:41:58 +1000 Subject: [PATCH 106/280] links: update generators --- pkg/arvo/gen/link-store/note.hoon | 2 +- pkg/arvo/gen/link-store/save.hoon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/gen/link-store/note.hoon b/pkg/arvo/gen/link-store/note.hoon index a3d169a33..6b3651ad6 100644 --- a/pkg/arvo/gen/link-store/note.hoon +++ b/pkg/arvo/gen/link-store/note.hoon @@ -1,6 +1,6 @@ :: link-store|note: write a note on a link in a path :: -/- *link-store +/- *link-store, *link :- %say |= $: [now=@da eny=@uvJ =beak] [[=path =url note=@t ~] ~] diff --git a/pkg/arvo/gen/link-store/save.hoon b/pkg/arvo/gen/link-store/save.hoon index 4a192d0be..59a5c6012 100644 --- a/pkg/arvo/gen/link-store/save.hoon +++ b/pkg/arvo/gen/link-store/save.hoon @@ -1,6 +1,6 @@ :: link-store|save: save a link to a path :: -/- *link-store +/- *link-store, *link :- %say |= $: [now=@da eny=@uvJ =beak] [[=path title=@t =url ~] ~] From 9a9d91214f0d06b73e8816ef182e514dcb70e22e Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 30 Apr 2020 19:32:48 -0700 Subject: [PATCH 107/280] clay: port mate/meld to ford fusion --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 21 +++- pkg/arvo/ted/merge.hoon | 218 +++++++++++++++++++++++++++++++++--- 3 files changed, 225 insertions(+), 18 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 2e7ab4b67..a587c1353 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35f37d5c98a4f7b81e633179d27d458ed5b09a106d45ef4581f4e982923bb02b -size 13198731 +oid sha256:0c2d48baffd6abcbd623f09ba0b8b6a0523f598a55b57322036063dfdcb67d7e +size 14078008 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 35f20239f..c18a22051 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3582,7 +3582,12 @@ %| p.value %& lobe:(~(got by change-cages) path) == - =/ =yaki (make-yaki p.p.yoki data now) + =/ =yaki + ?- -.yoki + %& (make-yaki p.p.yoki data now) + %| ?> =(data q.p.yoki) + p.yoki + == =: let.dom +(let.dom) hit.dom (~(put by hit.dom) +(let.dom) r.yaki) hut.ran (~(put by hut.ran) r.yaki yaki) @@ -5063,7 +5068,7 @@ ++ read-s |= [yon=aeon pax=path] ^- (unit (unit cage)) - ?. ?=([?(%yaki %blob %hash) * ~] pax) + ?. ?=([?(%yaki %blob %hash %cage) * ~] pax) `~ ?- i.pax %yaki @@ -5083,6 +5088,18 @@ ?~ yak ~ ``uvi+[-:!>(*@uvI) (content-hash u.yak /)] + :: + %cage + :: should save ford cache + :: + =/ =lobe (slav %uv i.t.pax) + =^ =page fod.dom + %- wrap:fusion + (lobe-to-page:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) lobe) + =^ =cage fod.dom + %- wrap:fusion + (page-to-cage:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) page) + ``cage+[-:!>(*^cage) cage] == :: +read-t: produce the list of paths within a yaki with :pax as prefix :: diff --git a/pkg/arvo/ted/merge.hoon b/pkg/arvo/ted/merge.hoon index f5fe338cc..1baaf53aa 100644 --- a/pkg/arvo/ted/merge.hoon +++ b/pkg/arvo/ted/merge.hoon @@ -38,7 +38,7 @@ =/ args [bob-desk new.u.merge-result rang] ;< ~ bind:m (send-raw-card:strandio %pass /merg/[bob-desk]/[ali-desk] %arvo %c %park args) -(pure:m !>(~)) +(pure:m !>(conflicts.u.merge-result)) :: +$ merge-result %- unit @@ -126,8 +126,13 @@ ~ =/ merge-point=yaki n.merge-points ?. ?=(%meet germ) - ~& %merge-not-implemented - !! + =/ ali-diffs=cane (diff-base ali-yaki bob-yaki merge-point) + =/ bob-diffs=cane (diff-base bob-yaki ali-yaki merge-point) + =/ bof=(map path (unit cage)) + (merge-conflicts can.ali-diffs can.bob-diffs) + =/ [conflicts=(set path) new=yoki lat=(map lobe blob)] + (build ali-yaki bob-yaki merge-point ali-diffs bob-diffs bof) + (pure:m `[conflicts new lat]) =/ ali-diffs=cane (calc-diffs ali-yaki merge-point) =/ bob-diffs=cane (calc-diffs bob-yaki merge-point) =/ both-diffs=(map path *) @@ -212,20 +217,23 @@ $(gud (~(put in gud) n.unk), unk bun) $(unk bun) :: - :: The set of changes between the mergebase and one of the desks being merged + :: The set of changes between the mergebase and one of the desks + :: being merged :: - :: -- `new` is the set of files in the new desk and not in the mergebase. - :: -- `cal` is the set of changes in the new desk from the mergebase except - :: for any that are also in the other new desk. - :: -- `can` is the set of changes in the new desk from the mergebase that - :: are also in the other new desk (potential conflicts). - :: -- `old` is the set of files in the mergebase and not in the new desk. + :: -- `new` is the set of files in the new desk and not in the + :: mergebase. + :: -- `cal` is the set of changes in the new desk from the mergebase + :: except for any that are also in the other new desk. + :: -- `can` is the set of changes in the new desk from the mergebase + :: that are also in the other new desk (potential conflicts). + :: -- `old` is the set of files in the mergebase and not in the new + :: desk. :: +$ cane - $: new/(map path lobe) - cal/(map path lobe) - can/(map path cage) - old/(map path ~) + $: new=(map path lobe) + cal=(map path lobe) + can=(map path cage) + old=(map path ~) == :: :: Calculate cane knowing there are no files changed by both desks @@ -255,6 +263,188 @@ `[pax ~] == :: + :: Diff yak against bas where different from yuk + :: + ++ diff-base + |= [yak=yaki yuk=yaki bas=yaki] + ^- cane + =/ new=(map path lobe) + %- malt + %+ skip ~(tap by q.yak) + |= [=path =lobe] + (~(has by q.bas) path) + :: + =/ cal=(map path lobe) + %- malt ^- (list [path lobe]) + %+ murn ~(tap by q.bas) + |= [pax=path lob=lobe] + ^- (unit (pair path lobe)) + =+ a=(~(get by q.yak) pax) + =+ b=(~(get by q.yuk) pax) + ?. ?& ?=(^ a) + !=([~ lob] a) + =([~ lob] b) + == + ~ + `[pax +.a] + :: + =/ can=(map path cage) + %- malt + %+ murn ~(tap by q.bas) + |= [=path =lobe] + ^- (unit [^path cage]) + =/ in-yak (~(get by q.yak) path) + ?~ in-yak + ~ + ?: =(lobe u.in-yak) + ~ + =/ in-yuk (~(get by q.yuk) path) + ?~ in-yuk + ~ + ?: =(lobe u.in-yuk) + ~ + ?: =(u.in-yak u.in-yuk) + ~ + `[path (diff-lobes lobe u.in-yak)] + :: + =/ old=(map path ~) + %- malt ^- (list [path ~]) + %+ murn ~(tap by q.bas) + |= [pax=path lob=lobe] + ?. =(~ (~(get by q.yak) pax)) + ~ + (some pax ~) + :: + [new cal can old] + :: + ++ start ~+ `path`/(scot %p our)/[bob-desk]/(scot %da wen) + ++ cb ~+ |=(=mark .^(dais %cb (weld start /[mark]))) + :: + :: Diff two files on bob-desk + :: + ++ diff-lobes + |= [=a=lobe =b=lobe] + ^- cage + =+ .^(=a=cage %cs (weld start /cage/(scot %uv a-lobe))) + =+ .^(=b=cage %cs (weld start /cage/(scot %uv b-lobe))) + ?> =(p.a-cage p.b-cage) + =/ =dais (cb p.a-cage) + [form:dais (~(diff dais q.a-cage) q.b-cage)] + :: + :: Merge diffs that are on the same file. + :: + ++ merge-conflicts + |= [ali-conflicts=(map path cage) bob-conflicts=(map path cage)] + ^- (map path (unit cage)) + %- ~(urn by (~(int by ali-conflicts) bob-conflicts)) + |= [=path *] + ^- (unit cage) + =/ cal=cage (~(got by ali-conflicts) path) + =/ cob=cage (~(got by bob-conflicts) path) + =/ =mark + =+ (slag (dec (lent path)) path) + ?~(- %$ i.-) + =+ .^(=dais %cb (weld start /[mark])) + =/ res=(unit (unit vase)) (~(join dais bunt:dais) q.cal q.cob) + ?~ res + ~ + ?~ u.res + ~ + `[form:dais u.u.res] + :: + :: Apply the patches in bof to get the new merged content. + :: + :: Gather all the changes between ali's and bob's commits and the + :: mergebase. This is similar to the %meet of ++merge, except + :: where they touch the same file, we use the merged versions. + :: + ++ build + |= $: ali=yaki + bob=yaki + bas=yaki + dal=cane + dob=cane + bof=(map path (unit cage)) + == + ^- [conflicts=(set path) new=yoki lat=(map lobe blob)] + =/ both-patched=(map path cage) + %- malt + %+ murn ~(tap by bof) + |= [=path cay=(unit cage)] + ^- (unit [^path cage]) + ?~ cay + ~ + :+ ~ path + =+ (~(get by q.bas) path) + ?~ - + ~| %mate-strange-diff-no-base + !! + =+ .^(=a=cage %cs (weld start /cage/(scot %uv u.-))) + =/ =dais (cb p.a-cage) + ?> =(p.u.cay form.dais) + :- p.a-cage + (~(pact dais q.a-cage) q.u.cay) + =/ con=(map path *) :: 2-change conflict + %- molt + %+ skim ~(tap by bof) + |=([pax=path cay=(unit cage)] ?=(~ cay)) + =/ cab=(map path lobe) :: conflict base + %- ~(urn by con) + |= [pax=path *] + (~(got by q.bas) pax) + =. con :: change+del conflict + %- ~(uni by con) + %- malt ^- (list [path *]) + %+ skim ~(tap by old.dal) + |= [pax=path ~] + ?: (~(has by new.dob) pax) + ~| %strange-add-and-del + !! + (~(has by can.dob) pax) + =. con :: change+del conflict + %- ~(uni by con) + %- malt ^- (list [path *]) + %+ skim ~(tap by old.dob) + |= [pax=path ~] + ?: (~(has by new.dal) pax) + ~| %strange-del-and-add + !! + (~(has by can.dal) pax) + =. con :: add+add conflict + %- ~(uni by con) + %- malt ^- (list [path *]) + %+ skip ~(tap by (~(int by new.dal) new.dob)) + |= [pax=path *] + =((~(got by new.dal) pax) (~(got by new.dob) pax)) + =/ old=(map path lobe) :: oldies but goodies + %+ roll ~(tap by (~(uni by old.dal) old.dob)) + =< .(old q.bas) + |= [[pax=path ~] old=(map path lobe)] + (~(del by old) pax) + =/ [hot=(map path lobe) lat=(map lobe blob)] :: new content + %+ roll ~(tap by both-patched) + |= [[pax=path cay=cage] hat=(map path lobe) lat=(map lobe blob)] + =/ =blob [%direct (page-to-lobe [p q.q]:cay) [p q.q]:cay] + :- (~(put by hat) pax p.blob) + ?: (~(has by lat) p.blob) + lat + (~(put by lat) p.blob blob) + =/ hat=(map path lobe) :: all the content + %- ~(uni by old) + %- ~(uni by new.dal) + %- ~(uni by new.dob) + %- ~(uni by cal.dal) + %- ~(uni by cal.dob) + %- ~(uni by hot) + cab + =/ del=(map path ?) + (~(run by (~(uni by old.dal) old.dob)) |=(~ %|)) + =/ new &+[[r.bob r.ali ~] (~(run by hat) |=(=lobe |+lobe))] + :* (silt (turn ~(tap by con) head)) + new + lat + == + :: ++ to-yuki |= m=(map path lobe) ^- (map path (each page lobe)) From 7d5e102dfe94198db3857d76fb1d1b89da37d2ff Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 11 May 2020 19:26:22 -0700 Subject: [PATCH 108/280] clay: change %info to use ford fusion --- pkg/arvo/sys/vane/clay.hoon | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index c18a22051..6a619f8b4 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -5408,27 +5408,25 @@ [[duct %pass /queued-request %b %wait now]~ ..^$] :: %info - ?: =(%$ des.req) - ~|(%info-no-desk !!) - =. act.ruf - =/ =dojo (~(gut by dos.rom.ruf) des.req *dojo) - =/ writer=form:commit-clad - %- %- commit - :* our - des.req - now - mon.ruf - hez.ruf - hun.rom.ruf - == - :* dit.req - dom.dojo - ran.ruf - == - `[hen req %commit (from-form:eval:commit-clad writer)] + ?: ?=(%| -.dit.req) + ~| %labelling-not-implemented + !! + =/ [deletes=(set path) changes=(map path cage)] + =/ =soba p.dit.req + =| deletes=(set path) + =| changes=(map path cage) + |- ^+ [deletes changes] + ?~ soba + [deletes changes] + ?- -.q.i.soba + %del $(soba t.soba, deletes (~(put in deletes) p.i.soba)) + %ins $(soba t.soba, changes (~(put by changes) [p p.q]:i.soba)) + %mut $(soba t.soba, changes (~(put by changes) [p p.q]:i.soba)) + %dif ~|(%dif-not-implemented !!) + == =^ mos ruf =/ den ((de our now ski hen ruf) our des.req) - abet:(take-commit:den clad-init-sign) + abet:(info:den deletes changes) [mos ..^$] :: %init From e75ab631a4de5061714af1905de4a1bf1a2a951d Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 11 May 2020 19:30:32 -0700 Subject: [PATCH 109/280] clay: remove turbo commit --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 545 +----------------------------------- 2 files changed, 3 insertions(+), 546 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a587c1353..3c2428d6c 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c2d48baffd6abcbd623f09ba0b8b6a0523f598a55b57322036063dfdcb67d7e -size 14078008 +oid sha256:71ae16ec67745d9c03cc24d4f85e3d4ad640b05b85a45457e413d1af37cf50da +size 13983138 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 6a619f8b4..e5a4c5546 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -165,22 +165,11 @@ $: hen=duct req=task:able $= eval-data - $% [%commit commit=eval-form:eval:commit-clad] - [%merge merge=eval-form:eval:merge-clad] + $% [%merge merge=eval-form:eval:merge-clad] [%mount mount=eval-form:eval:mount-clad] == == :: -:: The clad monad for commits. -:: -:: -- `dome` is the new dome -- each writer has a lock on the dome for -:: that desk -:: -- `rang` is a superset of the global rang, but we uni:by it into -:: the global rang because other things might add stuff to it. -:: Thus, writers do *not* have a lock on the global rang. -:: -++ commit-clad (clad ,[dome rang]) -:: :: The clad monad for merges. :: :: Same as +commit-clad, except includes a set of paths documenting the @@ -670,485 +659,6 @@ |= [=wove ducts=(set duct)] [ducts (print-wove wove)] :: -:: -:: Make a new commit with the given +nori of changes. -:: -++ commit - :: Global constants. These do not change during a commit. - :: - |= $: our=ship - syd=desk - wen=@da - mon=(map term beam) - hez=(unit duct) - hun=duct - == - |^ - :: Initial arguments - :: - |= [lem=nori original-dome=dome ran=rang] - =/ m commit-clad - ^- form:m - ?: ?=(%| -.lem) - :: If the change is just adding a label, handle it directly. - :: - =. original-dome - (execute-label:(state:util original-dome original-dome ran) p.lem) - =/ e (cor original-dome ran) - ;< ~ bind:m (print-changes:e %| p.lem) - (pure:m dom:e ran:e) - :: - :: Else, collect the data, apply it, fill in our local cache, let - :: unix know, and print a notification to the screen. - :: - =/ e (cor original-dome ran) - ;< [=dork mim=(map path mime)] bind:m (fill-dork:e wen p.lem) - ;< [=suba e=_*cor] bind:m (apply-dork:e wen dork) - ;< e=_*cor bind:m checkout-new-state:e - ;< mim=(map path mime) bind:m (ergo-changes:e suba mim) - ;< ~ bind:m (print-changes:e %& suba) - =. mim.dom.e mim - (pure:m dom:e ran:e) - :: - :: A stateful core, where the global state is a dome and a rang. - :: - :: These are the global state variables that an edit may change. - :: - ++ cor - |= [dom=dome ran=rang] - =/ original-dome dom - |% - ++ this-cor . - ++ sutil (state:util original-dome dom ran) - :: - :: Collect all the insertions, deletions, diffs, and mutations - :: which are requested. - :: - :: Sends them through ford for casting, patching, and diffing so - :: that the produced dork has all the relevant cages filled in. - :: - :: Also fills in the mime cache. Often we need to convert to mime - :: anyway to send (back) to unix, so we just keep it around rather - :: than recalculating it. This is less necessary than before - :: because of the ford cache. - :: - ++ fill-dork - |= [wen=@da =soba] - =/ m (clad ,[=dork mim=(map path mime)]) - ^- form:m - =| $= nuz - $: del=(list (pair path miso)) - ins=(list (pair path miso)) - dif=(list (pair path miso)) - mut=(list (pair path miso)) - ink=(list (pair path miso)) - == - :: - =. nuz - |- ^+ nuz - ?~ soba nuz - :: - ?- -.q.i.soba - %del $(soba t.soba, del.nuz [i.soba del.nuz]) - %dif $(soba t.soba, dif.nuz [i.soba dif.nuz]) - %ins - =/ pax=path p.i.soba - =/ mar=mark p.p.q.i.soba - :: - :: We store `%hoon` files directly to `ink` so that we add - :: them without requiring any mark definitions. `%hoon` - :: files have to be treated specially to make the - :: bootstrapping sequence work, since the mark definitions - :: are themselves `%hoon` files. - :: - ?: ?& ?=([%hoon *] (flop pax)) - ?=(%mime mar) - == - $(soba t.soba, ink.nuz [i.soba ink.nuz]) - $(soba t.soba, ins.nuz [i.soba ins.nuz]) - :: - %mut - =/ pax=path p.i.soba - =/ mis=miso q.i.soba - ?> ?=(%mut -.mis) - =/ cag=cage p.mis - :: if :mis has the %mime mark and it's the same as cached, no-op - :: - ?: ?. =(%mime p.cag) - %.n - ?~ cached=(~(get by mim.dom) pax) - %.n - =(q:;;(mime q.q.cag) q.u.cached) - :: - $(soba t.soba) - :: if the :mis mark is the target mark and the value is the same, no-op - :: - ?: =/ target-mark=mark =+(spur=(flop pax) ?~(spur !! i.spur)) - ?. =(target-mark p.cag) - %.n - :: - =/ stored (need (need (read-x:sutil & let.dom pax))) - =/ stored-cage=cage ?>(?=(%& -.stored) p.stored) - :: - =(q.q.stored-cage q.q.cag) - :: - $(soba t.soba) - :: the value differs from what's stored, so register mutation - :: - $(soba t.soba, mut.nuz [i.soba mut.nuz]) - == - :: sort each section alphabetically for determinism - :: - =. nuz :* - (sort del.nuz sort-by-head) - (sort ins.nuz sort-by-head) - (sort dif.nuz sort-by-head) - (sort mut.nuz sort-by-head) - (sort ink.nuz sort-by-head) - == - =/ ink - %+ turn ink.nuz - |= {pax/path mis/miso} - ^- (pair path cage) - ?> ?=($ins -.mis) - =+ =>((flop pax) ?~(. %$ i)) - [pax - [%atom %t ~] ;;(@t +>.q.q.p.mis)] - :: - =/ mim - :: add the new files to the new mime cache - :: - %- malt - ^- (list (pair path mime)) - ;: weld - ^- (list (pair path mime)) - %+ murn ins.nuz - |= {pax/path mis/miso} - ^- (unit (pair path mime)) - ?> ?=($ins -.mis) - ?. ?=($mime p.p.mis) - ~ - `[pax ;;(mime q.q.p.mis)] - :: - ^- (list (pair path mime)) - %+ murn ink.nuz - |= {pax/path mis/miso} - ^- (unit (pair path mime)) - ?> ?=($ins -.mis) - ?> ?=($mime p.p.mis) - `[pax ;;(mime q.q.p.mis)] - :: - ^- (list (pair path mime)) - %+ murn mut.nuz - |= {pax/path mis/miso} - ^- (unit (pair path mime)) - ?> ?=($mut -.mis) - ?. ?=($mime p.p.mis) - ~ - `[pax ;;(mime q.q.p.mis)] - == - :: - ;< ins=(list (pair path cage)) bind:m (calc-inserts wen ins.nuz) - ;< dif=(list (trel path lobe cage)) bind:m (calc-diffs wen dif.nuz) - ;< mut=(list (trel path lobe cage)) bind:m (calc-mutates wen mut.nuz) - %+ pure:m - ^- dork - [del=(turn del.nuz head) ink ins dif mut] - mim - :: - :: Build the list of insertions by casting to the correct mark. - :: - ++ calc-inserts - |= [wen=@da ins=(list (pair path miso))] - =/ m (clad (list (pair path cage))) - ^- form:m - ;< ~ bind:m - %+ just-do /inserts - :* %f %build live=%.n %pin wen %list - ^- (list schematic:ford) - %+ turn ins - |= [pax=path mis=miso] - ?> ?=($ins -.mis) - :- [%$ %path -:!>(*path) pax] - =+ =>((flop pax) ?~(. %$ i)) - [%cast [our syd] - [%$ p.mis]] - == - ;< res=made-result:ford bind:m expect-ford - ^- form:m - |= clad-input - :^ ~ ~ %done - ^- (list (pair path cage)) - %+ turn (made-result-to-success-cages:util res) - |= {pax/cage cay/cage} - ?. ?=($path p.pax) - ~|(%clay-take-inserting-strange-path-mark !!) - [;;(path q.q.pax) cay] - :: - :: Build the list of diffs by apply the given diffs to the existing - :: data. - :: - ++ calc-diffs - |= [wen=@da dif=(list (pair path miso))] - =/ m (clad (list (trel path lobe cage))) - ^- form:m - ;< ~ bind:m - %+ just-do /diffs - :* %f %build live=%.n %pin wen %list - ^- (list schematic:ford) - %+ turn dif - |= {pax/path mis/miso} - ?> ?=($dif -.mis) - =+ (need (need (read-x:sutil & let.dom pax))) - ?> ?=(%& -<) - :- [%$ %path -:!>(*path) pax] - [%pact [our syd] [%$ p.-] [%$ p.mis]] - == - ;< res=made-result:ford bind:m expect-ford - ^- form:m - |= clad-input - :^ ~ ~ %done - ^- (list (trel path lobe cage)) - =/ dig=(map path cage) - %- malt - (turn dif |=({pax/path mis/miso} ?>(?=($dif -.mis) [pax p.mis]))) - %+ turn (made-result-to-cages:util res) - |= {pax/cage cay/cage} - ^- (pair path (pair lobe cage)) - ?. ?=($path p.pax) - ~|(%clay-take-diffing-strange-path-mark !!) - =+ paf=;;(path q.q.pax) - [paf (page-to-lobe:sutil [p q.q]:cay) (~(got by dig) paf)] - :: - :: Build the list of mutations by casting to the correct mark and - :: diffing against the existing data. - :: - ++ calc-mutates - |= [wen=@da mut=(list (pair path miso))] - =/ m (clad (list (trel path lobe cage))) - ^- form:m - ;< ~ bind:m - %+ just-do /casts - :* %f %build live=%.n %pin wen %list - ::~ [her syd %da wen] %tabl - ^- (list schematic:ford) - %+ turn mut - |= {pax/path mis/miso} - ?> ?=($mut -.mis) - :- [%$ %path -:!>(*path) pax] - =/ mar - %- lobe-to-mark:sutil - (~(got by q:(aeon-to-yaki:sutil let.dom)) pax) - [%cast [our syd] mar [%$ p.mis]] - == - ;< res=made-result:ford bind:m expect-ford - ;< hashes=(map path lobe) bind:m - |= clad-input - =/ cat=(list (pair path cage)) - %+ turn (made-result-to-cages:util res) - |= {pax/cage cay/cage} - ?. ?=($path p.pax) - ~|(%castify-bad-path-mark !!) - [;;(path q.q.pax) cay] - :_ :+ ~ %done - ^- (map path lobe) - %- malt - %+ turn cat - |= {pax/path cay/cage} - [pax (page-to-lobe:sutil [p q.q]:cay)] - ^- (list [path note]) - :_ ~ - :* /mutates - %f %build live=%.n %pin wen %list - ^- (list schematic:ford) - %+ turn cat - |= {pax/path cay/cage} - :- [%$ %path -:!>(*path) pax] - =/ scheme - %^ lobe-to-schematic:sutil [our syd] pax - (~(got by q:(aeon-to-yaki:sutil let.dom)) pax) - [%diff [our syd] scheme [%$ cay]] - == - ;< res=made-result:ford bind:m expect-ford - %- pure:m - ^- (list (trel path lobe cage)) - %+ murn (made-result-to-cages:util res) - |= {pax/cage cay/cage} - ^- (unit (pair path (pair lobe cage))) - ?. ?=($path p.pax) - ~|(%clay-take-mutating-strange-path-mark !!) - ?: ?=($null p.cay) - ~ - =+ paf=;;(path q.q.pax) - `[paf (~(got by hashes) paf) cay] - :: - :: Collect the relevant data from dok and run +execute-changes to - :: apply them to our state. - :: - ++ apply-dork - |= [wen=@da =dork] - =/ m (clad ,[=suba _this-cor]) - ^- form:m - =/ sim=(list (pair path misu)) - ;: weld - ^- (list (pair path misu)) - (turn del.dork |=(pax/path [pax %del ~])) - :: - ^- (list (pair path misu)) - (turn ink.dork |=({pax/path cay/cage} [pax %ins cay])) - :: - ^- (list (pair path misu)) - (turn ins.dork |=({pax/path cay/cage} [pax %ins cay])) - :: - ^- (list (pair path misu)) - (turn dif.dork |=({pax/path cal/{lobe cage}} [pax %dif cal])) - :: - ^- (list (pair path misu)) - (turn mut.dork |=({pax/path cal/{lobe cage}} [pax %dif cal])) - == - =/ res=(unit [=dome =rang]) - (execute-changes:sutil wen sim) - ?~ res - (clad-fail %dork-fail ~) - =: dom dome.u.res - ran rang.u.res - == - (pure:m sim this-cor) - :: - :: Take the map of paths to lobes, convert to blobs, and save the - :: resulting ankh to the dome. - :: - ++ checkout-new-state - =/ m (clad ,_this-cor) - ^- form:m - ;< ~ bind:m - %+ just-do /checkout - =/ new-yaki (aeon-to-yaki:sutil let.dom) - :* %f %build live=%.n %list - ^- (list schematic:ford) - %+ turn (sort ~(tap by q.new-yaki) sort-by-head) - |= {a/path b/lobe} - ^- schematic:ford - :- [%$ %path-hash !>([a b])] - (lobe-to-schematic:sutil [our syd] a b) - == - ;< res=made-result:ford bind:m expect-ford - ?. ?=([%complete %success *] res) - =/ message (made-result-as-error:ford res) - (clad-fail %checkout-fail leaf+"clay patch failed" message) - :: - =/ cat/(list (trel path lobe cage)) - %+ turn (made-result-to-cages:util res) - |= {pax/cage cay/cage} - ?. ?=($path-hash p.pax) - ~|(%patch-bad-path-mark !!) - [-< -> +]:[;;({path lobe} q.q.pax) cay] - =. ank.dom (map-to-ankh:sutil (malt cat)) - (pure:m this-cor) - :: - :: Choose which changes must be synced to unix, and do so. We - :: convert to mime before dropping the ergo event to unix. - :: - ++ ergo-changes - |= [=suba mim=(map path mime)] - =/ m (clad ,mim=(map path mime)) - ^- form:m - ?~ hez (pure:m mim) - =+ must=(must-ergo:util our syd mon (turn suba head)) - ?: =(~ must) - (pure:m mim) - =/ all-paths/(set path) - %+ roll - (turn ~(tap by must) (corl tail tail)) - |= {pak/(set path) acc/(set path)} - (~(uni in acc) pak) - =/ changes (malt suba) - ;< ~ bind:m - %+ just-do /ergo - :* %f %build live=%.n %list - ^- (list schematic:ford) - %+ turn ~(tap in all-paths) - |= a/path - ^- schematic:ford - :- [%$ %path !>(a)] - =+ b=(~(got by changes) a) - ?: ?=($del -.b) - [%$ %null !>(~)] - =+ (~(get by mim) a) - ?^ - [%$ %mime !>(u.-)] - :^ %cast [our syd] %mime - =/ x (need (need (read-x:sutil & let.dom a))) - ?: ?=(%& -<) - [%$ p.x] - (lobe-to-schematic:sutil [our syd] a p.x) - == - ;< res=made-result:ford bind:m expect-ford - ?: ?=([%incomplete *] res) - (clad-fail %ergo-fail-incomplete leaf+"clay ergo incomplete" tang.res) - ?. ?=([%complete %success *] res) - (clad-fail %ergo-fail leaf+"clay ergo failed" message.build-result.res) - =/ changes=(map path (unit mime)) - %- malt ^- mode - %+ turn (made-result-to-cages:util res) - |= [pax=cage mim=cage] - ?. ?=($path p.pax) - ~|(%ergo-bad-path-mark !!) - :- ;;(path q.q.pax) - ?. ?=($mime p.mim) - ~ - `;;(mime q.q.mim) - =. mim (apply-changes-to-mim:util mim changes) - ;< ~ bind:m (give-ergo:util u.hez our syd mon changes) - (pure:m mim) - :: - :: Print a summary of changes to dill. - :: - ++ print-changes - |= lem=nuri - =/ m (clad ,~) - ^- form:m - :: skip full change output for initial filesystem - :: - ?: ?& =(%base syd) - |(=(1 let.dom) =(2 let.dom)) - ?=([%& ^] lem) - == - =/ msg=tape - %+ weld - "clay: committed initial filesystem" - ?:(=(1 let.dom) " (hoon)" " (all)") - |= clad-input - :- ~ :_ [%done ~] - [hun %pass / %d %flog %text msg]~ - :: - =+ pre=`path`~[(scot %p our) syd (scot %ud let.dom)] - ?- -.lem - %| (print-to-dill '=' %leaf :(weld (trip p.lem) " " (spud pre))) - %& - |- ^- form:m - ?~ p.lem (pure:m ~) - ;< ~ bind:m - %+ print-to-dill - ?-(-.q.i.p.lem $del '-', $ins '+', $dif ':') - :+ %rose ["/" "/" ~] - %+ turn (weld pre p.i.p.lem) - |= a/cord - ?: ((sane %ta) a) - [%leaf (trip a)] - [%leaf (dash:us (trip a) '\'' ~)] - ^$(p.lem t.p.lem) - == - :: - :: Send a tank straight to dill for printing. - :: - ++ print-to-dill - |= {car/@tD tan/tank} - =/ m (clad ,~) - ^- form:m - |= clad-input - :- ~ :_ [%done ~] - [hun %give %note car tan]~ - -- - -- -:: :: This transaction respresents a currently running merge. We always :: say we're merging from 'ali' to 'bob'. The basic steps, not all of :: which are always needed, are: @@ -4112,52 +3622,6 @@ ..start-request (duce for u.new-sub) :: - :: Continue committing - :: - ++ take-commit - |= =sign - ^+ +> - =/ m commit-clad - ?~ act - ~|(%no-active-write !!) - ?. ?=(%commit -.eval-data.u.act) - ~|(%active-not-commit !!) - =^ r=[moves=(list move) =eval-result:eval:m] commit.eval-data.u.act - (take:eval:m commit.eval-data.u.act hen /commit/[syd] now ran sign) - => .(+>.$ (emil moves.r)) :: TMI - ?- -.eval-result.r - %next +>.$ - %fail (fail-commit err.eval-result.r) - %done (done-commit value.eval-result.r) - == - :: - :: Don't release effects or apply state changes; print error - :: - ++ fail-commit - |= err=(pair term tang) - ^+ +> - =? +>.$ ?=(^ q.err) - %- emit - :* (need hun) %give %note - '!' %rose [" " "" ""] - leaf+"clay commit error" - leaf+(trip p.err) - q.err - == - finish-write - :: - :: Release effects and apply state changes - :: - ++ done-commit - |= [=dome =rang] - ^+ +> - =: dom dome - hut.ran (~(uni by hut.rang) hut.ran) - lat.ran (~(uni by lat.rang) lat.ran) - == - =. +>.$ wake - finish-write - :: :: Continue merging :: ++ take-merge @@ -5654,13 +5118,6 @@ ?^ dud ~|(%clay-take-dud (mean tang.u.dud)) :: - ?: ?=([%commit @ *] tea) - =* syd i.t.tea - =^ mos ruf - =/ den ((de our now ski hen ruf) our syd) - abet:(take-commit:den q.hin) - [mos ..^$] - :: ?: ?=([%merge @ *] tea) =* syd i.t.tea =^ mos ruf From aacd6f80d8a516cf5425865ec69f82b10b37f1ce Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 00:01:46 -0700 Subject: [PATCH 110/280] clay: move merge back into clay --- bin/solid.pill | 4 +- pkg/arvo/app/dojo.hoon | 5 +- pkg/arvo/sys/vane/clay.hoon | 495 ++++++++++++++++++++++++++++++++++-- 3 files changed, 477 insertions(+), 27 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 3c2428d6c..d8e74ec6e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:71ae16ec67745d9c03cc24d4f85e3d4ad640b05b85a45457e413d1af37cf50da -size 13983138 +oid sha256:684f47c147418d1424376be0088d59063bda843c7749196400bf96e8293d3e43 +size 14063453 diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index eec9c490e..9485c4b18 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -724,12 +724,13 @@ (dy-vase p.u.val) %+ slap (with-faces gat+gat rep+(with-faces soz) ~) + %- (slog >%try< (sell (slot 27 gat)) ~) :+ %cncb ~[%gat] ^- (list [wing hoon]) %+ turn soz |= [var=term vax=vase] ^- [wing hoon] - [~[var &+27 %gat] [%wing var %rep ~]] + [~[var &+27] [%wing var %rep ~]] (slap gat ^~((ream '(.)'))) :: ++ dy-made-dial :: dialog product @@ -847,7 +848,7 @@ ?^ val=(dy-hoon-var hoon) &+u.val %- mule |. - :- %hoon + :- %noun =/ vaz=(list [term vase]) (turn ~(tap by var) |=([lal=term cag=cage] [lal q.cag])) =/ sut (slop !>([our=our now=now eny=eny]:hid) !>(..zuse)) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index e5a4c5546..88b6a1759 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2763,7 +2763,6 @@ ?^ ezy :_(fod.dom.red `(bind u.ezy |=(a/cage [%& a]))) =+ nao=(case-to-aeon case.mun) - :: ~& [%aver-mun nao [%from syd lim case.mun]] ?~(nao [~ fod.dom.red] (read-at-aeon:ze for u.nao mun)) :: :: Queue a move. @@ -3520,6 +3519,469 @@ -- -- :: + :: We always say we're merging from 'ali' to 'bob'. The basic steps, + :: not all of which are always needed, are: + :: + :: -- fetch ali's desk, async in case it's remote + :: -- diff ali's desk against the mergebase + :: -- diff bob's desk against the mergebase + :: -- merge the diffs + :: -- commit + :: + ++ start-merge + |= [=ali=ship =ali=desk =case =germ] + ^+ ..start-merge + =/ =wire /merge/[syd]/(scot %p ali-ship)/[ali-desk]/[germ] + (emit hen %pass wire %c %warp ali-ship ali-desk `[%sing %v case /]) + :: + ++ merge + |= [=ali=ship =ali=desk =germ =riot] + ^+ ..merge + |^ + ?~ riot + (done %| %ali-unavailable >[ali-ship ali-desk germ]< ~) + =/ ali-dome=dome:clay !<(dome:clay q.r.u.riot) + =/ ali-yaki=yaki (~(got by hut.ran) (~(got by hit.ali-dome) let.ali-dome)) + =/ bob-yaki=(unit yaki) + ?~ let.dom + ~ + (~(get by hut.ran) (~(got by hit.dom) let.dom)) + =/ merge-result (merge-by-germ ali-yaki bob-yaki) + ?: ?=(%| -.merge-result) + (done %| p.merge-result) + ?~ p.merge-result + (done %& ~) + =. ..merge (done %& conflicts.u.p.merge-result) + (park | new.u.p.merge-result ~ lat.u.p.merge-result) + :: + ++ done + |= result=(each (set path) (pair term tang)) + ^+ ..merge + (emit hen %give %mere result) + :: + +$ merge-result [conflicts=(set path) new=yoki lat=(map lobe blob)] + ++ merge-by-germ + |= [=ali=yaki bob-yaki=(unit yaki)] + ^- (each (unit merge-result) [term tang]) + :: + :: If this is an %init merge, we set the ali's commit to be + :: bob's. + :: + ?: ?=(%init germ) + &+`[conflicts=~ new=|+ali-yaki lat=~] + :: + =/ bob-yaki (need bob-yaki) + |^ + ^- (each (unit merge-result) [term tang]) + ?- germ + :: + :: If this is a %this merge, we check to see if ali's and bob's + :: commits are the same, in which case we're done. Otherwise, we + :: check to see if ali's commit is in the ancestry of bob's, in + :: which case we're done. Otherwise, we create a new commit with + :: bob's data plus ali and bob as parents. + :: + %this + ?: =(r.ali-yaki r.bob-yaki) + &+~ + ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + &+~ + :* %& ~ + conflicts=~ + new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki q.bob-yaki)] + lat=~ + == + :: + :: If this is a %that merge, we check to see if ali's and bob's + :: commits are the same, in which case we're done. Otherwise, we + :: create a new commit with ali's data plus ali and bob as + :: parents. + :: + %that + ?: =(r.ali-yaki r.bob-yaki) + &+~ + :* %& ~ + conflicts=~ + new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki q.ali-yaki)] + lat=~ + == + :: + :: If this is a %fine merge, we check to see if ali's and bob's + :: commits are the same, in which case we're done. Otherwise, we + :: check to see if ali's commit is in the ancestry of bob's, in + :: which case we're done. Otherwise, we check to see if bob's + :: commit is in the ancestry of ali's. If not, this is not a + :: fast-forward merge, so we error out. If it is, we add ali's + :: commit to bob's desk and checkout. + :: + %fine + ?: =(r.ali-yaki r.bob-yaki) + &+~ + ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + &+~ + ?. (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) + :~ %| %bad-fine-merge + leaf+"tried fast-forward but is not ancestor or descendant" + == + &+`[conflicts=~ new=|+ali-yaki lat=~] + :: + ?(%meet %mate %meld) + ?: =(r.ali-yaki r.bob-yaki) + &+~ + ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + &+~ + ?: (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) + $(germ %fine) + =/ merge-points find-merge-points + ?~ merge-points + :~ %| %merge-no-merge-base + leaf+"consider a %this or %that merge to get a mergebase" + == + =/ merge-point=yaki n.merge-points + ?. ?=(%meet germ) + =/ ali-diffs=cane (diff-base ali-yaki bob-yaki merge-point) + =/ bob-diffs=cane (diff-base bob-yaki ali-yaki merge-point) + =/ bof=(map path (unit cage)) + (merge-conflicts can.ali-diffs can.bob-diffs) + &+`(build ali-yaki bob-yaki merge-point ali-diffs bob-diffs bof) + =/ ali-diffs=cane (calc-diffs ali-yaki merge-point) + =/ bob-diffs=cane (calc-diffs bob-yaki merge-point) + =/ both-diffs=(map path *) + %- %~ int by + %- ~(uni by `(map path *)`new.ali-diffs) + %- ~(uni by `(map path *)`cal.ali-diffs) + %- ~(uni by `(map path *)`can.ali-diffs) + `(map path *)`old.ali-diffs + %- ~(uni by `(map path *)`new.bob-diffs) + %- ~(uni by `(map path *)`cal.bob-diffs) + %- ~(uni by `(map path *)`can.bob-diffs) + `(map path *)`old.bob-diffs + ?. =(~ both-diffs) + :~ %| %meet-conflict + >~(key by both-diffs)< + leaf+"consider a %mate merge" + == + =/ not-deleted=(map path lobe) + %+ roll ~(tap by (~(uni by old.ali-diffs) old.bob-diffs)) + =< .(not-deleted q.merge-point) + |= [[pax=path ~] not-deleted=(map path lobe)] + (~(del by not-deleted) pax) + =/ hat=(map path lobe) + %- ~(uni by not-deleted) + %- ~(uni by new.ali-diffs) + %- ~(uni by new.bob-diffs) + %- ~(uni by cal.ali-diffs) + cal.bob-diffs + :* %& ~ + conflicts=~ + new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki hat)] + lat=~ + == + == + :: + ++ to-yuki + |= m=(map path lobe) + ^- (map path (each page lobe)) + (~(run by m) |=(=lobe |+lobe)) + :: + ++ reachable-takos + |= tak=tako + ^- (set tako) + |- ^- (set tako) + =/ =yaki (~(got by hut.ran) tak) + %+ roll p.yaki + =< .(takos (~(put in *(set tako)) tak)) + |= [q=tako takos=(set tako)] + ?: (~(has in takos) q) :: already done + takos :: hence skip + (~(uni in takos) ^$(tak q)) :: otherwise traverse + :: + :: Find the most recent common ancestor(s). + :: + :: Pretty sure this could be a lot more efficient. + :: + ++ find-merge-points + ^- (set yaki) + %- reduce-merge-points + =+ r=(reachable-takos r.ali-yaki) + |- ^- (set yaki) + ~! bob-yaki + ?: (~(has in r) r.bob-yaki) (~(put in *(set yaki)) bob-yaki) + %+ roll p.bob-yaki + |= [t=tako s=(set yaki)] + ?: (~(has in r) t) + (~(put in s) (~(got by hut.ran) t)) + (~(uni in s) ^$(bob-yaki (~(got by hut.ran) t))) + :: + :: Eliminate redundant merge-point candidates + :: + ++ reduce-merge-points + |= unk=(set yaki) + =| gud=(set yaki) + =/ zar=(map tako (set tako)) + %+ roll ~(tap in unk) + |= [yak=yaki qar=(map tako (set tako))] + (~(put by qar) r.yak (reachable-takos r.yak)) + |- + ^- (set yaki) + ?~ unk gud + =+ bun=(~(del in `(set yaki)`unk) n.unk) + ?: %+ levy ~(tap by (~(uni in gud) bun)) + |= yak=yaki + !(~(has in (~(got by zar) r.yak)) r.n.unk) + $(gud (~(put in gud) n.unk), unk bun) + $(unk bun) + :: + :: The set of changes between the mergebase and one of the desks + :: being merged + :: + :: -- `new` is the set of files in the new desk and not in the + :: mergebase. + :: -- `cal` is the set of changes in the new desk from the + :: mergebase except for any that are also in the other new desk. + :: -- `can` is the set of changes in the new desk from the + :: mergebase that are also in the other new desk (potential + :: conflicts). + :: -- `old` is the set of files in the mergebase and not in the + :: new desk. + :: + +$ cane + $: new=(map path lobe) + cal=(map path lobe) + can=(map path cage) + old=(map path ~) + == + :: + :: Calculate cane knowing there are no files changed by both + :: desks + :: + ++ calc-diffs + |= [hed=yaki bas=yaki] + ^- cane + :* %- molt + %+ skip ~(tap by q.hed) + |= [pax=path lob=lobe] + (~(has by q.bas) pax) + :: + %- molt + %+ skip ~(tap by q.hed) + |= [pax=path lob=lobe] + =+ (~(get by q.bas) pax) + |(=(~ -) =([~ lob] -)) + :: + ~ + :: + %- malt ^- (list [path ~]) + %+ murn ~(tap by q.bas) + |= [pax=path lob=lobe] + ^- (unit (pair path ~)) + ?. =(~ (~(get by q.hed) pax)) + ~ + `[pax ~] + == + :: + :: Diff yak against bas where different from yuk + :: + ++ diff-base + |= [yak=yaki yuk=yaki bas=yaki] + ^- cane + =/ new=(map path lobe) + %- malt + %+ skip ~(tap by q.yak) + |= [=path =lobe] + (~(has by q.bas) path) + :: + =/ cal=(map path lobe) + %- malt ^- (list [path lobe]) + %+ murn ~(tap by q.bas) + |= [pax=path lob=lobe] + ^- (unit (pair path lobe)) + =+ a=(~(get by q.yak) pax) + =+ b=(~(get by q.yuk) pax) + ?. ?& ?=(^ a) + !=([~ lob] a) + =([~ lob] b) + == + ~ + `[pax +.a] + :: + =/ can=(map path cage) + %- malt + %+ murn ~(tap by q.bas) + |= [=path =lobe] + ^- (unit [^path cage]) + =/ in-yak (~(get by q.yak) path) + ?~ in-yak + ~ + ?: =(lobe u.in-yak) + ~ + =/ in-yuk (~(get by q.yuk) path) + ?~ in-yuk + ~ + ?: =(lobe u.in-yuk) + ~ + ?: =(u.in-yak u.in-yuk) + ~ + `[path (diff-lobes lobe u.in-yak)] + :: + =/ old=(map path ~) + %- malt ^- (list [path ~]) + %+ murn ~(tap by q.bas) + |= [pax=path lob=lobe] + ?. =(~ (~(get by q.yak) pax)) + ~ + (some pax ~) + :: + [new cal can old] + :: + :: These can/should save their caches + :: + ++ lobe-to-cage + |= =lobe + ^- cage + =^ =page fod.dom + %- wrap:fusion + (lobe-to-page:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) lobe) + =^ =cage fod.dom + %- wrap:fusion + (page-to-cage:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) page) + cage + :: + ++ get-dais + |= =mark + ^- dais + =^ =dais fod.dom + %- wrap:fusion + (get-mark:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) mark) + dais + :: + :: Diff two files on bob-desk + :: + ++ diff-lobes + |= [=a=lobe =b=lobe] + ^- cage + =/ a-cage (lobe-to-cage a-lobe) + =/ b-cage (lobe-to-cage b-lobe) + ?> =(p.a-cage p.b-cage) + =/ =dais (get-dais p.a-cage) + [form:dais (~(diff dais q.a-cage) q.b-cage)] + :: + :: Merge diffs that are on the same file. + :: + ++ merge-conflicts + |= [ali-conflicts=(map path cage) bob-conflicts=(map path cage)] + ^- (map path (unit cage)) + %- ~(urn by (~(int by ali-conflicts) bob-conflicts)) + |= [=path *] + ^- (unit cage) + =/ cal=cage (~(got by ali-conflicts) path) + =/ cob=cage (~(got by bob-conflicts) path) + =/ =mark + =+ (slag (dec (lent path)) path) + ?~(- %$ i.-) + =/ =dais (get-dais mark) + =/ res=(unit (unit vase)) (~(join dais bunt:dais) q.cal q.cob) + ?~ res + ~ + ?~ u.res + ~ + `[form:dais u.u.res] + :: + :: Apply the patches in bof to get the new merged content. + :: + :: Gather all the changes between ali's and bob's commits and the + :: mergebase. This is similar to the %meet of ++merge, except + :: where they touch the same file, we use the merged versions. + :: + ++ build + |= $: ali=yaki + bob=yaki + bas=yaki + dal=cane + dob=cane + bof=(map path (unit cage)) + == + ^- merge-result + =/ both-patched=(map path cage) + %- malt + %+ murn ~(tap by bof) + |= [=path cay=(unit cage)] + ^- (unit [^path cage]) + ?~ cay + ~ + :+ ~ path + =+ (~(get by q.bas) path) + ?~ - + ~| %mate-strange-diff-no-base + !! + =/ =cage (lobe-to-cage u.-) + =/ =dais (get-dais p.cage) + ?> =(p.u.cay form.dais) + :- p.cage + (~(pact dais q.cage) q.u.cay) + =/ con=(map path *) :: 2-change conflict + %- molt + %+ skim ~(tap by bof) + |=([pax=path cay=(unit cage)] ?=(~ cay)) + =/ cab=(map path lobe) :: conflict base + %- ~(urn by con) + |= [pax=path *] + (~(got by q.bas) pax) + =. con :: change+del conflict + %- ~(uni by con) + %- malt ^- (list [path *]) + %+ skim ~(tap by old.dal) + |= [pax=path ~] + ?: (~(has by new.dob) pax) + ~| %strange-add-and-del + !! + (~(has by can.dob) pax) + =. con :: change+del conflict + %- ~(uni by con) + %- malt ^- (list [path *]) + %+ skim ~(tap by old.dob) + |= [pax=path ~] + ?: (~(has by new.dal) pax) + ~| %strange-del-and-add + !! + (~(has by can.dal) pax) + =. con :: add+add conflict + %- ~(uni by con) + %- malt ^- (list [path *]) + %+ skip ~(tap by (~(int by new.dal) new.dob)) + |= [pax=path *] + =((~(got by new.dal) pax) (~(got by new.dob) pax)) + =/ old=(map path lobe) :: oldies but goodies + %+ roll ~(tap by (~(uni by old.dal) old.dob)) + =< .(old q.bas) + |= [[pax=path ~] old=(map path lobe)] + (~(del by old) pax) + =/ [hot=(map path lobe) lat=(map lobe blob)] :: new content + %+ roll ~(tap by both-patched) + |= [[pax=path cay=cage] hat=(map path lobe) lat=(map lobe blob)] + =/ =blob [%direct (page-to-lobe [p q.q]:cay) [p q.q]:cay] + :- (~(put by hat) pax p.blob) + ?: (~(has by lat) p.blob) + lat + (~(put by lat) p.blob blob) + =/ hat=(map path lobe) :: all the content + %- ~(uni by old) + %- ~(uni by new.dal) + %- ~(uni by new.dob) + %- ~(uni by cal.dal) + %- ~(uni by cal.dob) + %- ~(uni by hot) + cab + =/ del=(map path ?) + (~(run by (~(uni by old.dal) old.dob)) |=(~ %|)) + =/ new &+[[r.bob r.ali ~] (~(run by hat) |=(=lobe |+lobe))] + :* (silt (turn ~(tap by con) head)) + new + lat + == + -- + -- + :: :: Set permissions for a node. :: ++ perm @@ -4916,26 +5378,9 @@ %merg :: direct state up ?: =(%$ des.req) ~&(%merg-no-desk !!) - =. act.ruf - =/ =dojo (~(gut by dos.rom.ruf) des.req *dojo) - =/ writer=form:merge-clad - %- %- merge - :* our - now - [her dem]:req - [our des.req] - cas.req - mon.ruf - hez.ruf - == - :* how.req - dom.dojo - ran.ruf - == - `[hen req %merge (from-form:eval:merge-clad writer)] =^ mos ruf =/ den ((de our now ski hen ruf) our des.req) - abet:(take-merge:den clad-init-sign) + abet:(start-merge:den her.req dem.req cas.req how.req) [mos ..^$] :: %mont @@ -5118,11 +5563,15 @@ ?^ dud ~|(%clay-take-dud (mean tang.u.dud)) :: - ?: ?=([%merge @ *] tea) + ?: ?=([%merge @ @ @ @ ~] tea) + ?> ?=(%writ +<.q.hin) =* syd i.t.tea + =/ ali-ship (slav %p i.t.t.tea) + =* ali-desk i.t.t.t.tea + =/ germ (germ i.t.t.t.t.tea) =^ mos ruf - =/ den ((de our now ski hen ruf) our syd) - abet:(take-merge:den q.hin) + =/ den ((de our now ski hen ruf) our i.t.tea) + abet:(merge:den ali-ship ali-desk germ p.q.hin) [mos ..^$] :: ?: ?=([%mount @ *] tea) @@ -5245,7 +5694,7 @@ %crud [[[hen %slip %d %flog +.q.hin] ~] ..^$] :: - %made ~|(%clay-raw-ford !!) + %made ~& %clay-raw-ford [~ ..^$] %mere ?: ?=(%& -.p.+.q.hin) ~& 'initial merge succeeded' From 9a1183e69f280aa05e8e19b5c45ca047b0ff74ea Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 00:02:37 -0700 Subject: [PATCH 111/280] clay: remove -merge --- pkg/arvo/ted/merge.hoon | 461 ---------------------------------------- 1 file changed, 461 deletions(-) delete mode 100644 pkg/arvo/ted/merge.hoon diff --git a/pkg/arvo/ted/merge.hoon b/pkg/arvo/ted/merge.hoon deleted file mode 100644 index 1baaf53aa..000000000 --- a/pkg/arvo/ted/merge.hoon +++ /dev/null @@ -1,461 +0,0 @@ -:: Merge second desk into first -:: -/- spider -/+ strandio -=, strand=strand:spider -=, clay -^- thread:spider -|= arg=vase -=+ !<([=bob=desk =ali=ship =ali=desk =germ ~] arg) -=/ m (strand ,vase) -^- form:m -;< our=@p bind:m get-our:strandio -;< now=@da bind:m get-time:strandio -:: -:: Fetch current states -:: -=/ start-path /(scot %p our)/[bob-desk]/(scot %da now) -;< =ali=riot:clay bind:m - (warp:strandio ali-ship ali-desk `[%sing %v da+now /]) -:: -;< wen=@da bind:m get-time:strandio -|^ -?> ?=(^ ali-riot) -=+ !<(=ali=dome q.r.u.ali-riot) -=/ ali-tako=tako (~(got by hit.ali-dome) let.ali-dome) -=+ .^(=ali=yaki %cs (weld start-path /yaki/(scot %uv ali-tako))) -=+ .^(=bob=dome %cv start-path) -=/ bob-yaki=(unit yaki) - ?~ let.bob-dome - ~ - =/ bob-tako=tako (~(got by hit.bob-dome) let.bob-dome) - `.^(=bob=yaki %cs (weld start-path /yaki/(scot %uv bob-tako))) -:: -;< =merge-result bind:m (merge ali-yaki bob-yaki) -?~ merge-result - (pure:m !>(~)) -=/ =rang [~ lat.u.merge-result] -=/ args [bob-desk new.u.merge-result rang] -;< ~ bind:m - (send-raw-card:strandio %pass /merg/[bob-desk]/[ali-desk] %arvo %c %park args) -(pure:m !>(conflicts.u.merge-result)) -:: -+$ merge-result - %- unit - $: conflicts=(set path) - new=yoki - lat=(map lobe blob) - == -:: -++ merge - |= [=ali=yaki bob-yaki=(unit yaki)] - =/ m (strand ,merge-result) - ^- form:m - :: - :: If this is an %init merge, we set the ali's commit to be bob's. - :: - ?: ?=(%init germ) - (pure:m ~ conflicts=~ new=|+ali-yaki lat=~) - :: - =/ bob-yaki (need bob-yaki) - |^ - ?- germ - :: - :: If this is a %this merge, we check to see if ali's and bob's commits - :: are the same, in which case we're done. Otherwise, we check to see - :: if ali's commit is in the ancestry of bob's, in which case we're - :: done. Otherwise, we create a new commit with bob's data plus ali - :: and bob as parents. - :: - %this - ?: =(r.ali-yaki r.bob-yaki) - (pure:m ~) - ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) - (pure:m ~) - %: pure:m - ~ - conflicts=~ - new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki q.bob-yaki)] - lat=~ - == - :: - :: If this is a %that merge, we check to see if ali's and bob's commits - :: are the same, in which case we're done. Otherwise, we create a new - :: commit with ali's data plus ali and bob as parents. - :: - %that - ?: =(r.ali-yaki r.bob-yaki) - (pure:m ~) - %: pure:m - ~ - conflicts=~ - new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki q.ali-yaki)] - lat=~ - == - :: - :: If this is a %fine merge, we check to see if ali's and bob's commits - :: are the same, in which case we're done. Otherwise, we check to see - :: if ali's commit is in the ancestry of bob's, in which case we're - :: done. Otherwise, we check to see if bob's commit is in the ancestry - :: of ali's. If not, this is not a fast-forward merge, so we error - :: out. If it is, we add ali's commit to bob's desk and checkout. - :: - :: - %fine - ?: =(r.ali-yaki r.bob-yaki) - (pure:m ~) - ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) - (pure:m ~) - ?. (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) - %^ error %bad-fine-merge - leaf+"tried fast-forward but is not ancestor or descendant" - ~ - (pure:m ~ conflicts=~ new=|+ali-yaki lat=~) - :: - ?(%meet %mate %meld) - ?: =(r.ali-yaki r.bob-yaki) - (pure:m ~) - ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) - (pure:m ~) - ?: (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) - $(germ %fine) - =/ merge-points find-merge-points - ?~ merge-points - %^ error %merge-no-merge-base - leaf+"consider a %this or %that merge to get a mergebase" - ~ - =/ merge-point=yaki n.merge-points - ?. ?=(%meet germ) - =/ ali-diffs=cane (diff-base ali-yaki bob-yaki merge-point) - =/ bob-diffs=cane (diff-base bob-yaki ali-yaki merge-point) - =/ bof=(map path (unit cage)) - (merge-conflicts can.ali-diffs can.bob-diffs) - =/ [conflicts=(set path) new=yoki lat=(map lobe blob)] - (build ali-yaki bob-yaki merge-point ali-diffs bob-diffs bof) - (pure:m `[conflicts new lat]) - =/ ali-diffs=cane (calc-diffs ali-yaki merge-point) - =/ bob-diffs=cane (calc-diffs bob-yaki merge-point) - =/ both-diffs=(map path *) - %- %~ int by - %- ~(uni by `(map path *)`new.ali-diffs) - %- ~(uni by `(map path *)`cal.ali-diffs) - %- ~(uni by `(map path *)`can.ali-diffs) - `(map path *)`old.ali-diffs - %- ~(uni by `(map path *)`new.bob-diffs) - %- ~(uni by `(map path *)`cal.bob-diffs) - %- ~(uni by `(map path *)`can.bob-diffs) - `(map path *)`old.bob-diffs - ?. =(~ both-diffs) - %: error %meet-conflict >~(key by both-diffs)< - leaf+"consider a %mate merge" ~ - == - =/ not-deleted=(map path lobe) - %+ roll ~(tap by (~(uni by old.ali-diffs) old.bob-diffs)) - =< .(not-deleted q.merge-point) - |= [[pax=path ~] not-deleted=(map path lobe)] - (~(del by not-deleted) pax) - =/ hat=(map path lobe) - %- ~(uni by not-deleted) - %- ~(uni by new.ali-diffs) - %- ~(uni by new.bob-diffs) - %- ~(uni by cal.ali-diffs) - cal.bob-diffs - %: pure:m - ~ - conflicts=~ - new=&+[[r.bob-yaki r.ali-yaki ~] (to-yuki hat)] - lat=~ - == - == - :: - ++ reachable-takos - |= tak=tako - ^- (set tako) - =/ start-path /(scot %p our)/[bob-desk]/(scot %da wen) - |- ^- (set tako) - =+ .^(=yaki %cs (weld start-path /yaki/(scot %uv tak))) - %+ roll p.yaki - =< .(takos (~(put in *(set tako)) tak)) - |= [q=tako takos=(set tako)] - ?: (~(has in takos) q) :: already done - takos :: hence skip - (~(uni in takos) ^$(tak q)) :: otherwise traverse - :: - :: Find the most recent common ancestor(s). - :: - :: Pretty sure this could be a lot more efficient. - :: - ++ find-merge-points - ^- (set yaki) - =/ start-path /(scot %p our)/[bob-desk]/(scot %da wen) - %- reduce-merge-points - =+ r=(reachable-takos r.ali-yaki) - |- ^- (set yaki) - ?: (~(has in r) r.bob-yaki) (~(put in *(set yaki)) bob-yaki) - %+ roll p.bob-yaki - |= [t=tako s=(set yaki)] - ?: (~(has in r) t) - (~(put in s) .^(yaki %cs (weld start-path /yaki/(scot %uv t)))) - (~(uni in s) ^$(bob-yaki .^(yaki %cs (weld start-path /yaki/(scot %uv t))))) - :: - :: Eliminate redundant merge-point candidates - :: - ++ reduce-merge-points - |= unk=(set yaki) - =| gud=(set yaki) - =/ zar=(map tako (set tako)) - %+ roll ~(tap in unk) - |= [yak=yaki qar=(map tako (set tako))] - (~(put by qar) r.yak (reachable-takos r.yak)) - |- - ^- (set yaki) - ?~ unk gud - =+ bun=(~(del in `(set yaki)`unk) n.unk) - ?: %+ levy ~(tap by (~(uni in gud) bun)) - |= yak=yaki - !(~(has in (~(got by zar) r.yak)) r.n.unk) - $(gud (~(put in gud) n.unk), unk bun) - $(unk bun) - :: - :: The set of changes between the mergebase and one of the desks - :: being merged - :: - :: -- `new` is the set of files in the new desk and not in the - :: mergebase. - :: -- `cal` is the set of changes in the new desk from the mergebase - :: except for any that are also in the other new desk. - :: -- `can` is the set of changes in the new desk from the mergebase - :: that are also in the other new desk (potential conflicts). - :: -- `old` is the set of files in the mergebase and not in the new - :: desk. - :: - +$ cane - $: new=(map path lobe) - cal=(map path lobe) - can=(map path cage) - old=(map path ~) - == - :: - :: Calculate cane knowing there are no files changed by both desks - :: - ++ calc-diffs - |= [hed=yaki bas=yaki] - ^- cane - :* %- molt - %+ skip ~(tap by q.hed) - |= [pax=path lob=lobe] - (~(has by q.bas) pax) - :: - %- molt - %+ skip ~(tap by q.hed) - |= [pax=path lob=lobe] - =+ (~(get by q.bas) pax) - |(=(~ -) =([~ lob] -)) - :: - ~ - :: - %- malt ^- (list [path ~]) - %+ murn ~(tap by q.bas) - |= [pax=path lob=lobe] - ^- (unit (pair path ~)) - ?. =(~ (~(get by q.hed) pax)) - ~ - `[pax ~] - == - :: - :: Diff yak against bas where different from yuk - :: - ++ diff-base - |= [yak=yaki yuk=yaki bas=yaki] - ^- cane - =/ new=(map path lobe) - %- malt - %+ skip ~(tap by q.yak) - |= [=path =lobe] - (~(has by q.bas) path) - :: - =/ cal=(map path lobe) - %- malt ^- (list [path lobe]) - %+ murn ~(tap by q.bas) - |= [pax=path lob=lobe] - ^- (unit (pair path lobe)) - =+ a=(~(get by q.yak) pax) - =+ b=(~(get by q.yuk) pax) - ?. ?& ?=(^ a) - !=([~ lob] a) - =([~ lob] b) - == - ~ - `[pax +.a] - :: - =/ can=(map path cage) - %- malt - %+ murn ~(tap by q.bas) - |= [=path =lobe] - ^- (unit [^path cage]) - =/ in-yak (~(get by q.yak) path) - ?~ in-yak - ~ - ?: =(lobe u.in-yak) - ~ - =/ in-yuk (~(get by q.yuk) path) - ?~ in-yuk - ~ - ?: =(lobe u.in-yuk) - ~ - ?: =(u.in-yak u.in-yuk) - ~ - `[path (diff-lobes lobe u.in-yak)] - :: - =/ old=(map path ~) - %- malt ^- (list [path ~]) - %+ murn ~(tap by q.bas) - |= [pax=path lob=lobe] - ?. =(~ (~(get by q.yak) pax)) - ~ - (some pax ~) - :: - [new cal can old] - :: - ++ start ~+ `path`/(scot %p our)/[bob-desk]/(scot %da wen) - ++ cb ~+ |=(=mark .^(dais %cb (weld start /[mark]))) - :: - :: Diff two files on bob-desk - :: - ++ diff-lobes - |= [=a=lobe =b=lobe] - ^- cage - =+ .^(=a=cage %cs (weld start /cage/(scot %uv a-lobe))) - =+ .^(=b=cage %cs (weld start /cage/(scot %uv b-lobe))) - ?> =(p.a-cage p.b-cage) - =/ =dais (cb p.a-cage) - [form:dais (~(diff dais q.a-cage) q.b-cage)] - :: - :: Merge diffs that are on the same file. - :: - ++ merge-conflicts - |= [ali-conflicts=(map path cage) bob-conflicts=(map path cage)] - ^- (map path (unit cage)) - %- ~(urn by (~(int by ali-conflicts) bob-conflicts)) - |= [=path *] - ^- (unit cage) - =/ cal=cage (~(got by ali-conflicts) path) - =/ cob=cage (~(got by bob-conflicts) path) - =/ =mark - =+ (slag (dec (lent path)) path) - ?~(- %$ i.-) - =+ .^(=dais %cb (weld start /[mark])) - =/ res=(unit (unit vase)) (~(join dais bunt:dais) q.cal q.cob) - ?~ res - ~ - ?~ u.res - ~ - `[form:dais u.u.res] - :: - :: Apply the patches in bof to get the new merged content. - :: - :: Gather all the changes between ali's and bob's commits and the - :: mergebase. This is similar to the %meet of ++merge, except - :: where they touch the same file, we use the merged versions. - :: - ++ build - |= $: ali=yaki - bob=yaki - bas=yaki - dal=cane - dob=cane - bof=(map path (unit cage)) - == - ^- [conflicts=(set path) new=yoki lat=(map lobe blob)] - =/ both-patched=(map path cage) - %- malt - %+ murn ~(tap by bof) - |= [=path cay=(unit cage)] - ^- (unit [^path cage]) - ?~ cay - ~ - :+ ~ path - =+ (~(get by q.bas) path) - ?~ - - ~| %mate-strange-diff-no-base - !! - =+ .^(=a=cage %cs (weld start /cage/(scot %uv u.-))) - =/ =dais (cb p.a-cage) - ?> =(p.u.cay form.dais) - :- p.a-cage - (~(pact dais q.a-cage) q.u.cay) - =/ con=(map path *) :: 2-change conflict - %- molt - %+ skim ~(tap by bof) - |=([pax=path cay=(unit cage)] ?=(~ cay)) - =/ cab=(map path lobe) :: conflict base - %- ~(urn by con) - |= [pax=path *] - (~(got by q.bas) pax) - =. con :: change+del conflict - %- ~(uni by con) - %- malt ^- (list [path *]) - %+ skim ~(tap by old.dal) - |= [pax=path ~] - ?: (~(has by new.dob) pax) - ~| %strange-add-and-del - !! - (~(has by can.dob) pax) - =. con :: change+del conflict - %- ~(uni by con) - %- malt ^- (list [path *]) - %+ skim ~(tap by old.dob) - |= [pax=path ~] - ?: (~(has by new.dal) pax) - ~| %strange-del-and-add - !! - (~(has by can.dal) pax) - =. con :: add+add conflict - %- ~(uni by con) - %- malt ^- (list [path *]) - %+ skip ~(tap by (~(int by new.dal) new.dob)) - |= [pax=path *] - =((~(got by new.dal) pax) (~(got by new.dob) pax)) - =/ old=(map path lobe) :: oldies but goodies - %+ roll ~(tap by (~(uni by old.dal) old.dob)) - =< .(old q.bas) - |= [[pax=path ~] old=(map path lobe)] - (~(del by old) pax) - =/ [hot=(map path lobe) lat=(map lobe blob)] :: new content - %+ roll ~(tap by both-patched) - |= [[pax=path cay=cage] hat=(map path lobe) lat=(map lobe blob)] - =/ =blob [%direct (page-to-lobe [p q.q]:cay) [p q.q]:cay] - :- (~(put by hat) pax p.blob) - ?: (~(has by lat) p.blob) - lat - (~(put by lat) p.blob blob) - =/ hat=(map path lobe) :: all the content - %- ~(uni by old) - %- ~(uni by new.dal) - %- ~(uni by new.dob) - %- ~(uni by cal.dal) - %- ~(uni by cal.dob) - %- ~(uni by hot) - cab - =/ del=(map path ?) - (~(run by (~(uni by old.dal) old.dob)) |=(~ %|)) - =/ new &+[[r.bob r.ali ~] (~(run by hat) |=(=lobe |+lobe))] - :* (silt (turn ~(tap by con) head)) - new - lat - == - :: - ++ to-yuki - |= m=(map path lobe) - ^- (map path (each page lobe)) - (~(run by m) |=(=lobe |+lobe)) - -- -:: -++ error - |= [=term =tang] - %: strand-fail:strandio term - leaf+"failed merge from {}/{} to {}/{}" - leaf+"with strategy germ" - tang - == --- From 5474b2fab6074b6f956db0c43a0af4814ef23ee1 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 00:37:04 -0700 Subject: [PATCH 112/280] clay: remove turbo merge --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 1031 ++++++----------------------------- 2 files changed, 181 insertions(+), 854 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d8e74ec6e..5e7399df4 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:684f47c147418d1424376be0088d59063bda843c7749196400bf96e8293d3e43 -size 14063453 +oid sha256:2354006941fe93cce37cb3f626499e5859cd6b2042814288f574e1e9b1910447 +size 13921587 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 88b6a1759..eeb284f5b 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -165,18 +165,10 @@ $: hen=duct req=task:able $= eval-data - $% [%merge merge=eval-form:eval:merge-clad] - [%mount mount=eval-form:eval:mount-clad] + $% [%mount mount=eval-form:eval:mount-clad] == == :: -:: The clad monad for merges. -:: -:: Same as +commit-clad, except includes a set of paths documenting the -:: conflicts encountered in the merge. -:: -++ merge-clad (clad ,[(set path) dome rang]) -:: :: The clad monad for mounts. :: :: Just a new mount point and mime cache. @@ -659,760 +651,6 @@ |= [=wove ducts=(set duct)] [ducts (print-wove wove)] :: -:: This transaction respresents a currently running merge. We always -:: say we're merging from 'ali' to 'bob'. The basic steps, not all of -:: which are always needed, are: -:: -:: -- fetch ali's desk -:: -- diff ali's desk against the mergebase -:: -- diff bob's desk against the mergebase -:: -- merge the diffs -:: -- build the new state -:: -- "checkout" (apply to actual `++dome`) the new state -:: -- "ergo" (tell unix about) any changes -:: -++ merge - :: Global constants. These do not change during a merge. - :: - |= $: our=ship - wen=@da - ali-disc=(pair ship desk) - bob-disc=(pair ship desk) - cas=case - mon=(map term beam) - hez=(unit duct) - == - :: Run ford operations on ali unless it's a foreign desk - :: - =/ ford-disc=disc:ford - ?: =(p.ali-disc p.bob-disc) - ali-disc - bob-disc - |^ - :: Initial arguments - :: - |= [gem=germ dom=dome ran=rang] - =/ m merge-clad - ^- form:m - =/ e (cor dom ran) - ;< [bob=(unit yaki) gem=germ] bind:m (get-bob:e gem) - ;< [ali=yaki e=_*cor] bind:m fetch-ali:e - ;< $= res - %- unit - $: conflicts=(set path) - bop=(map path cage) - new=yaki - erg=(map path ?) - e=_*cor - == - bind:m - (merge:e gem cas ali bob) - ?~ res - :: if no changes, we're done - :: - (pure:m ~ dom:e ran:e) - =. e e.u.res - ;< e=_*cor bind:m (checkout:e gem cas bob new.u.res bop.u.res) - ;< mim=(map path mime) bind:m (ergo:e gem cas mon erg.u.res new.u.res) - =. mim.dom.e mim - (pure:m conflicts.u.res dom:e ran:e) - :: - :: A stateful core, where the global state is a dome and a rang. - :: - :: These are the global state variables that a merge may change. - :: - ++ cor - |= [dom=dome ran=rang] - =/ original-dome dom - |% - ++ this-cor . - ++ sutil (state:util original-dome dom ran) - :: - :: Fetch the local disk, if it's there. - :: - ++ get-bob - |= gem=germ - =/ m (clad ,[bob=(unit yaki) gem=germ]) - ^- form:m - ?: &(=(0 let.dom) !?=(?(%init %that) gem)) - (error:he cas %no-bob-disc ~) - ?: =(0 let.dom) - (pure:m ~ %init) - =/ tak (~(get by hit.dom) let.dom) - ?~ tak - (error:he cas %no-bob-version ~) - =/ bob (~(get by hut.ran) u.tak) - ?~ bob - (error:he cas %no-bob-commit ~) - (pure:m `u.bob gem) - :: - :: Tell clay to get the state at the requested case for ali's desk. - :: - ++ fetch-ali - =/ m (clad ,[ali=yaki e=_this-cor]) - ^- form:m - ;< ~ bind:m - %+ just-do /fetch-ali - [%c %warp p.ali-disc q.ali-disc `[%sing %v cas /]] - ;< [rot=riot r=rang] bind:m (expect-clay ran) - =. ran r - ?~ rot - (error:he cas %bad-fetch-ali ~) - =/ ali-dome - ;; $: ank=* - let=@ud - hit=(map @ud tako) - lab=(map @tas @ud) - == - q.q.r.u.rot - ?: =(0 let.ali-dome) - (error:he cas %no-ali-disc ~) - =/ tak (~(get by hit.ali-dome) let.ali-dome) - ?~ tak - (error:he cas %no-ali-version ~) - =/ ali (~(get by hut.ran) u.tak) - ?~ ali - (error:he cas %no-ali-commit ~) - (pure:m u.ali this-cor) - :: - :: Produce null if nothing to do; else perform merge - :: - ++ merge - |= [gem=germ cas=case ali=yaki bob=(unit yaki)] - =/ m - %- clad - %- unit - $: conflicts=(set path) - bop=(map path cage) - new=yaki - erg=(map path ?) - e=_this-cor - == - ^- form:m - ?- gem - :: - :: If this is an %init merge, we set the ali's commit to be bob's, and - :: we checkout the new state. - :: - $init - %^ pure:m ~ ~ - :^ ~ - ali - (~(run by q.ali) |=(lobe %&)) - this-cor(hut.ran (~(put by hut.ran) r.ali ali)) - :: - :: If this is a %this merge, we check to see if ali's and bob's commits - :: are the same, in which case we're done. Otherwise, we check to see - :: if ali's commit is in the ancestry of bob's, in which case we're - :: done. Otherwise, we create a new commit with bob's data plus ali - :: and bob as parents. - :: - $this - =/ bob (need bob) - ?: =(r.ali r.bob) - (pure:m ~) - ?: (~(has in (reachable-takos:sutil r.bob)) r.ali) - (pure:m ~) - =/ new (make-yaki:sutil [r.ali r.bob ~] q.bob wen) - %^ pure:m ~ ~ - :^ ~ - new - ~ - this-cor(hut.ran (~(put by hut.ran) r.new new)) - :: - :: If this is a %that merge, we check to see if ali's and bob's commits - :: are the same, in which case we're done. Otherwise, we create a new - :: commit with ali's data plus ali and bob as parents. - :: - $that - =/ bob (need bob) - ?: =(r.ali r.bob) - (pure:m ~) - =/ new (make-yaki:sutil [r.ali r.bob ~] q.ali wen) - %^ pure:m ~ ~ - :^ ~ - new - %- malt ^- (list {path ?}) - %+ murn ~(tap by (~(uni by q.bob) q.ali)) - |= {pax/path lob/lobe} - ^- (unit {path ?}) - =+ a=(~(get by q.ali) pax) - =+ b=(~(get by q.bob) pax) - ?: =(a b) - ~ - `[pax !=(~ a)] - this-cor(hut.ran (~(put by hut.ran) r.new new)) - :: - :: If this is a %fine merge, we check to see if ali's and bob's commits - :: are the same, in which case we're done. Otherwise, we check to see - :: if ali's commit is in the ancestry of bob's, in which case we're - :: done. Otherwise, we check to see if bob's commit is in the ancestry - :: of ali's. If not, this is not a fast-forward merge, so we error - :: out. If it is, we add ali's commit to bob's desk and checkout. - :: - $fine - =/ bob (need bob) - ?: =(r.ali r.bob) - (pure:m ~) - ?: (~(has in (reachable-takos:sutil r.bob)) r.ali) - (pure:m ~) - ?. (~(has in (reachable-takos:sutil r.ali)) r.bob) - (error:he cas %bad-fine-merge ~) - %^ pure:m ~ ~ - :^ ~ - ali - %- malt ^- (list {path ?}) - %+ murn ~(tap by (~(uni by q.bob) q.ali)) - |= {pax/path lob/lobe} - ^- (unit {path ?}) - =+ a=(~(get by q.ali) pax) - =+ b=(~(get by q.bob) pax) - ?: =(a b) - ~ - `[pax !=(~ a)] - this-cor - :: - :: If this is a %meet, %mate, or %meld merge, we may need to - :: fetch more data. If this merge is either trivial or a - :: fast-forward, we short-circuit to either ++done or the %fine - :: case. - :: - :: Otherwise, we find the best common ancestor(s) with - :: ++find-merge-points. If there's no common ancestor, we error - :: out. Additionally, if there's more than one common ancestor - :: (i.e. this is a criss-cross merge), we error out. Something - :: akin to git's recursive merge should probably be used here, - :: but it isn't. - :: - :: Once we have our single best common ancestor (merge base), we - :: store it in bas. If this is a %mate or %meld merge, we diff - :: both against the mergebase, merge the conflicts, and build the - :: new commit. - :: - :: Otherwise (i.e. this is a %meet merge), we create a list of - :: all the changes between the mergebase and ali's commit and - :: store it in ali-diffs, and we put a similar list for bob's - :: commit in bob-diffs. Then we create bof, which is the a set - :: of changes in both ali and bob's commits. If this has any - :: members, we have conflicts, which is an error in a %meet - :: merge, so we error out. - :: - :: Otherwise, we merge the merge base data with ali's data and - :: bob's data, which produces the data for the new commit. - :: - ?($meet $mate $meld) - =/ bob (need bob) - ?: =(r.ali r.bob) - (pure:m ~) - ?. (~(has by hut.ran) r.bob) - (error:he cas %bad-bob-tako >r.bob< ~) - ?: (~(has in (reachable-takos:sutil r.bob)) r.ali) - (pure:m ~) - ?: (~(has in (reachable-takos:sutil r.ali)) r.bob) - $(gem %fine) - =+ r=(find-merge-points:he ali bob) - ?~ r - (error:he cas %merge-no-merge-base ~) - ?. ?=({* ~ ~} r) - =+ (lent ~(tap in `(set yaki)`r)) - (error:he cas %merge-criss-cross >[-]< ~) - =/ bas n.r - ?: ?=(?($mate $meld) gem) - ;< ali-diffs=cane bind:m (diff-bas ali bob bas) - ;< bob-diffs=cane bind:m (diff-bas bob ali bas) - ;< bof=(map path (unit cage)) bind:m - (merge-conflicts can.ali-diffs can.bob-diffs) - ;< $: conflicts=(set path) - bop=(map path cage) - new=yaki - erg=(map path ?) - e=_this-cor - == - bind:m - (build gem ali bob bas ali-diffs bob-diffs bof) - (pure:m `[conflicts bop new erg e]) - =/ ali-diffs=cane (calc-diffs:he ali bas) - =/ bob-diffs=cane (calc-diffs:he bob bas) - =/ bof=(map path *) - %- %~ int by - %- ~(uni by `(map path *)`new.ali-diffs) - %- ~(uni by `(map path *)`cal.ali-diffs) - %- ~(uni by `(map path *)`can.ali-diffs) - `(map path *)`old.ali-diffs - %- ~(uni by `(map path *)`new.bob-diffs) - %- ~(uni by `(map path *)`cal.bob-diffs) - %- ~(uni by `(map path *)`can.bob-diffs) - `(map path *)`old.bob-diffs - ?. =(~ bof) - (error:he cas %meet-conflict >~(key by bof)< ~) - =/ old=(map path lobe) - %+ roll ~(tap by (~(uni by old.ali-diffs) old.bob-diffs)) - =< .(old q.bas) - |= {{pax/path ~} old/(map path lobe)} - (~(del by old) pax) - =/ hat=(map path lobe) - %- ~(uni by old) - %- ~(uni by new.ali-diffs) - %- ~(uni by new.bob-diffs) - %- ~(uni by cal.ali-diffs) - cal.bob-diffs - =/ del=(map path ?) - (~(run by (~(uni by old.ali-diffs) old.bob-diffs)) |=(~ %|)) - =/ new (make-yaki:sutil [r.ali r.bob ~] hat wen) - %^ pure:m ~ ~ - :^ ~ - new - %- ~(uni by del) - ^- (map path ?) - %. |=(lobe %&) - ~(run by (~(uni by new.ali-diffs) cal.ali-diffs)) - this-cor(hut.ran (~(put by hut.ran) r.new new)) - == - :: - :: Diff a commit against the mergebase. - :: - ++ diff-bas - |= [yak=yaki yuk=yaki bas=yaki] - =/ m (clad ,cane) - ^- form:m - ;< ~ bind:m - %+ just-do /diff-bas - :* %f %build live=%.n %pin wen - %list - ^- (list schematic:ford) - %+ murn ~(tap by q.bas) - |= {pax/path lob/lobe} - ^- (unit schematic:ford) - =+ a=(~(get by q.yak) pax) - ?~ a - ~ - ?: =(lob u.a) - ~ - =+ (~(get by q.yuk) pax) - ?~ - - ~ - ?: =(u.a u.-) - ~ - :- ~ - =/ disc ford-disc - :- [%$ %path !>(pax)] - :^ %diff ford-disc - (lobe-to-schematic:sutil disc pax lob) - (lobe-to-schematic:sutil disc pax u.a) - == - ;< res=made-result:ford bind:m expect-ford - =+ tay=(made-result-to-cages-or-error:util res) - ?: ?=(%| -.tay) - (error:he cas %diff-ali-bad-made leaf+"merge diff ali failed" p.tay) - =+ can=(cages-to-map:util p.tay) - ?: ?=(%| -.can) - (error:he cas %diff-ali p.can) - %- pure:m - :* %- molt - %+ skip ~(tap by q.yak) - |= {pax/path lob/lobe} - (~(has by q.bas) pax) - :: - %- molt ^- (list (pair path lobe)) - %+ murn ~(tap by q.bas) - |= {pax/path lob/lobe} - ^- (unit (pair path lobe)) - =+ a=(~(get by q.yak) pax) - =+ b=(~(get by q.yuk) pax) - ?. ?& ?=(^ a) - !=([~ lob] a) - =([~ lob] b) - == - ~ - `[pax +.a] - :: - p.can - :: - %- malt ^- (list {path ~}) - %+ murn ~(tap by q.bas) - |= {pax/path lob/lobe} - ?. =(~ (~(get by q.yak) pax)) - ~ - (some pax ~) - == - :: - :: Merge diffs that are on the same file. - :: - ++ merge-conflicts - |= [conflicts-ali=(map path cage) conflicts-bob=(map path cage)] - =/ m (clad ,bof=(map path (unit cage))) - ^- form:m - ;< ~ bind:m - %+ just-do /merge-conflicts - :* %f %build live=%.n %list - ^- (list schematic:ford) - %+ turn - ~(tap by (~(int by conflicts-ali) conflicts-bob)) - |= {pax/path *} - ^- schematic:ford - =+ cal=(~(got by conflicts-ali) pax) - =+ cob=(~(got by conflicts-bob) pax) - =/ her - =+ (slag (dec (lent pax)) pax) - ?~(- %$ i.-) - :- [%$ %path !>(pax)] - [%join [p.bob-disc q.bob-disc] her [%$ cal] [%$ cob]] - == - ;< res=made-result:ford bind:m expect-ford - =+ tay=(made-result-to-cages-or-error:util res) - ?: ?=(%| -.tay) - (error:he cas %merge-bad-made leaf+"merging failed" p.tay) - =+ can=(cages-to-map:util p.tay) - ?: ?=(%| -.can) - (error:he cas %merge p.can) - %- pure:m - (~(run by p.can) (flit |=({a/mark ^} !?=($null a)))) - :: - :: Apply the patches in bof to get the new merged content. - :: - :: Gather all the changes between ali's and bob's commits and the - :: mergebase. This is similar to the %meet of ++merge, except - :: where they touch the same file, we use the merged versions. - :: - ++ build - |= $: gem=germ - ali=yaki - bob=yaki - bas=yaki - dal=cane - dob=cane - bof=(map path (unit cage)) - == - =/ m - %- clad - $: conflicts=(set path) - bop=(map path cage) - new=yaki - erg=(map path ?) - e=_this-cor - == - ^- form:m - ;< ~ bind:m - %+ just-do /build - :* %f %build live=%.n %list - ^- (list schematic:ford) - %+ murn ~(tap by bof) - |= {pax/path cay/(unit cage)} - ^- (unit schematic:ford) - ?~ cay - ~ - :- ~ - :- [%$ %path !>(pax)] - =+ (~(get by q.bas) pax) - ?~ - - ~| %mate-strange-diff-no-base - !! - :* %pact - [p.bob-disc q.bob-disc] - (lobe-to-schematic:sutil ford-disc pax u.-) - [%$ u.cay] - == - == - ;< res=made-result:ford bind:m expect-ford - =+ tay=(made-result-to-cages-or-error:util res) - ?: ?=(%| -.tay) - (error:he cas %build-bad-made leaf+"delta building failed" p.tay) - =/ bop (cages-to-map:util p.tay) - ?: ?=(%| -.bop) - (error:he cas %built p.bop) - =/ both-patched p.bop - =/ con=(map path *) :: 2-change conflict - %- molt - %+ skim ~(tap by bof) - |=({pax/path cay/(unit cage)} ?=(~ cay)) - =/ cab=(map path lobe) :: conflict base - %- ~(urn by con) - |= {pax/path *} - (~(got by q.bas) pax) - =. con :: change+del conflict - %- ~(uni by con) - %- malt ^- (list {path *}) - %+ skim ~(tap by old.dal) - |= {pax/path ~} - ?: (~(has by new.dob) pax) - ~| %strange-add-and-del - !! - (~(has by can.dob) pax) - =. con :: change+del conflict - %- ~(uni by con) - %- malt ^- (list {path *}) - %+ skim ~(tap by old.dob) - |= {pax/path ~} - ?: (~(has by new.dal) pax) - ~| %strange-del-and-add - !! - (~(has by can.dal) pax) - =. con :: add+add conflict - %- ~(uni by con) - %- malt ^- (list {path *}) - %+ skip ~(tap by (~(int by new.dal) new.dob)) - |= {pax/path *} - =((~(got by new.dal) pax) (~(got by new.dob) pax)) - ?: &(?=($mate gem) ?=(^ con)) - =+ (turn ~(tap by `(map path *)`con) |=({path *} >[+<-]<)) - (error:he cas %mate-conflict -) - =/ old=(map path lobe) :: oldies but goodies - %+ roll ~(tap by (~(uni by old.dal) old.dob)) - =< .(old q.bas) - |= {{pax/path ~} old/(map path lobe)} - (~(del by old) pax) - =/ can=(map path cage) :: content changes - %- molt - ^- (list (pair path cage)) - %+ murn ~(tap by bof) - |= {pax/path cay/(unit cage)} - ^- (unit (pair path cage)) - ?~ cay - ~ - `[pax u.cay] - =^ hot lat.ran :: new content - ^- {(map path lobe) (map lobe blob)} - %+ roll ~(tap by can) - =< .(lat lat.ran) - |= {{pax/path cay/cage} hat/(map path lobe) lat/(map lobe blob)} - =+ ^= bol - =+ (~(get by q.bas) pax) - ?~ - - ~| %mate-strange-diff-no-base - !! - %^ make-delta-blob:sutil - (page-to-lobe:sutil [p q.q]:(~(got by both-patched) pax)) - [(lobe-to-mark:sutil u.-) u.-] - [p q.q]:cay - :- (~(put by hat) pax p.bol) - ?: (~(has by lat) p.bol) - lat - (~(put by lat) p.bol bol) - :: ~& old=(~(run by old) mug) - :: ~& newdal=(~(run by new.dal) mug) - :: ~& newdob=(~(run by new.dob) mug) - :: ~& caldal=(~(run by cal.dal) mug) - :: ~& caldob=(~(run by cal.dob) mug) - :: ~& hot=(~(run by hot) mug) - :: ~& cas=(~(run by cas) mug) - =/ hat=(map path lobe) :: all the content - %- ~(uni by old) - %- ~(uni by new.dal) - %- ~(uni by new.dob) - %- ~(uni by cal.dal) - %- ~(uni by cal.dob) - %- ~(uni by hot) - cab - =/ del=(map path ?) - (~(run by (~(uni by old.dal) old.dob)) |=(~ %|)) - =/ new (make-yaki:sutil [r.ali r.bob ~] hat wen) - %- pure:m - :* (silt (turn ~(tap by con) head)) - both-patched - new - :: - %- ~(uni by del) - ^- (map path ?) - %. |=(lobe %&) - %~ run by - %- ~(uni by new.dal) - %- ~(uni by cal.dal) - %- ~(uni by cab) - hot - :: - this-cor(hut.ran (~(put by hut.ran) r.new new)) - == - :: - :: Convert new commit into actual data (i.e. blobs rather than - :: lobes). Apply the new commit to our state - :: - ++ checkout - |= [gem=germ cas=case bob=(unit yaki) new=yaki bop=(map path cage)] - =/ m (clad ,_this-cor) - ^- form:m - ;< ~ bind:m - =/ val=beak - ?: ?=($init gem) - [p.ali-disc q.ali-disc cas] - [p.bob-disc q.bob-disc da+wen] - %+ just-do /checkout - :* %f %build live=%.n %pin wen %list - ^- (list schematic:ford) - %+ murn ~(tap by q.new) - |= {pax/path lob/lobe} - ^- (unit schematic:ford) - ?: (~(has by bop) pax) - ~ - :+ ~ - [%$ %path !>(pax)] - (merge-lobe-to-schematic:he (fall bob *yaki) ford-disc pax lob) - == - ;< res=made-result:ford bind:m expect-ford - =+ tay=(made-result-to-cages-or-error:util res) - ?: ?=(%| -.tay) - (error:he cas %checkout-bad-made leaf+"merge checkout failed" p.tay) - =+ can=(cages-to-map:util p.tay) - ?: ?=(%| -.can) - (error:he cas %checkout p.can) - =. let.dom +(let.dom) - =. hit.dom (~(put by hit.dom) let.dom r.new) - =. ank.dom - %- map-to-ankh:sutil - %- ~(run by (~(uni by bop) p.can)) - |=(cage [(page-to-lobe:sutil p q.q) +<]) - (pure:m this-cor) - :: - :: Cast all the content that we're going to tell unix about to - :: %mime, then tell unix. - :: - ++ ergo - |= [gem=germ cas=case mon=(map term beam) erg=(map path ?) new=yaki] - =/ m (clad ,mim=(map path mime)) - ^- form:m - =+ must=(must-ergo:util our q.bob-disc mon (turn ~(tap by erg) head)) - ?: =(~ must) - (pure:m mim.dom) - =/ sum=(set path) - =+ (turn ~(tap by must) (corl tail tail)) - %+ roll - - |= {pak/(set path) acc/(set path)} - (~(uni in acc) pak) - =/ val=beak - ?: ?=($init gem) - [p.ali-disc q.ali-disc cas] - [p.bob-disc q.bob-disc da+wen] - ;< ~ bind:m - %+ just-do /ergo - :* %f %build live=%.n %pin wen %list - ^- (list schematic:ford) - %+ turn ~(tap in sum) - |= a/path - ^- schematic:ford - :- [%$ %path !>(a)] - =+ b=(~(got by erg) a) - ?. b - [%$ %null !>(~)] - =/ disc ford-disc :: [p q]:val - :^ %cast ford-disc %mime - (lobe-to-schematic:sutil disc a (~(got by q.new) a)) - == - ;< res=made-result:ford bind:m expect-ford - =+ tay=(made-result-to-cages-or-error:util res) - ?: ?=(%| -.tay) - (error:he cas %ergo-bad-made leaf+"merge ergo failed" p.tay) - =+ =| nac=mode - |- ^- tan=$^(mode {p/term q/tang}) - ?~ p.tay nac - =* pax p.i.p.tay - ?. ?=($path p.pax) - [%ergo >[%expected-path got=p.pax]< ~] - =* mim q.i.p.tay - =+ mit=?.(?=($mime p.mim) ~ `;;(mime q.q.mim)) - $(p.tay t.p.tay, nac :_(nac [;;(path q.q.pax) mit])) - ?: ?=([@ *] tan) (error:he cas tan) - =/ changes=(map path (unit mime)) (malt tan) - =/ mim (apply-changes-to-mim:util mim.dom changes) - ?~ hez - (error:he cas %ergo-no-hez ~) - ;< ~ bind:m (give-ergo:util u.hez our q.bob-disc mon changes) - (pure:m mim) - :: - :: A small set of helper functions to assist in merging. - :: - ++ he - |% - :: - :: Cancel the merge gracefully and produce an error. - :: - ++ error - |= [cas=case err=term tan=(list tank)] - (clad-fail err >ali-disc< >bob-disc< >cas< tan) - :: - ++ calc-diffs - |= [hed=yaki bas=yaki] - ^- cane - :* %- molt - %+ skip ~(tap by q.hed) - |= {pax/path lob/lobe} - (~(has by q.bas) pax) - :: - %- molt - %+ skip ~(tap by q.hed) - |= {pax/path lob/lobe} - =+ (~(get by q.bas) pax) - |(=(~ -) =([~ lob] -)) - :: - ~ - :: - %- malt ^- (list {path ~}) - %+ murn ~(tap by q.bas) - |= {pax/path lob/lobe} - ^- (unit (pair path ~)) - ?. =(~ (~(get by q.hed) pax)) - ~ - `[pax ~] - == - :: - :: Create a schematic to turn a lobe into a blob. - :: - :: We short-circuit if we already have the content somewhere. - :: - ++ merge-lobe-to-schematic - |= [bob=yaki disc=disc:ford pax=path lob=lobe] - ^- schematic:ford - =+ lol=(~(get by q.bob) pax) - |- ^- schematic:ford - ?: =([~ lob] lol) - =+ (need (need (read-x:sutil & let.dom pax))) - ?> ?=(%& -<) - [%$ p.-] - :: ?: =([~ lob] lal) - :: [%$ +:(need fil.ank:(descend-path:(zu:sutil ank:(need alh)) pax))] - =+ bol=(~(got by lat.ran) lob) - ?- -.bol - $direct (page-to-schematic:sutil disc q.bol) - $delta - [%pact disc $(lob q.q.bol) (page-to-schematic:sutil disc r.bol)] - == - :: - :: Find the most recent common ancestor(s). - :: - ++ find-merge-points - |= {p/yaki q/yaki} :: maybe need jet - ^- (set yaki) - %- reduce-merge-points - =+ r=(reachable-takos:sutil r.p) - |- ^- (set yaki) - ?: (~(has in r) r.q) (~(put in *(set yaki)) q) - %+ roll p.q - |= {t/tako s/(set yaki)} - ?: (~(has in r) t) - (~(put in s) (tako-to-yaki:sutil t)) :: found - (~(uni in s) ^$(q (tako-to-yaki:sutil t))) :: traverse - :: - :: Helper for ++find-merge-points. - :: - ++ reduce-merge-points - |= unk/(set yaki) :: maybe need jet - =| gud/(set yaki) - =+ ^= zar - ^- (map tako (set tako)) - %+ roll ~(tap in unk) - |= {yak/yaki qar/(map tako (set tako))} - (~(put by qar) r.yak (reachable-takos:sutil r.yak)) - |- - ^- (set yaki) - ?~ unk gud - =+ bun=(~(del in `(set yaki)`unk) n.unk) - ?: %+ levy ~(tap by (~(uni in gud) bun)) - |= yak/yaki - !(~(has in (~(got by zar) r.yak)) r.n.unk) - $(gud (~(put in gud) n.unk), unk bun) - $(unk bun) - -- - -- - -- -:: :: Mount a beam to unix :: ++ mount @@ -2085,19 +1323,6 @@ ~|([%two-diffs-for-same-file pax] !!) == :: - :: Traverse parentage and find all ancestor hashes - :: - ++ reachable-takos :: reachable - |= p/tako - ^- (set tako) - =+ y=(tako-to-yaki p) - %+ roll p.y - =< .(s (~(put in *(set tako)) p)) - |= {q/tako s/(set tako)} - ?: (~(has in s) q) :: already done - s :: hence skip - (~(uni in s) ^$(p q)) :: otherwise traverse - :: :: Get the data at a node. :: :: If it's in our ankh (current state cache), we can just produce @@ -2819,9 +2044,78 @@ (lobe-to-schematic [her syd] path.mun p.dat) == :: - ++ case-to-date (cury case-to-date:util lim) - ++ case-to-aeon (cury case-to-aeon-before:util lim) - ++ lobe-to-schematic (cury lobe-to-schematic-p:util ?=(~ ref)) + ++ case-to-date + |= =case + ^- @da + :: if the case is already a date, use it. + :: + ?: ?=([%da *] case) + p.case + :: translate other cases to dates + :: + =/ aey (case-to-aeon-before lim case) + ?~ aey `@da`0 + ?: =(0 u.aey) `@da`0 + t:(aeon-to-yaki:ze u.aey) + :: + ++ case-to-aeon (cury case-to-aeon-before lim) + :: + :: Reduce a case to an aeon (version number) + :: + :: We produce null if we can't yet reduce the case for whatever + :: resaon (usually either the time or aeon hasn't happened yet or + :: the label hasn't been created). + :: + ++ case-to-aeon-before + |= [lim=@da lok=case] + ^- (unit aeon) + ?- -.lok + $da + ?: (gth p.lok lim) ~ + |- ^- (unit aeon) + ?: =(0 let.dom) [~ 0] :: avoid underflow + ?: %+ gte p.lok + =< t + ~| [%letdom let=let.dom hit=hit.dom hut=~(key by hut.ran)] + ~| [%getdom (~(get by hit.dom) let.dom)] + %- aeon-to-yaki:ze + let.dom + [~ let.dom] + $(let.dom (dec let.dom)) + :: + $tas (~(get by lab.dom) p.lok) + $ud ?:((gth p.lok let.dom) ~ [~ p.lok]) + == + ++ lobe-to-schematic (cury lobe-to-schematic-p ?=(~ ref)) + ++ lobe-to-schematic-p + |= [local=? disc=disc:ford pax=path lob=lobe] + ^- schematic:ford + =/ hat/(map path lobe) + ?: =(let.dom 0) + ~ + q:(aeon-to-yaki:ze let.dom) + =+ lol=`(unit lobe)`?.(local `0vsen.tinel (~(get by hat) pax)) + |- ^- schematic:ford + ?: =([~ lob] lol) + =+ (need (need (read-x:ze let.dom pax))) + ?> ?=(%& -<) + [%$ p.-] + =+ bol=(~(got by lat.ran) lob) + ?- -.bol + $direct (page-to-schematic disc q.bol) + $delta ~| delta+q.q.bol + [%pact disc $(lob q.q.bol) (page-to-schematic disc r.bol)] + == + :: + :: Create a schematic out of a page (which is a [mark noun]). + :: + ++ page-to-schematic + |= [disc=disc:ford a=page] + ^- schematic:ford + ?. ?=($hoon p.a) [%volt disc a] + :: %hoon bootstrapping + [%$ p.a [%atom %t ~] q.a] + :: :: ++ blas |= {hen/duct das/(set mood)} @@ -3202,7 +2496,7 @@ :: Don't use p.change.i.cans because that's before casting to :: the correct mark. :: - %& (page-to-lobe:util [p q.q]:cage) + %& (page-to-lobe [p q.q]:cage) == =^ so-far ford-cache.ford-args $(cans t.cans) [(~(put by so-far) path.i.cans lobe cage) ford-cache.ford-args] @@ -3303,7 +2597,7 @@ ++ ergo |= mim=(map path (unit mime)) ^+ ..park - =/ must (must-ergo:util her syd mon (turn ~(tap by mim) head)) + =/ must (must-ergo her syd mon (turn ~(tap by mim) head)) %- emil %+ turn ~(tap by must) |= [pot=term len=@ud pak=(set path)] @@ -3313,6 +2607,20 @@ [(slag len pax) (~(got by mim) pax)] == :: + :: Output is a map of mount points to {length-of-mounted-path set-of-paths}. + :: + ++ must-ergo + |= [our=ship syd=desk mon=(map term beam) can/(list path)] + ^- (map term (pair @ud (set path))) + %- malt ^- (list (trel term @ud (set path))) + %+ murn ~(tap by mon) + |= {nam/term bem/beam} + ^- (unit (trel term @ud (set path))) + =- ?~(- ~ `[nam (lent s.bem) (silt `(list path)`-)]) + %+ skim can + |= pax/path + &(=(p.bem our) =(q.bem syd) =((flop s.bem) (scag (lent s.bem) pax))) + :: :: Print notification to console :: ++ print @@ -3584,7 +2892,7 @@ %this ?: =(r.ali-yaki r.bob-yaki) &+~ - ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + ?: (~(has in (reachable-takos:ze r.bob-yaki)) r.ali-yaki) &+~ :* %& ~ conflicts=~ @@ -3617,9 +2925,9 @@ %fine ?: =(r.ali-yaki r.bob-yaki) &+~ - ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + ?: (~(has in (reachable-takos:ze r.bob-yaki)) r.ali-yaki) &+~ - ?. (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) + ?. (~(has in (reachable-takos:ze r.ali-yaki)) r.bob-yaki) :~ %| %bad-fine-merge leaf+"tried fast-forward but is not ancestor or descendant" == @@ -3628,9 +2936,9 @@ ?(%meet %mate %meld) ?: =(r.ali-yaki r.bob-yaki) &+~ - ?: (~(has in (reachable-takos r.bob-yaki)) r.ali-yaki) + ?: (~(has in (reachable-takos:ze r.bob-yaki)) r.ali-yaki) &+~ - ?: (~(has in (reachable-takos r.ali-yaki)) r.bob-yaki) + ?: (~(has in (reachable-takos:ze r.ali-yaki)) r.bob-yaki) $(germ %fine) =/ merge-points find-merge-points ?~ merge-points @@ -3684,18 +2992,6 @@ ^- (map path (each page lobe)) (~(run by m) |=(=lobe |+lobe)) :: - ++ reachable-takos - |= tak=tako - ^- (set tako) - |- ^- (set tako) - =/ =yaki (~(got by hut.ran) tak) - %+ roll p.yaki - =< .(takos (~(put in *(set tako)) tak)) - |= [q=tako takos=(set tako)] - ?: (~(has in takos) q) :: already done - takos :: hence skip - (~(uni in takos) ^$(tak q)) :: otherwise traverse - :: :: Find the most recent common ancestor(s). :: :: Pretty sure this could be a lot more efficient. @@ -3703,7 +2999,7 @@ ++ find-merge-points ^- (set yaki) %- reduce-merge-points - =+ r=(reachable-takos r.ali-yaki) + =+ r=(reachable-takos:ze r.ali-yaki) |- ^- (set yaki) ~! bob-yaki ?: (~(has in r) r.bob-yaki) (~(put in *(set yaki)) bob-yaki) @@ -3721,7 +3017,7 @@ =/ zar=(map tako (set tako)) %+ roll ~(tap in unk) |= [yak=yaki qar=(map tako (set tako))] - (~(put by qar) r.yak (reachable-takos r.yak)) + (~(put by qar) r.yak (reachable-takos:ze r.yak)) |- ^- (set yaki) ?~ unk gud @@ -4084,47 +3380,6 @@ ..start-request (duce for u.new-sub) :: - :: Continue merging - :: - ++ take-merge - |= =sign - ^+ +> - =/ m merge-clad - ?~ act - ~|(%no-active-write !!) - ?. ?=(%merge -.eval-data.u.act) - ~|(%active-not-merge !!) - =^ r=[moves=(list move) =eval-result:eval:m] merge.eval-data.u.act - (take:eval:m merge.eval-data.u.act hen /merge/[syd] now ran sign) - => .(+>.$ (emil moves.r)) :: TMI - ?- -.eval-result.r - %next +>.$ - %fail (fail-merge err.eval-result.r) - %done (done-merge value.eval-result.r) - == - :: - :: Don't release effects or apply state changes; print error - :: - ++ fail-merge - |= err=(pair term tang) - ^+ +> - =. +>.$ - (emit [hen %slip %b %drip !>([%mere %| err])]) - finish-write - :: - :: Release effects and apply state changes - :: - ++ done-merge - |= [conflicts=(set path) =dome =rang] - ^+ +> - =. +>.$ (emit [hen %slip %b %drip !>([%mere %& conflicts])]) - =: dom dome - hut.ran (~(uni by hut.rang) hut.ran) - lat.ran (~(uni by lat.rang) lat.ran) - == - =. +>.$ wake - finish-write - :: :: Continue mounting :: ++ take-mount @@ -4133,8 +3388,8 @@ =/ m mount-clad ?~ act ~|(%no-active-write !!) - ?. ?=(%mount -.eval-data.u.act) - ~|(%active-not-mount !!) + :: ?. ?=(%mount -.eval-data.u.act) + :: ~|(%active-not-mount !!) =^ r=[moves=(list move) =eval-result:eval:m] mount.eval-data.u.act (take:eval:m mount.eval-data.u.act hen /mount/[syd] now ran sign) => .(+>.$ (emil moves.r)) :: TMI @@ -4730,9 +3985,6 @@ :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: - :: The useful utility functions that are common to several cores - :: - ++ util (state:[^util] dom dom ran) :: :: Other utility functions :: @@ -4747,7 +3999,13 @@ ++ aeon-to-yaki |=(=aeon (tako-to-yaki (aeon-to-tako aeon))) ++ lobe-to-blob ~(got by lat.ran) ++ tako-to-yaki ~(got by hut.ran) - ++ page-to-lobe page-to-lobe:util + ++ lobe-to-mark + |= a/lobe + => (lobe-to-blob a) + ?- - + $delta p.q + $direct p.q + == :: :: Checks whether two pieces of data (either cages or lobes) are the same. :: @@ -4798,6 +4056,19 @@ [~ ~] (data-twixt-takos (~(get by hit.dom) a) (aeon-to-tako b)) :: + :: Traverse parentage and find all ancestor hashes + :: + ++ reachable-takos :: reachable + |= p/tako + ^- (set tako) + =+ y=(tako-to-yaki p) + %+ roll p.y + =< .(s (~(put in *(set tako)) p)) + |= {q/tako s/(set tako)} + ?: (~(has in s) q) :: already done + s :: hence skip + (~(uni in s) ^$(p q)) :: otherwise traverse + :: :: Gets the data between two commit hashes, assuming the first is an :: ancestor of the second. :: @@ -4808,11 +4079,11 @@ ++ data-twixt-takos |= {a/(unit tako) b/tako} ^- {(set yaki) (set plop)} - =+ old=?~(a ~ (reachable-takos:util u.a)) + =+ old=?~(a ~ (reachable-takos u.a)) =/ yal/(set tako) %- silt %+ skip - ~(tap in (reachable-takos:util b)) + ~(tap in (reachable-takos b)) |=(tak/tako (~(has in old) tak)) :- (silt (turn ~(tap in yal) tako-to-yaki)) (silt (turn ~(tap in (new-lobes (new-lobes ~ old) yal)) lobe-to-blob)) @@ -5112,9 +4383,49 @@ ?: =(0 u.aey) `@da`0 t:(aeon-to-yaki u.aey) :: - :: Gets the data at a node. + :: Get the data at a node. :: - ++ read-x (cury read-x:util ?=(~ ref)) + :: If it's in our ankh (current state cache), we can just produce + :: the result. Otherwise, we've got to look up the node at the + :: aeon to get the content hash, use that to find the blob, and use + :: the blob to get the data. We also special-case the hoon mark + :: for bootstrapping purposes. + :: + ++ read-x + |= [yon=aeon pax=path] + ^- (unit (unit (each cage lobe))) + ?: =(0 yon) + [~ ~] + =+ tak=(~(get by hit.dom) yon) + ?~ tak + ~ + ?: &(?=(~ ref) =(yon let.dom)) + :- ~ + %+ bind + fil.ank:(descend-path:(zu ank.dom) pax) + |=(a/{p/lobe q/cage} [%& q.a]) + =+ yak=(tako-to-yaki u.tak) + =+ lob=(~(get by q.yak) pax) + ?~ lob + [~ ~] + =+ mar=(lobe-to-mark u.lob) + :: should convert any lobe to cage + :: + ?. ?=($hoon mar) + [~ ~ %| u.lob] + :^ ~ ~ %& + :+ mar [%atom %t ~] + |- ^- @t :: (urge cord) would be faster + =+ bol=(lobe-to-blob u.lob) + ?: ?=($direct -.bol) + ;;(@t q.q.bol) + ?> ?=($delta -.bol) + =+ txt=$(u.lob q.q.bol) + ?> ?=($txt-diff p.r.bol) + =+ dif=;;((urge cord) q.r.bol) + =, format + =+ pac=(of-wain (lurk:differ (to-wain (cat 3 txt '\0a')) dif)) + (end 3 (dec (met 3 pac)) pac) :: :: Gets an arch (directory listing) at a node. :: @@ -5193,7 +4504,23 @@ %y :_(fod (bind (read-y yon path.mun) (lift |=(a/cage [%& a])))) %z :_(fod (bind (read-z yon path.mun) (lift |=(a/cage [%& a])))) == - ++ zu zu:util + :: Traverse an ankh. + :: + ++ zu :: filesystem + |= ank/ankh :: filesystem state + =| ram/path :: reverse path into + |% + ++ descend :: descend + |= lol/@ta + ^+ +> + =+ you=(~(get by dir.ank) lol) + +>.$(ram [lol ram], ank ?~(you [~ ~] u.you)) + :: + ++ descend-path :: descend recursively + |= way/path + ^+ +> + ?~(way +> $(way t.way, +> (descend i.way))) + -- -- -- -- From 4e1bac8946dfcf17e03a463393747b5cec484c2b Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 01:27:19 -0700 Subject: [PATCH 113/280] clay: convert |mount to fusion --- pkg/arvo/sys/vane/clay.hoon | 177 ++++++++++++++++++------------------ pkg/arvo/sys/zuse.hoon | 2 +- 2 files changed, 91 insertions(+), 88 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index eeb284f5b..d6ec0557d 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2554,73 +2554,6 @@ =. ankh new-ankh outer-loop(cans t.cans) :: - :: Update mime cache - :: - ++ checkout-mime - |= $: =ford=args:ford:fusion - deletes=(set path) - changes=(set path) - == - ^- [(map path (unit mime)) ford-cache] - =/ mim=(map path (unit mime)) - =/ dels=(list path) ~(tap by deletes) - |- ^- (map path (unit mime)) - ?~ dels - ~ - (~(put by $(dels t.dels)) i.dels ~) - =/ cans=(list path) ~(tap by changes) - |- ^- [(map path (unit mime)) ford-cache] - ?~ cans - [mim ford-cache.ford-args] - =^ cage ford-cache.ford-args - ~| mime-cast-fail+i.cans - (wrap:fusion (cast-path:(ford:fusion ford-args) i.cans %mime)) - =^ mim ford-cache.ford-args $(cans t.cans) - [(~(put by mim) i.cans `!<(mime q.cage)) ford-cache.ford-args] - :: - :: Add or remove entries to the mime cache - :: - ++ apply-changes-to-mim - |= [mim=(map path mime) changes=(map path (unit mime))] - ^- (map path mime) - =/ changes-l=(list [pax=path change=(unit mime)]) - ~(tap by changes) - |- ^- (map path mime) - ?~ changes-l - mim - ?~ change.i.changes-l - $(changes-l t.changes-l, mim (~(del by mim) pax.i.changes-l)) - $(changes-l t.changes-l, mim (~(put by mim) [pax u.change]:i.changes-l)) - :: - :: Emit update to unix sync - :: - ++ ergo - |= mim=(map path (unit mime)) - ^+ ..park - =/ must (must-ergo her syd mon (turn ~(tap by mim) head)) - %- emil - %+ turn ~(tap by must) - |= [pot=term len=@ud pak=(set path)] - :* (need hez) %give %ergo pot - %+ turn ~(tap in pak) - |= pax=path - [(slag len pax) (~(got by mim) pax)] - == - :: - :: Output is a map of mount points to {length-of-mounted-path set-of-paths}. - :: - ++ must-ergo - |= [our=ship syd=desk mon=(map term beam) can/(list path)] - ^- (map term (pair @ud (set path))) - %- malt ^- (list (trel term @ud (set path))) - %+ murn ~(tap by mon) - |= {nam/term bem/beam} - ^- (unit (trel term @ud (set path))) - =- ?~(- ~ `[nam (lent s.bem) (silt `(list path)`-)]) - %+ skim can - |= pax/path - &(=(p.bem our) =(q.bem syd) =((flop s.bem) (scag (lent s.bem) pax))) - :: :: Print notification to console :: ++ print @@ -3278,6 +3211,93 @@ -- -- :: + :: Update mime cache + :: + ++ checkout-mime + |= $: =ford=args:ford:fusion + deletes=(set path) + changes=(set path) + == + ^- [(map path (unit mime)) ford-cache] + =/ mim=(map path (unit mime)) + =/ dels=(list path) ~(tap by deletes) + |- ^- (map path (unit mime)) + ?~ dels + ~ + (~(put by $(dels t.dels)) i.dels ~) + =/ cans=(list path) ~(tap by changes) + |- ^- [(map path (unit mime)) ford-cache] + ?~ cans + [mim ford-cache.ford-args] + =^ cage ford-cache.ford-args + ~| mime-cast-fail+i.cans + (wrap:fusion (cast-path:(ford:fusion ford-args) i.cans %mime)) + =^ mim ford-cache.ford-args $(cans t.cans) + [(~(put by mim) i.cans `!<(mime q.cage)) ford-cache.ford-args] + :: + :: Add or remove entries to the mime cache + :: + ++ apply-changes-to-mim + |= [mim=(map path mime) changes=(map path (unit mime))] + ^- (map path mime) + =/ changes-l=(list [pax=path change=(unit mime)]) + ~(tap by changes) + |- ^- (map path mime) + ?~ changes-l + mim + ?~ change.i.changes-l + $(changes-l t.changes-l, mim (~(del by mim) pax.i.changes-l)) + $(changes-l t.changes-l, mim (~(put by mim) [pax u.change]:i.changes-l)) + :: + :: Emit update to unix sync + :: + ++ ergo + |= mim=(map path (unit mime)) + ^+ ..park + =/ must (must-ergo her syd mon (turn ~(tap by mim) head)) + %- emil + %+ turn ~(tap by must) + |= [pot=term len=@ud pak=(set path)] + :* (need hez) %give %ergo pot + %+ turn ~(tap in pak) + |= pax=path + [(slag len pax) (~(got by mim) pax)] + == + :: + :: Output is a map of mount points to {length-of-mounted-path set-of-paths}. + :: + ++ must-ergo + |= [our=ship syd=desk mon=(map term beam) can/(list path)] + ^- (map term (pair @ud (set path))) + %- malt ^- (list (trel term @ud (set path))) + %+ murn ~(tap by mon) + |= {nam/term bem/beam} + ^- (unit (trel term @ud (set path))) + =- ?~(- ~ `[nam (lent s.bem) (silt `(list path)`-)]) + %+ skim can + |= pax/path + &(=(p.bem our) =(q.bem syd) =((flop s.bem) (scag (lent s.bem) pax))) + :: + :: Mount a beam to unix + :: + ++ mount + |= [pot=term =case =spur] + ^+ ..mount + =/ old-mon (~(get by mon) pot) + ?^ old-mon + %- (slog >%already-mounted< >u.old-mon< ~) + ..mount + =. mon (~(put by mon) pot [her syd case] spur) + =/ =yaki (~(got by hut.ran) (~(got by hit.dom) let.dom)) + =/ changes (~(run by q.yaki) |=(=lobe |+lobe)) + =/ =args:ford:fusion + [ank.dom ~ changes lat.ran fod.dom] + =^ mim ford-cache.args + (checkout-mime args ~ ~(key by changes)) + =. mim.dom (apply-changes-to-mim mim.dom mim) + =. fod.dom ford-cache.args + (ergo mim) + :: :: Set permissions for a node. :: ++ perm @@ -4584,7 +4604,7 @@ :: Without this, two commits could have the same date, which :: would make clay violate referential transparency. :: - =/ =desk des.req + =/ =desk +<.req =/ =dojo (~(gut by dos.rom.ruf) desk *dojo) ?: =(0 let.dom.dojo) (handle-task hen req) @@ -4712,25 +4732,9 @@ :: %mont =. hez.ruf ?^(hez.ruf hez.ruf `[[%$ %sync ~] ~]) - =. act.ruf - =/ =dojo (~(gut by dos.rom.ruf) q.bem.req *dojo) - =/ writer=form:mount-clad - %- %- mount - :* our - q.bem.req - now - (need hez.ruf) - dom.dojo - ran.ruf - == - :* des.req - bem.req - mon.ruf - == - `[hen req %mount (from-form:eval:mount-clad writer)] =^ mos ruf =/ den ((de our now ski hen ruf) p.bem.req q.bem.req) - abet:(take-mount:den clad-init-sign) + abet:(mount:den pot.req r.bem.req s.bem.req) [mos ..^$] :: %dirk @@ -4740,8 +4744,7 @@ ?. (~(has by mon.ruf) des.req) ~& [%not-mounted des.req] [~ ..^$] - :- ~[[u.hez.ruf %give %dirk des.req]] - ..^$ + [~[[u.hez.ruf %give %dirk des.req]] ..^$] :: %ogre ?~ hez.ruf diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index a66a7d683..9ce064ab9 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -564,7 +564,7 @@ her/@p dem/desk cas/case :: source how/germ :: method == :: - {$mont des/desk bem/beam} :: mount to unix + {$mont pot/term bem/beam} :: mount to unix {$dirk des/desk} :: mark mount dirty {$ogre pot/$@(desk beam)} :: delete mount point {$park des/desk yok/yoki ran/rang} :: synchronous commit From 6e10a7439a93cf3101ce6bc48f0c8a0bd77b7cc6 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 02:09:41 -0700 Subject: [PATCH 114/280] clay: remove fusion mount and queuing infrastructure --- pkg/arvo/sys/vane/clay.hoon | 233 ++---------------------------------- 1 file changed, 12 insertions(+), 221 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index d6ec0557d..40baf0471 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -143,8 +143,7 @@ :: location). :: -- `hez` is the unix duct that %ergo's should be sent to. :: -- `cez` is a collection of named permission groups. -:: -- `cue` is a queue of requests to perform in later events. -:: -- `tip` is the date of the last write; if now, enqueue incoming requests. +:: -- `pud` is an update that's waiting on a kernel upgrade :: ++ raft :: filesystem $: rom=room :: domestic @@ -153,28 +152,9 @@ mon=(map term beam) :: mount points hez=(unit duct) :: sync duct cez=(map @ta crew) :: permission groups - cue=(qeu [=duct =task:able]) :: queued requests - act=active-write :: active write pud=(unit [=desk =yoki]) :: pending update == :: :: -:: Currently active write -:: -++ active-write - %- unit - $: hen=duct - req=task:able - $= eval-data - $% [%mount mount=eval-form:eval:mount-clad] - == - == -:: -:: The clad monad for mounts. -:: -:: Just a new mount point and mime cache. -:: -++ mount-clad (clad ,[new-mon=(pair term beam) mim=(map path mime)]) -:: :: Object store. :: :: Maps of commit hashes to commits and content hashes to content. @@ -651,79 +631,6 @@ |= [=wove ducts=(set duct)] [ducts (print-wove wove)] :: -:: Mount a beam to unix -:: -++ mount - |= $: our=ship - syd=desk - wen=@da - hez=duct - dom=dome - ran=rang - == - |^ - |= [pot=term bem=beam mon=(map term beam)] - =/ m mount-clad - ^- form:m - =/ old-mon (~(get by mon) pot) - ?^ old-mon - (clad-fail %already-mounted >u.old-mon< ~) - =. mon (~(put by mon) pot bem) - ;< changes=(map path (unit mime)) bind:m (cast-to-mime bem) - ;< ~ bind:m (ergo changes mon) - =/ mim (apply-changes-to-mim:util mim.dom changes) - (pure:m [pot bem] mim) - :: - ++ sutil (state:util dom dom ran) - :: Initializes a new mount point. - :: - ++ cast-to-mime - |= bem=beam - =/ m (clad ,(map path (unit mime))) - ^- form:m - =* pax s.bem - =/ =aeon (need (case-to-aeon-before:sutil wen r.bem)) - =/ must - =/ all (turn ~(tap by q:(aeon-to-yaki:sutil aeon)) head) - (skim all |=(paf/path =(pax (scag (lent pax) paf)))) - ?~ must - (pure:m ~) - ;< ~ bind:m - %+ just-do /ergoing - :* %f %build live=%.n %list - ^- (list schematic:ford) - %+ turn `(list path)`must - |= a/path - :- [%$ %path !>(a)] - :^ %cast [our %home] %mime - =+ (need (need (read-x:sutil & aeon a))) - ?: ?=(%& -<) - [%$ p.-] - (lobe-to-schematic:sutil [our %home] a p.-) - == - ;< res=made-result:ford bind:m expect-ford - ?: ?=([%incomplete *] res) - (clad-fail %ergo-fail-incomplete leaf+"clay ergo incomplete" tang.res) - ?. ?=([%complete %success *] res) - (clad-fail %ergo-fail leaf+"clay ergo failed" message.build-result.res) - %- pure:m - %- malt ^- mode - %+ turn (made-result-to-cages:util res) - |= [pax=cage mim=cage] - ?. ?=($path p.pax) - ~|(%ergo-bad-path-mark !!) - :- ;;(path q.q.pax) - ?. ?=($mime p.mim) - ~ - `;;(mime q.q.mim) - :: - :: Send changes to unix - :: - ++ ergo - |= [changes=(map path (unit mime)) mon=(map term beam)] - (give-ergo:util hez our syd mon changes) - -- -:: :: A simple foreign request. :: ++ foreign-request @@ -3400,53 +3307,6 @@ ..start-request (duce for u.new-sub) :: - :: Continue mounting - :: - ++ take-mount - |= =sign - ^+ +> - =/ m mount-clad - ?~ act - ~|(%no-active-write !!) - :: ?. ?=(%mount -.eval-data.u.act) - :: ~|(%active-not-mount !!) - =^ r=[moves=(list move) =eval-result:eval:m] mount.eval-data.u.act - (take:eval:m mount.eval-data.u.act hen /mount/[syd] now ran sign) - => .(+>.$ (emil moves.r)) :: TMI - ?- -.eval-result.r - %next +>.$ - %fail (fail-mount err.eval-result.r) - %done (done-mount value.eval-result.r) - == - :: - :: Don't release effects or apply state changes; print error - :: - ++ fail-mount - |= err=(pair term tang) - ^+ +> - %- (slog leaf+"mount failed" leaf+(trip p.err) q.err) - finish-write - :: - :: Release effects and apply state changes - :: - ++ done-mount - |= [new-mon=(pair term beam) mim=(map path mime)] - ^+ +> - =: mon (~(put by mon) new-mon) - mim.dom mim - == - finish-write - :: - :: Start next item in write queue - :: - ++ finish-write - ^+ . - =. act ~ - ?~ cue - . - =/ =duct duct:(need ~(top to cue)) - (emit [duct %pass /queued-request %b %wait now]) - :: :: Continue foreign request :: ++ take-foreign-request @@ -4580,48 +4440,6 @@ ?< ?=(%crud -.req) [%crud -.req tang.u.dud] :: - :: only one of these should be going at once, so queue - :: - ?: ?=(?(%info %merg %mont) -.req) - :: If there's an active write or a queue, enqueue - :: - :: We only want one active write so each can be a clean - :: transaction. We don't intercept `%into` because it - :: immediately translates itself into one or two `%info` calls. - :: - ?: |(!=(~ act.ruf) !=(~ cue.ruf)) - =. cue.ruf (~(put to cue.ruf) [hen req]) - :: ~& :* %clall-enqueing - :: cue=(turn ~(tap to cue.ruf) |=([=duct =task:able] [duct -.task])) - :: ^= act - :: ?~ act.ruf - :: ~ - :: [hen req -.eval-data]:u.act.ruf - :: == - [~ ..^$] - :: If the last commit happened in this event, enqueue - :: - :: Without this, two commits could have the same date, which - :: would make clay violate referential transparency. - :: - =/ =desk +<.req - =/ =dojo (~(gut by dos.rom.ruf) desk *dojo) - ?: =(0 let.dom.dojo) - (handle-task hen req) - =/ sutil (state:util dom.dojo dom.dojo ran.ruf) - =/ last-write=@da t:(aeon-to-yaki:sutil let.dom.dojo) - ?: !=(last-write now) - (handle-task hen req) - =. cue.ruf (~(put to cue.ruf) [hen req]) - =/ wait-behn [hen %pass /queued-request %b %wait now] - [[wait-behn ~] ..^$] - (handle-task hen req) -:: -:: Handle a task, without worrying about write queueing -:: -++ handle-task - |= [hen=duct req=task:able] - ^- [(list move) _..^$] ?- -.req %boat :_ ..^$ @@ -4670,15 +4488,8 @@ [[[hen %slip %d %flog req] ~] ..^$] :: %drop - ~? =(~ act.ruf) - [%clay-idle cue-length=~(wyt in cue.ruf)] - ~? ?=(^ act.ruf) - [%clay-cancelling hen -.req -.eval-data]:u.act.ruf - =. act.ruf ~ - ?~ cue.ruf - [~ ..^$] - =/ =duct duct:(need ~(top to cue.ruf)) - [[duct %pass /queued-request %b %wait now]~ ..^$] + ~& %clay-idle + [~ ..^$] :: %info ?: ?=(%| -.dit.req) @@ -4904,13 +4715,6 @@ abet:(merge:den ali-ship ali-desk germ p.q.hin) [mos ..^$] :: - ?: ?=([%mount @ *] tea) - =* syd i.t.tea - =^ mos ruf - =/ den ((de our now ski hen ruf) our syd) - abet:(take-mount:den q.hin) - [mos ..^$] - :: ?: ?=([%foreign-warp *] tea) ?> ?=(%writ +<.q.hin) :_ ..^$ @@ -5044,28 +4848,15 @@ ?^ error.q.hin [[hen %slip %d %flog %crud %wake u.error.q.hin]~ ..^$] :: - ?: ?=([%tyme @ @ ~] tea) - =/ her (slav %p i.t.tea) - =/ syd (slav %tas i.t.t.tea) - =^ mos ruf - =/ den ((de our now ski hen ruf) her syd) - abet:wake:den - [mos ..^$] - :: - =^ queued cue.ruf ~(get to cue.ruf) - :: - =/ queued-duct=duct -.queued - =/ queued-task=task:able +.queued - :: - :: ~& :* %clay-waking - :: queued-duct - :: hen - :: ?~(cue.ruf /empty -:(need ~(top to cue.ruf))) - :: == - ~| [%mismatched-ducts %queued queued-duct %timer hen] - ?> =(hen queued-duct) - :: - (handle-task hen queued-task) + ?. ?=([%tyme @ @ ~] tea) + ~& [%clay-strange-timer tea] + [~ ..^$] + =/ her (slav %p i.t.tea) + =/ syd (slav %tas i.t.t.tea) + =^ mos ruf + =/ den ((de our now ski hen ruf) her syd) + abet:wake:den + [mos ..^$] :: :: handled in the wire dispatcher :: From 8536c6b1ca5caabde2e9eb9dac6322a1646af57a Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 02:48:06 -0700 Subject: [PATCH 115/280] clay: remove move of +util --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 430 ------------------------------------ 2 files changed, 2 insertions(+), 432 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 5e7399df4..40b4de715 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2354006941fe93cce37cb3f626499e5859cd6b2042814288f574e1e9b1910447 -size 13921587 +oid sha256:9b25a71e52b11e205e527cc309ab8e54a5b14c11703239b3ee70894ce47699fd +size 13823021 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 40baf0471..f00a1b3f1 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -815,62 +815,6 @@ :: ++ util |% - :: Hash a page to get a lobe. - :: - ++ page-to-lobe |=(page (shax (jam +<))) - :: - :: Takes a list of changed paths and finds those paths that are inside a - :: mount point (listed in `mon`). - :: - :: Output is a map of mount points to {length-of-mounted-path set-of-paths}. - :: - ++ must-ergo - |= [our=ship syd=desk mon=(map term beam) can/(list path)] - ^- (map term (pair @ud (set path))) - %- malt ^- (list (trel term @ud (set path))) - %+ murn ~(tap by mon) - |= {nam/term bem/beam} - ^- (unit (trel term @ud (set path))) - =- ?~(- ~ `[nam (lent s.bem) (silt `(list path)`-)]) - %+ skim can - |= pax/path - &(=(p.bem our) =(q.bem syd) =((flop s.bem) (scag (lent s.bem) pax))) - :: - :: Send changes to unix - :: - ++ give-ergo - |= $: hez=duct - our=ship - syd=desk - mon=(map term beam) - changes=(map path (unit mime)) - == - =/ m (clad ,~) - ^- form:m - =/ must (must-ergo our syd mon (turn ~(tap by changes) head)) - |= clad-input - :- ~ :_ [%done ~] - %+ turn ~(tap by must) - |= [pot=term len=@ud pak=(set path)] - :* hez %give %ergo pot - %+ turn ~(tap in pak) - |= pax=path - [(slag len pax) (~(got by changes) pax)] - == - :: - :: Add or remove entries to the mime cache - :: - ++ apply-changes-to-mim - |= [mim=(map path mime) changes=(map path (unit mime))] - ^- (map path mime) - =/ caz=(list [pax=path change=(unit mime)]) ~(tap by changes) - |- ^- (map path mime) - ?~ caz - mim - ?~ change.i.caz - $(caz t.caz, mim (~(del by mim) pax.i.caz)) - $(caz t.caz, mim (~(put by mim) [pax u.change]:i.caz)) - :: :: Create a schematic to validate a page. :: :: If the mark is %hoon, we short-circuit the validation for bootstrapping @@ -882,56 +826,10 @@ ?. ?=($hoon p.a) [%vale disc a] ?. ?=(@t q.a) [%dude >%weird-hoon< %ride [%zpzp ~] %$ *cage] [%$ p.a [%atom %t ~] q.a] - :: :: Crashes on ford failure :: ++ ford-fail |=(tan/tang ~|(%ford-fail (mean tan))) :: - :: Takes either a result or a stack trace. If it's a stack trace, we crash; - :: else, we produce the result. - :: - ++ unwrap-tang - |* res/(each * tang) - ?:(?=(%& -.res) p.res (mean p.res)) - :: - :: Parse a gage to a list of pairs of cages, crashing on error. - :: - :: Composition of ++gage-to-cages-or-error and ++unwrap-tang. Maybe same as - :: ++gage-to-success-cages? - :: - ++ made-result-to-cages - |= result=made-result:ford - ^- (list (pair cage cage)) - (unwrap-tang (made-result-to-cages-or-error result)) - :: - :: Same as ++gage-to-cages-or-error except crashes on error. Maybe same as - :: ++gage-to-cages? - :: - ++ made-result-to-success-cages - |= result=made-result:ford - ^- (list (pair cage cage)) - ?. ?=([%complete %success %list *] result) - (ford-fail >%strange-ford-result< ~) - :: process each row in the list, filtering out errors - :: - %+ murn results.build-result.result - |= row=build-result:ford - ^- (unit [cage cage]) - :: - ?: ?=([%error *] row) - ~& [%clay-whole-build-failed message.row] - ~ - ?: ?=([%success [%error *] *] row) - ~& [%clay-first-failure message.head.row] - ~ - ?: ?=([%success [%success *] [%error *]] row) - ~& %clay-second-failure - %- (slog message.tail.row) - ~ - ?. ?=([%success [%success *] [%success *]] row) - ~ - `[(result-to-cage:ford head.row) (result-to-cage:ford tail.row)] - :: :: Expects a single-level gage (i.e. a list of pairs of cages). If the :: result is of a different form, or if some of the computations in the gage :: failed, we produce a stack trace. Otherwise, we produce the list of pairs @@ -964,334 +862,6 @@ :_ - [(result-to-cage:ford head.i.results) (result-to-cage:ford tail.i.results)] :: - :: Assumes the list of pairs of cages is actually a listified map of paths - :: to cages, and converts it to (map path cage) or a stack trace on error. - :: - ++ cages-to-map - |= tay/(list (pair cage cage)) - =| can/(map path cage) - |- ^- (each (map path cage) tang) - ?~ tay [%& can] - =* pax p.i.tay - ?. ?=($path p.pax) - (mule |.(`~`~|([%expected-path got=p.pax] !!))) - $(tay t.tay, can (~(put by can) ;;(path q.q.pax) q.i.tay)) - :: - :: Useful functions which operate on a dome and a rang. - :: - :: `original-dome` is the dome which we had when the transaction - :: started. This is used as a lobe-to-blob cache in - :: +lobe-to-schematic so we don't have to recalculate the blobs for - :: files which haven't changed. - :: - ++ state - |= [original-dome=dome dom=dome ran=rang] - |% - :: These convert between aeon (version number), tako (commit hash), yaki - :: (commit data structure), lobe (content hash), and blob (content). - ++ aeon-to-tako ~(got by hit.dom) - ++ aeon-to-yaki |=(=aeon (tako-to-yaki (aeon-to-tako aeon))) - ++ lobe-to-blob ~(got by lat.ran) - ++ tako-to-yaki ~(got by hut.ran) - ++ lobe-to-mark - |= a/lobe - => (lobe-to-blob a) - ?- - - $delta p.q - $direct p.q - == - :: - :: Create a schematic out of a page (which is a [mark noun]). - :: - ++ page-to-schematic - |= [disc=disc:ford a=page] - ^- schematic:ford - ?. ?=($hoon p.a) [%volt disc a] - :: %hoon bootstrapping - [%$ p.a [%atom %t ~] q.a] - :: - :: Create a schematic out of a lobe (content hash). - :: - ++ lobe-to-schematic (cury lobe-to-schematic-p &) - ++ lobe-to-schematic-p - =. dom original-dome - |= [local=? disc=disc:ford pax=path lob=lobe] - ^- schematic:ford - :: - =/ hat/(map path lobe) - ?: =(let.dom 0) - ~ - q:(aeon-to-yaki let.dom) - =+ lol=`(unit lobe)`?.(local `0vsen.tinel (~(get by hat) pax)) - |- ^- schematic:ford - ?: =([~ lob] lol) - =+ (need (need (read-x & let.dom pax))) - ?> ?=(%& -<) - [%$ p.-] - =+ bol=(~(got by lat.ran) lob) - ?- -.bol - $direct (page-to-schematic disc q.bol) - $delta ~| delta+q.q.bol - [%pact disc $(lob q.q.bol) (page-to-schematic disc r.bol)] - == - :: - :: Hash a page to get a lobe. - :: - ++ page-to-lobe |=(page (shax (jam +<))) - :: - :: Make a direct blob out of a page. - :: - ++ make-direct-blob - |= p/page - ^- blob - [%direct (page-to-lobe p) p] - :: - :: Make a delta blob out of a lobe, mark, lobe of parent, and page of diff. - :: - ++ make-delta-blob - |= {p/lobe q/{p/mark q/lobe} r/page} - ^- blob - [%delta p q r] - :: - :: Make a commit out of a list of parents, content, and date. - :: - ++ make-yaki - |= {p/(list tako) q/(map path lobe) t/@da} - ^- yaki - =+ ^= has - %^ cat 7 (sham [%yaki (roll p add) q t]) - (sham [%tako (roll p add) q t]) - [p q has t] - :: - ++ case-to-date - |= [now=@da =case] - ^- @da - :: if the case is already a date, use it. - :: - ?: ?=([%da *] case) - p.case - :: translate other cases to dates - :: - =/ aey (case-to-aeon-before now case) - ?~ aey `@da`0 - ?: =(0 u.aey) `@da`0 - t:(aeon-to-yaki u.aey) - :: - :: Reduce a case to an aeon (version number) - :: - :: We produce null if we can't yet reduce the case for whatever - :: resaon (usually either the time or aeon hasn't happened yet or - :: the label hasn't been created). - :: - ++ case-to-aeon-before - |= [lim=@da lok=case] - ^- (unit aeon) - ?- -.lok - $da - ?: (gth p.lok lim) ~ - |- ^- (unit aeon) - ?: =(0 let.dom) [~ 0] :: avoid underflow - ?: %+ gte p.lok - =< t - ~| [%letdom let=let.dom hit=hit.dom hut=~(key by hut.ran)] - ~| [%getdom (~(get by hit.dom) let.dom)] - %- aeon-to-yaki - let.dom - [~ let.dom] - $(let.dom (dec let.dom)) - :: - $tas (~(get by lab.dom) p.lok) - $ud ?:((gth p.lok let.dom) ~ [~ p.lok]) - == - :: - :: Convert a map of paths to data into an ankh. - :: - ++ map-to-ankh - |= hat/(map path (pair lobe cage)) - ^- ankh - %+ roll ~(tap by hat) - |= {{pat/path lob/lobe zar/cage} ank/ankh} - ^- ankh - ?~ pat - ank(fil [~ lob zar]) - =+ nak=(~(get by dir.ank) i.pat) - %= ank - dir %+ ~(put by dir.ank) i.pat - $(pat t.pat, ank (fall nak *ankh)) - == - :: - :: Update the object store with new blobs. - :: - :: Must uni the old-lat into the new-lat so that if we recreate - :: the same blob hash, we use the old blob not the new one. Else - :: you get mutually recurring %delta blobs. - ++ add-blobs - |= [new-blobs=(map path blob) old-lat=(map lobe blob)] - ^- (map lobe blob) - =/ new-lat=(map lobe blob) - %- malt - %+ turn - ~(tap by new-blobs) - |= [=path =blob] - [p.blob blob] - (~(uni by new-lat) old-lat) - :: - :: Apply a change list, creating the commit and applying it to - :: the current state. - :: - ++ execute-changes - |= [wen=@da lem=suba] - ^- (unit [dome rang]) - =/ parent - ?: =(0 let.dom) - ~ - [(aeon-to-tako let.dom)]~ - =/ new-blobs (apply-changes lem) - =. lat.ran (add-blobs new-blobs lat.ran) - =/ new-lobes (~(run by new-blobs) |=(=blob p.blob)) - =/ new-yaki (make-yaki parent new-lobes wen) - :: if no changes and not first commit or merge, abort - ?. ?| =(0 let.dom) - !=((lent p.new-yaki) 1) - !=(q.new-yaki q:(aeon-to-yaki let.dom)) - == - ~ - =: let.dom +(let.dom) - hit.dom (~(put by hit.dom) +(let.dom) r.new-yaki) - hut.ran (~(put by hut.ran) r.new-yaki new-yaki) - == - `[dom ran] - :: - :: Apply label to current revision - :: - ++ execute-label - |= lab=@tas - ?< (~(has by lab.dom) lab) - dom(lab (~(put by lab.dom) lab let.dom)) - :: - :: Apply a list of changes against the current state and produce - :: the new state. - :: - ++ apply-changes :: apply-changes - |= [change-files=(list [p=path q=misu])] - ^- (map path blob) - =+ ^= old-files :: current state - ?: =(let.dom 0) :: initial commit - ~ :: has nothing - =< q - %- aeon-to-yaki - let.dom - =; new-files=(map path blob) - =+ sar=(silt (turn change-files head)) :: changed paths - %+ roll ~(tap by old-files) :: find unchanged - =< .(bat new-files) - |= [[pax=path gar=lobe] bat=(map path blob)] - ?: (~(has in sar) pax) :: has update - bat - %+ ~(put by bat) pax - ~| [pax gar (lent ~(tap by lat.ran))] - (lobe-to-blob gar) :: use original - %+ roll change-files - |= {{pax/path mys/misu} new-files/(map path blob)} - ^+ new-files - ?- -.mys - $ins :: insert if not exist - ?: (~(has by new-files) pax) - ~|([%ins-new-files pax] !!) - ?: (~(has by old-files) pax) - ~|([%ins-old-files pax] !!) - %+ ~(put by new-files) pax - %- make-direct-blob - ?: &(?=($mime -.p.mys) =([%hoon ~] (slag (dec (lent pax)) pax))) - `page`[%hoon +.+.q.q.p.mys] - [p q.q]:p.mys - :: - $del :: delete if exists - ?> |((~(has by old-files) pax) (~(has by new-files) pax)) - (~(del by new-files) pax) - :: - $dif :: mutate, must exist - =+ ber=(~(get by new-files) pax) :: XX typed - =+ her==>((flop pax) ?~(. %$ i)) - ?~ ber - =+ har=(~(get by old-files) pax) - ?~ har !! - %+ ~(put by new-files) pax - (make-delta-blob p.mys [(lobe-to-mark u.har) u.har] [p q.q]:q.mys) - :: XX check vase !evil - :: XX of course that's a problem, p.u.ber isn't in rang since it - :: was just created. We shouldn't be sending multiple - :: diffs - :: %+ ~(put by bar) pax - :: %^ make-delta-blob p.mys - :: [(lobe-to-mark p.u.ber) p.u.ber] - :: [p q.q]:q.mys - :: :: XX check vase !evil - ~|([%two-diffs-for-same-file pax] !!) - == - :: - :: Get the data at a node. - :: - :: If it's in our ankh (current state cache), we can just produce - :: the result. Otherwise, we've got to look up the node at the - :: aeon to get the content hash, use that to find the blob, and use - :: the blob to get the data. We also special-case the hoon mark - :: for bootstrapping purposes. - :: - ++ read-x - |= [local=? yon=aeon pax=path] - ^- (unit (unit (each cage lobe))) - ?: =(0 yon) - [~ ~] - =+ tak=(~(get by hit.dom) yon) - ?~ tak - ~ - ?: &(local =(yon let.dom)) - :- ~ - %+ bind - fil.ank:(descend-path:(zu ank.dom) pax) - |=(a/{p/lobe q/cage} [%& q.a]) - =+ yak=(tako-to-yaki u.tak) - =+ lob=(~(get by q.yak) pax) - ?~ lob - [~ ~] - =+ mar=(lobe-to-mark u.lob) - :: should convert any lobe to cage - :: - ?. ?=($hoon mar) - [~ ~ %| u.lob] - :^ ~ ~ %& - :+ mar [%atom %t ~] - |- ^- @t :: (urge cord) would be faster - =+ bol=(lobe-to-blob u.lob) - ?: ?=($direct -.bol) - ;;(@t q.q.bol) - ?> ?=($delta -.bol) - =+ txt=$(u.lob q.q.bol) - ?> ?=($txt-diff p.r.bol) - =+ dif=;;((urge cord) q.r.bol) - =, format - =+ pac=(of-wain (lurk:differ (to-wain (cat 3 txt '\0a')) dif)) - (end 3 (dec (met 3 pac)) pac) - :: - :: Traverse an ankh. - :: - ++ zu :: filesystem - |= ank/ankh :: filesystem state - =| ram/path :: reverse path into - |% - ++ descend :: descend - |= lol/@ta - ^+ +> - =+ you=(~(get by dir.ank) lol) - +>.$(ram [lol ram], ank ?~(you [~ ~] u.you)) - :: - ++ descend-path :: descend recursively - |= way/path - ^+ +> - ?~(way +> $(way t.way, +> (descend i.way))) - -- - -- -- :: ++ fusion From ee13aa73d4c2411c2111c1a8acb6d6673e248562 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 20:22:25 -0700 Subject: [PATCH 116/280] clay: move foreign-request to fusion --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 183 +++++++++++------------------------- 2 files changed, 58 insertions(+), 129 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 40b4de715..f9e670900 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b25a71e52b11e205e527cc309ab8e54a5b14c11703239b3ee70894ce47699fd -size 13823021 +oid sha256:b645d0c0f3d05af1f372df6d9e153b337bc54fa7d84de52c14b1b2ecf0520d67 +size 13809831 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index f00a1b3f1..995026193 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -211,7 +211,6 @@ fod/(map duct @ud) :: current requests haw/(map mood (unit cage)) :: simple cache pud/update-qeu :: active updates - pur/request-map :: active requests == :: :: :: Result of a subscription @@ -235,11 +234,6 @@ eval-data=(unit [inx=@ud rut=(unit rand) =eval-form:eval:update-clad]) == :: -:: The clad monad for foreign simple requests -:: -++ request-clad (clad ,cage) -++ request-map ,(map inx=@ud [=rand =eval-form:eval:request-clad]) -:: :: Domestic ship. :: :: `hun` is the duct to dill, and `dos` is a collection of our desks. @@ -631,58 +625,6 @@ |= [=wove ducts=(set duct)] [ducts (print-wove wove)] :: -:: A simple foreign request. -:: -++ foreign-request - |= $: our=ship - her=ship - syd=desk - wen=@da - == - |^ - |= [=rave =rand] - =/ m request-clad - ^- form:m - ?- p.p.rand - $a ~| %no-big-ford-builds-across-network-for-now !! - $b ~| %i-guess-you-ought-to-build-your-own-marks !! - $c ~| %casts-should-be-compiled-on-your-own-ship !! - $d ~| %totally-temporary-error-please-replace-me !! - $p ~| %requesting-foreign-permissions-is-invalid !! - $s ~| %please-dont-get-your-takos-over-a-network !! - $t ~| %requesting-foreign-directory-is-vaporware !! - $u ~| %prolly-poor-idea-to-get-rang-over-network !! - $v ~| %weird-shouldnt-get-v-request-from-network !! - $z ~| %its-prolly-not-reasonable-to-request-ankh !! - $x (validate-x [p.p q.p q r]:rand) - $y (pure:m [p.r.rand !>(;;(arch q.r.rand))]) - :: - $w - %- pure:m - :- p.r.rand - ?+ p.r.rand ~| %strange-w-over-nextwork !! - $cass !>(;;(cass q.r.rand)) - $null [[%atom %n ~] ~] - $nako !>(~|([%molding [&1 &2 &3]:q.r.rand] ;;(nako q.r.rand))) - == - == - :: - :: Make sure that incoming data is of the mark it claims to be. - :: - ++ validate-x - |= [car=care cas=case pax=path peg=page] - =/ m (clad ,cage) - ;< ~ bind:m - %+ just-do /foreign-x - [%f %build live=%.n %pin wen (vale-page:util [our %home] peg)] - ;< res=made-result:ford bind:m expect-ford - ^- form:m - ?. ?=([%complete %success *] res) - =/ message (made-result-as-error:ford res) - (clad-fail %validate-foreign-x-failed message) - (pure:m (result-to-cage:ford build-result.res)) - -- -:: :: A full foreign update. Validate and apply to our local cache of :: their state. :: @@ -2877,58 +2819,6 @@ ..start-request (duce for u.new-sub) :: - :: Continue foreign request - :: - ++ take-foreign-request - |= [inx=@ud =sign] - ^+ +> - =/ m request-clad - ?> ?=(^ ref) - ?~ request=(~(get by pur.u.ref) inx) - ~|(%no-active-foreign-request !!) - =^ r=[moves=(list move) =eval-result:eval:m] eval-form.u.request - %- take:eval:m - :* eval-form.u.request - hen - /foreign-request/(scot %p her)/[syd]/(scot %ud inx) - now - ran - sign - == - => .(+>.$ (emil moves.r)) :: TMI - ?- -.eval-result.r - %next +>.$ - %fail (fail-foreign-request inx rand.u.request err.eval-result.r) - %done (done-foreign-request inx rand.u.request value.eval-result.r) - == - :: - :: Fail foreign request - :: - ++ fail-foreign-request - |= [inx=@ud =rand err=(pair term tang)] - ^+ +> - %- (slog leaf+"foreign request failed" leaf+(trip p.err) q.err) - ?> ?=(^ ref) - =/ =mood [p.p q.p q]:rand - =: haw.u.ref (~(put by haw.u.ref) mood ~) - bom.u.ref (~(del by bom.u.ref) inx) - fod.u.ref (~(del by fod.u.ref) hen) - == - wake - :: - :: Finish foreign request - :: - ++ done-foreign-request - |= [inx=@ud =rand =cage] - ^+ +> - ?> ?=(^ ref) - =/ =mood [p.p q.p q]:rand - =: haw.u.ref (~(put by haw.u.ref) mood `cage) - bom.u.ref (~(del by bom.u.ref) inx) - fod.u.ref (~(del by fod.u.ref) hen) - == - wake - :: :: Called when a foreign ship answers one of our requests. :: :: If it's a `%many` request, start a `+foreign-update`. Else start @@ -2961,15 +2851,63 @@ ?. ?=($sing -.rav) haw.u.ref (~(put by haw.u.ref) mood.rav ~) == - :: something here, so kick off a validator + |^ + =/ result=(unit cage) (validate u.rut) + =/ =mood [p.p q.p q]:u.rut + =: haw.u.ref (~(put by haw.u.ref) mood result) + bom.u.ref (~(del by bom.u.ref) inx) + fod.u.ref (~(del by fod.u.ref) hen) + == + wake + :: something here, so validate :: - =. pur.u.ref - %+ ~(put by pur.u.ref) - inx - :- u.rut - %- from-form:eval:request-clad - ((foreign-request our her syd now) rav u.rut) - (take-foreign-request inx clad-init-sign) + ++ validate + |= =rand + ^- (unit cage) + ?- p.p.rand + $a ~| %no-big-ford-builds-across-network-for-now !! + $b ~| %i-guess-you-ought-to-build-your-own-marks !! + $c ~| %casts-should-be-compiled-on-your-own-ship !! + $d ~| %totally-temporary-error-please-replace-me !! + $p ~| %requesting-foreign-permissions-is-invalid !! + $s ~| %please-dont-get-your-takos-over-a-network !! + $t ~| %requesting-foreign-directory-is-vaporware !! + $u ~| %prolly-poor-idea-to-get-rang-over-network !! + $v ~| %weird-shouldnt-get-v-request-from-network !! + $z ~| %its-prolly-not-reasonable-to-request-ankh !! + $w `(validate-w r.rand) + $x (validate-x [p.p q.p q r]:rand) + $y `[p.r.rand !>(;;(arch q.r.rand))] + == + :: + :: Make sure the incoming data is a %w response + :: + ++ validate-w + |= =page + ^- cage + :- p.page + ?+ p.page ~| %strange-w-over-nextwork !! + $cass !>(;;(cass q.page)) + $null [[%atom %n ~] ~] + $nako !>(~|([%molding [&1 &2 &3]:q.page] ;;(nako q.page))) + == + :: + :: Make sure that incoming data is of the mark it claims to be. + :: + ++ validate-x + |= [car=care cas=case pax=path peg=page] + ^- (unit cage) + =/ =args:ford:fusion + [ank.dom ~ ~ lat.ran fod.dom] + =/ vale-result + %- mule |. + %- wrap:fusion + (page-to-cage:(ford:fusion args) peg) + ?: ?=(%| -.vale-result) + %- (slog >%validate-x-failed< p.vale-result) + ~ + `-.p.vale-result + -- :: :: Continue foreign update :: @@ -4290,15 +4228,6 @@ :_ ..^$ [hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~ :: - ?: ?=([%foreign-request @ @ @ *] tea) - =/ her (slav %p i.t.tea) - =/ syd (slav %tas i.t.t.tea) - =/ inx (slav %ud i.t.t.t.tea) - =^ mos ruf - =/ den ((de our now ski hen ruf) her syd) - abet:(take-foreign-request:den inx q.hin) - [mos ..^$] - :: ?: ?=([%foreign-update @ @ *] tea) =/ her (slav %p i.t.tea) =/ syd (slav %tas i.t.t.tea) From be77fa39db83b971a0854f4ba76f7b6f238420b9 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 22:53:23 -0700 Subject: [PATCH 117/280] clay: convert foreign-update to fusion --- bin/solid.pill | 4 +- pkg/arvo/app/dojo.hoon | 1 - pkg/arvo/sys/vane/clay.hoon | 621 +++++------------------------------- 3 files changed, 81 insertions(+), 545 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index f9e670900..c2cb0aa94 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b645d0c0f3d05af1f372df6d9e153b337bc54fa7d84de52c14b1b2ecf0520d67 -size 13809831 +oid sha256:8adb1a6c02846868b94011e52472d05668731e5e5dfcdde46f61806c1f875f6f +size 13749154 diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 9485c4b18..579cc383b 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -724,7 +724,6 @@ (dy-vase p.u.val) %+ slap (with-faces gat+gat rep+(with-faces soz) ~) - %- (slog >%try< (sell (slot 27 gat)) ~) :+ %cncb ~[%gat] ^- (list [wing hoon]) %+ turn soz diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 995026193..d8badc5da 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -210,7 +210,6 @@ bom/(map @ud {p/duct q/rave}) :: outstanding fod/(map duct @ud) :: current requests haw/(map mood (unit cage)) :: simple cache - pud/update-qeu :: active updates == :: :: :: Result of a subscription @@ -223,17 +222,6 @@ [%blub ~] == :: -:: The clad monad for foreign updates. -:: -:: Same as +commit-clad, except includes `lim`, as in +rede. Null if -:: subscription ended. -:: -++ update-clad (clad ,(unit [lim=@da dome rang])) -++ update-qeu - $: waiting=(qeu [inx=@ud rut=(unit rand)]) - eval-data=(unit [inx=@ud rut=(unit rand) =eval-form:eval:update-clad]) - == -:: :: Domestic ship. :: :: `hun` is the duct to dill, and `dos` is a collection of our desks. @@ -268,170 +256,6 @@ $: rus=(map desk rede) :: neighbor desks == :: -:: Hash of a commit, for lookup in the object store (hut.ran) -:: -++ tako @ :: yaki ref -:: -:: Commit. -:: -:: List of parents, content, hash of self, and time commited. -:: -++ yaki :: snapshot - $: p/(list tako) :: parents - q/(map path lobe) :: fileset - r/tako :: - :: :: XX s? - t/@da :: date - == :: -:: -:: Unvalidated blob -:: -++ plop blob :: unvalidated blob -:: -:: The clay monad, for easier-to-follow state machines. -:: -:: The best way to think about a clad is that it's a transaction that -:: may take multiple arvo events, and may send notes to other vanes to -:: get information. -:: -+$ clad-input [now=@da new-rang=rang =sign] -:: -:: notes: notes to send immediately. These will go out even if a -:: later stage of the process fails, so they shouldn't have any -:: semantic effect on the rest of the system. Path is -:: included exclusively for documentation and |verb. -:: effects: moves to send after the process ends. -:: wait: don't move on, stay here. The next sign should come back -:: to this same callback. -:: cont: continue process with new callback. -:: fail: abort process; don't send effects -:: done: finish process; send effects -:: -++ clad-output-raw - |* a=mold - $~ [~ ~ %done *a] - $: notes=(list [path note]) - effects=(list move) - $= next - $% [%wait ~] - [%cont self=(clad-form-raw a)] - [%fail err=(pair term tang)] - [%done value=a] - == - == -:: -++ clad-form-raw - |* a=mold - $-(clad-input (clad-output-raw a)) -:: -++ clad-fail - |= err=(pair term tang) - |= clad-input - [~ ~ %fail err] -:: -++ clad-init-sign `sign`[%y %init-clad ~] -:: -++ clad - |* a=mold - |% - ++ output (clad-output-raw a) - ++ form (clad-form-raw a) - ++ pure - |= arg=a - ^- form - |= clad-input - [~ ~ %done arg] - :: - ++ bind - |* b=mold - |= [m-b=(clad-form-raw b) fun=$-(b form)] - ^- form - |= input=clad-input - =/ b-res=(clad-output-raw b) - (m-b input) - ^- output - :+ notes.b-res effects.b-res - ?- -.next.b-res - %wait [%wait ~] - %cont [%cont ..$(m-b self.next.b-res)] - %fail [%fail err.next.b-res] - %done [%cont (fun value.next.b-res)] - == - :: - :: The clad monad must be evaluted in a particular way to maintain - :: its monadic character. +take:eval implements this. - :: - ++ eval - |% - :: Indelible state of a clad - :: - +$ eval-form - $: effects=(list move) - =form - == - :: - :: Convert initial form to eval-form - :: - ++ from-form - |= =form - ^- eval-form - [~ form] - :: - :: The cases of results of +take - :: - +$ eval-result - $% [%next ~] - [%fail err=(pair term tang)] - [%done value=a] - == - :: - :: Take a new sign and run the clad against it - :: - ++ take - :: moves: accumulate throughout recursion the moves to be - :: produced now - =| moves=(list move) - |= [=eval-form =duct =our=wire =clad-input] - ^- [[(list move) =eval-result] _eval-form] - :: run the clad callback - :: - =/ =output (form.eval-form clad-input) - :: add notes to moves - :: - =. moves - %+ welp - moves - %+ turn notes.output - |= [=path =note] - [duct %pass (weld our-wire path) note] - :: add effects to list to be produced when done - :: - =. effects.eval-form - (weld effects.eval-form effects.output) - :: if done, produce effects - :: - =? moves ?=(%done -.next.output) - %+ welp - moves - effects.eval-form - :: case-wise handle next steps - :: - ?- -.next.output - %wait [[moves %next ~] eval-form] - %fail [[moves %fail err.next.output] eval-form] - %done [[moves %done value.next.output] eval-form] - %cont - :: recurse to run continuation with initialization move - :: - %_ $ - form.eval-form self.next.output - sign.clad-input clad-init-sign - == - == - -- - -- -:: -:: ++ move {p/duct q/(wind note gift:able)} :: local move ++ note :: out request $-> $~ [%b %wait *@da] :: @@ -473,10 +297,7 @@ ++ riot (unit rant) :: response+complete ++ sign :: in result $<- $~ [%b %wake ~] :: - $% $: %y :: - $% [%init-clad ~] :: - == == :: - $: %a :: by %ames + $% $: %a :: by %ames $> $? %boon :: response %done :: (n)ack %lost :: lost boon @@ -513,14 +334,6 @@ ++ sort-by-head |=([a=(pair path *) b=(pair path *)] (aor p.a p.b)) :: -:: Just send a note. -:: -++ just-do - |= [=path =note] - =/ m (clad ,~) - ^- form:m - |= clad-input - [[path note]~ ~ %done ~] :: By convention: paf == (weld pax pat) :: ++ mode-to-commit @@ -568,40 +381,6 @@ :: [deletes changes] :: -:: Wait for ford to respond -:: -++ expect-ford - =/ m (clad ,made-result:ford) - ^- form:m - |= clad-input - ?: ?=(%init-clad +<.sign) - [~ ~ %wait ~] - ?: ?=(%made +<.sign) - [~ ~ %done result.sign] - ~| [%expected-made got=+<.sign] - !! -:: -:: Wait for clay to respond -:: -:: This setup where we take in a new-rang in +clad-input but only -:: apply it when calling +expect-clay is suspicious. I'm not sure -:: what's the best approach to reading in potentially new state that -:: we also may have changed but haven't committed. -:: -++ expect-clay - |= ran=rang - =/ m (clad ,[riot rang]) - ^- form:m - |= clad-input - ?: ?=(%init-clad +<.sign) - [~ ~ %wait ~] - ?: ?=(%writ +<.sign) - =/ uni-rang=rang - :- (~(uni by hut.new-rang) hut.ran) - (~(uni by lat.new-rang) lat.ran) - [~ ~ %done p.sign uni-rang] - ~| [%expected-writ got=+<.sign] - !! -- => ~% %clay + ~ |% @@ -625,187 +404,6 @@ |= [=wove ducts=(set duct)] [ducts (print-wove wove)] :: -:: A full foreign update. Validate and apply to our local cache of -:: their state. -:: -++ foreign-update - |= $: our=ship - her=ship - syd=desk - wen=@da - == - |^ - |= [=moat rand=(unit rand) lim=@da dom=dome ran=rang] - =/ m update-clad - ^- form:m - ?~ rand - (pure:m ~) - =/ lem ?.(?=(%da -.to.moat) lim p.to.moat) - ?> ?=(%nako p.r.u.rand) - =/ nako ;;(nako q.r.u.rand) - ?: =(0 let.dom) - ;< [dom=dome ran=rang] bind:m (apply-foreign-update nako dom ran) - (pure:m ~ lem dom ran) - ;< blobs=(set blob) bind:m (validate-plops bar.nako) - ;< [dom=dome ran=rang] bind:m - (apply-foreign-update nako(bar blobs) dom ran) - (pure:m ~ lem dom ran) - :: - :: Make sure that incoming data is of the mark it claims to be. - :: - ++ validate-plops - |= plops=(set plop) - =/ m (clad ,(set blob)) - ^- form:m - ;< ~ bind:m - %+ just-do /validate-plops - :* %f %build live=%.n %pin wen - %list - ^- (list schematic:ford) - %+ turn ~(tap in plops) - |= a/plop - ?- -.a - $direct - :- [%$ %blob !>([%direct p.a *page])] - (vale-page:util [our %home] p.q.a q.q.a) - :: - $delta - :- [%$ %blob !>([%delta p.a q.a *page])] - (vale-page:util [our %home] p.r.a q.r.a) - == - == - ;< res=made-result:ford bind:m expect-ford - =/ cages (made-result-to-cages-or-error:util res) - ?: ?=(%| -.cages) - (clad-fail %validate-plops-failed p.cages) - =| blobs=(list blob) - |- ^- form:m - ?~ p.cages - (pure:m (silt blobs)) - =* bob p.i.p.cages - =* cay q.i.p.cages - ?. ?=(%blob p.bob) - (clad-fail %validate-plops-not-blob >p.bob< ~) - =/ new-blob=blob - =/ blob ;;(blob q.q.bob) - ?- -.blob - %delta [-.blob p.blob q.blob p.cay q.q.cay] - %direct [-.blob p.blob p.cay q.q.cay] - == - $(p.cages t.p.cages, blobs [new-blob blobs]) - :: - :: When we get a %w foreign update, store this in our state. - :: - :: We get the commits and blobs from the nako and add them to our object - :: store, then we update the map of aeons to commits and the latest aeon. - :: - ++ apply-foreign-update - |= [=nako dom=dome ran=rang] - =/ m (clad ,[dome rang]) - ^- form:m - :: hit: updated commit-hashes by @ud case - :: - =/ hit (~(uni by hit.dom) gar.nako) - :: nut: new commit-hash/commit pairs - :: - =/ nut - (turn ~(tap in lar.nako) |=(=yaki [r.yaki yaki])) - :: hut: updated commits by hash - :: - =/ hut (~(uni by (malt nut)) hut.ran) - :: nat: new blob-hash/blob pairs - :: - =/ nat - (turn ~(tap in bar.nako) |=(=blob [p.blob blob])) - :: lat: updated blobs by hash - :: - =/ lat (~(uni by (malt nat)) lat.ran) - :: traverse updated state and sanity check - :: - =+ ~| :* %bad-foreign-update - [gar=gar let=let.nako nut=(turn nut head) nat=(turn nat head)] - [hitdom=hit.dom letdom=let.dom] - == - ?: =(0 let.nako) - ~ - =/ =aeon 1 - |- ^- ~ - =/ =tako - ~| [%missing-aeon aeon] (~(got by hit) aeon) - =/ =yaki - ~| [%missing-tako tako] (~(got by hut) tako) - =+ %+ turn - ~(tap by q.yaki) - |= [=path =lobe] - ~| [%missing-blob path lobe] - ?> (~(has by lat) lobe) - ~ - ?: =(let.nako aeon) - ~ - $(aeon +(aeon)) - :: produce updated state - :: - =: let.dom (max let.nako let.dom) - hit.dom hit - hut.ran hut - lat.ran lat - == - (pure:m dom ran) - -- -:: -:: An assortment of useful functions, used in +commit, +merge, and +de -:: -++ util - |% - :: Create a schematic to validate a page. - :: - :: If the mark is %hoon, we short-circuit the validation for bootstrapping - :: purposes. - :: - ++ vale-page - |= [=disc:ford a=page] - ^- schematic:ford - ?. ?=($hoon p.a) [%vale disc a] - ?. ?=(@t q.a) [%dude >%weird-hoon< %ride [%zpzp ~] %$ *cage] - [%$ p.a [%atom %t ~] q.a] - :: Crashes on ford failure - :: - ++ ford-fail |=(tan/tang ~|(%ford-fail (mean tan))) - :: - :: Expects a single-level gage (i.e. a list of pairs of cages). If the - :: result is of a different form, or if some of the computations in the gage - :: failed, we produce a stack trace. Otherwise, we produce the list of pairs - :: of cages. - :: - ++ made-result-to-cages-or-error - |= result=made-result:ford - ^- (each (list (pair cage cage)) tang) - :: - ?: ?=([%incomplete *] result) - (mule |.(`~`(ford-fail tang.result))) - ?. ?=([%complete %success %list *] result) - (mule |.(`~`(ford-fail >%strange-ford-result -.build-result.result< ~))) - =/ results=(list build-result:ford) - results.build-result.result - =< ?+(. [%& .] {@ *} .) - |- - ^- ?((list [cage cage]) (each ~ tang)) - ?~ results ~ - :: - ?. ?=([%success ^ *] i.results) - (mule |.(`~`(ford-fail >%strange-ford-result< ~))) - ?: ?=([%error *] head.i.results) - (mule |.(`~`(ford-fail message.head.i.results))) - ?: ?=([%error *] tail.i.results) - (mule |.(`~`(ford-fail message.tail.i.results))) - :: - =+ $(results t.results) - ?: ?=([@ *] -) - - :_ - - [(result-to-cage:ford head.i.results) (result-to-cage:ford tail.i.results)] - :: - -- -:: ++ fusion => |% @@ -2821,8 +2419,7 @@ :: :: Called when a foreign ship answers one of our requests. :: - :: If it's a `%many` request, start a `+foreign-update`. Else start - :: a `+foreign-request`. + :: If it's a `%many` request, process in +take-foreign-update :: :: After updating ref (our request manager), we handle %x, %w, and %y :: responses. For %x, we call ++validate-x to validate the type of @@ -2836,13 +2433,7 @@ ?~ ruv +>.$ =/ rav=rave q.u.ruv ?: ?=(%many -.rav) - :: add to update queue - :: - =. waiting.pud.u.ref - (~(put to waiting.pud.u.ref) inx rut) - :: start update if nothing active - :: - start-next-foreign-update + (take-foreign-update inx rut) ?~ rut :: nothing here, so cache that :: @@ -2909,92 +2500,89 @@ `-.p.vale-result -- :: - :: Continue foreign update + :: A full foreign update. Validate and apply to our local cache of + :: their state. :: ++ take-foreign-update - |= =sign - ^+ +> - =/ m update-clad + |= [inx=@ud rut=(unit rand)] + ^+ ..take-foreign-update ?> ?=(^ ref) - ?~ eval-data.pud.u.ref - ~|(%no-active-foreign-update !!) - =* ed u.eval-data.pud.u.ref - =/ inx inx.ed - =^ r=[moves=(list move) =eval-result:eval:m] - eval-form.u.eval-data.pud.u.ref - %- take:eval:m - :* eval-form.ed - hen - /foreign-update/(scot %p her)/[syd] - now - ran - sign - == - => .(+>.$ (emil moves.r)) :: TMI - ?- -.eval-result.r - %next +>.$ - %fail (fail-foreign-update inx err.eval-result.r) - %done (done-foreign-update inx value.eval-result.r) - == - :: - :: Fail foreign update - :: - ++ fail-foreign-update - |= [inx=@ud err=(pair term tang)] - ^+ +> - %- (slog leaf+"foreign update failed" leaf+(trip p.err) q.err) - ?> ?=(^ ref) - =: bom.u.ref (~(del by bom.u.ref) inx) - fod.u.ref (~(del by fod.u.ref) hen) - == - =. +>.$ =<(?>(?=(^ ref) .) wake) - =. eval-data.pud.u.ref ~ - start-next-foreign-update - :: - :: Finish foreign update - :: - ++ done-foreign-update - |= [inx=@ud res=(unit [new-lim=@da =new=dome =new=rang])] - ^+ +> - ?> ?=(^ ref) - =: bom.u.ref (~(del by bom.u.ref) inx) - fod.u.ref (~(del by fod.u.ref) hen) - == - ?~ res - wake - =: lim new-lim.u.res - dom new-dome.u.res - ran new-rang.u.res - == - =. +>.$ =<(?>(?=(^ ref) .) wake) - =. eval-data.pud.u.ref ~ - start-next-foreign-update - :: - :: Kick off the the next foreign update in the queue - :: - ++ start-next-foreign-update - ^+ . - ?> ?=(^ ref) - ?. =(~ eval-data.pud.u.ref) - . - ?: =(~ waiting.pud.u.ref) - . - =^ next=[inx=@ud rut=(unit rand)] waiting.pud.u.ref - ~(get to waiting.pud.u.ref) - =/ ruv (~(get by bom.u.ref) inx.next) + =/ ruv (~(get by bom.u.ref) inx) ?~ ruv - ~& [%clay-foreign-update-lost her syd inx.next] - start-next-foreign-update + ~& [%clay-foreign-update-lost her syd inx] + ..take-foreign-update =. hen p.u.ruv =/ =rave q.u.ruv ?> ?=(%many -.rave) - =. eval-data.pud.u.ref - :- ~ - :+ inx.next - rut.next - %- from-form:eval:update-clad - ((foreign-update our her syd now) moat.rave rut.next lim dom ran) - (take-foreign-update clad-init-sign) + |^ + ?~ rut + done + =. lim ?.(?=(%da -.to.moat.rave) lim p.to.moat.rave) + ?> ?=(%nako p.r.u.rut) + =/ nako ;;(nako q.r.u.rut) + =. ..take-foreign-update + =< ?>(?=(^ ref) .) + (apply-foreign-update nako) + done + :: + ++ done + =: bom.u.ref (~(del by bom.u.ref) inx) + bom.u.ref (~(del by bom.u.ref) hen) + == + =<(?>(?=(^ ref) .) wake) + :: + :: When we get a %w foreign update, store this in our state. + :: + :: We get the commits and blobs from the nako and add them to our + :: object store, then we update the map of aeons to commits and the + :: latest aeon. + :: + ++ apply-foreign-update + |= =nako + ^+ ..take-foreign-update + :: hit: updated commit-hashes by @ud case + :: nut: new commit-hash/commit pairs + :: hut: updated commits by hash + :: nat: new blob-hash/blob pairs + :: lat: updated blobs by hash + :: + =/ hit (~(uni by hit.dom) gar.nako) + =/ nut (turn ~(tap in lar.nako) |=(=yaki [r.yaki yaki])) + =/ hut (~(uni by (malt nut)) hut.ran) + =/ nat (turn ~(tap in bar.nako) |=(=blob [p.blob blob])) + =/ lat (~(uni by (malt nat)) lat.ran) + :: traverse updated state and sanity check + :: + =+ ~| :* %bad-foreign-update + [gar=gar let=let.nako nut=(turn nut head) nat=(turn nat head)] + [hitdom=hit.dom letdom=let.dom] + == + ?: =(0 let.nako) + ~ + =/ =aeon 1 + |- ^- ~ + =/ =tako + ~| [%missing-aeon aeon] (~(got by hit) aeon) + =/ =yaki + ~| [%missing-tako tako] (~(got by hut) tako) + =+ %+ turn + ~(tap by q.yaki) + |= [=path =lobe] + ~| [%missing-blob path lobe] + ?> (~(has by lat) lobe) + ~ + ?: =(let.nako aeon) + ~ + $(aeon +(aeon)) + :: produce updated state + :: + =: let.dom (max let.nako let.dom) + hit.dom hit + hut.ran hut + lat.ran lat + == + ..take-foreign-update + -- :: :: fire function if request is in future :: @@ -4228,14 +3816,6 @@ :_ ..^$ [hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~ :: - ?: ?=([%foreign-update @ @ *] tea) - =/ her (slav %p i.t.tea) - =/ syd (slav %tas i.t.t.tea) - =^ mos ruf - =/ den ((de our now ski hen ruf) her syd) - abet:(take-foreign-update:den q.hin) - [mos ..^$] - :: ?: ?=([%blab care @ @ *] tea) ?> ?=(%made +<.q.hin) ?. ?=([%complete %success *] result.q.hin) @@ -4321,9 +3901,6 @@ :: ?- -.+.q.hin %public-keys ~|([%public-keys-raw tea] !!) - %init-clad - ~|(%clad-not-real !!) - :: %crud [[[hen %slip %d %flog +.q.hin] ~] ..^$] :: @@ -4374,44 +3951,4 @@ |= rant ^- rand [p q [p q.q]:r] -:: -:: -++ mode-to-soba - |= {hat/(map path lobe) pax/path all/? mod/mode} - ^- soba - %+ weld - ^- (list (pair path miso)) - ?. all - ~ - =+ mad=(malt mod) - =+ len=(lent pax) - =/ descendants/(list path) - %+ turn - %+ skim ~(tap by hat) - |= {paf/path lob/lobe} - =(pax (scag len paf)) - |= {paf/path lob/lobe} - (slag len paf) - %+ murn - descendants - |= pat/path - ^- (unit (pair path {$del ~})) - ?: (~(has by mad) pat) - ~ - `[(weld pax pat) %del ~] - ^- (list (pair path miso)) - %+ murn mod - |= {pat/path mim/(unit mime)} - ^- (unit (pair path miso)) - =+ paf=(weld pax pat) - ?~ mim - =+ (~(get by hat) paf) - ?~ - - ~& [%deleting-already-gone pax pat] - ~ - `[paf %del ~] - =+ (~(get by hat) paf) - ?~ - - `[paf %ins %mime -:!>(*mime) u.mim] - `[paf %mut %mime -:!>(*mime) u.mim] -- From 6da1424f8ab82b0213138afc71317d8c9d403ec0 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 23:36:55 -0700 Subject: [PATCH 118/280] clay: remove last turbo references --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 91 +++++++------------------------------ 2 files changed, 18 insertions(+), 77 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index c2cb0aa94..7d566fb68 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8adb1a6c02846868b94011e52472d05668731e5e5dfcdde46f61806c1f875f6f -size 13749154 +oid sha256:67b99bf7c4724fa37e2601e80fbf750dbe7e1ac53b77833224bc99ba17779026 +size 13738329 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index d8badc5da..56ec57d0f 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -281,13 +281,6 @@ $: %d :: to %dill $>(%flog task:able:dill) :: == :: - $: %f :: to %ford - $> $? %build :: - %keep :: - %wipe :: - == :: - task:able:ford :: - == :: $: %g :: to %gall $>(%deal task:able:gall) :: == :: @@ -315,9 +308,6 @@ == :: gift:able :: == :: - $: %f :: by %ford - $>(%made gift:able:ford) :: - == :: $: %j :: by %jael $>(%public-keys gift:able:jael) :: == :: @@ -1047,18 +1037,23 @@ :: the latter case we fetch the data at the lobe and produce that. :: ++ blab - |= {hen/duct mun/mood dat/(each cage lobe)} + |= [hen=duct mun=mood dat=(each cage lobe)] ^+ +> - ?: ?=(%& -.dat) - %- emit - :* hen %slip %b %drip - !>([%writ ~ [care.mun case.mun syd] path.mun p.dat]) - == + =^ =cage fod.dom + ?: ?=(%& -.dat) + [p.dat fod.dom] + =/ =args:ford:fusion + [ank.dom ~ ~ lat.ran fod.dom] + =^ =page ford-cache.args + %- wrap:fusion + (lobe-to-page:(ford:fusion args) p.dat) + =^ =cage ford-cache.args + %- wrap:fusion + (page-to-cage:(ford:fusion args) page) + [cage ford-cache.args] %- emit - :* hen %pass [%blab care.mun (scot case.mun) syd path.mun] - %f %build live=%.n %pin - (case-to-date case.mun) - (lobe-to-schematic [her syd] path.mun p.dat) + :* hen %slip %b %drip + !>([%writ ~ [care.mun case.mun syd] path.mun cage]) == :: ++ case-to-date @@ -1103,36 +1098,6 @@ $tas (~(get by lab.dom) p.lok) $ud ?:((gth p.lok let.dom) ~ [~ p.lok]) == - ++ lobe-to-schematic (cury lobe-to-schematic-p ?=(~ ref)) - ++ lobe-to-schematic-p - |= [local=? disc=disc:ford pax=path lob=lobe] - ^- schematic:ford - =/ hat/(map path lobe) - ?: =(let.dom 0) - ~ - q:(aeon-to-yaki:ze let.dom) - =+ lol=`(unit lobe)`?.(local `0vsen.tinel (~(get by hat) pax)) - |- ^- schematic:ford - ?: =([~ lob] lol) - =+ (need (need (read-x:ze let.dom pax))) - ?> ?=(%& -<) - [%$ p.-] - =+ bol=(~(got by lat.ran) lob) - ?- -.bol - $direct (page-to-schematic disc q.bol) - $delta ~| delta+q.q.bol - [%pact disc $(lob q.q.bol) (page-to-schematic disc r.bol)] - == - :: - :: Create a schematic out of a page (which is a [mark noun]). - :: - ++ page-to-schematic - |= [disc=disc:ford a=page] - ^- schematic:ford - ?. ?=($hoon p.a) [%volt disc a] - :: %hoon bootstrapping - [%$ p.a [%atom %t ~] q.a] - :: :: ++ blas |= {hen/duct das/(set mood)} @@ -3816,22 +3781,6 @@ :_ ..^$ [hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~ :: - ?: ?=([%blab care @ @ *] tea) - ?> ?=(%made +<.q.hin) - ?. ?=([%complete %success *] result.q.hin) - ~| %blab-fail - ~> %mean.|.((made-result-as-error:ford result.q.hin)) - !! :: interpolate ford fail into stack trace - :_ ..^$ :_ ~ - :* hen %slip %b %drip !> - :* %writ ~ - ^- [care case @tas] - [i.t.tea ;;(case +>:(slay i.t.t.tea)) i.t.t.t.tea] - :: - `path`t.t.t.t.tea - `cage`(result-to-cage:ford build-result.result.q.hin) - == == - :: ?: ?=([%warp-index @ @ @ ~] tea) ?+ +<.q.hin ~| %clay-warp-index-strange !! %done @@ -3887,24 +3836,16 @@ %+ turn cancel-ducts |= =duct [duct %slip %b %drip !>([%writ ~])] - :: Clear ford cache - :: - =/ clear-ford-cache-moves=(list move) - :~ [hen %pass /clear/keep %f %keep 0 1] - [hen %pass /clear/wipe %f %wipe 100] - [hen %pass /clear/kep %f %keep 2.048 64] - == :: delete local state of foreign desk :: =. hoy.ruf (~(del by hoy.ruf) who) - [(weld clear-ford-cache-moves cancel-moves) ..^$] + [cancel-moves ..^$] :: ?- -.+.q.hin %public-keys ~|([%public-keys-raw tea] !!) %crud [[[hen %slip %d %flog +.q.hin] ~] ..^$] :: - %made ~& %clay-raw-ford [~ ..^$] %mere ?: ?=(%& -.p.+.q.hin) ~& 'initial merge succeeded' From 778f6e9d05aa0110263624db7be3d4322d947a58 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 9 May 2020 08:09:26 -0400 Subject: [PATCH 119/280] /sys: make hoon optional in %lyra --- bin/solid.pill | 4 +- pkg/arvo/lib/hood/helm.hoon | 7 +-- pkg/arvo/lib/pill.hoon | 78 +++++++++++++--------------------- pkg/arvo/sys/arvo.hoon | 85 +++++++++++++++++++++++-------------- pkg/arvo/sys/vane/clay.hoon | 44 +++++++++++++------ pkg/arvo/sys/vane/gall.hoon | 9 +++- pkg/arvo/sys/zuse.hoon | 12 +++--- 7 files changed, 131 insertions(+), 108 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 4c9598731..72145990d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0af672290640049b6cb522f0ed71bf0171e18e11f4b526d319bf47cf71f0dd4f -size 13357516 +oid sha256:43ee79a0c0dc306572ea8bbe150c1c05ee28a3777a1b83cfbf627e7487687d25 +size 14221188 diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index cdfd8a446..fb1fb100f 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -166,9 +166,10 @@ %- emil ^- (list card:agent:gall) =/ top=path /(scot %p our)/home/(scot %da now)/sys - =/ hun .^(@ %cx (welp top /hoon/hoon)) - =/ arv .^(@ %cx (welp top /arvo/hoon)) - :- [%pass /reset %arvo %d %flog %lyra `@t`hun `@t`arv] + =/ hun .^(@t %cx (welp top /hoon/hoon)) + =/ arv .^(@t %cx (welp top /arvo/hoon)) + ~! *task:able:dill + :- [%pass /reset %arvo %d %flog %lyra `hun arv] %+ turn (module-ova:pill top) |=([=wire =flog:dill] [%pass wire %arvo %d %flog flog]) diff --git a/pkg/arvo/lib/pill.hoon b/pkg/arvo/lib/pill.hoon index ee77daaed..8595a85f2 100644 --- a/pkg/arvo/lib/pill.hoon +++ b/pkg/arvo/lib/pill.hoon @@ -2,12 +2,12 @@ :: ^? |% -:: +module-ova: vane load operations. -:: -:: sys: full path to /sys directory :: +$ pill - [boot-ova=* kernel-ova=(list unix-event) userspace-ova=(list unix-event)] + $: boot-ova=* + kernel-ova=(list unix-event) + userspace-ova=(list unix-event) + == :: +$ unix-event %+ pair wire @@ -16,42 +16,25 @@ [%boot ? $%($>(%fake task:able:jael) $>(%dawn task:able:jael))] unix-task == +:: +module-ova: vane load operations +:: +:: sys: full path to /sys directory :: ++ module-ova |= sys=path ^- (list [wire [%veer term path cord]]) %+ turn ^- (list (pair term path)) - :~ :: sys/zuse: standard library - :: - [%$ /zuse] - :: sys/vane/ames: network - :: - [%a /vane/ames] - :: sys/vane/behn: timer - :: - [%b /vane/behn] - :: sys/vane/clay: revision control - :: - [%c /vane/clay] - :: sys/vane/dill: console - :: - [%d /vane/dill] - :: sys/vane/eyre: http server - :: - [%e /vane/eyre] - :: sys/vane/ford: build - :: - [%f /vane/ford] - :: sys/vane/gall: applications - :: - [%g /vane/gall] - :: sys/vane/iris: http client - :: - [%i /vane/iris] - :: sys/vane/kale: security - :: - [%j /vane/jael] + :~ [%$ /zuse] :: standard library + [%a /vane/ames] :: network + [%b /vane/behn] :: timer + [%c /vane/clay] :: revision control + [%d /vane/dill] :: console + [%e /vane/eyre] :: http server + [%f /vane/ford] :: build + [%g /vane/gall] :: applications + [%i /vane/iris] :: http client + [%j /vane/jael] :: identity and security == |= [=term =path] =/ pax (weld sys path) @@ -59,25 +42,22 @@ [[%vane path] [%veer term pax txt]] :: +file-ovum: userspace filesystem load :: -:: bas: full path to / directory +:: bas: full path to / directory :: ++ file-ovum - =/ directories - `(list path)`~[/app /ted /gen /lib /mar /ren /sec /sur /sys /tests /web] + =/ directories=(list path) + :~ /app :: %gall applications + /gen :: :dojo generators + /lib :: libraries + /mar :: mark definitions + /sur :: structures + /sys :: system files + /ted :: :spider strands + /tests :: unit tests + /web :: %eyre web content + == |= bas=path ^- unix-event - :: - :: /app %gall applications - :: /gen :dojo generators - :: /lib %ford libraries - :: /mar %ford marks - :: /ren %ford renderers - :: /sec %eyre security drivers - :: /sur %ford structures - :: /sys system files - :: /tests unit tests - :: /web %eyre web content - :: %. directories |= :: sal: all spurs to load from :: diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index d5fbab248..1ff75b5a4 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -893,7 +893,8 @@ pax=path txt=@ta == - ~| [%failed-vint lal] + =; res ?-(-.res %& p.res, %| (mean leaf+"vint: {}" p.res)) + %- mule |. =+ gen=(rain pax txt) ~> %slog.[0 leaf+"vane: parsed {(scow p+(mug gen))}"] =+ pro=(vent who lal vil bud [(slym (slap bud gen) bud) *worm]) @@ -1186,7 +1187,7 @@ ^- [(list ovum) *] ~| feck+-.q.ovo ?: ?=(%lyra -.q.ovo) - (vega now nub ;;([@ @] +.q.ovo)) + (vega now nub ;;([(unit @) @] +.q.ovo)) ?+ -.q.ovo ~|(bad-fec+-.q.ovo !!) :: produce memory usage report :: @@ -1215,46 +1216,65 @@ ++ vega |= $: :: now: current date :: nub: vane continuation state - :: hun: hoon.hoon source + :: hun: hoon.hoon source, or ~ if unchanged :: arv: arvo.hoon source :: now=@da nub=debt:le:part - hun=@t + hun=(unit @t) van=@t == :: produce a new kernel and an effect list :: ^- [(list ovum) *] - :: compile the hoon.hoon source with the current compiler + :: go metacircular as hint to vere to run in new memory arena :: - =/ raw - ~> %slog.[0 leaf+"vega: compiling hoon"] - (ride %noun hun) - :: activate the new compiler gate, producing +ride + =; res ?-(-.res %& p.res, %| (mean leaf+"vega: ruin" p.res)) + %- mule |. + :: obtain hoon compiler data :: - =/ cop .*(0 +.raw) - :: find the hoon version number of the new kernel + :: Arvo is compiled against the hoon.hoon vase with its outer +ride + :: gate stripped off, leaving the main core. :: - =/ nex - (@ .*(cop q:(~(mint ut p.raw) %noun [%limb %hoon-version]))) - ?> |(=(nex hoon-version) =(+(nex) hoon-version)) - :: if we're upgrading language versions, recompile the compiler + :: hyp: hoon core type + :: hoc: hoon core + :: cop: compiler gate + :: lod: can we use the +load arm? (language-compatible upgrade) :: - :: hot: raw compiler formula - :: - => ?: =(nex hoon-version) - [hot=`*`raw .] - ~> %slog.[0 leaf+"vega: recompiling hoon {}k"] - ~& [%hoon-compile-upgrade nex] - =/ hot (slum cop [%noun hun]) - .(cop .*(0 +.hot)) - :: extract the hoon core from the outer gate (+ride) - :: - =/ hoc .*(cop [%0 7]) - :: compute the type of the hoon.hoon core - :: - =/ hyp -:(slum cop [-.hot '+>']) + =/ [hyp=* hoc=* cop=* lod=?] + :: if no new hoon.hoon source, use current compiler + :: + ?~ hun + [-:!>(+>:ride) +>:ride ride &] + :: compile new hoon.hoon source with the current compiler + :: + =/ raw + ~> %slog.[0 leaf+"vega: compiling hoon"] + (ride %noun u.hun) + :: activate the new compiler gate, producing +ride + :: + =/ cop .*(0 +.raw) + :: find the hoon version number of the new kernel + :: + =/ nex + (@ .*(cop q:(~(mint ut p.raw) %noun [%limb %hoon-version]))) + ?> |(=(nex hoon-version) =(+(nex) hoon-version)) + :: if we're upgrading language versions, recompile the compiler + :: + => ?: =(nex hoon-version) + [hot=`*`raw .] + ~> %slog.[0 leaf+"vega: recompiling hoon {}k"] + ~& [%hoon-compile-upgrade nex] + =/ hot (slum cop [%noun hun]) + .(cop .*(0 +.hot)) + :: extract the hoon core from the outer gate (+ride) + :: + =/ hoc .*(cop [%0 7]) + :: compute the type of the hoon.hoon core + :: + =/ hyp -:(slum cop [-.hot '+>']) + :: + [hyp hoc cop =(nex hoon-version)] :: compile arvo :: =/ rav @@ -1267,7 +1287,7 @@ :: entry gate: ++load for the normal case, ++come for upgrade :: =/ gat - =/ arm ?:(=(nex hoon-version) 'load' 'come') + =/ arm ?:(lod 'load' 'come') ~> %slog.[0 leaf+"vega: +{(trip arm)}"] :: compute the type of the arvo.hoon core :: @@ -1305,7 +1325,8 @@ |= [who=ship now=@da fav=curd] ^+ soul => .(fav ;;([%veer lal=@tas pax=path txt=@t] fav)) - ~| veer+[lal pax]:fav + =; res ?-(-.res %& p.res, %| (mean leaf+"veer: {}" p.res)) + %- mule |. ?: =(%$ lal.fav) ~> %slog.[0 leaf+"zuse: {(scow p+(mug txt.fav))}"] =+ gen=(rain pax.fav txt.fav) @@ -1323,7 +1344,7 @@ ~> %slog.[0 leaf+"vane: {} {(scow p+(mug txt.fav))}"] :_ t.vanes :- label.i.vanes - ~| [%failed-vane-activation now lal.fav] + ~| [%failed-vane-activation lal.fav] =< vane %. [pax txt]:fav ruck:(vent who lal.fav vil bud [vase.vane.i.vanes *worm]) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 730e33e48..ec14e28bb 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3558,11 +3558,11 @@ :: =. fod.dom (promote-ford fod.dom deletes ~(key by changes)) - =/ =args:ford:fusion - [ank.dom deletes changes lat.ran fod.dom] :: =/ sys-changes (need-sys-update changes) ?: &(!updated !=(~ sys-changes)) + =/ =args:ford:fusion + [ank.dom deletes changes lat.ran fod.dom] (sys-update args yoki changes) =. ..park (emil (print deletes ~(key by changes))) :: clear caches if zuse reloaded @@ -3572,6 +3572,8 @@ =? ank.dom is-zuse-new *ankh =? changes is-zuse-new (changes-for-upgrade old-lobes deletes changes) + =/ =args:ford:fusion + [ank.dom deletes changes lat.ran fod.dom] :: =^ change-cages ford-cache.args (checkout-changes args changes) @@ -3949,12 +3951,14 @@ test-ankh (~(got by dir.test-ankh) ta) == :: - :: Find /sys changes + :: Find /sys changes; does not reload on first commit :: ++ need-sys-update |= changes=(map path (each page lobe)) ^- (map path (each page lobe)) ~+ + ?: =(0 let.dom) + ~ %- malt %+ skim ~(tap by changes) |= [=path *] @@ -3989,25 +3993,37 @@ ?> =(~ pud) =. pud `[syd yoki] |^ ?: (~(has by updates) /sys/hoon/hoon) - reset + (reset &) ?: (~(has by updates) /sys/arvo/hoon) - reset + (reset |) ?: (~(has by updates) /sys/zuse/hoon) reboot reload-all :: ++ reset - =^ hoon=cage ford-cache.ford-args - %- wrap:fusion - (get-value:(ford:fusion ford-args) /sys/hoon/hoon) - =^ arvo=cage ford-cache.ford-args - %- wrap:fusion - (get-value:(ford:fusion ford-args) /sys/arvo/hoon) - =. ..park - %- emit - [hen %pass /reset %d %flog %lyra !<(@t q.hoon) !<(@t q.arvo)] + |= new-hoon=? + ^+ ..park + ?. new-hoon + =^ arvo=@t ford-cache.ford-args (load-sys %arvo) + =. ..park (pass-lyra hoon=~ arvo) + reboot + =^ hoon=@t ford-cache.ford-args (load-sys %hoon) + =^ arvo=@t ford-cache.ford-args (load-sys %arvo) + =. ..park (pass-lyra `hoon arvo) reboot :: + ++ load-sys + |= fil=@tas + ^- [@t ford-cache] + =- [!<(@t q.-<) ->] + %- wrap:fusion + (get-value:(ford:fusion ford-args) /sys/[fil]/hoon) + :: + ++ pass-lyra + |= [hoon=(unit @t) arvo=@t] + ^+ ..park + (emit hen %pass /reset %d %flog %lyra hoon arvo) + :: ++ reboot =^ zuse=cage ford-cache.ford-args %- wrap:fusion diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 6ce5ef6a3..fe536ed17 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -173,6 +173,9 @@ |= [dap=term bek=beak =cage] ^+ mo-core :: + =/ existing (~(get by yokes.state) dap) + =/ re ?~(existing "" "re") + ~> %slog.[0 leaf+"gall: {re}loading {}"] ?. =(%vase p.cage) (mo-give %onto |+[leaf+"gall: bad mark {} for agent {}"]~) :: @@ -182,7 +185,7 @@ (mo-give %onto %.n err) =/ =agent p.maybe-new-agent :: - ?^ existing=(~(get by yokes.state) dap) + ?^ existing =. yokes.state (~(put by yokes.state) dap u.existing(beak bek)) =/ =routes [disclosing=~ attributing=our] @@ -354,7 +357,7 @@ =. mo-core (mo-receive-core dap beak r.u.p.sign-arvo) (mo-subscribe-to-agent-builds tim) (mo-give %onto |+[leaf+"gall: failed to build agent {}"]~) - :: + :: +mo-handle-sys-lyv: handle notice that agents have been rebuilt :: ++ mo-handle-sys-lyv |= [=path =sign-arvo] @@ -363,6 +366,8 @@ ?> ?=([?(%b %c) %wris *] sign-arvo) =/ bek=beak [our %home p.sign-arvo] =/ nex=(list [=care:clay =^path]) ~(tap in q.sign-arvo) + ~> %slog.[0 leaf+"gall: reloading agents"] + ~< %slog.[0 leaf+"gall: reloaded agents"] =; cor (mo-subscribe-to-agent-builds:cor p.p.sign-arvo) %+ roll nex |= [[=care:clay =^path] cor=_mo-core] diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 23858b081..27d43ca45 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1,6 +1,6 @@ -:: :: /van/zuse -:: :: %reference/1 -:: %zuse: arvo library. +:: /sys/zuse +:: %reference/1 +:: %zuse: arvo library :: :: %zuse is two nested cores: the first for models :: (data structures), the second for engines (functions @@ -784,7 +784,7 @@ {$burl p/@t} :: activate url {$init p/@p} :: set owner {$logo ~} :: logout - {$lyra p/@t q/@t} :: upgrade kernel + [%lyra hoon=(unit @t) arvo=@t] :: upgrade kernel {$pack ~} :: compact memory {$veer p/@ta q/path r/@t} :: install vane {$verb ~} :: verbose mode @@ -803,7 +803,7 @@ {$hook ~} :: this term hung up {$harm ~} :: all terms hung up $>(%init vane-task) :: after gall ready - {$lyra p/@t q/@t} :: upgrade kernel + [%lyra hoon=(unit @t) arvo=@t] :: upgrade kernel {$noop ~} :: no operation {$pack ~} :: compact memory {$talk p/tank} :: @@ -869,7 +869,7 @@ ++ flog :: sent to %dill $% {$crud p/@tas q/(list tank)} :: {$heft ~} :: - {$lyra p/@t q/@t} :: upgrade kernel + [%lyra hoon=(unit @t) arvo=@t] :: upgrade kernel {$pack ~} :: compact memory {$text p/tape} :: {$veer p/@ta q/path r/@t} :: install vane From 9b434af44edfc1773a309f43bc46177866acf9b1 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 12 May 2020 18:26:11 -0700 Subject: [PATCH 120/280] clay: only reload vanes that changed --- pkg/arvo/sys/vane/clay.hoon | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index ec14e28bb..789600c30 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3992,13 +3992,23 @@ (checkout-changes ford-args updates) ?> =(~ pud) =. pud `[syd yoki] - |^ ?: (~(has by updates) /sys/hoon/hoon) + |^ %. [hen %slip %c %pork ~] + =< emit + ?: (~(has by updates) /sys/hoon/hoon) (reset &) ?: (~(has by updates) /sys/arvo/hoon) (reset |) ?: (~(has by updates) /sys/zuse/hoon) reboot - reload-all + =/ vanes=(list [=path *]) ~(tap by updates) + |- ^+ ..park + ?~ vanes + ..park + ?. ?=([%sys %vane * %hoon ~] path.i.vanes) + ~& [%strange-sys-update path.i.vanes] + $(vanes t.vanes) + =. ..park (reload i.t.t.path.i.vanes) + $(vanes t.vanes) :: ++ reset |= new-hoon=? @@ -4038,7 +4048,7 @@ ~[%ames %behn %clay %dill %eyre %ford %gall %iris %jael] |- ^+ ..park ?~ vanes - (emit hen %slip %c %pork ~) + ..park =. ..park (reload i.vanes) $(vanes t.vanes) :: From 2ce063f40996a190328be9565e34e0a9bb697328 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 13 May 2020 21:10:35 -0400 Subject: [PATCH 121/280] ford: delete, update /lib/pill --- bin/solid.pill | 4 +- pkg/arvo/lib/pill.hoon | 1 - pkg/arvo/sys/vane/ford.hoon | 6360 ----------------------------------- 3 files changed, 2 insertions(+), 6363 deletions(-) delete mode 100644 pkg/arvo/sys/vane/ford.hoon diff --git a/bin/solid.pill b/bin/solid.pill index f984ef1e5..4c9621393 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f56fc04103d6cad9096dd58c87997e692ab7082dc6ccbd62df3cc282f3141646 -size 13210644 +oid sha256:d3cc5752c31acbb4bb1dd9e4c915eb8d125a2a01f1bbc1c72e6e0ec2cf73975b +size 12444927 diff --git a/pkg/arvo/lib/pill.hoon b/pkg/arvo/lib/pill.hoon index 8595a85f2..06493edc8 100644 --- a/pkg/arvo/lib/pill.hoon +++ b/pkg/arvo/lib/pill.hoon @@ -31,7 +31,6 @@ [%c /vane/clay] :: revision control [%d /vane/dill] :: console [%e /vane/eyre] :: http server - [%f /vane/ford] :: build [%g /vane/gall] :: applications [%i /vane/iris] :: http client [%j /vane/jael] :: identity and security diff --git a/pkg/arvo/sys/vane/ford.hoon b/pkg/arvo/sys/vane/ford.hoon deleted file mode 100644 index f1c92925c..000000000 --- a/pkg/arvo/sys/vane/ford.hoon +++ /dev/null @@ -1,6360 +0,0 @@ -:: ford: build system vane -!: -:: Ford is a functional reactive build system. -:: -:: A Ford build is a function of the Urbit namespace and a date that -:: produces marked, typed data or an error. -:: -:: The function in the definition of a build is called a "schematic," -:: and it's represented by a Hoon data structure with twenty-five sub-types. -:: A schematic is a (possibly trivial) DAG of sub-builds to be performed. -:: The different schematic sub-types transform the results of their -:: sub-builds in different ways. -:: -:: We call the date in the definition of a build the "formal date" to -:: distinguish it from the time at which the build was performed. -:: -:: Each build is referentially transparent with respect to its formal date: -:: ask to run that function on the namespace and a particular formal date, -:: and Ford will always produce the same result. -:: -:: We can now say Ford is a functional build system, since each build is a -:: function. We have not yet explained how it's a functional reactive build -:: system. With Ford, you can subscribe to results of a build. Ford tracks -:: the result of a "live" build consisting of a static schematic and the -:: ever-changing current date. Whenever this live build's result changes, -:: Ford sends you the new result and the formal date of the build (the date -:: which would cause the same result if you asked Ford to build that -:: schematic again). This is a push-based FRP paradigm. -:: -:: The implementation is event-driven, like the rest of Urbit. While -:: performing a build, Ford registers each namespace access as a dependency -:: and also notes whether the dependency is "live," meaning the path within -:: the namespace updates with time. For example a live Clay dependency would -:: update the +case within the +beam over time. -:: -:: A request to perform a build without subscribing to its future changes is -:: called a "once build." -:: -:: After finishing a build, Ford subscribes to updates on the build's -:: dependencies. For now, this just means it subscribes to Clay for file -:: changes. Whenever any of the files in the subscription have new contents, -:: Clay will notify Ford, which will then rerun any live builds that depend -:: on any of the changed files and send its subscribers the new results. -:: -:: This matches the semantics of live builds defined above. If someone had -:: asked for a build of the schematic with a formal date d2 just before the -:: changed Clay files, Ford would respond with the result of the previous -:: build with formal date d1, which would still be an accurate -:: representation of the schematic's result at d2, since Ford knows none of -:: its dependencies changed between d1 and d2. -:: -:: Note that Ford can only calculate dependencies after running a build, -:: not before. This is because Ford can be thought of as an interpreter for -:: schematics, rather than a compiler, in the sense that it can't have a -:: dependency-gathering step followed by a build step. The dependencies of -:: some schematics must be calculated based on results, e.g. the %alts -:: schematic, which tries a sequence of sub-builds until one succeeds. If -:: the first sub-build succeeds, the build depends only on that first -:: sub-build, but if the first fails and the second succeeds, the build -:: depends on both. -:: -:: This dynamicity implies we don't know what we depend on until we depend -:: on it. Most build systems have this property, but this part of Ford's -:: job is easier than for most Unix-based build systems: Ford draws all -:: resources from an immutable namespace, and it can track every access of -:: that namespace. -:: -:: Ford might produce a build's result asynchronously, in a subsequent Arvo -:: event. This happens when accessing the namespace doesn't complete -:: synchronously, such as when grabbing a file from another ship. Ford -:: guarantees it will respond with build results in chronological order -:: using the formal date, not the order in which the builds completed. -:: -:: Ford does not guarantee it will notify a subscriber of a changed build -:: only once per change. In common usage it will not send duplicate -:: notifications, but it might if its cache was recently wiped. -:: -:: Ford uses dependency tracking, caching, and results of previous builds -:: to eliminate excess work. When rerunning a live build, Ford "promotes" -:: previous results to the new time if the build's dependencies hvaen't -:: changed since the previous build's formal date. Ford does this check -:: for each build in a tree of sub-builds under the "root build," which -:: is the build that was requested directly. -:: -:: In addition to the main %build +task sub-type, Ford also supports -:: four other commands: -:: -:: %kill: cancel a build -:: -:: A once build in progress will be canceled, including all of its -:: sub-builds that aren't part of any other builds. -:: -:: A live build's subscriptions will be canceled, its completed results -:: will be deleted, and its dependency tracking information will be -:: deleted. If a rebuild is in progress, it will be canceled. -:: -:: %keep: resize caches -:: -:: Ford maintains two caches: a :compiler-cache that stores -:: content-addressed compiler operations, such as parsing, compiling, -:: and type inference; and a :build-cache that stores previously -:: completed build trees along with their results and dependency tracking. -:: -:: The %keep command resets the maximum sizes of these caches, deleting -:: entries if necessary. -:: -:: %wipe: decimate storage -:: -:: The %wipe command removes build results from storage to free memory. -:: It deletes the specified percentage of build results, in LRU -:: (Least Recently Used) order. It also removes entries from the compiler -:: cache. It does not remove dependency tracking information. -:: -:: %wegh: report memory usage -:: -:: Like all vanes, Ford can also be asked to produce a human-readable -:: report of its memory usage. Nock cannot calculate its own memory use -:: directly, so instead we produce the nouns themselves, which the runtime -:: "weighs" based on its memory model. -:: -:: For details on Ford's implementation, consult Ford's vane interface core -:: near the bottom of the file. -:: -:: pit: a +vase of the hoon+zuse kernel, which is a deeply nested core -:: -|= pit=vase -:: -=, contain -=, ford -:: ford internal data structures -:: -=> =~ -|% -:: +move: arvo moves that ford can emit -:: -+= move - :: - $: :: duct: request identifier - :: - =duct - :: card: move contents; either a +note or a +gift:able - :: - card=(wind note gift:able) - == -:: +note: private request from ford to another vane -:: -+$ note - $~ [%c %warp *@p *riff:clay] - $% :: %c: to clay - :: - $: %c - :: %warp: internal (intra-ship) file request - :: - $>(%warp task:able:clay) - == == -:: +sign: private response from another vane to ford -:: -+$ sign - $~ [%c %writ *riot:clay] - $? :: %c: from clay - :: - :: XX also from behn due to %slip asynchronicity - :: - $: ?(%b %c) - $> $? :: %writ: internal (intra-ship) file response - :: - %writ - :: %wris: response to %mult; many changed files - :: - %wris - == - gift:able:clay - == == --- -|% -:: +axle: overall ford state, tagged by version -:: -+= axle - $% [%~2018.12.13 state=ford-state] - [%~2020.2.21 state=ford-state] - == -:: +ford-state: all state that ford maintains -:: -+= ford-state - $: :: builds: per-build state machine for all builds - :: - :: Ford holds onto all in-progress builds that were either directly - :: requested by a duct (root builds) or that are dependencies - :: (sub-builds) of a directly requested build. - :: - :: It also stores the last completed version of each live build tree - :: (root build and sub-builds), and any cached builds. - :: - builds=(map build build-status) - :: ducts: per-duct state machine for all incoming ducts (build requests) - :: - :: Ford tracks every duct that has requested a build until it has - :: finished dealing with that request. - :: - :: For live ducts, we store the duct while we repeatedly run new - :: versions of the live build it requested until it is explicitly - :: canceled by the requester. - :: - :: A once (non-live) duct, on the other hand, will be removed - :: as soon as the requested build has been completed. - :: - ducts=(map duct duct-status) - :: builds-by-schematic: all attempted builds, sorted by time - :: - :: For each schematic we've attempted to build at any time, - :: list the formal dates of all build attempts, sorted newest first. - :: - builds-by-schematic=(map schematic (list @da)) - :: pending-scrys: outgoing requests for static resources - :: - pending-scrys=(request-tracker scry-request) - :: pending-subscriptions: outgoing subscriptions on live resources - :: - pending-subscriptions=(request-tracker subscription) - :: build-cache: fifo queue of completed root builds - :: - $= build-cache - $: :: next-anchor-id: incrementing identifier for cache anchors - :: - next-anchor-id=@ud - :: queue: fifo queue of root builds identified by anchor id - :: - queue=(capped-queue build-cache-key) - == - :: compiler-cache: clock based cache of build results - :: - compiler-cache=(clock compiler-cache-key build-result) - == -:: +anchor: something which holds on to builds -:: -:: An anchor is a reference which keeps builds. This is either a %duct, in -:: which case the build is live because a duct is waiting for a response, or -:: a %cache, in which case the anchor is a cached build. -:: -:: When a duct would be removed from a build, the %duct anchor is replaced -:: with a %cache anchor. This %cache anchor refers to a FIFO queue of cached -:: builds. -:: -+= anchor - $% :: %duct: this is anchored on a duct - :: - [%duct =duct] - :: %cache: this is anchored to a cache entry - :: - [%cache id=@ud] - == -:: +build-status: current data for a build, including construction status -:: -:: +build-status stores the construction status of a build as a finite state -:: machine (:state). It stores links to dependent sub-builds in :subs, and -:: per-duct client builds in :clients. -:: -+= build-status - $: :: requesters: ducts for whom this build is the root build - :: - requesters=(set anchor) - :: clients: per duct information for this build - :: - clients=(jug anchor build) - :: subs: sub-builds of this build, for whom this build is a client - :: - subs=(map build build-relation) - :: state: a state machine for tracking the build's progress - :: - $= state - $% $: :: %untried: build has not been started yet - :: - %untried ~ - == - $: :: %blocked: build blocked on either sub-builds or resource - :: - :: If we're in this state and there are no blocks in :subs, - :: then we're blocked on a resource. - :: - %blocked ~ - == - $: :: %unblocked: we were blocked but now we aren't - :: - %unblocked ~ - == - $: :: %complete: build has finished running and has a result - :: - %complete - :: build-record: the product of the build, possibly tombstoned - :: - =build-record - == == == -:: +duct-status: information relating a build to a duct -:: -+= duct-status - $: :: live: whether this duct is being run live - :: - $= live - $% [%once in-progress=@da] - $: %live - :: - :: - in-progress=(unit @da) - :: the last subscription we made - :: - :: This can possibly have an empty set of resources, in which - :: we never sent a move. - :: - :: NOTE: This implies that a single live build can only depend - :: on live resources from a single disc. We don't have a - :: working plan for fixing this and will need to think very - :: hard about the future. - :: - last-sent=(unit [date=@da subscription=(unit subscription)]) - == == - :: root-schematic: the requested build for this duct - :: - root-schematic=schematic - == -:: +build-relation: how do two builds relate to each other? -:: -:: A +build-relation can be either :verified or not, and :blocked or not. -:: It is a symmetric relation between two builds, in the sense that both -:: the client and the sub will store the same relation, just pointing to -:: the other build. -:: -:: If it's not :verified, then the relation is a guess based on previous -:: builds. These guesses are used to ensure that we hold onto builds we -:: expect to be used in future builds. Each time we run +make on a build, -:: it might produce new :verified sub-builds, which may have been unverified -:: until then. Once a build completes, any unverified sub-builds must be -:: cleaned up, since it turned out they weren't used by the build after all. -:: -:: :blocked is used to note that a build can't be completed until that -:: sub-build has been completed. A relation can be :blocked but not :verified -:: if we're trying to promote a build, but we haven't run all its sub-builds -:: yet. In that case, we'll try to promote or run the sub-build in order to -:: determine whether we can promote the client. Until the sub-build has been -:: completed, the client is provisionally blocked on the sub-build. -:: -+= build-relation - $: :: verified: do we know this relation is real, or is it only a guess? - :: - verified=? - :: is this build blocked on this other build? - :: - blocked=? - == -:: +build-record: information associated with the result of a completed +build -:: -+= build-record - $% $: :: %tombstone: the build's result has been wiped - :: - %tombstone ~ - == - $: :: %value: we have the +build-result - :: - %value - :: last-accessed: last time we looked at the result - :: - :: This is used for LRU cache reclamation. - :: - last-accessed=@da - :: build-result: the stored value of the build's product - :: - =build-result - == == -:: +build: a referentially transparent request for a build -:: -:: Each unique +build will always produce the same +build-result -:: when run (if it completes). A live build consists of a sequence of -:: instances of +build with the same :schematic and increasing :date. -:: -+= build - $: :: date: the formal date of this build; unrelated to time of execution - :: - date=@da - :: schematic: the schematic that determines how to run this build - :: - =schematic - == -:: +request-tracker: generic tracker and multiplexer for pending requests -:: -++ request-tracker - |* request-type=mold - %+ map request-type - $: :: waiting: ducts blocked on this request - :: - waiting=(set duct) - :: originator: the duct that kicked off the request - :: - originator=duct - == -:: +subscription: a single subscription to changes on a set of resources -:: -+= subscription - $: :: date: date this was made - :: - date=@da - :: disc: ship and desk for all :resources - :: - =disc - :: resources: we will be notified if any of these resources change - :: - resources=(set resource) - == -:: +scry-request: parsed arguments to a scry operation -:: -+= scry-request - $: :: vane: the vane from which to make the request - :: - :: If we add other vanes in the future, this will become a fork type. - :: For now, though, Ford only knows how to make asynchronous scry - :: requests to Clay. - :: - vane=%c - :: care: type of request - :: - care=care:clay - :: beam: request path - :: - =beam - == -:: +compiler-cache-key: content addressable build definitions -:: -+= compiler-cache-key - $% [%call gate=vase sample=vase] - [%hood =beam txt=@t] - [%ride formula=hoon subject=vase] - [%slim subject-type=type formula=hoon] - [%slit gate=type sample=type] - == -:: +build-cache-key: key for the fifo cache of completed build trees -:: -+= build-cache-key - $: :: id: incrementing identifier for an +anchor - :: - id=@ud - :: root-build: the root build associated with this anchor - :: - root-build=build - == -:: +build-receipt: result of running +make -:: -:: A +build-receipt contains all information necessary to perform the -:: effects and state mutations indicated by a call to +make. If :build -:: succeeded, :result will be %build-result; otherwise, it will be %blocks. -:: -:: After +make runs on a batch of builds, the resulting +build-receipt's are -:: applied one at a time. -:: -+= build-receipt - $: :: build: the build we worked on - :: - =build - :: result: the outcome of this build - :: - $= result - $% :: %build-result: the build produced a result - :: - $: %build-result - =build-result - == - :: %blocks: the build blocked on the following builds or resource - :: - $: %blocks - :: builds: builds that :build blocked on - :: - builds=(list build) - == - == - :: sub-builds: subbuilds of :build - :: - :: While running +make on :build, we need to keep track of any - :: sub-builds that we try to access so we can keep track of - :: component linkages and cache access times. - :: - sub-builds=(list build) - :: cache-access: if not ~, cache this result as :compiler-cache-key. - :: - cache-access=(unit [=compiler-cache-key new=?]) - == --- -=, format -|% -:: +tear: split a +term into segments delimited by `-` -:: -:: Example: -:: ``` -:: dojo> (tear 'foo-bar-baz') -:: ['foo' 'bar' 'baz'] -:: ``` -:: -++ tear - |= a=term - ^- (list term) - :: sym-no-heps: a parser for terms with no heps and a leading letter - :: - =/ sym-no-heps (cook crip ;~(plug low (star ;~(pose low nud)))) - :: - (fall (rush a (most hep sym-no-heps)) /[a]) -:: +segments: compute all paths from :path-part, replacing some `/`s with `-`s -:: -:: For example, when passed a :path-part of 'foo-bar-baz', -:: the product will contain: -:: ``` -:: dojo> (segments 'foo-bar-baz') -:: [/foo/bar/baz /foo/bar-baz /foo-bar/baz /foo-bar-baz] -:: ``` -:: -++ segments - |= path-part=@tas - ^- (list path) - :: - =/ join |=([a=@tas b=@tas] (crip "{(trip a)}-{(trip b)}")) - :: - =/ torn=(list @tas) (tear path-part) - :: - |- ^- (list (list @tas)) - :: - ?< ?=(~ torn) - :: - ?: ?=([@ ~] torn) - ~[torn] - :: - %- zing - %+ turn $(torn t.torn) - |= s=(list @tas) - ^- (list (list @tas)) - :: - ?> ?=(^ s) - ~[[i.torn s] [(join i.torn i.s) t.s]] -:: +build-to-tape: convert :build to a printable format -:: -:: Builds often contain the standard library and large types, so -:: this function should always be called when trying to print a +build. -:: -++ build-to-tape - |= =build - ^- tape - ~+ - :: - =/ enclose |=(tape "[{+<}]") - =/ date=@da date.build - =/ =schematic schematic.build - :: - %- enclose - %+ welp (trip (scot %da date)) - %+ welp " " - :: - ?+ -.schematic - :(welp "[" (trip -.schematic) " {<`@uvI`(mug schematic)>}]") - :: - %$ - "literal" - :: - ^ - %- enclose - ;:(welp $(build [date head.schematic]) " " $(build [date tail.schematic])) - :: - %alts - ;: welp - %+ roll choices.schematic - |= [choice=^schematic txt=_"[alts"] - :(welp txt " " ^$(schematic.build choice)) - :: - "]" - == - :: - %core - :(welp "[core " (spud (en-beam (rail-to-beam source-path.schematic))) "]") - :: - %hood - :(welp "[hood " (spud (en-beam (rail-to-beam source-path.schematic))) "]") - :: - %plan - ;: welp - "[plan " - (spud (en-beam (rail-to-beam path-to-render.schematic))) - "]" - == - :: - %scry - (spud (en-beam (extract-beam resource.schematic ~))) - :: - :: %slim - :: "slim {} {}" - :: - %vale - ;: welp - "[vale [" - (trip (scot %p ship.disc.schematic)) - " " - (trip desk.disc.schematic) - "] " - (trip mark.schematic) - "]" - == - == -:: +rail-to-beam: convert :rail to a +beam, filling in the case with `[%ud 0]` -:: -++ rail-to-beam - |= =rail - ^- beam - [[ship.disc.rail desk.disc.rail [%ud 0]] spur.rail] -:: +rail-to-path: pretty-printable rail -:: -++ rail-to-path - |= =rail - ^- path - (en-beam (rail-to-beam rail)) -:: +unify-jugs: make a new jug, unifying sets for all keys -:: -:: Example: -:: ``` -:: dojo> %+ unify-jugs -:: (~(gas by *(jug @tas @ud)) ~[[%a (sy 1 2 ~)] [%b (sy 4 5 ~)]]) -:: (~(gas by *(jug @tas @ud)) ~[[%b (sy 5 6 ~)] [%c (sy 7 8 ~)]]) -:: -:: {[p=%a q={1 2 3}] [p=%b q={4 5 6}] [p=%c q={7 8}]} -:: ``` -:: -++ unify-jugs - |* [a=(jug) b=(jug)] - ^+ a - :: - =/ tapped ~(tap by b) - :: - |- ^+ a - ?~ tapped a - :: - =/ key p.i.tapped - =/ vals ~(tap in q.i.tapped) - :: - =. a - |- ^+ a - ?~ vals a - :: - $(vals t.vals, a (~(put ju a) key i.vals)) - :: - $(tapped t.tapped) -:: +path-to-resource: decode a +resource from a +wire -:: -++ path-to-resource - |= =path - ^- (unit resource) - :: - =/ scry-request=(unit scry-request) (path-to-scry-request path) - ?~ scry-request - ~ - =+ [vane care bem]=u.scry-request - =/ =beam bem - =/ =rail [disc=[p.beam q.beam] spur=s.beam] - `[vane care rail] -:: +scry-request-to-path: encode a +scry-request in a +wire -:: -:: Example: -:: ``` -:: dojo> %- scry-request-to-path -:: [%c %x [[~zod %home [%da ~2018.1.1]] /hoon/bar]]) -:: -:: /cx/~zod/home/~2018.1.1/bar/hoon -:: ``` -:: -++ scry-request-to-path - |= =scry-request - ^- path - =/ =term (cat 3 [vane care]:scry-request) - [term (en-beam beam.scry-request)] -:: +path-to-scry-request: parse :path's components into :vane, :care, and :rail -:: -++ path-to-scry-request - |= =path - ^- (unit scry-request) - :: - ?~ path - ~ - ?~ vane=((soft ,%c) (end 3 1 i.path)) - ~ - ?~ care=((soft care:clay) (rsh 3 1 i.path)) - ~ - ?~ beam=(de-beam t.path) - ~ - ?. ?=(%da -.r.u.beam) - ~ - `[u.vane u.care u.beam] -:: +scry-request-to-build: convert a +scry-request to a %scry build -:: -++ scry-request-to-build - |= =scry-request - ^- build - :: we only operate on dates, not other kinds of +case:clay - :: - ?> ?=(%da -.r.beam.scry-request) - :: - =, scry-request - [p.r.beam [%scry [vane care `rail`[[p q] s]:beam]]] -:: +extract-beam: obtain a +beam from a +resource -:: -:: Fills case with [%ud 0] for live resources if :date is `~`. -:: For once resources, ignore :date. -:: -++ extract-beam - |= [=resource date=(unit @da)] ^- beam - :: - =/ =case ?~(date [%ud 0] [%da u.date]) - :: - =, rail.resource - [[ship.disc desk.disc case] spur] -:: +extract-disc: obtain a +disc from a +resource -:: -++ extract-disc - |= =resource ^- disc - disc.rail.resource -:: +get-sub-schematics: find any schematics contained within :schematic -:: -++ get-sub-schematics - |= =schematic - ^- (list ^schematic) - ?- -.schematic - ^ ~[head.schematic tail.schematic] - %$ ~ - %pin ~[schematic.schematic] - %alts choices.schematic - %bake ~ - %bunt ~ - %call ~[gate.schematic sample.schematic] - %cast ~[input.schematic] - %core ~ - %diff ~[start.schematic end.schematic] - %dude ~[attempt.schematic] - %hood ~ - %join ~[first.schematic second.schematic] - %list schematics.schematic - %mash ~[schematic.first.schematic schematic.second.schematic] - %mute [subject.schematic (turn mutations.schematic tail)] - %pact ~[start.schematic diff.schematic] - %path ~ - %plan ~ - %reef ~ - %ride ~[subject.schematic] - %same ~[schematic.schematic] - %scry ~ - %slim ~ - %slit ~ - %vale ~ - %volt ~ - %walk ~ - == -:: +by-schematic: door for manipulating :by-schematic.builds.ford-state -:: -:: The :dates list for each key in :builds is sorted in reverse -:: chronological order. These operations access and mutate keys and values -:: of :builds and maintain that sort order. -:: -++ by-schematic - |_ builds=(map schematic (list @da)) - :: +put: add a +build to :builds - :: - :: If :build already exists in :builds, this is a no-op. - :: Otherwise, replace the value at the key :schematic.build - :: with a new :dates list that contains :date.build. - :: - ++ put - |= =build - ^+ builds - %+ ~(put by builds) schematic.build - :: - =/ dates (~(gut by builds) schematic.build ~) - |- - ^+ dates - ?~ dates - [date.build ~] - ?: =(i.dates date.build) - dates - ?: (gth date.build i.dates) - [date.build dates] - [i.dates $(dates t.dates)] - :: +del: remove a +build from :builds - :: - :: Removes :build from :builds by replacing the value at - :: the key :schematic.build with a new :dates list with - :: :date.build omitted. If the resulting :dates list is - :: empty, then remove the key-value pair from :builds. - :: - ++ del - |= =build - ^+ builds - =. builds - %+ ~(jab by builds) schematic.build - |= dates=(list @da) - ~| build+build - =/ date-index (need (find [date.build]~ dates)) - (oust [date-index 1] dates) - :: if :builds has an empty entry for :build, delete it - :: - =? builds - =(~ (~(got by builds) schematic.build)) - (~(del by builds) schematic.build) - :: - builds - :: +find-previous: find the most recent older build with :schematic.build - :: - ++ find-previous - |= =build - ^- (unit ^build) - :: - =/ dates=(list @da) (~(gut by builds) schematic.build ~) - :: - |- ^- (unit ^build) - ?~ dates ~ - :: - ?: (lth i.dates date.build) - `[i.dates schematic.build] - $(dates t.dates) - :: +find-next: find the earliest build of :schematic.build later than :build - :: - ++ find-next - |= =build - ^- (unit ^build) - :: - =/ dates=(list @da) (flop (~(gut by builds) schematic.build ~)) - :: - |- ^- (unit ^build) - ?~ dates ~ - :: - ?: (gth i.dates date.build) - `[i.dates schematic.build] - $(dates t.dates) - -- -:: +get-request-ducts: all ducts waiting on this request -:: -++ get-request-ducts - |* [tracker=(request-tracker) request=*] - ^- (list duct) - :: - ?~ val=(~(get by tracker) request) - ~ - ~(tap in waiting.u.val) -:: +put-request: associates a +duct with a request -:: -++ put-request - |* [tracker=(request-tracker) request=* =duct] - :: - %+ ~(put by tracker) request - ?~ existing=(~(get by tracker) request) - [(sy duct ~) duct] - u.existing(waiting (~(put in waiting.u.existing) duct)) -:: +del-request: remove a duct and produce the originating duct if empty -:: -++ del-request - |* [tracker=(request-tracker) request=* =duct] - ^- [(unit ^duct) _tracker] - :: remove :duct from the existing :record of this :request - :: - =/ record (~(got by tracker) request) - =. waiting.record (~(del in waiting.record) duct) - :: if no more ducts wait on :request, delete it - :: - ?^ waiting.record - [~ (~(put by tracker) request record)] - [`originator.record (~(del by tracker) request)] -:: +parse-scaffold: produces a parser for a hoon file with +crane instances -:: -:: Ford parses a superset of hoon which contains additional runes to -:: represent +crane s. This parses to a +scaffold. -:: -:: src-beam: +beam of the source file we're parsing -:: -++ parse-scaffold - |= src-beam=beam - :: - =/ hoon-parser (vang & (en-beam src-beam)) - |^ :: - %+ cook - |= a=[@ud (list ^cable) (list ^cable) (list ^crane) (list hoon)] - ^- scaffold - [[[p q] s]:src-beam a] - :: - %+ ifix [gay gay] - ;~ plug - :: parses the zuse version, eg "/? 309" - :: - ;~ pose - (ifix [;~(plug net wut gap) gap] dem) - (easy zuse) - == - :: pareses the structures, eg "/- types" - :: - ;~ pose - (ifix [;~(plug net hep gap) gap] (most ;~(plug com gaw) cable)) - (easy ~) - == - :: parses the libraries, eg "/+ lib1, lib2" - :: - ;~ pose - (ifix [;~(plug net lus gap) gap] (most ;~(plug com gaw) cable)) - (easy ~) - == - :: - (star ;~(sfix crane gap)) - :: - (most gap tall:hoon-parser) - == - :: +beam: parses a hood path and converts it to a beam - :: - ++ beam - %+ sear de-beam - ;~ pfix - net - (sear plex (stag %clsg poor)):hoon-parser - == - :: +cable: parses a +^cable, a reference to something on the filesystem - :: - :: This parses: - :: - :: `library` -> wraps `library` around the library `library` - :: `face=library` -> wraps `face` around the library `library` - :: `*library` -> exposes `library` directly to the subject - :: - ++ cable - %+ cook |=(a=^cable a) - ;~ pose - (stag ~ ;~(pfix tar sym)) - (cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym)) - (cook |=(a=term [`a a]) sym) - == - :: +crane: all runes that start with / which aren't /?, /-, /+ or //. - :: - ++ crane - =< apex - :: whether we allow tall form - =| allow-tall-form=? - :: - |% - ++ apex - %+ knee *^crane |. ~+ - ;~ pfix net - ;~ pose - :: `/~` hoon literal - :: - (stag %fssg ;~(pfix sig hoon)) - :: `/$` process query string - :: - (stag %fsbc ;~(pfix bus hoon)) - :: `/|` first of many options that succeeds - :: - (stag %fsbr ;~(pfix bar parse-alts)) - :: `/=` wrap a face around a crane - :: - (stag %fsts ;~(pfix tis parse-face)) - :: `/.` null terminated list - :: - (stag %fsdt ;~(pfix dot parse-list)) - :: `/,` switch by path - :: - (stag %fscm ;~(pfix com parse-switch)) - :: `/&` pass through a series of mark - :: - (stag %fspm ;~(pfix pad parse-pipe)) - :: `/_` run a crane on each file in the current directory - :: - (stag %fscb ;~(pfix cab subcrane)) - :: `/;` passes date through a gate - :: - (stag %fssm ;~(pfix mic parse-gate)) - :: `/:` evaluate at path - :: - (stag %fscl ;~(pfix col parse-at-path)) - :: `/^` cast - :: - (stag %fskt ;~(pfix ket parse-cast)) - :: `/*` run a crane on each file with current path as prefix - :: - (stag %fstr ;~(pfix tar subcrane)) - :: `/!mark/ evaluate as hoon, then pass through mark - :: - (stag %fszp ;~(pfix zap ;~(sfix sym net))) - :: `/mark/` passes current path through :mark - :: - (stag %fszy ;~(sfix sym net)) - == - == - :: +parse-alts: parse a set of alternatives - :: - ++ parse-alts - %+ wide-or-tall - (ifix [lit rit] (most ace subcrane)) - ;~(sfix (star subcrane) gap duz) - :: +parse-face: parse a face around a subcrane - :: - ++ parse-face - %+ wide-or-tall - ;~(plug sym ;~(pfix tis subcrane)) - ;~(pfix gap ;~(plug sym subcrane)) - :: +parse-list: parse a null terminated list of cranes - :: - ++ parse-list - %+ wide-or-tall - fail - ;~(sfix (star subcrane) gap duz) - :: +parse-switch: parses a list of [path crane] - :: - ++ parse-switch - %+ wide-or-tall - fail - =- ;~(sfix (star -) gap duz) - ;~(pfix gap net ;~(plug static-path subcrane)) - :: +parse-pipe: parses a pipe of mark conversions - :: - ++ parse-pipe - %+ wide-or-tall - ;~(plug (plus ;~(sfix sym pad)) subcrane) - =+ (cook |=(a=term [a ~]) sym) - ;~(pfix gap ;~(plug - subcrane)) - :: +parse-gate: parses a gate applied to a crane - :: - ++ parse-gate - %+ wide-or-tall - ;~(plug ;~(sfix wide:hoon-parser mic) subcrane) - ;~(pfix gap ;~(plug tall:hoon-parser subcrane)) - :: +parse-at-path: parses a late bound bath - :: - ++ parse-at-path - %+ wide-or-tall - ;~(plug ;~(sfix late-bound-path col) subcrane) - ;~(pfix gap ;~(plug late-bound-path subcrane)) - :: +parse-cast: parses a mold and then the subcrane to apply that mold to - :: - ++ parse-cast - %+ wide-or-tall - ;~(plug ;~(sfix wyde:hoon-parser ket) subcrane) - ;~(pfix gap ;~(plug till:hoon-parser subcrane)) - :: +subcrane: parses a subcrane - :: - ++ subcrane - %+ wide-or-tall - apex(allow-tall-form |) - ;~(pfix gap apex) - :: +wide-or-tall: parses tall form hoon if :allow-tall-form is %.y - :: - ++ wide-or-tall - |* [wide=rule tall=rule] - ?. allow-tall-form wide - ;~(pose wide tall) - :: +hoon: parses hoon as an argument to a crane - :: - ++ hoon - %+ wide-or-tall - (ifix [lac rac] (stag %cltr (most ace wide:hoon-parser))) - ;~(pfix gap tall:hoon-parser) - -- - :: +static-path: parses a path - :: - ++ static-path - (sear plex (stag %clsg (more net hasp))):hoon-parser - :: +late-bound-path: a path whose time varies - :: - ++ late-bound-path - ;~ pfix net - %+ cook |=(a=truss a) - => hoon-parser - ;~ plug - (stag ~ gash) - ;~(pose (stag ~ ;~(pfix cen porc)) (easy ~)) - == - == - -- -:: +per-event: per-event core; main build engine -:: -:: This arm produces a gate that when called with state and event -:: information produces the core of Ford's main build engine. -:: -:: The main build engine core has the following entry points: -:: -:: +start-build start performing a build -:: +rebuild rerun a live build at a new date -:: +unblock continue a build that was waiting on a resource -:: +cancel stop trying to run a build and delete its tracking info -:: +wipe wipe the build storage to free memory -:: +keep resize caches, deleting entries if necessary -:: -:: The main internal arm is +execute-loop, which is called from +start-build, -:: +rebuild, and +unblock. +execute defines Ford's build loop. -:: -++ per-event - :: moves: the moves to be sent out at the end of this event, reversed - :: - =| moves=(list move) - :: scry-results: responses to scry's to handle in this event - :: - :: If a value is `~`, the requested resource is not available. - :: Otherwise, the value will contain a +cage. - :: - =| scry-results=(map scry-request (unit cage)) - :: next-builds: builds to perform in the next iteration - :: - =| next-builds=(set build) - :: candidate-builds: builds which might go into next-builds - :: - =| candidate-builds=(set build) - :: gate that produces the +per-event core from event information - :: - :: Produces a core containing Ford's main build engine. - :: - ~% %f ..is ~ - |= [[our=@p =duct now=@da scry=sley] state=ford-state] - :: - ~% %per-event + ~ - |% - :: +finalize: extract moves and state from the +per-event core - :: - :: Run once at the end of processing an event. - :: - ++ finalize - ^- [(list move) ford-state] - [(flop moves) state] - :: |entry-points: externally fired arms - :: - ::+| entry-points - :: - :: +start-build: perform a fresh +build, either live or once - :: - :: This might complete the build, or the build might block on one or more - :: requests for resources. Calls +execute-loop. - :: - ++ start-build - ~/ %start-build - |= [=build live=?] - ^- [(list move) ford-state] - :: - =< finalize - :: associate :duct with :build in :ducts.state - :: - =. ducts.state - %+ ~(put by ducts.state) duct - :_ schematic.build - ?: live - [%live in-progress=`date.build last-sent=~] - [%once in-progress=date.build] - :: register a state machine for :build in :builds.state - :: - =. state (add-build build) - :: :anchor: the reason we hold onto the root of this build tree - :: - =/ =anchor [%duct duct] - :: register :duct as an anchor in :requesters.build-status - :: - :: This establishes :build as the root build for :duct. - :: - =. builds.state - %+ ~(jab by builds.state) build - |= =build-status - build-status(requesters (~(put in requesters.build-status) anchor)) - :: copy :anchor into any preexisting descendants - :: - :: Sub-builds will reference :build in their :clients.build-status, - :: using `[%duct duct]` as the key. Some sub-builds might already - :: exist if we've already started running :build, so make sure they - :: know who their daddy is. - :: - =. builds.state (add-anchor-to-subs anchor build) - :: run +execute on :build in a loop until it completes or blocks - :: - (execute-loop (sy [build ~])) - :: +rebuild: rebuild a live build based on +resource updates - :: - :: For every changed resource, run the %scry build for that - :: for that resource. Then rebuild upward using the main +execute-loop - :: until all relevant builds either complete or block on external - :: resources. Use dependency tracking information from the previous - :: run of this live build to inform the dependency tracking for this - :: new rebuild. - :: - ++ rebuild - ~/ %rebuild - |= $: =subscription - new-date=@da - =disc - care-paths=(set [care=care:clay =path]) - == - ^- [(list move) ford-state] - :: - ~| [%rebuilding new-date disc] - :: - =< finalize - :: mark this subscription as complete now that we've heard a response - :: - =. pending-subscriptions.state - +:(del-request pending-subscriptions.state subscription duct) - :: for every changed resource, create a %scry build - :: - =/ builds=(list build) - %+ turn ~(tap in care-paths) - |= [care=care:clay =path] - ^- build - :: - [new-date [%scry [%c care rail=[disc spur=(flop path)]]]] - :: sanity check; only rebuild live builds, not once builds - :: - =/ duct-status (~(got by ducts.state) duct) - ?> ?=(%live -.live.duct-status) - :: sanity check; only rebuild once we've completed the previous one - :: - ?> ?=(~ in-progress.live.duct-status) - ?> ?=(^ last-sent.live.duct-status) - :: set the in-progress date for this new build - :: - =. ducts.state - %+ ~(put by ducts.state) duct - duct-status(in-progress.live `new-date) - :: copy the previous build's tree as provisional sub-builds - :: - :: This provides an upward rebuild path from leaves to root, - :: so that once the %scry builds complete, we'll know to rebuild - :: their clients. This process will continue up through rebuilding - :: the root build. - :: - :: If the build at this new date ends up with a different set of - :: dependencies from its previous incarnation, provisional sub-builds - :: that weren't actually used will be removed in - :: +cleanup-orphaned-provisional-builds. - :: - =/ old-root=build - [date.u.last-sent.live.duct-status root-schematic.duct-status] - :: - =. state - :: - ~| [%duct-doesnt-refer-to-real-build live.duct-status] - ~| [%missing-build (build-to-tape old-root)] - ~| [%dates (~(get by builds-by-schematic.state) root-schematic.duct-status)] - ?> (~(has by builds.state) old-root) - :: - (copy-build-tree-as-provisional old-root new-date=new-date) - :: gather all the :builds, forcing reruns - :: - :: The normal +gather logic would promote the previous results - :: for these %scry builds, since we have subscriptions on them. - :: We pass `force=%.y` to ensure the builds get enqueued instead - :: of promoted. - :: - =. ..execute (gather (sy builds) force=%.y) - :: rebuild resource builds at the new date - :: - :: This kicks off the main build loop, which will first build - :: :builds, then rebuild upward toward the root. If the whole - :: build tree completes synchronously, then this will produce - :: %made moves at the end of this event. Otherwise, it will - :: block on resources and complete during a later event. - :: - (execute-loop ~) - :: +unblock: continue builds that had blocked on :resource - :: - :: A build can be stymied temporarily if it depends on a resource - :: that must be fetched asynchronously. +unblock is called when - :: we receive a response to a resource request that blocked a build. - :: - :: We pick up the build from where we left off, starting with the - :: %scry build that blocked on this resource last time we tried it. - :: - ++ unblock - ~/ %unblock - |= [=scry-request scry-result=(unit cage)] - ^- [(list move) ford-state] - :: - =< finalize - :: place :scry-result in :scry-results.per-event - :: - :: We don't want to call the actual +scry function again, - :: because we already tried that in a previous event and it - :: had no synchronous answer. This +unblock call is a result - :: of the response to the asynchronous request we made to - :: retrieve that resource from another vane. - :: - :: Instead, we'll intercept any calls to +scry by looking up - :: the arguments in :scry-results.per-event. This is ok because - :: in this function we attempt to run every +build that had - :: blocked on the resource, so the information is guaranteed - :: to be used during this event before it goes out of scope. - :: - =. scry-results (~(put by scry-results) scry-request scry-result) - :: mark this +scry-request as complete now that we have a response - :: - =. pending-scrys.state - +:(del-request pending-scrys.state scry-request duct) - :: update :unblocked-build's state machine to reflect its new status - :: - =/ unblocked-build=build (scry-request-to-build scry-request) - =. builds.state - %+ ~(jab by builds.state) unblocked-build - |= =build-status - build-status(state [%unblocked ~]) - :: jump into the main build loop, starting with :unblocked-build - :: - (execute-loop (sy unblocked-build ~)) - :: +wipe: forcibly decimate build results from the state - :: - :: +wipe decimates both the :compiler-cache and the results in - :: :builds.state. It removes the specified percentage of build results - :: from the state. For simplicity, it considers the weight of each - :: compiler cache line to be equal to the weight of a build result. - :: - :: It deletes cache entries before dipping into :builds.state; it only - :: converts entries in :builds.state to %tombstone's if there aren't - :: enough entries in the compiler cache to sate the request's bloodlust. - :: - :: When deleting results from :builds.state, it first sorts them by - :: their :last-accessed date so that the stalest builds are deleted first. - :: We do not touch the :build-cache directly, but because the results - :: of the builds in :build-cache live in :builds.state, the results of - :: both FIFO-cached builds and active builds are all sorted and trimmed. - :: - ++ wipe - ~/ %wipe - |= percent-to-remove=@ud - ^+ state - :: removing 0% is the same as doing nothing, so do nothing - :: - ?: =(0 percent-to-remove) - ~& %wipe-no-op - state - :: - ~| [%wipe percent-to-remove=percent-to-remove] - ?> (lte percent-to-remove 100) - :: find all completed builds, sorted by :last-accessed date - :: - =/ completed-builds=(list build) - =- (turn - head) - %+ sort - :: filter for builds with a stored +build-result - :: - %+ skim ~(tap by builds.state) - |= [=build =build-status] - ^- ? - :: - ?=([%complete %value *] state.build-status) - :: sort by :last-accessed date - :: - |= [[* a=build-status] [* b=build-status]] - ^- ? - :: - ?> ?=([%complete %value *] state.a) - ?> ?=([%complete %value *] state.b) - :: - %+ lte - last-accessed.build-record.state.a - last-accessed.build-record.state.b - :: determine how many builds should remain after decimation - :: - :: This formula has the property that repeated applications - :: of +wipe with anything other than 100% retention rate will - :: always eventually remove every build. - :: - =/ num-completed-builds=@ud - (add (lent completed-builds) size.compiler-cache.state) - =/ percent-to-keep=@ud (sub 100 percent-to-remove) - =/ num-to-keep=@ud (div (mul percent-to-keep num-completed-builds) 100) - =/ num-to-remove=@ud (sub num-completed-builds num-to-keep) - :: - |^ ^+ state - :: - =+ cache-size=size.compiler-cache.state - ?: (lte num-to-remove cache-size) - (remove-from-cache num-to-remove) - =. compiler-cache.state - %~ purge - (by-clock compiler-cache-key build-result) - compiler-cache.state - (tombstone-builds (sub num-to-remove cache-size)) - :: - ++ remove-from-cache - |= count=@ud - %_ state - compiler-cache - %- %~ trim - (by-clock compiler-cache-key build-result) - compiler-cache.state - count - == - :: - ++ tombstone-builds - |= num-to-remove=@ud - :: - ~| [%wipe num-to-remove=num-to-remove] - :: the oldest :num-to-remove builds are considered stale - :: - =/ stale-builds (scag num-to-remove completed-builds) - :: iterate over :stale-builds, replacing with %tombstone's - :: - |- ^+ state - ?~ stale-builds state - :: replace the build's entry in :builds.state with a %tombstone - :: - =. builds.state - =< builds - %+ update-build-status i.stale-builds - |= =build-status - build-status(state [%complete %tombstone ~]) - :: - $(stale-builds t.stale-builds) - -- - :: +keep: resize caches - :: - :: Ford maintains two caches: a :build-cache for caching previously - :: completed build trees, and a :compiler-cache for caching various - :: compiler operations that tend to be shared among multiple builds. - :: - :: To handle this command, we reset the maximum sizes of both of - :: these caches, removing entries from the caches if necessary. - :: - ++ keep - ~/ %keep - |= [compiler-cache-size=@ud build-cache-size=@ud] - ^+ state - :: pop old builds out of :build-cache and remove their cache anchors - :: - =^ pops queue.build-cache.state - %. build-cache-size - ~(resize (to-capped-queue build-cache-key) queue.build-cache.state) - :: - =. state - |- ^+ state - ?~ pops state - :: - =. state (remove-anchor-from-root root-build.i.pops [%cache id.i.pops]) - :: - $(pops t.pops) - :: resize the :compiler-cache - :: - %_ state - compiler-cache - %- %~ resize - (by-clock compiler-cache-key build-result) - compiler-cache.state - compiler-cache-size - == - :: +cancel: cancel a build - :: - :: When called on a live build, removes all tracking related to the live - :: build, and no more %made moves will be sent for that build. - :: - :: When called on a once build, removes all tracking related to the once - :: build, and that build will never be completed or have a %made sent. - :: - :: When called on a build that isn't registered in :state, such as a - :: completed once build, or a build that has already been canceled, - :: prints and no-ops. - :: - ++ cancel ^+ [moves state] - :: - =< finalize - :: - ?~ duct-status=(~(get by ducts.state) duct) - ~& [%no-build-for-duct duct] - ..execute - :: :duct is being canceled, so remove it unconditionally - :: - =. ducts.state (~(del by ducts.state) duct) - :: if the duct was not live, cancel any in-progress builds - :: - ?: ?=(%once -.live.u.duct-status) - :: - =/ root-build=build [in-progress.live root-schematic]:u.duct-status - :: - =. ..execute (cancel-scrys root-build) - =. state (remove-anchor-from-root root-build [%duct duct]) - ..execute - :: if the duct was live and has an unfinished build, cancel it - :: - =? ..execute ?=(^ in-progress.live.u.duct-status) - :: - =/ root-build=build [u.in-progress.live root-schematic]:u.duct-status - :: - =. ..execute (cancel-scrys root-build) - =. state (remove-anchor-from-root root-build [%duct duct]) - ..execute - :: if there is no completed build for the live duct, we're done - :: - ?~ last-sent=last-sent.live.u.duct-status - ..execute - :: there is a completed build for the live duct, so delete it - :: - =/ root-build=build [date.u.last-sent root-schematic.u.duct-status] - :: - =. state (remove-anchor-from-root root-build [%duct duct]) - :: - ?~ subscription.u.last-sent - ..execute - (cancel-clay-subscription u.subscription.u.last-sent) - :: +cancel-scrys: cancel all blocked %scry sub-builds of :root-builds - :: - ++ cancel-scrys - |= root-build=build - ^+ ..execute - :: - =/ blocked-sub-scrys ~(tap in (collect-blocked-sub-scrys root-build)) - :: - |- ^+ ..execute - ?~ blocked-sub-scrys ..execute - :: - =. ..execute (cancel-scry-request i.blocked-sub-scrys) - :: - $(blocked-sub-scrys t.blocked-sub-scrys) - :: +move-root-to-cache: replace :duct with a %cache anchor in :build's tree - :: - ++ move-root-to-cache - ~/ %move-root-to-cache - |= =build - ^+ state - :: obtain the new cache id and increment the :next-anchor-id in the state - :: - =^ new-id next-anchor-id.build-cache.state - =/ id=@ud next-anchor-id.build-cache.state - [id +(id)] - :: replace the requester in the root build - :: - =. builds.state - %+ ~(jab by builds.state) build - |= =build-status - %_ build-status - requesters - =- (~(del in -) [%duct duct]) - =- (~(put in -) [%cache new-id]) - requesters.build-status - == - :: enqueue :build into cache, possibly popping and deleting a stale build - :: - =^ oldest queue.build-cache.state - %. [new-id build] - ~(put (to-capped-queue build-cache-key) queue.build-cache.state) - :: - =? state - ?=(^ oldest) - (remove-anchor-from-root root-build.u.oldest [%cache id.u.oldest]) - :: recursively replace :clients in :build and descendants - :: - |- ^+ state - :: - =/ client-status=build-status (got-build build) - =/ subs=(list ^build) ~(tap in ~(key by subs.client-status)) - :: - |- ^+ state - ?~ subs state - :: - =. builds.state - %+ ~(jab by builds.state) i.subs - |= =build-status - %_ build-status - clients - :: if we've already encountered :i.subs, don't overwrite - :: - ?: (~(has by clients.build-status) [%cache new-id]) - clients.build-status - :: - =/ old-clients-on-duct (~(get ju clients.build-status) [%duct duct]) - :: - =- (~(del by -) [%duct duct]) - =- (~(put by -) [%cache new-id] old-clients-on-duct) - clients.build-status - == - :: - =. state ^$(build i.subs) - :: - $(subs t.subs) - :: +remove-anchor-from-root: remove :anchor from :build's tree - :: - ++ remove-anchor-from-root - ~/ %remove-anchor-from-root - |= [=build =anchor] - ^+ state - :: - =. builds.state - %+ ~(jab by builds.state) build - |= =build-status - build-status(requesters (~(del in requesters.build-status) anchor)) - :: - =. builds.state (remove-anchor-from-subs build anchor) - :: - (cleanup build) - :: +remove-anchor-from-subs: recursively remove :anchor from sub-builds - :: - ++ remove-anchor-from-subs - ~/ %remove-anchor-from-subs - |= [=build =anchor] - ^+ builds.state - :: - =/ =build-status (got-build build) - =/ subs=(list ^build) ~(tap in ~(key by subs.build-status)) - =/ client=^build build - :: - |- ^+ builds.state - ?~ subs builds.state - :: - =/ sub-status=^build-status (got-build i.subs) - :: - =. clients.sub-status - (~(del ju clients.sub-status) anchor client) - :: - =. builds.state (~(put by builds.state) i.subs sub-status) - :: - =? builds.state !(~(has by clients.sub-status) anchor) - :: - ^$(build i.subs) - :: - $(subs t.subs) - :: +add-anchors-to-build-subs: for each sub, add all of :build's anchors - :: - ++ add-anchors-to-build-subs - ~/ %add-anchors-to-build-subs - |= =build - ^+ state - :: - =/ =build-status (got-build build) - =/ new-anchors - ~(tap in (~(put in ~(key by clients.build-status)) [%duct duct])) - =/ subs ~(tap in ~(key by subs.build-status)) - :: - =. state - |- - ^+ state - ?~ subs state - :: - =. state (add-build i.subs) - :: - $(subs t.subs) - :: - =. builds.state - |- ^+ builds.state - ?~ new-anchors builds.state - :: - =. builds.state (add-anchor-to-subs i.new-anchors build) - :: - $(new-anchors t.new-anchors) - :: - state - :: +add-anchor-to-subs: attach :duct to :build's descendants - :: - ++ add-anchor-to-subs - ~/ %add-anchor-to-subs - |= [=anchor =build] - ^+ builds.state - :: - =/ =build-status (got-build build) - =/ subs=(list ^build) ~(tap in ~(key by subs.build-status)) - =/ client=^build build - :: - |- ^+ builds.state - ?~ subs builds.state - :: - =/ sub-status=^build-status (got-build i.subs) - :: - =/ already-had-anchor=? (~(has by clients.sub-status) anchor) - :: - =. clients.sub-status - (~(put ju clients.sub-status) anchor client) - :: - =. builds.state (~(put by builds.state) i.subs sub-status) - :: - =? builds.state !already-had-anchor ^$(build i.subs) - :: - $(subs t.subs) - :: +copy-build-tree-as-provisional: prepopulate new live build - :: - :: Make a provisional copy of the completed old root build tree at the - :: :new time. - :: - ++ copy-build-tree-as-provisional - ~/ %copy-build-tree-as-provisional - |= [old-root=build new-date=@da] - ^+ state - ~| [old-root=(build-to-tape old-root) new-date=new-date] - :: - =/ old-client=build old-root - =/ new-client=build old-client(date new-date) - =. state (add-build new-client) - :: - =. builds.state - %+ ~(jab by builds.state) new-client - |= =build-status - build-status(requesters (~(put in requesters.build-status) [%duct duct])) - :: - =< copy-node - :: - |% - ++ copy-node - ^+ state - :: - =/ old-build-status=build-status (got-build old-client) - :: - =/ old-subs=(list build) ~(tap in ~(key by subs.old-build-status)) - =/ new-subs=(list build) (turn old-subs |=(a=build a(date new-date))) - :: - =. builds.state - (add-subs-to-client new-client new-subs [verified=%.n blocked=%.y]) - :: - |- - ^+ state - ?~ old-subs - state - :: - =. state (add-client-to-sub i.old-subs) - =. state - copy-node(old-client i.old-subs, new-client i.old-subs(date new-date)) - :: - $(old-subs t.old-subs) - :: - ++ add-client-to-sub - |= old-sub=build - ^+ state - :: - =/ new-sub old-sub(date new-date) - =. state (add-build new-sub) - :: - =. builds.state - %+ ~(jab by builds.state) new-sub - |= =build-status - %_ build-status - clients (~(put ju clients.build-status) [%duct duct] new-client) - == - :: - state - -- - :: +add-subs-to-client: register :new-subs as subs of :new-client - :: - ++ add-subs-to-client - ~/ %add-subs-to-client - |= [new-client=build new-subs=(list build) =build-relation] - ^+ builds.state - :: - %+ ~(jab by builds.state) new-client - |= =build-status - %_ build-status - subs - %- ~(gas by subs.build-status) - %+ murn new-subs - |= sub=build - ^- (unit (pair build ^build-relation)) - :: - ?^ (~(get by subs.build-status) sub) - ~ - `[sub build-relation] - == - :: |construction: arms for performing builds - :: - ::+| construction - :: - :: +execute-loop: +execute repeatedly until there's no more work to do - :: - :: Keep running +execute until all relevant builds either complete or - :: block on external resource requests. See +execute for details of each - :: loop execution. - :: - :: This implementation is for simplicity. In the longer term, we'd - :: like to just perform a single run through +execute and set a Behn timer - :: to wake us up immediately. This has the advantage that Ford stops hard - :: blocking the main Urbit event loop, letting other work be done. - :: - ++ execute-loop !. - ~/ %execute-loop - |= builds=(set build) - ^+ ..execute - :: - =. ..execute (execute builds) - :: - ?: ?& ?=(~ next-builds) - ?=(~ candidate-builds) - == - ..execute - :: - $(builds ~) - :: +execute: main recursive construction algorithm - :: - :: Performs the three step build process: First, figure out which builds - :: we're going to run this loop through the ford algorithm. Second, run - :: the gathered builds, possibly in parallel. Third, apply the - :: +build-receipt algorithms to the ford state. - :: - ++ execute - ~/ %execute - |= builds=(set build) - ^+ ..execute - :: - =. ..execute (gather builds force=%.n) - :: - =^ build-receipts ..execute run-builds - :: - (reduce build-receipts) - :: +gather: collect builds to be run in a batch - :: - :: The +gather phase is the first of the three parts of +execute. In - :: +gather, we look through each item in :candidate-builds. If we - :: should run the candidate build this cycle through the +execute loop, we - :: place it in :next-builds. +gather runs until it has no more candidates. - :: - ++ gather !. - ~/ %gather - |= [builds=(set build) force=?] - ^+ ..execute - :: add builds that were triggered by incoming event to the candidate list - :: - =. candidate-builds (~(uni in candidate-builds) builds) - :: - |^ ^+ ..execute - :: - ?: =(~ candidate-builds) - ..execute - :: - =/ next=build - ?< ?=(~ candidate-builds) - n.candidate-builds - =. candidate-builds (~(del in candidate-builds) next) - :: - $(..execute (gather-build next)) - :: +gather-build: looks at a single candidate build - :: - :: This gate inspects a single build. It might move it to :next-builds, - :: or promote it using an old build. It also might add this build's - :: sub-builds to :candidate-builds. - :: - ++ gather-build - |= =build - ^+ ..execute - ~| [%duct duct] - =/ duct-status (~(got by ducts.state) duct) - :: if we already have a result for this build, don't rerun the build - :: - =^ current-result builds.state (access-build-record build) - :: - ?: ?=([~ %value *] current-result) - (on-build-complete build) - :: place :build in :builds.state if it isn't already there - :: - =. state (add-build build) - :: ignore blocked builds - :: - =/ =build-status (got-build build) - ?: ?=(%blocked -.state.build-status) - =. state (add-anchors-to-build-subs build) - :: - =/ sub-scrys=(list scry-request) - ~(tap in (collect-blocked-sub-scrys build)) - :: - =. pending-scrys.state - |- ^+ pending-scrys.state - ?~ sub-scrys pending-scrys.state - :: - =. pending-scrys.state - (put-request pending-scrys.state i.sub-scrys duct) - :: - $(sub-scrys t.sub-scrys) - :: - ..execute - :: old-build: most recent previous build with :schematic.build - :: - =/ old-build=(unit ^build) - ?: ?& ?=(%live -.live.duct-status) - ?=(^ last-sent.live.duct-status) - == - :: check whether :build was run as part of the last live build tree - :: - :: If we had build this schematic as part of the build tree - :: during the last run of this live build, then we can compare - :: our result to that build. It might not be the most recent, - :: but if our sub-builds have the same results as they did then, - :: we can promote them. This is especially helpful for a %scry - :: build, because we don't have to make a new request for the - :: resource if the last live build subscribed to it. - :: - :: Otherwise, default to looking up the most recent build of this - :: schematic in :builds-by-schematic.state. We'll have to rerun - :: any %scry sub-builds, but other than that, we should still be - :: able to promote its result if its sub-builds have the same - :: results as ours. - :: - =/ possible-build=^build - [date.u.last-sent.live.duct-status schematic.build] - ?: (~(has by builds.state) possible-build) - `possible-build - (~(find-previous by-schematic builds-by-schematic.state) build) - (~(find-previous by-schematic builds-by-schematic.state) build) - :: if no previous builds exist, we need to run :build - :: - ?~ old-build - (add-build-to-next build) - :: - =/ old-build-status=^build-status (got-build u.old-build) - :: selectively promote scry builds - :: - :: We can only promote a scry if it's not forced and we ran the same - :: scry schematic as a descendant of the root build schematic at the - :: last sent time for this duct. - :: - ?: ?& ?=(%scry -.schematic.build) - ?| force - ?! - ?& ?=(%live -.live.duct-status) - ?=(^ last-sent.live.duct-status) - :: - =/ subscription=(unit subscription) - subscription.u.last-sent.live.duct-status - :: - ?~ subscription - %.n - %- ~(has in resources.u.subscription) - resource.schematic.build - == == == - (add-build-to-next build) - :: if we don't have :u.old-build's result cached, we need to run :build - :: - =^ old-build-record builds.state (access-build-record u.old-build) - ?. ?=([~ %value *] old-build-record) - (add-build-to-next build) - :: - =. old-build-status (got-build u.old-build) - :: - =/ old-subs=(list ^build) ~(tap in ~(key by subs.old-build-status)) - =/ new-subs=(list ^build) - (turn old-subs |=(^build +<(date date.build))) - :: link sub-builds provisionally, blocking on incomplete - :: - :: We don't know that :build will end up depending on :new-subs, - :: so they're not :verified. - :: - =/ split-new-subs - %+ skid new-subs - |= sub=^build - ^- ? - :: - ?~ maybe-build-status=(~(get by builds.state) sub) - %.n - :: - ?& ?=(%complete -.state.u.maybe-build-status) - ?=(%value -.build-record.state.u.maybe-build-status) - == - :: - =/ stored-new-subs=(list ^build) -.split-new-subs - =/ un-stored-new-subs=(list ^build) +.split-new-subs - :: - =. builds.state - (add-subs-to-client build stored-new-subs [verified=%.n blocked=%.n]) - =. builds.state - (add-subs-to-client build un-stored-new-subs [verified=%.n blocked=%.y]) - :: - =. state (add-anchors-to-build-subs build) - :: - ?^ un-stored-new-subs - :: enqueue incomplete sub-builds to be promoted or run - :: - :: When not all our sub builds have results, we can't add :build to - :: :next-builds.state. Instead, put all the remaining uncached new - :: subs into :candidate-builds. - :: - :: If all of our sub-builds finish immediately (i.e. promoted) when - :: they pass through +gather-internal, they will add :build back to - :: :candidate-builds and we will run again before +execute runs - :: +make. - :: - %_ ..execute - candidate-builds - (~(gas in candidate-builds) un-stored-new-subs) - == - :: - =^ promotable builds.state (are-subs-unchanged old-subs new-subs) - ?. promotable - (add-build-to-next build) - :: - ?> =(schematic.build schematic.u.old-build) - ?> (~(has by builds.state) build) - (promote-build u.old-build date.build new-subs) - :: +are-subs-unchanged: checks sub-build equivalence, updating access time - :: - ++ are-subs-unchanged - |= [old-subs=(list build) new-subs=(list build)] - ^- [? _builds.state] - :: - ?~ old-subs - [%.y builds.state] - ?> ?=(^ new-subs) - :: - =^ old-build-record builds.state (access-build-record i.old-subs) - ?. ?=([~ %value *] old-build-record) - [%.n builds.state] - :: - =^ new-build-record builds.state (access-build-record i.new-subs) - ?. ?=([~ %value *] new-build-record) - [%.n builds.state] - :: - ?. =(build-result.u.old-build-record build-result.u.new-build-record) - [%.n builds.state] - $(new-subs t.new-subs, old-subs t.old-subs) - :: +add-build-to-next: run this build during the +make phase - :: - ++ add-build-to-next - |= =build - ..execute(next-builds (~(put in next-builds) build)) - :: +promote-build: promote result of :build to newer :date - :: - :: Also performs relevant accounting, and possibly sends %made moves. - :: - ++ promote-build - |= [old-build=build new-date=@da new-subs=(list build)] - ^+ ..execute - :: grab the previous result, freshening the cache - :: - =^ old-build-record builds.state (access-build-record old-build) - :: we can only promote a cached result, not missing or a %tombstone - :: - ?> ?=([~ %value *] old-build-record) - =/ =build-result build-result.u.old-build-record - :: :new-build is :old-build at :date; promotion destination - :: - =/ new-build=build old-build(date new-date) - :: - =. builds.state - %+ ~(jab by builds.state) new-build - |= =build-status - ^+ build-status - :: - %_ build-status - :: verify linkages between :new-build and subs - :: - subs - :: - ^- (map build build-relation) - %- my - ^- (list (pair build build-relation)) - %+ turn new-subs - |= sub=build - :: - [sub [verified=& blocked=|]] - :: copy the old result to :new-build - :: - state - [%complete [%value last-accessed=now build-result=build-result]] - == - :: - (on-build-complete new-build) - -- - :: +run-builds: run the builds and produce +build-receipts - :: - :: Runs the builds and cleans up the build lists afterwards. - :: - :: When the vere interpreter has a parallel variant of +turn, use - :: that as each build might take a while and there are no data - :: dependencies between builds here. For now, though, run them serially. - :: - ++ run-builds - =< $ - ~% %run-builds + ~ - |. - ^- [(list build-receipt) _..execute] - :: - =/ build-receipts=(list build-receipt) - (turn ~(tap in next-builds) make) - :: - =. next-builds ~ - [build-receipts ..execute] - :: reduce: apply +build-receipts produce from the +make phase. - :: - :: +gather produces builds to run make on. +make produces - :: +build-receipts. It is in +reduce where we take these +build-receipts - :: and apply them to ..execute. - :: - ++ reduce !. - ~/ %reduce - |= build-receipts=(list build-receipt) - ^+ ..execute - :: sort :build-receipts so blocks are processed before completions - :: - :: It's possible for a build to block on a sub-build that was run - :: in the same batch. If that's the case, make sure we register - :: that the build blocked on the sub-build before registering the - :: completion of the sub-build. This way, when we do register the - :: completion of the sub-build, we will know which builds are blocked - :: on the sub-build, so we can enqueue those blocked clients to be - :: rerun. - :: - =. build-receipts - %+ sort build-receipts - |= [a=build-receipt b=build-receipt] - ^- ? - ?=(%blocks -.result.a) - :: - |^ ^+ ..execute - ?~ build-receipts ..execute - :: - =. ..execute (apply-build-receipt i.build-receipts) - $(build-receipts t.build-receipts) - :: +apply-build-receipt: applies a single state diff to ..execute - :: - ++ apply-build-receipt - |= made=build-receipt - ^+ ..execute - :: process :sub-builds.made - :: - =. state (track-sub-builds build.made sub-builds.made) - :: - ?- -.result.made - %build-result - (apply-build-result [build build-result.result cache-access]:made) - :: - %blocks - (apply-blocks [build builds.result]:made) - == - :: +track-sub-builds: - :: - :: For every sub-build discovered while running :build, we have to make - :: sure that we track that sub-build and that it is associated with the - :: right ducts. - :: - ++ track-sub-builds - |= [client=build sub-builds=(list build)] - ^+ state - :: mark :sub-builds as :subs in :build's +build-status - :: - =^ build-status builds.state - %+ update-build-status client - |= =build-status - %_ build-status - subs - %- ~(gas by subs.build-status) - %+ turn sub-builds - |= sub=build - :: - =/ blocked=? - ?~ sub-status=(~(get by builds.state) sub) - %.y - !?=([%complete %value *] state.u.sub-status) - :: - [sub [verified=& blocked]] - == - :: - =. state (add-anchors-to-build-subs client) - :: - |- ^+ state - ?~ sub-builds state - :: - =. builds.state - %+ ~(jab by builds.state) i.sub-builds - |= build-status=^build-status - %_ build-status - :: freshen :last-accessed date - :: - state - :: - ?. ?=([%complete %value *] state.build-status) - state.build-status - state.build-status(last-accessed.build-record now) - == - :: - $(sub-builds t.sub-builds) - :: +apply-build-result: apply a %build-result +build-receipt to ..execute - :: - :: Our build produced an actual result. - :: - ++ apply-build-result - |= [=build =build-result cache-access=(unit [=compiler-cache-key new=?])] - ^+ ..execute - :: - =? compiler-cache.state ?=(^ cache-access) - =+ by-clock=(by-clock compiler-cache-key ^build-result) - ?. new.u.cache-access - =^ ignored compiler-cache.state - (~(get by-clock compiler-cache.state) compiler-cache-key.u.cache-access) - compiler-cache.state - :: - %+ ~(put by-clock compiler-cache.state) - compiler-cache-key.u.cache-access - build-result - :: - =. builds.state - %+ ~(jab by builds.state) build - |= =build-status - build-status(state [%complete [%value last-accessed=now build-result]]) - :: - (on-build-complete build) - :: +apply-blocks: apply a %blocks +build-receipt to ..execute - :: - :: :build blocked. Record information about what builds it blocked on - :: and try those blocked builds as candidates in the next pass. - :: - ++ apply-blocks - |= [=build blocks=(list build)] - ^+ ..execute - :: if a %scry blocked, register it and maybe send an async request - :: - =? ..execute - ?=(~ blocks) - ?> ?=(%scry -.schematic.build) - =, resource.schematic.build - %- start-scry-request - [vane care [[ship.disc.rail desk.disc.rail [%da date.build]] spur.rail]] - :: we must run +apply-build-receipt on :build.made before :block - :: - ?< %+ lien blocks - |= block=^build - ?~ maybe-build-status=(~(get by builds.state) block) - %.n - ?=(%complete -.state.u.maybe-build-status) - :: transition :build's state machine to the %blocked state - :: - =. builds.state - %+ ~(jab by builds.state) build - |= =build-status - build-status(state [%blocked ~]) - :: enqueue :blocks to be run next - :: - =. candidate-builds (~(gas in candidate-builds) blocks) - :: - ..execute - -- - :: +make: attempt to perform :build, non-recursively - :: - :: Registers component linkages between :build and its sub-builds. - :: Attempts to perform +scry if necessary. Does not directly enqueue - :: any moves. - :: - ++ make - ~/ %make - |= =build - ^- build-receipt - :: out: receipt to return to caller - :: - =| out=build-receipt - :: ~& [%turbo-make (build-to-tape build)] - :: dispatch based on the kind of +schematic in :build - :: - |^ =, schematic.build - :: - =. build.out build - :: - ?- -.schematic.build - :: - ^ (make-autocons [head tail]) - :: - %$ (make-literal literal) - :: - %pin (make-pin date schematic) - %alts (make-alts choices ~) - %bake (make-bake renderer query-string path-to-render) - %bunt (make-bunt disc mark) - %call (make-call gate sample) - %cast (make-cast disc mark input) - %core (make-core source-path) - %diff (make-diff disc start end) - %dude (make-dude error attempt) - %hood (make-hood source-path) - %join (make-join disc mark first second) - %list (make-list schematics) - %mash (make-mash disc mark first second) - %mute (make-mute subject mutations) - %pact (make-pact disc start diff) - %path (make-path disc prefix raw-path) - %plan (make-plan path-to-render query-string scaffold) - %reef (make-reef disc) - %ride (make-ride formula subject) - %same (make-same schematic) - %scry (make-scry resource) - %slim (make-slim subject-type formula) - %slit (make-slit gate sample) - %vale (make-vale disc mark input) - %volt (make-volt disc mark input) - %walk (make-walk disc source target) - == - :: |schematic-handlers:make: implementation of the schematics - :: - :: All of these produce a value of the same type as +make itself. - :: - :: +| schematic-handlers - :: - ++ make-autocons - ~% %make-autocons ..^^$ ~ - |= [head=schematic tail=schematic] - ^- build-receipt - :: - =/ head-build=^build [date.build head] - =/ tail-build=^build [date.build tail] - =^ head-result out (depend-on head-build) - =^ tail-result out (depend-on tail-build) - :: - =| blocks=(list ^build) - =? blocks ?=(~ head-result) [head-build blocks] - =? blocks ?=(~ tail-result) [tail-build blocks] - :: if either build blocked, we're not done - :: - ?^ blocks - :: - (return-blocks blocks) - :: - ?< ?=(~ head-result) - ?< ?=(~ tail-result) - :: - (return-result %success u.head-result u.tail-result) - :: - ++ make-literal - ~% %make-literal ..^^$ ~ - |= =cage - ^- build-receipt - (return-result %success %$ cage) - :: - ++ make-pin - ~% %make-pin ..^^$ ~ - |= [date=@da =schematic] - ^- build-receipt - :: pinned-sub: sub-build with the %pin date as formal date - :: - =/ pinned-sub=^build [date schematic] - :: - =^ result out (depend-on pinned-sub) - :: - ?~ result - (return-blocks ~[pinned-sub]) - :: - (return-result u.result) - :: - ++ make-alts - ~% %make-alts ..^^$ ~ - |= [choices=(list schematic) errors=(list tank)] - ^- build-receipt - :: - ?~ choices - (return-error [[%leaf "%alts: all options failed"] errors]) - :: - =/ choice=^build [date.build i.choices] - :: - =^ result out (depend-on choice) - ?~ result - (return-blocks ~[choice]) - :: - ?: ?=([%error *] u.result) - :: - =/ braces [[' ' ' ' ~] ['{' ~] ['}' ~]] - =/ wrapped-error=tank - [%rose braces `(list tank)`message.u.result] - =. errors - (weld errors `(list tank)`[[%leaf "option"] wrapped-error ~]) - $(choices t.choices) - :: - (return-result %success %alts u.result) - :: - ++ make-bake - ~% %make-bake ..^^$ ~ - |= [renderer=term query-string=coin path-to-render=rail] - ^- build-receipt - :: path-build: find the file path for the renderer source - :: - =/ path-build=^build - [date.build [%path disc.path-to-render %ren renderer]] - :: - =^ path-result out (depend-on path-build) - ?~ path-result - (return-blocks [path-build]~) - :: - |^ ^- build-receipt - :: if there's a renderer called :renderer, use it on :path-to-render - :: - :: Otherwise, fall back to running the contents of :path-to-render - :: through a mark that has the same name as :renderer. - :: - ?: ?=([~ %success %path *] path-result) - (try-renderer-then-mark rail.u.path-result) - (try-mark ~) - :: +try-renderer-then-mark: try to render a path, then fall back to mark - :: - ++ try-renderer-then-mark - |= =rail - ^- build-receipt - :: build a +scaffold from the renderer source - :: - =/ hood-build=^build [date.build [%hood rail]] - :: - =^ hood-result out (depend-on hood-build) - ?~ hood-result - (return-blocks [hood-build]~) - :: if we can't find and parse the renderer, try the mark instead - :: - ?: ?=([~ %error *] hood-result) - (try-mark message.u.hood-result) - ?> ?=([~ %success %hood *] hood-result) - :: link the renderer, passing through :path-to-render and :query-string - :: - =/ plan-build=^build - :- date.build - [%plan path-to-render query-string scaffold.u.hood-result] - :: - =^ plan-result out (depend-on plan-build) - ?~ plan-result - (return-blocks [plan-build]~) - :: if compiling the renderer errors out, try the mark instead - :: - ?: ?=([~ %error *] plan-result) - (try-mark message.u.plan-result) - ?> ?=([~ %success %plan *] plan-result) - :: renderers return their name as the mark - :: - :: We should rethink whether we want this to be the case going - :: forward, but for now, Eyre depends on this detail to work. - :: - (return-result [%success %bake renderer vase.u.plan-result]) - :: +try-mark: try to cast a file's contents through a mark - :: - :: :errors contains any error messages from our previous attempt to - :: run a renderer, if we made one. This way if both the renderer and - :: mark fail, the requester will see the errors of both attempts. - :: - ++ try-mark - |= errors=(list tank) - ^- build-receipt - :: no renderer, try mark; retrieve directory listing of :path-to-render - :: - :: There might be multiple files of different marks stored at - :: :path-to-render. Retrieve the directory listing for - :: :path-to-render, then check which of the path segments in - :: that directory are files (not just folders), then for each - :: file try to %cast its mark to the desired mark (:renderer). - :: - :: Start by retrieving the directory listing, using :toplevel-build. - :: - =/ toplevel-build=^build - [date.build [%scry %c %y path-to-render]] - :: - =^ toplevel-result out (depend-on toplevel-build) - ?~ toplevel-result - (return-blocks [toplevel-build]~) - :: - ?: ?=([~ %error *] toplevel-result) - :: - =/ =path (rail-to-path path-to-render) - ?~ errors - %- return-error - :- [%leaf "ford: %bake {} on {} failed:"] - message.u.toplevel-result - :: - =/ braces [[' ' ' ' ~] ['{' ~] ['}' ~]] - %- return-error :~ - [%leaf "ford: %bake {} on {} failed:"] - [%leaf "as-renderer"] - [%rose braces errors] - [%leaf "as-mark"] - [%rose braces message.u.toplevel-result] - == - ?> ?=([~ %success %scry *] toplevel-result) - :: - =/ toplevel-arch=arch ;;(arch q.q.cage.u.toplevel-result) - :: find the :sub-path-segments that could be files - :: - :: Filter out path segments that aren't a +term, - :: since those aren't valid marks and therefore can't - :: be the last segment of a filepath in Clay. - :: - =/ sub-path-segments=(list @ta) - (skim (turn ~(tap by dir.toplevel-arch) head) (sane %tas)) - :: - =/ sub-schematics=(list [sub-path=@ta =schematic]) - %+ turn sub-path-segments - |= sub=@ta - :- sub - [%scry %c %y path-to-render(spur [sub spur.path-to-render])] - :: - =^ maybe-schematic-results out - %- perform-schematics :* - ;: weld - "ford: %bake " (trip renderer) " on " - (spud (rail-to-path path-to-render)) " contained failures:" - == - sub-schematics - %fail-on-errors - *@ta - == - ?~ maybe-schematic-results - out - :: marks: list of the marks of the files at :path-to-render - :: - =/ marks=(list @tas) - %+ murn u.maybe-schematic-results - |= [sub-path=@ta result=build-result] - ^- (unit @tas) - :: - ?> ?=([%success %scry *] result) - :: - =/ =arch ;;(arch q.q.cage.result) - :: if it's a directory, not a file, we can't load it - :: - ?~ fil.arch - ~ - [~ `@tas`sub-path] - :: sort marks in alphabetical order - :: - =. marks (sort marks lte) - :: try to convert files to the destination mark, in order - :: - =/ alts-build=^build - :: - :+ date.build %alts - ^= choices ^- (list schematic) - :: - %+ turn marks - |= mark=term - ^- schematic - :: - =/ file=rail path-to-render(spur [mark spur.path-to-render]) - :: - [%cast disc.file renderer [%scry %c %x file]] - :: - =^ alts-result out (depend-on alts-build) - ?~ alts-result - (return-blocks [alts-build]~) - :: - ?: ?=([~ %error *] alts-result) - =/ =path (rail-to-path path-to-render) - ?~ errors - %- return-error - :- [%leaf "ford: %bake {} on {} failed:"] - message.u.alts-result - :: - =/ braces [[' ' ' ' ~] ['{' ~] ['}' ~]] - %- return-error :~ - [%leaf "ford: %bake {} on {} failed:"] - [%leaf "as-renderer"] - [%rose braces errors] - [%leaf "as-mark"] - [%rose braces message.u.alts-result] - == - :: - ?> ?=([~ %success %alts *] alts-result) - :: - =/ =build-result - [%success %bake (result-to-cage u.alts-result)] - :: - (return-result build-result) - -- - :: - ++ make-bunt - ~% %make-bunt ..^^$ ~ - |= [=disc mark=term] - ^- build-receipt - :: resolve path of the mark definition file - :: - =/ path-build=^build [date.build [%path disc %mar mark]] - :: - =^ path-result out (depend-on path-build) - ?~ path-result - (return-blocks [path-build]~) - :: - ?: ?=([~ %error *] path-result) - %- return-error - :_ message.u.path-result - :- %leaf - "ford: %bunt resolving path for {} on {} failed:" - :: - ?> ?=([~ %success %path *] path-result) - :: build the mark core from source - :: - =/ core-build=^build [date.build [%core rail.u.path-result]] - :: - =^ core-result out (depend-on core-build) - ?~ core-result - (return-blocks [core-build]~) - :: - ?: ?=([~ %error *] core-result) - %- return-error - :_ message.u.core-result - :- %leaf - "ford: %bunt compiling mark {} on {} failed:" - :: - ?> ?=([~ %success %core *] core-result) - :: extract the sample from the mark core - :: - =/ mark-vase=vase vase.u.core-result - ~| %mark-vase - =+ [sample-type=p sample-value=q]:(slot 6 mark-vase) - :: if sample is wrapped in a face, unwrap it - :: - =? sample-type ?=(%face -.sample-type) q.sample-type - :: - =/ =cage [mark sample-type sample-value] - (return-result %success %bunt cage) - :: - ++ make-call - ~% %make-call ..^^$ ~ - |= [gate=schematic sample=schematic] - ^- build-receipt - :: - =/ gate-build=^build [date.build gate] - =^ gate-result out (depend-on gate-build) - :: - =/ sample-build=^build [date.build sample] - =^ sample-result out (depend-on sample-build) - :: - =| blocks=(list ^build) - =? blocks ?=(~ gate-result) [[date.build gate] blocks] - =? blocks ?=(~ sample-result) [[date.build sample] blocks] - ?^ blocks - (return-blocks blocks) - :: - ?< ?=(~ gate-result) - ?: ?=([~ %error *] gate-result) - %- return-error - :- [%leaf "ford: %call failed to build gate:"] - message.u.gate-result - :: - ?< ?=(~ sample-result) - ?: ?=([~ %error *] sample-result) - %- return-error - :- [%leaf "ford: %call failed to build sample:"] - message.u.sample-result - :: - =/ gate-vase=vase q:(result-to-cage u.gate-result) - =/ sample-vase=vase q:(result-to-cage u.sample-result) - :: run %slit to get the resulting type of calculating the gate - :: - =/ slit-schematic=schematic [%slit gate-vase sample-vase] - =/ slit-build=^build [date.build slit-schematic] - =^ slit-result out (depend-on slit-build) - ?~ slit-result - (return-blocks [date.build slit-schematic]~) - :: - ?: ?=([~ %error *] slit-result) - %- return-error - :- [%leaf "ford: %call failed type calculation"] - message.u.slit-result - :: - ?> ?=([~ %success %slit *] slit-result) - :: - =/ =compiler-cache-key [%call gate-vase sample-vase] - =^ cached-result out (access-cache compiler-cache-key) - ?^ cached-result - (return-result u.cached-result) - :: - ?> &(?=(^ q.gate-vase) ?=(^ +.q.gate-vase)) - =/ val - (mong [q.gate-vase q.sample-vase] intercepted-scry) - :: - ?- -.val - %0 - (return-result %success %call [type.u.slit-result p.val]) - :: - %1 - =/ blocked-paths=(list path) ;;((list path) p.val) - (blocked-paths-to-receipt %call blocked-paths) - :: - %2 - (return-error [[%leaf "ford: %call execution failed:"] p.val]) - == - :: - ++ make-cast - ~% %make-cast ..^^$ ~ - |= [=disc mark=term input=schematic] - ^- build-receipt - :: - =/ input-build=^build [date.build input] - :: - =^ input-result out (depend-on input-build) - ?~ input-result - (return-blocks [input-build]~) - :: - ?: ?=([~ %error *] input-result) - %- return-error - :_ message.u.input-result - :- %leaf - ;: weld - "ford: %cast " (trip mark) " on [" (trip (scot %p ship.disc)) - " " (trip desk.disc) "] failed on input:" - == - :: - ?> ?=([~ %success *] input-result) - :: - =/ result-cage=cage (result-to-cage u.input-result) - :: - =/ translation-path-build=^build - [date.build [%walk disc p.result-cage mark]] - =^ translation-path-result out - (depend-on translation-path-build) - :: - ?~ translation-path-result - (return-blocks [translation-path-build]~) - :: - ?: ?=([~ %error *] translation-path-result) - %- return-error - :_ message.u.translation-path-result - :- %leaf - ;: weld - "ford: %cast " (trip mark) " on [" (trip (scot %p ship.disc)) - " " (trip desk.disc) "] failed:" - == - :: - ?> ?=([~ %success %walk *] translation-path-result) - :: - =/ translation-path=(list mark-action) - results.u.translation-path-result - :: - |^ ^- build-receipt - ?~ translation-path - (return-result %success %cast result-cage) - :: - =^ action-result out - =, i.translation-path - ?- -.i.translation-path - %grow (run-grow source target result-cage) - %grab (run-grab source target result-cage) - == - :: - ?- -.action-result - %success - %_ $ - translation-path t.translation-path - result-cage cage.action-result - == - :: - %blocks - (return-blocks blocks.action-result) - :: - %error - (return-error [leaf+"ford: failed to %cast" tang.action-result]) - == - :: - += action-result - $% :: translation was successful and here's a cage for you - [%success =cage] - :: it was an error. sorry. - [%error =tang] - :: we block on a build - [%blocks blocks=(list ^build)] - == - :: - ++ run-grab - |= [source-mark=term target-mark=term input-cage=cage] - ^- [action-result _out] - :: - =/ mark-path-build=^build - [date.build [%path disc %mar target-mark]] - :: - =^ mark-path-result out - (depend-on mark-path-build) - ?~ mark-path-result - [[%blocks [mark-path-build]~] out] - :: - ?. ?=([~ %success %path *] mark-path-result) - %- cast-wrap-error :* - source-mark - target-mark - ;: weld - "ford: %cast failed to find path for mark " (trip source-mark) - " during +grab:" - == - mark-path-result - == - :: - =/ mark-core-build=^build [date.build [%core rail.u.mark-path-result]] - :: - =^ mark-core-result out (depend-on mark-core-build) - ?~ mark-core-result - [[%blocks ~[mark-core-build]] out] - :: find +grab within the destination mark core - :: - =/ grab-build=^build - :- date.build - [%ride [%limb %grab] [%$ (result-to-cage u.mark-core-result)]] - :: - =^ grab-result out (depend-on grab-build) - ?~ grab-result - [[%blocks [grab-build]~] out] - :: - ?. ?=([~ %success %ride *] grab-result) - =/ =path (rail-to-path rail.u.mark-path-result) - %- cast-wrap-error :* - source-mark - target-mark - :(weld "ford: %cast failed to ride " (spud path) " during +grab:") - grab-result - == - :: find an arm for the input's mark within the +grab core - :: - =/ grab-mark-build=^build - :- date.build - [%ride [%limb source-mark] [%$ %noun vase.u.grab-result]] - :: - =^ grab-mark-result out (depend-on grab-mark-build) - ?~ grab-mark-result - [[%blocks [grab-mark-build]~] out] - :: - ?. ?=([~ %success %ride *] grab-mark-result) - =/ =path (rail-to-path rail.u.mark-path-result) - %- cast-wrap-error :* - source-mark - target-mark - :(weld "ford: %cast failed to ride " (spud path) " during +grab:") - grab-mark-result - == - :: slam the +mark-name:grab gate on the result of running :input - :: - =/ call-build=^build - :- date.build - [%call gate=[%$ %noun vase.u.grab-mark-result] sample=[%$ input-cage]] - :: - =^ call-result out (depend-on call-build) - ?~ call-result - [[%blocks [call-build]~] out] - :: - ?. ?=([~ %success %call *] call-result) - =/ =path (rail-to-path rail.u.mark-path-result) - %- cast-wrap-error :* - source-mark - target-mark - :(weld "ford: %cast failed to call +grab arm in " (spud path) ":") - call-result - == - :: - [[%success [mark vase.u.call-result]] out] - :: +grow: grow from the input mark to the destination mark - :: - ++ run-grow - |= [source-mark=term target-mark=term input-cage=cage] - ^- [action-result _out] - :: - =/ starting-mark-path-build=^build - [date.build [%path disc %mar source-mark]] - :: - =^ starting-mark-path-result out - (depend-on starting-mark-path-build) - ?~ starting-mark-path-result - [[%blocks [starting-mark-path-build]~] out] - :: - ?. ?=([~ %success %path *] starting-mark-path-result) - %- cast-wrap-error :* - source-mark - target-mark - ;: weld - "ford: %cast failed to find path for mark " (trip source-mark) - " during +grow:" - == - starting-mark-path-result - == - :: grow the value from the initial mark to the final mark - :: - :: Replace the input mark's sample with the input's result, - :: then fire the mark-name:grow arm to produce a result. - :: - =/ grow-build=^build - :- date.build - :+ %ride - formula=`hoon`[%tsld [%wing ~[target-mark]] [%wing ~[%grow]]] - ^= subject - ^- schematic - :* %mute - ^- schematic - [%core rail.u.starting-mark-path-result] - ^= mutations - ^- (list [wing schematic]) - [[%& 6]~ [%$ input-cage]]~ - == - :: - =^ grow-result out (depend-on grow-build) - ?~ grow-result - [[%blocks [grow-build]~] out] - :: - ?. ?=([~ %success %ride *] grow-result) - =/ =path (rail-to-path rail.u.starting-mark-path-result) - %- cast-wrap-error :* - source-mark - target-mark - :(weld "ford: %cast failed to ride " (spud path) " during +grow:") - grow-result - == - :: make sure the product nests in the sample of the destination mark - :: - =/ bunt-build=^build [date.build [%bunt disc target-mark]] - :: - =^ bunt-result out (depend-on bunt-build) - ?~ bunt-result - [[%blocks [bunt-build]~] out] - :: - ?. ?=([~ %success %bunt *] bunt-result) - %- cast-wrap-error :* - source-mark - target-mark - :(weld "ford: %cast failed to bunt " (trip target-mark) ":") - bunt-result - == - :: - ?. (~(nest ut p.q.cage.u.bunt-result) | p.vase.u.grow-result) - =* src source-mark - =* dst target-mark - :_ out - :- %error - :_ ~ - :- %leaf - ;: weld - "ford: %cast from " (trip src) " to " (trip dst) - " failed: nest fail" - == - :: - [[%success mark vase.u.grow-result] out] - :: - ++ cast-wrap-error - |= $: source-mark=term - target-mark=term - description=tape - result=(unit build-result) - == - ^- [action-result _out] - :: - ?> ?=([~ %error *] result) - :: - :_ out - :- %error - :* :- %leaf - ;: weld - "ford: %cast failed while trying to cast from " - (trip source-mark) " to " (trip target-mark) ":" - == - [%leaf description] - message.u.result - == - -- - :: - ++ make-core - ~% %make-core ..^^$ ~ - |= source-path=rail - ^- build-receipt - :: convert file at :source-path to a +scaffold - :: - =/ hood-build=^build [date.build [%hood source-path]] - :: - =^ hood-result out (depend-on hood-build) - ?~ hood-result - (return-blocks [hood-build]~) - :: - ?: ?=(%error -.u.hood-result) - %- return-error - :- [%leaf "ford: %core on {<(rail-to-path source-path)>} failed:"] - message.u.hood-result - :: build the +scaffold into a program - :: - ?> ?=([%success %hood *] u.hood-result) - :: - =/ plan-build=^build - [date.build [%plan source-path `coin`[%many ~] scaffold.u.hood-result]] - :: - =^ plan-result out (depend-on plan-build) - ?~ plan-result - (return-blocks [plan-build]~) - :: - ?: ?=(%error -.u.plan-result) - %- return-error - :- [%leaf "ford: %core on {<(rail-to-path source-path)>} failed:"] - message.u.plan-result - :: - ?> ?=([%success %plan *] u.plan-result) - (return-result %success %core vase.u.plan-result) - :: - ++ make-diff - ~% %make-diff ..^^$ ~ - |= [=disc start=schematic end=schematic] - ^- build-receipt - :: run both input schematics as an autocons build - :: - =/ sub-build=^build [date.build [start end]] - :: - =^ sub-result out (depend-on sub-build) - ?~ sub-result - (return-blocks [sub-build]~) - :: - ?. ?=([~ %success ^ ^] sub-result) - (wrap-error sub-result) - ?. ?=([%success *] head.u.sub-result) - (wrap-error `head.u.sub-result) - ?. ?=([%success *] tail.u.sub-result) - (wrap-error `tail.u.sub-result) - :: - =/ start-cage=cage (result-to-cage head.u.sub-result) - =/ end-cage=cage (result-to-cage tail.u.sub-result) - :: if the marks aren't the same, we can't diff them - :: - ?. =(p.start-cage p.end-cage) - %- return-error :_ ~ :- %leaf - "ford: %diff failed: mark mismatch: %{} / %{}" - :: if the values are the same, the diff is null - :: - ?: =(q.q.start-cage q.q.end-cage) - =/ =build-result - [%success %diff [%null [%atom %n ~] ~]] - :: - (return-result build-result) - :: - =/ mark-path-build=^build [date.build [%path disc %mar p.start-cage]] - :: - =^ mark-path-result out (depend-on mark-path-build) - ?~ mark-path-result - (return-blocks [mark-path-build]~) - :: - ?: ?=([~ %error *] mark-path-result) - %- return-error - :- [%leaf "ford: %diff failed on {}:"] - message.u.mark-path-result - :: - ?> ?=([~ %success %path *] mark-path-result) - :: - =/ mark-build=^build [date.build [%core rail.u.mark-path-result]] - :: - =^ mark-result out (depend-on mark-build) - ?~ mark-result - (return-blocks [mark-build]~) - :: - ?: ?=([~ %error *] mark-result) - %- return-error - :- [%leaf "ford: %diff failed on {}:"] - message.u.mark-result - :: - ?> ?=([~ %success %core *] mark-result) - :: - ?. (slab %grad p.vase.u.mark-result) - %- return-error :_ ~ :- %leaf - "ford: %diff failed: %{} mark has no +grad arm" - :: - =/ grad-build=^build - [date.build [%ride [%limb %grad] [%$ %noun vase.u.mark-result]]] - :: - =^ grad-result out (depend-on grad-build) - ?~ grad-result - (return-blocks [grad-build]~) - :: - ?: ?=([~ %error *] grad-result) - %- return-error - :- [%leaf "ford: %diff failed on {}:"] - message.u.grad-result - :: - ?> ?=([~ %success %ride *] grad-result) - :: if +grad produced a @tas, convert to that mark and diff those - :: - ?@ q.vase.u.grad-result - =/ mark=(unit @tas) ((sand %tas) q.vase.u.grad-result) - ?~ mark - %- return-error :_ ~ :- %leaf - "ford: %diff failed: %{} mark has invalid +grad arm" - :: - =/ diff-build=^build - :- date.build - :^ %diff - disc - [%cast disc u.mark [%$ start-cage]] - [%cast disc u.mark [%$ end-cage]] - :: - =^ diff-result out (depend-on diff-build) - ?~ diff-result - (return-blocks [diff-build]~) - :: - ?. ?=([~ %success %diff *] diff-result) - (wrap-error diff-result) - :: - =/ =build-result - [%success %diff cage.u.diff-result] - :: - (return-result build-result) - :: +grad produced a cell, which should be a core with a +form arm - :: - ?. (slab %form p.vase.u.grad-result) - %- return-error :_ ~ :- %leaf - "ford: %diff failed: %{} mark has no +form:grab arm" - :: the +grab core should also contain a +diff arm - :: - ?. (slab %diff p.vase.u.grad-result) - %- return-error :_ ~ :- %leaf - "ford: %diff failed: %{} mark has no +diff:grab arm" - :: - =/ diff-build=^build - :- date.build - :+ %call - :: - ^= gate - :+ %ride - :: - formula=`hoon`[%tsld [%wing ~[%diff]] [%wing ~[%grad]]] - :: - ^= subject - :+ %mute - :: - subject=`schematic`[%$ %noun vase.u.mark-result] - :: - ^= mutations - ^- (list [wing schematic]) - [[%& 6]~ [%$ start-cage]]~ - :: - sample=`schematic`[%$ end-cage] - :: - =^ diff-result out (depend-on diff-build) - ?~ diff-result - (return-blocks [diff-build]~) - :: - ?. ?=([~ %success %call *] diff-result) - (wrap-error diff-result) - :: - =/ form-build=^build - [date.build [%ride [%limb %form] [%$ %noun vase.u.grad-result]]] - :: - =^ form-result out (depend-on form-build) - ?~ form-result - (return-blocks [form-build]~) - :: - ?. ?=([~ %success %ride *] form-result) - (wrap-error form-result) - :: - =/ mark=(unit @tas) ((soft @tas) q.vase.u.form-result) - ?~ mark - %- return-error :_ ~ :- %leaf - "ford: %diff failed: invalid +form result: {(text vase.u.form-result)}" - :: - =/ =build-result - [%success %diff [u.mark vase.u.diff-result]] - :: - (return-result build-result) - :: - ++ make-dude - ~% %make-dude ..^^$ ~ - |= [error=tank attempt=schematic] - ^- build-receipt - :: - =/ attempt-build=^build [date.build attempt] - =^ attempt-result out (depend-on attempt-build) - ?~ attempt-result - :: - (return-blocks ~[[date.build attempt]]) - :: - ?. ?=([%error *] u.attempt-result) - (return-result u.attempt-result) - :: - (return-error [error message.u.attempt-result]) - :: - ++ make-hood - ~% %make-hood ..^^$ ~ - |= source-rail=rail - ^- build-receipt - :: - =/ scry-build=^build [date.build [%scry [%c %x source-rail]]] - =^ scry-result out (depend-on scry-build) - ?~ scry-result - :: - (return-blocks ~[scry-build]) - :: - ?: ?=([~ %error *] scry-result) - =/ =path (rail-to-path source-rail) - %- return-error - :- [%leaf "ford: %hood failed for {}:"] - message.u.scry-result - =+ as-cage=(result-to-cage u.scry-result) - :: hoon files must be atoms to parse - :: - ?. ?=(@ q.q.as-cage) - =/ =path (rail-to-path source-rail) - %- return-error - :_ ~ - :- %leaf - "ford: %hood: path {} not an atom" - :: - =/ src-beam=beam [[ship.disc desk.disc [%ud 0]] spur]:source-rail - :: - =/ =compiler-cache-key [%hood src-beam q.q.as-cage] - =^ cached-result out (access-cache compiler-cache-key) - ?^ cached-result - (return-result u.cached-result) - :: - =/ parsed - ((full (parse-scaffold src-beam)) [1 1] (trip q.q.as-cage)) - :: - ?~ q.parsed - =/ =path (rail-to-path source-rail) - %- return-error - :- :- %leaf - %+ weld "ford: %hood: syntax error at " - "[{} {}] in {}" - ~ - :: - (return-result %success %hood p.u.q.parsed) - :: - ++ make-join - ~% %make-join ..^^$ ~ - |= [disc=disc mark=term first=schematic second=schematic] - ^- build-receipt - :: - =/ initial-build=^build - [date.build [first second] [%path disc %mar mark]] - :: - =^ initial-result out (depend-on initial-build) - ?~ initial-result - (return-blocks [initial-build]~) - :: - ?. ?=([~ %success [%success ^ ^] %success %path *] initial-result) - (wrap-error initial-result) - ?. ?=([%success *] head.head.u.initial-result) - (wrap-error `head.head.u.initial-result) - ?. ?=([%success *] tail.head.u.initial-result) - (wrap-error `tail.head.u.initial-result) - :: - =/ first-cage=cage (result-to-cage head.head.u.initial-result) - =/ second-cage=cage (result-to-cage tail.head.u.initial-result) - =/ mark-path=rail rail.tail.u.initial-result - :: TODO: duplicate logic with +make-pact and others - :: - =/ mark-build=^build [date.build [%core mark-path]] - :: - =^ mark-result out (depend-on mark-build) - ?~ mark-result - (return-blocks [mark-build]~) - :: - ?: ?=([~ %error *] mark-result) - %- return-error - :- [%leaf "ford: %join to {} on {} failed:"] - message.u.mark-result - :: - ?> ?=([~ %success %core *] mark-result) - :: - =/ mark-vase=vase vase.u.mark-result - :: - ?. (slab %grad p.mark-vase) - %- return-error :_ ~ :- %leaf - "ford: %join failed: %{} mark has no +grad arm" - :: - =/ grad-build=^build - [date.build [%ride [%limb %grad] [%$ %noun mark-vase]]] - :: - =^ grad-result out (depend-on grad-build) - ?~ grad-result - (return-blocks [grad-build]~) - :: - ?: ?=([~ %error *] grad-result) - %- return-error - :- [%leaf "ford: %join to {} on {} failed:"] - message.u.grad-result - :: - ?> ?=([~ %success %ride *] grad-result) - :: - =/ grad-vase=vase vase.u.grad-result - :: if +grad produced a mark, delegate %join behavior to that mark - :: - ?@ q.grad-vase - :: if +grad produced a term, make sure it's a valid mark - :: - =/ grad-mark=(unit term) ((sand %tas) q.grad-vase) - ?~ grad-mark - %- return-error :_ ~ :- %leaf - "ford: %join failed: %{} mark invalid +grad" - :: todo: doesn't catch full cycles of +grad arms, only simple cases - :: - ?: =(u.grad-mark mark) - %- return-error :_ ~ :- %leaf - "ford: %join failed: %{} mark +grad arm refers to self" - :: - =/ join-build=^build - [date.build [%join disc u.grad-mark [%$ first-cage] [%$ second-cage]]] - :: - =^ join-result out (depend-on join-build) - ?~ join-result - (return-blocks [join-build]~) - :: - ?: ?=([~ %error *] join-result) - %- return-error - :- [%leaf "ford: %join to {} on {} failed:"] - message.u.join-result - :: - ?> ?=([~ %success %join *] join-result) - :: - (return-result u.join-result) - :: make sure the +grad core has a +form arm - :: - ?. (slab %form p.grad-vase) - %- return-error :_ ~ :- %leaf - "ford: %join failed: no +form:grad in %{} mark" - :: make sure the +grad core has a +join arm - :: - ?. (slab %join p.grad-vase) - %- return-error :_ ~ :- %leaf - "ford: %join failed: no +join:grad in %{} mark" - :: fire the +form:grad arm, which should produce a mark - :: - =/ form-build=^build - [date.build [%ride [%limb %form] [%$ %noun grad-vase]]] - :: - =^ form-result out (depend-on form-build) - ?~ form-result - (return-blocks [form-build]~) - :: - ?. ?=([~ %success %ride *] form-result) - (wrap-error form-result) - :: - =/ form-mark=(unit term) ((soft @tas) q.vase.u.form-result) - ?~ form-mark - %- return-error :_ ~ :- %leaf - "ford: %join failed: %{} mark invalid +form:grad" - :: the mark produced by +form:grad should match both diffs - :: - ?. &(=(u.form-mark p.first-cage) =(u.form-mark p.second-cage)) - %- return-error :_ ~ :- %leaf - "ford: %join failed: mark mismatch" - :: if the diffs are identical, just produce the first - :: - ?: =(q.q.first-cage q.q.second-cage) - (return-result %success %join first-cage) - :: call the +join:grad gate on the two diffs - :: - =/ diff-build=^build - :- date.build - :+ %call - :+ %ride - [%limb %join] - [%$ %noun grad-vase] - [%$ %noun (slop q.first-cage q.second-cage)] - :: - =^ diff-result out (depend-on diff-build) - ?~ diff-result - (return-blocks [diff-build]~) - :: - ?: ?=([~ %error *] diff-result) - %- return-error - :- [%leaf "ford: %join to {} on {} failed:"] - message.u.diff-result - :: - ?> ?=([~ %success %call *] diff-result) - :: the result was a unit; if `~`, use %null mark; otherwise grab tail - :: - =/ =build-result - :+ %success %join - ?@ q.vase.u.diff-result - [%null vase.u.diff-result] - [u.form-mark (slot 3 vase.u.diff-result)] - :: - (return-result build-result) - :: - ++ make-list - ~% %make-list ..^^$ ~ - |= schematics=(list schematic) - ^- build-receipt - :: - =/ key-and-schematics - (turn schematics |=(=schematic [~ schematic])) - :: depend on builds of each schematic - :: - =^ maybe-schematic-results out - (perform-schematics "" key-and-schematics %ignore-errors *~) - ?~ maybe-schematic-results - out - :: return all builds - :: - =/ =build-result - :+ %success %list - :: the roll above implicitly flopped the results - :: - (flop (turn u.maybe-schematic-results tail)) - (return-result build-result) - :: - ++ make-mash - ~% %make-mash ..^^$ ~ - |= $: disc=disc - mark=term - first=[disc=disc mark=term =schematic] - second=[disc=disc mark=term =schematic] - == - ^- build-receipt - :: - =/ initial-build=^build - [date.build [schematic.first schematic.second] [%path disc %mar mark]] - :: - =^ initial-result out (depend-on initial-build) - ?~ initial-result - (return-blocks [initial-build]~) - :: TODO: duplicate logic with +make-join - :: - ?. ?=([~ %success [%success ^ ^] %success %path *] initial-result) - (wrap-error initial-result) - ?. ?=([%success *] head.head.u.initial-result) - (wrap-error `head.head.u.initial-result) - ?. ?=([%success *] tail.head.u.initial-result) - (wrap-error `tail.head.u.initial-result) - :: - =/ first-cage=cage (result-to-cage head.head.u.initial-result) - =/ second-cage=cage (result-to-cage tail.head.u.initial-result) - =/ mark-path=rail rail.tail.u.initial-result - :: TODO: duplicate logic with +make-pact and others - :: - =/ mark-build=^build [date.build [%core mark-path]] - :: - =^ mark-result out (depend-on mark-build) - ?~ mark-result - (return-blocks [mark-build]~) - :: - ?. ?=([~ %success %core *] mark-result) - (wrap-error mark-result) - :: - =/ mark-vase=vase vase.u.mark-result - :: - ?. (slab %grad p.mark-vase) - %- return-error :_ ~ :- %leaf - "ford: %mash failed: %{} mark has no +grad arm" - :: - =/ grad-build=^build - [date.build [%ride [%limb %grad] [%$ %noun mark-vase]]] - :: - =^ grad-result out (depend-on grad-build) - ?~ grad-result - (return-blocks [grad-build]~) - :: - ?. ?=([~ %success %ride *] grad-result) - (wrap-error grad-result) - :: - =/ grad-vase=vase vase.u.grad-result - :: if +grad produced a mark, delegate %mash behavior to that mark - :: - ?@ q.grad-vase - :: if +grad produced a term, make sure it's a valid mark - :: - =/ grad-mark=(unit term) ((sand %tas) q.grad-vase) - ?~ grad-mark - %- return-error :_ ~ :- %leaf - "ford: %mash failed: %{} mark invalid +grad" - :: - =/ mash-build=^build - :- date.build - :- %mash - :^ disc u.grad-mark - [disc.first mark.first [%$ first-cage]] - [disc.second mark.second [%$ second-cage]] - :: - =^ mash-result out (depend-on mash-build) - ?~ mash-result - (return-blocks [mash-build]~) - :: - ?. ?=([~ %success %mash *] mash-result) - (wrap-error mash-result) - :: - =/ =build-result - [%success %mash cage.u.mash-result] - :: - (return-result build-result) - :: - ?. (slab %form p.grad-vase) - %- return-error :_ ~ :- %leaf - "ford: %mash failed: %{} mark has no +form:grad" - :: - ?. (slab %mash p.grad-vase) - %- return-error :_ ~ :- %leaf - "ford: %mash failed: %{} mark has no +mash:grad" - :: - =/ form-build=^build - [date.build [%ride [%limb %form] [%$ %noun grad-vase]]] - :: - =^ form-result out (depend-on form-build) - ?~ form-result - (return-blocks [form-build]~) - :: - ?. ?=([~ %success %ride *] form-result) - (wrap-error form-result) - :: - =/ form-mark=(unit term) ((soft @tas) q.vase.u.form-result) - ?~ form-mark - %- return-error :_ ~ :- %leaf - "ford: %mash failed: %{} mark invalid +form:grad" - :: - ?. &(=(u.form-mark p.first-cage) =(u.form-mark p.second-cage)) - %- return-error :_ ~ :- %leaf - "ford: %mash failed: mark mismatch" - :: - ?: =(q.q.first-cage q.q.second-cage) - =/ =build-result - [%success %mash [%null [%atom %n ~] ~]] - :: - (return-result build-result) - :: call the +mash:grad gate on two [ship desk diff] triples - :: - =/ mash-build=^build - :- date.build - :+ %call - :+ %ride - [%limb %mash] - [%$ %noun grad-vase] - :+ %$ %noun - %+ slop - ;: slop - [[%atom %p ~] ship.disc.first] - [[%atom %tas ~] desk.disc.first] - q.first-cage - == - ;: slop - [[%atom %p ~] ship.disc.second] - [[%atom %tas ~] desk.disc.second] - q.second-cage - == - :: - =^ mash-result out (depend-on mash-build) - ?~ mash-result - (return-blocks [mash-build]~) - :: - ?. ?=([~ %success %call *] mash-result) - (wrap-error mash-result) - :: - =/ =build-result - [%success %mash [u.form-mark vase.u.mash-result]] - :: - (return-result build-result) - :: - ++ make-mute - ~% %make-mute ..^^$ ~ - |= [subject=schematic mutations=(list [=wing =schematic])] - ^- build-receipt - :: run the subject build to produce the noun to be mutated - :: - =/ subject-build=^build [date.build subject] - =^ subject-result out (depend-on subject-build) - ?~ subject-result - (return-blocks [subject-build]~) - :: - ?. ?=([~ %success *] subject-result) - (wrap-error subject-result) - :: - =/ subject-cage=cage (result-to-cage u.subject-result) - :: - =/ subject-vase=vase q.subject-cage - :: - =^ maybe-schematic-results out - %- perform-schematics :* - "ford: %mute contained failures:" - mutations - %fail-on-errors - *wing - == - ?~ maybe-schematic-results - out - :: all builds succeeded; retrieve vases from results - :: - =/ successes=(list [=wing =vase]) - %+ turn u.maybe-schematic-results - |= [=wing result=build-result] - ^- [^wing vase] - :: - ?> ?=([%success *] result) - :: - [wing q:(result-to-cage result)] - :: create and run a +build to apply all mutations in order - :: - =/ ride-build=^build - :- date.build - :+ %ride - :: formula: a `%_` +hoon that applies a list of mutations - :: - :: The hoon ends up looking like: - :: ``` - :: %_ +2 - :: wing-1 +6 - :: wing-2 +14 - :: ... - :: == - :: ``` - :: - ^= formula - ^- hoon - :+ %cncb [%& 2]~ - =/ axis 3 - :: - |- ^- (list [wing hoon]) - ?~ successes ~ - :: - :- [wing.i.successes [%$ (peg axis 2)]] - $(successes t.successes, axis (peg axis 3)) - :: subject: list of :subject-vase and mutations, as literal schematic - :: - :: The subject ends up as a vase of something like this: - :: ``` - :: :~ original-subject - :: mutant-1 - :: mutant-2 - :: ... - :: == - :: ``` - :: - ^= subject ^- schematic - :+ %$ %noun - ^- vase - %+ slop subject-vase - |- ^- vase - ?~ successes [[%atom %n ~] ~] - :: - (slop vase.i.successes $(successes t.successes)) - :: - =^ ride-result out (depend-on ride-build) - ?~ ride-result - (return-blocks [ride-build]~) - :: - ?. ?=([~ %success %ride *] ride-result) - (wrap-error ride-result) - :: - =/ =build-result - [%success %mute p.subject-cage vase.u.ride-result] - :: - (return-result build-result) - :: - ++ make-pact - ~% %make-pact ..^^$ ~ - |= [disc=disc start=schematic diff=schematic] - ^- build-receipt - :: first, build the inputs - :: - =/ initial-build=^build [date.build start diff] - :: - =^ initial-result out (depend-on initial-build) - ?~ initial-result - (return-blocks [initial-build]~) - :: - ?> ?=([~ %success ^ ^] initial-result) - =/ start-result=build-result head.u.initial-result - =/ diff-result=build-result tail.u.initial-result - :: - ?. ?=(%success -.start-result) - (wrap-error `start-result) - ?. ?=(%success -.diff-result) - (wrap-error `diff-result) - :: - =/ start-cage=cage (result-to-cage start-result) - =/ diff-cage=cage (result-to-cage diff-result) - :: - =/ start-mark=term p.start-cage - =/ diff-mark=term p.diff-cage - :: load the starting mark from the filesystem - :: - =/ mark-path-build=^build [date.build [%path disc %mar start-mark]] - :: - =^ mark-path-result out - (depend-on mark-path-build) - :: - ?~ mark-path-result - (return-blocks [mark-path-build]~) - :: - ?. ?=([~ %success %path *] mark-path-result) - (wrap-error mark-path-result) - :: - =/ mark-build=^build [date.build [%core rail.u.mark-path-result]] - :: - =^ mark-result out (depend-on mark-build) - ?~ mark-result - (return-blocks [mark-build]~) - :: - ?. ?=([~ %success %core *] mark-result) - (wrap-error mark-result) - :: - =/ mark-vase=vase vase.u.mark-result - :: fire the +grad arm of the mark core - :: - ?. (slab %grad p.mark-vase) - %- return-error :_ ~ :- %leaf - "ford: %pact failed: %{} mark has no +grad arm" - :: - =/ grad-build=^build - [date.build [%ride [%limb %grad] [%$ %noun mark-vase]]] - :: - =^ grad-result out (depend-on grad-build) - ?~ grad-result - (return-blocks [grad-build]~) - :: - ?. ?=([~ %success %ride *] grad-result) - (wrap-error grad-result) - :: - =/ grad-vase=vase vase.u.grad-result - :: +grad can produce a term or a core - :: - :: If a mark's +grad arm produces a mark (as a +term), - :: it means we should use that mark's machinery to run %pact. - :: In this way, a mark can delegate its patching machinery to - :: another mark. - :: - :: First we cast :start-cage to the +grad mark, then we run - :: a new %pact build on the result of that, which will use the - :: +grad mark's +grad arm. Finally we cast the %pact result back to - :: :start-mark, since we're trying to produce a patched version of - :: the initial marked value (:start-cage). - :: - ?@ q.grad-vase - :: if +grad produced a term, make sure it's a valid mark - :: - =/ grad-mark=(unit term) ((sand %tas) q.grad-vase) - ?~ grad-mark - %- return-error :_ ~ :- %leaf - "ford: %pact failed: %{} mark invalid +grad" - :: cast :start-cage to :grad-mark, %pact that, then cast back to start - :: - =/ cast-build=^build - :- date.build - :^ %cast disc start-mark - :^ %pact disc - :^ %cast disc u.grad-mark - [%$ start-cage] - [%$ diff-cage] - :: - =^ cast-result out (depend-on cast-build) - ?~ cast-result - (return-blocks [cast-build]~) - :: - ?. ?=([~ %success %cast *] cast-result) - (wrap-error cast-result) - :: - =/ =build-result - [%success %pact cage.u.cast-result] - :: - (return-result build-result) - :: +grad produced a core; make sure it has a +form arm - :: - :: +grad can produce a core containing +pact and +form - :: arms. +form:grad, which produces a mark (as a term), is used - :: to verify that the diff is of the correct mark. - :: - :: +pact:grad produces a gate that gets slammed with the diff - :: as its sample and produces a mutant version of :start-cage - :: by applying the diff. - :: - ?. (slab %form p.grad-vase) - %- return-error :_ ~ :- %leaf - "ford: %pact failed: no +form:grad in %{} mark" - :: we also need a +pact arm in the +grad core - :: - ?. (slab %pact p.grad-vase) - %- return-error :_ ~ :- %leaf - "ford: %pact failed: no +pact:grad in %{} mark" - :: fire the +form arm in the core produced by +grad - :: - =/ form-build=^build - [date.build [%ride [%limb %form] [%$ %noun grad-vase]]] - :: - =^ form-result out (depend-on form-build) - ?~ form-result - (return-blocks [form-build]~) - :: - ?. ?=([~ %success %ride *] form-result) - (wrap-error form-result) - :: +form:grad should produce a mark - :: - =/ form-mark=(unit @tas) ((soft @tas) q.vase.u.form-result) - ?~ form-mark - %- return-error :_ ~ :- %leaf - "ford: %pact failed: %{} mark invalid +form:grad" - :: mark produced by +form:grad needs to match the mark of the diff - :: - ?. =(u.form-mark diff-mark) - %- return-error :_ ~ :- %leaf - "ford: %pact failed: %{} mark invalid +form:grad" - :: call +pact:grad on the diff - :: - =/ pact-build=^build - :- date.build - :+ %call - ^- schematic - :+ %ride - [%tsld [%limb %pact] [%limb %grad]] - ^- schematic - :+ %mute - ^- schematic - [%$ %noun mark-vase] - ^- (list [wing schematic]) - [[%& 6]~ [%$ start-cage]]~ - ^- schematic - [%$ diff-cage] - :: - =^ pact-result out (depend-on pact-build) - ?~ pact-result - (return-blocks [pact-build]~) - :: - ?. ?=([~ %success %call *] pact-result) - (wrap-error pact-result) - :: - =/ =build-result - [%success %pact start-mark vase.u.pact-result] - :: - (return-result build-result) - :: - ++ make-path - ~% %make-path ..^^$ ~ - |= [disc=disc prefix=@tas raw-path=@tas] - ^- build-receipt - :: possible-spurs: flopped paths to which :raw-path could resolve - :: - =/ possible-spurs=(list spur) (turn (segments raw-path) flop) - :: rails-and-schematics: scrys to check each path in :possible-paths - :: - =/ rails-and-schematics=(list [=rail =schematic]) - %+ turn possible-spurs - |= possible-spur=spur - ^- [rail schematic] - :: full-spur: wrap :possible-spur with :prefix and /hoon suffix - :: - =/ full-spur=spur :(welp /hoon possible-spur /[prefix]) - :: - :- [disc full-spur] - [%scry %c %x `rail`[disc full-spur]] - :: depend on builds of each schematic - :: - =^ maybe-schematic-results out - %- perform-schematics :* - ;: weld - "ford: %path resolution of " (trip raw-path) "at prefix " - (trip prefix) " contained failures:" - == - rails-and-schematics - %filter-errors - *rail - == - ?~ maybe-schematic-results - out - :: matches: builds that completed with a successful result - :: - =/ matches u.maybe-schematic-results - :: if no matches, error out - :: - ?~ matches - =/ =beam - [[ship.disc desk.disc [%da date.build]] /hoon/[raw-path]/[prefix]] - :: - %- return-error - :_ ~ - :- %leaf - (weld "%path: no matches for " (spud (en-beam beam))) - :: if exactly one path matches, succeed with the matching path - :: - ?: ?=([* ~] matches) - (return-result %success %path key.i.matches) - :: multiple paths matched; error out - :: - %- return-error - :: - :- [%leaf "multiple matches for %path: "] - :: tmi; cast :matches back to +list - :: - %+ roll `_u.maybe-schematic-results`matches - |= [[key=rail result=build-result] message=tang] - ^- tang - :: beam: reconstruct request from :kid's schematic and date - :: - =/ =beam [[ship.disc desk.disc [%da date.build]] spur.key] - :: - [[%leaf (spud (en-beam beam))] message] - :: - ++ make-plan - ~% %make-plan ..^^$ ~ - |= [path-to-render=rail query-string=coin =scaffold] - ^- build-receipt - :: blocks: accumulator for blocked sub-builds - :: - =| blocks=(list ^build) - :: error-message: accumulator for failed sub-builds - :: - =| error-message=tang - :: - |^ :: imports: structure and library +cables, with %sur/%lib prefixes - :: - =/ imports=(list [prefix=?(%sur %lib) =cable]) - %+ welp - (turn structures.scaffold |=(cable [%sur +<])) - (turn libraries.scaffold |=(cable [%lib +<])) - :: path-builds: %path sub-builds to resolve import paths - :: - =/ path-builds (gather-path-builds imports) - :: - =^ path-results ..$ (resolve-builds path-builds) - ?^ blocks - (return-blocks blocks) - :: - ?^ error-message - (return-error error-message) - :: tmi; remove type specializations - :: - => .(blocks *(list ^build), error-message *tang) - :: core-builds: %core sub-builds to produce library vases - :: - =/ core-builds (gather-core-builds path-results) - :: - =^ core-results ..$ (resolve-builds core-builds) - ?^ blocks - (return-blocks blocks) - :: - ?^ error-message - (return-error error-message) - :: reef-build: %reef build to produce standard library - :: - =/ reef-build=^build [date.build [%reef disc.path-to-render]] - :: - =^ reef-result out (depend-on reef-build) - ?~ reef-result - (return-blocks [reef-build]~) - :: - ?. ?=([~ %success %reef *] reef-result) - (wrap-error reef-result) - :: subject: tuple of imports and standard library - :: - =/ subject=vase - (link-imports imports vase.u.reef-result core-results) - :: tmi; remove type specializations - :: - => .(blocks *(list ^build), error-message *tang) - :: iterate over each crane - :: - =^ crane-result ..$ - (compose-cranes [%noun subject] cranes.scaffold) - ?: ?=(%error -.crane-result) - (return-error message.crane-result) - ?: ?=(%block -.crane-result) - (return-blocks builds.crane-result) - :: combined-hoon: source hoons condensed into a single +hoon - :: - =/ combined-hoon=hoon [%tssg sources.scaffold] - :: compile :combined-hoon against :subject - :: - =/ compile=^build - [date.build [%ride combined-hoon [%$ subject.crane-result]]] - :: - =^ compiled out (depend-on compile) - :: compilation blocked; produce block on sub-build - :: - ?~ compiled - (return-blocks ~[compile]) - :: compilation failed; error out - :: - ?. ?=([~ %success %ride *] compiled) - (wrap-error compiled) - :: compilation succeeded: produce resulting +vase - :: - (return-result %success %plan vase.u.compiled) - :: +compose-result: the result of a single composition - :: - += compose-result - $% [%subject subject=cage] - [%block builds=(list ^build)] - [%error message=tang] - == - :: +compose-cranes: runs each crane and composes the results - :: - :: For each crane in :cranes, runs it and composes its result into a - :: new subject, which is returned if there are no errors or blocks. - :: - ++ compose-cranes - |= [subject=cage cranes=(list crane)] - ^- $: compose-result - _..compose-cranes - == - :: - ?~ cranes - [[%subject subject] ..compose-cranes] - :: - =^ result ..compose-cranes (run-crane subject i.cranes) - ?+ -.result [result ..compose-cranes] - :: - %subject - $(cranes t.cranes, subject [%noun (slop q.subject.result q.subject)]) - == - :: +run-crane: runs an individual :crane against :subject - :: - ++ run-crane - |= [subject=cage =crane] - ^- compose-cranes - :: - |^ ?- -.crane - %fssg (run-fssg +.crane) - %fsbc (run-fsbc +.crane) - %fsbr (run-fsbr +.crane) - %fsts (run-fsts +.crane) - %fscm (run-fscm +.crane) - %fspm (run-fspm +.crane) - %fscb (run-fscb +.crane) - %fsdt (run-fsdt +.crane) - %fssm (run-fssm +.crane) - %fscl (run-fscl +.crane) - %fskt (run-fskt +.crane) - %fstr (run-fstr +.crane) - %fszp (run-fszp +.crane) - %fszy (run-fszy +.crane) - == - :: +run-fssg: runs the `/~` rune - :: - ++ run-fssg - |= =hoon - ^- compose-cranes - :: - =/ ride-build=^build - [date.build [%ride hoon [%$ subject]]] - =^ ride-result out (depend-on ride-build) - ?~ ride-result - [[%block [ride-build]~] ..run-crane] - ?: ?=([~ %error *] ride-result) - [[%error [leaf+"/~ failed: " message.u.ride-result]] ..run-crane] - ?> ?=([~ %success %ride *] ride-result) - [[%subject %noun vase.u.ride-result] ..run-crane] - :: +run-fsbc: runs the `/$` rune - :: - ++ run-fsbc - |= =hoon - ^- compose-cranes - :: - =/ query-compile-build=^build - [date.build [%ride ((jock |) query-string) [%$ %noun !>(~)]]] - =^ query-compile-result out (depend-on query-compile-build) - ?~ query-compile-result - [[%block [query-compile-build]~] ..run-crane] - ?: ?=([~ %error *] query-compile-result) - :- [%error [leaf+"/; failed: " message.u.query-compile-result]] - ..run-crane - ?> ?=([~ %success %ride *] query-compile-result) - :: - =/ =beam - =, path-to-render - [[ship.disc desk.disc [%da date.build]] spur] - =+ arguments=(slop !>(beam) vase.u.query-compile-result) - :: - =/ call-build=^build - [date.build [%call [%ride hoon [%$ subject]] [%$ %noun arguments]]] - =^ call-result out (depend-on call-build) - ?~ call-result - [[%block [call-build]~] ..run-crane] - ?: ?=([~ %error *] call-result) - [[%error [leaf+"/; failed: " message.u.call-result]] ..run-crane] - ?> ?=([~ %success %call *] call-result) - :: - [[%subject %noun vase.u.call-result] ..run-crane] - :: +run-fsbr: runs the `/|` rune - :: - ++ run-fsbr - |= choices=(list ^crane) - ^- compose-cranes - :: - ?~ choices - [[%error [leaf+"/| failed: out of options"]~] ..run-crane] - :: - =^ child ..run-crane (run-crane subject i.choices) - ?. ?=([%error *] child) - [child ..run-crane] - $(choices t.choices) - :: +run-fsts: runs the `/=` rune - :: - ++ run-fsts - |= [face=term sub-crane=^crane] - ^- compose-cranes - :: - =^ child ..run-crane (run-crane subject sub-crane) - ?. ?=([%subject *] child) - [child ..run-crane] - :_ ..run-crane - :* %subject - p.subject.child - [[%face face p.q.subject.child] q.q.subject.child] - == - :: +run-fscm: runs the `/,` rune - :: - ++ run-fscm - |= cases=(list [=spur crane=^crane]) - ^- compose-cranes - :: - ?~ cases - [[%error [leaf+"/, failed: no match"]~] ..run-crane] - :: - ?. .= spur.i.cases - (scag (lent spur.i.cases) (flop spur.path-to-render)) - $(cases t.cases) - :: - (run-crane subject crane.i.cases) - :: +run-fspm: runs the `/&` rune - :: - ++ run-fspm - |= [marks=(list mark) sub-crane=^crane] - ^- compose-cranes - :: - =^ child ..run-crane (run-crane subject sub-crane) - ?. ?=([%subject *] child) - [child ..run-crane] - :: - =/ cast-build=^build - :- date.build - |- - ^- schematic - ?~ marks - :: TODO: If we were keeping track of the mark across runes, this - :: wouldn't have %noun here. This is a case where it might matter. - :: - [%$ subject.child] - [%cast disc.source-rail.scaffold i.marks $(marks t.marks)] - =^ cast-result out (depend-on cast-build) - ?~ cast-result - [[%block [cast-build]~] ..run-crane] - :: - ?: ?=([~ %error *] cast-result) - [[%error [leaf+"/& failed: " message.u.cast-result]] ..run-crane] - ?> ?=([~ %success %cast *] cast-result) - :: - [[%subject cage.u.cast-result] ..run-crane] - :: +run-fscb: runs the `/_` rune - :: - ++ run-fscb - |= sub-crane=^crane - ^- compose-cranes - :: perform a scry to get the contents of +path-to-render - :: - =/ toplevel-build=^build - [date.build [%scry [%c %y path-to-render]]] - :: - =^ toplevel-result out (depend-on toplevel-build) - ?~ toplevel-result - [[%block ~[toplevel-build]] ..run-crane] - :: - ?: ?=([~ %error *] toplevel-result) - :- [%error [leaf+"/_ failed: " message.u.toplevel-result]] - ..run-crane - ?> ?=([~ %success %scry *] toplevel-result) - :: - =/ toplevel-arch=arch ;;(arch q.q.cage.u.toplevel-result) - :: sub-path: each possible sub-directory to check - :: - =/ sub-paths=(list @ta) - (turn ~(tap by dir.toplevel-arch) head) - :: for each directory in :toplevel-arch, issue a sub-build - :: - =/ sub-builds=(list ^build) - %+ turn sub-paths - |= sub=@ta - ^- ^build - :- date.build - [%scry [%c %y path-to-render(spur [sub spur.path-to-render])]] - :: results: accumulator for results of sub-builds - :: - =| $= results - (list [kid=^build sub-path=@ta results=(unit build-result)]) - :: resolve all the :sub-builds - :: - =/ subs-results - |- ^+ [results out] - ?~ sub-builds [results out] - ?> ?=(^ sub-paths) - :: - =/ kid=^build i.sub-builds - =/ sub-path=@ta i.sub-paths - :: - =^ result out (depend-on kid) - =. results [[kid sub-path result] results] - :: - $(sub-builds t.sub-builds, sub-paths t.sub-paths) - :: apply mutations from depending on sub-builds - :: - =: results -.subs-results - out +.subs-results - == - :: split :results into completed :mades and incomplete :blocks - :: - =+ ^= split-results - (skid results |=([* * r=(unit build-result)] ?=(^ r))) - :: - =/ mades=_results -.split-results - =/ blocks=_results +.split-results - :: if any builds blocked, produce them all in %blocks - :: - ?^ blocks - [[%block (turn `_results`blocks head)] ..run-crane] - :: find the first error and return it if exists - :: - =/ errors=_results - %+ skim results - |= [* * r=(unit build-result)] - ?=([~ %error *] r) - ?^ errors - ?> ?=([~ %error *] results.i.errors) - [[%error message.u.results.i.errors] ..run-crane] - :: get a list of valid sub-paths - :: - :: :results is now a list of the :build-result of %cy on each path - :: in :toplevel-arch. What we want is to now filter this list so - :: that we filter files out. - :: - =/ sub-paths=(list [=rail sub-path=@ta]) - %+ murn results - |= [build=^build sub-path=@ta result=(unit build-result)] - ^- (unit [rail @ta]) - :: - ?> ?=([@da %scry %c %y *] build) - ?> ?=([~ %success %scry *] result) - =/ =arch ;;(arch q.q.cage.u.result) - :: - ?~ dir.arch - ~ - `[rail.resource.schematic.build sub-path] - :: keep track of the original value so we can reset it - :: - =/ old-path-to-render path-to-render - :: apply each of the filtered :sub-paths to the :sub-crane. - :: - =^ crane-results ..run-crane - %+ roll sub-paths - |= $: [=rail sub-path=@ta] - $= accumulator - [(list [sub-path=@ta =compose-result]) _..run-crane] - == - =. ..run-crane +.accumulator - =. path-to-render rail - =^ result ..run-crane (run-crane subject sub-crane) - [[[sub-path result] -.accumulator] ..run-crane] - :: set :path-to-render back - :: - =. path-to-render old-path-to-render - :: if any sub-cranes error, return the first error - :: - =/ error-list=(list [@ta =compose-result]) - %+ skim crane-results - |= [@ta =compose-result] - =(%error -.compose-result) - :: - ?^ error-list - [compose-result.i.error-list ..run-crane] - :: if any sub-cranes block, return all blocks - :: - =/ block-list=(list ^build) - =| block-list=(list ^build) - |- - ^+ block-list - ?~ crane-results - block-list - ?. ?=(%block -.compose-result.i.crane-results) - $(crane-results t.crane-results) - =. block-list - (weld builds.compose-result.i.crane-results block-list) - $(crane-results t.crane-results) - :: - ?^ block-list - [[%block block-list] ..run-crane] - :: put the data in map order - :: - =/ result-map=(map @ta vase) - %- my - %+ turn crane-results - |= [path=@ta =compose-result] - ^- (pair @ta vase) - :: - ?> ?=([%subject *] compose-result) - [path q.subject.compose-result] - :: convert the map into a flat format for return - :: - :: This step flattens the values out of the map for return. Let's - :: say we're doing a /_ over a directory of files that just have a - :: single @ud in them. We want the return value of /_ to have the - :: nest in (map @ta @ud) instead of returning a (map @ta vase). - :: - =/ as-vase=vase - |- - ^- vase - :: - ?~ result-map - [[%atom %n `0] 0] - :: - %+ slop - (slop [[%atom %ta ~] p.n.result-map] q.n.result-map) - (slop $(result-map l.result-map) $(result-map r.result-map)) - :: - [[%subject %noun as-vase] ..run-crane] - :: +run-fsdt: runs the `/.` rune - :: - ++ run-fsdt - |= sub-cranes=(list ^crane) - ^- compose-cranes - :: - =^ list-results ..run-crane - %+ roll sub-cranes - |= $: sub-crane=^crane - accumulator=[(list compose-result) _..run-crane] - == - =. ..run-crane +.accumulator - =^ result ..run-crane (run-crane subject sub-crane) - [[result -.accumulator] ..run-crane] - :: if any sub-cranes error, return the first error - :: - =/ error-list=(list compose-result) - %+ skim list-results - |= =compose-result - =(%error -.compose-result) - :: - ?^ error-list - [i.error-list ..run-crane] - :: if any sub-cranes block, return all blocks - :: - =/ block-list=(list ^build) - =| block-list=(list ^build) - |- - ^+ block-list - ?~ list-results - block-list - ?. ?=(%block -.i.list-results) - $(list-results t.list-results) - =. block-list (weld builds.i.list-results block-list) - $(list-results t.list-results) - :: - ?^ block-list - [[%block block-list] ..run-crane] - :: concatenate all the results together with null termination - :: - =. list-results (flop list-results) - :: - =/ final-result=vase - |- - ^- vase - ?~ list-results - [[%atom %n `~] 0] - ?> ?=(%subject -.i.list-results) - (slop q.subject.i.list-results $(list-results t.list-results)) - :: - [[%subject %noun final-result] ..run-crane] - :: +run-fssm: runs the `/;` rune - :: - ++ run-fssm - |= [=hoon sub-crane=^crane] - ^- compose-cranes - :: - =^ child ..run-crane (run-crane subject sub-crane) - ?. ?=([%subject *] child) - [child ..run-crane] - :: - =/ call-build=^build - [date.build [%call [%ride hoon [%$ subject]] [%$ subject.child]]] - =^ call-result out (depend-on call-build) - ?~ call-result - [[%block [call-build]~] ..run-crane] - ?: ?=([~ %error *] call-result) - [[%error [leaf+"/; failed: " message.u.call-result]] ..run-crane] - ?> ?=([~ %success %call *] call-result) - :: - [[%subject %noun vase.u.call-result] ..run-crane] - :: +run-fscl: runs the `/:` rune - :: - ++ run-fscl - |= [=truss sub-crane=^crane] - ^- compose-cranes - :: - =/ beam-to-render=beam - [[ship.disc desk.disc %ud 0] spur]:path-to-render - :: - =/ hoon-parser (vang & (en-beam beam-to-render)) - :: - =+ tuz=(posh:hoon-parser truss) - ?~ tuz - [[%error [leaf+"/: failed: bad tusk: {}"]~] ..run-crane] - =+ pax=(plex:hoon-parser %clsg u.tuz) - ?~ pax - [[%error [leaf+"/: failed: bad path: {}"]~] ..run-crane] - =+ bem=(de-beam u.pax) - ?~ bem - [[%error [leaf+"/: failed: bad beam: {}"]~] ..run-crane] - :: - =. path-to-render [[p q] s]:u.bem - (run-crane subject sub-crane) - :: +run-fskt: runs the `/^` rune - :: - ++ run-fskt - |= [=spec sub-crane=^crane] - ^- compose-cranes - :: - =^ child ..run-crane (run-crane subject sub-crane) - ?. ?=([%subject *] child) - [child ..run-crane] - :: - =/ bunt-build=^build - [date.build [%ride [%kttr spec] [%$ subject]]] - =^ bunt-result out (depend-on bunt-build) - ?~ bunt-result - [[%block [bunt-build]~] ..run-crane] - ?: ?=([~ %error *] bunt-result) - [[%error [leaf+"/^ failed: " message.u.bunt-result]] ..run-crane] - ?> ?=([~ %success %ride *] bunt-result) - :: - ?. (~(nest ut p.vase.u.bunt-result) | p.q.subject.child) - [[%error [leaf+"/^ failed: nest-fail"]~] ..run-crane] - :_ ..run-crane - [%subject %noun [p.vase.u.bunt-result q.q.subject.child]] - :: +run-fstr: runs the `/*` rune - :: - :: TODO: some duplicate code with +run-fscb - :: - ++ run-fstr - |= sub-crane=^crane - ^- compose-cranes - :: - =/ tree-build=^build - [date.build [%scry [%c %t path-to-render]]] - :: - =^ tree-result out (depend-on tree-build) - ?~ tree-result - [[%block ~[tree-build]] ..run-crane] - :: - ?: ?=([~ %error *] tree-result) - :- [%error [%leaf "/* failed: "] message.u.tree-result] - ..run-crane - ?> ?=([~ %success %scry *] tree-result) - :: - =/ file-list=(list path) ;;((list path) q.q.cage.u.tree-result) - :: trim file extensions off the file paths - :: - :: This is pretty ugly, but Ford expects :path-to-render not to - :: have a file extension, so we need to trim it off each path. - :: - =. file-list - :: deduplicate since multiple files could share a trimmed path - :: - =- ~(tap in (~(gas in *(set path)) `(list path)`-)) - %+ turn file-list - |= =path - ^+ path - (scag (sub (lent path) 1) path) - :: - =/ old-path-to-render path-to-render - :: apply each of the paths in :file-list to the :sub-crane - :: - =^ crane-results ..run-crane - %+ roll file-list - |= $: =path - $= accumulator - [(list [=path =compose-result]) _..run-crane] - == - =. ..run-crane +.accumulator - =. spur.path-to-render (flop path) - :: - =^ result ..run-crane (run-crane subject sub-crane) - [[[path result] -.accumulator] ..run-crane] - :: - =. path-to-render old-path-to-render - :: if any sub-cranes error, return the first error - :: - =/ error-list=(list [=path =compose-result]) - %+ skim crane-results - |= [=path =compose-result] - =(%error -.compose-result) - :: - ?^ error-list - [compose-result.i.error-list ..run-crane] - :: if any sub-cranes block, return all blocks - :: - =/ block-list=(list ^build) - =| block-list=(list ^build) - |- ^+ block-list - ?~ crane-results block-list - :: - ?. ?=(%block -.compose-result.i.crane-results) - $(crane-results t.crane-results) - =. block-list - (weld builds.compose-result.i.crane-results block-list) - :: - $(crane-results t.crane-results) - :: - ?^ block-list - [[%block block-list] ..run-crane] - :: - =/ result-map=(map path vase) - %- my - %+ turn crane-results - |= [=path =compose-result] - ^- (pair ^path vase) - :: - ?> ?=(%subject -.compose-result) - [path q.subject.compose-result] - :: - =/ as-vase - =/ path-type -:!>(*path) - |- ^- vase - ?~ result-map [[%atom %n `0] 0] - :: - %+ slop - (slop [path-type p.n.result-map] q.n.result-map) - (slop $(result-map l.result-map) $(result-map r.result-map)) - :: - [[%subject %noun as-vase] ..run-crane] - :: +run-fszp: runs the `/!mark/` "rune" - :: - ++ run-fszp - |= =mark - ^- compose-cranes - :: - =/ hoon-path=rail - =, path-to-render - [disc [%hoon spur]] - :: - =/ hood-build=^build [date.build [%hood hoon-path]] - =^ hood-result out (depend-on hood-build) - ?~ hood-result - [[%block [hood-build]~] ..run-crane] - ?: ?=([~ %error *] hood-result) - [[%error [leaf+"/! failed: " message.u.hood-result]] ..run-crane] - ?> ?=([~ %success %hood *] hood-result) - :: - =/ plan-build=^build - :- date.build - [%plan path-to-render query-string scaffold.u.hood-result] - =^ plan-result out (depend-on plan-build) - ?~ plan-result - [[%block [plan-build]~] ..run-crane] - ?: ?=([~ %error *] plan-result) - [[%error [leaf+"/! failed: " message.u.plan-result]] ..run-crane] - ?> ?=([~ %success %plan *] plan-result) - :: if :mark is %noun, don't perform mark translation; just return - :: - :: If we were to verify the product type with %noun, this would - :: cast to *, which would overwrite :vase.u.plan-result's actual - :: product type - :: - ?: =(%noun mark) - [[%subject %noun vase.u.plan-result] ..run-crane] - :: - =/ vale-build=^build - :- date.build - [%vale disc.source-rail.scaffold mark q.vase.u.plan-result] - =^ vale-result out (depend-on vale-build) - ?~ vale-result - [[%block [vale-build]~] ..run-crane] - ?: ?=([~ %error *] vale-result) - [[%error [leaf+"/! failed: " message.u.vale-result]] ..run-crane] - ?> ?=([~ %success %vale *] vale-result) - :: - [[%subject cage.u.vale-result] ..run-crane] - :: +run-fszy: runs the `/mark/` "rune" - :: - ++ run-fszy - |= =mark - ^- compose-cranes - :: - =/ bake-build=^build - :- date.build - [%bake mark query-string path-to-render] - =^ bake-result out (depend-on bake-build) - ?~ bake-result - [[%block [bake-build]~] ..run-crane] - ?: ?=([~ %error *] bake-result) - :_ ..run-crane - [%error [leaf+"/{(trip mark)}/ failed: " message.u.bake-result]] - ?> ?=([~ %success %bake *] bake-result) - :: - [[%subject cage.u.bake-result] ..run-crane] - -- - :: +gather-path-builds: produce %path builds to resolve import paths - :: - ++ gather-path-builds - |= imports=(list [prefix=?(%sur %lib) =cable]) - ^- (list ^build) - :: - %+ turn imports - |= [prefix=?(%sur %lib) =cable] - ^- ^build - [date.build [%path disc.source-rail.scaffold prefix file-path.cable]] - :: +resolve-builds: run a list of builds and collect results - :: - :: If a build blocks, put its +tang in :error-message and stop. - :: All builds that block get put in :blocks. Results of - :: successful builds are produced in :results. - :: - ++ resolve-builds - =| results=(list build-result) - |= builds=(list ^build) - ^+ [results ..^$] - :: - ?~ builds - [results ..^$] - :: - =^ result out (depend-on i.builds) - ?~ result - =. blocks [i.builds blocks] - $(builds t.builds) - :: - ?. ?=(%success -.u.result) - =. error-message [[%leaf "%plan failed: "] message.u.result] - [results ..^$] - :: - =. results [u.result results] - $(builds t.builds) - :: +gather-core-builds: produce %core builds from resolved paths - :: - ++ gather-core-builds - |= path-results=(list build-result) - ^- (list ^build) - %+ turn path-results - |= result=build-result - ^- ^build - :: - ?> ?=([%success %path *] result) - :: - [date.build [%core rail.result]] - :: +link-imports: link libraries and structures with standard library - :: - :: Prepends each library vase onto the standard library vase. - :: Wraps a face around each library to prevent namespace leakage - :: unless imported as *lib-name. - :: - ++ link-imports - |= $: imports=(list [?(%lib %sur) =cable]) - reef=vase - core-results=(list build-result) - == - ^- vase - :: - =/ subject=vase reef - :: - =/ core-vases=(list vase) - %+ turn core-results - |= result=build-result - ^- vase - ?> ?=([%success %core *] result) - vase.result - :: link structures and libraries into a subject for compilation - :: - |- ^+ subject - ?~ core-vases subject - ?< ?=(~ imports) - :: cons this vase onto the head of the subject - :: - =. subject - %- slop :_ subject - :: check if the programmer named the library - :: - ?~ face.cable.i.imports - :: no face assigned to this library, so use vase as-is - :: - i.core-vases - :: use the library name as a face to prevent namespace leakage - :: - ^- vase - [[%face u.face.cable.i.imports p.i.core-vases] q.i.core-vases] - :: - $(core-vases t.core-vases, imports t.imports) - -- - :: - ++ make-reef - ~% %make-reef ..^^$ ~ - |= =disc - ^- build-receipt - :: - =/ hoon-scry - [date.build [%scry %c %x [disc /hoon/hoon/sys]]] - :: - =^ hoon-scry-result out (depend-on hoon-scry) - :: - =/ arvo-scry - [date.build [%scry %c %x [disc /hoon/arvo/sys]]] - :: - =^ arvo-scry-result out (depend-on arvo-scry) - :: - =/ zuse-scry - [date.build [%scry %c %x [disc /hoon/zuse/sys]]] - :: - =^ zuse-scry-result out (depend-on zuse-scry) - :: - =| blocks=(list ^build) - =? blocks ?=(~ hoon-scry-result) [hoon-scry blocks] - =? blocks ?=(~ arvo-scry-result) [arvo-scry blocks] - =? blocks ?=(~ zuse-scry-result) [zuse-scry blocks] - :: - ?^ blocks - (return-blocks blocks) - :: - ?. ?=([~ %success %scry *] hoon-scry-result) - (wrap-error hoon-scry-result) - :: - ?. ?=([~ %success %scry *] arvo-scry-result) - (wrap-error arvo-scry-result) - :: - ?. ?=([~ %success %scry *] zuse-scry-result) - (wrap-error zuse-scry-result) - :: - :: short-circuit to .pit during boot - :: - :: This avoids needing to recompile the kernel if we're asked - :: to build %hoon one the home desk, at revision 1 or 2. - :: - ?: ?& =(our ship.disc) - ?=(?(%base %home) desk.disc) - :: - =/ =beam - [[ship.disc desk.disc [%da date.build]] /hoon/hoon/sys] - =/ cass - (scry [%141 %noun] [~ %cw beam]) - ?=([~ ~ %cass * ?(%1 %2) *] cass) - == - :: - (return-result %success %reef pit) - :: omit case from path to prevent cache misses - :: - =/ hoon-path=path - /(scot %p ship.disc)/(scot %tas desk.disc)/hoon/hoon/sys - =/ hoon-hoon=(each hoon tang) - %- mule |. - (rain hoon-path ;;(@t q.q.cage.u.hoon-scry-result)) - ?: ?=(%| -.hoon-hoon) - (return-error leaf+"ford: %reef failed to compile hoon" p.hoon-hoon) - :: - =/ arvo-path=path - /(scot %p ship.disc)/(scot %tas desk.disc)/hoon/arvo/sys - =/ arvo-hoon=(each hoon tang) - %- mule |. - (rain arvo-path ;;(@t q.q.cage.u.arvo-scry-result)) - ?: ?=(%| -.arvo-hoon) - (return-error leaf+"ford: %reef failed to compile arvo" p.arvo-hoon) - :: - =/ zuse-path=path - /(scot %p ship.disc)/(scot %tas desk.disc)/hoon/zuse/sys - =/ zuse-hoon=(each hoon tang) - %- mule |. - (rain zuse-path ;;(@t q.q.cage.u.zuse-scry-result)) - ?: ?=(%| -.zuse-hoon) - (return-error leaf+"ford: %reef failed to compile zuse" p.zuse-hoon) - :: - =/ zuse-build=^build - :* date.build - %ride p.zuse-hoon - :: hoon for `..is` to grab the :pit out of the arvo core - :: - %ride [%cnts ~[[%& 1] %is] ~] - %ride p.arvo-hoon - %ride [%$ 7] - %ride p.hoon-hoon - [%$ %noun !>(~)] - == - :: - =^ zuse-build-result out (depend-on zuse-build) - ?~ zuse-build-result - (return-blocks [zuse-build]~) - :: - ?. ?=([~ %success %ride *] zuse-build-result) - (wrap-error zuse-build-result) - :: - (return-result %success %reef vase.u.zuse-build-result) - :: - ++ make-ride - ~% %make-ride ..^^$ ~ - |= [formula=hoon =schematic] - ^- build-receipt - :: - =^ result out (depend-on [date.build schematic]) - ?~ result - (return-blocks [date.build schematic]~) - :: - =* subject-vase q:(result-to-cage u.result) - =/ slim-schematic=^schematic [%slim p.subject-vase formula] - =^ slim-result out (depend-on [date.build slim-schematic]) - ?~ slim-result - (return-blocks [date.build slim-schematic]~) - :: - ?: ?=([~ %error *] slim-result) - %- return-error - :* [%leaf "ford: %ride failed to compute type:"] - message.u.slim-result - == - :: - ?> ?=([~ %success %slim *] slim-result) - :: - =/ =compiler-cache-key [%ride formula subject-vase] - =^ cached-result out (access-cache compiler-cache-key) - ?^ cached-result - (return-result u.cached-result) - :: - =/ val - (mock [q.subject-vase nock.u.slim-result] intercepted-scry) - :: val is a toon, which might be a list of blocks. - :: - ?- -.val - :: - %0 - (return-result %success %ride [type.u.slim-result p.val]) - :: - %1 - =/ blocked-paths=(list path) ;;((list path) p.val) - (blocked-paths-to-receipt %ride blocked-paths) - :: - %2 - (return-error [[%leaf "ford: %ride failed to execute:"] p.val]) - == - :: - ++ make-same - ~% %make-same ..^^$ ~ - |= =schematic - ^- build-receipt - :: - =^ result out (depend-on [date.build schematic]) - :: - ?~ result - (return-blocks [date.build schematic]~) - (return-result u.result) - :: - ++ make-scry - ~% %make-scry ..^^$ ~ - |= =resource - ^- build-receipt - :: construct a full +beam to make the scry request - :: - =/ =beam (extract-beam resource `date.build) - =/ =scry-request [vane.resource care.resource beam] - :: perform scry operation if we don't already know the result - :: - :: Look up :scry-request in :scry-results.per-event to avoid - :: rerunning a previously blocked +scry. - :: - =/ scry-response - ?: (~(has by scry-results) scry-request) - (~(get by scry-results) scry-request) - (scry [%141 %noun] ~ `@tas`(cat 3 [vane care]:resource) beam) - :: scry blocked - :: - ?~ scry-response - (return-blocks ~) - :: scry failed - :: - ?~ u.scry-response - %- return-error - :~ leaf+"scry failed for" - leaf+:(weld "%c" (trip care.resource) " " (spud (en-beam beam))) - == - :: scry succeeded - :: - (return-result %success %scry u.u.scry-response) - :: - ++ make-slim - ~% %make-slim ..^^$ ~ - |= [subject-type=type formula=hoon] - ^- build-receipt - :: - =/ =compiler-cache-key [%slim subject-type formula] - =^ cached-result out (access-cache compiler-cache-key) - ?^ cached-result - (return-result u.cached-result) - :: - =/ compiled=(each (pair type nock) tang) - (mule |.((~(mint ut subject-type) [%noun formula]))) - :: - %_ out - result - ?- -.compiled - %| [%build-result %error [leaf+"ford: %slim failed: " p.compiled]] - %& [%build-result %success %slim p.compiled] - == - == - :: TODO: Take in +type instead of +vase? - :: - ++ make-slit - ~% %make-slit ..^^$ ~ - |= [gate=vase sample=vase] - ^- build-receipt - :: - =/ =compiler-cache-key [%slit p.gate p.sample] - =^ cached-result out (access-cache compiler-cache-key) - ?^ cached-result - (return-result u.cached-result) - :: - =/ product=(each type tang) - (mule |.((slit p.gate p.sample))) - :: - %_ out - result - ?- -.product - %| :* %build-result %error - :* (~(dunk ut p.sample) %have) - (~(dunk ut (~(peek ut p.gate) %free 6)) %want) - leaf+"ford: %slit failed:" - p.product - == - == - %& [%build-result %success %slit p.product] - == - == - :: - ++ make-volt - ~% %make-volt ..^^$ ~ - |= [=disc mark=term input=*] - ^- build-receipt - :: - =/ bunt-build=^build [date.build [%bunt disc mark]] - :: - =^ bunt-result out (depend-on bunt-build) - ?~ bunt-result - (return-blocks [bunt-build]~) - :: - ?: ?=([~ %error *] bunt-result) - %- return-error - :- [%leaf "ford: %volt {} on {} failed:"] - message.u.bunt-result - :: - ?> ?=([~ %success %bunt *] bunt-result) - :: - =/ =build-result - [%success %volt [mark p.q.cage.u.bunt-result input]] - :: - (return-result build-result) - :: - ++ make-vale - ~% %make-vale ..^^$ ~ - :: TODO: better docs - :: - |= [=disc mark=term input=*] - ^- build-receipt - :: don't validate for the %noun mark - :: - ?: =(%noun mark) - =/ =build-result [%success %vale [%noun %noun input]] - :: - (return-result build-result) - :: - =/ path-build [date.build [%path disc %mar mark]] - :: - =^ path-result out (depend-on path-build) - ?~ path-result - (return-blocks [path-build]~) - :: - ?: ?=([~ %error *] path-result) - %- return-error - :- leaf+"ford: %vale failed while searching for {}:" - message.u.path-result - :: - ?> ?=([~ %success %path *] path-result) - :: - =/ bunt-build=^build [date.build [%bunt disc mark]] - :: - =^ bunt-result out (depend-on bunt-build) - ?~ bunt-result - (return-blocks [bunt-build]~) - :: - ?. ?=([~ %success %bunt *] bunt-result) - (wrap-error bunt-result) - :: - =/ mark-sample=vase q.cage.u.bunt-result - :: - =/ call-build=^build - :^ date.build - %call - ^= gate - :* %ride - :: (ream 'noun:grab') - formula=`hoon`[%tsld [%wing ~[%noun]] [%wing ~[%grab]]] - subject=`schematic`[%core rail.u.path-result] - == - sample=[%$ %noun %noun input] - :: - =^ call-result out (depend-on call-build) - ?~ call-result - (return-blocks [call-build]~) - :: - ?: ?=([~ %error *] call-result) - :: - %- return-error - =/ =beam - [[ship.disc desk.disc %da date.build] spur.rail.u.path-result] - :* :- %leaf - "ford: %vale failed: invalid input for mark: {<(en-beam beam)>}" - message.u.call-result - == - :: - ?> ?=([~ %success %call *] call-result) - =/ product=vase vase.u.call-result - :: +grab might produce the wrong type - :: - ?. (~(nest ut p.mark-sample) | p.product) - %- return-error - :~ leaf+"ford: %vale failed" - leaf+"+grab has wrong type in mark {} on disc {}" - == - :: - =/ =build-result - [%success %vale [mark p.mark-sample q.product]] - :: - (return-result build-result) - :: - ++ make-walk - ~% %make-walk ..^^$ ~ - |= [=disc source=term target=term] - ^- build-receipt - :: define some types used in this gate - :: - => |% - :: +load-node: a queued arm to run from a mark core - :: - += load-node [type=?(%grab %grow) mark=term] - :: edge-jug: directed graph from :source mark to :target marks - :: - :: :source can be converted to :target either by running - :: its own +grow arm, or by running the target's +grab arm. - :: - += edge-jug (jug source=term [target=term arm=?(%grow %grab)]) - :: mark-path: a path through the mark graph - :: - :: +mark-path represents a series of mark translation - :: operations to be performed to 'walk' from one mark to another. - :: - :: +mark-action is defined in Zuse. It represents a conversion - :: from a source mark to a target mark, and it specifies - :: whether it will use +grow or +grab. - :: - += mark-path (list mark-action) - -- - :: - |^ ^- build-receipt - ?: =(source target) - (return-result %success %walk ~) - :: load all marks. - :: - =^ marks-result out - (load-marks-reachable-from [[%grow source] [%grab target] ~]) - ?~ -.marks-result - out - :: find a path through the graph - :: - :: Make a list of individual mark translation actions which will - :: take us from :source to :term. - :: - =/ path (find-path-through u.-.marks-result) - :: if there is no path between these marks, give an error message - :: - ?~ path - :: we failed; surface errors from +load-marks-reachable-from - :: - =/ braces [[' ' ' ' ~] ['{' ~] ['}' ~]] - =/ errors=(list tank) - %- zing - %+ turn ~(tap in +.marks-result) - |= [mark=term err=tang] - ^- tang - :~ [%leaf :(weld "while compiling " (trip mark) ":")] - [%rose braces err] - == - :: - %_ out - result - :* %build-result %error - :* :- %leaf - ;: weld - "ford: no mark path from " (trip source) " to " - (trip target) - == - errors - == == - == - :: - (return-result %success %walk path) - :: +load-marks-reachable-from: partial mark graph loading - :: - :: While we can just load all marks in the %/mar directory, this is - :: rather slow. What we do instead is traverse forwards and backwards - :: from the source and target marks: we start at the source mark, - :: check all the grow arms, and then check their grow arms. At the - :: same time, we start from the target mark, check all the grab arms, - :: and then check their grab arms. This gives us a much smaller - :: dependency set than loading the entire %/mar directory. - :: - ++ load-marks-reachable-from - |= queued-nodes=(list load-node) - :: list of nodes in the graph that we've already checked - :: - =| visited=(set load-node) - :: graph of the available edges - :: - =| =edge-jug - :: compile-failures: mark files which didn't compile - :: - =| compile-failures=(map term tang) - :: - |- - ^- [[(unit ^edge-jug) _compile-failures] _out] - :: no ?~ to prevent tmi - :: - ?: =(~ queued-nodes) - [[`edge-jug compile-failures] out] - :: - =/ nodes-and-schematics - %+ turn queued-nodes - |= =load-node - ^- [^load-node schematic] - :- load-node - [%path disc %mar mark.load-node] - :: get the path for each mark name - :: - :: For %path builds, any ambiguous path is just filtered out. - :: - =^ maybe-path-results out - %- perform-schematics :* - ;: weld - "ford: %walk from " (trip source) " to " (trip target) - " contained failures:" - == - nodes-and-schematics - %filter-errors - *load-node - == - ?~ maybe-path-results - [[~ ~] out] - :: - =/ nodes-and-cores - %+ turn u.maybe-path-results - |= [=load-node =build-result] - ^- [^load-node schematic] - :: - ?> ?=([%success %path *] build-result) - :: - :- load-node - [%core rail.build-result] - :: - =^ maybe-core-results out - %- perform-schematics :* - ;: weld - "ford: %walk from " (trip source) " to " (trip target) - " contained failures:" - == - nodes-and-cores - %ignore-errors - *load-node - == - ?~ maybe-core-results - [[~ ~] out] - :: clear the queue before we process the new results - :: - =. queued-nodes ~ - :: - =/ cores u.maybe-core-results - :: - |- - ?~ cores - ^$ - :: mark this node as visited - :: - =. visited (~(put in visited) key.i.cores) - :: add core errors to compile failures - :: - =? compile-failures ?=([%error *] result.i.cores) - %+ ~(put by compile-failures) mark.key.i.cores - message.result.i.cores - :: - =/ target-arms=(list load-node) - ?. ?=([%success %core *] result.i.cores) - ~ - ?: =(%grow type.key.i.cores) - (get-arms-of-type %grow vase.result.i.cores) - (get-arms-of-type %grab vase.result.i.cores) - :: filter places we know we've already been. - :: - =. target-arms - %+ skip target-arms ~(has in visited) - =. queued-nodes (weld target-arms queued-nodes) - :: - =. edge-jug - |- - ?~ target-arms - edge-jug - :: - =. edge-jug - ?- type.i.target-arms - :: - %grab - (~(put ju edge-jug) mark.i.target-arms [mark.key.i.cores %grab]) - :: - %grow - (~(put ju edge-jug) mark.key.i.cores [mark.i.target-arms %grow]) - == - $(target-arms t.target-arms) - :: - $(cores t.cores) - :: - ++ get-arms-of-type - |= [type=?(%grab %grow) =vase] - ^- (list load-node) - :: it is valid for this node to not have a +grow arm. - :: - ?. (slob type p.vase) - ~ - :: - %+ turn - (sloe p:(slap vase [%limb type])) - |= arm=term - [type arm] - :: +find-path-through: breadth first search over the mark graph - :: - ++ find-path-through - |= edges=edge-jug - ^- mark-path - :: the source node starts out visited - =/ visited-nodes=(set mark) [source ~ ~] - :: these paths are flopped so we're always inserting to the front. - =| path-queue=(qeu mark-path) - :: start the queue with all the edges which start at the source mark - :: - =. path-queue - =/ start-links (find-links-in-edges edges source) - :: - |- - ^+ path-queue - ?~ start-links - path-queue - :: - =. path-queue (~(put to path-queue) [i.start-links]~) - :: - $(start-links t.start-links) - :: - |- - ^- mark-path - :: - ?: =(~ path-queue) - :: no path found - ~ - =^ current path-queue [p q]:~(get to path-queue) - ?> ?=(^ current) - :: - ?: =(target target.i.current) - :: we have a completed path. paths in the queue are backwards - (flop current) - :: - =+ next-steps=(find-links-in-edges edges target.i.current) - :: filter out already visited nodes - :: - =. next-steps - %+ skip next-steps - |= link=mark-action - (~(has in visited-nodes) source.link) - :: then add the new ones to the set of already visited nodes - :: - =. visited-nodes - (~(gas in visited-nodes) (turn next-steps |=(mark-action source))) - :: now all next steps go in the queue - :: - =. path-queue - %- ~(gas to path-queue) - %+ turn next-steps - |= new-link=mark-action - [new-link current] - :: - $ - :: +find-links-in-edges: gets edges usable by +find-path-through - :: - :: This deals with disambiguating between %grab and %grow so we always - :: pick %grab over %grow. - :: - ++ find-links-in-edges - |= [edges=edge-jug source=term] - ^- (list mark-action) - :: - =+ links=~(tap in (~(get ju edges) source)) - :: - =| results=(set mark-action) - |- - ^- (list mark-action) - ?~ links - ~(tap in results) - :: - ?- arm.i.links - %grab - :: if :results has a %grow entry, remove it before adding our %grab - =/ grow-entry=mark-action [%grow source target.i.links] - =? results (~(has in results) grow-entry) - (~(del in results) grow-entry) - :: - =. results (~(put in results) [%grab source target.i.links]) - $(links t.links) - :: - %grow - :: if :results has a %grab entry, don't add a %grow entry - ?: (~(has in results) [%grab source target.i.links]) - $(links t.links) - :: - =. results (~(put in results) [%grow source target.i.links]) - $(links t.links) - == - -- - :: |utilities:make: helper arms - :: - ::+| utilities - :: - :: +perform-schematics: helper function that performs a list of builds - :: - :: We often need to run a list of builds. This helper method will - :: depend on all :builds, will return a +build-receipt of either the - :: blocks or the first error, or a list of all completed results. - :: - :: This is a wet gate so individual callers can associate their own - :: key types with schematics. - :: - ++ perform-schematics - |* $: failure=tape - builds=(list [key=* =schematic]) - on-error=?(%fail-on-errors %filter-errors %ignore-errors) - key-bunt=* - == - ^- $: (unit (list [key=_key-bunt result=build-result])) - _out - == - :: - |^ =^ results out - =| results=(list [_key-bunt ^build (unit build-result)]) - |- - ^+ [results out] - :: - ?~ builds - [results out] - :: - =/ sub-build=^build [date.build schematic.i.builds] - =^ result out (depend-on sub-build) - =. results [[key.i.builds sub-build result] results] - :: - $(builds t.builds) - ?: =(%fail-on-errors on-error) - (check-errors results) - ?: =(%filter-errors on-error) - (filter-errors results) - (handle-rest results) - :: - ++ check-errors - |= results=(list [_key-bunt ^build (unit build-result)]) - :: - =/ braces [[' ' ' ' ~] ['{' ~] ['}' ~]] - =/ errors=(list tank) - %+ murn results - |= [* * result=(unit build-result)] - ^- (unit tank) - ?. ?=([~ %error *] result) - ~ - `[%rose braces message.u.result] - :: - ?^ errors - :- ~ - %- return-error - :- [%leaf failure] - errors - :: - (handle-rest results) - :: - ++ filter-errors - |= results=(list [_key-bunt ^build (unit build-result)]) - =. results - %+ skip results - |= [* * r=(unit build-result)] - ?=([~ %error *] r) - (handle-rest results) - :: - ++ handle-rest - |= results=(list [_key-bunt ^build (unit build-result)]) - :: if any sub-builds blocked, produce all blocked sub-builds - :: - =/ blocks=(list ^build) - %+ murn `(list [* ^build (unit build-result)])`results - |= [* sub=^build result=(unit build-result)] - ^- (unit ^build) - ?^ result - ~ - `sub - :: - ?^ blocks - [~ (return-blocks blocks)] - :: - :_ out - :- ~ - %+ turn results - |* [key=_key-bunt ^build result=(unit build-result)] - ^- [_key-bunt build-result] - [key (need result)] - -- - :: +wrap-error: wrap an error message around a failed sub-build - :: - ++ wrap-error - |= result=(unit build-result) - ^- build-receipt - :: - ?> ?=([~ %error *] result) - =/ message=tang - [[%leaf "ford: {<-.schematic.build>} failed: "] message.u.result] - :: - (return-error message) - :: +return-blocks: exit +make as a blocked build - :: - ++ return-blocks - |= builds=(list ^build) - ^- build-receipt - out(result [%blocks builds]) - :: +return-error: exit +make with a specific failure message - :: - ++ return-error - |= =tang - ^- build-receipt - out(result [%build-result %error tang]) - :: +return-result: exit +make with a completed build - :: - ++ return-result - |= =build-result - ^- build-receipt - out(result [%build-result build-result]) - :: - ++ access-cache - |= =compiler-cache-key - ^- [(unit build-result) _out] - :: - ?~ entry=(~(get by lookup.compiler-cache.state) compiler-cache-key) - [~ out(cache-access `[compiler-cache-key new=%.y])] - :: - [`val.u.entry out(cache-access `[compiler-cache-key new=%.n])] - :: - ++ depend-on - |= kid=^build - ^- [(unit build-result) _out] - :: - ?: =(kid build) - ~| [%depend-on-self (build-to-tape kid)] - !! - :: - =. sub-builds.out [kid sub-builds.out] - :: +access-build-record will mutate :results.state - :: - :: It's okay to ignore this because the accessed-builds get gathered - :: and merged during the +reduce step. - :: - =/ maybe-build-record -:(access-build-record kid) - ?~ maybe-build-record - [~ out] - :: - =* build-record u.maybe-build-record - ?: ?=(%tombstone -.build-record) - [~ out] - :: - [`build-result.build-record out] - :: +blocked-paths-to-receipt: handle the %2 case for mock - :: - :: Multiple schematics handle +toon instances. This handles the %2 case - :: for a +toon and transforms it into a +build-receipt so we depend on - :: the blocked paths correctly. - :: - ++ blocked-paths-to-receipt - |= [name=term blocked-paths=(list path)] - ^- build-receipt - :: - =/ blocks-or-failures=(list (each ^build tank)) - %+ turn blocked-paths - |= =path - :: - =/ scry-request=(unit scry-request) (path-to-scry-request path) - ?~ scry-request - [%| [%leaf "ford: {}: invalid scry path: {}"]] - :: - =* case r.beam.u.scry-request - :: - ?. ?=(%da -.case) - [%| [%leaf "ford: {}: invalid case in scry path: {}"]] - :: - =/ date=@da p.case - :: - =/ resource=(unit resource) (path-to-resource path) - ?~ resource - :- %| - [%leaf "ford: {}: invalid resource in scry path: {}"] - :: - =/ sub-schematic=schematic [%pin date %scry u.resource] - :: - [%& `^build`[date sub-schematic]] - :: - =/ failed=tang - %+ murn blocks-or-failures - |= block=(each ^build tank) - ^- (unit tank) - ?- -.block - %& ~ - %| `p.block - == - :: - ?^ failed - :: some failed - :: - out(result [%build-result %error failed]) - :: no failures - :: - =/ blocks=(list ^build) - %+ turn blocks-or-failures - |= block=(each ^build tank) - ?> ?=(%& -.block) - :: - p.block - :: - =. out - %+ roll blocks - |= [block=^build accumulator=_out] - =. out accumulator - +:(depend-on [date.block schematic.block]) - :: - (return-blocks blocks) - -- - :: |utilities:per-event: helper arms - :: - ::+| utilities - :: - :: +got-build: lookup :build in state, asserting presence - :: - ++ got-build - |= =build - ^- build-status - ~| [%ford-missing-build build=(build-to-tape build) duct=duct] - (~(got by builds.state) build) - :: +add-build: store a fresh, unstarted build in the state - :: - ++ add-build - ~/ %add-build - |= =build - ^+ state - :: don't overwrite an existing entry - :: - ?: (~(has by builds.state) build) - state - :: - %_ state - builds-by-schematic - (~(put by-schematic builds-by-schematic.state) build) - :: - builds - %+ ~(put by builds.state) build - =| =build-status - build-status(state [%untried ~]) - == - :: +remove-builds: remove builds and their sub-builds - :: - ++ remove-builds - ~/ %remove-builds - |= builds=(list build) - :: - |^ ^+ state - :: - ?~ builds - state - :: - ?~ maybe-build-status=(~(get by builds.state) i.builds) - $(builds t.builds) - =/ subs ~(tap in ~(key by subs.u.maybe-build-status)) - :: - =^ removed state (remove-single-build i.builds u.maybe-build-status) - ?. removed - $(builds t.builds) - :: - $(builds (welp t.builds subs)) - :: +remove-build: stop storing :build in the state - :: - :: Removes all linkages to and from sub-builds - :: - ++ remove-single-build - |= [=build =build-status] - ^+ [removed=| state] - :: never delete a build that something depends on - :: - ?^ clients.build-status - [removed=| state] - ?^ requesters.build-status - [removed=| state] - :: nothing depends on :build, so we'll remove it - :: - :- removed=& - :: - %_ state - builds-by-schematic - (~(del by-schematic builds-by-schematic.state) build) - :: - builds - (~(del by builds.state) build) - == - -- - :: +update-build-status: replace :build's +build-status by running a function - :: - ++ update-build-status - ~/ %update-build-status - |= [=build update-func=$-(build-status build-status)] - ^- [build-status builds=_builds.state] - :: - =/ original=build-status (got-build build) - =/ mutant=build-status (update-func original) - :: - [mutant (~(put by builds.state) build mutant)] - :: +intercepted-scry: augment real scry with local %scry build results - :: - :: Try to deduplicate requests for possibly remote resources by looking up - :: the result in local state if the real scry has no synchronous - :: answer (it produced `~`). - :: - ++ intercepted-scry - %- sloy ^- slyd - ~/ %intercepted-scry - |= [ref=* (unit (set monk)) =term =beam] - ^- (unit (unit (cask meta))) - :: if the actual scry produces a value, use that value; otherwise use local - :: - =/ scry-response (scry +<.$) - :: - ?^ scry-response - scry-response - :: - =/ vane=(unit %c) ((soft ,%c) (end 3 1 term)) - ?~ vane - ~ - =/ care=(unit care:clay) ((soft care:clay) (rsh 3 1 term)) - ?~ care - ~ - ?. ?=(%da -.r.beam) - ~ - =/ =resource [u.vane u.care rail=[[p.beam q.beam] s.beam]] - =/ =build [date=p.r.beam %scry resource] - :: look up the scry result from our permanent state - :: - :: Note: we can't freshen :build's :last-accessed date because - :: we can't mutate :state from this gate. %scry results might get - :: deleted during %wipe more quickly than they should because of this. - :: - =/ local-result -:(access-build-record build) - ?~ local-result - ~ - ?: ?=(%tombstone -.u.local-result) - ~ - :: - =/ local-cage=cage (result-to-cage build-result.u.local-result) - :: if :local-result does not nest in :type, produce an error - :: - ?. -:(nets:wa +.ref `type`p.q.local-cage) - [~ ~] - :: - [~ ~ local-cage] - :: +unblock-clients-on-duct: unblock and produce clients blocked on :build - :: - ++ unblock-clients-on-duct - =| unblocked=(list build) - ~% %unblock-clients-on-duct +>+ ~ - |= =build - ^+ [unblocked builds.state] - :: - =/ =build-status (got-build build) - :: - =/ clients=(list ^build) ~(tap in (~(get ju clients.build-status) [%duct duct])) - :: - |- - ^+ [unblocked builds.state] - ?~ clients - [unblocked builds.state] - :: - =^ client-status builds.state - %+ update-build-status i.clients - |= client-status=^build-status - :: - =. subs.client-status - %+ ~(jab by subs.client-status) build - |= original=build-relation - original(blocked |) - :: - =? state.client-status - ?& ?=(%blocked -.state.client-status) - :: - ?! - %- ~(any by subs.client-status) - |=(build-relation &(blocked verified)) - == - :: - [%unblocked ~] - client-status - :: - =? unblocked !?=(%blocked -.state.client-status) - [i.clients unblocked] - :: - $(clients t.clients) - :: +on-build-complete: handles completion of any build - :: - ++ on-build-complete - ~/ %on-build-complete - |= =build - ^+ ..execute - :: - =. ..execute (cleanup-orphaned-provisional-builds build) - :: - =/ duct-status (~(got by ducts.state) duct) - :: - =/ =build-status (got-build build) - ?: (~(has in requesters.build-status) [%duct duct]) - (on-root-build-complete build) - :: - =^ unblocked-clients builds.state (unblock-clients-on-duct build) - =. candidate-builds (~(gas in candidate-builds) unblocked-clients) - :: - ..execute - :: +on-root-build-complete: handle completion or promotion of a root build - :: - :: When a build completes for a duct, we might have to send a %made move - :: on the requesting duct and also do duct and build book-keeping. - :: - ++ on-root-build-complete - ~/ %on-root-build-complete - |= =build - ^+ ..execute - :: - =; res=_..execute - =/ duct-status=(unit duct-status) - (~(get by ducts.state.res) duct) - ?~ duct-status res - :: debugging assertions to try to track down failure in - :: +copy-build-tree-as-provisional - :: - ~| [%failed-to-preserve-live-build (build-to-tape build)] - ?> ?=(%live -.live.u.duct-status) - ~| %failed-2 - ?> ?=(^ last-sent.live.u.duct-status) - ~| %failed-3 - ?> .= build - [date.u.last-sent.live.u.duct-status root-schematic.u.duct-status] - ~| %failed-4 - ?> (~(has by builds.state.res) build) - :: - res - :: - =/ =build-status (got-build build) - =/ =duct-status (~(got by ducts.state) duct) - :: make sure we have something to send - :: - ?> ?=([%complete %value *] state.build-status) - :: send a %made move unless it's an unchanged live build - :: - =? moves - ?! - ?& ?=(%live -.live.duct-status) - ?=(^ last-sent.live.duct-status) - :: - =/ last-build-status - %- ~(got by builds.state) - [date.u.last-sent.live.duct-status schematic.build] - :: - ?> ?=(%complete -.state.last-build-status) - ?& ?=(%value -.build-record.state.last-build-status) - :: - .= build-result.build-record.state.last-build-status - build-result.build-record.state.build-status - == == - :_ moves - ^- move - :: - :* duct %give %made date.build %complete - build-result.build-record.state.build-status - == - :: - ?- -.live.duct-status - %once - =. ducts.state (~(del by ducts.state) duct) - =. state (move-root-to-cache build) - :: - ..execute - :: - %live - :: clean up previous build - :: - =? state ?=(^ last-sent.live.duct-status) - =/ old-build=^build build(date date.u.last-sent.live.duct-status) - ~? =(date.build date.old-build) - :+ "old and new builds have same date, will probably crash!" - (build-to-tape build) - (build-to-tape old-build) - :: - (remove-anchor-from-root old-build [%duct duct]) - :: - =/ resource-list=(list [=disc resources=(set resource)]) - ~(tap by (collect-live-resources build)) - :: we can only handle a single subscription - :: - :: In the long term, we need Clay's interface to change so we can - :: subscribe to multiple desks at the same time. - :: - ?: (lth 1 (lent resource-list)) - =. ..execute - %+ send-incomplete build :~ - [%leaf "root build {(build-to-tape build)}"] - [%leaf "on duct:"] - [%leaf "{}"] - [%leaf "tried to subscribe to multiple discs:"] - [%leaf "{}"] - == - :: delete this instead of caching it, since it wasn't right - :: - =. ducts.state (~(del by ducts.state) duct) - =. state (remove-anchor-from-root build [%duct duct]) - ..execute - :: - =/ subscription=(unit subscription) - ?~ resource-list - ~ - `[date.build disc.i.resource-list resources.i.resource-list] - :: - =? ..execute ?=(^ subscription) - (start-clay-subscription u.subscription) - :: - =. ducts.state - %+ ~(put by ducts.state) duct - %_ duct-status - live - [%live in-progress=~ last-sent=`[date.build subscription]] - == - :: - ..execute - == - :: +send-incomplete: emit a move indicating we can't complete :build - :: - ++ send-incomplete - |= [=build message=tang] - ^+ ..execute - :: - =. moves - :_ moves - `move`[duct %give %made date.build %incomplete message] - :: - ..execute - :: +cleanup-orphaned-provisional-builds: delete extraneous sub-builds - :: - :: Remove unverified linkages to sub builds. If a sub-build has no other - :: clients on this duct, then it is orphaned and we remove the duct from - :: its subs and call +cleanup on it. - :: - ++ cleanup-orphaned-provisional-builds - ~/ %cleanup-orphaned-provisional-builds - |= =build - ^+ ..execute - :: - =/ =build-status (got-build build) - :: - =/ orphans=(list ^build) - %+ murn ~(tap by subs.build-status) - |= [sub=^build =build-relation] - ^- (unit ^build) - :: - ?: verified.build-relation - ~ - `sub - :: dequeue orphans in case we were about to run them - :: - =/ orphan-set (~(gas in *(set ^build)) orphans) - =. next-builds (~(dif in next-builds) orphan-set) - =. candidate-builds (~(dif in candidate-builds) orphan-set) - :: remove links to orphans in :build's +build-status - :: - =^ build-status builds.state - %+ update-build-status build - |= build-status=^build-status - %_ build-status - subs - :: - |- ^+ subs.build-status - ?~ orphans subs.build-status - :: - =. subs.build-status (~(del by subs.build-status) i.orphans) - :: - $(orphans t.orphans) - == - :: - =/ =anchor [%duct duct] - :: - |- ^+ ..execute - ?~ orphans ..execute - :: remove link to :build in :i.orphan's +build-status - :: - =^ orphan-status builds.state - %+ update-build-status i.orphans - |= orphan-status=_build-status - %_ orphan-status - clients (~(del ju clients.orphan-status) anchor build) - == - :: - ?: (~(has by clients.orphan-status) anchor) - $(orphans t.orphans) - :: :build was the last client on this duct so remove it - :: - =. builds.state (remove-anchor-from-subs i.orphans anchor) - =. state (cleanup i.orphans) - $(orphans t.orphans) - :: +access-build-record: access a +build-record, updating :last-accessed - :: - :: Usage: - :: ``` - :: =^ maybe-build-record builds.state (access-build-record build) - :: ``` - :: - ++ access-build-record - ~/ %access-build-record - |= =build - ^- [(unit build-record) _builds.state] - :: - ?~ maybe-build-status=(~(get by builds.state) build) - [~ builds.state] - :: - =/ =build-status u.maybe-build-status - :: - ?. ?=(%complete -.state.build-status) - [~ builds.state] - :: - ?: ?=(%tombstone -.build-record.state.build-status) - [`build-record.state.build-status builds.state] - :: - =. last-accessed.build-record.state.build-status now - :: - :- `build-record.state.build-status - (~(put by builds.state) build build-status) - :: +cleanup: try to clean up a build and its sub-builds - :: - ++ cleanup - ~/ %cleanup - |= =build - ^+ state - :: does this build even exist?! - :: - ?~ maybe-build-status=(~(get by builds.state) build) - state - :: - =/ =build-status u.maybe-build-status - :: never delete a build that something depends on - :: - ?^ clients.build-status - state - ?^ requesters.build-status - state - :: - (remove-builds ~[build]) - :: +collect-live-resources: produces all live resources from sub-scrys - :: - ++ collect-live-resources - ~/ %collect-live-resources - |= =build - ^- (jug disc resource) - :: - ?: ?=(%scry -.schematic.build) - =* resource resource.schematic.build - (my [(extract-disc resource) (sy [resource]~)]~) - :: - ?: ?=(%pin -.schematic.build) - ~ - :: - =/ subs ~(tap in ~(key by subs:(got-build build))) - =| resources=(jug disc resource) - |- - ?~ subs - resources - :: - =/ sub-resources=(jug disc resource) ^$(build i.subs) - =. resources (unify-jugs resources sub-resources) - $(subs t.subs) - :: +collect-blocked-resources: produces all blocked resources from sub-scrys - :: - ++ collect-blocked-sub-scrys - ~/ %collect-blocked-sub-scrys - |= =build - ^- (set scry-request) - :: - ?: ?=(%scry -.schematic.build) - =, resource.schematic.build - =/ =scry-request - :+ vane care - ^- beam - [[ship.disc.rail desk.disc.rail [%da date.build]] spur.rail] - (sy [scry-request ~]) - :: only recurse on blocked sub-builds - :: - =/ subs=(list ^build) - %+ murn ~(tap by subs:(got-build build)) - |= [sub=^build =build-relation] - ^- (unit ^build) - :: - ?. blocked.build-relation - ~ - `sub - :: - =| scrys=(set scry-request) - |- - ^+ scrys - ?~ subs - scrys - :: - =. scrys (~(uni in scrys) ^$(build i.subs)) - $(subs t.subs) - :: +start-clay-subscription: listen for changes in the filesystem - :: - ++ start-clay-subscription - ~/ %start-clay-subscription - |= =subscription - ^+ ..execute - :: - =/ already-subscribed=? - (~(has by pending-subscriptions.state) subscription) - :: - =. pending-subscriptions.state - (put-request pending-subscriptions.state subscription duct) - :: don't send a duplicate move if we're already subscribed - :: - ?: already-subscribed - ..execute - :: - =/ =wire (clay-subscription-wire [date disc]:subscription) - :: - =/ =note - :: request-contents: the set of [care path]s to subscribe to in clay - :: - =/ request-contents=(set [care:clay path]) - %- sy ^- (list [care:clay path]) - %+ murn ~(tap in `(set resource)`resources.subscription) - |= =resource ^- (unit [care:clay path]) - :: - `[care.resource (flop spur.rail.resource)] - :: if :request-contents is `~`, this code is incorrect - :: - ?< ?=(~ request-contents) - :: their: requestee +ship - :: - =+ [their desk]=disc.subscription - :: - :^ %c %warp ship=their - ^- riff:clay - [desk `[%mult `case`[%da date.subscription] request-contents]] - :: - =. moves [`move`[duct [%pass wire note]] moves] - :: - ..execute - :: +cancel-clay-subscription: remove a subscription on :duct - :: - ++ cancel-clay-subscription - ~/ %cancel-clay-subscription - |= =subscription - ^+ ..execute - :: - =^ originator pending-subscriptions.state - (del-request pending-subscriptions.state subscription duct) - :: if there are still other ducts on this subscription, don't send a move - :: - ?~ originator - ..execute - :: - =/ =wire (clay-subscription-wire [date disc]:subscription) - :: - =/ =note - =+ [their desk]=disc.subscription - [%c %warp ship=their `riff:clay`[desk ~]] - :: - =. moves [`move`[u.originator [%pass wire note]] moves] - :: - ..execute - :: +clay-sub-wire: the wire to use for a clay subscription - :: - :: While it is possible for two different root builds to make - :: subscriptions with the same wire, those wires will always be associated - :: with different ducts, so there's no risk of duplicates. - :: - ++ clay-subscription-wire - |= [date=@da =disc] - ^- wire - :: - =+ [their desk]=disc - :: - /clay-sub/(scot %p their)/[desk]/(scot %da date) - :: +start-scry-request: kick off an asynchronous request for a resource - :: - ++ start-scry-request - |= =scry-request - ^+ ..execute - :: if we are the first block depending on this scry, send a move - :: - =/ already-started=? (~(has by pending-scrys.state) scry-request) - :: - =. pending-scrys.state - (put-request pending-scrys.state scry-request duct) - :: don't send a duplicate move if we've already sent one - :: - ?: already-started - ..execute - :: - =/ =wire (scry-request-wire scry-request) - :: - =/ =note - =, scry-request - =/ =disc [p q]:beam - :* %c %warp their=ship.disc desk.disc - `[%sing care case=r.beam (flop s.beam)] - == - :: - =. moves [`move`[duct [%pass wire note]] moves] - :: - ..execute - :: +cancel-scry-request: cancel a pending asynchronous scry request - :: - ++ cancel-scry-request - |= =scry-request - ^+ ..execute - :: - =^ originator pending-scrys.state - (del-request pending-scrys.state scry-request duct) - :: if there are still other ducts on this subscription, don't send a move - :: - ?~ originator - ..execute - :: - =/ =wire (scry-request-wire scry-request) - :: - =/ =note - =+ [their desk]=[p q]:beam.scry-request - [%c %warp ship=their `riff:clay`[desk ~]] - :: - =. moves [`move`[u.originator [%pass wire note]] moves] - :: - ..execute - :: +scry-request-wire - :: - ++ scry-request-wire - |= =scry-request - ^- wire - (welp /scry-request (scry-request-to-path scry-request)) - -- --- -:: -:: end the =~ -:: -. == -:: -:::: vane interface - :: -:: begin with a default +axle as a blank slate -:: -=| ax=axle -:: a vane is activated with identity, the current date, entropy, -:: and a namespace function -:: -|= [our=ship now=@da eny=@uvJ scry-gate=sley] -=* ford-gate . -:: allow jets to be registered within this core -:: -~% %ford ..is ~ -|% -:: +call: handle a +task:able from arvo -:: -:: Ford can be tasked with: -:: -:: %build: perform a build -:: %keep: resize caches -:: %kill: cancel a build -:: %wipe: clear memory -:: -:: Most requests get converted into operations to be performed inside -:: the +per-event core, which is Ford's main build engine. -:: -++ call - |= [=duct dud=(unit goof) type=* wrapped-task=(hobo task:able)] - ^- [(list move) _ford-gate] - ?^ dud - ~|(%ford-call-dud (mean tang.u.dud)) - :: - =/ task=task:able ((harden task:able) wrapped-task) - :: we wrap +per-event with a call that binds our event args - :: - =* this-event (per-event [our duct now scry-gate] state.ax) - :: - ?- -.task - :: %build: request to perform a build - :: - %build - :: perform the build indicated by :task - :: - :: We call :start-build on :this-event, which is the |per-event core - :: with the our event-args already bound. :start-build performs the - :: build and produces a pair of :moves and a mutant :state. - :: We update our :state and produce it along with :moves. - :: - =/ =build [now schematic.task] - =^ moves state.ax (start-build:this-event build live.task) - :: - [moves ford-gate] - :: - :: %keep: keep :count cache entries - :: - %keep - :: - =. state.ax (keep:this-event [compiler-cache build-cache]:task) - :: - [~ ford-gate] - :: - :: %kill: cancel a %build - :: - %kill - :: - =^ moves state.ax cancel:this-event - :: - [moves ford-gate] - :: - :: %trim: in response to memory pressure - :: - %trim - :: - ?. =(0 p.task) - :: low-priority: remove 50% of cache/stored-builds - :: - ~> %slog.[0 leaf+"ford: trim: pruning caches"] - =. state.ax (wipe:this-event 50) - [~ ford-gate] - :: - :: high-priority: remove 100% of cache/stored-builds - :: - :: We use %keep to ensure that cache-keys are also purged, - :: then restore original limits to allow future caching. - :: - :: XX cancel in-progress builds? - :: - ~> %slog.[0 leaf+"ford: trim: clearing caches"] - =/ b-max max-size.queue.build-cache.state.ax - =/ c-max max-size.compiler-cache.state.ax - =. state.ax (keep:this-event 0 0) - =. state.ax (keep:this-event c-max b-max) - [~ ford-gate] - :: - :: %vega: learn of kernel upgrade - :: - :: XX clear cache, rebuild live builds - :: - %vega - :: - [~ ford-gate] - :: - :: %wipe: wipe stored builds, clearing :percent-to-remove of the entries - :: - %wipe - :: - =. state.ax (wipe:this-event percent-to-remove.task) - :: - [~ ford-gate] - == -:: +take: receive a response from another vane -:: -:: A +take is a response to a request that Ford made of another vane. -:: -:: Ford decodes the type of response based on the +wire in the +take. -:: The possibilities are: -:: -:: %clay-sub: Clay notification of an update to a subscription -:: -:: If Ford receives this, it will rebuild one or more live builds, -:: taking into account the new date and changed resources. -:: -:: %scry-request: Clay response to a request for a resource -:: -:: If Ford receives this, it will continue building one or more builds -:: that were blocked on this resource. -:: -:: The +sign gets converted into operations to be performed inside -:: the +per-event core, which is Ford's main build engine. -:: -++ take - |= [=wire =duct dud=(unit goof) wrapped-sign=(hypo sign)] - ^- [(list move) _ford-gate] - ?^ dud - ~|(%ford-take-dud (mean tang.u.dud)) - :: unwrap :sign, ignoring unneeded +type in :p.wrapped-sign - :: - =/ =sign q.wrapped-sign - :: :wire must at least contain a tag for dispatching - :: - ?> ?=([@ *] wire) - :: - |^ ^- [(list move) _ford-gate] - :: - =^ moves state.ax - ?+ i.wire ~|([%bad-take-wire wire] !!) - %clay-sub take-rebuilds - %scry-request take-unblocks - == - :: - [moves ford-gate] - :: +take-rebuilds: rebuild all live builds affected by the Clay changes - :: - ++ take-rebuilds - ^- [(list move) ford-state] - :: - ~| [%ford-take-rebuilds wire=wire duct=duct] - ?> ?=([@tas %wris *] sign) - =* case-sign p.sign - =* care-paths-sign q.sign - =+ [ship desk date]=(raid:wired t.wire ~[%p %tas %da]) - =/ disc [ship desk] - :: ignore spurious clay updates - :: - :: Due to asynchronicity of Clay notifications, we might get a - :: subscription update on an already-canceled duct. This is - :: normal; no-op. - :: - ?~ duct-status=(~(get by ducts.state.ax) duct) - [~ state.ax] - :: - =/ =subscription - ?> ?=(%live -.live.u.duct-status) - (need subscription:(need last-sent.live.u.duct-status)) - :: - =/ ducts=(list ^duct) - :: sanity check; there must be at least one duct per subscription - :: - =- ?<(=(~ -) -) - (get-request-ducts pending-subscriptions.state.ax subscription) - :: - =| moves=(list move) - |- ^+ [moves state.ax] - ?~ ducts [moves state.ax] - :: - =* event-args [[our i.ducts now scry-gate] state.ax] - =* rebuild rebuild:(per-event event-args) - =^ duct-moves state.ax - (rebuild subscription p.case-sign disc care-paths-sign) - :: - $(ducts t.ducts, moves (weld moves duct-moves)) - :: +take-unblocks: unblock all builds waiting on this scry request - :: - ++ take-unblocks - ^- [(list move) ford-state] - :: - ~| [%ford-take-unblocks wire=wire duct=duct] - ?> ?=([@tas %writ *] sign) - =* riot-sign p.sign - :: scry-request: the +scry-request we had previously blocked on - :: - =/ =scry-request (need (path-to-scry-request t.wire)) - :: scry-result: parse a (unit cage) from :sign - :: - :: If the result is `~`, the requested resource was not available. - :: - =/ scry-result=(unit cage) - ?~ riot-sign - ~ - `r.u.riot-sign - :: if spurious Clay response, :ducts will be empty, causing no-op - :: - =/ ducts=(list ^duct) - (get-request-ducts pending-scrys.state.ax scry-request) - :: - =| moves=(list move) - |- ^+ [moves state.ax] - ?~ ducts [moves state.ax] - :: - =* event-args [[our i.ducts now scry-gate] state.ax] - :: unblock the builds that had blocked on :resource - :: - =* unblock unblock:(per-event event-args) - =^ duct-moves state.ax (unblock scry-request scry-result) - :: - $(ducts t.ducts, moves (weld moves duct-moves)) - -- -:: +load: either flush or migrate old state (called on vane reload) -:: -:: If it has the old state version, flush the ford state. Otherwise trim -:: build results in case a change to our code invalidated an old build -:: result. -:: -:: Flushing state of the old version is a temporary measure for the OS1 -:: %publish update. We can flush all build state like this because only gall -:: and %publish use ford live builds currently. :goad will handle remaking -:: builds for gall, and the new %publish does not use ford. -:: -++ load - |= old=axle - ^+ ford-gate - ?: =(%~2018.12.13 -.old) - =. -.ax %~2020.2.21 - ford-gate - =. ax [%~2020.2.21 state.old] - =. ford-gate +:(call ~[/ford-load-self] ~ *type %trim 0) - ford-gate -:: +stay: produce current state -:: -++ stay `axle`ax -:: +scry: request a path in the urbit namespace -:: -++ scry - |= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path} - ^- (unit (unit cage)) - ?. ?=(%& -.why) ~ - =* his p.why - ?: &(=(ren %$) =(tyl /whey)) - ``mass+!>([state+&+ax]~) - ~ --- From c092f9cea4ae6528a2144ebfed6529126942fd26 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 13 May 2020 14:13:26 -0700 Subject: [PATCH 122/280] hood: remove references to ford --- bin/solid.pill | 4 +- pkg/arvo/gen/hood/keep-ford.hoon | 13 ---- pkg/arvo/gen/hood/wipe-ford.hoon | 14 ---- pkg/arvo/lib/hood/kiln.hoon | 10 --- pkg/arvo/lib/strandio.hoon | 109 ------------------------------- 5 files changed, 2 insertions(+), 148 deletions(-) delete mode 100644 pkg/arvo/gen/hood/keep-ford.hoon delete mode 100644 pkg/arvo/gen/hood/wipe-ford.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 4c9621393..f6ab9b6ec 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3cc5752c31acbb4bb1dd9e4c915eb8d125a2a01f1bbc1c72e6e0ec2cf73975b -size 12444927 +oid sha256:2c2de07be164de8a840cc724294a0b6770a9fb7b9cd28026ada3ea4a9a18cbd2 +size 13198099 diff --git a/pkg/arvo/gen/hood/keep-ford.hoon b/pkg/arvo/gen/hood/keep-ford.hoon deleted file mode 100644 index 30bac8cdf..000000000 --- a/pkg/arvo/gen/hood/keep-ford.hoon +++ /dev/null @@ -1,13 +0,0 @@ -:: Kiln: resize Ford cache -:: -:::: - :: -/? 310 -:: -:::: - !: -:- %say -|= $: [now=@da eny=@uvJ bec=beak] - [[compiler-cache-size=@ud build-cache-size=@ud ~] ~] - == -[%kiln-keep-ford compiler-cache-size build-cache-size] diff --git a/pkg/arvo/gen/hood/wipe-ford.hoon b/pkg/arvo/gen/hood/wipe-ford.hoon deleted file mode 100644 index 4261e871b..000000000 --- a/pkg/arvo/gen/hood/wipe-ford.hoon +++ /dev/null @@ -1,14 +0,0 @@ -:: Kiln: wipe ford cache -:: -:::: /hoon/wipe-ford/hood/gen - :: -/? 310 -:: -:::: - !: -:- %say -|= $: [now=@da eny=@uvJ bec=beak] - [percent=@ud ~] - ~ - == -[%kiln-wipe-ford percent] diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index bed6538bc..988e65880 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -206,8 +206,6 @@ %kiln-track =;(f (f !<(_+<.f vase)) poke-track) %kiln-sync =;(f (f !<(_+<.f vase)) poke-sync) %kiln-syncs =;(f (f !<(_+<.f vase)) poke-syncs) - %kiln-wipe-ford =;(f (f !<(_+<.f vase)) poke-wipe-ford) - %kiln-keep-ford =;(f (f !<(_+<.f vase)) poke-keep-ford) %kiln-autoload =;(f (f !<(_+<.f vase)) poke-autoload) %kiln-overload =;(f (f !<(_+<.f vase)) poke-overload) %kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-goad-gall) @@ -301,14 +299,6 @@ ?> (gte start now) abet:(emit %pass /kiln/overload/(scot %dr recur) %arvo %b [%wait start]) :: -++ poke-wipe-ford - |=(percent=@ud abet:(emit %pass /kiln %arvo %f [%wipe percent])) -:: -++ poke-keep-ford - |= [compiler-cache-size=@ud build-cache-size=@ud] - =< abet - (emit %pass /kiln %arvo %f [%keep compiler-cache-size build-cache-size]) -:: ++ poke-goad-gall |= [force=? agent=(unit dude:gall)] abet:(emit %pass /kiln %arvo %g %goad force agent) diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 60f123214..8a645f153 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -386,31 +386,6 @@ ;< ~ bind:m (send-request (hiss-to-request:html hiss)) take-maybe-sigh :: -:: Run ford build -:: -++ ford-build - |= =schematic:ford - =/ m (strand ,build-result:ford) - ^- form:m - ;< ~ bind:m (send-raw-card %pass /ford-build %arvo %f %build | schematic) - ;< =made-result:ford bind:m (take-made-result /ford-build) - ?: ?=(%incomplete -.made-result) - (strand-fail %ford-incomplete tang.made-result) - (pure:m build-result.made-result) -:: Take ford build result -:: -++ take-made-result - |= =wire - =/ m (strand ,made-result:ford) - ^- form:m - |= tin=strand-input:strand - ?+ in.tin `[%skip ~] - ~ `[%wait ~] - [~ %sign * %f %made *] - ?. =(wire wire.u.in.tin) - `[%skip ~] - `[%done result.sign-arvo.u.in.tin] - == :: +build-fail: build the source file at the specified $beam :: ++ build-file @@ -450,90 +425,6 @@ (strand-fail %build-cast >arg< ~) ?> =(%tube p.r.u.riot) (pure:m !<(tube:clay q.r.u.riot)) -:: Run several taggged ford builds -:: -++ build-map - |= builds=(map path schematic:ford) - =/ m (strand ,(map path build-result:ford)) - ^- form:m - =/ schematics=(list schematic:ford) - %+ turn ~(tap by builds) - |= [=path =schematic:ford] - [[%$ %noun !>(path)] schematic] - :: - ;< =build-result:ford bind:m (ford-build %list schematics) - ?: ?=(%error -.build-result) - (strand-fail %ford-error message.build-result) - ?> ?=(%list -.+.build-result) - :: - =| produce=(map path build-result:ford) - |- ^- form:m - =* loop $ - ?^ results.build-result - ?> ?=([[%success %$ %noun *] *] +.i.results.build-result) - =. produce - %+ ~(put by produce) - !<(path q.cage.head.i.results.build-result) - tail.i.results.build-result - loop(results.build-result t.results.build-result) - (pure:m produce) -:: -:: Run several taggged ford builds -:: -++ build-cages - |= builds=(map path schematic:ford) - =/ m (strand ,(map path cage)) - ^- form:m - ;< result-map=(map path build-result:ford) bind:m (build-map builds) - =/ results=(list [=path =build-result:ford]) ~(tap by result-map) - =| produce=(map path cage) - |- ^- form:m - =* loop $ - ?^ results - ?: ?=(%error -.build-result.i.results) - (strand-fail %ford-error message.build-result.i.results) - =. produce - %+ ~(put by produce) path.i.results - (result-to-cage:ford build-result.i.results) - loop(results t.results) - (pure:m produce) -:: -:: Run ford %core build -:: -++ build-core - |= =rail:ford - =/ m (strand ,vase) - ^- form:m - ;< =build-result:ford bind:m (ford-build %core rail) - ?: ?=(%error -.build-result) - (strand-fail %ford-error message.build-result) - ?> ?=(%core -.+.build-result) - (pure:m vase.build-result) -:: -:: Run ford %core builds -:: -++ build-cores - |= rails=(map path rail:ford) - =/ m (strand ,(map path vase)) - ^- form:m - =/ builds - %- ~(run by rails) - |= =rail:ford - [%core rail] - :: - ;< result-map=(map path build-result:ford) bind:m (build-map builds) - =/ results=(list [=path =build-result:ford]) ~(tap by result-map) - =| produce=(map path vase) - |- ^- form:m - =* loop $ - ?^ results - ?: ?=(%error -.build-result.i.results) - (strand-fail %ford-error message.build-result.i.results) - ?> ?=(%core -.+.build-result.i.results) - =. produce - (~(put by produce) path.i.results vase.build-result.i.results) - loop(results t.results) - (pure:m produce) :: :: Read from Clay :: From af1a26aa5d706cb548af98bc8f904a402589a320 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 13 May 2020 17:47:19 -0700 Subject: [PATCH 123/280] clay: abort mate on conflicts --- pkg/arvo/sys/vane/clay.hoon | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 1dfcd2bca..e6fd9e7be 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1923,7 +1923,7 @@ =/ bob-diffs=cane (diff-base bob-yaki ali-yaki merge-point) =/ bof=(map path (unit cage)) (merge-conflicts can.ali-diffs can.bob-diffs) - &+`(build ali-yaki bob-yaki merge-point ali-diffs bob-diffs bof) + (build ali-yaki bob-yaki merge-point ali-diffs bob-diffs bof) =/ ali-diffs=cane (calc-diffs ali-yaki merge-point) =/ bob-diffs=cane (calc-diffs bob-yaki merge-point) =/ both-diffs=(map path *) @@ -2169,7 +2169,7 @@ dob=cane bof=(map path (unit cage)) == - ^- merge-result + ^- (each (unit merge-result) [term tang]) =/ both-patched=(map path cage) %- malt %+ murn ~(tap by bof) @@ -2219,6 +2219,8 @@ %+ skip ~(tap by (~(int by new.dal) new.dob)) |= [pax=path *] =((~(got by new.dal) pax) (~(got by new.dob) pax)) + ?: &(?=(%mate germ) ?=(^ con)) + [%| %mate-conflict ~] =/ old=(map path lobe) :: oldies but goodies %+ roll ~(tap by (~(uni by old.dal) old.dob)) =< .(old q.bas) @@ -2243,7 +2245,8 @@ =/ del=(map path ?) (~(run by (~(uni by old.dal) old.dob)) |=(~ %|)) =/ new &+[[r.bob r.ali ~] (~(run by hat) |=(=lobe |+lobe))] - :* (silt (turn ~(tap by con) head)) + :* %& ~ + (silt (turn ~(tap by con) head)) new lat == From fd26b2184e46ae7be4f40a2a29551db07bfc8cb3 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 13 May 2020 19:28:04 -0700 Subject: [PATCH 124/280] kiln: convert to fusion --- bin/solid.pill | 4 +- pkg/arvo/lib/hood/kiln.hoon | 169 +++++++++++++----------------------- pkg/arvo/sys/vane/clay.hoon | 21 +++-- pkg/arvo/sys/zuse.hoon | 2 +- 4 files changed, 77 insertions(+), 119 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index f6ab9b6ec..941ebd91d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c2de07be164de8a840cc724294a0b6770a9fb7b9cd28026ada3ea4a9a18cbd2 -size 13198099 +oid sha256:d86877601e9038c205c3ee2e2dfc646c5d3cfc6c7d144a5b5bc14e1241a9f116 +size 13136154 diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 988e65880..4b6a75e7b 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -338,8 +338,6 @@ ?+ +<.sign-arvo ~|([%kiln-bad-take-card +<.sign-arvo] !!) %done %+ done wire ?>(?=(%done +<.sign-arvo) +>.sign-arvo) - %made %+ take-made wire - ?>(?=(%made +<.sign-arvo) +>.sign-arvo) %mere %+ take-mere wire ?>(?=(%mere +<.sign-arvo) +>.sign-arvo) == @@ -349,18 +347,6 @@ |= {way/wire are/(each (set path) (pair term tang))} abet:abet:(mere:(take way) are) :: -++ take-made - |= [way=wire date=@da result=made-result:ford] - :: hack for |overload - :: - :: We might have gotten an ignorable response back for our cache priming - :: ford call. If it matches our magic wire, ignore it. - :: - ?: =(/prime/cache way) - ~& %cache-primed - abet - abet:abet:(made:(take way) date result) -:: ++ take-coup-fancy :: |= {way/wire saw/(unit tang)} abet:abet:(coup-fancy:(take way) saw) @@ -603,10 +589,7 @@ ++ coup-fancy |= saw/(unit tang) ?~ saw - => (spam leaf+"%melding %{(trip sud)} into scratch space" ~) - %- blab :_ ~ - =/ note [%merg (cat 3 syd '-scratch') her sud cas gem] - [%pass /kiln/[syd] %arvo %c note] + +> =+ :- "failed to set up conflict resolution scratch space" "I'm out of ideas" lose:(spam leaf+-< leaf+-> u.saw) @@ -620,35 +603,60 @@ =+ "merged with strategy {}" win:(spam leaf+- ?~(p.are ~ [>`(set path)`p.are< ~])) :: ~? > =(~ p.are) [%mere-no-conflict syd] - =+ "mashing conflicts" - => .(+>.$ (spam leaf+- ~)) + => .(+>.$ (spam leaf+"mashing conflicts" ~)) =+ tic=(cat 3 syd '-scratch') - %- blab :_ ~ - =, ford - :* %pass /kiln/[syd] %arvo %f - :* %build live=%.n - ^- schematic - :- %list - ^- (list schematic) - :: ~& > kiln-mashing+[p.are syd=syd +<.abet] - %+ turn ~(tap in p.are) - |= pax/path - ^- [schematic schematic] - :- [%$ %path -:!>(*path) pax] - =/ base=schematic [%scry %c %x `rail`[[our tic] (flop pax)]] - ?> ?=([%da @] cas) - =/ alis=schematic - [%pin p.cas `schematic`[%scry %c %x [[our syd] (flop pax)]]] - =/ bobs=schematic - [%scry %c %x [[our syd] (flop pax)]] - =/ dali=schematic [%diff [our syd] base alis] - =/ dbob=schematic [%diff [our syd] base bobs] - =/ for=mark - =+ (slag (dec (lent pax)) pax) - ?~(- %$ i.-) - ^- schematic - [%mash [our tic] for [[her sud] for dali] [[our syd] for dbob]] - == == + =/ notations=(list [path (unit [mark vase])]) + %+ turn ~(tap in p.are) + |= =path + =/ =mark -:(flop path) + =/ =dais .^(dais %cb /(scot %p our)/[syd]/(scot cas)/[mark]) + =/ base .^(vase %cr (weld /(scot %p our)/[tic]/(scot cas) path)) + =/ ali .^(vase %cr (weld /(scot %p her)/[sud]/(scot cas) path)) + =/ bob .^(vase %cr (weld /(scot %p our)/[syd]/(scot cas) path)) + =/ ali-dif (~(diff dais base) ali) + =/ bob-dif (~(diff dais base) bob) + =/ mash (~(mash dais base) [her sud ali-dif] [our syd bob-dif]) + :- path + ?~ mash + ~ + `[mark (~(pact dais base) u.mash)] + =/ [annotated=(list [path *]) unnotated=(list [path *])] + (skid notations |=([* v=*] ?=(^ v))) + =/ tic=desk (cat 3 syd '-scratch') + =/ tan=(list tank) + %- zing + ^- (list (list tank)) + :~ %- tape-to-tanks + """ + done setting up scratch space in {<[tic]>} + please resolve the following conflicts and run + |merge {} our {<[tic]>} + """ + %^ tanks-if-any + "annotated conflicts in:" (turn annotated head) + "" + %^ tanks-if-any + "unannotated conflicts in:" (turn unnotated head) + """ + some conflicts could not be annotated. + for these, the scratch space contains + the most recent common ancestor of the + conflicting content. + """ + == + =< win + %- blab:(spam tan) + :_ ~ + :* %pass /kiln/[syd] %arvo %c + %info + tic %& + %+ murn notations + |= [=path dif=(unit [=mark =vase])] + ^- (unit [^path miso]) + ?~ dif + ~ + `[path %mut mark.u.dif vase.u.dif] + == =+ "failed to merge with strategy meld" lose:(spam leaf+- >p.p.are< q.p.are) ?: ?=(%& -.are) @@ -688,7 +696,11 @@ => =+ :- "%mate merge failed with conflicts," "setting up scratch space at %{(trip tic)}" [tic=tic (spam leaf+-< leaf+-> q.p.are)] - (fancy-merge tic our syd %init) + =. ..mere (fancy-merge tic our syd %init) + => (spam leaf+"%melding %{(trip sud)} into scratch space" ~) + %- blab :_ ~ + =/ note [%merg (cat 3 syd '-scratch') her sud cas gem] + [%pass /kiln/[syd] %arvo %c note] == :: ++ tape-to-tanks @@ -699,68 +711,5 @@ |= {a/tape b/(list path) c/tape} ^- (list tank) ?: =(~ b) ~ (welp (tape-to-tanks "\0a{c}{a}") >b< ~) - :: - ++ made - |= [date=@da result=made-result:ford] - :: |= {dep/@uvH reg/gage:ford} - ^+ +> - :: - ?: ?=([%incomplete *] result) - =+ "failed to mash" - lose:(spam leaf+- tang.result) - ?: ?=([%complete %error *] result) - =+ "failed to mash" - lose:(spam leaf+- message.build-result.result) - ?> ?=([%complete %success %list *] result) - =/ can=(list (pair path (unit miso))) - %+ turn results.build-result.result - |= res=build-result:ford - ^- (pair path (unit miso)) - ?> ?=([%success ^ *] res) - ~! res - =+ pax=(result-to-cage:ford head.res) - =+ dif=(result-to-cage:ford tail.res) - :: - ?. ?=($path p.pax) - ~| "strange path mark: {}" - !! - [;;(path q.q.pax) ?:(?=($null p.dif) ~ `[%dif dif])] - :: ~& > kiln-made+[(turn can head) syd=syd +<.abet] - =+ notated=(skid can |=({path a/(unit miso)} ?=(^ a))) - =+ annotated=(turn `(list (pair path *))`-.notated head) - =+ unnotated=(turn `(list (pair path *))`+.notated head) - =+ `desk`(cat 3 syd '-scratch') - =/ tan=(list tank) - %- zing - ^- (list (list tank)) - :~ %- tape-to-tanks - """ - done setting up scratch space in {<[-]>} - please resolve the following conflicts and run - |merge {} our {<[-]>} - """ - %^ tanks-if-any - "annotated conflicts in:" annotated - "" - %^ tanks-if-any - "unannotated conflicts in:" unnotated - """ - some conflicts could not be annotated. - for these, the scratch space contains - the most recent common ancestor of the - conflicting content. - - """ - == - =< win - %- blab:(spam tan) - :_ ~ - :* %pass /kiln/[syd] %arvo %c - :* %info - (cat 3 syd '-scratch') %& - %+ murn can - |= {p/path q/(unit miso)} - `(unit (pair path miso))`?~(q ~ `[p u.q]) - == == -- -- diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index e6fd9e7be..a69709432 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1491,7 +1491,7 @@ ?~ cans [~ ford-cache.ford-args] =^ cage ford-cache.ford-args - ~> %slog.[0 leaf+"clay: validating {(spud path.i.cans)}"] + :: ~> %slog.[0 leaf+"clay: validating {(spud path.i.cans)}"] %- wrap:fusion (get-value:(ford:fusion ford-args) path.i.cans) =/ =lobe @@ -1694,6 +1694,8 @@ ~+ ?: =(0 let.dom) ~ + ?. =(%home syd) + ~ %- malt %+ skim ~(tap by changes) |= [=path *] @@ -2486,6 +2488,7 @@ $c ~| %casts-should-be-compiled-on-your-own-ship !! $d ~| %totally-temporary-error-please-replace-me !! $p ~| %requesting-foreign-permissions-is-invalid !! + $r ~| %no-cages-please-they-are-just-way-too-big !! $s ~| %please-dont-get-your-takos-over-a-network !! $t ~| %requesting-foreign-directory-is-vaporware !! $u ~| %prolly-poor-idea-to-get-rang-over-network !! @@ -3242,13 +3245,8 @@ |= [=yaki pax=path] ^- @uvI =+ len=(lent pax) - :: ~& read-z+[yon=yon qyt=~(wyt by q.yaki) pax=pax] =/ descendants/(list (pair path lobe)) - :: ~& %turning - :: =- ~& %turned - %+ turn - :: ~& %skimming - :: =- ~& %skimmed - %+ skim ~(tap by (~(del by q.yaki) pax)) |= {paf/path lob/lobe} =(pax (scag len paf)) @@ -3261,6 +3259,16 @@ ^- (list (pair path lobe)) [[~ ?~(us *lobe u.us)] descendants] |=({{path lobe} @uvI} (shax (jam +<))) + :: +read-r: %x wrapped in a vase + :: + ++ read-r + |= [yon=aeon pax=path] + ^- (unit (unit cage)) + =/ x (read-x yon pax) + ?~ x ~ + ?~ u.x [~ ~] + ?> ?=(%& -.u.u.x) + ``[p.p.u.u.x !>(q.p.u.u.x)] :: +read-s: produce yaki or blob for given tako or lobe :: ++ read-s @@ -3496,6 +3504,7 @@ %b (read-b yon path.mun) %c (read-c yon path.mun) %p :_(fod (read-p path.mun)) + %r :_(fod (bind (read-r yon path.mun) (lift |=(a=cage [%& a])))) %s :_(fod (bind (read-s yon path.mun) (lift |=(a=cage [%& a])))) %t :_(fod (bind (read-t yon path.mun) (lift |=(a=cage [%& a])))) %u :_(fod (read-u yon path.mun)) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 3c31b4e4a..8756688ef 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -582,7 +582,7 @@ $% {$delta p/lobe q/{p/mark q/lobe} r/page} :: delta on q {$direct p/lobe q/page} :: immediate == :: - ++ care ?($a $b $c $d $p $s $t $u $v $w $x $y $z) :: clay submode + ++ care ?($a $b $c $d $p $r $s $t $u $v $w $x $y $z) :: clay submode ++ case :: ship desk case spur $% {$da p/@da} :: date {$tas p/@tas} :: label From 2c2e16df7a8b10cb180df60634fb6145c48ab3e7 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 13 May 2020 23:26:52 -0700 Subject: [PATCH 125/280] language-server: convert to fusion --- bin/solid.pill | 4 +- pkg/arvo/app/language-server.hoon | 83 ++----- pkg/arvo/lib/language-server/complete.hoon | 4 +- pkg/arvo/lib/language-server/parser.hoon | 267 ++++++--------------- pkg/arvo/sys/vane/clay.hoon | 44 ++-- pkg/arvo/sys/zuse.hoon | 18 ++ 6 files changed, 145 insertions(+), 275 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 941ebd91d..602b81db5 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d86877601e9038c205c3ee2e2dfc646c5d3cfc6c7d144a5b5bc14e1241a9f116 -size 13136154 +oid sha256:51ea2b84964f7ae79c6c10a17610e6f812e7842659db852aaed4a9c94f20f21b +size 13136190 diff --git a/pkg/arvo/app/language-server.hoon b/pkg/arvo/app/language-server.hoon index e976d62b9..1eca035ea 100644 --- a/pkg/arvo/app/language-server.hoon +++ b/pkg/arvo/app/language-server.hoon @@ -101,7 +101,7 @@ =^ cards state ?+ sign-arvo (on-arvo:def wire sign-arvo) [%e %bound *] `state - [%f *] (handle-build:lsp wire +.sign-arvo) + [%c *] (handle-build:lsp wire +.sign-arvo) == [cards this] :: @@ -240,42 +240,25 @@ `state :: ++ handle-build - |= [=path =gift:able:ford] + |= [=path =gift:able:clay] ^- (quip card _state) - ?> ?=([%made *] gift) - ?. ?=([%complete *] result.gift) - [~ state] + ?> ?=([%writ *] gift) =/ uri=@t (snag 1 path) - =/ =build-result:ford - build-result.result.gift - ?+ build-result [~ state] - :: - [%success %plan *] - =. preludes - (~(put by preludes) uri -:vase.build-result) + =; res=(quip card _state) + [(snoc -.res (build-file | uri path)) +.res] + ?~ p.gift [~ state] - :: - [%success %core *] - =. builds - (~(put by builds) uri vase.build-result) - =. ford-diagnostics - (~(del by ford-diagnostics) uri) - :_ state - (give-rpc-notification (get-diagnostics uri)) - :: - [%error *] - =/ error-ranges=(list =range:lsp-sur) - (get-errors-from-tang:build uri message.build-result) - ?~ error-ranges - [~ state] - =. ford-diagnostics - %+ ~(put by ford-diagnostics) - uri - [i.error-ranges 1 'Build Error']~ - :_ state - (give-rpc-notification (get-diagnostics uri)) - == + =. builds + (~(put by builds) uri q.r.u.p.gift) + =. ford-diagnostics + (~(del by ford-diagnostics) uri) + =+ .^(=open:clay %cs /(scot %p our.bow)/home/(scot %da now.bow)/open) + =/ =type -:(open (uri-to-path:build uri)) + =. preludes + (~(put by preludes) uri type) + :_ state + (give-rpc-notification (get-diagnostics uri)) :: ++ get-diagnostics |= uri=@t @@ -286,20 +269,14 @@ (~(gut by ford-diagnostics) uri ~) (get-parser-diagnostics uri) :: -++ get-build-deps - |= [=path buf=wall] - ^- schematic:ford - =/ parse=(like scaffold:ford) - %+ (lsp-parser [byk.bow path]) [1 1] - (zing (join "\0a" buf)) - =/ =scaffold:ford - ?~ q.parse *scaffold:ford - p.u.q.parse - :* %plan - [[our.bow %home] (flop path)] - *coin - scaffold(sources `(list hoon)`~[[%cnts ~[[%& 1]] ~]]) - == +++ build-file + |= [eager=? uri=@t =path] + ^- card + =/ =rave:clay + ?: eager + [%sing %a da+now.bow path] + [%next %a da+now.bow path] + [%pass /ford/[uri] %arvo %c %warp our.bow %home `rave] :: ++ handle-did-open |= item=text-document-item:lsp-sur @@ -310,18 +287,10 @@ (~(put by bufs) uri.item buf) =/ =path (uri-to-path:build uri.item) - =/ =schematic:ford - [%core [our.bow %home] (flop path)] - =/ dep-schematic=schematic:ford - (get-build-deps path buf) :_ state %+ weld (give-rpc-notification (get-diagnostics uri.item)) - ^- (list card) - :~ - [%pass /ford/[uri.item] %arvo %f %build live=%.y schematic] - [%pass /ford/[uri.item]/deps %arvo %f %build live=%.y dep-schematic] - == + [(build-file & uri.item path) ~] :: ++ get-parser-diagnostics |= uri=@t @@ -329,7 +298,7 @@ =/ t=tape (zing (join "\0a" `wall`(~(got by bufs) uri))) =/ parse - (lily:auto t (lsp-parser *beam)) + (lily:auto t (lsp-parser (uri-to-path:build uri))) ?. ?=(%| -.parse) ~ =/ loc=position:lsp-sur diff --git a/pkg/arvo/lib/language-server/complete.hoon b/pkg/arvo/lib/language-server/complete.hoon index 1245c1661..eaed94cb2 100644 --- a/pkg/arvo/lib/language-server/complete.hoon +++ b/pkg/arvo/lib/language-server/complete.hoon @@ -338,11 +338,11 @@ ~? > debug %start-magick =/ magicked txt:(insert-magic pos code) ~? > debug %start-parsing - =/ res (lily magicked (language-server-parser *beam)) + =/ res (lily magicked (language-server-parser *path)) ?: ?=(%| -.res) ~? > debug [%parsing-error p.res] [%| p.res] :- %& ~? > debug %parsed-good - ((cury tab-list-hoon sut) tssg+sources.p.res) + ((cury tab-list-hoon sut) hoon.p.res) -- diff --git a/pkg/arvo/lib/language-server/parser.hoon b/pkg/arvo/lib/language-server/parser.hoon index 57d3b21a1..4564c22f0 100644 --- a/pkg/arvo/lib/language-server/parser.hoon +++ b/pkg/arvo/lib/language-server/parser.hoon @@ -1,204 +1,85 @@ :: lifted directly from ford, should probably be in zuse -=< parse-scaffold -=, ford +=, clay +=< pile-rule |% -++ parse-scaffold - |= src-beam=beam - :: - =/ hoon-parser (vang & (en-beam:format src-beam)) - |^ :: - %+ cook - |= a=[@ud (list ^cable) (list ^cable) (list ^crane) (list hoon)] - ^- scaffold - [[[p q] s]:src-beam a] - :: - %+ ifix [gay gay] - ;~ plug - :: parses the zuse version, eg "/? 309" - :: - ;~ pose - (ifix [;~(plug net wut gap) gap] dem) - (easy zuse) - == - :: pareses the structures, eg "/- types" - :: - ;~ pose - (ifix [;~(plug net hep gap) gap] (most ;~(plug com gaw) cable)) - (easy ~) - == - :: parses the libraries, eg "/+ lib1, lib2" - :: - ;~ pose - (ifix [;~(plug net lus gap) gap] (most ;~(plug com gaw) cable)) - (easy ~) - == - :: - (star ;~(sfix crane gap)) - :: - (most gap tall:hoon-parser) - == - :: +beam: parses a hood path and converts it to a beam - :: - ++ beam - %+ sear de-beam:format - ;~ pfix - net - (sear plex (stag %clsg poor)):hoon-parser - == - :: +cable: parses a +^cable, a reference to something on the filesystem - :: - :: This parses: - :: - :: `library` -> wraps `library` around the library `library` - :: `face=library` -> wraps `face` around the library `library` - :: `*library` -> exposes `library` directly to the subject - :: - ++ cable - %+ cook |=(a=^cable a) +++ pile-rule + |= pax=path + %- full + %+ ifix [gay gay] + %+ cook |=(pile +<) + ;~ pfix + :: parse optional /? and ignore + :: ;~ pose - (stag ~ ;~(pfix tar sym)) - (cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym)) - (cook |=(a=term [`a a]) sym) + (cold ~ ;~(plug net wut gap dem gap)) + (easy ~) == - :: +crane: all runes that start with / which aren't /?, /-, /+ or //. :: - ++ crane - =< apex - :: whether we allow tall form - =| allow-tall-form=? - :: - |% - ++ apex - %+ knee *^crane |. ~+ - ;~ pfix net - ;~ pose - :: `/~` hoon literal - :: - (stag %fssg ;~(pfix sig hoon)) - :: `/$` process query string - :: - (stag %fsbc ;~(pfix bus hoon)) - :: `/|` first of many options that succeeds - :: - (stag %fsbr ;~(pfix bar parse-alts)) - :: `/=` wrap a face around a crane - :: - (stag %fsts ;~(pfix tis parse-face)) - :: `/.` null terminated list - :: - (stag %fsdt ;~(pfix dot parse-list)) - :: `/,` switch by path - :: - (stag %fscm ;~(pfix com parse-switch)) - :: `/&` pass through a series of mark - :: - (stag %fspm ;~(pfix pad parse-pipe)) - :: `/_` run a crane on each file in the current directory - :: - (stag %fscb ;~(pfix cab subcrane)) - :: `/;` passes date through a gate - :: - (stag %fssm ;~(pfix mic parse-gate)) - :: `/:` evaluate at path - :: - (stag %fscl ;~(pfix col parse-at-path)) - :: `/^` cast - :: - (stag %fskt ;~(pfix ket parse-cast)) - :: `/*` run a crane on each file with current path as prefix - :: - (stag %fstr ;~(pfix tar subcrane)) - :: `/!mark/ evaluate as hoon, then pass through mark - :: - (stag %fszp ;~(pfix zap ;~(sfix sym net))) - :: `/mark/` passes current path through :mark - :: - (stag %fszy ;~(sfix sym net)) + ;~ plug + ;~ pose + ;~ sfix + %+ cook |=((list (list taut)) (zing +<)) + %+ more gap + ;~ pfix ;~(plug net hep gap) + (most ;~(plug com gaw) taut-rule) + == + gap == + (easy ~) == - :: +parse-alts: parse a set of alternatives :: - ++ parse-alts - %+ wide-or-tall - (ifix [lit rit] (most ace subcrane)) - ;~(sfix (star subcrane) gap duz) - :: +parse-face: parse a face around a subcrane - :: - ++ parse-face - %+ wide-or-tall - ;~(plug sym ;~(pfix tis subcrane)) - ;~(pfix gap ;~(plug sym subcrane)) - :: +parse-list: parse a null terminated list of cranes - :: - ++ parse-list - %+ wide-or-tall - fail - ;~(sfix (star subcrane) gap duz) - :: +parse-switch: parses a list of [path crane] - :: - ++ parse-switch - %+ wide-or-tall - fail - =- ;~(sfix (star -) gap duz) - ;~(pfix gap net ;~(plug static-path subcrane)) - :: +parse-pipe: parses a pipe of mark conversions - :: - ++ parse-pipe - %+ wide-or-tall - ;~(plug (plus ;~(sfix sym pad)) subcrane) - =+ (cook |=(a=term [a ~]) sym) - ;~(pfix gap ;~(plug - subcrane)) - :: +parse-gate: parses a gate applied to a crane - :: - ++ parse-gate - %+ wide-or-tall - ;~(plug ;~(sfix wide:hoon-parser mic) subcrane) - ;~(pfix gap ;~(plug tall:hoon-parser subcrane)) - :: +parse-at-path: parses a late bound bath - :: - ++ parse-at-path - %+ wide-or-tall - ;~(plug ;~(sfix late-bound-path col) subcrane) - ;~(pfix gap ;~(plug late-bound-path subcrane)) - :: +parse-cast: parses a mold and then the subcrane to apply that mold to - :: - ++ parse-cast - %+ wide-or-tall - ;~(plug ;~(sfix wyde:hoon-parser ket) subcrane) - ;~(pfix gap ;~(plug till:hoon-parser subcrane)) - :: +subcrane: parses a subcrane - :: - ++ subcrane - %+ wide-or-tall - apex(allow-tall-form |) - ;~(pfix gap apex) - :: +wide-or-tall: parses tall form hoon if :allow-tall-form is %.y - :: - ++ wide-or-tall - |* [wide=rule tall=rule] - ?. allow-tall-form wide - ;~(pose wide tall) - :: +hoon: parses hoon as an argument to a crane - :: - ++ hoon - %+ wide-or-tall - (ifix [lac rac] (stag %cltr (most ace wide:hoon-parser))) - ;~(pfix gap tall:hoon-parser) - -- - :: +static-path: parses a path - :: - ++ static-path - (sear plex (stag %clsg (more net hasp))):hoon-parser - :: +late-bound-path: a path whose time varies - :: - ++ late-bound-path - ;~ pfix net - %+ cook |=(a=truss a) - => hoon-parser - ;~ plug - (stag ~ gash) - ;~(pose (stag ~ ;~(pfix cen porc)) (easy ~)) + ;~ pose + ;~ sfix + %+ cook |=((list (list taut)) (zing +<)) + %+ more gap + ;~ pfix ;~(plug net lus gap) + (most ;~(plug com gaw) taut-rule) + == + gap + == + (easy ~) == + :: + ;~ pose + ;~ sfix + %+ cook |=((list [face=term =path]) +<) + %+ more gap + ;~ pfix ;~(plug net tis gap) + %+ cook |=([term path] +<) + ;~(plug sym ;~(pfix ;~(plug gap net) (more net urs:ab))) + == + gap + == + (easy ~) + == + :: + ;~ pose + ;~ sfix + %+ cook |=((list [face=term =mark =path]) +<) + %+ more gap + ;~ pfix ;~(plug net tar gap) + %+ cook |=([term mark path] +<) + ;~ plug + sym + ;~(pfix ;~(plug gap cen) sym) + ;~(pfix ;~(plug gap net) (more net urs:ab)) + == + == + gap + == + (easy ~) + == + :: + %+ cook |=(huz=(list hoon) `hoon`tssg+huz) + (most gap tall:(vang & pax)) == - -- + == +:: +++ taut-rule + %+ cook |=(taut +<) + ;~ pose + (stag ~ ;~(pfix tar sym)) + ;~(plug (stag ~ sym) ;~(pfix tis sym)) + (cook |=(a=term [`a a]) sym) + == -- diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index a69709432..abb84b0d0 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -396,23 +396,6 @@ ++ fusion => |% - :: $pile: preprocessed hoon source file - :: - :: /- sur-file :: surface imports from /sur - :: /+ lib-file :: library imports from /lib - :: /= face /path :: imports built hoon file at path - :: /* face %mark /path :: unbuilt file imports, as mark - :: - +$ pile - $: sur=(list taut) - lib=(list taut) - raw=(list [face=term =path]) - bar=(list [face=term =mark =path]) - =hoon - == - :: $taut: file import from /lib or /sur - :: - +$ taut [face=(unit term) pax=term] :: +an: $ankh interface door :: ++ an @@ -725,6 +708,17 @@ =^ syd=dais nub (get-mark p.diff) :_(nub [p.old (~(pact dys (vale:dys q.old)) (vale:syd q.diff))]) :: + ++ prelude + |= =path + ^- vase + =^ cag=cage nub (get-value path) + ?> =(%hoon p.cag) + =/ tex=tape (trip !<(@t q.cag)) + =/ =pile (parse-pile path tex) + =. hoon.pile !,(*hoon .) + =^ res=vase nub (run-pile pile) + res + :: ++ build-file |= =path ^- [vase state] @@ -741,14 +735,19 @@ ?> =(%hoon p.cag) =/ tex=tape (trip !<(@t q.cag)) =/ =pile (parse-pile path tex) + =^ res=vase nub (run-pile pile) + =^ top stack.nub pop-stack + =. vases.cache.nub (~(put by vases.cache.nub) path [res top]) + [res nub] + :: + ++ run-pile + |= =pile =^ sut=vase nub run-reef =^ sut=vase nub (run-tauts sut %sur sur.pile) =^ sut=vase nub (run-tauts sut %lib lib.pile) =^ sut=vase nub (run-raw sut raw.pile) =^ sut=vase nub (run-bar sut bar.pile) =/ res=vase (slap sut hoon.pile) - =^ top stack.nub pop-stack - =. vases.cache.nub (~(put by vases.cache.nub) path [res top]) [res nub] :: ++ parse-pile @@ -1782,7 +1781,7 @@ :: ++ reload-all =/ vanes=(list term) - ~[%ames %behn %clay %dill %eyre %ford %gall %iris %jael] + ~[%ames %behn %clay %dill %eyre %gall %iris %jael] |- ^+ ..park ?~ vanes ..park @@ -3274,7 +3273,7 @@ ++ read-s |= [yon=aeon pax=path] ^- (unit (unit cage)) - ?. ?=([?(%yaki %blob %hash %cage) * ~] pax) + ?. ?=([?(%yaki %blob %hash %cage %open) * ~] pax) `~ ?- i.pax %yaki @@ -3306,6 +3305,9 @@ %- wrap:fusion (page-to-cage:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) page) ``cage+[-:!>(*^cage) cage] + :: + %open + ``open+!>(prelude:(ford:fusion ank.dom ~ ~ lat.ran fod.dom)) == :: +read-t: produce the list of paths within a yaki with :pax as prefix :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 8756688ef..88ec968e0 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -639,6 +639,7 @@ $% {%& p/suba} :: delta {%| p/@tas} :: label == :: + ++ open $-(path vase) :: get prelude ++ page (cask *) :: untyped cage ++ plop blob :: unvalidated blob ++ rang :: repository @@ -707,6 +708,23 @@ %^ cat 7 (sham [%yaki (roll p add) q t]) (sham [%tako (roll p add) q t]) [p q has t] + :: $pile: preprocessed hoon source file + :: + :: /- sur-file :: surface imports from /sur + :: /+ lib-file :: library imports from /lib + :: /= face /path :: imports built hoon file at path + :: /* face %mark /path :: unbuilt file imports, as mark + :: + +$ pile + $: sur=(list taut) + lib=(list taut) + raw=(list [face=term =path]) + bar=(list [face=term =mark =path]) + =hoon + == + :: $taut: file import from /lib or /sur + :: + +$ taut [face=(unit term) pax=term] :: $mars: mark conversion request :: $tube: mark conversion gate :: From e95f34a3253765d11c81e6c89d40ebbd89dc32e7 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 13 May 2020 23:42:44 -0700 Subject: [PATCH 126/280] write: convert to fusion --- pkg/arvo/lib/hood/write.hoon | 46 ++++++++---------------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/pkg/arvo/lib/hood/write.hoon b/pkg/arvo/lib/hood/write.hoon index b958711ff..dee25db78 100644 --- a/pkg/arvo/lib/hood/write.hoon +++ b/pkg/arvo/lib/hood/write.hoon @@ -89,18 +89,14 @@ ++ poke--data |= {{ext/(unit @t) pax/path} dat/data} ^+ abet ?~ ext $(ext [~ -.dat]) - =+ cay=?-(-.dat $json [-.dat !>(+.dat)], $mime [-.dat !>(+.dat)]) - ?: =(u.ext -.dat) - (made pax now [%complete %success %$ cay]) - =< abet - %- emit :* - %pass write+pax %arvo %f - %build - live=%.n :: XX defer %nice - ^- schematic:ford :: SYNTAX ERROR AT START OF LINE? - =/ =beak beak-now - [%cast [p q]:beak u.ext [%$ cay]] - == + =/ cay=cage ?-(-.dat $json [-.dat !>(+.dat)], $mime [-.dat !>(+.dat)]) + =/ =cage + ?: =(u.ext -.dat) + cay + =+ .^(=tube:clay %cc /(scot %p our)/home/(scot %da now)/[p.cay]/[u.ext]) + [u.ext (tube q.cay)] + =- abet:(emit %pass /write %arvo %c %info -) + (foal :(welp (en-beam beak-now ~) pax /[-.cage]) cage) :: ++ poke |= [=mark =vase] @@ -111,31 +107,9 @@ %write-wipe =;(f (f !<(_+<.f vase)) poke-wipe) == :: -++ made - |= [pax=wire date=@da result=made-result:ford] - ^+ abet - :: |= {pax/wire @ res/gage:ford} ^+ abet - :: ?. =(our src) - :: ~|(foreign-write/[our=our src=src] !!) - ?: ?=(%incomplete -.result) - (mean tang.result) - :: - =/ build-result build-result.result - :: - ?: ?=([%error *] build-result) - (mean message.build-result) - :: - =/ =cage (result-to-cage:ford build-result) - :: - =- abet:(emit %pass /write %arvo %c %info -) - :: - (foal :(welp (en-beam beak-now ~) pax /[-.cage]) cage) -:: -++ take :: +++ take |= [=wire =sign-arvo] - %+ made wire - ?> ?=(%made +<.sign-arvo) - +>.sign-arvo + !! :: ++ take-agent |= [=wire =sign:agent:gall] From a874ab4355c943aea14b4c78c5b40b7829f2a241 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 14 May 2020 00:22:39 -0700 Subject: [PATCH 127/280] zuse: remove +ford --- bin/solid.pill | 4 +- pkg/arvo/app/aqua.hoon | 1 - pkg/arvo/app/dojo.hoon | 21 +- pkg/arvo/app/language-server.hoon | 10 +- pkg/arvo/app/publish.hoon | 15 - pkg/arvo/app/test.hoon | 1 - pkg/arvo/gen/hood/autoload.hoon | 14 - pkg/arvo/gen/hood/overload.hoon | 13 - pkg/arvo/gen/hood/reboot.hoon | 2 +- pkg/arvo/gen/hood/rf.hoon | 13 - pkg/arvo/gen/metal.hoon | 4 - pkg/arvo/lib/hood/kiln.hoon | 123 ----- pkg/arvo/lib/test/ford-external.hoon | 267 ---------- pkg/arvo/lib/test/ford.hoon | 341 ------------- pkg/arvo/sys/vane/gall.hoon | 221 +++++++- pkg/arvo/sys/zuse.hoon | 720 +-------------------------- pkg/arvo/ted/up.hoon | 33 -- pkg/arvo/tests/sys/vane/clay.hoon | 448 +---------------- pkg/arvo/tests/sys/vane/eyre.hoon | 2 +- 19 files changed, 248 insertions(+), 2005 deletions(-) delete mode 100644 pkg/arvo/gen/hood/autoload.hoon delete mode 100644 pkg/arvo/gen/hood/overload.hoon delete mode 100644 pkg/arvo/gen/hood/rf.hoon delete mode 100644 pkg/arvo/lib/test/ford-external.hoon delete mode 100644 pkg/arvo/lib/test/ford.hoon delete mode 100644 pkg/arvo/ted/up.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 602b81db5..6610aa14f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51ea2b84964f7ae79c6c10a17610e6f812e7842659db852aaed4a9c94f20f21b -size 13136190 +oid sha256:600d74621bc74756d0488dc38dce8cc7a56c560ca0aa276f0cde81eadac35832 +size 13077251 diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index cacb97283..d961331ba 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -382,7 +382,6 @@ %c %clay %d %dill %e %eyre - %f %ford %g %gall %j %jael %g %gall diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 579cc383b..0e396a70d 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -22,10 +22,10 @@ poy/(unit dojo-project) :: working $: :: sur: structure imports :: - sur=(list cable:ford) + sur=(list cable:clay) :: lib: library imports :: - lib=(list cable:ford) + lib=(list cable:clay) == var/(map term cage) :: variable state old/(set term) :: used TLVs @@ -88,7 +88,7 @@ $: mad/dojo-command :: operation num/@ud :: number of tasks cud/(unit dojo-source) :: now solving - pux/(unit path) :: ford working + pux/(unit path) :: working pro/(unit vase) :: prompting loop per/(unit sole-edit) :: pending reverse job/(map @ud dojo-build) :: problems @@ -187,13 +187,13 @@ :: ++ parse-cables %+ cook - |= cables=(list cable:ford) + |= cables=(list cable:clay) :+ 0 %ex ^- hoon :: :- %clsg %+ turn cables - |= cable=cable:ford + |= cable=cable:clay ^- hoon :: :+ %clhp @@ -204,7 +204,7 @@ (most ;~(plug com gaw) parse-cable) :: ++ parse-cable - %+ cook |=(a=cable:ford a) + %+ cook |=(a=cable:clay a) ;~ pose (stag ~ ;~(pfix tar sym)) (cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym)) @@ -322,9 +322,7 @@ dir dir(r [%da now.hid]) :: - ++ he-disc `disc:ford`[p q]:he-beam ++ he-beak `beak`[p q r]:he-beam - ++ he-rail `rail:ford`[[p q] s]:he-beam ++ he-parser (parser-at our.hid he-beam) :: ++ dy :: project work @@ -359,7 +357,8 @@ :: really shoud stop the thread as well :: [%pass u.pux %agent [our.hid %spider] %leave ~] - [%pass u.pux %arvo %f %kill ~] + =/ [=ship =desk =case:clay] he-beak + [%pass u.pux %arvo %c %warp ship desk ~] :: ++ dy-errd :: reject change, abet |= {rev/(unit sole-edit) err/@u} @@ -526,13 +525,13 @@ $lib %_ . lib - ((dy-cast (list cable:ford) !>(*(list cable:ford))) q.cay) + ((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay) == :: $sur %_ . sur - ((dy-cast (list cable:ford) !>(*(list cable:ford))) q.cay) + ((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay) == :: $dir =+ ^= pax ^- path diff --git a/pkg/arvo/app/language-server.hoon b/pkg/arvo/app/language-server.hoon index 1eca035ea..3ad37f516 100644 --- a/pkg/arvo/app/language-server.hoon +++ b/pkg/arvo/app/language-server.hoon @@ -192,13 +192,10 @@ ^- (quip card _state) ~& > %lsp-shutdown :_ *state-zero - %- zing %+ turn ~(tap in ~(key by builds)) |= uri=@t - :+ [%pass /ford/[uri] %arvo %f %kill ~] - [%pass /ford/[uri]/deps %arvo %f %kill ~] - ~ + [%pass /ford/[uri] %arvo %c %warp our.bow %home ~] :: ++ handle-did-close |= [uri=@t version=(unit @)] @@ -210,10 +207,7 @@ =. builds (~(del by builds) uri) :_ state - :~ - [%pass /ford/[uri] %arvo %f %kill ~] - [%pass /ford/[uri]/deps %arvo %f %kill ~] - == + [%pass /ford/[uri] %arvo %c %warp our.bow %home ~]~ :: ++ handle-did-save |= [uri=@t version=(unit @)] diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index 9896f8a63..c93ab8ba2 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -155,7 +155,6 @@ ~(wyt by u.inv) :_ this(state [%2 new-state]) ;: weld - kill-builds kick-cards init-cards (move-files old-subs) @@ -176,20 +175,6 @@ [~ subs] [[%give %kick paths ~]~ subs] :: - ++ kill-builds - ^- (list card) - %- zing - %+ turn ~(tap by pubs.zero) - |= [col-name=@tas col-data=collection-zero] - ^- (list card) - :- [%pass /collection/[col-name] %arvo %f %kill ~] - %- zing - %+ turn ~(tap by pos.col-data) - |= [pos-name=@tas *] - :~ [%pass /post/[col-name]/[pos-name] %arvo %f %kill ~] - [%pass /comments/[col-name]/[pos-name] %arvo %f %kill ~] - == - :: ++ send-invites |= [book=@tas subscribers=(set @p)] ^- (list card) diff --git a/pkg/arvo/app/test.hoon b/pkg/arvo/app/test.hoon index 07cf19106..d081f2897 100644 --- a/pkg/arvo/app/test.hoon +++ b/pkg/arvo/app/test.hoon @@ -10,7 +10,6 @@ mar-ok=? == -- -=, ford =, format ^- agent:gall =| =state diff --git a/pkg/arvo/gen/hood/autoload.hoon b/pkg/arvo/gen/hood/autoload.hoon deleted file mode 100644 index f31fe68d5..000000000 --- a/pkg/arvo/gen/hood/autoload.hoon +++ /dev/null @@ -1,14 +0,0 @@ -:: Helm: Disable/enable/toggle auto-reload of kernel components -:: -:::: /hoon/autoload/hood/gen - :: -/? 310 -:: -:::: - :: -:- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/?(~ {? ~}) ~} - == -:- %kiln-autoload -`(unit ?)`?~(arg ~ `-.arg) diff --git a/pkg/arvo/gen/hood/overload.hoon b/pkg/arvo/gen/hood/overload.hoon deleted file mode 100644 index 5be499e2d..000000000 --- a/pkg/arvo/gen/hood/overload.hoon +++ /dev/null @@ -1,13 +0,0 @@ -:: Kiln: regularly clear %ford cache XX find relevant leak -:: -:::: /hoon/overload/hood/gen - :: -/? 310 -:: -:::: - :: -:- %say -|= $: {now/@da eny/@uvJ bec/beak} - {{recur/@dr start/@da ~} ~} - == -[%kiln-overload recur start] diff --git a/pkg/arvo/gen/hood/reboot.hoon b/pkg/arvo/gen/hood/reboot.hoon index cce93c26f..f9afb0a3c 100644 --- a/pkg/arvo/gen/hood/reboot.hoon +++ b/pkg/arvo/gen/hood/reboot.hoon @@ -10,4 +10,4 @@ |= $: {now/@da eny/@uvJ bec/beak} {arg/~ ~} == -[%helm-reload ~[%z %a %b %c %d %e %f %g %i %j]] +[%helm-reload ~[%z %a %b %c %d %e %g %i %j]] diff --git a/pkg/arvo/gen/hood/rf.hoon b/pkg/arvo/gen/hood/rf.hoon deleted file mode 100644 index c1b6fa061..000000000 --- a/pkg/arvo/gen/hood/rf.hoon +++ /dev/null @@ -1,13 +0,0 @@ -:: Helm: Reload %ford -:: -:::: /hoon/rf/hood/gen - :: -/? 310 -:: -:::: - :: -:- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/~ ~} - == -[%helm-reload ~[%f]] diff --git a/pkg/arvo/gen/metal.hoon b/pkg/arvo/gen/metal.hoon index 146b1ffb4..884dc0334 100644 --- a/pkg/arvo/gen/metal.hoon +++ b/pkg/arvo/gen/metal.hoon @@ -206,10 +206,6 @@ :: (vent %e /vane/eyre) :: - :: sys/vane/ford: build - :: - (vent %f /vane/ford) - :: :: sys/vane/gall: applications :: (vent %g /vane/gall) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 4b6a75e7b..94beb0aee 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -190,8 +190,6 @@ =/ =rite [%r ~ ?:(pub %black %white) ~] [%pass /kiln/permission %arvo %c [%perm syd pax rite]] :: -++ poke-autoload |=(lod/(unit ?) abet:(poke:autoload lod)) -++ poke-start-autoload |=(~ abet:start:autoload) ++ poke |= [=mark =vase] ?+ mark ~|([%poke-kiln-bad-mark mark] !!) @@ -206,99 +204,14 @@ %kiln-track =;(f (f !<(_+<.f vase)) poke-track) %kiln-sync =;(f (f !<(_+<.f vase)) poke-sync) %kiln-syncs =;(f (f !<(_+<.f vase)) poke-syncs) - %kiln-autoload =;(f (f !<(_+<.f vase)) poke-autoload) - %kiln-overload =;(f (f !<(_+<.f vase)) poke-overload) %kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-goad-gall) %kiln-unmount =;(f (f !<(_+<.f vase)) poke-unmount) %kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync) %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) %kiln-cancel-autocommit =;(f (f !<(_+<.f vase)) poke-cancel-autocommit) - %kiln-start-autoload =;(f (f !<(_+<.f vase)) poke-start-autoload) %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) == :: -++ autoload - |% - ++ emit - |= a/card:agent:gall - +>(..autoload (^emit a)) - :: - ++ tracked-vanes - ^- (list @tas) - ~[%ames %behn %clay %dill %eyre %ford %gall %iris %jael] - :: - ++ our-home /(scot %p our)/home/(scot %da now) - ++ sys-hash |=(pax/path .^(@uvI %cz :(welp our-home /sys pax))) - ++ hash-vane - |= syd/@tas ^- (pair term @uvI) - [syd (sys-hash /vane/[syd]/hoon)] - :: - ++ rehash-vanes - ^+ cur-vanes - (malt (turn tracked-vanes hash-vane)) - :: - :: - ++ poke - |= lod/(unit ?) - ?^ lod - ..autoload(autoload-on u.lod) - =. autoload-on !autoload-on - (spam leaf+"turned autoload {?:(autoload-on "on" "off")}" ~) - :: - ++ start - =. cur-hoon (sys-hash /hoon/hoon) - =. cur-arvo (sys-hash /arvo/hoon) - =. cur-zuse (sys-hash /zuse/hoon) - =. cur-vanes rehash-vanes - subscribe-next - :: - ++ subscribe-next - %- emit - [%pass /kiln/autoload %arvo %c [%warp our %home `[%next %z da+now /sys]]] - :: - ++ writ =>(check-new subscribe-next) - ++ check-new - ?. autoload-on - ..check-new - =/ new-hoon (sys-hash /hoon/hoon) - =/ new-arvo (sys-hash /arvo/hoon) - ?: |(!=(new-hoon cur-hoon) !=(new-arvo cur-arvo)) - =. cur-hoon new-hoon - =. cur-arvo new-arvo - =. cur-vanes rehash-vanes - (emit %pass /kiln/reload/hoon %agent [our %hood] %poke %helm-reset !>(~)) - :: XX updates cur-vanes? - =/ new-zuse (sys-hash /zuse/hoon) - ?: !=(new-zuse cur-zuse) - =. cur-zuse new-zuse - =. cur-vanes rehash-vanes - =/ =cage [%helm-reload !>([%zuse tracked-vanes])] - (emit [%pass /kiln/reload/zuse %agent [our %hood] %poke cage]) - (roll tracked-vanes load-vane) - :: - ++ load-vane - =< %_(. con ..load-vane) - |: $:{syd/@tas con/_.} - =. +>.$ con - =/ new-vane q:(hash-vane syd) - ?: =(`new-vane (~(get by cur-vanes) syd)) - +>.$ - =. cur-vanes (~(put by cur-vanes) syd new-vane) - =/ =cage [%helm-reload !>(~[syd])] - (emit %pass /kiln/reload/[syd] %agent [our %hood] %poke cage) - :: - ++ coup-reload - |= {way/wire saw/(unit tang)} - ~? ?=(^ saw) [%kiln-reload-lame u.saw] - +>.$ - -- -:: -++ poke-overload - :: +poke-overload: wipes ford cache at {start}, and then every {recur}. - |= [recur=@dr start=@da] - ?> (gte start now) - abet:(emit %pass /kiln/overload/(scot %dr recur) %arvo %b [%wait start]) -:: ++ poke-goad-gall |= [force=? agent=(unit dude:gall)] abet:(emit %pass /kiln %arvo %g %goad force agent) @@ -313,8 +226,6 @@ ?+ wire ~|([%kiln-bad-take-agent wire -.sign] !!) [%kiln %fancy *] ?> ?=(%poke-ack -.sign) (take-coup-fancy t.t.wire p.sign) - [%kiln %reload *] ?> ?=(%poke-ack -.sign) - (take-coup-reload t.t.wire p.sign) [%kiln %spam *] ?> ?=(%poke-ack -.sign) (take-coup-spam t.t.wire p.sign) == @@ -324,14 +235,10 @@ ?- wire [%sync %merg *] %+ take-mere-sync t.t.wire ?>(?=(%mere +<.sign-arvo) +>.sign-arvo) - [%autoload *] %+ take-writ-autoload t.wire - ?>(?=(%writ +<.sign-arvo) +>.sign-arvo) [%find-ship *] %+ take-writ-find-ship t.wire ?>(?=(%writ +<.sign-arvo) +>.sign-arvo) [%sync *] %+ take-writ-sync t.wire ?>(?=(%writ +<.sign-arvo) +>.sign-arvo) - [%overload *] %+ take-wake-overload t.wire - ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) [%autocommit *] %+ take-wake-autocommit t.wire ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) * @@ -351,10 +258,6 @@ |= {way/wire saw/(unit tang)} abet:abet:(coup-fancy:(take way) saw) :: -++ take-coup-reload :: - |= {way/wire saw/(unit tang)} - abet:(coup-reload:autoload way saw) -:: ++ take-coup-spam :: |= {way/wire saw/(unit tang)} ~? ?=(^ saw) [%kiln-spam-lame u.saw] @@ -390,23 +293,6 @@ == abet:abet:(writ:(auto hos) rot) :: -++ take-writ-autoload - |= {way/wire rot/riot} - ?> ?=(~ way) - ?> ?=(^ rot) - abet:writ:autoload -:: -++ take-wake-overload - |= {way/wire error=(unit tang)} - ?^ error - %- (slog u.error) - ~& %kiln-take-wake-overload-fail - abet - ?> ?=({@ ~} way) - =+ tym=(slav %dr i.way) - ~& %wake-overload-deprecated - abet -:: ++ take-wake-autocommit |= [way=wire error=(unit tang)] ?^ error @@ -553,15 +439,6 @@ ~| %kiln-work-fail . :: - ++ ford-fail - |=(tan/tang ~|(%ford-fail (mean tan))) - :: - ++ unwrap-tang - |* res/(each * tang) - ?: ?=(%& -.res) - p.res - (ford-fail p.res) - :: ++ perform :: ^+ . (blab [%pass /kiln/[syd] %arvo %c [%merg syd her sud cas gem]] ~) diff --git a/pkg/arvo/lib/test/ford-external.hoon b/pkg/arvo/lib/test/ford-external.hoon deleted file mode 100644 index 304dfa69f..000000000 --- a/pkg/arvo/lib/test/ford-external.hoon +++ /dev/null @@ -1,267 +0,0 @@ -/+ *test -=, ford -|% -:: +expect-schematic: assert a +schematic:ford is what we expect -:: -:: Since Ford requests contain types, we can't do simple -:: equality checking. This function handles all the different -:: kinds of +schematic:ford, dealing with types as necessary. -:: -++ expect-schematic - |= [expected=schematic actual=schematic] - ^- tang - :: - ?^ -.expected - ?. ?=(^ -.actual) - [%leaf "expected autocons, but got {<-.actual>}"]~ - :: - %+ weld - $(expected head.expected, actual head.actual) - $(expected tail.expected, actual tail.actual) - :: - ?- -.expected - %$ - ?. ?=(%$ -.actual) - [%leaf "expected %$, but got {<-.actual>}"]~ - :: - %+ weld - (expect-eq !>(p.literal.expected) !>(p.literal.actual)) - (expect-eq q.literal.expected q.literal.actual) - :: - %pin - :: - ?. ?=(%pin -.actual) - [%leaf "expected %pin, but got {<-.actual>}"]~ - :: - %+ weld - (expect-eq !>(date.expected) !>(date.actual)) - $(expected schematic.expected, actual schematic.actual) - :: - %alts - :: - ?. ?=(%alts -.actual) - [%leaf "expected %alts, but got {<-.actual>}"]~ - :: - |- ^- tang - ?~ choices.expected - :: make sure there aren't any extra :choices in :actual - :: - ?~ choices.actual - ~ - [%leaf "actual had more choices than expected"]~ - :: :expected isn't empty yet; make sure :actual isn't either - :: - ?~ choices.actual - [%leaf "expected had more choices than actual"]~ - :: recurse on the first sub-schematic - :: - %+ weld - ^$(expected i.choices.expected, actual i.choices.actual) - $(choices.expected t.choices.expected, choices.actual t.choices.actual) - :: - %bake - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %bunt - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %call - :: - ?. ?=(%call -.actual) - [%leaf "expected %call, but got {<-.actual>}"]~ - :: - %+ weld - $(expected gate.expected, actual gate.actual) - $(expected sample.expected, actual sample.actual) - :: - %cast - :: - ?. ?=(%cast -.actual) - [%leaf "expected %cast, but got {<-.actual>}"]~ - :: - ;: weld - (expect-eq !>(disc.expected) !>(disc.actual)) - (expect-eq !>(mark.expected) !>(mark.actual)) - $(expected input.expected, actual input.actual) - == - :: - %core - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %diff - :: - ?. ?=(%diff -.actual) - [%leaf "expected %diff, but got {<-.actual>}"]~ - :: - ;: weld - (expect-eq !>(disc.expected) !>(disc.actual)) - $(expected start.expected, actual start.actual) - $(expected end.expected, actual end.actual) - == - :: - %dude - :: - ?. ?=(%dude -.actual) - [%leaf "expected %dude, but got {<-.actual>}"]~ - :: - %+ weld - (expect-eq !>(error.expected) !>(error.actual)) - $(expected attempt.expected, actual attempt.actual) - :: - %hood - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %join - :: - ?. ?=(%join -.actual) - [%leaf "expected %join, but got {<-.actual>}"]~ - :: - ;: weld - (expect-eq !>(disc.expected) !>(disc.actual)) - (expect-eq !>(mark.expected) !>(mark.actual)) - $(expected first.expected, actual first.actual) - $(expected second.expected, actual second.actual) - == - :: - %list - :: - ?. ?=(%list -.actual) - [%leaf "expected %list, but got {<-.actual>}"]~ - :: - |- ^- tang - ?~ schematics.expected - :: make sure there aren't any extra :schematics in :actual - :: - ?~ schematics.actual - ~ - [%leaf "actual had more schematics than expected"]~ - :: :expected isn't empty yet; make sure :actual isn't either - :: - ?~ schematics.actual - [%leaf "expected had more schematics than actual"]~ - :: - %+ weld - ^$(expected i.schematics.expected, actual i.schematics.actual) - :: - %_ $ - schematics.expected t.schematics.expected - schematics.actual t.schematics.actual - == - :: - %mash - :: - ?. ?=(%mash -.actual) - [%leaf "expected %mash, but got {<-.actual>}"]~ - :: - ;: weld - (expect-eq !>(disc.expected) !>(disc.actual)) - (expect-eq !>(mark.expected) !>(mark.actual)) - (expect-eq !>(disc.first.expected) !>(disc.first.actual)) - (expect-eq !>(mark.first.expected) !>(mark.first.actual)) - (expect-eq !>(disc.second.expected) !>(disc.second.actual)) - (expect-eq !>(mark.second.expected) !>(mark.second.actual)) - $(expected schematic.first.expected, actual schematic.first.actual) - $(expected schematic.second.expected, actual schematic.second.actual) - == - :: - %mute - :: - ?. ?=(%mute -.actual) - [%leaf "expected %mute, but got {<-.actual>}"]~ - :: - %+ weld $(expected subject.expected, actual subject.actual) - :: - |- ^- tang - ?~ mutations.expected - :: make sure there aren't any extra :mutations in :actual - :: - ?~ mutations.actual - ~ - [%leaf "actual had more mutations than expected"]~ - :: :expected isn't empty yet; make sure :actual isn't either - :: - ?~ mutations.actual - [%leaf "expected had more mutations than actual"]~ - :: - ;: weld - (expect-eq !>(p.i.mutations.expected) !>(p.i.mutations.actual)) - ^$(expected q.i.mutations.expected, actual q.i.mutations.actual) - %_ $ - mutations.expected t.mutations.expected - mutations.actual t.mutations.actual - == - == - :: - %pact - :: - ?. ?=(%pact -.actual) - [%leaf "expected %pact, but got {<-.actual>}"]~ - :: - ;: weld - (expect-eq !>(disc.expected) !>(disc.actual)) - $(expected start.expected, actual start.actual) - $(expected diff.expected, actual diff.actual) - == - :: - %path - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %plan - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %reef - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %ride - :: - ?. ?=(%ride -.actual) - [%leaf "expected %ride, but got {<-.actual>}"]~ - :: - %+ weld - (expect-eq !>(formula.expected) !>(formula.actual)) - $(expected subject.expected, actual subject.actual) - :: - %same - :: - ?. ?=(%same -.actual) - [%leaf "expected %same, but got {<-.actual>}"]~ - :: - $(expected schematic.expected, actual schematic.actual) - :: - %scry - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %slim - :: - ?. ?=(%slim -.actual) - [%leaf "expected %slim, but got {<-.actual>}"]~ - :: - %+ weld - (expect-eq !>(formula.expected) !>(formula.actual)) - :: - %+ expect-eq - !>(`?`%.y) - ^- vase - :- -:!>(*?) - ^- ? - (~(nest ut subject-type.expected) | subject-type.actual) - :: - %slit - :: - ?. ?=(%slit -.actual) - [%leaf "expected %slit, but got {<-.actual>}"]~ - :: - %+ weld - (expect-eq gate.expected gate.actual) - (expect-eq sample.expected sample.actual) - :: - ?(%vale %volt) - (expect-eq [schematic-type expected] [schematic-type actual]) - :: - %walk - (expect-eq [schematic-type expected] [schematic-type actual]) - == -:: +schematic-type: the +type for +schematic:ford -:: -++ schematic-type ^~ `type`-:!>(*schematic:ford) --- diff --git a/pkg/arvo/lib/test/ford.hoon b/pkg/arvo/lib/test/ford.hoon deleted file mode 100644 index d5121cf37..000000000 --- a/pkg/arvo/lib/test/ford.hoon +++ /dev/null @@ -1,341 +0,0 @@ -/+ *test -:: -/= ford-vane /: /===/sys/vane/ford /!noun/ -:: -/= hoon-scry /: /===/sys/hoon /hoon/ -/= arvo-scry /: /===/sys/arvo /hoon/ -/= zuse-scry /: /===/sys/zuse /hoon/ -/= txt-scry /: /===/mar/txt /hoon/ -/= diff-scry /: /===/mar/txt-diff /hoon/ -:: -!: -=, ford -=, format -:: -=/ test-pit=vase !>(..zuse) -=/ ford-gate (ford-vane test-pit) -:: -|% -++ verify-post-made - |= $: move=move:ford-gate - =duct - =type - date=@da - title=@tas - contents=tape - == - ^- tang - :: - ?> ?=([* %give %made @da %complete %success ^ *] move) - =/ result build-result.result.p.card.move - ?> ?=([%success %scry %noun type-a=* @tas *] head.result) - ?> ?=([%success ^ *] tail.result) - ?> ?=([%success %ride type-title-a=* %post-a] head.tail.result) - ?> ?=([%success %ride type-title-b=* %post-b] tail.tail.result) - :: - ;: welp - %+ expect-eq - !> duct - !> duct.move - :: - %+ expect-eq - !> date - !> date.p.card.move - :: - %+ expect-eq - !> [%success %scry %noun *^type [title=title contents=contents]] - !> head.result(p.q.cage *^type) - :: - %+ expect-eq - !> & - !> (~(nest ut p.q.cage.head.result) | type) - :: - %+ expect-eq - !> 'post-a' - vase.head.tail.result - :: - %+ expect-eq - !> 'post-b' - vase.tail.tail.result - == -++ scry-with-results - |= results=(map [=term =beam] cage) - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - =/ date=@da ?>(?=(%da -.r.beam) p.r.beam) - :: - ?^ reef=((scry-reef date) +<.$) - reef - :: - ~| scry-with-results+[term=term beam=beam] - :: - [~ ~ (~(got by results) [term beam])] -:: +scry-with-results-and-failures -:: -++ scry-with-results-and-failures - |= results=(map [=term =beam] (unit cage)) - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - =/ date=@da ?>(?=(%da -.r.beam) p.r.beam) - :: - ?^ reef=((scry-reef date) +<.$) - reef - :: - ~| scry-with-results+[term=term beam=beam] - :: - [~ (~(got by results) [term beam])] -:: +scry-succeed: produces a scry function with a known request and answer -:: -++ scry-succeed - |= [date=@da result=cage] ^- sley - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ?^ reef=((scry-reef date) +<.$) - reef - :: - ~| scry-succeed+[beam+beam term+term] - ?> =(term %cx) - ?> =(beam [[~nul %desk %da date] /bar/foo]) - :: - [~ ~ result] -:: +scry-fail: produces a scry function with a known request and failed answer -:: -++ scry-fail - |= date=@da ^- sley - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ?^ reef=((scry-reef date) +<.$) - reef - :: - ~| scry-fail+[beam+beam term+term] - ?> =(term %cx) - ?> =(beam [[~nul %desk %da date] /bar/foo]) - :: - [~ ~] -:: +scry-block: produces a scry function with known request and blocked answer -:: -++ scry-block - |= date=@da ^- sley - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ?^ reef=((scry-reef date) +<.$) - reef - :: - ~| scry-block+[beam+beam term+term] - ?> =(term %cx) - ?> =(beam [[~nul %desk %da date] /bar/foo]) - :: - ~ -:: +scry-blocks: block on a file at multiple dates; does not include %reef -:: -++ scry-blocks - |= dates=(set @da) ^- sley - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ~| scry-block+[beam+beam term+term] - ?> =(term %cx) - ?> ?=([%da @da] r.beam) - ?> (~(has in dates) p.r.beam) - :: - ~ -:: +scry-is-forbidden: makes sure ford does not attempt to scry -:: -++ scry-is-forbidden ^- sley - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - =/ date=@da ?>(?=(%da -.r.beam) p.r.beam) - :: - ?^ reef=((scry-reef date) +<.$) - reef - :: - ~| scry-is-forbidden+[beam+beam term+term] - !! -:: -++ scry-reef - |= date=@da ^- sley - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - =- ?~ res=(~(get by -) [term beam]) - ~ - `res - :: - (with-reef date ~) -:: -++ with-reef - |= [date=@da scry-results=(map [term beam] cage)] - ^+ scry-results - %- ~(gas by scry-results) - :~ :- [%cx [[~nul %home %da date] /hoon/hoon/sys]] - [%hoon !>(hoon-scry)] - :- [%cx [[~nul %home %da date] /hoon/arvo/sys]] - [%hoon !>(arvo-scry)] - :- [%cx [[~nul %home %da date] /hoon/zuse/sys]] - [%hoon !>(zuse-scry)] - :: - :- [%cw [[~nul %home %da date] /hoon/hoon/sys]] - [%cass !>([ud=1 da=date])] - == -:: -++ with-reef-unit - |= [date=@da scry-results=(map [term beam] (unit cage))] - ^+ scry-results - %- ~(gas by scry-results) - :~ :- [%cx [[~nul %home %da date] /hoon/hoon/sys]] - `[%noun !>(~)] - :- [%cx [[~nul %home %da date] /hoon/arvo/sys]] - `[%noun !>(~)] - :- [%cx [[~nul %home %da date] /hoon/zuse/sys]] - `[%noun !>(~)] - :: - :- [%cw [[~nul %home %da date] /hoon/hoon/sys]] - `[%cass !>([ud=1 da=date])] - == -:: -++ ford-call - |= $: ford-gate=_ford-gate - now=@da - scry=sley - call-args=[=duct type=* wrapped-task=(hobo task:able:ford-gate)] - expected-moves=(list move:ford-gate) - == - ^- [tang _ford-gate] - :: - =/ ford (ford-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) - :: - =^ moves ford-gate - %- call:ford [duct ~ type wrapped-task]:call-args - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> moves - :: - [output ford-gate] -:: -++ ford-take - |= $: ford-gate=_ford-gate - now=@da - scry=sley - take-args=[=wire =duct wrapped-sign=(hypo sign:ford-gate)] - expected-moves=(list move:ford-gate) - == - ^- [tang _ford-gate] - :: - =/ ford (ford-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) - :: - =^ moves ford-gate - %- take:ford [wire duct ~ wrapped-sign]:take-args - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> moves - :: - [output ford-gate] -:: +ford-call-with-comparator -:: -:: Sometimes we can't just do simple comparisons between the moves statements -:: and must instead specify a gate that performs the comparisons. -:: -++ ford-call-with-comparator - |= $: ford-gate=_ford-gate - now=@da - scry=sley - call-args=[=duct type=* wrapped-task=(hobo task:able:ford-gate)] - move-comparator=$-((list move:ford-gate) tang) - == - ^- [tang _ford-gate] - :: - =/ ford (ford-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) - :: - =^ moves ford-gate - %- call:ford [duct ~ type wrapped-task]:call-args - :: - =/ output=tang (move-comparator moves) - :: - [output ford-gate] -:: +ford-take-with-comparator -:: -++ ford-take-with-comparator - |= $: ford-gate=_ford-gate - now=@da - scry=sley - take-args=[=wire =duct wrapped-sign=(hypo sign:ford-gate)] - move-comparator=$-((list move:ford-gate) tang) - == - ^- [tang _ford-gate] - :: - =/ ford (ford-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) - :: - =^ moves ford-gate - %- take:ford [wire duct ~ wrapped-sign]:take-args - :: - =/ output=tang (move-comparator moves) - :: - [output ford-gate] -:: +expect-cage: assert that the actual cage has the right mark and vase -:: -++ expect-cage - |= [mark=term expected=vase actual=cage] - %+ weld - %+ expect-eq - !> mark - !> p.actual - :: - (expect-eq expected q.actual) -:: +expect-ford-empty: assert that ford's state is one empty ship -:: -:: At the end of every test, we want to assert that we have cleaned up all -:: state. -:: -++ expect-ford-empty - |= [ford-gate=_ford-gate ship=@p] - ^- tang - :: - =^ results1 ford-gate - %- ford-call :* - ford-gate - now=~1234.5.6 - scry=scry-is-forbidden - call-args=[duct=~[/empty] type=~ [%keep 0 0]] - expected-moves=~ - == - :: - =/ ford *ford-gate - =/ state state.ax.+>+<.ford - :: - =/ default-state *ford-state:ford - :: - =. max-size.compiler-cache.state max-size.compiler-cache.default-state - =. max-size.queue.build-cache.state max-size.queue.build-cache.default-state - =. next-anchor-id.build-cache.state 0 - :: - %+ welp results1 - :: - ?: =(default-state state) - ~ - :: - =/ build-state=(list tank) - %- zing - %+ turn ~(tap by builds.state) - |= [build=build:ford build-status=build-status:ford] - :~ [%leaf (build-to-tape:ford build)] - [%leaf "requesters: {}"] - [%leaf "clients: {<~(tap in ~(key by clients.build-status))>}"] - == - :: - =/ braces [[' ' ' ' ~] ['{' ~] ['}' ~]] - :: - :~ [%leaf "failed to cleanup"] - [%leaf "builds.state:"] - [%rose braces build-state] - == --- diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index fe536ed17..a220fa080 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1796,12 +1796,231 @@ == {$c gift:able:clay} {$d $<(%pack gift:able:dill)} - {$f gift:able:ford} + {$f gift:ford} [%e gift:able:eyre] {$g gift:able:gall} [%i gift:able:iris] {$j gift:able:jael} == + :: + ++ ford + |% + += gift + $% :: %made: build result; response to %build +task + :: + $: %made + :: date: formal date of the build + :: + date=@da + :: result: result of the build; either complete build, or error + :: + result=made-result + == == + += made-result + $% :: %complete: contains the result of the completed build + :: + [%complete =build-result] + :: %incomplete: couldn't finish build; contains error message + :: + [%incomplete =tang] + == + += build-result + $% :: %error: the build produced an error whose description is :message + :: + [%error message=tang] + :: %success: result of successful +build, tagged by +schematic sub-type + :: + $: %success + $^ [head=build-result tail=build-result] + $% [%$ =cage] + [%alts =build-result] + [%bake =cage] + [%bunt =cage] + [%call =vase] + [%cast =cage] + [%core =vase] + [%diff =cage] + [%hood =scaffold] + [%join =cage] + [%list results=(list build-result)] + [%mash =cage] + [%mute =cage] + [%pact =cage] + [%path =rail] + [%plan =vase] + [%reef =vase] + [%ride =vase] + [%scry =cage] + [%slim [=type =nock]] + [%slit =type] + [%vale =cage] + [%volt =cage] + [%walk results=(list mark-action)] + == == == + += scaffold + $: :: source-rail: the file this scaffold was parsed from + :: + source-rail=rail + :: zuse-version: the kelvin version of the standard library + :: + zuse-version=@ud + :: structures: files from %/sur which are included + :: + structures=(list cable) + :: libraries: files from %/lib which are included + :: + libraries=(list cable) + :: cranes: a list of resources to transform and include + :: + cranes=(list crane) + :: sources: hoon sources, either parsed or on the filesystem + :: + sources=(list hoon) + == + += mark-action [type=?(%grow %grab) source=term target=term] + += rail [=disc =spur] + +$ cable + $: face=(unit term) + file-path=term + == + += crane + $% $: :: %fssg: `/~` hoon literal + :: + :: `/~ ` produces a crane that evaluates arbitrary hoon. + :: + %fssg + =hoon + == + $: :: %fsbc: `/$` process query string + :: + :: `/$` will call a gate with the query string supplied to this + :: build. If no query string, this errors. + :: + %fsbc + =hoon + == + $: :: %fsbr: `/|` first of many options that succeeds + :: + :: `/|` takes a series of cranes and produces the first one + :: (left-to-right) that succeeds. If none succeed, it produces + :: stack traces from all of its arguments. + :: + %fsbr + :: choices: cranes to try + :: + choices=(list crane) + == + $: :: %fsts: `/=` wrap a face around a crane + :: + :: /= runs a crane (usually produced by another ford rune), takes + :: the result of that crane, and wraps a face around it. + :: + %fsts + :: face: face to apply + :: + face=term + :: crane: internal build step + :: + =crane + == + $: :: %fsdt: `/.` null-terminated list + :: + :: Produce a null-terminated list from a sequence of cranes, + :: terminated by a `==`. + :: + %fsdt + :: items: cranes to evaluate + :: + items=(list crane) + == + $: :: %fscm: `/,` switch by path + :: + :: `/,` is a switch statement, which picks a branch to evaluate + :: based on whether the current path matches the path in the + :: switch statement. Takes a sequence of pairs of (path, crane) + :: terminated by a `==`. + :: + %fscm + :: cases: produces evaluated crane of first +spur match + :: + cases=(list (pair spur crane)) + == + $: :: %fspm: `/&` pass through a series of marks + :: + :: `/&` passes a crane through multiple marks, right-to-left. + :: + %fspm + :: marks: marks to apply to :crane, in reverse order + :: + marks=(list mark) + =crane + == + $: :: %fscb: `/_` run a crane on each file in the current directory + :: + :: `/_` takes a crane as an argument. It produces a new crane + :: representing the result of mapping the supplied crane over the + :: list of files in the current directory. The keys in the + :: resulting map are the basenames of the files in the directory, + :: and each value is the result of running that crane on the + :: contents of the file. + :: + %fscb + =crane + == + $: :: %fssm: `/;` operate on + :: + :: `/;` takes a hoon and a crane. The hoon should evaluate to a + :: gate, which is then called with the result of the crane as its + :: sample. + :: + %fssm + =hoon + =crane + == + $: :: %fscl: `/:` evaluate at path + :: + :: `/:` takes a path and a +crane, and evaluates the crane with + :: the current path set to the supplied path. + :: + %fscl + :: path: late bound path to be resolved relative to current beak + :: + :: This becomes current path of :crane + :: + path=truss + =crane + == + $: :: %fskt: `/^` cast + :: + :: `/^` takes a +mold and a +crane, and casts the result of the + :: crane to the mold. + :: + %fskt + :: mold: evaluates to a mold to be applied to :crane + :: + =spec + =crane + == + $: :: %fstr: `/*` run :crane on all files with current path as prefix + :: + %fstr + =crane + == + $: :: %fszp: `/!mark/` evaluate as hoon, then pass through mark + :: + %fszp + =mark + == + $: :: %fszy: `/mark/` passes current path through :mark + :: + %fszy + =mark + == == + += truss + $: pre=(unit tyke) + pof=(unit [p=@ud q=tyke]) + == + -- -- :: +scry: standard scry :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 88ec968e0..277c05b68 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -7,14 +7,13 @@ :: or classes). :: :: each of these stages is split into cores for each of -:: arvo's nine major vanes (kernel modules). these are: +:: arvo's eight major vanes (kernel modules). these are: :: :: - %ames: networking (rhymes with "games") :: - %behn: scheduling ("bane") :: - %clay: revision control ("play") :: - %dill: console ("pill") :: - %eyre: http server ("fair") -:: - %ford: build ("lord") :: - %gall: application ("ball") :: - %iris: http client ("virus") :: - %jael: security ("jail") @@ -70,6 +69,9 @@ == :: ++ coop (unit ares) :: possible error +:: +disc: a desk on a ship; can be used as a beak that varies with time +:: ++$ disc [=ship =desk] ++ life @ud :: ship key revision ++ rift @ud :: ship continuity ++ mime {p/mite q/octs} :: mimetyped data @@ -582,6 +584,13 @@ $% {$delta p/lobe q/{p/mark q/lobe} r/page} :: delta on q {$direct p/lobe q/page} :: immediate == :: + :: +cable: a reference to something on the filesystem + :: face: the face to wrap around the imported file + :: file-path: location in clay + +$ cable + $: face=(unit term) + file-path=term + == ++ care ?($a $b $c $d $p $r $s $t $u $v $w $x $y $z) :: clay submode ++ case :: ship desk case spur $% {$da p/@da} :: date @@ -1177,709 +1186,6 @@ ++ user knot :: username -- ::eyre :: :::: -:::: ++ford :: (1f) build - :: :::: -:: |ford: build system vane interface -:: -++ ford ^? - |% - :: |able:ford: ford's public +move interface - :: - ++ able ^? - |% - :: +task:able:ford: requests to ford - :: - += task - $~ [%vega ~] - $% :: %build: perform a build, either live or once - :: - $: %build - :: live: whether we run this build live - :: - :: A live build will subscribe to further updates and keep the - :: build around. - :: - live=? - :: plan: the schematic to build - :: - =schematic - == - :: %keep: reset cache sizes - :: - [%keep compiler-cache=@ud build-cache=@ud] - :: %kill: stop a build; send on same duct as original %build request - :: - [%kill ~] - :: trim state (in response to memory pressure) - :: - $>(%trim vane-task) - :: %vega: report kernel upgrade - :: - $>(%vega vane-task) - :: %wipe: wipes stored builds - :: - [%wipe percent-to-remove=@ud] - == - :: +gift:able:ford: responses from ford - :: - += gift - $% :: %made: build result; response to %build +task - :: - $: %made - :: date: formal date of the build - :: - date=@da - :: result: result of the build; either complete build, or error - :: - result=made-result - == == - -- - :: +made-result: the main payload for a %made +gift - :: - += made-result - $% :: %complete: contains the result of the completed build - :: - [%complete =build-result] - :: %incomplete: couldn't finish build; contains error message - :: - [%incomplete =tang] - == - :: +disc: a desk on a ship; can be used as a beak that varies with time - :: - += disc [=ship =desk] - :: +rail: a time-varying full path - :: - :: This can be thought of as a +beam without a +case, which is what - :: would specify the time. :spur is flopped just like the +spur in a +beam. - :: - += rail [=disc =spur] - :: +resource: time-varying dependency on a value from the urbit namespace - :: - += resource - $: :: vane which we are querying - :: - vane=%c - :: type of request - :: - :: TODO: care:clay should be cleaned up in zuse as it is a general - :: type, not a clay specific one. - :: - care=care:clay - :: path on which to depend, missing time, which will be filled in - :: - =rail - == - :: +build-result: the referentially transparent result of a +build - :: - :: A +build produces either an error or a result. A result is a tagged - :: union of the various kinds of datatypes a build can produce. The tag - :: represents the sub-type of +schematic that produced the result. - :: - += build-result - $% :: %error: the build produced an error whose description is :message - :: - [%error message=tang] - :: %success: result of successful +build, tagged by +schematic sub-type - :: - $: %success - $^ [head=build-result tail=build-result] - $% [%$ =cage] - [%alts =build-result] - [%bake =cage] - [%bunt =cage] - [%call =vase] - [%cast =cage] - [%core =vase] - [%diff =cage] - [%hood =scaffold] - [%join =cage] - [%list results=(list build-result)] - [%mash =cage] - [%mute =cage] - [%pact =cage] - [%path =rail] - [%plan =vase] - [%reef =vase] - [%ride =vase] - [%scry =cage] - [%slim [=type =nock]] - [%slit =type] - [%vale =cage] - [%volt =cage] - [%walk results=(list mark-action)] - == == == - :: +mark-action: represents a single mark conversion step - :: - :: In mark conversion, we want to convert from :source to :target. We also - :: need to keep track of what type of conversion this is. If %grab, we - :: want to use the definitions in the :target mark. If %grow, we want to - :: use the :source mark. - :: - += mark-action [type=?(%grow %grab) source=term target=term] - :: - :: +schematic: plan for building - :: - ++ schematic - :: If the head of the +schematic is a pair, it's an auto-cons - :: schematic. Its result will be the pair of results of its - :: sub-schematics. - :: - $^ [head=schematic tail=schematic] - :: - $% :: %$: literal value. Produces its input unchanged. - :: - $: %$ - :: literal: the value to be produced by the build - :: - literal=cage - == - :: %pin: pins a sub-schematic to a date - :: - :: There is a difference between live builds and once builds. In - :: live builds, we produce results over and over again and aren't - :: pinned to a specifc time. In once builds, we want to specify a - :: specific date, which we apply recursively to any sub-schematics - :: contained within :schematic. - :: - :: If a build has a %pin at the top level, we consider it to be a - :: once build. Otherwise, we consider it to be a live build. We do - :: this so schematics which depend on the result of a once build can - :: be cached, giving the client explicit control over the caching - :: behaviour. - :: - $: %pin - :: date: time at which to perform the build - :: - date=@da - :: schematic: wrapped schematic of pinned time - :: - =schematic - == - :: %alts: alternative build choices - :: - :: Try each choice in :choices, in order; accept the first one that - :: succeeds. Note that the result inherits the dependencies of all - :: failed schematics, as well as the successful one. - :: - $: %alts - :: choices: list of build options to try - :: - choices=(list schematic) - == - :: %bake: run a file through a renderer - :: - $: %bake - :: renderer: name of renderer; also its file path in ren/ - :: - renderer=term - :: query-string: the query string of the renderer's http path - :: - query-string=coin - :: path-to-render: full path of file to render - :: - path-to-render=rail - == - :: %bunt: produce the default value for a mark - :: - $: %bunt - :: disc where in clay to load the mark from - :: - =disc - :: mark: name of mark; also its file path in mar/ - :: - mark=term - == - :: %call: call a gate on a sample - :: - $: %call - :: gate: schematic whose result is a gate - :: - gate=schematic - :: sample: schematic whose result will be the gate's sample - :: - sample=schematic - == - :: %cast: cast the result of a schematic through a mark - :: - $: %cast - :: disc where in clay to load the mark from - :: - =disc - :: mark: name of mark; also its file path in ren/ - :: - mark=term - :: input: schematic whose result will be run through the mark - :: - input=schematic - == - :: %core: build a hoon program from a source file - :: - $: %core - :: source-path: clay path from which to load hoon source - :: - source-path=rail - == - :: %diff: produce marked diff from :first to :second - :: - $: %diff - :: disc where in clay to load the mark from - :: - =disc - :: old: schematic producing data to be used as diff starting point - :: - start=schematic - :: new: schematic producing data to be used as diff ending point - :: - end=schematic - == - :: %dude: wrap a failure's error message with an extra message - :: - $: %dude - :: error: a trap producing an error message to wrap the original - :: - error=tank - :: attempt: the schematic to try, whose error we wrap, if any - :: - attempt=schematic - == - :: %hood: create a +hood from a hoon source file - :: - $: %hood - :: source-path: clay path from which to load hoon source - :: - source-path=rail - == - :: %join: merge two diffs into one diff; produces `~` if conflicts - :: - $: %join - :: disc where in clay to load the mark from - :: - =disc - :: mark: name of the mark to use for diffs; also file path in mar/ - :: - mark=term - :: first: schematic producing first diff - :: - first=schematic - :: second: schematic producing second diff - :: - second=schematic - == - :: %list: performs a list of schematics, returns a list of +builds-results - :: - $: %list - :: schematics: list of builds to perform - :: - schematics=(list schematic) - == - :: %mash: force a merge, annotating any conflicts - :: - $: %mash - :: disc where in clay to load the mark from - :: - =disc - :: mark: name of mark used in diffs; also file path in mar/ - :: - mark=term - :: first: marked schematic producing first diff - :: - first=[=disc mark=term =schematic] - :: second: marked schematic producing second diff - :: - second=[=disc mark=term =schematic] - == - :: %mute: mutate a noun by replacing its wings with new values - :: - $: %mute - :: subject: schematic producing the noun to mutate - :: - subject=schematic - :: mutations: axes and schematics to produce their new contents - :: - mutations=(list (pair wing schematic)) - == - :: %pact: patch a marked noun by applying a diff - :: - $: %pact - :: disc where in clay to load marks from - :: - =disc - :: start: schematic producing a noun to be patched - :: - start=schematic - :: diff: schematic producing the diff to apply to :start - :: - diff=schematic - == - :: %path: resolve a path with `-`s to a path with `/`s - :: - :: Resolve +raw-path to a path containing a file, replacing - :: any `-`s in the path with `/`s if no file exists at the - :: original path. Produces an error if multiple files match, - :: e.g. a/b/c and a/b-c, or a/b/c and a-b/c. - :: - $: %path - :: disc: the +disc forming the base of the path to be resolved - :: - =disc - :: prefix: path prefix under which to resolve :raw-path, e.g. lib - :: - prefix=@tas - :: raw-path: the file path to be resolved - :: - raw-path=@tas - == - :: %plan: build a hoon program from a preprocessed source file - :: - $: %plan - :: path-to-render: the clay path of a file being rendered - :: - :: TODO: Once we've really implemented this, write the - :: documentation. (This is the path that starts out as the path - :: of the hoon source which generated the scaffold, but can be - :: changed with `/:`.) - :: - path-to-render=rail - :: query-string: the query string of the http request - :: - query-string=coin - :: scaffold: preprocessed hoon source and imports - :: - =scaffold - == - :: %reef: produce a hoon+zuse kernel. used internally for caching - :: - $: %reef - :: disc: location of sys/hoon/hoon and sys/zuse/hoon - :: - =disc - == - :: %ride: eval hoon as formula with result of a schematic as subject - :: - $: %ride - :: formula: a hoon to be evaluated against a subject - :: - formula=hoon - :: subject: a schematic whose result will be used as subject - :: - subject=schematic - == - :: %same: the identity function - :: - :: Functionally used to "unpin" a build for caching reasons. If you - :: run a %pin build, it is treated as a once build and is therefore - :: not cached. Wrapping the %pin schematic in a %same schematic - :: converts it to a live build, which will be cached due to live - :: build subscription semantics. - :: - $: %same - :: schematic that we evaluate to - :: - =schematic - == - :: %scry: lookup a value from the urbit namespace - :: - $: %scry - :: resource: a namespace request, with unspecified time - :: - :: Schematics can only be resolved when specifying a time, - :: which will convert this +resource into a +scry-request. - :: - =resource - == - :: %slim: compile a hoon against a subject type - :: - $: %slim - :: compile-time subject type for the :formula - :: - subject-type=type - :: formula: a +hoon to be compiled to (pair type nock) - :: - formula=hoon - == - :: %slit: get type of gate product - :: - $: %slit - :: gate: a vase containing a gate - :: - gate=vase - :: sample: a vase containing the :gate's sample - :: - sample=vase - == - :: %vale: coerce a noun to a mark, validated - :: - $: %vale - :: disc where in clay to load the mark from - :: - =disc - :: mark: name of mark to use; also file path in mar/ - :: - mark=term - :: input: the noun to be converted using the mark - :: - input=* - == - :: %volt: coerce a noun to a mark, unsafe - :: - $: %volt - :: disc where in clay to load the mark from - :: - =disc - :: mark: name of mark to use; also file path in mar/ - :: - mark=term - :: input: the noun to be converted using the mark - :: - input=* - == - :: %walk: finds a mark conversion path between two marks - :: - $: %walk - :: disc in clay to load the marks from - :: - =disc - :: source: the original mark type - :: - source=term - :: target: the destination mark type - :: - target=term - == - == - :: - :: +scaffold: program construction in progress - :: - :: A source file with all its imports and requirements, which will be - :: built and combined into one final product. - :: - += scaffold - $: :: source-rail: the file this scaffold was parsed from - :: - source-rail=rail - :: zuse-version: the kelvin version of the standard library - :: - zuse-version=@ud - :: structures: files from %/sur which are included - :: - structures=(list cable) - :: libraries: files from %/lib which are included - :: - libraries=(list cable) - :: cranes: a list of resources to transform and include - :: - cranes=(list crane) - :: sources: hoon sources, either parsed or on the filesystem - :: - sources=(list hoon) - == - :: +cable: a reference to something on the filesystem - :: - += cable - $: :: face: the face to wrap around the imported file - :: - face=(unit term) - :: file-path: location in clay - :: - file-path=term - == - :: +truss: late-bound path - :: - :: TODO: the +tyke data structure should be rethought, possibly as part - :: of this effort since it is actually a `(list (unit hoon))`, when it - :: only represents @tas. It should be a structure which explicitly - :: represents a path with holes that need to be filled in. - :: - += truss - $: pre=(unit tyke) - pof=(unit [p=@ud q=tyke]) - == - :: +crane: parsed rune used to include and transform resources - :: - :: Cranes lifting cranes lifting cranes! - :: - :: A recursive tree of Ford directives that specifies instructions for - :: including and transforming resources from the Urbit namespace. - :: - += crane - $% $: :: %fssg: `/~` hoon literal - :: - :: `/~ ` produces a crane that evaluates arbitrary hoon. - :: - %fssg - =hoon - == - $: :: %fsbc: `/$` process query string - :: - :: `/$` will call a gate with the query string supplied to this - :: build. If no query string, this errors. - :: - %fsbc - =hoon - == - $: :: %fsbr: `/|` first of many options that succeeds - :: - :: `/|` takes a series of cranes and produces the first one - :: (left-to-right) that succeeds. If none succeed, it produces - :: stack traces from all of its arguments. - :: - %fsbr - :: choices: cranes to try - :: - choices=(list crane) - == - $: :: %fsts: `/=` wrap a face around a crane - :: - :: /= runs a crane (usually produced by another ford rune), takes - :: the result of that crane, and wraps a face around it. - :: - %fsts - :: face: face to apply - :: - face=term - :: crane: internal build step - :: - =crane - == - $: :: %fsdt: `/.` null-terminated list - :: - :: Produce a null-terminated list from a sequence of cranes, - :: terminated by a `==`. - :: - %fsdt - :: items: cranes to evaluate - :: - items=(list crane) - == - $: :: %fscm: `/,` switch by path - :: - :: `/,` is a switch statement, which picks a branch to evaluate - :: based on whether the current path matches the path in the - :: switch statement. Takes a sequence of pairs of (path, crane) - :: terminated by a `==`. - :: - %fscm - :: cases: produces evaluated crane of first +spur match - :: - cases=(list (pair spur crane)) - == - $: :: %fspm: `/&` pass through a series of marks - :: - :: `/&` passes a crane through multiple marks, right-to-left. - :: - %fspm - :: marks: marks to apply to :crane, in reverse order - :: - marks=(list mark) - =crane - == - $: :: %fscb: `/_` run a crane on each file in the current directory - :: - :: `/_` takes a crane as an argument. It produces a new crane - :: representing the result of mapping the supplied crane over the - :: list of files in the current directory. The keys in the - :: resulting map are the basenames of the files in the directory, - :: and each value is the result of running that crane on the - :: contents of the file. - :: - %fscb - =crane - == - $: :: %fssm: `/;` operate on - :: - :: `/;` takes a hoon and a crane. The hoon should evaluate to a - :: gate, which is then called with the result of the crane as its - :: sample. - :: - %fssm - =hoon - =crane - == - $: :: %fscl: `/:` evaluate at path - :: - :: `/:` takes a path and a +crane, and evaluates the crane with - :: the current path set to the supplied path. - :: - %fscl - :: path: late bound path to be resolved relative to current beak - :: - :: This becomes current path of :crane - :: - path=truss - =crane - == - $: :: %fskt: `/^` cast - :: - :: `/^` takes a +mold and a +crane, and casts the result of the - :: crane to the mold. - :: - %fskt - :: mold: evaluates to a mold to be applied to :crane - :: - =spec - =crane - == - $: :: %fstr: `/*` run :crane on all files with current path as prefix - :: - %fstr - =crane - == - $: :: %fszp: `/!mark/` evaluate as hoon, then pass through mark - :: - %fszp - =mark - == - $: :: %fszy: `/mark/` passes current path through :mark - :: - %fszy - =mark - == == - :: +result-to-cage: extract a +cage from a +build-result - :: - ++ result-to-cage - |= result=build-result - ^- cage - ?: ?=(%error -.result) - [%tang !>(message.result)] - ?- -.+.result - ^ [%noun (slop q:$(result head.result) q:$(result tail.result))] - %$ cage.result - %alts $(result build-result.result) - %bake cage.result - %bunt cage.result - %call [%noun vase.result] - %cast cage.result - %core [%noun vase.result] - %diff cage.result - %hood [%noun !>(scaffold.result)] - %join cage.result - %list [%noun -:!>(*(list cage)) (turn results.result result-to-cage)] - %mash cage.result - %mute cage.result - %pact cage.result - %path [%noun !>(rail.result)] - %plan [%noun vase.result] - %reef [%noun vase.result] - %ride [%noun vase.result] - %scry cage.result - %slim [%noun !>([type nock]:result)] - %slit [%noun !>(type.result)] - %vale cage.result - %volt cage.result - %walk [%noun !>(results.result)] - == - :: +result-as-error: extracts a tang out of a made-result - :: - ++ made-result-as-error - |= result=made-result - ^- tang - ?: ?=([%incomplete *] result) - tang.result - ?: ?=([%complete %error *] result) - message.build-result.result - ~ - -- -:: :::: :::: ++gall :: (1g) extensions :: :::: ++ gall ^? @@ -2358,7 +1664,6 @@ gift:able:clay gift:able:dill gift:able:eyre - gift:able:ford gift:able:gall gift:able:iris gift:able:jael @@ -2369,7 +1674,6 @@ task:able:behn task:able:dill task:able:eyre - task:able:ford task:able:gall task:able:iris task:able:jael @@ -2381,7 +1685,6 @@ {$c task:able:clay} {$d task:able:dill} [%e task:able:eyre] - {$f task:able:ford} {$g task:able:gall} [%i task:able:iris] {$j task:able:jael} @@ -2399,7 +1702,6 @@ == {$c gift:able:clay} {$d gift:able:dill} - {$f gift:able:ford} [%e gift:able:eyre] {$g gift:able:gall} [%i gift:able:iris] diff --git a/pkg/arvo/ted/up.hoon b/pkg/arvo/ted/up.hoon deleted file mode 100644 index 9aa5ce3e0..000000000 --- a/pkg/arvo/ted/up.hoon +++ /dev/null @@ -1,33 +0,0 @@ -/- spider -/+ strandio -=, strand=strand:spider -^- thread:spider -|= arg=vase -=+ !<([scratch=desk real=desk ~] arg) -|^ -=/ m (strand ,vase) -^- form:m -;< apps=(map path vase) bind:m load-apps -(pure:m !>((~(run by apps) mug))) -:: -++ scratch-path - |= [=bowl:spider =path] - (weld /(scot %p our.bowl)/[scratch]/(scot %da now.bowl) path) -:: -++ load-apps - =/ m (strand ,(map path vase)) - ^- form:m - ;< =bowl:spider bind:m get-bowl:strandio - =+ .^(=arch %cy (scratch-path bowl /app)) - =/ apps ~(tap in ~(key by dir.arch)) - =/ rails - %- malt - %+ murn apps - |= =term - ^- (unit [^term rail:ford]) - =+ .^(=app=^arch %cy (scratch-path bowl /app/[term])) - ?. (~(has by dir.app-arch) %hoon) - ~ - `[/[term] our.bowl^scratch /hoon/[term]/app] - (build-cores:strandio rails) --- diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 36453db0b..a4c627543 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -1,4 +1,4 @@ -/+ *test, test-ford-external +/+ *test /= clay-raw /sys/vane/clay /* hello-gen %hoon /gen/hello/hoon /* strandio-lib %hoon /lib/strandio/hoon @@ -161,452 +161,6 @@ !> dez:(~(got by vases.cache.nub) /lib/strandio/hoon) == :: -++ test-info ^- tang - =^ results0 clay-gate - %- clay-call :* - clay-gate - now=~1111.1.1 - scry=*sley - call-args=[duct=~[/init] -:!>(*task:able:clay) [%init ~nul]] - expected-moves=~ - == - :: - =^ results1 clay-gate - %- clay-call-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= call-args - :+ duct=~[/info] type=-:!>(*task:able:clay) - ^- task:able:clay - :+ %info %home - ^- nori:clay - :- %& - ^- soba:clay - :~ [/file1/noun `miso:clay`[%ins [%noun %noun 'file1']]] - [/file2/noun `miso:clay`[%ins [%noun %noun 'file2']]] - == - ^= move-comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - ^- tang - ;: weld - :: - ^- tang - :: - =/ move=move:clay-gate i.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/commit/home/inserts) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%f %build *] note) - [%leaf "bad move, not a %build: {}"]~ - :: - %+ weld - (expect-eq !>(%.n) !>(live.note)) - :: - %- expect-schematic:test-ford-external - :_ schematic.note - ^- schematic:ford - :+ %pin ~1111.1.1 - :- %list - :~ :- [%$ %path -:!>(*path) /file1/noun] - :^ %cast [~nul %home] %noun - [%$ %noun %noun 'file1'] - :: - :- [%$ %path -:!>(*path) /file2/noun] - :^ %cast [~nul %home] %noun - [%$ %noun %noun 'file2'] - == - == == - :: - :: inserting - :: - =^ results2 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/inserts - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - :* %f %made ~1111.1.1 %complete %success %list - ^- (list build-result:ford) - :~ :+ %success - [%success %$ %path -:!>(*path) /file1/noun] - [%success %cast %noun %noun 'file1'] - :: - :+ %success - [%success %$ %path -:!>(*path) /file2/noun] - [%success %cast %noun %noun 'file2'] - == == == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - %+ expect-eq - !> ^- move:clay-gate - :- duct=~[/info] - ^- (wind note:clay-gate gift:able:clay) - :+ %pass /commit/home/diffs - ^- note:clay-gate - :- %f - [%build live=%.n [%pin ~1111.1.1 [%list ~]]] - !> i.moves - == :: == - :: - :: diffing - :: - =^ results3 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/diffs - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - [%f %made ~1111.1.1 %complete %success %list ~] - == - ^= move-comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - %+ expect-eq - !> ^- move:clay-gate - :- duct=~[/info] - ^- (wind note:clay-gate gift:able:clay) - :+ %pass /commit/home/casts - ^- note:clay-gate - :- %f - [%build live=%.n [%pin ~1111.1.1 [%list ~]]] - !> i.moves - == - :: - :: castifying - :: - =^ results4 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/casts - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - [%f %made ~1111.1.1 %complete %success %list ~] - == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - =/ move=move:clay-gate i.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/commit/home/mutates) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%f %build *] note) - [%leaf "bad move, not a %build: {}"]~ - :: - %+ weld - (expect-eq !>(%.n) !>(live.note)) - :: - %- expect-schematic:test-ford-external - :_ schematic.note - ^- schematic:ford - [%pin ~1111.1.1 %list ~] - == - :: - :: mutating - :: - =^ results5 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/mutates - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - [%f %made ~1111.1.1 %complete %success %list ~] - == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - =/ move=move:clay-gate i.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/commit/home/checkout) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%f %build *] note) - [%leaf "bad move, not a %build: {}"]~ - :: - %+ weld - (expect-eq !>(%.n) !>(live.note)) - :: - %- expect-schematic:test-ford-external - :_ schematic.note - ^- schematic:ford - :- %list - ^- (list schematic:ford) - :~ :- :^ %$ %path-hash -:!>([*path *@uvI]) - :- /file1/noun - 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj.k8b3s.n5hlf.57i21.5m1nn.bhob7 - :: - [%volt [~nul %home] %noun 'file1'] - :: - :- :^ %$ %path-hash -:!>([*path *@uvI]) - :- /file2/noun - 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp.8ifgp.0ljbi.dqau7.7c0q0.fj144 - :: - [%volt [~nul %home] %noun 'file2'] - == == - :: - :: patching - :: - =^ results6 clay-gate - %- clay-take :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= take-args - :* wire=/commit/home/checkout - duct=~[/info] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - :* %f %made ~1111.1.1 %complete %success %list - ^- (list build-result:ford) - :~ :+ %success - :* %success %$ %path-hash -:!>([*path *@uvI]) - /file1/noun - 0v1u.egg7f.h1o7a.22g2g.torgm.2kcfj. - k8b3s.n5hlf.57i21.5m1nn.bhob7 - == - [%success %volt %noun %noun 'file1'] - :: - :+ %success - :* %success %$ %path-hash -:!>([*path *@uvI]) - /file2/noun - 0vj.5f6kr.5o1of.dubnd.6k5a7.jprgp. - 8ifgp.0ljbi.dqau7.7c0q0.fj144 - == - [%success %volt %noun %noun 'file2'] - == == == - ^= expected-moves - :~ :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] - :~ [%leaf "~nul"] - [%leaf "home"] - [%leaf "1"] - [%leaf "file1"] - [%leaf "noun"] - == == - :: - :* duct=~[/init] %give %note '+' %rose ["/" "/" ~] - :~ [%leaf "~nul"] - [%leaf "home"] - [%leaf "1"] - [%leaf "file2"] - [%leaf "noun"] - == == == == - :: make a second write request during the same arvo event - :: - :: This should produce a Behn timer at `now` to run the write - :: request. - :: - =^ results7 clay-gate - %- clay-call-with-comparator :* - clay-gate - now=~1111.1.1 - scry=*sley - ^= call-args - :+ duct=~[/info2] type=-:!>(*task:able:clay) - ^- task:able:clay - :+ %info %home - ^- nori:clay - :- %& - ^- soba:clay - :~ [/file3/noun `miso:clay`[%ins [%noun %noun 'file3']]] - [/file4/noun `miso:clay`[%ins [%noun %noun 'file4']]] - == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* ~] moves) - [%leaf "wrong number of moves: {}"]~ - :: - =/ move=move:clay-gate i.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info2]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/queued-request) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%b %wait *] note) - [%leaf "bad move, not a %wait: {}"]~ - :: - (expect-eq !>(~1111.1.1) !>(p.note)) - == - :: - =^ results8 clay-gate - %- clay-take-with-comparator :* - clay-gate - now=~2222.2.2 - scry=*sley - ^= take-args - :* wire=/queued-request - duct=~[/info2] - -:!>(*sign:clay-gate) - ^- sign:clay-gate - [%b %wake ~] - == - ^= comparator - |= moves=(list move:clay-gate) - ^- tang - :: - ?. ?=([* * * ~] moves) - [%leaf "wrong number of moves: {<(lent moves)>}"]~ - :: - ^- tang - ;: weld - %+ expect-eq - !> ^- move:clay-gate - :- duct=~[/info2] - ^- (wind note:clay-gate gift:able:clay) - :+ %pass /castifying/~nul/home/~2222.2.2 - ^- note:clay-gate - :- %f - [%build live=%.n [%pin ~2222.2.2 [%list ~]]] - !> i.moves - :: - %+ expect-eq - !> ^- move:clay-gate - :- duct=~[/info2] - ^- (wind note:clay-gate gift:able:clay) - :+ %pass /diffing/~nul/home/~2222.2.2 - ^- note:clay-gate - :- %f - [%build live=%.n [%pin ~2222.2.2 [%list ~]]] - !> i.t.moves - :: - ^- tang - :: - =/ move=move:clay-gate i.t.t.moves - =/ =duct p.move - =/ card=(wind note:clay-gate gift:able:clay) q.move - :: - %+ weld - (expect-eq !>(~[/info2]) !>(duct)) - :: - ?. ?=(%pass -.card) - [%leaf "bad move, not a %pass: {}"]~ - :: - =/ =wire p.card - :: - %+ weld - (expect-eq !>(/inserting/~nul/home/~2222.2.2) !>(wire)) - :: - =/ note=note:clay-gate q.card - :: - ?. ?=([%f %build *] note) - [%leaf "bad move, not a %build: {}"]~ - :: - %+ weld - (expect-eq !>(%.n) !>(live.note)) - :: - %- expect-schematic:test-ford-external - :_ schematic.note - ^- schematic:ford - :+ %pin ~2222.2.2 - :- %list - :~ :- [%$ %path -:!>(*path) /file3/noun] - :^ %cast [~nul %home] %noun - [%$ %noun %noun 'file3'] - :: - :- [%$ %path -:!>(*path) /file4/noun] - :^ %cast [~nul %home] %noun - [%$ %noun %noun 'file4'] - == - == == - :: - ;: welp - results0 - results1 - results2 - results3 - results4 - results5 - results6 - results7 - == :: |utilities: helper functions for testing :: :: TODO: make these utilities generic for any vane diff --git a/pkg/arvo/tests/sys/vane/eyre.hoon b/pkg/arvo/tests/sys/vane/eyre.hoon index 41c2955ea..a718d383a 100644 --- a/pkg/arvo/tests/sys/vane/eyre.hoon +++ b/pkg/arvo/tests/sys/vane/eyre.hoon @@ -1,4 +1,4 @@ -/+ *test, *test-ford-external +/+ *test /= eyre-raw /sys/vane/eyre :: !: From 88b834107cf89905d658c9cc704f77a269370f4a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 14 May 2020 07:24:44 -0400 Subject: [PATCH 128/280] gall: pupal phase --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/gall.hoon | 1545 ++++++++++++++++++++--------------- 2 files changed, 871 insertions(+), 678 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 6610aa14f..a1a73d72d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:600d74621bc74756d0488dc38dce8cc7a56c560ca0aa276f0cde81eadac35832 -size 13077251 +oid sha256:9c37d3bca1ecd239b23a4f3f6c8a046dbbcf6e1c1f48b7a89ae14eea2d9a5255 +size 13122161 diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index a220fa080..b89347402 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -6,13 +6,15 @@ =, gall => |% -:: +move: Arvo-level move ++| %main +:: +:: $move: Arvo-level move :: +$ move [=duct move=(wind note-arvo gift-arvo)] -:: +state-5: overall gall state, versioned +:: $state-6: overall gall state, versioned :: -+$ state-5 [%5 state] -:: +state: overall gall state ++$ state-6 [%6 state] +:: $state: overall gall state :: :: system-duct: TODO document :: outstanding: outstanding request queue @@ -27,19 +29,19 @@ yokes=(map term yoke) blocked=(map term (qeu blocked-move)) == -:: +watches: subscribers and publications +:: $watches: subscribers and publications :: :: TODO: rename this, to $ties? :: TODO: rename $boat and $bitt and document :: +$ watches [inbound=bitt outbound=boat] -:: +routes: new cuff; TODO: document +:: $routes: new cuff; TODO: document :: +$ routes $: disclosing=(unit (set ship)) attributing=ship == -:: +yoke: agent runner state +:: $yoke: agent runner state :: :: control-duct: TODO document :: live: is this agent running? TODO document better @@ -58,17 +60,17 @@ =beak marks=(map duct mark) == -:: +blocked-move: enqueued move to an agent +:: $blocked-move: enqueued move to an agent :: +$ blocked-move [=duct =routes =deal] -:: +stats: statistics +:: $stats: statistics :: -:: change: how many moves this agent has processed -:: eny: entropy -:: time: date of current event processing +:: change: how many moves this agent has processed +:: eny: entropy +:: time: date of current event processing :: +$ stats [change=@ud eny=@uvJ time=@da] -:: +ames-response: network response message (%boon) +:: $ames-response: network response message (%boon) :: :: %d: fact :: %x: quit @@ -77,7 +79,7 @@ $% [%d =mark noun=*] [%x ~] == -:: +ames-request: network request (%plea) +:: $ames-request: network request (%plea) :: :: %m: poke :: %l: watch-as @@ -90,7 +92,7 @@ [%s =path] [%u ~] == -:: +remote-request: kinds of agent actions that can cross the network +:: $remote-request: kinds of agent actions that can cross the network :: :: Used in wires to identify the kind of remote request we made. :: Bijective with the tags of $ames-request. @@ -102,14 +104,800 @@ %leave %missing == +:: |migrate: data structures for upgrades +:: ++| %migrate +:: +:: $chrysalis: pupal gall state, until agents have reloaded +:: ++$ chrysalis + $: queue=(qeu bolus) + =spore + == +:: $bolus: incoming move to a pupa, enqueued in a $chrysalis +:: ++$ bolus + $% [%call =duct =task:able] + [%take =wire =duct sign=sign-arvo] + == +:: $spore: structures for update, produced by +stay +:: ++$ spore + $: %6 + system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + eggs=(map term egg) + blocked=(map term (qeu blocked-move)) + == +:: $egg: migratory agent state; $yoke with .old-state instead of .agent +:: ++$ egg + $: control-duct=duct + live=? + =stats + =watches + old-state=vase + =beak + marks=(map duct mark) + == -- -=| state=state-5 +:: pupal gall core, on upgrade +:: +=< =* adult-gate . + =| sac=chrysalis + |= [our=ship now=@da eny=@uvJ ski=sley] + =* pupal-gate . + =* adult-core (adult-gate +<) + |% + ++ call + |= [=duct dud=(unit goof) typ=type wrapped-task=(hobo task:able)] + =* call-args +< + ?: =(~ eggs.spore.sac) + ~> %slog.[0 leaf+"gall: direct morphogenesis"] + =. state.adult-gate spore.sac(eggs *(map term yoke)) + (call:adult-core call-args) + ?^ dud + (mean >mote.u.dud< tang.u.dud) + :: + =/ task ((harden task:able:gall) wrapped-task) + ~> %slog.[0 leaf+"gall: pupa call {<-.task>}"] + =. queue.sac (~(put to queue.sac) [%call duct task]) + [*(list move) pupal-gate] + ++ scry scry:adult-core + ++ stay ~|(%gall-subinvolution !!) + ++ take + |= [=wire =duct dud=(unit goof) typ=type sign=sign-arvo] + =* take-args +< + ?: =(~ eggs.spore.sac) + ~> %slog.[0 leaf+"gall: direct morphogenesis"] + =. state.adult-gate spore.sac(eggs *(map term yoke)) + (take:adult-core take-args) + ?^ dud + ~> %slog.[0 leaf+"gall: pupa take dud"] + (mean >mote.u.dud< tang.u.dud) + ?. =(/sys/lyv wire) + ~> %slog.[0 leaf+"gall: pupa take {(spud wire)} {<[- +<]:sign>}"] + =. queue.sac (~(put to queue.sac) [%take wire duct sign]) + [*(list move) pupal-gate] + ~> %slog.[0 leaf+"gall: pupa exiting chrysalis"] + =/ adult adult-core + =. state.adult + [%6 system-duct outstanding contacts yokes=~ blocked]:spore.sac + =/ mo-core (mo-abed:mo:adult duct) + =. mo-core + =/ apps=(list [dap=term =egg]) ~(tap by eggs.spore.sac) + |- ^+ mo-core + ?~ apps mo-core + ~> %slog.[0 leaf+"gall: pupa upgrading {}"] + =/ ap-core (ap-abut:ap:mo-core i.apps) + =^ tan ap-core (ap-install:ap-core `old-state.egg.i.apps) + ?^ tan + (mean u.tan) + $(apps t.apps, mo-core ap-abet:ap-core) + =. mo-core (mo-subscribe-to-agent-builds:mo-core now) + =^ moves adult-gate mo-abet:mo-core + =. moves + %+ weld moves + %+ turn ~(tap to queue.sac) + |= mov=bolus + ^- move + ~& gall-dequeue+-.mov + ?- -.mov + %call [duct.mov %slip %g task.mov] + %take [duct.mov %pass wire.mov %b %huck !>(sign.mov)] + == + ~> %slog.[0 leaf+"gall: metamorphosis"] + [moves adult-gate] + :: + ++ load + |^ + |= old=all-state + =. spore.sac (upgrade old) + ?. =(~ eggs.spore.sac) + pupal-gate + ~> %slog.[0 leaf+"gall: direct morphogenesis"] + adult-gate(state spore.sac(eggs *(map term yoke))) + :: + ++ upgrade + |= =all-state + ^- spore + :: + =? all-state ?=(%0 -.all-state) + (state-0-to-1 all-state) + :: + =? all-state ?=(%1 -.all-state) + (state-1-to-2 all-state) + :: + =? all-state ?=(%2 -.all-state) + (state-2-to-3 all-state) + :: + =? all-state ?=(%3 -.all-state) + (state-3-to-4 all-state) + :: + =? all-state ?=(%4 -.all-state) + (state-4-to-5 all-state) + :: + =? all-state ?=(%5 -.all-state) + (state-5-to-spore-6 all-state) + :: + ?> ?=(%6 -.all-state) + all-state + :: +all-state: upgrade path + :: + ++ all-state $%(state-0 state-1 state-2 state-3 state-4 state-5 spore) + :: + ++ state-5-to-spore-6 + |= =state-5 + ^- spore + =; eggs=(map term egg) state-5(- %6, yokes.agents-5 eggs) + %- ~(run by yokes.agents-5.state-5) + |=(=yoke `egg`yoke(agent on-save:agent.yoke)) + :: + ++ state-5 + $: %5 + =agents-5 + == + :: + ++ agents-5 + $: system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + yokes=(map term yoke-5) + blocked=(map term (qeu blocked-move)) + == + :: + ++ yoke-5 + $: control-duct=duct + live=? + =stats + =watches + =agent + =beak + marks=(map duct mark) + == + :: + ++ state-4-to-5 + |= =state-4 + ^- state-5 + %= state-4 + - %5 + running.agents-4 + (~(run by running.agents-4.state-4) |=(yoke-3 +<+)) + == + :: + ++ state-4 + $: %4 + agents-4=agents-3 :: agents-3 is unchanged in state-4 + == + :: + ++ state-3-to-4 + |= =state-3 + ^- state-4 + %= state-3 + - %4 + outstanding.agents-3 ~ + == + :: + ++ state-3 + $: %3 + =agents-3 + == + :: + ++ agents-3 + $: system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + running=(map term yoke-3) + blocked=(map term (qeu blocked-move)) + == + :: + ++ yoke-3 + $: cache=worm + control-duct=duct + live=? + =stats + =watches + =agent + =beak + marks=(map duct mark) + == + :: + ++ state-2-to-3 + |= =state-2 + ^- state-3 + %= state-2 + - %3 + running.agents-2 + %- ~(run by running.agents-2.state-2) + |= =yoke-2 + ^- yoke-3 + %= yoke-2 + agent-2 (agent-2-to-3 agent-2.yoke-2) + == + == + :: + ++ agent-2-to-3 + |= =agent-2 + ^- agent + => |% + ++ cards-2-to-3 + |= cards=(list card:^agent-2) + ^- (list card:agent) + %+ turn cards + |= =card:^agent-2 + ^- card:agent + ?. ?=([%give ?(%fact %kick) *] card) card + %=(card path.p (drop path.p.card)) + -- + |_ =bowl:gall + +* this . + pass ~(. agent-2 bowl) + ++ on-init + =^ cards agent-2 on-init:pass + [(cards-2-to-3 cards) this] + :: + ++ on-save + on-save:pass + :: + ++ on-load + |= old-state=vase + =^ cards agent-2 (on-load:pass old-state) + [(cards-2-to-3 cards) this] + :: + ++ on-poke + |= [=mark =vase] + =^ cards agent-2 (on-poke:pass mark vase) + [(cards-2-to-3 cards) this] + :: + ++ on-watch + |= =path + =^ cards agent-2 (on-watch:pass path) + [(cards-2-to-3 cards) this] + :: + ++ on-leave + |= =path + =^ cards agent-2 (on-leave:pass path) + [(cards-2-to-3 cards) this] + :: + ++ on-peek + |= =path + (on-peek:pass path) + :: + ++ on-agent + |= [=wire =sign:agent:gall] + =^ cards agent-2 (on-agent:pass wire sign) + [(cards-2-to-3 cards) this] + :: + ++ on-arvo + |= [=wire =sign-arvo] + =^ cards agent-2 (on-arvo:pass wire sign-arvo) + [(cards-2-to-3 cards) this] + :: + ++ on-fail + |= [=term =tang] + =^ cards agent-2 (on-fail:pass term tang) + [(cards-2-to-3 cards) this] + -- + :: + ++ state-2 + $: %2 + =agents-2 + == + :: + ++ agents-2 + $: system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + running=(map term yoke-2) + blocked=(map term (qeu blocked-move)) + == + :: + ++ yoke-2 + $: cache=worm + control-duct=duct + live=? + =stats + =watches + =agent-2 + =beak + marks=(map duct mark) + == + :: + ++ agent-2 + =< form + |% + +$ step (quip card form) + +$ card (wind note gift) + +$ note note:agent + +$ task task:agent + +$ sign sign:agent + +$ gift + $% [%fact path=(unit path) =cage] + [%kick path=(unit path) ship=(unit ship)] + [%watch-ack p=(unit tang)] + [%poke-ack p=(unit tang)] + == + ++ form + $_ ^| + |_ bowl + ++ on-init + *(quip card _^|(..on-init)) + :: + ++ on-save + *vase + :: + ++ on-load + |~ old-state=vase + *(quip card _^|(..on-init)) + :: + ++ on-poke + |~ [mark vase] + *(quip card _^|(..on-init)) + :: + ++ on-watch + |~ path + *(quip card _^|(..on-init)) + :: + ++ on-leave + |~ path + *(quip card _^|(..on-init)) + :: + ++ on-peek + |~ path + *(unit (unit cage)) + :: + ++ on-agent + |~ [wire sign] + *(quip card _^|(..on-init)) + :: + ++ on-arvo + |~ [wire sign-arvo] + *(quip card _^|(..on-init)) + :: + ++ on-fail + |~ [term tang] + *(quip card _^|(..on-init)) + -- + -- + :: + ++ state-1-to-2 + |= =state-1 + ^- state-2 + %= state-1 + - %2 + +.agents-1 [~ +.agents-1.state-1] + == + :: + ++ state-1 + $: %1 + =agents-1 + == + :: + ++ agents-1 + $: system-duct=duct + contacts=(set ship) + running=(map term yoke-2) + blocked=(map term (qeu blocked-move)) + == + :: + ++ state-0-to-1 + |= =state-0 + ^- state-1 + %= state-0 + - %1 + running.agents-0 + %- ~(run by running.agents-0.state-0) + |= =yoke-0 + ^- yoke-2 + %= yoke-0 + agent-0 (agent-0-to-1 agent-0.yoke-0) + == + == + :: + ++ agent-0-to-1 + |= =agent-0 + ^- agent-2 + |_ =bowl:gall + +* this . + pass ~(. agent-0 bowl) + ++ on-init + =^ cards agent-0 on-init:pass + [cards this] + :: + ++ on-save + on-save:pass + :: + ++ on-load + |= old-state=vase + =^ cards agent-0 (on-load:pass old-state) + [cards this] + :: + ++ on-poke + |= [=mark =vase] + =^ cards agent-0 (on-poke:pass mark vase) + [cards this] + :: + ++ on-watch + |= =path + =^ cards agent-0 (on-watch:pass path) + [cards this] + :: + ++ on-leave + |= =path + =^ cards agent-0 (on-leave:pass path) + [cards this] + :: + ++ on-peek + |= =path + (on-peek:pass path) + :: + ++ on-agent + |= [=wire =sign:agent:gall] + =^ cards agent-0 (on-agent:pass wire sign) + [cards this] + :: + ++ on-arvo + |= [=wire =sign-arvo] + ?< ?=([%d %pack *] sign-arvo) + =^ cards agent-0 (on-arvo:pass wire `sign-arvo-0`sign-arvo) + [cards this] + :: + ++ on-fail + |= [=term =tang] + =^ cards agent-0 (on-fail:pass term tang) + [cards this] + -- + :: + ++ state-0 + $: %0 + =agents-0 + == + :: + ++ agents-0 + $: system-duct=duct + contacts=(set ship) + running=(map term yoke-0) + blocked=(map term (qeu blocked-move)) + == + :: + ++ yoke-0 + $: cache=worm + control-duct=duct + live=? + =stats + =watches + =agent-0 + =beak + marks=(map duct mark) + == + :: + ++ agent-0 + =< form + |% + +$ step (quip card form) + +$ card (wind note gift) + +$ note note:agent + +$ task task:agent + +$ gift gift:agent-2 + +$ sign sign:agent + ++ form + $_ ^| + |_ bowl + ++ on-init + *(quip card _^|(..on-init)) + :: + ++ on-save + *vase + :: + ++ on-load + |~ old-state=vase + *(quip card _^|(..on-init)) + :: + ++ on-poke + |~ [mark vase] + *(quip card _^|(..on-init)) + :: + ++ on-watch + |~ path + *(quip card _^|(..on-init)) + :: + ++ on-leave + |~ path + *(quip card _^|(..on-init)) + :: + ++ on-peek + |~ path + *(unit (unit cage)) + :: + ++ on-agent + |~ [wire sign] + *(quip card _^|(..on-init)) + :: + ++ on-arvo + |~ [wire sign-arvo-0] + *(quip card _^|(..on-init)) + :: + ++ on-fail + |~ [term tang] + *(quip card _^|(..on-init)) + -- + -- + :: + ++ sign-arvo-0 + $% {$a gift:able:ames} + $: $b + $% gift:able:behn + $>(%wris gift:able:clay) + $>(%writ gift:able:clay) + $>(%mere gift:able:clay) + $>(%unto gift:able:gall) + == + == + {$c gift:able:clay} + {$d $<(%pack gift:able:dill)} + {$f gift:ford} + [%e gift:able:eyre] + {$g gift:able:gall} + [%i gift:able:iris] + {$j gift:able:jael} + == + :: + ++ ford + |% + += gift + $% :: %made: build result; response to %build +task + :: + $: %made + :: date: formal date of the build + :: + date=@da + :: result: result of the build; either complete build, or error + :: + result=made-result + == == + += made-result + $% :: %complete: contains the result of the completed build + :: + [%complete =build-result] + :: %incomplete: couldn't finish build; contains error message + :: + [%incomplete =tang] + == + += build-result + $% :: %error: the build produced an error whose description is :message + :: + [%error message=tang] + :: %success: result of successful +build, tagged by +schematic sub-type + :: + $: %success + $^ [head=build-result tail=build-result] + $% [%$ =cage] + [%alts =build-result] + [%bake =cage] + [%bunt =cage] + [%call =vase] + [%cast =cage] + [%core =vase] + [%diff =cage] + [%hood =scaffold] + [%join =cage] + [%list results=(list build-result)] + [%mash =cage] + [%mute =cage] + [%pact =cage] + [%path =rail] + [%plan =vase] + [%reef =vase] + [%ride =vase] + [%scry =cage] + [%slim [=type =nock]] + [%slit =type] + [%vale =cage] + [%volt =cage] + [%walk results=(list mark-action)] + == == == + += scaffold + $: :: source-rail: the file this scaffold was parsed from + :: + source-rail=rail + :: zuse-version: the kelvin version of the standard library + :: + zuse-version=@ud + :: structures: files from %/sur which are included + :: + structures=(list cable) + :: libraries: files from %/lib which are included + :: + libraries=(list cable) + :: cranes: a list of resources to transform and include + :: + cranes=(list crane) + :: sources: hoon sources, either parsed or on the filesystem + :: + sources=(list hoon) + == + += mark-action [type=?(%grow %grab) source=term target=term] + += rail [=disc =spur] + +$ cable + $: face=(unit term) + file-path=term + == + += crane + $% $: :: %fssg: `/~` hoon literal + :: + :: `/~ ` produces a crane that evaluates arbitrary hoon. + :: + %fssg + =hoon + == + $: :: %fsbc: `/$` process query string + :: + :: `/$` will call a gate with the query string supplied to this + :: build. If no query string, this errors. + :: + %fsbc + =hoon + == + $: :: %fsbr: `/|` first of many options that succeeds + :: + :: `/|` takes a series of cranes and produces the first one + :: (left-to-right) that succeeds. If none succeed, it produces + :: stack traces from all of its arguments. + :: + %fsbr + :: choices: cranes to try + :: + choices=(list crane) + == + $: :: %fsts: `/=` wrap a face around a crane + :: + :: /= runs a crane (usually produced by another ford rune), takes + :: the result of that crane, and wraps a face around it. + :: + %fsts + :: face: face to apply + :: + face=term + :: crane: internal build step + :: + =crane + == + $: :: %fsdt: `/.` null-terminated list + :: + :: Produce a null-terminated list from a sequence of cranes, + :: terminated by a `==`. + :: + %fsdt + :: items: cranes to evaluate + :: + items=(list crane) + == + $: :: %fscm: `/,` switch by path + :: + :: `/,` is a switch statement, which picks a branch to evaluate + :: based on whether the current path matches the path in the + :: switch statement. Takes a sequence of pairs of (path, crane) + :: terminated by a `==`. + :: + %fscm + :: cases: produces evaluated crane of first +spur match + :: + cases=(list (pair spur crane)) + == + $: :: %fspm: `/&` pass through a series of marks + :: + :: `/&` passes a crane through multiple marks, right-to-left. + :: + %fspm + :: marks: marks to apply to :crane, in reverse order + :: + marks=(list mark) + =crane + == + $: :: %fscb: `/_` run a crane on each file in the current directory + :: + :: `/_` takes a crane as an argument. It produces a new crane + :: representing the result of mapping the supplied crane over the + :: list of files in the current directory. The keys in the + :: resulting map are the basenames of the files in the directory, + :: and each value is the result of running that crane on the + :: contents of the file. + :: + %fscb + =crane + == + $: :: %fssm: `/;` operate on + :: + :: `/;` takes a hoon and a crane. The hoon should evaluate to a + :: gate, which is then called with the result of the crane as its + :: sample. + :: + %fssm + =hoon + =crane + == + $: :: %fscl: `/:` evaluate at path + :: + :: `/:` takes a path and a +crane, and evaluates the crane with + :: the current path set to the supplied path. + :: + %fscl + :: path: late bound path to be resolved relative to current beak + :: + :: This becomes current path of :crane + :: + path=truss + =crane + == + $: :: %fskt: `/^` cast + :: + :: `/^` takes a +mold and a +crane, and casts the result of the + :: crane to the mold. + :: + %fskt + :: mold: evaluates to a mold to be applied to :crane + :: + =spec + =crane + == + $: :: %fstr: `/*` run :crane on all files with current path as prefix + :: + %fstr + =crane + == + $: :: %fszp: `/!mark/` evaluate as hoon, then pass through mark + :: + %fszp + =mark + == + $: :: %fszy: `/mark/` passes current path through :mark + :: + %fszy + =mark + == == + += truss + $: pre=(unit tyke) + pof=(unit [p=@ud q=tyke]) + == + -- + -- + -- +:: adult gall vane interface, for type compatibility with pupa +:: +=| state=state-6 |= [our=ship now=@da eny=@uvJ ski=sley] +=* gall-payload . +=< ~% %gall-wrap ..mo ~ + |% + ++ call ^call + ++ load ^load + ++ scry ^scry + ++ stay ^stay + ++ take ^take + -- ~% %gall-top ..is ~ |% -:: +gall-payload: gall payload -:: -++ gall-payload + :: +mo: Arvo-level move handling :: :: An outer core responsible for routing moves to and from Arvo; it calls @@ -170,20 +958,12 @@ :: ++ mo-receive-core ~/ %mo-receive-core - |= [dap=term bek=beak =cage] + |= [dap=term bek=beak =agent] ^+ mo-core :: =/ existing (~(get by yokes.state) dap) =/ re ?~(existing "" "re") ~> %slog.[0 leaf+"gall: {re}loading {}"] - ?. =(%vase p.cage) - (mo-give %onto |+[leaf+"gall: bad mark {} for agent {}"]~) - :: - =/ maybe-new-agent (mule |.(!<(agent !<(vase q.cage)))) - ?: ?=(%| -.maybe-new-agent) - =/ err [[%leaf "{}: not valid agent"] p.maybe-new-agent] - (mo-give %onto %.n err) - =/ =agent p.maybe-new-agent :: ?^ existing =. yokes.state @@ -216,20 +996,41 @@ (mo-give %onto [%.y suss]) :: +mo-subscribe-to-agent-builds: request agent update notices :: + :: Also subscribe to our own source path, in case we get reloaded + :: but none of the agents do. This way, Clay will still notify us, + :: and we'll be able to exit the chrysalis. + :: ++ mo-subscribe-to-agent-builds |= date=@da ^+ mo-core =. mo-core (mo-abed system-duct.state) - =/ =wire /sys/lyv :: TODO: add $aeon to wire as sanity check + =/ =wire /sys/lyv =. mo-core (mo-pass /sys/lyv %c %warp our %home ~) =/ =mool:clay :- da+date %- ~(gas in *(set [care:clay path])) + :- [%z /sys/vane/gall/hoon] %+ turn ~(tap in ~(key by yokes.state)) |= dap=term ^- [care:clay path] [%a /app/[dap]/hoon] (mo-pass wire %c %warp our %home ~ %mult mool) + :: +mo-scry-agent-cage: read $agent core from clay + :: + ++ mo-scry-agent-cage + |= [dap=term =case:clay] + ^- (each agent tang) + =/ bek=beak [our %home case] + =/ sky (ski [%141 %noun] ~ %ca bek /hoon/[dap]/app) + ?~ sky |+[leaf+"gall: {} scry blocked"]~ + ?~ u.sky |+[leaf+"gall: {} scry failed"]~ + =/ =cage u.u.sky + ?. =(%vase p.cage) + |+[leaf+"gall: bad mark {} for agent {}"]~ + =/ res (mule |.(!<(agent !<(vase q.cage)))) + ?: ?=(%& -.res) + &+p.res + |+[[leaf+"gall: {} not valid agent"] p.res] :: +mo-send-foreign-request: handle local request to .ship :: ++ mo-send-foreign-request @@ -354,7 +1155,13 @@ =/ =beak [(slav %p her) desk da+tim] ?> ?=([?(%b %c) %writ *] sign-arvo) ?^ p.sign-arvo - =. mo-core (mo-receive-core dap beak r.u.p.sign-arvo) + =/ cag=cage r.u.p.sign-arvo + ?. =(%vase p.cag) + (mo-give %onto |+[leaf+"gall: invalid %writ {} for {}"]~) + =/ res (mule |.(!<(agent !<(vase q.cag)))) + ?: ?=(%| -.res) + (mo-give %onto |+[leaf+"gall: {}" p.res]) + =. mo-core (mo-receive-core dap beak p.res) (mo-subscribe-to-agent-builds tim) (mo-give %onto |+[leaf+"gall: failed to build agent {}"]~) :: +mo-handle-sys-lyv: handle notice that agents have been rebuilt @@ -374,8 +1181,10 @@ ^+ cor ?> =(%a care) =/ dap dap:;;([%app dap=@tas %hoon ~] path) - =/ cage (need (need (ski [%141 %noun] ~ %ca bek (flop path)))) - (mo-receive-core:cor dap bek cage) + =/ rag (mo-scry-agent-cage dap p.sign-arvo) + ?: ?=(%| -.rag) + (mean p.rag) + (mo-receive-core:cor dap bek p.rag) :: +mo-handle-sys-lag: handle an ames %clog notification :: ++ mo-handle-sys-lag @@ -747,17 +1556,28 @@ ~/ %ap-abed |= [dap=term =routes] ^+ ap-core - :: - =/ =yoke - =/ running (~(got by yokes.state) dap) - =/ =stats - :+ +(change.stats.running) - (shaz (mix (add dap change.stats.running) eny)) - now - running(stats stats) - :: + (ap-yoke dap (~(got by yokes.state) dap)) + :: +ap-hatch: initialize agent state from $egg, after upgrade + :: + ++ ap-abut + |= [dap=term =egg] + ^+ ap-core + =/ res (mo-scry-agent-cage dap da+now) + ?: ?=(%| -.res) + (mean p.res) + =/ =yoke egg(old-state `agent`p.res) + (ap-yoke dap yoke) + :: +ap-yoke: initialize agent state, starting from a $yoke + :: + ++ ap-yoke + |= [dap=term =yoke] + ^+ ap-core + =. stats.yoke + :+ +(change.stats.yoke) + (shaz (mix (add dap change.stats.yoke) eny)) + now =. agent-name dap - =. agent-routes routes + =. agent-routes [disclosing=~ attributing=our] =. current-agent yoke =. agent-duct hen ap-core @@ -1388,640 +2208,9 @@ %trim [~ gall-payload] %vega [~ gall-payload] == -:: +load: recreate vane +:: +load: recreate vane; note, only valid if called from pupa :: -++ load - |^ - |= =all-state - ^+ gall-payload - :: - =? all-state ?=(%0 -.all-state) - (state-0-to-1 all-state) - :: - =? all-state ?=(%1 -.all-state) - (state-1-to-2 all-state) - :: - =? all-state ?=(%2 -.all-state) - (state-2-to-3 all-state) - :: - =? all-state ?=(%3 -.all-state) - (state-3-to-4 all-state) - :: - =? all-state ?=(%4 -.all-state) - (state-4-to-5 all-state) - :: - ?> ?=(%5 -.all-state) - gall-payload(state all-state) - :: - :: +all-state: upgrade path - :: - ++ all-state $%(state-0 state-1 state-2 state-3 state-4 state-5) - :: - ++ state-4-to-5 - |= =state-4 - ^- state-5 - %= state-4 - - %5 - running.agents-4 - (~(run by running.agents-4.state-4) |=(yoke-3 +<+)) - == - :: - ++ state-4 - $: %4 - agents-4=agents-3 :: agents-3 is unchanged in state-4 - == - :: - ++ state-3-to-4 - |= =state-3 - ^- state-4 - %= state-3 - - %4 - outstanding.agents-3 ~ - == - :: - ++ state-3 - $: %3 - =agents-3 - == - :: - ++ agents-3 - $: system-duct=duct - outstanding=(map [wire duct] (qeu remote-request)) - contacts=(set ship) - running=(map term yoke-3) - blocked=(map term (qeu blocked-move)) - == - :: - ++ yoke-3 - $: cache=worm - control-duct=duct - live=? - =stats - =watches - =agent - =beak - marks=(map duct mark) - == - :: - ++ state-2-to-3 - |= =state-2 - ^- state-3 - %= state-2 - - %3 - running.agents-2 - %- ~(run by running.agents-2.state-2) - |= =yoke-2 - ^- yoke-3 - %= yoke-2 - agent-2 (agent-2-to-3 agent-2.yoke-2) - == - == - :: - ++ agent-2-to-3 - |= =agent-2 - ^- agent - => |% - ++ cards-2-to-3 - |= cards=(list card:^agent-2) - ^- (list card:agent) - %+ turn cards - |= =card:^agent-2 - ^- card:agent - ?. ?=([%give ?(%fact %kick) *] card) card - %=(card path.p (drop path.p.card)) - -- - |_ =bowl:gall - +* this . - pass ~(. agent-2 bowl) - ++ on-init - =^ cards agent-2 on-init:pass - [(cards-2-to-3 cards) this] - :: - ++ on-save - on-save:pass - :: - ++ on-load - |= old-state=vase - =^ cards agent-2 (on-load:pass old-state) - [(cards-2-to-3 cards) this] - :: - ++ on-poke - |= [=mark =vase] - =^ cards agent-2 (on-poke:pass mark vase) - [(cards-2-to-3 cards) this] - :: - ++ on-watch - |= =path - =^ cards agent-2 (on-watch:pass path) - [(cards-2-to-3 cards) this] - :: - ++ on-leave - |= =path - =^ cards agent-2 (on-leave:pass path) - [(cards-2-to-3 cards) this] - :: - ++ on-peek - |= =path - (on-peek:pass path) - :: - ++ on-agent - |= [=wire =sign:agent:gall] - =^ cards agent-2 (on-agent:pass wire sign) - [(cards-2-to-3 cards) this] - :: - ++ on-arvo - |= [=wire =sign-arvo] - =^ cards agent-2 (on-arvo:pass wire sign-arvo) - [(cards-2-to-3 cards) this] - :: - ++ on-fail - |= [=term =tang] - =^ cards agent-2 (on-fail:pass term tang) - [(cards-2-to-3 cards) this] - -- - :: - ++ state-2 - $: %2 - =agents-2 - == - :: - ++ agents-2 - $: system-duct=duct - outstanding=(map [wire duct] (qeu remote-request)) - contacts=(set ship) - running=(map term yoke-2) - blocked=(map term (qeu blocked-move)) - == - :: - ++ yoke-2 - $: cache=worm - control-duct=duct - live=? - =stats - =watches - =agent-2 - =beak - marks=(map duct mark) - == - :: - ++ agent-2 - =< form - |% - +$ step (quip card form) - +$ card (wind note gift) - +$ note note:agent - +$ task task:agent - +$ sign sign:agent - +$ gift - $% [%fact path=(unit path) =cage] - [%kick path=(unit path) ship=(unit ship)] - [%watch-ack p=(unit tang)] - [%poke-ack p=(unit tang)] - == - ++ form - $_ ^| - |_ bowl - ++ on-init - *(quip card _^|(..on-init)) - :: - ++ on-save - *vase - :: - ++ on-load - |~ old-state=vase - *(quip card _^|(..on-init)) - :: - ++ on-poke - |~ [mark vase] - *(quip card _^|(..on-init)) - :: - ++ on-watch - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-leave - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-peek - |~ path - *(unit (unit cage)) - :: - ++ on-agent - |~ [wire sign] - *(quip card _^|(..on-init)) - :: - ++ on-arvo - |~ [wire sign-arvo] - *(quip card _^|(..on-init)) - :: - ++ on-fail - |~ [term tang] - *(quip card _^|(..on-init)) - -- - -- - :: - ++ state-1-to-2 - |= =state-1 - ^- state-2 - %= state-1 - - %2 - +.agents-1 [~ +.agents-1.state-1] - == - :: - ++ state-1 - $: %1 - =agents-1 - == - :: - ++ agents-1 - $: system-duct=duct - contacts=(set ship) - running=(map term yoke-2) - blocked=(map term (qeu blocked-move)) - == - :: - ++ state-0-to-1 - |= =state-0 - ^- state-1 - %= state-0 - - %1 - running.agents-0 - %- ~(run by running.agents-0.state-0) - |= =yoke-0 - ^- yoke-2 - %= yoke-0 - agent-0 (agent-0-to-1 agent-0.yoke-0) - == - == - :: - ++ agent-0-to-1 - |= =agent-0 - ^- agent-2 - |_ =bowl:gall - +* this . - pass ~(. agent-0 bowl) - ++ on-init - =^ cards agent-0 on-init:pass - [cards this] - :: - ++ on-save - on-save:pass - :: - ++ on-load - |= old-state=vase - =^ cards agent-0 (on-load:pass old-state) - [cards this] - :: - ++ on-poke - |= [=mark =vase] - =^ cards agent-0 (on-poke:pass mark vase) - [cards this] - :: - ++ on-watch - |= =path - =^ cards agent-0 (on-watch:pass path) - [cards this] - :: - ++ on-leave - |= =path - =^ cards agent-0 (on-leave:pass path) - [cards this] - :: - ++ on-peek - |= =path - (on-peek:pass path) - :: - ++ on-agent - |= [=wire =sign:agent:gall] - =^ cards agent-0 (on-agent:pass wire sign) - [cards this] - :: - ++ on-arvo - |= [=wire =sign-arvo] - ?< ?=([%d %pack *] sign-arvo) - =^ cards agent-0 (on-arvo:pass wire `sign-arvo-0`sign-arvo) - [cards this] - :: - ++ on-fail - |= [=term =tang] - =^ cards agent-0 (on-fail:pass term tang) - [cards this] - -- - :: - ++ state-0 - $: %0 - =agents-0 - == - :: - ++ agents-0 - $: system-duct=duct - contacts=(set ship) - running=(map term yoke-0) - blocked=(map term (qeu blocked-move)) - == - :: - ++ yoke-0 - $: cache=worm - control-duct=duct - live=? - =stats - =watches - =agent-0 - =beak - marks=(map duct mark) - == - :: - ++ agent-0 - =< form - |% - +$ step (quip card form) - +$ card (wind note gift) - +$ note note:agent - +$ task task:agent - +$ gift gift:agent-2 - +$ sign sign:agent - ++ form - $_ ^| - |_ bowl - ++ on-init - *(quip card _^|(..on-init)) - :: - ++ on-save - *vase - :: - ++ on-load - |~ old-state=vase - *(quip card _^|(..on-init)) - :: - ++ on-poke - |~ [mark vase] - *(quip card _^|(..on-init)) - :: - ++ on-watch - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-leave - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-peek - |~ path - *(unit (unit cage)) - :: - ++ on-agent - |~ [wire sign] - *(quip card _^|(..on-init)) - :: - ++ on-arvo - |~ [wire sign-arvo-0] - *(quip card _^|(..on-init)) - :: - ++ on-fail - |~ [term tang] - *(quip card _^|(..on-init)) - -- - -- - :: - ++ sign-arvo-0 - $% {$a gift:able:ames} - $: $b - $% gift:able:behn - $>(%wris gift:able:clay) - $>(%writ gift:able:clay) - $>(%mere gift:able:clay) - $>(%unto gift:able:gall) - == - == - {$c gift:able:clay} - {$d $<(%pack gift:able:dill)} - {$f gift:ford} - [%e gift:able:eyre] - {$g gift:able:gall} - [%i gift:able:iris] - {$j gift:able:jael} - == - :: - ++ ford - |% - += gift - $% :: %made: build result; response to %build +task - :: - $: %made - :: date: formal date of the build - :: - date=@da - :: result: result of the build; either complete build, or error - :: - result=made-result - == == - += made-result - $% :: %complete: contains the result of the completed build - :: - [%complete =build-result] - :: %incomplete: couldn't finish build; contains error message - :: - [%incomplete =tang] - == - += build-result - $% :: %error: the build produced an error whose description is :message - :: - [%error message=tang] - :: %success: result of successful +build, tagged by +schematic sub-type - :: - $: %success - $^ [head=build-result tail=build-result] - $% [%$ =cage] - [%alts =build-result] - [%bake =cage] - [%bunt =cage] - [%call =vase] - [%cast =cage] - [%core =vase] - [%diff =cage] - [%hood =scaffold] - [%join =cage] - [%list results=(list build-result)] - [%mash =cage] - [%mute =cage] - [%pact =cage] - [%path =rail] - [%plan =vase] - [%reef =vase] - [%ride =vase] - [%scry =cage] - [%slim [=type =nock]] - [%slit =type] - [%vale =cage] - [%volt =cage] - [%walk results=(list mark-action)] - == == == - += scaffold - $: :: source-rail: the file this scaffold was parsed from - :: - source-rail=rail - :: zuse-version: the kelvin version of the standard library - :: - zuse-version=@ud - :: structures: files from %/sur which are included - :: - structures=(list cable) - :: libraries: files from %/lib which are included - :: - libraries=(list cable) - :: cranes: a list of resources to transform and include - :: - cranes=(list crane) - :: sources: hoon sources, either parsed or on the filesystem - :: - sources=(list hoon) - == - += mark-action [type=?(%grow %grab) source=term target=term] - += rail [=disc =spur] - +$ cable - $: face=(unit term) - file-path=term - == - += crane - $% $: :: %fssg: `/~` hoon literal - :: - :: `/~ ` produces a crane that evaluates arbitrary hoon. - :: - %fssg - =hoon - == - $: :: %fsbc: `/$` process query string - :: - :: `/$` will call a gate with the query string supplied to this - :: build. If no query string, this errors. - :: - %fsbc - =hoon - == - $: :: %fsbr: `/|` first of many options that succeeds - :: - :: `/|` takes a series of cranes and produces the first one - :: (left-to-right) that succeeds. If none succeed, it produces - :: stack traces from all of its arguments. - :: - %fsbr - :: choices: cranes to try - :: - choices=(list crane) - == - $: :: %fsts: `/=` wrap a face around a crane - :: - :: /= runs a crane (usually produced by another ford rune), takes - :: the result of that crane, and wraps a face around it. - :: - %fsts - :: face: face to apply - :: - face=term - :: crane: internal build step - :: - =crane - == - $: :: %fsdt: `/.` null-terminated list - :: - :: Produce a null-terminated list from a sequence of cranes, - :: terminated by a `==`. - :: - %fsdt - :: items: cranes to evaluate - :: - items=(list crane) - == - $: :: %fscm: `/,` switch by path - :: - :: `/,` is a switch statement, which picks a branch to evaluate - :: based on whether the current path matches the path in the - :: switch statement. Takes a sequence of pairs of (path, crane) - :: terminated by a `==`. - :: - %fscm - :: cases: produces evaluated crane of first +spur match - :: - cases=(list (pair spur crane)) - == - $: :: %fspm: `/&` pass through a series of marks - :: - :: `/&` passes a crane through multiple marks, right-to-left. - :: - %fspm - :: marks: marks to apply to :crane, in reverse order - :: - marks=(list mark) - =crane - == - $: :: %fscb: `/_` run a crane on each file in the current directory - :: - :: `/_` takes a crane as an argument. It produces a new crane - :: representing the result of mapping the supplied crane over the - :: list of files in the current directory. The keys in the - :: resulting map are the basenames of the files in the directory, - :: and each value is the result of running that crane on the - :: contents of the file. - :: - %fscb - =crane - == - $: :: %fssm: `/;` operate on - :: - :: `/;` takes a hoon and a crane. The hoon should evaluate to a - :: gate, which is then called with the result of the crane as its - :: sample. - :: - %fssm - =hoon - =crane - == - $: :: %fscl: `/:` evaluate at path - :: - :: `/:` takes a path and a +crane, and evaluates the crane with - :: the current path set to the supplied path. - :: - %fscl - :: path: late bound path to be resolved relative to current beak - :: - :: This becomes current path of :crane - :: - path=truss - =crane - == - $: :: %fskt: `/^` cast - :: - :: `/^` takes a +mold and a +crane, and casts the result of the - :: crane to the mold. - :: - %fskt - :: mold: evaluates to a mold to be applied to :crane - :: - =spec - =crane - == - $: :: %fstr: `/*` run :crane on all files with current path as prefix - :: - %fstr - =crane - == - $: :: %fszp: `/!mark/` evaluate as hoon, then pass through mark - :: - %fszp - =mark - == - $: :: %fszy: `/mark/` passes current path through :mark - :: - %fszy - =mark - == == - += truss - $: pre=(unit tyke) - pof=(unit [p=@ud q=tyke]) - == - -- - -- +++ load !! :: +scry: standard scry :: ++ scry @@ -2066,7 +2255,11 @@ (mo-peek:mo dap routes care path) :: +stay: save without cache :: -++ stay state +++ stay + ^- spore + =; eggs=(map term egg) state(yokes eggs) + %- ~(run by yokes.state) + |=(=yoke `egg`yoke(agent on-save:agent.yoke)) :: +take: response :: ++ take From d6b2b961bcffd64dfa326269185cdf504fb3144d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 15 May 2020 03:58:36 -0400 Subject: [PATCH 129/280] /lib/strandio: +trace monadic logger --- pkg/arvo/lib/strandio.hoon | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index 8a645f153..db9db877e 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -580,6 +580,12 @@ ;< ~ bind:m (flog-text i.wall) loop(wall t.wall) :: +++ trace + |= =tang + =/ m (strand ,~) + ^- form:m + (pure:m ((slog tang) ~)) +:: ++ app-message |= [app=term =cord =tang] =/ m (strand ,~) From 9bb6daad068aaf19acd8d480cb1a9c27506b8739 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 15 May 2020 04:00:56 -0400 Subject: [PATCH 130/280] -work: create and mount dev desks --- pkg/arvo/ted/work.hoon | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pkg/arvo/ted/work.hoon diff --git a/pkg/arvo/ted/work.hoon b/pkg/arvo/ted/work.hoon new file mode 100644 index 000000000..adbb4fa45 --- /dev/null +++ b/pkg/arvo/ted/work.hoon @@ -0,0 +1,36 @@ +:: -work: create and mount development desk(s) +:: +:: With no arguments, creates and mounts a %work desk. +:: If there are arguments, each one is created and mounted. +:: All desks are begun by merging from our %home desk. +:: +/- spider +/+ strandio +=, strand=strand:spider +^- thread:spider +|= arg=vase +=/ m (strand ,vase) +^- form:m +=+ !<(desks=(list desk) arg) +=? desks =(~ desks) [%work]~ +|- ^- form:m +=* loop $ +?~ desks (pure:m !>(ok=&)) +:: |merge %work our %home +:: +;< [=ship =desk =case:clay] bind:m get-beak:strandio +=/ kiln-merge [i.desks ship %home case %auto] +;< ~ bind:m (poke-our:strandio %hood %kiln-merge !>(kiln-merge)) +;< ~ bind:m (trace:strandio leaf+"work: merged {}" ~) +:: sleep 10ms to defer to new event +:: +:: TODO: This crashes if it's in the same event for some reason. +:: +;< ~ bind:m (sleep:strandio `@dr`(div ~s1 100)) +:: |mount %work +:: +=/ pax=path (en-beam:format [ship i.desks case] /) +;< ~ bind:m (poke-our:strandio %hood %kiln-mount !>([pax i.desks])) +;< ~ bind:m (trace:strandio leaf+"work: mounted {}" ~) +:: +loop(desks t.desks) From b7beb6a69785846b706de4f0b40881e5dd32cf5e Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Sat, 16 May 2020 05:22:39 -0700 Subject: [PATCH 131/280] clay: make covariant in type of +hoon --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/clay.hoon | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a1a73d72d..8cee85a8c 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c37d3bca1ecd239b23a4f3f6c8a046dbbcf6e1c1f48b7a89ae14eea2d9a5255 -size 13122161 +oid sha256:aa03602671bf8e42072f75ae41c6978fd670a84c33959a7caf29fb125355fcf8 +size 13137499 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index abb84b0d0..43092c628 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3810,7 +3810,30 @@ ?: ?=(%& -.u.u.p.result) ``p.u.u.p.result ~ :: -++ stay [ver ruf] +:: We clear the ford cache by replacing it with its bunt as a literal. +:: This nests within +ford-cache without reference to +type, +hoon, or +:: anything else in the sample of cache objects. Otherwise we would be +:: contravariant in the those types, which makes them harder to change. +:: +++ stay + :- ver + %= ruf + dos.rom + %- ~(run by dos.rom.ruf) + |= =dojo + dojo(fod.dom [~ ~ ~]) + :: + hoy + %- ~(run by hoy.ruf) + |= =rung + %= rung + rus + %- ~(run by rus.rung) + |= =rede + rede(fod.dom [~ ~ ~]) + == + == +:: ++ take :: accept response |= [tea=wire hen=duct dud=(unit goof) hin=(hypo sign)] ^+ [*(list move) ..^$] From 2583da4d31a615b9a1361cc12d9ee63381dd0085 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Sun, 17 May 2020 00:22:51 -0700 Subject: [PATCH 132/280] gall: subscribe to hoon/arvo/zuse as well --- pkg/arvo/sys/vane/gall.hoon | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index b89347402..dfe6c10d5 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1009,11 +1009,15 @@ =/ =mool:clay :- da+date %- ~(gas in *(set [care:clay path])) - :- [%z /sys/vane/gall/hoon] - %+ turn ~(tap in ~(key by yokes.state)) - |= dap=term - ^- [care:clay path] - [%a /app/[dap]/hoon] + :* [%z /sys/hoon/hoon] + [%z /sys/arvo/hoon] + [%z /sys/zuse/hoon] + [%z /sys/vane/gall/hoon] + %+ turn ~(tap in ~(key by yokes.state)) + |= dap=term + ^- [care:clay path] + [%a /app/[dap]/hoon] + == (mo-pass wire %c %warp our %home ~ %mult mool) :: +mo-scry-agent-cage: read $agent core from clay :: From 161cc7aa15213c50d82e4584830dc0a5902d1828 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Sun, 17 May 2020 01:59:10 -0700 Subject: [PATCH 133/280] clay: put ship/desk in compiler path --- pkg/arvo/sys/vane/clay.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 43092c628..7937de5b5 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -394,6 +394,7 @@ [ducts (print-wove wove)] :: ++ fusion + |= [her=@p syd=desk] => |% :: +an: $ankh interface door @@ -832,7 +833,7 @@ == :: %+ cook |=(huz=(list hoon) `hoon`tssg+huz) - (most gap tall:(vang & pax)) + (most gap tall:(vang & (scot %p her) syd '1' pax)) == == :: @@ -984,6 +985,8 @@ dos.rom (~(put by dos.rom.ruf) syd [qyx dom per pew]:red) == :: + ++ fusion (^fusion her syd) + :: :: Handle `%sing` requests :: ++ aver From aaf7a45e256033f1e20a64ac9f347e4e36fc5e6c Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Sun, 17 May 2020 02:01:17 -0700 Subject: [PATCH 134/280] arvo: properly print %warn --- pkg/arvo/sys/arvo.hoon | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 1ff75b5a4..59e76cf2c 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1112,10 +1112,18 @@ :: Print warning and no-op. :: %warn - ?: =(%& -:(mule |.(((slog ;;(tank q.q.ovo) ~) ~)))) - [~ arvo] - ~> %slog.[0 leaf+"arvo: %warn print-fail"] - [~ arvo] + :_ arvo + ?. ?=(^ +.q.ovo) + ~ + =/ msg=tape + :(weld "(for %" (trip (symp +<.q.ovo)) ") failed") + ~> %slog.[0 leaf+(weld "arvo: replacement event " msg)] + ?: lac + ~ + =/ rep + %- mule |. + ((slog (tang +>.q.ovo)) ~) + ~ :: Process these events just as if they had come from a vane :: ?(%lyra %veer %verb %wack %whey) (feck now ovo *debt:le:part) From 64882f09e7ecb1886b430c69a06d9a8bda8d43ea Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 19 May 2020 16:53:55 -0400 Subject: [PATCH 135/280] /gen,/app: stop using /= --- pkg/arvo/app/chat-view.hoon | 12 ++++++++++-- pkg/arvo/app/contact-hook.hoon | 18 ++++++++++++++---- pkg/arvo/app/contact-view.hoon | 9 +++++++-- pkg/arvo/app/group-hook.hoon | 11 ++++++++--- pkg/arvo/app/invite-hook.hoon | 12 ++++++++++-- pkg/arvo/app/invite-view.hoon | 4 +++- pkg/arvo/app/metadata-hook.hoon | 13 +++++++++---- pkg/arvo/app/permission-group-hook.hoon | 3 ++- pkg/arvo/app/permission-hook.hoon | 7 ++++++- pkg/arvo/app/ping.hoon | 4 ++-- pkg/arvo/app/publish.hoon | 6 +++++- pkg/arvo/gen/acme/domain-validation.hoon | 8 +++++++- pkg/arvo/gen/azimuth-block.hoon | 9 +++++++-- pkg/arvo/gen/azimuth-sources.hoon | 4 ++-- pkg/arvo/gen/hood/static.hoon | 1 + pkg/arvo/gen/keys.hoon | 9 ++++++--- pkg/arvo/gen/spider/tree.hoon | 7 +++++-- 17 files changed, 104 insertions(+), 33 deletions(-) diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index fd6222cc5..2b9f24dbb 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -114,7 +114,10 @@ :: ++ truncated-inbox-scry ^- inbox - =/ =inbox .^(inbox %gx /=chat-store/(scot %da now.bol)/all/noun) + =/ =inbox + =/ our (scot %p our.bowl) + =/ now (scot %da now.bowl) + .^(inbox %gx /[our]/chat-store/[now]/all/noun) %- ~(run by inbox) |= =mailbox ^- ^mailbox @@ -424,7 +427,12 @@ ++ chat-scry |= pax=path ^- (unit mailbox) - =. pax ;:(weld /=chat-store/(scot %da now.bol)/mailbox pax /noun) + =. pax + ;: weld + /(scot %p our.bowl)/chat-store/(scot %da now.bol)/mailbox + pax + /noun + == .^((unit mailbox) %gx pax) :: ++ maybe-group-from-chat diff --git a/pkg/arvo/app/contact-hook.hoon b/pkg/arvo/app/contact-hook.hoon index 9ea215ca8..679830aa7 100644 --- a/pkg/arvo/app/contact-hook.hoon +++ b/pkg/arvo/app/contact-hook.hoon @@ -413,20 +413,30 @@ ++ contacts-scry |= pax=path ^- (unit contacts) - =. pax ;:(weld /=contact-store/(scot %da now.bol)/contacts pax /noun) + =. pax + ;: weld + /(scot %p our.bol)/contact-store/(scot %da now.bol)/contacts + pax + /noun + == .^((unit contacts) %gx pax) :: ++ invite-scry |= uid=serial ^- (unit invite) =/ pax - /=invite-store/(scot %da now.bol)/invite/contacts/(scot %uv uid)/noun + ;: weld + /(scot %p our.bol)/invite-store/(scot %da now.bol) + /invite/contacts/(scot %uv uid)/noun + == .^((unit invite) %gx pax) :: ++ group-scry |= pax=path - ^- (unit group) - .^((unit group) %gx ;:(weld /=group-store/(scot %da now.bol) pax /noun)) + .^ (unit group) + %gx + ;:(weld /(scot %p our.bol)/group-store/(scot %da now.bol) pax /noun) + == :: ++ pull-wire |= pax=path diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index aceaaa3be..2590d7e33 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -270,11 +270,16 @@ :: ++ all-scry ^- rolodex - .^(rolodex %gx /=contact-store/(scot %da now.bol)/all/noun) + .^(rolodex %gx /(scot %p our.bowl)/contact-store/(scot %da now.bol)/all/noun) :: ++ contact-scry |= pax=path ^- (unit contact) - =. pax ;:(weld /=contact-store/(scot %da now.bol)/contact pax /noun) + =. pax + ;: weld + /(scot %p our.bowl)/contact-store/(scot %da now.bol)/contact + pax + /noun + == .^((unit contact) %gx pax) -- diff --git a/pkg/arvo/app/group-hook.hoon b/pkg/arvo/app/group-hook.hoon index 3bf44d3f0..cdce3c977 100644 --- a/pkg/arvo/app/group-hook.hoon +++ b/pkg/arvo/app/group-hook.hoon @@ -57,7 +57,7 @@ ?. (~(has by synced.state) t.path) (on-watch:def path) =/ scry-path=^path - :(welp /=group-store/(scot %da now.bowl) t.path /noun) + :(welp /(scot %p our.bowl)/group-store/(scot %da now.bowl) t.path /noun) =/ grp=(unit group) .^((unit group) %gx scry-path) ?~ grp @@ -209,8 +209,13 @@ :: ++ group-scry |= pax=path - ^- (unit group) - .^((unit group) %gx ;:(weld /=group-store/(scot %da now.bol) pax /noun)) + .^ (unit group) + %gx + (scot %p our.bowl) + %group-store + (scot %da now.bowl) + (weld pax /noun) + == :: ++ update-subscribers |= [pax=path diff=group-update] diff --git a/pkg/arvo/app/invite-hook.hoon b/pkg/arvo/app/invite-hook.hoon index 22cb95b29..2e4cef97b 100644 --- a/pkg/arvo/app/invite-hook.hoon +++ b/pkg/arvo/app/invite-hook.hoon @@ -100,14 +100,22 @@ |= pax=path ^- (unit invitatory) =. pax - ;:(weld /=invite-store/(scot %da now.bowl)/invitatory pax /noun) + ;: weld + /(scot %p our.bowl)/invite-store/(scot %da now.bowl)/invitatory + pax + /noun + == .^((unit invitatory) %gx pax) :: ++ invite-scry |= [pax=path uid=serial] ^- (unit invite) =. pax - ;:(weld /=invite-store/(scot %da now.bowl)/invite pax /(scot %uv uid)/noun) + ;: weld + /(scot %p our.bowl)/invite-store/(scot %da now.bowl)/invite + pax + /(scot %uv uid)/noun + == .^((unit invite) %gx pax) -- diff --git a/pkg/arvo/app/invite-view.hoon b/pkg/arvo/app/invite-view.hoon index 82cdf18df..cd842f1c1 100644 --- a/pkg/arvo/app/invite-view.hoon +++ b/pkg/arvo/app/invite-view.hoon @@ -44,7 +44,9 @@ (on-watch:def path) :_ this =/ =invites - .^(invites %gx /=invite-store/(scot %da now.bowl)/all/noun) + .^ invites %gx + /(scot %p our.bowl)/invite-store/(scot %da now.bowl)/all/noun + == [%give %fact ~ %json !>((invites-to-json invites))]~ :: ++ on-agent diff --git a/pkg/arvo/app/metadata-hook.hoon b/pkg/arvo/app/metadata-hook.hoon index 2205fe06b..9fee9d1d2 100644 --- a/pkg/arvo/app/metadata-hook.hoon +++ b/pkg/arvo/app/metadata-hook.hoon @@ -1,4 +1,4 @@ -:: metadata-hook: allow syncing foreign metadata +: metadata-hook: allow syncing foreign metadata :: :: watch paths: :: /group/%group-path all updates related to this group @@ -45,7 +45,7 @@ :: %metadata-action [(poke-action:hc !<(metadata-action vase)) this] - == + == :: ++ on-watch |= =path @@ -160,7 +160,12 @@ ++ metadata-scry |= pax=^path ^- associations - =. pax ;:(weld /=metadata-store/(scot %da now.bowl)/group pax /noun) + =. pax + ;: weld + /(scot %p our.bowl)/metadata-store/(scot %da now.bowl)/group + pax + /noun + == .^(associations %gx pax) -- :: @@ -238,7 +243,7 @@ ^- ? =. pax ;: weld - /=permission-store/(scot %da now.bowl)/permitted + /(scot %p our.bowl)/permission-store/(scot %da now.bowl)/permitted [(scot %p ship) pax] /noun == diff --git a/pkg/arvo/app/permission-group-hook.hoon b/pkg/arvo/app/permission-group-hook.hoon index 6ef419729..2627d5ec1 100644 --- a/pkg/arvo/app/permission-group-hook.hoon +++ b/pkg/arvo/app/permission-group-hook.hoon @@ -201,7 +201,8 @@ ++ group-scry |= pax=path ^- (unit group) - .^((unit group) %gx ;:(weld /=group-store/(scot %da now.bowl) pax /noun)) + =/ bek=path /(scot %p our.bowl)/group-store/(scot %da now.bowl) + .^((unit group) %gx :(weld bek pax /noun)) :: ++ add-members |= [pax=path mem=(set ship) perms=(set path)] diff --git a/pkg/arvo/app/permission-hook.hoon b/pkg/arvo/app/permission-hook.hoon index f2de76ddf..c8a38f652 100644 --- a/pkg/arvo/app/permission-hook.hoon +++ b/pkg/arvo/app/permission-hook.hoon @@ -293,7 +293,12 @@ ++ permission-scry |= pax=path ^- permission - =. pax ;:(weld /=permission-store/(scot %da now.bowl)/permission pax /noun) + =. pax + ;: weld + /(scot %p our.bowl)/permission-store/(scot %da now.bowl)/permission + pax + /noun + == (need .^((unit permission) %gx pax)) :: ++ permitted diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 6be1dddde..f666efd31 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -71,7 +71,7 @@ ++ stop-ping-ship |= [our=@p now=@da =ship =old=rift =ship-state] ^- (quip card _state) - =+ .^(=new=rift %j /=rift/(scot %da now)/(scot %p ship)) + =+ .^(=new=rift %j /(scot %p our)/rift/(scot %da now)/(scot %p ship)) :: if nothing's changed about us, don't cancel :: ?: ?& =(old-rift new-rift) @@ -96,7 +96,7 @@ (send-ping our now ship) :: ;< new-state=_state (rind card state) - =+ .^(=rift %j /=rift/(scot %da now)/(scot %p ship)) + =+ .^(=rift %j /(scot %p our)/rift/(scot %da now)/(scot %p ship)) :_ state(ships (~(put by ships.state) ship rift %idle ~)) [%pass /jael/(scot %p ship) %arvo %j %public-keys (silt ship ~)]~ =. state new-state diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index c93ab8ba2..48be232e4 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -953,7 +953,11 @@ ^- [(list card) write=path read=path] ?> ?=(^ group-path.group) =/ scry-path - ;:(weld /=group-store/(scot %da now.bol) group-path.group /noun) + ;: weld + /(scot %p our.bowl)/group-store/(scot %da now.bol) + group-path.group + /noun + == =/ grp .^((unit ^group) %gx scry-path) ?: use-preexisting.group ?~ grp !! diff --git a/pkg/arvo/gen/acme/domain-validation.hoon b/pkg/arvo/gen/acme/domain-validation.hoon index a1b4c2c05..477317e81 100644 --- a/pkg/arvo/gen/acme/domain-validation.hoon +++ b/pkg/arvo/gen/acme/domain-validation.hoon @@ -20,7 +20,13 @@ [[%404 ~] ~] =/ challenge=@t i.t.t.q.p.u.url =/ response - .^((unit @t) %gx /=acme/(scot %da now)/domain-validation/[challenge]/noun) + .^ (unit @t) + %gx + (scot %p p.bek) + %acme + (scot %da now) + /domain-validation/[challenge]/noun + == ?~ response [[%404 ~] ~] :- [200 ['content-type' 'text/html']~] diff --git a/pkg/arvo/gen/azimuth-block.hoon b/pkg/arvo/gen/azimuth-block.hoon index dfb108ee7..6b42aa8d8 100644 --- a/pkg/arvo/gen/azimuth-block.hoon +++ b/pkg/arvo/gen/azimuth-block.hoon @@ -4,6 +4,11 @@ :: processed only those blocks which are this number minus 30. :: :- %say -|= [[now=@da *] *] +|= [[now=@da @ our=@p ^] *] :- %tang -[>.^(@ud %gx /=eth-watcher/(scot %da now)/block/azimuth-tracker/noun)< ~] +=; block=@ud + [leaf+(scow %ud block)]~ +.^ @ud + %gx + /(scot %p our)/eth-watcher/(scot %da now)/block/azimuth-tracker/noun +== diff --git a/pkg/arvo/gen/azimuth-sources.hoon b/pkg/arvo/gen/azimuth-sources.hoon index b72349e44..1ad7c5df7 100644 --- a/pkg/arvo/gen/azimuth-sources.hoon +++ b/pkg/arvo/gen/azimuth-sources.hoon @@ -1,4 +1,4 @@ :- %say -|= [[now=@da *] *] +|= [[now=@da @ our=@p ^] *] :- %noun -.^(state-eth-node:jael j//=sources/(scot %da now)) +.^(state-eth-node:jael j//(scot %p our)/sources/(scot %da now)) diff --git a/pkg/arvo/gen/hood/static.hoon b/pkg/arvo/gen/hood/static.hoon index c91d21661..bdbcc7441 100644 --- a/pkg/arvo/gen/hood/static.hoon +++ b/pkg/arvo/gen/hood/static.hoon @@ -1,3 +1,4 @@ +:: TODO: modernize for ford fusion; will not parse /? 309 :: /= pre-process diff --git a/pkg/arvo/gen/keys.hoon b/pkg/arvo/gen/keys.hoon index 38f9aa6b1..bbdb20d72 100644 --- a/pkg/arvo/gen/keys.hoon +++ b/pkg/arvo/gen/keys.hoon @@ -1,8 +1,11 @@ :: Print keys for a ship :: :- %say -|= [[now=time *] [=ship ~] ~] +|= [[now=time @ our=ship ^] [her=ship ~] ~] +=/ our (scot %p our) +=/ now (scot %da now) +=/ her (scot %p ship) :* %noun - life=.^((unit @ud) %j /=lyfe/(scot %da now)/(scot %p ship)) - rift=.^((unit @ud) %j /=ryft/(scot %da now)/(scot %p ship)) + life=.^((unit @ud) %j /[our]/lyfe/[now]/[her]) + rift=.^((unit @ud) %j /[our]/ryft/[now]/[her]) == diff --git a/pkg/arvo/gen/spider/tree.hoon b/pkg/arvo/gen/spider/tree.hoon index 7bb7d1367..14eaa80e4 100644 --- a/pkg/arvo/gen/spider/tree.hoon +++ b/pkg/arvo/gen/spider/tree.hoon @@ -1,9 +1,12 @@ /- spider :- %say -|= [[now=@da *] ~ *] +|= [[now=@da @ our=@p ^] ~ *] :- %tang =/ tree - .^((list (list tid:spider)) %gx /=spider/(scot %da now)/tree/noun) + .^ (list (list tid:spider)) + %gx + /(scot %p our)/spider/(scot %da now)/tree/noun + == %+ turn tree |= yarn=(list tid:spider) >`path`yarn< From 4616daf0dcc38659ebdc50094dee3e2daf17b8ba Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 19 May 2020 20:27:34 -0400 Subject: [PATCH 136/280] /app: fix remaining /=s; all agents build --- pkg/arvo/app/contact-view.hoon | 4 ++-- pkg/arvo/app/publish.hoon | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index 2590d7e33..4de979a95 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -270,14 +270,14 @@ :: ++ all-scry ^- rolodex - .^(rolodex %gx /(scot %p our.bowl)/contact-store/(scot %da now.bol)/all/noun) + .^(rolodex %gx /(scot %p our.bol)/contact-store/(scot %da now.bol)/all/noun) :: ++ contact-scry |= pax=path ^- (unit contact) =. pax ;: weld - /(scot %p our.bowl)/contact-store/(scot %da now.bol)/contact + /(scot %p our.bol)/contact-store/(scot %da now.bol)/contact pax /noun == diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index 48be232e4..6486fca57 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -954,7 +954,7 @@ ?> ?=(^ group-path.group) =/ scry-path ;: weld - /(scot %p our.bowl)/group-store/(scot %da now.bol) + /(scot %p our.bol)/group-store/(scot %da now.bol) group-path.group /noun == From 044c22357de54fea90ac3f8f8b30c8ff9f1aac3d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 19 May 2020 20:28:24 -0400 Subject: [PATCH 137/280] clay: virtualize +read-at-aeon:ze so failures don't kill event --- pkg/arvo/sys/vane/clay.hoon | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 7937de5b5..57f89c98b 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3494,6 +3494,11 @@ =* fod fod.dom ?. |(?=(~ for) (may-read u.for care.mun yon path.mun)) [~ fod] + :: virtualize to catch and produce deterministic failures + :: + =- ?:(?=(%& -<) p.- ((slog p.-) [[~ ~] fod])) + %- mule |. + :: ?- care.mun %d :_ fod From 6f80d5528981f7de36dbe27a0085cc48fe46fcd7 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 19 May 2020 20:28:46 -0400 Subject: [PATCH 138/280] :test %generators --- pkg/arvo/app/test.hoon | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/test.hoon b/pkg/arvo/app/test.hoon index d081f2897..06f695d25 100644 --- a/pkg/arvo/app/test.hoon +++ b/pkg/arvo/app/test.hoon @@ -2,12 +2,14 @@ !: |% +$ card card:agent:gall -+$ test ?(%agents %marks) ++$ test ?(%agents %marks %generators) +$ state $: app=(set path) app-ok=? mar=(set path) mar-ok=? + gen=(set path) + gen-ok=? == -- =, format @@ -28,6 +30,7 @@ ?- test %marks test-marks %agents test-agents + %generators test-generators == :: ++ test-marks @@ -76,6 +79,26 @@ app.state (~(put in app.state) /app/[i.daz]) == :: + ++ test-generators + =| fex=(list card) + ^+ [fex this] + ?> =(~ gen.state) + =. gen-ok.state %.y + =+ .^(paz=(list path) ct+(en-beam now-beak /gen)) + |- ^+ [fex this] + ?~ paz [fex this] + =/ xap=path (flop i.paz) + ?. ?=([%hoon *] xap) + $(paz t.paz) + =/ sing=card + :+ %pass build+i.paz + [%arvo %c %warp our.bowl %home ~ %sing %a da+now.bowl i.paz] + %_ $ + paz t.paz + fex [sing fex] + gen.state (~(put in gen.state) i.paz) + == + :: ++ now-beak %_(byk.bowl r [%da now.bowl]) -- ++ on-watch on-watch:def @@ -92,7 +115,9 @@ =/ =path t.wire ?+ path ~|(path+path !!) [%app *] - =/ ok ?=(^ p.sign-arvo) + =/ ok + ?~ p.sign-arvo | + (~(nest ut -:!>(*agent:gall)) | -:!<(vase q.r.u.p.sign-arvo)) ~& ?: ok agent-built+path agent-failed+path @@ -116,6 +141,19 @@ %all-marks-built %some-marks-failed [~ this] + :: + [%gen *] + =/ ok ?=(^ p.sign-arvo) + ~& ?: ok + generator-built+path + generator-failed+path + =? gen-ok.state !ok %.n + =. gen.state (~(del in gen.state) path) + ~? =(~ gen.state) + ?: gen-ok.state + %all-generators-built + %some-generators-failed + [~ this] == ++ on-fail on-fail:def -- From 19f0fe7757ae851d4e3153b6bb8b8577d2ed9458 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 02:34:11 -0400 Subject: [PATCH 139/280] :metadata-hook: fix syntax error --- pkg/arvo/app/metadata-hook.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/metadata-hook.hoon b/pkg/arvo/app/metadata-hook.hoon index 9fee9d1d2..8143ce6f8 100644 --- a/pkg/arvo/app/metadata-hook.hoon +++ b/pkg/arvo/app/metadata-hook.hoon @@ -1,4 +1,4 @@ -: metadata-hook: allow syncing foreign metadata +:: metadata-hook: allow syncing foreign metadata :: :: watch paths: :: /group/%group-path all updates related to this group From 66b9e20ee5c0a0fd765044f19565d96f003e1f4d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 03:28:14 -0400 Subject: [PATCH 140/280] /app: more fixes from /= replacement --- pkg/arvo/app/chat-view.hoon | 6 +++--- pkg/arvo/app/group-hook.hoon | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index 2b9f24dbb..0a1a0097a 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -115,8 +115,8 @@ ++ truncated-inbox-scry ^- inbox =/ =inbox - =/ our (scot %p our.bowl) - =/ now (scot %da now.bowl) + =/ our (scot %p our.bol) + =/ now (scot %da now.bol) .^(inbox %gx /[our]/chat-store/[now]/all/noun) %- ~(run by inbox) |= =mailbox @@ -429,7 +429,7 @@ ^- (unit mailbox) =. pax ;: weld - /(scot %p our.bowl)/chat-store/(scot %da now.bol)/mailbox + /(scot %p our.bol)/chat-store/(scot %da now.bol)/mailbox pax /noun == diff --git a/pkg/arvo/app/group-hook.hoon b/pkg/arvo/app/group-hook.hoon index cdce3c977..ef808f76d 100644 --- a/pkg/arvo/app/group-hook.hoon +++ b/pkg/arvo/app/group-hook.hoon @@ -211,9 +211,9 @@ |= pax=path .^ (unit group) %gx - (scot %p our.bowl) + (scot %p our.bol) %group-store - (scot %da now.bowl) + (scot %da now.bol) (weld pax /noun) == :: From 7e69e66280b30085e991fe26fa6e700c678c4f0f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 03:29:54 -0400 Subject: [PATCH 141/280] ames/zuse: handle %trim event --- pkg/arvo/sys/vane/ames.hoon | 3 +++ pkg/arvo/sys/zuse.hoon | 2 ++ 2 files changed, 5 insertions(+) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 4ba5b4d3a..1684062b6 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1094,6 +1094,7 @@ %jilt (on-jilt:event-core ship.task) %sift (on-sift:event-core ships.task) %spew (on-spew:event-core veb.task) + %trim on-trim:event-core %vega on-vega:event-core %plea (on-plea:event-core [ship plea]:task) == @@ -1856,8 +1857,10 @@ :: (emit unix-duct.ames-state %give %turf turfs) :: +on-vega: handle kernel reload + :: +on-trim: handle request to free memory :: ++ on-vega event-core + ++ on-trim event-core :: +enqueue-alien-todo: helper to enqueue a pending request :: :: Also requests key and life from Jael on first request. diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 277c05b68..1b013c360 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -394,6 +394,7 @@ :: %init: vane boot :: %sift: limit verbosity to .ships :: %spew: set verbosity toggles + :: %trim: release memory :: %vega: kernel reload notification :: +$ task @@ -408,6 +409,7 @@ $>(%init vane-task) [%sift ships=(list ship)] [%spew veb=(list verb)] + $>(%trim vane-task) $>(%vega vane-task) == :: $gift: effect from ames From 917c55eaa3027e52178d529cb15bb7f38b83ca5b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 03:30:29 -0400 Subject: [PATCH 142/280] gall: remove pupal queue, molt on any event --- pkg/arvo/sys/vane/gall.hoon | 113 +++++++++++++++++------------------- 1 file changed, 54 insertions(+), 59 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index dfe6c10d5..75fdd3b5d 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -107,13 +107,6 @@ :: |migrate: data structures for upgrades :: +| %migrate -:: -:: $chrysalis: pupal gall state, until agents have reloaded -:: -+$ chrysalis - $: queue=(qeu bolus) - =spore - == :: $bolus: incoming move to a pupa, enqueued in a $chrysalis :: +$ bolus @@ -145,51 +138,32 @@ :: pupal gall core, on upgrade :: =< =* adult-gate . - =| sac=chrysalis + =| =spore |= [our=ship now=@da eny=@uvJ ski=sley] =* pupal-gate . =* adult-core (adult-gate +<) + =< |% + ++ call ^call + ++ load ^load + ++ scry ^scry + ++ stay ^stay + ++ take ^take + -- |% - ++ call - |= [=duct dud=(unit goof) typ=type wrapped-task=(hobo task:able)] - =* call-args +< - ?: =(~ eggs.spore.sac) - ~> %slog.[0 leaf+"gall: direct morphogenesis"] - =. state.adult-gate spore.sac(eggs *(map term yoke)) - (call:adult-core call-args) - ?^ dud - (mean >mote.u.dud< tang.u.dud) - :: - =/ task ((harden task:able:gall) wrapped-task) - ~> %slog.[0 leaf+"gall: pupa call {<-.task>}"] - =. queue.sac (~(put to queue.sac) [%call duct task]) - [*(list move) pupal-gate] - ++ scry scry:adult-core - ++ stay ~|(%gall-subinvolution !!) - ++ take - |= [=wire =duct dud=(unit goof) typ=type sign=sign-arvo] - =* take-args +< - ?: =(~ eggs.spore.sac) - ~> %slog.[0 leaf+"gall: direct morphogenesis"] - =. state.adult-gate spore.sac(eggs *(map term yoke)) - (take:adult-core take-args) - ?^ dud - ~> %slog.[0 leaf+"gall: pupa take dud"] - (mean >mote.u.dud< tang.u.dud) - ?. =(/sys/lyv wire) - ~> %slog.[0 leaf+"gall: pupa take {(spud wire)} {<[- +<]:sign>}"] - =. queue.sac (~(put to queue.sac) [%take wire duct sign]) - [*(list move) pupal-gate] - ~> %slog.[0 leaf+"gall: pupa exiting chrysalis"] + ++ molt + |= [=duct fec=(unit move)] + ^- [(list move) _adult-gate] + ~> %slog.[0 leaf+"gall: molting"] + ~< %slog.[0 leaf+"gall: molted"] =/ adult adult-core =. state.adult - [%6 system-duct outstanding contacts yokes=~ blocked]:spore.sac + [%6 system-duct outstanding contacts yokes=~ blocked]:spore =/ mo-core (mo-abed:mo:adult duct) =. mo-core - =/ apps=(list [dap=term =egg]) ~(tap by eggs.spore.sac) + =/ apps=(list [dap=term =egg]) ~(tap by eggs.spore) |- ^+ mo-core ?~ apps mo-core - ~> %slog.[0 leaf+"gall: pupa upgrading {}"] + ~> %slog.[0 leaf+"gall: upgrading {}"] =/ ap-core (ap-abut:ap:mo-core i.apps) =^ tan ap-core (ap-install:ap-core `old-state.egg.i.apps) ?^ tan @@ -197,31 +171,52 @@ $(apps t.apps, mo-core ap-abet:ap-core) =. mo-core (mo-subscribe-to-agent-builds:mo-core now) =^ moves adult-gate mo-abet:mo-core - =. moves - %+ weld moves - %+ turn ~(tap to queue.sac) - |= mov=bolus - ^- move - ~& gall-dequeue+-.mov - ?- -.mov - %call [duct.mov %slip %g task.mov] - %take [duct.mov %pass wire.mov %b %huck !>(sign.mov)] - == - ~> %slog.[0 leaf+"gall: metamorphosis"] + =? moves ?=(^ fec) (weld moves [u.fec]~) [moves adult-gate] :: + ++ call + |= [=duct dud=(unit goof) typ=type wrapped-task=(hobo task:able)] + =* call-args +< + ?: =(~ eggs.spore) + ~> %slog.[0 leaf+"gall: direct morphogenesis"] + =. state.adult-gate spore(eggs *(map term yoke)) + (call:adult-core call-args) + ?^ dud + ~> %slog.[0 leaf+"gall: pupa call dud"] + (mean >mote.u.dud< tang.u.dud) + =/ task ((harden task:able:gall) wrapped-task) + (molt duct `[duct %slip %g task]) + :: + ++ scry scry:adult-core + ++ stay ~|(%gall-subinvolution !!) + ++ take + |= [=wire =duct dud=(unit goof) typ=type sign=sign-arvo] + =* take-args +< + ?: =(~ eggs.spore) + ~> %slog.[0 leaf+"gall: direct morphogenesis"] + =. state.adult-gate spore(eggs *(map term yoke)) + (take:adult-core take-args) + ?^ dud + ~> %slog.[0 leaf+"gall: pupa take dud"] + (mean >mote.u.dud< tang.u.dud) + ?: =(/sys/lyv wire) + (molt duct ~) + :: TODO: test this or remove and assert /sys/lyv + :: + (molt duct `[duct %pass wire %b %huck !>(sign)]) + :: ++ load |^ |= old=all-state - =. spore.sac (upgrade old) - ?. =(~ eggs.spore.sac) + =. spore (upgrade old) + ?. =(~ eggs.spore) pupal-gate ~> %slog.[0 leaf+"gall: direct morphogenesis"] - adult-gate(state spore.sac(eggs *(map term yoke))) + adult-gate(state spore(eggs *(map term yoke))) :: ++ upgrade |= =all-state - ^- spore + ^- ^spore :: =? all-state ?=(%0 -.all-state) (state-0-to-1 all-state) @@ -245,11 +240,11 @@ all-state :: +all-state: upgrade path :: - ++ all-state $%(state-0 state-1 state-2 state-3 state-4 state-5 spore) + +$ all-state $%(state-0 state-1 state-2 state-3 state-4 state-5 ^spore) :: ++ state-5-to-spore-6 |= =state-5 - ^- spore + ^- ^spore =; eggs=(map term egg) state-5(- %6, yokes.agents-5 eggs) %- ~(run by yokes.agents-5.state-5) |=(=yoke `egg`yoke(agent on-save:agent.yoke)) From 96c92a493d4fea7ae7cf9667b85960448b7c0e99 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 04:22:40 -0400 Subject: [PATCH 143/280] /tests: gall tests pass again --- pkg/arvo/tests/sys/vane/gall.hoon | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/gall.hoon b/pkg/arvo/tests/sys/vane/gall.hoon index bbc930bbc..c4c71b6b5 100644 --- a/pkg/arvo/tests/sys/vane/gall.hoon +++ b/pkg/arvo/tests/sys/vane/gall.hoon @@ -18,13 +18,13 @@ =/ =task:able:gall [%init ~nec] [duct type task] :: - =/ expected-moves ~ + =/ expected-moves=(list move:gall-gate) ~ :: - =^ results gall-gate + =/ res (gall-call gall-gate time *sley call-args expected-moves) :: - results -:: +test-conf: test %conf: TODO: fix + -.res +:: +test-conf: test %conf; TODO: test clay response :: ++ test-conf ^- tang @@ -47,10 +47,10 @@ :: =/ expected-moves=(list move:gall-gate) ~[move] :: - =^ results gall-gate + =/ res (gall-call gall-gate time *sley call-args expected-moves) :: - results + -.res :: +gall-call: have %gall run a +task and assert it produces expected-moves :: ++ gall-call @@ -60,16 +60,16 @@ call-args=[=duct =type wrapped-task=(hobo task:able:gall)] expected-moves=(list move:gall-gate) == - ^- [tang _gall-gate] - :: =/ gall-core (gall-gate our=~nec now=now eny=`@`0xdead.beef scry=scry) :: - =^ moves gall-gate (call:gall-core [duct ~ type wrapped-task]:call-args) + =/ res + =/ =type -:!>(*task:able:gall) + (call:gall-core duct.call-args dud=~ type wrapped-task.call-args) :: =/ output=tang %+ expect-eq !> expected-moves - !> moves + !> -.res :: - [output gall-gate] + [output +.res] -- From 5a1f227622de3db6c1ca85d2d2e4069523a684e5 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 04:25:00 -0400 Subject: [PATCH 144/280] clay: remove beak from compiler path --- pkg/arvo/sys/vane/clay.hoon | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 57f89c98b..8659d4b4e 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -394,7 +394,6 @@ [ducts (print-wove wove)] :: ++ fusion - |= [her=@p syd=desk] => |% :: +an: $ankh interface door @@ -833,7 +832,7 @@ == :: %+ cook |=(huz=(list hoon) `hoon`tssg+huz) - (most gap tall:(vang & (scot %p her) syd '1' pax)) + (most gap tall:(vang & pax)) == == :: @@ -985,8 +984,6 @@ dos.rom (~(put by dos.rom.ruf) syd [qyx dom per pew]:red) == :: - ++ fusion (^fusion her syd) - :: :: Handle `%sing` requests :: ++ aver From 1028e9fd7c7a5b1b3c532e127cced55354afa650 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 04:36:16 -0400 Subject: [PATCH 145/280] hoon,kiln: clean up boot prints; new pill --- bin/solid.pill | 4 ++-- pkg/arvo/lib/hood/kiln.hoon | 2 +- pkg/arvo/sys/hoon.hoon | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 8cee85a8c..2f58d34de 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa03602671bf8e42072f75ae41c6978fd670a84c33959a7caf29fb125355fcf8 -size 13137499 +oid sha256:f2d7296ea9cc0d02f452be54d847023154f6ea7b5f17a6de229a73a28a11227f +size 13283655 diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 94beb0aee..5b1af16d6 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -74,7 +74,7 @@ :: ++ render |= {mez/tape sud/desk who/ship syd/desk} - :^ %palm [" " ~ ~ ~] leaf+mez + :^ %palm [" " ~ ~ ~] leaf+(weld "kiln: " mez) ~[leaf+"from {}" leaf+"on {}" leaf+"to {}"] :: ++ poke-commit diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index c69cb59f8..d24f092ae 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -14350,11 +14350,10 @@ ++ ride :: end-to-end compiler |= {typ/type txt/@} ^- (pair type nock) - ~> %slog.[0 leaf/"ride-parsing"] + ~> %slog.[0 leaf/"ride: parsing"] =/ gen (ream txt) - ~> %slog.[0 leaf/"ride-compiling"] - =- ~> %slog.[0 leaf/"ride-compiled"] - - + ~> %slog.[0 leaf/"ride: compiling"] + ~< %slog.[0 leaf/"ride: compiled"] (~(mint ut typ) %noun gen) :: :::: 5e: caching compiler From 96264f7fa3627a1abf6462b7a39e780b7773684b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 04:36:33 -0400 Subject: [PATCH 146/280] eyre: clarify common prints --- pkg/arvo/sys/vane/eyre.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 0a9979b59..d5b698f6e 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1230,10 +1230,10 @@ :: lookup the session id by duct :: ?~ maybe-channel-id=(~(get by duct-to-key.channel-state.state) duct) - ~& [%canceling-nonexistant-channel duct] + ~> %slog.[0 leaf+"eyre: no channel to cancel {}"] [~ state] :: - ~& [%canceling-cancel duct] + ~> %slog.[0 leaf+"eyre: canceling {}"] :: =/ maybe-session (~(get by session.channel-state.state) u.maybe-channel-id) From 34038a4616d84f57e566d6fd8e15a7a014e34b18 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 20 May 2020 04:51:37 -0400 Subject: [PATCH 147/280] /gen: all generators build --- pkg/arvo/gen/hood/static.hoon | 79 --------------------------------- pkg/arvo/gen/keys.hoon | 2 +- pkg/arvo/gen/test.hoon | 82 ----------------------------------- 3 files changed, 1 insertion(+), 162 deletions(-) delete mode 100644 pkg/arvo/gen/hood/static.hoon delete mode 100644 pkg/arvo/gen/test.hoon diff --git a/pkg/arvo/gen/hood/static.hoon b/pkg/arvo/gen/hood/static.hoon deleted file mode 100644 index bdbcc7441..000000000 --- a/pkg/arvo/gen/hood/static.hoon +++ /dev/null @@ -1,79 +0,0 @@ -:: TODO: modernize for ford fusion; will not parse -/? 309 -:: -/= pre-process - /^ (map path [@tas @t]) - /: /===/web/static-site /* - /| /; |=(@t [%html +<]) /&html&/!hymn/ - /; |=(@t [%html +<]) /&html&/&elem&/udon/ - :: XX /lib/down-jet/parse is broken - :: /; |=(@t [%html +<]) /&html&/&hymn&/&down&/md/ - /; |=(@t [%raw +<]) /atom/ - == -:: -~& %finished-preprocessing -:- %say -|= $: [now=@da eny=@uv bec=beak] - ~ - ~ - == -=> -|% -++ convert-link - |= [pre=tape link=tape] - =/ parsed=(unit (list coin)) - %+ rust link - ;~ pose - ;~(pfix net (more net nuck:so)) - (more net nuck:so) - == - ?~ parsed - link - ^- tape - %+ welp - =< + - %^ spin u.parsed pre - |= [c=coin s=path] - ^- [* out=tape] - ?> ?=([%$ dime] c) - [0 (weld "{s}/" (scow +.c))] - :: - ".html" -:: -++ convert-file - |= [pre=tape fil=tape] - ^- tape - =/ idc=(list @ud) (fand "" b)) - =/ old-link=tape (scag c b) - =/ new-link=tape (convert-link pre old-link) - =/ new-file=tape :(welp a new-link (slag c b)) - =/ new-f (sub (lent new-link) (lent old-link)) - [0 (add f new-f) new-file] --- -:: -:- %dill-blit -=/ trio /(scot %p p.bec)/[q.bec]/(scot r.bec) -=/ dirs .^((list path) %ct (weld trio /web/static-site)) -:: -:- %mor -%+ roll dirs -|= [pax=path out=(list [%sav path @t])] -=/ path-prefix=path (scag (dec (lent pax)) pax) -=/ pre=[@tas @t] (~(got by pre-process) path-prefix) -:_ out -:- %sav -?: =(%raw -.pre) - [pax +.pre] -:: find and update links -=/ root=tape - ?~ path-prefix "" - (slag 1 (spud (scag 1 (flop path-prefix)))) -=/ fil=tape (convert-file root (trip +.pre)) -[(weld path-prefix /[-.pre]) (crip fil)] diff --git a/pkg/arvo/gen/keys.hoon b/pkg/arvo/gen/keys.hoon index bbdb20d72..955c848a4 100644 --- a/pkg/arvo/gen/keys.hoon +++ b/pkg/arvo/gen/keys.hoon @@ -4,7 +4,7 @@ |= [[now=time @ our=ship ^] [her=ship ~] ~] =/ our (scot %p our) =/ now (scot %da now) -=/ her (scot %p ship) +=/ her (scot %p her) :* %noun life=.^((unit @ud) %j /[our]/lyfe/[now]/[her]) rift=.^((unit @ud) %j /[our]/ryft/[now]/[her]) diff --git a/pkg/arvo/gen/test.hoon b/pkg/arvo/gen/test.hoon deleted file mode 100644 index 765362546..000000000 --- a/pkg/arvo/gen/test.hoon +++ /dev/null @@ -1,82 +0,0 @@ -/+ test-runner -/= all-tests - /^ (map path (list test-arm:test-runner)) - /: /===/tests - /* /test-gen/ -:: -|% -++ main - |= [defer=? tests=(list test:test-runner)] - ^- tang - :: - %- zing - %+ turn tests - |= [=path test-func=test-func:test-runner] - ^- tang - :: - =/ test-results=tang (run-test path test-func) - :: if :defer is set, produce errors; otherwise print them and produce ~ - :: - ?: defer - test-results - ((slog (flop test-results)) ~) -:: -++ run-test - :: executes an individual test. - |= [pax=path test=test-func:test-runner] - ^- tang - =+ name=(spud pax) - =+ run=(mule test) - ?- -.run - %| :: the stack is already flopped for output? - ;: weld - p.run - `tang`[[%leaf (weld "CRASHED " name)] ~] - == - %& ?: =(~ p.run) - [[%leaf (weld "OK " name)] ~] - :: Create a welded list of all failures indented. - %- flop - ;: weld - `tang`[[%leaf (weld "FAILED " name)] ~] - ::TODO indent - :: %+ turn p:run - :: |= {i/tape} - :: ^- tank - :: [%leaf (weld " " i)] - p.run - == - == -:: +filter-tests-by-prefix -:: -++ filter-tests-by-prefix - |= [prefix=path tests=(list test:test-runner)] - ^+ tests - :: - =/ prefix-length=@ud (lent prefix) - :: - %+ skim tests - :: - |= [=path *] - =(prefix (scag prefix-length path)) --- -:: -:- %say -|= $: [now=@da eny=@uvJ bec=beak] - [filter=$?(~ [pax=path ~])] - [defer=_& seed=?(~ @uvJ)] - == -:: start printing early if we're not deferring output -:: -~? !defer %tests-compiled -:- %tang -:: use empty path prefix if unspecified -:: -=/ prefix=path ?~(filter ~ pax.filter) -:: -=/ filtered-tests=(list test:test-runner) - %+ filter-tests-by-prefix - prefix - (resolve-test-paths:test-runner all-tests) -:: -(main defer filtered-tests) From 560e3375f5cceaf2523f4a02647729b76efcf525 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 21 May 2020 01:10:39 -0700 Subject: [PATCH 148/280] clay: drip if foreign desk --- pkg/arvo/sys/vane/clay.hoon | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 8659d4b4e..a2de00725 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -263,7 +263,8 @@ $>(%plea task:able:ames) :: == :: $: %b :: to %behn - $> $? %rest :: + $> $? %drip :: + %rest :: %wait :: == :: task:able:behn :: @@ -1049,7 +1050,10 @@ %- wrap:fusion (page-to-cage:(ford:fusion args) page) [cage ford-cache.args] - (emit hen %give %writ ~ [care.mun case.mun syd] path.mun cage) + =/ gift [%writ ~ [care.mun case.mun syd] path.mun cage] + ?: ?=(^ ref) + (emit hen %slip %b %drip !>(gift)) + (emit hen %give gift) :: ++ case-to-date |= =case @@ -1101,8 +1105,12 @@ :: translate the case to a date :: =/ cas [%da (case-to-date case.n.das)] - =- (emit hen %give %wris cas -) - (~(run in `(set mood)`das) |=(m/mood [care.m path.m])) + =/ res + (~(run in `(set mood)`das) |=(m/mood [care.m path.m])) + =/ gift [%wris cas res] + ?: ?=(^ ref) + (emit hen %slip %b %drip !>(gift)) + (emit hen %give gift) :: :: Give next step in a subscription. :: @@ -1119,6 +1127,8 @@ :: ++ blub |= hen/duct + ?: ?=(^ ref) + (emit hen %slip %b %drip !>([%writ ~])) (emit hen %give %writ ~) :: :: Lifts a function so that a single result can be fanned out over a set of @@ -3914,7 +3924,7 @@ ~(tap in ducts) =/ cancel-moves=(list move) %+ turn cancel-ducts - |=(=duct [duct %give %writ ~]) + |=(=duct [duct %slip %b %drip !>([%writ ~])]) :: delete local state of foreign desk :: =. hoy.ruf (~(del by hoy.ruf) who) From a84b0db733cb520716af7fc81e2538ebed0c5adc Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 21 May 2020 01:11:16 -0700 Subject: [PATCH 149/280] clay: fix clobbering changes if identical changes --- bin/solid.pill | 4 ++-- pkg/arvo/lib/hood/kiln.hoon | 2 +- pkg/arvo/sys/vane/clay.hoon | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 2f58d34de..bd9f5c393 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2d7296ea9cc0d02f452be54d847023154f6ea7b5f17a6de229a73a28a11227f -size 13283655 +oid sha256:ae3add505f1c37c3d10f2781bca3c9fc5032c11c9b9b8a6218d4301e462d4ccc +size 16089760 diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 5b1af16d6..cd39ae1e7 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -380,7 +380,7 @@ .^(cass:clay %cw /(scot %p our)/[syd]/(scot %da now)) ?: =(0 ud.cass) %init - ?:((gth 3 ud.cass) %that %mate) + ?:((gth 2 ud.cass) %that %mate) =< %- spam ?: =(our her) ~ [(render "beginning sync" sud her syd) ~] diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index a2de00725..98bdf4a51 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2161,7 +2161,7 @@ =/ =dais (get-dais mark) =/ res=(unit (unit vase)) (~(join dais bunt:dais) q.cal q.cob) ?~ res - ~ + `[form:dais q.cob] ?~ u.res ~ `[form:dais u.u.res] From 7c9f12891056ba1aca4566a80b6dbfb92ba756ab Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Thu, 21 May 2020 17:16:54 -0600 Subject: [PATCH 150/280] publish: fix publish-info mark quote escaping --- pkg/arvo/mar/publish/info.hoon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/mar/publish/info.hoon b/pkg/arvo/mar/publish/info.hoon index 731e6e568..cb28e7e72 100644 --- a/pkg/arvo/mar/publish/info.hoon +++ b/pkg/arvo/mar/publish/info.hoon @@ -31,7 +31,7 @@ ++ old-parser ;~ plug (key-val (jest 'owner: ~') fed:ag) - (key-val (jest 'title: ') (cook crip (star qit))) + (key-val (jest 'title: ') (cook crip (star prn))) (key-val (jest 'filename: ') sym) %+ key-val (jest 'comments: ') ;~(pose (jest %open) (jest %closed) (jest %none)) @@ -45,8 +45,8 @@ == ++ new-parser ;~ plug - (key-val (jest 'title: ') (cook crip (star qit))) - (key-val (jest 'description: ') (cook crip (star qit))) + (key-val (jest 'title: ') (cook crip (star prn))) + (key-val (jest 'description: ') (cook crip (star prn))) %+ key-val (jest 'comments: ') (cook |=(a=@ =(%on a)) ;~(pose (jest %on) (jest %off))) (key-val (jest 'writers: ') ;~(pfix net (more net urs:ab))) From 7e4c0036f644e916ccd00d6f2b8bc9eb43fd6dc2 Mon Sep 17 00:00:00 2001 From: pilfer-pandex <47340789+pilfer-pandex@users.noreply.github.com> Date: Wed, 20 May 2020 22:53:57 -0400 Subject: [PATCH 151/280] hoon: make +slab respect variance (%read) and return false --- pkg/arvo/sys/hoon.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index d24f092ae..17e2ecbfa 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -12015,7 +12015,8 @@ :: ++ slab :: test if contains |= {cog/@tas typ/type} - =(& -:(~(find ut typ) %free [cog ~])) + ?= [%| *] + (~(find ut typ) %read ~[cog]) :: ++ slap |= {vax/vase gen/hoon} ^- vase :: untyped vase .* From 90e8c9a2b0d4dccb47609931c6acdbe81e603b9b Mon Sep 17 00:00:00 2001 From: pilfer-pandex <47340789+pilfer-pandex@users.noreply.github.com> Date: Thu, 21 May 2020 19:38:10 -0400 Subject: [PATCH 152/280] hoon: make +slab respect variance using given mode and return false --- pkg/arvo/sys/hoon.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 17e2ecbfa..9bf9450cc 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -12014,9 +12014,9 @@ [p.gun (slum q.gat q.sam)] :: ++ slab :: test if contains - |= {cog/@tas typ/type} + |= {cog/@tas way/?(%read %rite %both) typ/type} ?= [%| *] - (~(find ut typ) %read ~[cog]) + (~(find ut typ) way ~[cog]) :: ++ slap |= {vax/vase gen/hoon} ^- vase :: untyped vase .* From 8bd1ed7a2c25caed7dd1017f946147f84cf9ce41 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 22 May 2020 01:53:04 -0400 Subject: [PATCH 153/280] dojo: fix keyword arguments --- pkg/arvo/app/dojo.hoon | 52 ++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 0e396a70d..f689cbb98 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -691,7 +691,7 @@ :: - optional keyword arguments, as name-value pairs :: :: The generator is a pair of a result mark and a gate. - :: TODO: handle %ask generators + :: TODO: test %ask generators :: =/ wat (mule |.(!<(?(%ask %say) (slot 2 q.cay)))) ?: ?=(%| -.wat) @@ -704,32 +704,30 @@ %say (dy-made-gent %noun p.res) == |. ^- vase - =/ gat - %+ slap - %- with-faces :~ - gat+(slot 3 q.cay) - ven+!>([now=now.hid eny=eny.hid bec=he-beak]) - sor+(dy-sore p.cig) - == - ^~((ream 'gat(+<- ven, +<+< sor)')) - =? gat !=(~ q.cig) - =/ soz=(list [var=term vax=vase]) - %+ turn ~(tap by q.cig) - |= [var=term val=(unit dojo-source)] - ^- [term vase] - :- var - ?~ val - !>([~ ~]) - (dy-vase p.u.val) - %+ slap - (with-faces gat+gat rep+(with-faces soz) ~) - :+ %cncb ~[%gat] - ^- (list [wing hoon]) - %+ turn soz - |= [var=term vax=vase] - ^- [wing hoon] - [~[var &+27] [%wing var %rep ~]] - (slap gat ^~((ream '(.)'))) + =/ gat=vase (slot 3 q.cay) + %+ slam gat + %+ slop !>([now=now.hid eny=eny.hid bec=he-beak]) + %+ slop (dy-sore p.cig) + ^- vase + =/ sam (slew 27 gat) :: |2.+< + ?: =(~ q.cig) + (fall sam !>(~)) + =/ soz=(list [var=term vax=vase]) + %+ turn ~(tap by q.cig) + |= [var=term val=(unit dojo-source)] + ^- [term vase] + :- var + ?~ val + !>([~ ~]) + (dy-vase p.u.val) + ~| keyword-arg-failure+~(key by q.cig) + %+ slap + (with-faces sam+(need sam) rep+(with-faces soz) ~) + :+ %cncb [%sam]~ + %+ turn soz + |= [var=term *] + ^- [wing hoon] + [[var]~ [%wing var %rep ~]] :: ++ dy-made-dial :: dialog product |= cag/cage From 13f6b84b76519fa396c85f1dd5b741261526c0d6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 22 May 2020 01:53:33 -0400 Subject: [PATCH 154/280] /gen/timers: stop using parser path --- pkg/arvo/gen/timers.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/gen/timers.hoon b/pkg/arvo/gen/timers.hoon index 1c0cdac8b..9ca6fa6da 100644 --- a/pkg/arvo/gen/timers.hoon +++ b/pkg/arvo/gen/timers.hoon @@ -1,4 +1,4 @@ :- %say -|= * +|= [[now=@da eny=@uvJ bec=beak] ~ ~] :- %tang -[.^(tank %b %) ~] +[.^(tank %b (en-beam:format bec /)) ~] From 4aff4d74e203184c7eb6655345483ede7e5f15af Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 21 May 2020 23:05:42 -0700 Subject: [PATCH 155/280] kiln: get updates into %home, remove %base We need to get updates directly into %home in case the marks depend on changes to hoon.hoon. %base has no reason to exist. Our ota strategy is now to merge from parent/kids to home, then parent/kids to kids. --- bin/solid.pill | 4 +- pkg/arvo/app/aqua.hoon | 4 +- pkg/arvo/gen/hood/ota.hoon | 14 +++ pkg/arvo/gen/spider/kill.hoon | 2 +- pkg/arvo/gen/trouble.hoon | 2 +- pkg/arvo/lib/hood/kiln.hoon | 179 ++++++++++++++++++++++++++++-- pkg/arvo/lib/ph/io.hoon | 4 +- pkg/arvo/lib/ph/util.hoon | 12 +- pkg/arvo/sys/arvo.hoon | 1 - pkg/arvo/sys/vane/clay.hoon | 2 +- pkg/arvo/sys/vane/dill.hoon | 20 ++-- pkg/arvo/sys/vane/gall.hoon | 5 +- pkg/arvo/ted/ph/child-update.hoon | 54 +++++++++ 13 files changed, 265 insertions(+), 38 deletions(-) create mode 100644 pkg/arvo/gen/hood/ota.hoon create mode 100644 pkg/arvo/ted/ph/child-update.hoon diff --git a/bin/solid.pill b/bin/solid.pill index bd9f5c393..5f852ceae 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ae3add505f1c37c3d10f2781bca3c9fc5032c11c9b9b8a6218d4301e462d4ccc -size 16089760 +oid sha256:4bd63360c1b2fab69a35f71d360db6b9c71a796965d1826f919cf271e990bad2 +size 15816973 diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index d961331ba..748a2ee2f 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -387,7 +387,7 @@ %g %gall == =/ pax - /(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane] + /(scot %p our.hid)/work/(scot %da now.hid)/sys/vane/[vane] =/ txt .^(@ %cx (weld pax /hoon)) [/vane/[vane] [%veer v pax txt]] => .(this ^+(this this)) @@ -401,7 +401,7 @@ :_ ~ %- unix-event %- %*(. file-ovum:pill-lib directories slim-dirs) - /(scot %p our.hid)/home/(scot %da now.hid) + /(scot %p our.hid)/work/(scot %da now.hid) =^ ms all-state (poke-pill pil) (emit-cards ms) :: diff --git a/pkg/arvo/gen/hood/ota.hoon b/pkg/arvo/gen/hood/ota.hoon new file mode 100644 index 000000000..c91f5b9f3 --- /dev/null +++ b/pkg/arvo/gen/hood/ota.hoon @@ -0,0 +1,14 @@ +:: Kiln: Continuously merge local desk from (optionally-)foreign one +:: +:::: /hoon/ota/hood/gen + :: +/? 310 +:: +:::: + :: +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [arg=?(~ [her=@p sud=@tas ~]) ~] + == +:- %kiln-ota +?~(arg ~ `[her sud]:arg) diff --git a/pkg/arvo/gen/spider/kill.hoon b/pkg/arvo/gen/spider/kill.hoon index 7505d9cc3..6f691bb7e 100644 --- a/pkg/arvo/gen/spider/kill.hoon +++ b/pkg/arvo/gen/spider/kill.hoon @@ -1,3 +1,3 @@ :- %say -|= * +|= [^ ~ ~] [%spider-kill ~] diff --git a/pkg/arvo/gen/trouble.hoon b/pkg/arvo/gen/trouble.hoon index 3ab8d718e..4d9ca4630 100644 --- a/pkg/arvo/gen/trouble.hoon +++ b/pkg/arvo/gen/trouble.hoon @@ -7,7 +7,7 @@ :- %noun =< :~ - [%base-hash .^(@uv %cz (pathify ~.base ~))] + [%kids-hash .^(@uv %cz (pathify ~.kids ~))] [%home-hash .^(@uv %cz (pathify ~.home ~))] :: (info %our our) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index cd39ae1e7..b10c302a6 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -11,14 +11,10 @@ |% :: :: ++ part {$kiln $0 pith} :: kiln state ++ pith :: :: - $: rem/(map desk per-desk) :: - syn/(map kiln-sync let/@ud) :: - autoload-on/? :: - cur-hoon/@uvI :: - cur-arvo/@uvI :: - cur-zuse/@uvI :: - cur-vanes/(map @tas @uvI) :: - commit-timer/{way/wire nex/@da tim/@dr mon=term} + $: rem=(map desk per-desk) :: + syn=(map kiln-sync let/@ud) :: + ota=(unit [=ship =desk =aeon]) :: + commit-timer=[way=wire nex=@da tim=@dr mon=term] == :: ++ per-desk :: per-desk state $: auto/? :: escalate on failure @@ -127,6 +123,168 @@ abet:(spam (render "already tracking" [sud her syd]:hos) ~) abet:abet:start-track:(auto hos) :: +++ update + |% + ++ make-wire + |= =path + ?> ?=(^ ota) + %- welp + :_ path + /kiln/ota/(scot %p ship.u.ota)/[desk.u.ota]/(scot %ud aeon.u.ota) + :: + ++ check-ota + |= =wire + ?~ ota + | + ~! ota=ota + ?& ?=([@ @ @ *] wire) + =(i.wire (scot %p ship.u.ota)) + =(i.t.wire desk.u.ota) + =(i.t.t.wire (scot %ud aeon.u.ota)) + == + :: + ++ render + |= [mez=tape error=(unit (pair term tang))] + %+ spam + ?~ ota + leaf+mez + :^ %palm [" " ~ ~ ~] leaf+(weld "kiln: " mez) + ~[leaf+"from {}" leaf+"on {}"] + ?~ error + ~ + [>p.u.error< q.u.error] + :: + ++ render-ket + |= [mez=tape error=(unit (pair term tang))] + ?> ?=(^ ota) + =< ?>(?=(^ ota) .) + %+ spam + :^ %palm [" " ~ ~ ~] leaf+(weld "kiln: " mez) + ~[leaf+"from {}" leaf+"on {}"] + ?~ error + ~ + [>p.u.error< q.u.error] + :: + ++ poke + |= arg=(unit [=ship =desk]) + abet:(poke-internal arg) + :: + ++ poke-internal + |= arg=(unit [=ship =desk]) + ^+ ..abet + =? ..abet =(arg (bind ota |=([=ship =desk =aeon] [ship desk]))) + (render "restarting OTA sync" ~) + =? ..abet ?=(^ ota) + =. ..abet (render-ket "cancelling OTA sync" ~) + ..abet(ota ~) + ?~ arg + ..abet + =. ota `[ship.u.arg desk.u.arg *aeon] + =. ..abet (render "starting OTA sync" ~) + %: emit + %pass (make-wire /find) %arvo %c + %warp ship.u.arg desk.u.arg `[%sing %y ud+1 /] + == + :: + ++ take + |= [=wire =sign-arvo] + ^+ ..abet + ?> ?=(^ ota) + ?. (check-ota wire) + ..abet + ?. ?=([@ @ @ @ *] wire) + ..abet + ?+ i.t.t.t.wire ~&([%strange-ota-take t.t.t.wire] ..abet) + %find (take-find sign-arvo) + %sync (take-sync sign-arvo) + %merge-home (take-merge-home sign-arvo) + %merge-kids (take-merge-kids sign-arvo) + == + :: + ++ take-find + |= =sign-arvo + ?> ?=(%writ +<.sign-arvo) + ?> ?=(^ ota) + =. ..abet (render-ket "activated OTA" ~) + %: emit + %pass (make-wire /sync) %arvo %c + %warp ship.u.ota desk.u.ota `[%sing %w da+now /] + == + :: + ++ take-sync + |= =sign-arvo + ^+ ..abet + ?> ?=(%writ +<.sign-arvo) + ?> ?=(^ ota) + ?~ p.sign-arvo + =. ..abet (render-ket "OTA cancelled, retrying" ~) + (poke-internal `[ship desk]:u.ota) + =? aeon.u.ota ?=($w p.p.u.p.sign-arvo) + ud:;;(cass:clay q.q.r.u.p.sign-arvo) + =/ =germ + =+ .^(=cass:clay %cw /(scot %p our)/home/(scot %da now)) + ?: =(0 ud.cass) + %init + ?:((gth 2 ud.cass) %that %mate) + =. ..abet (render-ket "beginning OTA to %home" ~) + %: emit + %pass (make-wire /merge-home) %arvo %c + %merg %home ship.u.ota desk.u.ota ud+aeon.u.ota germ + == + :: + ++ take-merge-home + |= =sign-arvo + ?> ?=(%mere +<.sign-arvo) + ?> ?=(^ ota) + ?: ?=([%| %ali-unavailable *] p.sign-arvo) + =. ..abet + =/ =tape "OTA to %home failed, maybe because sunk; restarting" + (render-ket tape `p.p.sign-arvo) + (poke-internal `[ship desk]:u.ota) + :: + ?: ?=(%| -.p.sign-arvo) + =. ..abet + =/ =tape "OTA to %home failed, waiting for next revision" + (render-ket tape `p.p.sign-arvo) + =. aeon.u.ota +(aeon.u.ota) + %: emit + %pass (make-wire /sync) %arvo %c + %warp ship.u.ota desk.u.ota `[%sing %y ud+aeon.u.ota /] + == + =. ..abet (render-ket "OTA to %home succeeded" ~) + =. ..abet (render-ket "beginning OTA to %kids" ~) + =/ =germ + =+ .^(=cass:clay %cw /(scot %p our)/kids/(scot %da now)) + ?: =(0 ud.cass) + %init + ?:((gth 2 ud.cass) %that %mate) + %: emit + %pass (make-wire /merge-kids) %arvo %c + %merg %kids ship.u.ota desk.u.ota ud+aeon.u.ota germ + == + :: + ++ take-merge-kids + |= =sign-arvo + ?> ?=(%mere +<.sign-arvo) + ?> ?=(^ ota) + ?: ?=([%| %ali-unavailable *] p.sign-arvo) + =. ..abet + =/ =tape "OTA to %kids failed, maybe because sunk; restarting" + (render-ket tape `p.p.sign-arvo) + (poke-internal `[ship desk]:u.ota) + :: + =. ..abet + ?- -.p.sign-arvo + %& (render-ket "OTA to %kids succeeded" ~) + %| (render-ket "OTA to %kids failed" `p.p.sign-arvo) + == + =. aeon.u.ota +(aeon.u.ota) + %: emit + %pass (make-wire /sync) %arvo %c + %warp ship.u.ota desk.u.ota `[%sing %y ud+aeon.u.ota /] + == + -- +:: ++ poke-sync :: |= hos/kiln-sync ?: (~(has by syn) hos) @@ -136,6 +294,7 @@ ++ poke-syncs :: print sync config |= ~ =< abet %- spam + :- [%leaf "OTAs from {}"] ?: =(0 ~(wyt by syn)) [%leaf "no syncs configured"]~ %+ turn ~(tap in ~(key by syn)) @@ -203,6 +362,7 @@ %kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule) %kiln-track =;(f (f !<(_+<.f vase)) poke-track) %kiln-sync =;(f (f !<(_+<.f vase)) poke-sync) + %kiln-ota =;(f (f !<(_+<.f vase)) poke:update) %kiln-syncs =;(f (f !<(_+<.f vase)) poke-syncs) %kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-goad-gall) %kiln-unmount =;(f (f !<(_+<.f vase)) poke-unmount) @@ -241,6 +401,7 @@ ?>(?=(%writ +<.sign-arvo) +>.sign-arvo) [%autocommit *] %+ take-wake-autocommit t.wire ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) + [%ota *] abet:(take:update t.wire sign-arvo) * ?+ +<.sign-arvo ~|([%kiln-bad-take-card +<.sign-arvo] !!) %done %+ done wire @@ -388,7 +549,7 @@ :: ++ mere |= mes=(each (set path) (pair term tang)) - ?: ?=([%| %bad-fetch-ali *] mes) + ?: ?=([%| %ali-unavailable *] mes) =. +>.$ %^ spam leaf+"merge cancelled, maybe because sunk; restarting" diff --git a/pkg/arvo/lib/ph/io.hoon b/pkg/arvo/lib/ph/io.hoon index 3e18f821f..58400579d 100644 --- a/pkg/arvo/lib/ph/io.hoon +++ b/pkg/arvo/lib/ph/io.hoon @@ -228,8 +228,6 @@ ;< ~ bind:m (mount her desk) ;< our=@p bind:m get-our ;< now=@da bind:m get-time - =/ host-pax - (weld /(scot %p our)/home/(scot %da now) pax) =/ aqua-pax ;: weld /i/(scot %p her)/cx/(scot %p her)/[desk]/(scot %da now) @@ -240,7 +238,7 @@ %^ cat 3 '=> . ' %^ cat 3 extra (need (scry-aqua:util (unit @) our now aqua-pax)) - ;< ~ bind:m (send-events (insert-file:util her desk host-pax warped)) + ;< ~ bind:m (send-events (insert-files:util her desk [pax warped] ~)) (pure:m warped) :: :: Check /sur/aquarium/hoon on the given has the given contents. diff --git a/pkg/arvo/lib/ph/util.hoon b/pkg/arvo/lib/ph/util.hoon index 51a51344c..c9bd6dc63 100644 --- a/pkg/arvo/lib/ph/util.hoon +++ b/pkg/arvo/lib/ph/util.hoon @@ -45,14 +45,16 @@ :: :: Inject a file into a ship :: -++ insert-file - |= [who=ship des=desk pax=path txt=@t] +++ insert-files + |= [who=ship des=desk files=(list [=path txt=@t])] ^- (list aqua-event) - ?> ?=([@ @ @ *] pax) - =/ file [/text/plain (as-octs:mimes:html txt)] + =/ input + %+ turn files + |= [=path txt=@t] + [path ~ /text/plain (as-octs:mimes:html txt)] %+ send-events-to who :~ - [//sync/0v1n.2m9vh %into des | [t.t.t.pax `file]~] + [//sync/0v1n.2m9vh %into des | input] == :: :: Checks whether the given event is a dojo output blit containing the diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 59e76cf2c..f5455f220 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1,7 +1,6 @@ :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::: :::::: Postface :::::: :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: -!: ~> %slog.[0 leaf+"arvo: assembly"] ~< %slog.[0 leaf+"arvo: assembled"] =< :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 98bdf4a51..e8bdedb0f 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3671,7 +3671,7 @@ =/ bem/beam ?^ bem u.bem - [[our %base %ud 1] ~] + [[our %home %ud 1] ~] =/ dos (~(get by dos.rom.ruf) q.bem) ?~ dos !! :: fire next in queue diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 5e9b46251..64d64bbba 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -260,7 +260,7 @@ [[151 %noun] %j our %sein da+now /(scot %p who)] :: ++ init :: initialize - (pass /merg/home [%c %merg %home our %base da+now %init]) + (pass /merg/home [%c %merg %kids our %home da+now %init]) :: ++ mere :: continue init ^+ . @@ -268,13 +268,11 @@ =/ can (clan:title our) =. tem ~ =. +> (pass / %g %conf ram) - =. +> (sync %home our %base) =? +> ?=(?($earl $duke $king) can) - (sync %base (sein our) %kids) - =? +> ?=(?($duke $king $czar) can) - :: make kids desk publicly readable, so syncs work. - :: - (show %kids):(sync %kids our %base) + (ota (sein our) %kids) + :: make kids desk publicly readable, so syncs work. + :: + =. +> (show %kids) =. +> hood-set-boot-apps =. +> peer |- ^+ +>+ @@ -284,7 +282,7 @@ ++ into :: preinitialize |= gyl/(list gill) =. tem `(turn gyl |=(a/gill [%yow a])) - (pass / [%c %warp our %base `[%sing %y [%ud 1] /]]) + (pass / [%c %warp our %home `[%sing %y [%ud 1] /]]) :: ++ send :: send action |= bet/dill-belt @@ -303,9 +301,9 @@ |= des/desk (pass /show [%c %perm des / r+`[%black ~]]) :: - ++ sync - |= syn/{desk ship desk} - (deal /sync [%poke %hood-sync -:!>(syn) syn]) + ++ ota + |= syn=[ship desk] + (deal /sync %poke %kiln-ota !>(`syn)) :: ++ take :: receive |= {tea/wire sih/sign} diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 75fdd3b5d..7522ba964 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1,6 +1,7 @@ -!: :: %gall, agent execution +:: :: %gall, agent execution !? 163 -!: +:: + :::: |= pit=vase =, gall diff --git a/pkg/arvo/ted/ph/child-update.hoon b/pkg/arvo/ted/ph/child-update.hoon new file mode 100644 index 000000000..fc0878ad2 --- /dev/null +++ b/pkg/arvo/ted/ph/child-update.hoon @@ -0,0 +1,54 @@ +/- spider +/+ *ph-io +=, strand=strand:spider +^- thread:spider +|= vase +|^ +=/ m (strand ,vase) +;< ~ bind:m start-simple +;< ~ bind:m (raw-ship ~bud ~) +;< ~ bind:m (raw-ship ~marbud ~) +;< [path @t] bind:m (modify ~bud %home) +;< [=path file=@t] bind:m (modify ~bud %kids) +;< ~ bind:m (check-touched ~marbud %kids path file) +;< ~ bind:m end-simple +(pure:m *vase) +:: +++ modify + |= [her=@p =desk] + =/ m (strand ,[path @t]) + ^- form:m + ;< ~ bind:m (mount her desk) + ;< our=@p bind:m get-our + ;< now=@da bind:m get-time + |^ + =/ zuse-contents + %^ cat 3 '=/ new-val 57 ' + (get-val /sys/zuse/hoon) + =/ mar-contents + %^ cat 3 (get-val /mar/js/hoon) + ' ~& > new-val=new-val .' + =/ js-contents + %^ cat 3 (get-val /app/publish/js/index/js) + 'extra' + =/ files + :~ [/sys/zuse/hoon zuse-contents] + [/mar/js/hoon mar-contents] + [/app/publish/js/index/js js-contents] + == + ;< ~ bind:m (send-events (insert-files:util her desk files)) + (pure:m /app/publish/js/index/js js-contents) + :: + ++ aqua-path + |= =path + ;: weld + /i/(scot %p her)/cx/(scot %p her)/[desk]/(scot %da now) + path + /noun + == + :: + ++ get-val + |= =path + (need (scry-aqua:util (unit @) our now (aqua-path path))) + -- +-- From 25bd1340f62e3f1c9b243622c054364dc0c123d4 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 22 May 2020 00:30:15 -0700 Subject: [PATCH 156/280] ph: update breach-sync now that %base is gone --- pkg/arvo/ted/ph/breach-sync.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/ted/ph/breach-sync.hoon b/pkg/arvo/ted/ph/breach-sync.hoon index d8a4ac09f..833ececd1 100644 --- a/pkg/arvo/ted/ph/breach-sync.hoon +++ b/pkg/arvo/ted/ph/breach-sync.hoon @@ -11,13 +11,13 @@ ;< ~ bind:m (spawn az ~marbud) ;< ~ bind:m (real-ship az ~bud) ;< ~ bind:m (real-ship az ~marbud) -;< file=@t bind:m (touch-file ~bud %base %foo) +;< file=@t bind:m (touch-file ~bud %kids %foo) ;< ~ bind:m (check-file-touched ~marbud %home file) ;< ~ bind:m (breach-and-hear az ~bud ~marbud) ;< ~ bind:m (real-ship az ~bud) -;< ~ bind:m (dojo ~bud "|merge %base ~marbud %kids, =gem %this") -;< file=@t bind:m (touch-file ~bud %base %bar) -;< file=@t bind:m (touch-file ~bud %base %baz) +;< ~ bind:m (dojo ~bud "|merge %kids ~marbud %kids, =gem %this") +;< file=@t bind:m (touch-file ~bud %kids %bar) +;< file=@t bind:m (touch-file ~bud %kids %baz) ;< ~ bind:m (check-file-touched ~marbud %home file) ;< ~ bind:m end-azimuth (pure:m *vase) From a4a44f1e21005ddb6d485782bec21dab936cfa97 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 22 May 2020 14:32:32 -0700 Subject: [PATCH 157/280] kiln: cleanup --- bin/solid.pill | 4 ++-- pkg/arvo/gen/spider/kill.hoon | 2 +- pkg/arvo/gen/trouble.hoon | 8 +++++++- pkg/arvo/lib/hood/kiln.hoon | 29 +++++++++++++++++------------ pkg/arvo/sys/vane/ames.hoon | 4 ++-- pkg/arvo/sys/vane/clay.hoon | 19 +++++++++++++++++-- pkg/arvo/sys/vane/gall.hoon | 1 - pkg/arvo/ted/read.hoon | 8 +++----- 8 files changed, 49 insertions(+), 26 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 5f852ceae..f41ec49d6 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4bd63360c1b2fab69a35f71d360db6b9c71a796965d1826f919cf271e990bad2 -size 15816973 +oid sha256:a571650a0bec9d9368c7290a245cec1546fdd73bcf3982a73f6f6e6e6d5cee55 +size 15819552 diff --git a/pkg/arvo/gen/spider/kill.hoon b/pkg/arvo/gen/spider/kill.hoon index 6f691bb7e..7505d9cc3 100644 --- a/pkg/arvo/gen/spider/kill.hoon +++ b/pkg/arvo/gen/spider/kill.hoon @@ -1,3 +1,3 @@ :- %say -|= [^ ~ ~] +|= * [%spider-kill ~] diff --git a/pkg/arvo/gen/trouble.hoon b/pkg/arvo/gen/trouble.hoon index 4d9ca4630..58df96e1e 100644 --- a/pkg/arvo/gen/trouble.hoon +++ b/pkg/arvo/gen/trouble.hoon @@ -7,8 +7,9 @@ :- %noun =< :~ - [%kids-hash .^(@uv %cz (pathify ~.kids ~))] + [%base-hash base-hash] [%home-hash .^(@uv %cz (pathify ~.home ~))] + [%kids-hash .^(@uv %cz (pathify ~.kids ~))] :: (info %our our) (info %sponsor sponsor) @@ -40,4 +41,9 @@ life=lyfe rift=ryft == +:: +++ base-hash + =/ parent (scot %p (sein:title our now our)) + =+ .^(=cass:clay %cs /[parent]/kids/1/late/foo) + .^(@uv %cz /[parent]/kids/(scot %ud ud.cass)) -- diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index b10c302a6..9c287616c 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -165,6 +165,19 @@ ~ [>p.u.error< q.u.error] :: + :: If destination desk doesn't exist, need a %init merge. If this is + :: its first revision, it probably doesn't have a mergebase yet, so + :: use %that. + :: + ++ get-germ + |= =desk + =+ .^(=cass:clay %cw /(scot %p our)/home/(scot %da now)) + ?- ud.cass + %0 %init + %1 %that + * %mate + == + :: ++ poke |= arg=(unit [=ship =desk]) abet:(poke-internal arg) @@ -221,11 +234,7 @@ (poke-internal `[ship desk]:u.ota) =? aeon.u.ota ?=($w p.p.u.p.sign-arvo) ud:;;(cass:clay q.q.r.u.p.sign-arvo) - =/ =germ - =+ .^(=cass:clay %cw /(scot %p our)/home/(scot %da now)) - ?: =(0 ud.cass) - %init - ?:((gth 2 ud.cass) %that %mate) + =/ =germ (get-germ %home) =. ..abet (render-ket "beginning OTA to %home" ~) %: emit %pass (make-wire /merge-home) %arvo %c @@ -249,15 +258,11 @@ =. aeon.u.ota +(aeon.u.ota) %: emit %pass (make-wire /sync) %arvo %c - %warp ship.u.ota desk.u.ota `[%sing %y ud+aeon.u.ota /] + %warp ship.u.ota desk.u.ota `[%sing %z ud+aeon.u.ota /] == =. ..abet (render-ket "OTA to %home succeeded" ~) =. ..abet (render-ket "beginning OTA to %kids" ~) - =/ =germ - =+ .^(=cass:clay %cw /(scot %p our)/kids/(scot %da now)) - ?: =(0 ud.cass) - %init - ?:((gth 2 ud.cass) %that %mate) + =/ =germ (get-germ %kids) %: emit %pass (make-wire /merge-kids) %arvo %c %merg %kids ship.u.ota desk.u.ota ud+aeon.u.ota germ @@ -281,7 +286,7 @@ =. aeon.u.ota +(aeon.u.ota) %: emit %pass (make-wire /sync) %arvo %c - %warp ship.u.ota desk.u.ota `[%sing %y ud+aeon.u.ota /] + %warp ship.u.ota desk.u.ota `[%sing %z ud+aeon.u.ota /] == -- :: diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 1684062b6..ee5038d33 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3274,7 +3274,7 @@ |= [=message-num =message-blob] ^- (list static-fragment) :: - =/ fragments=(list fragment) (rip 13 message-blob) + =/ fragments=(list fragment) (rip 23 message-blob) =/ num-fragments=fragment-num (lent fragments) =| counter=@ :: @@ -3299,7 +3299,7 @@ $(index +(index), sorted [(~(got by fragments) index) sorted]) :: %- cue - %+ can 13 + %+ can 23 %+ turn (flop sorted) |=(a=@ [1 a]) :: +bind-duct: find or make new $bone for .duct in .ossuary diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index e8bdedb0f..e026456f5 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2502,7 +2502,7 @@ $t ~| %requesting-foreign-directory-is-vaporware !! $u ~| %prolly-poor-idea-to-get-rang-over-network !! $v ~| %weird-shouldnt-get-v-request-from-network !! - $z ~| %its-prolly-not-reasonable-to-request-ankh !! + $z `(validate-z r.rand) $w `(validate-w r.rand) $x (validate-x [p.p q.p q r]:rand) $y `[p.r.rand !>(;;(arch q.r.rand))] @@ -2535,6 +2535,15 @@ %- (slog >%validate-x-failed< p.vale-result) ~ `-.p.vale-result + :: + :: Make sure the incoming data is a %z response + :: + ++ validate-z + |= =page + ^- cage + ?> ?=(%uvi p.page) + :- p.page + !>(;;(@uvI q.page)) -- :: :: A full foreign update. Validate and apply to our local cache of @@ -3283,7 +3292,7 @@ ++ read-s |= [yon=aeon pax=path] ^- (unit (unit cage)) - ?. ?=([?(%yaki %blob %hash %cage %open) * ~] pax) + ?. ?=([?(%yaki %blob %hash %cage %open %late) * ~] pax) `~ ?- i.pax %yaki @@ -3318,6 +3327,12 @@ :: %open ``open+!>(prelude:(ford:fusion ank.dom ~ ~ lat.ran fod.dom)) + :: + %late + :^ ~ ~ %cass + ?~ let.dom + !>([0 *@da]) + !>([let.dom t:(~(got by hut.ran) (~(got by hit.dom) let.dom))]) == :: +read-t: produce the list of paths within a yaki with :pax as prefix :: diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 7522ba964..023af2576 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1,7 +1,6 @@ :: :: %gall, agent execution !? 163 :: - :::: |= pit=vase =, gall diff --git a/pkg/arvo/ted/read.hoon b/pkg/arvo/ted/read.hoon index 346b495fe..12816e985 100644 --- a/pkg/arvo/ted/read.hoon +++ b/pkg/arvo/ted/read.hoon @@ -7,14 +7,12 @@ ^- form:m :: Parse arguments as ship, desk, and path :: -=+ !<([=target=path ~] arg) +=+ !<([=care:clay =ship =desk =case =target=path ~] arg) :: Read the file, possibly asyncrhonously :: ;< =bowl:spider bind:m get-bowl:strandio ;< =riot:clay bind:m - (warp:strandio our.bowl %home ~ %sing %a [%da now.bowl] target-path) + (warp:strandio ship desk ~ %sing care case target-path) ?~ riot - ~& %nothing (pure:m !>("nothing")) -%- (slog leaf+"got writ" (sell !<(vase q.r.u.riot)) ~) -(pure:m !<(vase q.r.u.riot)) +(pure:m q.r.u.riot) From 831206d4fe4092c3d1dbe1dc97cd972b6b722291 Mon Sep 17 00:00:00 2001 From: pilfer-pandex <47340789+pilfer-pandex@users.noreply.github.com> Date: Mon, 25 May 2020 22:35:54 -0400 Subject: [PATCH 158/280] hoon: comment and syn mod for +slab --- pkg/arvo/sys/hoon.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 9bf9450cc..eff7548ee 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -12013,8 +12013,11 @@ =+ gun=(~(mint ut typ) %noun gen) [p.gun (slum q.gat q.sam)] :: +:: +slab states whether you can access an arm in a type +:: for reading, writing, or reading-and-writing. +:: ++ slab :: test if contains - |= {cog/@tas way/?(%read %rite %both) typ/type} + |= [way=?(%read %rite %both) cog=@tas typ=type] ?= [%| *] (~(find ut typ) way ~[cog]) :: From 78729f4f879eb5711ff1f41e6fb1aa594708b98f Mon Sep 17 00:00:00 2001 From: pilfer-pandex <47340789+pilfer-pandex@users.noreply.github.com> Date: Mon, 25 May 2020 22:42:49 -0400 Subject: [PATCH 159/280] hoon: better comment for +slab --- pkg/arvo/sys/hoon.hoon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index eff7548ee..aa3f4ffab 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -12013,8 +12013,12 @@ =+ gun=(~(mint ut typ) %noun gen) [p.gun (slum q.gat q.sam)] :: -:: +slab states whether you can access an arm in a type -:: for reading, writing, or reading-and-writing. +:: +slab: states whether you can access an arm in a type. +:: +:: -- way: the access type ($vial): read, write, or read-and-write. +:: The fourth case of $vial, %free, is not permitted because it would +:: allow you to discover "private" information about a type, +:: information which you could not make use of in (law-abiding) hoon anyway. :: ++ slab :: test if contains |= [way=?(%read %rite %both) cog=@tas typ=type] From 33b534e8f8179e807594e296c7b5571b61235c3e Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Tue, 26 May 2020 14:55:27 -0600 Subject: [PATCH 160/280] publish: send less data on kick/resubscribe --- pkg/arvo/app/publish.hoon | 95 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 89 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index f7b729986..cfa7778b2 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -362,7 +362,7 @@ ?+ pax (on-watch:def pax) [%http-response *] [~ this] :: - [%notebook @ ~] + [%notebook @ *] =^ cards state (watch-notebook:main pax) [cards this] @@ -458,8 +458,13 @@ [%subscribe @ @ ~] =/ who=@p (slav %p i.t.wir) =/ book=@tas i.t.t.wir + =/ wen=(unit @da) (get-last-update:main who book) + =/ pax=path + ?~ wen + /notebook/[book] + /notebook/[book]/(scot %da u.wen) :_ this - [%pass wir %agent [who %publish] %watch /notebook/[book]]~ + [%pass wir %agent [who %publish] %watch pax]~ :: [%permissions ~] :_ this @@ -542,6 +547,63 @@ :: |_ bol=bowl:gall :: +++ get-last-update + |= [host=@p book-name=@tas] + ^- (unit @da) + =/ book (~(get by books) host book-name) + ?~ book ~ + =/ wen date-created.u.book + %- some + %- ~(rep by notes.u.book) + |= [[@tas =note] out=_wen] + ^- @da + =? out (gth last-edit.note wen) + last-edit.note + =. out + %- ~(rep by comments.note) + |= [[@da =comment] out=_out] + ?: (gth date-created.comment out) + date-created.comment + out + out +:: +++ get-notebook-from-date + |= [host=@p book-name=@tas wen=@da] + ^- notebook + =/ book (~(got by books) host book-name) + %= book + notes + %- ~(rep by notes.book) + |= [[nom=@tas not=note] out=(map @tas note)] + ^- (map @tas note) + ?: (gth last-edit.not wen) + (~(put by out) nom not) + =. comments.not + %- ~(rep by comments.not) + |= [[nam=@da com=comment] out=(map @da comment)] + ?: (gth date-created.com wen) + (~(put by out) nam com) + out + ?~ comments.not + out + (~(put by out) nom not) + == +:: +++ merge-notebooks + |= [base=notebook diff=notebook] + ^- notebook + %= base + notes + %- ~(rep by notes.diff) + |= [[nom=@tas not=note] out=_notes.base] + =/ base-note=(unit note) (~(get by out) nom) + ?~ base-note + (~(put by out) nom not) + =. comments.u.base-note + (~(uni by comments.u.base-note) comments.not) + (~(put by out) nom u.base-note) + == +:: ++ read-paths |= ran=rant:clay ^- (quip card _state) @@ -881,6 +943,19 @@ %.n == :: +++ get-subscriber-paths + |= [book-name=@tas who=@p] + ^- (list path) + %+ roll ~(val by sup.bol) + |= [[whom=@p pax=path] out=(list path)] + ?. =(who whom) + out + ?. ?=([%notebook @ *] pax) + out + ?. =(i.t.pax book-name) + out + [pax out] +:: ++ handle-permission-update |= upd=permission-update ^- (quip card _state) @@ -901,7 +976,7 @@ %+ turn ~(tap in who.upd) |= who=@p ?. (allowed who %read u.book) - [%give %kick [/notebook/[u.book]]~ `who]~ + [%give %kick (get-subscriber-paths u.book who) `who]~ ?: ?|(?=(%remove -.upd) (is-managed path.upd)) ~ =/ uid (sham %publish who u.book eny.bol) @@ -957,11 +1032,15 @@ :: ++ watch-notebook |= pax=path - ?> ?=([%notebook @ ~] pax) + ?> ?=([%notebook @ *] pax) =/ book-name i.t.pax ?. (allowed src.bol %read book-name) ~|("not permitted" !!) - =/ book (~(got by books) our.bol book-name) + =/ book + ?: ?=([%notebook @ @ ~] pax) + =/ wen=@da (slav %da i.t.t.pax) + (get-notebook-from-date our.bol book-name wen) + (~(got by books) our.bol book-name) =/ delta=notebook-delta [%add-book our.bol book-name book] :_ state @@ -1814,7 +1893,7 @@ %+ turn ~(tap in dif-peeps) |= who=@p ^- card - [%give %kick [/notebook/[book.act]]~ `who] + [%give %kick (get-subscriber-paths book.act who) `who] == :: ++ get-subscribers @@ -1963,7 +2042,11 @@ date-created.data.del == == + =/ book (~(get by books) host.del book.del) =^ cards state + ?~ book + (emit-updates-and-state host.del book.del data.del del sty) + =. data.del (merge-notebooks u.book data.del) (emit-updates-and-state host.del book.del data.del del sty) :_ state :* (group-hook-poke [%add host.del writers.data.del]) From e9b7360335ca1112a433a39c3585dc4db970c607 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Wed, 27 May 2020 16:27:51 -0600 Subject: [PATCH 161/280] publish: address review comments --- pkg/arvo/app/publish.hoon | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index cfa7778b2..09c1f2212 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -557,15 +557,11 @@ %- ~(rep by notes.u.book) |= [[@tas =note] out=_wen] ^- @da - =? out (gth last-edit.note wen) - last-edit.note - =. out - %- ~(rep by comments.note) - |= [[@da =comment] out=_out] - ?: (gth date-created.comment out) - date-created.comment - out - out + %+ max out + %+ max last-edit.note + %- ~(rep by comments.note) + |= [[@da =comment] out=_out] + (max date-created.comment out) :: ++ get-notebook-from-date |= [host=@p book-name=@tas wen=@da] @@ -592,7 +588,7 @@ ++ merge-notebooks |= [base=notebook diff=notebook] ^- notebook - %= base + %= diff notes %- ~(rep by notes.diff) |= [[nom=@tas not=note] out=_notes.base] @@ -2042,11 +2038,9 @@ date-created.data.del == == - =/ book (~(get by books) host.del book.del) + =? data.del (~(has by books) host.del book.del) + (merge-notebooks (~(got by books) host.del book.del) data.del) =^ cards state - ?~ book - (emit-updates-and-state host.del book.del data.del del sty) - =. data.del (merge-notebooks u.book data.del) (emit-updates-and-state host.del book.del data.del del sty) :_ state :* (group-hook-poke [%add host.del writers.data.del]) From 3eb28e2f61d51d95b5a2088262566ace2d01c085 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 27 May 2020 19:35:22 -0700 Subject: [PATCH 162/280] hood: update on-save --- pkg/arvo/app/hood.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 54657f138..83282c1be 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -140,7 +140,7 @@ `..on-init :: ++ on-save - !>([%4 lac]) + !>([%5 lac]) :: ++ on-load |= =old-state=vase From 8d2aad0de29e13ab5f54a1606d1aff1735e83980 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 28 May 2020 20:36:54 +0200 Subject: [PATCH 163/280] dbug fe: coax searchable list key into string includes() only works on strings, but we might pass in other types as keys. --- pkg/interface/dbug/src/js/components/searchable-list.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/interface/dbug/src/js/components/searchable-list.js b/pkg/interface/dbug/src/js/components/searchable-list.js index 27b17e9ea..5b7e1d1de 100644 --- a/pkg/interface/dbug/src/js/components/searchable-list.js +++ b/pkg/interface/dbug/src/js/components/searchable-list.js @@ -33,7 +33,7 @@ export class SearchableList extends Component { let items = props.items.filter(item => { return state.query.split(' ').reduce((match, query) => { - return match && item.key.includes(query); + return match && ('' + item.key).includes(query); }, true); }) items = items.map(item => @@ -46,4 +46,4 @@ export class SearchableList extends Component {
{items.length === 0 ? 'none' : items}
); } -} \ No newline at end of file +} From 00e3159287980e2ae3c8a32cf23bbfa9735cfc7e Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 29 May 2020 15:28:13 +0200 Subject: [PATCH 164/280] eyre: clear expired sessions/cookies from state Instead of setting a timer for every session, we set a single expiry timer when the first session is created. On the subsequent wake event, we clear all cookies that have expired at that time, then set a timer for when the next session expires. This approach gives us flexibility wrt sessions going forward, allowing extending or early deleting of sessions without having to care about the related timers. Note that in +load, we clear all existing sessions. We would start the expiry timer flow there, but can't. Forcing the user to login again post-ota once isn't the end of the world. --- pkg/arvo/sys/vane/eyre.hoon | 65 +++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 58ac07e72..90b43a411 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -84,7 +84,7 @@ ++ axle $: :: date: date at which http-server's state was updated to this data structure :: - date=%~2019.10.6 + date=%~2020.5.29 :: server-state: state of inbound requests :: =server-state @@ -146,6 +146,9 @@ :: channel-timeout: the delay before a channel should be reaped :: ++ channel-timeout ~h12 +:: session-timeout: the delay before a session expires +:: +++ session-timeout ~d7 -- :: utilities :: @@ -956,15 +959,25 @@ $(eny (shas %try-again candidate)) :: record cookie and record expiry time :: - =/ expires-in=@dr ~d7 + =/ first-session=? =(~ sessions.authentication-state.state) + =/ expires-at=@da (add now session-timeout) =. sessions.authentication-state.state - (~(put by sessions.authentication-state.state) session (add now expires-in)) + (~(put by sessions.authentication-state.state) session expires-at) :: - =/ max-age=tape (format-ud-as-integer `@ud`(div (msec:milly expires-in) 1.000)) + =/ max-age=tape + %- format-ud-as-integer + (div (msec:milly session-timeout) 1.000) =/ cookie-line %- crip "urbauth-{}={}; Path=/; Max-Age={max-age}" :: + =; out=[moves=(list move) server-state] + :: if we didn't have any cookies previously, start the expiry timer + :: + ?. first-session out + =- out(moves [- moves.out]) + [duct %pass /sessions/expire %b %wait expires-at] + :: ?~ redirect=(get-header:http 'redirect' u.parsed) %- handle-response :* %start @@ -2150,6 +2163,7 @@ %run-app-request run-app-request %watch-response watch-response %run-build run-build + %sessions sessions %channel channel %acme acme-ack == @@ -2266,6 +2280,34 @@ [moves http-server-gate] == :: + ++ sessions + :: + ?> ?=([%b %wake *] sign) + :: + ?^ error.sign + [[duct %slip %d %flog %crud %wake u.error.sign]~ http-server-gate] + :: remove cookies that have expired + :: + =* sessions sessions.authentication-state.server-state.ax + =. sessions.authentication-state.server-state.ax + %- ~(gas by *(map @uv session)) + %+ murn ~(tap in sessions) + |= [cookie=@uv session] + ^- (unit [@uv session]) + ?: (lth expiry-time now) ~ + `[cookie expiry-time] + :: if there's any cookies left, set a timer for the next expected expiry + :: + ^- [(list move) _http-server-gate] + :_ http-server-gate + ?: =(~ sessions) ~ + =; next-expiry=@da + [duct %pass /sessions/expire %b %wait next-expiry]~ + %+ roll ~(tap by sessions) + |= [[@uv session] next=@da] + ?: =(*@da next) expiry-time + (min next expiry-time) + :: ++ acme-ack ?> ?=([%g %unto *] sign) :: @@ -2294,13 +2336,16 @@ $: session=(map @t channel-old) duct-to-key=(map duct @t) == - ++ axle-old + ++ axle-2019-1-7 %+ cork axle |= =axle axle(date %~2019.1.7, channel-state.server-state (channel-state-old)) + :: + +$ axle-2019-10-6 + [date=%~2019.10.6 =server-state] -- - |= old=$%(axle axle-old) + |= old=$%(axle axle-2019-10-6 axle-2019-1-7) ^+ ..^$ :: ~! %loading @@ -2319,7 +2364,13 @@ == $(old new) :: - %~2019.10.6 ..^$(ax old) + %~2019.10.6 + %_ $ + date.old %~2020.5.29 + sessions.authentication-state.server-state.old ~ + == + :: + %~2020.5.29 ..^$(ax old) == :: +stay: produce current state From a51d93326a48e5a3e61dbb0bb20dfe52d4aa1202 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 29 May 2020 15:33:22 +0200 Subject: [PATCH 165/280] eyre: clean up old +load code Removes pre-breach state adapter logic and touches up code style. --- pkg/arvo/sys/vane/eyre.hoon | 50 ++++++++----------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 90b43a411..3189eb7a1 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -2326,51 +2326,21 @@ :: ++ load => |% - +$ channel-old - $: state=(each timer duct) - next-id=@ud - events=(qeu [id=@ud lines=wall]) - subscriptions=(map wire [ship=@p app=term =path duc=duct]) - == - +$ channel-state-old - $: session=(map @t channel-old) - duct-to-key=(map duct @t) - == - ++ axle-2019-1-7 - %+ cork - axle - |= =axle - axle(date %~2019.1.7, channel-state.server-state (channel-state-old)) - :: - +$ axle-2019-10-6 - [date=%~2019.10.6 =server-state] - -- - |= old=$%(axle axle-2019-10-6 axle-2019-1-7) + +$ axle-2019-10-6 + [date=%~2019.10.6 =server-state] + -- + |= old=$%(axle axle-2019-10-6) ^+ ..^$ :: ~! %loading ?- -.old - %~2019.1.7 - =/ add-heartbeat - %- ~(run by session.channel-state.server-state.old) - |= [c=channel-old] - ^- channel - [state.c next-id.c events.c subscriptions.c ~] - :: - =/ new - %= old - date %~2019.10.6 - session.channel-state.server-state add-heartbeat - == - $(old new) - :: - %~2019.10.6 - %_ $ - date.old %~2020.5.29 - sessions.authentication-state.server-state.old ~ - == - :: %~2020.5.29 ..^$(ax old) + :: + %~2019.10.6 + %_ $ + date.old %~2020.5.29 + sessions.authentication-state.server-state.old ~ + == == :: +stay: produce current state From 63c26151a3bddf382833f9128ad1e838d01420c4 Mon Sep 17 00:00:00 2001 From: Fang Date: Sat, 30 May 2020 02:29:20 +0200 Subject: [PATCH 166/280] eyre: extend session duration on-use When sending a response to an authenticated request, update the session to last for +session-timeout again, and send an updated cookie to match. Assuming the user makes an actual HTTP request at least once a week, this will make sure they don't get logged out automatically. Simply keeping a channel open, unfortunately, doesn't count. --- pkg/arvo/sys/vane/eyre.hoon | 90 ++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 25 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 3189eb7a1..4f3cfa638 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -146,7 +146,7 @@ :: channel-timeout: the delay before a channel should be reaped :: ++ channel-timeout ~h12 -:: session-timeout: the delay before a session expires +:: session-timeout: the delay before an idle session expires :: ++ session-timeout ~d7 -- @@ -964,12 +964,8 @@ =. sessions.authentication-state.state (~(put by sessions.authentication-state.state) session expires-at) :: - =/ max-age=tape - %- format-ud-as-integer - (div (msec:milly session-timeout) 1.000) - =/ cookie-line - %- crip - "urbauth-{}={}; Path=/; Max-Age={max-age}" + =/ cookie-line=@t + (session-cookie-string session) :: =; out=[moves=(list move) server-state] :: if we didn't have any cookies previously, start the expiry timer @@ -1000,6 +996,29 @@ data=~ complete=%.y == + :: +session-id-from-request: attempt to find a session cookie + :: + ++ session-id-from-request + |= =request:http + ^- (unit @uv) + :: are there cookies passed with this request? + :: + :: TODO: In HTTP2, the client is allowed to put multiple 'Cookie' + :: headers. + :: + ?~ cookie-header=(get-header:http 'cookie' header-list.request) + ~ + :: is the cookie line is valid? + :: + ?~ cookies=(rush u.cookie-header cock:de-purl:html) + ~ + :: is there an urbauth cookie? + :: + ?~ urbauth=(get-header:http (crip "urbauth-{}") u.cookies) + ~ + :: if it's formatted like a valid session cookie, produce it + :: + `(unit @)`(rush u.urbauth ;~(pfix (jest '0v') viz:ag)) :: +request-is-logged-in: checks to see if the request is authenticated :: :: We are considered logged in if this request has an urbauth @@ -1008,24 +1027,9 @@ ++ request-is-logged-in |= =request:http ^- ? - :: are there cookies passed with this request? + :: does the request pass a session cookie? :: - :: TODO: In HTTP2, the client is allowed to put multiple 'Cookie' - :: headers. - :: - ?~ cookie-header=(get-header:http 'cookie' header-list.request) - %.n - :: is the cookie line is valid? - :: - ?~ cookies=(rush u.cookie-header cock:de-purl:html) - %.n - :: is there an urbauth cookie? - :: - ?~ urbauth=(get-header:http (crip "urbauth-{}") u.cookies) - %.n - :: is this formatted like a valid session cookie? - :: - ?~ session-id=(rush u.urbauth ;~(pfix (jest '0v') viz:ag)) + ?~ session-id=(session-id-from-request request) %.n :: is this a session that we know about? :: @@ -1043,6 +1047,16 @@ =+ res=((sloy scry) [151 %noun] %j pax) :: (rsh 3 1 (scot %p (@ (need (need res))))) + :: +session-cookie-string: compose newly-timestamped session cookie + :: + ++ session-cookie-string + |= session=@uv + ^- @t + %- crip + =; max-age=tape + "urbauth-{}={}; Path=/; Max-Age={max-age}" + %- format-ud-as-integer + (div (msec:milly session-timeout) 1.000) -- :: +channel: per-event handling of requests to the channel system :: @@ -1750,12 +1764,38 @@ ?^ response-header.u.connection-state ~& [%http-multiple-start duct] error-connection + :: if request was authenticated, extend the session & cookie's life :: + =^ response-header sessions.authentication-state.state + =, authentication + =* sessions sessions.authentication-state.state + =* inbound inbound-request.u.connection-state + =* no-op [response-header.http-event sessions] + :: + ?. authenticated.inbound + no-op + ?~ session-id=(session-id-from-request request.inbound) + :: cookies are the only auth method, so this is unexpected + :: + ~& [%e %authenticated-without-cookie] + no-op + ?. (~(has by sessions) u.session-id) + :: if the session has expired since the request was opened, + :: tough luck, we don't create/revive sessions here + :: + no-op + :_ (~(put by sessions) u.session-id (add now session-timeout)) + =- response-header.http-event(headers -) + %^ set-header:http 'set-cookie' + (session-cookie-string u.session-id) + headers.response-header.http-event + :: + =. response-header.http-event response-header =. connections.state %+ ~(jab by connections.state) duct |= connection=outstanding-connection %_ connection - response-header `response-header.http-event + response-header `response-header bytes-sent ?~(data.http-event 0 p.u.data.http-event) == :: From b1daaec7bf0c522b2a269d874768a6beb1654501 Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 31 May 2020 17:23:50 +0200 Subject: [PATCH 167/280] zuse: add parsers for ip addresses Parses into +address:eyre. --- pkg/arvo/sys/zuse.hoon | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 54410369d..813906f8e 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1470,6 +1470,53 @@ :: (gte i.b 224) == + :: +ipa: parse ip address + :: + ++ ipa + ;~(pose (stag %ipv4 ip4) (stag %ipv6 ip6)) + :: +ip4: parse ipv4 address + :: + ++ ip4 + =+ byt=(ape:ag ted:ab) + (bass 256 ;~(plug byt (stun [3 3] ;~(pfix dot byt)))) + :: +ip6: parse ipv6 address + :: + ++ ip6 + %+ bass 0x1.0000 + %+ sear + |= hexts=(list $@(@ [~ %zeros])) + ^- (unit (list @)) + :: not every list of hextets is an ipv6 address + :: + =/ legit=? + =+ l=(lent hexts) + =+ c=|=(a=* ?=([~ %zeros] a)) + ?| &((lth l 8) ?=([* ~] (skim hexts c))) + &(=(8 l) !(lien hexts c)) + == + ?. legit ~ + %- some + :: expand zeros + :: + %- zing + %+ turn hexts + |= hext=$@(@ [~ %zeros]) + ?@ hext [hext]~ + (reap (sub 9 (lent hexts)) 0) + :: parse hextets, producing cell for shorthand zeroes + :: + |^ %+ cook + |= [a=(list @) b=(list [~ %zeros]) c=(list @)] + :(welp a b c) + ;~ plug + (more col het) + (stun [0 1] cel) + (more col het) + == + ++ cel (cold `%zeros ;~(plug col col)) + ++ het (bass 16 (stun [1 4] six:ab)) + -- + :: ++ rout {p/(list host) q/path r/oryx s/path} :: http route (new) ++ user knot :: username -- ::eyre From a87000149db5f07fcca6c949c859757ae5c5aee7 Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 31 May 2020 17:36:47 +0200 Subject: [PATCH 168/280] zuse: add parsers for http header field values Multi-value format as used by some headers. Also updates pill with recent zuse changes. --- bin/solid.pill | 4 ++-- pkg/arvo/sys/zuse.hoon | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ac7df51de..551d747d1 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a22f2797c2cbbff171cb0a4c14afaca4353f41f49f1fcdc5f5dbf3e8056a7e3 -size 13813374 +oid sha256:960df352aa78135a409e87d0946bf2665605bf3918c19e3e290ad40edb740769 +size 17295261 diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 813906f8e..29977037e 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -357,6 +357,45 @@ t.header-list :: [i.header-list $(header-list t.header-list)] + :: +unpack-header: parse header field values + :: + ++ unpack-header + |^ |= value=@t + ^- (unit (list (map @t @t))) + (rust (cass (trip value)) values) + :: + ++ values + %+ more + (ifix [. .]:(star ;~(pose ace (just '\09'))) com) + pairs + :: + ++ pairs + %+ cook + ~(gas by *(map @t @t)) + %+ more (ifix [. .]:(star ace) mic) + ;~(plug token ;~(pose ;~(pfix tis value) (easy ''))) + :: + ++ value + ;~(pose token quoted-string) + :: + ++ token :: 7230 token + %+ cook crip + ::NOTE this is ptok:de-purl:html, but can't access that here + %- plus + ;~ pose + aln zap hax bus cen pad say tar lus + hep dot ket cab tec bar sig + == + :: + ++ quoted-string :: 7230 quoted string + %+ cook crip + %+ ifix [. .]:;~(less (jest '\\"') yel) + %- star + ;~ pose + ;~(pfix bat ;~(pose (just '\09') ace prn)) + ;~(pose (just '\09') ;~(less (mask "\22\5c\7f") (shim 0x20 0xff))) + == + -- :: +simple-payload: a simple, one event response used for generators :: +$ simple-payload From 750ff6e5e18e2d765cafc10735e322987156c49c Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 31 May 2020 17:43:35 +0200 Subject: [PATCH 169/280] eyre: respect "forwarded" header from localhost For request transparency, HTTP proxies may set the Forwarded header to specify who the original requester is. For requests from localhost only, we make Eyre respect the Forwarded header, and adjust the handled ip address accordingly. Note that we do not support X-Forwarded or other non-standard variants. The header remains in the request, so server applications can handle them as desired. Fixes #2723. --- pkg/arvo/sys/vane/eyre.hoon | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 58ac07e72..6abe5949e 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -794,6 +794,10 @@ ++ request |= [secure=? =address =request:http] ^- [(list move) server-state] + :: for requests from localhost, respect the "forwarded" header + :: + =? address =([%ipv4 .127.0.0.1] address) + (fall (forwarded-for header-list.request) address) :: =/ host (get-header:http 'host' header-list.request) =/ action (get-action-for-binding host url.request) @@ -1912,6 +1916,29 @@ $(bindings t.bindings) -- :: +++ forwarded-for + |= =header-list:http + ^- (unit address) + =/ forwarded=(unit @t) + (get-header:http 'forwarded' header-list) + ?~ forwarded ~ + |^ =/ forwards=(unit (list (map @t @t))) + (unpack-header:http u.forwarded) + ?. ?=([~ ^] forwards) ~ + =* forward i.u.forwards + ?~ for=(~(get by forward) 'for') ~ + ::NOTE per rfc7239, non-ip values are also valid. they're not useful + :: for the general case, so we ignore them here. if needed, + :: request handlers are free to inspect the headers themselves. + :: + (rush u.for ip-address) + :: + ++ ip-address + ;~ sfix + ;~(pose (stag %ipv4 ip4) (stag %ipv6 (ifix [lac rac] ip6))) + ;~(pose ;~(pfix col dim:ag) (easy ~)) + == + -- :: ++ parse-request-line |= url=@t From b191636276faffb360c2552a2ee57e53c246eebc Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 1 Jun 2020 12:56:21 -0400 Subject: [PATCH 170/280] clay: WIP reef building --- pkg/arvo/sys/vane/clay.hoon | 49 +++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index e026456f5..abfd3860d 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -114,6 +114,14 @@ $: vases=(map path [res=vase dez=(set path)]) marks=(map mark [res=dais dez=(set path)]) casts=(map mars [res=tube dez=(set path)]) + reef=reef-cache + == +:: $reef-cache: built system files +:: ++$ reef-cache + $: hoon=(unit vase) + arvo=(unit vase) + zuse=(unit vase) == :: :: Hash of a blob, for lookup in the object store (lat.ran) @@ -870,8 +878,36 @@ $(sut (slop q.cage sut), bar t.bar) :: ++ run-reef - ^- [vase state] - [!>(..zuse) nub] :: TODO implement + |- ^- [vase state] + ?^ zuse.reef.cache.nub + [u.zuse.reef.cache.nub state] + =^ zus nub (get-value /sys/zuse/hoon) + ?^ arvo.reef.cache.nub + =/ gen + ~> %mean.%zuse-parse-fail + (rain /sys/zuse/hoon `@t`q.q.zus) + =/ vax + ~> %mean.%zuse-compile-fail + (slap (slap u.arvo.reef.cache.nub (ream '..is')) gen) + $(zuse.reef.cache.nub `vax) + =^ rav nub (get-value /sys/arvo/hoon) + ?^ hoon.reef.cache.nub + =/ gen + ~> %mean.%arvo-parse-fail + (rain /sys/arvo/hoon `@t`q.q.rav) + =/ vax + ~> %mean.%arvo-compile-fail + (slap (slot 7 u.hoon.reef.cache.nub) gen) + $(arvo.reef.cache.nub `vax) + ~& %clay-should-never-build-hoon + =^ hun nub (get-value /sys/hoon/hoon) + =/ gen + ~> %mean.%hoon-parse-fail + (rain /sys/hoon/hoon `@t`q.q.hun) + =/ vax + ~> %mean.%hoon-compile-fail + (slap !>(0) gen) + $(hoon.reef.cache.nub `vax) :: +build-fit: build file at path, maybe converting '-'s to '/'s in path :: ++ build-fit @@ -1478,6 +1514,7 @@ :* ((invalidate path vase) vases.ford-cache invalid) ((invalidate mark dais) marks.ford-cache invalid) ((invalidate mars tube) casts.ford-cache invalid) + (promote-reef reef.ford-cache invalid) == :: ++ invalidate @@ -1491,6 +1528,14 @@ $(builds t.builds) (~(put by $(builds t.builds)) i.builds) :: + ++ promote-reef + |= [reef=reef-cache invalid=(set path)] + ^- reef-cache + ?: (~(has in invalid) /sys/hoon/hoon) [~ ~ ~] + ?: (~(has in invalid) /sys/arvo/hoon) [hoon.reef ~ ~] + ?: (~(has in invalid) /sys/zuse/hoon) [hoon.reef arvo.reef ~] + reef + :: :: Updated q.yaki :: ++ checkout-changes From 2c02a91633d80753b98de20bd869fcff39904bfb Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 1 Jun 2020 21:42:32 +0200 Subject: [PATCH 171/280] tests: update eyre tests To account for recent cookie-related changes. --- pkg/arvo/tests/sys/vane/eyre.hoon | 67 +++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 21 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/eyre.hoon b/pkg/arvo/tests/sys/vane/eyre.hoon index 9d6d67a38..16b7f2cf4 100644 --- a/pkg/arvo/tests/sys/vane/eyre.hoon +++ b/pkg/arvo/tests/sys/vane/eyre.hoon @@ -643,7 +643,7 @@ [%ipv4 .192.168.1.1] %'GET' '/~landscape/inner-path' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ ~ == ^= comparator @@ -683,7 +683,7 @@ [%ipv4 .192.168.1.1] :* %'GET' '/~landscape/inner-path' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ ~ == == == @@ -1037,7 +1037,7 @@ [%ipv4 .192.168.1.1] %'GET' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ ~ == ^= expected-moves @@ -1055,6 +1055,7 @@ :~ ['content-type' 'text/event-stream'] ['cache-control' 'no-cache'] ['connection' 'keep-alive'] + ['set-cookie' cookie-string] == :: :- ~ @@ -1135,7 +1136,7 @@ [%ipv4 .192.168.1.1] %'PUT' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ :: :- ~ %- as-octs:mimes:html @@ -1164,7 +1165,7 @@ card.i.moves :: %+ expect-eq - !> [~[/http-put-request] %give %response %start [200 ~] ~ %.y] + !> put-200-response !> i.t.moves :: %+ expect-eq @@ -1235,7 +1236,7 @@ [%ipv4 .192.168.1.1] %'PUT' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ :: :- ~ %- as-octs:mimes:html @@ -1263,7 +1264,7 @@ card.i.moves :: %+ expect-eq - !> [~[/http-put-request] %give %response %start [200 ~] ~ %.y] + !> put-200-response !> i.t.moves :: %+ expect-eq @@ -1336,7 +1337,7 @@ [%ipv4 .192.168.1.1] %'PUT' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ :: :- ~ %- as-octs:mimes:html @@ -1365,7 +1366,7 @@ card.i.moves :: %+ expect-eq - !> [~[/http-put-request] %give %response %start [200 ~] ~ %.y] + !> put-200-response !> i.t.moves :: %+ expect-eq @@ -1426,7 +1427,7 @@ [%ipv4 .192.168.1.1] %'GET' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ ~ == ^= expected-moves @@ -1444,6 +1445,7 @@ :~ ['content-type' 'text/event-stream'] ['cache-control' 'no-cache'] ['connection' 'keep-alive'] + ['set-cookie' cookie-string] == :: :- ~ @@ -1486,7 +1488,7 @@ [%ipv4 .192.168.1.1] %'PUT' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ :: :- ~ %- as-octs:mimes:html @@ -1512,7 +1514,7 @@ card.i.moves :: %+ expect-eq - !> [~[/http-put-request] %give %response %start [200 ~] ~ %.y] + !> put-200-response !> i.t.moves == == :: gall responds on the second subscription. @@ -1624,7 +1626,7 @@ [%ipv4 .192.168.1.1] %'GET' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ ~ == ^= expected-moves @@ -1642,6 +1644,7 @@ :~ ['content-type' 'text/event-stream'] ['cache-control' 'no-cache'] ['connection' 'keep-alive'] + ['set-cookie' cookie-string] == :: :- ~ @@ -1709,7 +1712,7 @@ [%ipv4 .192.168.1.1] %'PUT' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ :: :- ~ %- as-octs:mimes:html @@ -1727,7 +1730,7 @@ [%leaf "wrong number of moves: {<(lent moves)>}"]~ :: %+ expect-eq - !> [~[/http-put-request] %give %response %start [200 ~] ~ %.y] + !> put-200-response !> i.moves == :: the client connection is detected to be broken @@ -1784,7 +1787,7 @@ [%ipv4 .192.168.1.1] %'GET' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ ~ == ^= expected-moves @@ -1802,6 +1805,7 @@ :~ ['content-type' 'text/event-stream'] ['cache-control' 'no-cache'] ['connection' 'keep-alive'] + ['set-cookie' cookie-string] == :: :- ~ @@ -2148,14 +2152,17 @@ == ^= expected-moves ^- (list move:http-server-gate) - :~ :* duct=~[/http-blah] + :~ ::NOTE this ~d7 is tied to the eyre-internal +session-timeout... + :- duct=~[/http-blah] + [%pass p=/sessions/expire q=[%b [%wait p=(add start-now ~d7.m1)]]] + :: + :* duct=~[/http-blah] %give %response %start :- 307 :~ ['location' '/~landscape'] - :- 'set-cookie' - 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea; Path=/; Max-Age=604800' + ['set-cookie' cookie-string] == ~ complete=%.y @@ -2202,7 +2209,7 @@ [%ipv4 .192.168.1.1] %'PUT' '/~/channel/0123456789abcdef' - ['cookie' 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea']~ + ['cookie' cookie-value]~ :: :- ~ %- as-octs:mimes:html @@ -2244,7 +2251,7 @@ card.i.t.moves :: %+ expect-eq - !> [~[/http-put-request] %give %response %start [200 ~] ~ %.y] + !> put-200-response !> i.t.t.moves :: %+ expect-eq @@ -2278,4 +2285,22 @@ ?~ data headers %+ weld headers ['content-length' (crip ((d-co:co 1) p.u.data))]~ +:: produce the 200 response to a put request +:: +++ put-200-response + :* ~[/http-put-request] + %give + %response + %start + [200 ['set-cookie' cookie-string]~] + ~ + %.y + == +:: +++ cookie-value + 'urbauth-~nul=0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea' +:: +++ cookie-string + %^ cat 3 cookie-value + '; Path=/; Max-Age=604800' -- From 62889d78d1c4473e5681192eaabaa3aed5e66bdd Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 1 Jun 2020 20:46:43 -0700 Subject: [PATCH 172/280] txt: don't conflict if identical changes --- pkg/arvo/mar/txt.hoon | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/mar/txt.hoon b/pkg/arvo/mar/txt.hoon index f87f58fe8..808a59aa1 100644 --- a/pkg/arvo/mar/txt.hoon +++ b/pkg/arvo/mar/txt.hoon @@ -55,7 +55,7 @@ |=(cud/(urge cord) [i.bob cud]) %+ bind $(ali t.ali, p.i.bob (sub p.i.bob p.i.ali)) |=(cud/(urge cord) [i.ali cud]) - :: + :: %| ?: =(p.i.ali (lent p.i.bob)) %+ bind $(ali t.ali, bob t.bob) @@ -68,7 +68,12 @@ :: %| ?- -.i.bob - %| ~ + %| + ?. =(i.ali i.bob) + ~ + %+ bind $(ali t.ali, bob t.bob) + |=(cud/(urge cord) [i.ali cud]) + :: %& ?: =(p.i.bob (lent p.i.ali)) %+ bind $(ali t.ali, bob t.bob) From 84b8a67e47cf644848f4745f2991d675f2839747 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 1 Jun 2020 20:52:20 -0700 Subject: [PATCH 173/280] clay: handle reefs for non-home desks We build a reef for each desk but use the compiler from our kernel. At some point we should use the compiler from the desk, but then we need to validate any results we get from it. --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/clay.hoon | 292 ++++++++++++++++++++++-------------- 2 files changed, 182 insertions(+), 114 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index f41ec49d6..57fc07d83 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a571650a0bec9d9368c7290a245cec1546fdd73bcf3982a73f6f6e6e6d5cee55 -size 15819552 +oid sha256:a48d18ab231b26e693158acf3c8f477e086cd771a220fda88855bd068879cd96 +size 15970043 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index abfd3860d..a8ee710df 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -89,6 +89,7 @@ lab/(map @tas aeon) :: labels mim/(map path mime) :: mime cache fod/ford-cache :: ford cache + fer/(unit reef-cache) :: reef cache == :: :: :: Commit state. @@ -114,14 +115,13 @@ $: vases=(map path [res=vase dez=(set path)]) marks=(map mark [res=dais dez=(set path)]) casts=(map mars [res=tube dez=(set path)]) - reef=reef-cache == :: $reef-cache: built system files :: +$ reef-cache - $: hoon=(unit vase) - arvo=(unit vase) - zuse=(unit vase) + $: hoon=vase + arvo=vase + zuse=vase == :: :: Hash of a blob, for lookup in the object store (lat.ran) @@ -454,7 +454,8 @@ cycle=(set build) == +$ args - $: =ankh + $: bud=vase + =ankh deletes=(set path) changes=(map path (each page lobe)) file-store=(map lobe blob) @@ -751,8 +752,7 @@ :: ++ run-pile |= =pile - =^ sut=vase nub run-reef - =^ sut=vase nub (run-tauts sut %sur sur.pile) + =^ sut=vase nub (run-tauts bud %sur sur.pile) =^ sut=vase nub (run-tauts sut %lib lib.pile) =^ sut=vase nub (run-raw sut raw.pile) =^ sut=vase nub (run-bar sut bar.pile) @@ -877,37 +877,6 @@ =. p.q.cage [%face face.i.bar p.q.cage] $(sut (slop q.cage sut), bar t.bar) :: - ++ run-reef - |- ^- [vase state] - ?^ zuse.reef.cache.nub - [u.zuse.reef.cache.nub state] - =^ zus nub (get-value /sys/zuse/hoon) - ?^ arvo.reef.cache.nub - =/ gen - ~> %mean.%zuse-parse-fail - (rain /sys/zuse/hoon `@t`q.q.zus) - =/ vax - ~> %mean.%zuse-compile-fail - (slap (slap u.arvo.reef.cache.nub (ream '..is')) gen) - $(zuse.reef.cache.nub `vax) - =^ rav nub (get-value /sys/arvo/hoon) - ?^ hoon.reef.cache.nub - =/ gen - ~> %mean.%arvo-parse-fail - (rain /sys/arvo/hoon `@t`q.q.rav) - =/ vax - ~> %mean.%arvo-compile-fail - (slap (slot 7 u.hoon.reef.cache.nub) gen) - $(arvo.reef.cache.nub `vax) - ~& %clay-should-never-build-hoon - =^ hun nub (get-value /sys/hoon/hoon) - =/ gen - ~> %mean.%hoon-parse-fail - (rain /sys/hoon/hoon `@t`q.q.hun) - =/ vax - ~> %mean.%hoon-compile-fail - (slap !>(0) gen) - $(hoon.reef.cache.nub `vax) :: +build-fit: build file at path, maybe converting '-'s to '/'s in path :: ++ build-fit @@ -1077,15 +1046,13 @@ =^ =cage fod.dom ?: ?=(%& -.dat) [p.dat fod.dom] - =/ =args:ford:fusion - [ank.dom ~ ~ lat.ran fod.dom] - =^ =page ford-cache.args + =^ =page fod.dom %- wrap:fusion - (lobe-to-page:(ford:fusion args) p.dat) - =^ =cage ford-cache.args + (lobe-to-page:(ford:fusion static-ford-args) p.dat) + =^ =cage fod.dom %- wrap:fusion - (page-to-cage:(ford:fusion args) page) - [cage ford-cache.args] + (page-to-cage:(ford:fusion static-ford-args) page) + [cage fod.dom] =/ gift [%writ ~ [care.mun case.mun syd] path.mun cage] ?: ?=(^ ref) (emit hen %slip %b %drip !>(gift)) @@ -1188,6 +1155,9 @@ ++ balk-all (duct-lift balk) ++ bleb-all (duct-lift bleb) :: + ++ static-ford-args + [zuse:(need fer.dom) ank.dom ~ ~ lat.ran fod.dom] + :: :: Transfer a request to another ship's clay. :: ++ send-over-ames @@ -1384,24 +1354,27 @@ :: promote and fill in ankh :: promote and fill in mime cache :: - =. fod.dom - (promote-ford fod.dom deletes ~(key by changes)) - :: =/ sys-changes (need-sys-update changes) - ?: &(!updated !=(~ sys-changes)) - =/ =args:ford:fusion - [ank.dom deletes changes lat.ran fod.dom] - (sys-update args yoki changes) + ?: ?& =(%home syd) + !updated + |(!=(~ sys-changes) !=(~ (need-vane-update changes))) + == + (sys-update yoki new-data changes) =. ..park (emil (print deletes ~(key by changes))) :: clear caches if zuse reloaded :: - =/ is-zuse-new=? &(updated (was-zuse-updated sys-changes)) - =? fod.dom is-zuse-new *ford-cache + =/ is-zuse-new=? !=(~ sys-changes) + =. fod.dom + ?: is-zuse-new + *ford-cache + (promote-ford fod.dom deletes ~(key by changes)) + =. fer.dom `(build-reef fer.dom ~(key by changes) new-data) =? ank.dom is-zuse-new *ankh =? changes is-zuse-new (changes-for-upgrade old-lobes deletes changes) + :: =/ =args:ford:fusion - [ank.dom deletes changes lat.ran fod.dom] + [zuse:(need fer.dom) ank.dom deletes changes lat.ran fod.dom] :: =^ change-cages ford-cache.args (checkout-changes args changes) @@ -1514,7 +1487,6 @@ :* ((invalidate path vase) vases.ford-cache invalid) ((invalidate mark dais) marks.ford-cache invalid) ((invalidate mars tube) casts.ford-cache invalid) - (promote-reef reef.ford-cache invalid) == :: ++ invalidate @@ -1528,13 +1500,125 @@ $(builds t.builds) (~(put by $(builds t.builds)) i.builds) :: - ++ promote-reef - |= [reef=reef-cache invalid=(set path)] + ++ build-reef + |= $: fer=(unit reef-cache) + invalid=(set path) + data=(map path (each page lobe)) + == ^- reef-cache - ?: (~(has in invalid) /sys/hoon/hoon) [~ ~ ~] - ?: (~(has in invalid) /sys/arvo/hoon) [hoon.reef ~ ~] - ?: (~(has in invalid) /sys/zuse/hoon) [hoon.reef arvo.reef ~] - reef + ?: =(%home syd) + [!>(..ride) !>(..is) !>(..zuse)] + |^ + ?: |(?=(~ fer) (~(has in invalid) /sys/hoon/hoon)) + =/ [home=? hoon=vase] + ?: (same-as-home /sys/hoon/hoon) + &+!>(..ride) + |+build-hoon + :- hoon + =/ [home=? arvo=vase] + ?: &(home (same-as-home /sys/arvo/hoon)) + &+!>(..is) + |+(build-arvo hoon) + :- arvo + ?: &(home (same-as-home /sys/zuse/hoon)) + !>(..zuse) + (build-zuse arvo) + :- hoon.u.fer + ?: (~(has in invalid) /sys/arvo/hoon) + =/ [home=? arvo=vase] + ?: &((same-as-home /sys/hoon/hoon) (same-as-home /sys/arvo/hoon)) + &+!>(..is) + |+(build-arvo hoon.u.fer) + :- arvo + ?: &(home (same-as-home /sys/zuse/hoon)) + !>(..zuse) + (build-zuse arvo) + :- arvo.u.fer + ?: (~(has in invalid) /sys/zuse/hoon) + ?: ?& (same-as-home /sys/hoon/hoon) + (same-as-home /sys/arvo/hoon) + (same-as-home /sys/zuse/hoon) + == + !>(..zuse) + (build-zuse arvo.u.fer) + zuse.u.fer + :: + ++ build-hoon + ~> %slog.0^leaf+"clay: building hoon on {}" + =/ gen + ~> %mean.%hoon-parse-fail + (path-to-hoon data /sys/hoon/hoon) + ~> %mean.%hoon-compile-fail + (slot 7 (slap !>(0) gen)) + :: + ++ build-arvo + |= hoon=vase + ~> %slog.0^leaf+"clay: building arvo on {}" + =/ gen + ~> %mean.%arvo-parse-fail + (path-to-hoon data /sys/arvo/hoon) + ~> %mean.%arvo-compile-fail + (slap (slap hoon gen) (ream '..is')) + :: + ++ build-zuse + |= arvo=vase + ~> %slog.0^leaf+"clay: building zuse on {}" + =/ gen + ~> %mean.%zuse-parse-fail + (path-to-hoon data /sys/zuse/hoon) + ~> %mean.%zuse-compile-fail + (slap arvo gen) + :: + ++ same-as-home + |= =path + ^- ? + =/ our=lobe + =/ datum (~(got by data) path) + ?- -.datum + %& (page-to-lobe %hoon (page-to-cord p.datum)) + %| p.datum + == + =/ =dome dom:(~(got by dos.rom) %home) + =/ =yaki (~(got by hut.ran) (~(got by hit.dome) let.dome)) + =(`our (~(get by q.yaki) path)) + -- + :: + ++ page-to-cord + |= =page + ^- @t + ?+ p.page ~|([%sys-bad-mark p.page] !!) + %hoon ;;(@t q.page) + %mime q.q:;;(mime q.page) + == + :: + ++ path-to-hoon + |= [data=(map path (each page lobe)) =path] + (rain path (path-to-cord data path)) + :: + ++ path-to-cord + |= [data=(map path (each page lobe)) =path] + ^- @t + =/ datum (~(got by data) path) + ?- -.datum + %& (page-to-cord p.datum) + %| (lobe-to-cord data p.datum) + == + :: + ++ lobe-to-cord + |= [data=(map path (each page lobe)) =lobe] + ^- @t + =- ?:(?=(%& -<) p.- (of-wain:format p.-)) + |- ^- (each @t wain) + =/ =blob (~(got by lat.ran) lobe) + ?- -.blob + %direct [%& ;;(@t q.q.blob)] + %delta + :- %| + %+ lurk:differ + =- ?:(?=(%| -<) p.- (to-wain:format p.-)) + $(lobe q.q.blob) + ;;((urge:clay cord) r.blob) + == :: :: Updated q.yaki :: @@ -1675,7 +1759,7 @@ (~(run by q.yaki) |=(=lobe |+lobe)) (~(uni by original) changes) =/ =args:ford:fusion - [*ankh ~ all-changes lat.ran *ford-cache] + [zuse:(need fer.dom) *ankh ~ all-changes lat.ran *ford-cache] =^ all-change-cages ford-cache.args (checkout-changes args all-changes) =/ ccs=(list [=path =lobe =cage]) ~(tap by change-cages) @@ -1748,39 +1832,36 @@ ~+ ?: =(0 let.dom) ~ - ?. =(%home syd) - ~ %- malt %+ skim ~(tap by changes) |= [=path *] ?| =(/sys/hoon/hoon path) =(/sys/arvo/hoon path) =(/sys/zuse/hoon path) - =(/sys/vane (scag 2 path)) == :: - :: Did the standard library reload? - :: - ++ was-zuse-updated + ++ need-vane-update |= changes=(map path (each page lobe)) - ^- ? + ^- (map path (each page lobe)) ~+ - ?| (~(has by changes) /sys/hoon/hoon) - (~(has by changes) /sys/arvo/hoon) - (~(has by changes) /sys/zuse/hoon) - == + ?: =(0 let.dom) + ~ + %- malt + %+ skim ~(tap by changes) + |= [=path *] + =(/sys/vane (scag 2 path)) :: :: Delay current update until sys update is complete :: ++ sys-update - |= [=ford=args:ford:fusion =yoki changes=(map path (each page lobe))] + |= $: =yoki + data=(map path (each page lobe)) + changes=(map path (each page lobe)) + == ^+ ..park - =/ updates (need-sys-update changes) - :: Don't save ford cache so it gets properly handled when we - :: restart the commit - :: - =^ updates-cages=(map path [lobe cage]) ford-cache.ford-args - (checkout-changes ford-args updates) + =/ updates + %- ~(uni by (need-sys-update changes)) + (need-vane-update changes) ?> =(~ pud) =. pud `[syd yoki] |^ %. [hen %slip %c %pork ~] @@ -1805,33 +1886,24 @@ |= new-hoon=? ^+ ..park ?. new-hoon - =^ arvo=@t ford-cache.ford-args (load-sys %arvo) + =/ arvo=@t (path-to-cord data /sys/arvo/hoon) =. ..park (pass-lyra hoon=~ arvo) reboot - =^ hoon=@t ford-cache.ford-args (load-sys %hoon) - =^ arvo=@t ford-cache.ford-args (load-sys %arvo) + =/ hoon=@t (path-to-cord data /sys/hoon/hoon) + =/ arvo=@t (path-to-cord data /sys/arvo/hoon) =. ..park (pass-lyra `hoon arvo) reboot :: - ++ load-sys - |= fil=@tas - ^- [@t ford-cache] - =- [!<(@t q.-<) ->] - %- wrap:fusion - (get-value:(ford:fusion ford-args) /sys/[fil]/hoon) - :: ++ pass-lyra |= [hoon=(unit @t) arvo=@t] ^+ ..park (emit hen %pass /reset %d %flog %lyra hoon arvo) :: ++ reboot - =^ zuse=cage ford-cache.ford-args - %- wrap:fusion - (get-value:(ford:fusion ford-args) /sys/zuse/hoon) + =/ zuse=@t (path-to-cord data /sys/zuse/hoon) =. ..park %- emit - [hen %pass /reboot %d %flog %veer %$ /sys/zuse/hoon !<(@t q.zuse)] + [hen %pass /reboot %d %flog %veer %$ /sys/zuse/hoon zuse] reload-all :: ++ reload-all @@ -1845,13 +1917,11 @@ :: ++ reload |= =term - =^ vane=cage ford-cache.ford-args - %- wrap:fusion - (get-value:(ford:fusion ford-args) /sys/vane/[term]/hoon) + =/ vane=@t (path-to-cord data /sys/vane/[term]/hoon) %- emit =/ tip (end 3 1 term) =/ =path /sys/vane/[term]/hoon - [hen %pass /reload %d %flog %veer tip path !<(@t q.vane)] + [hen %pass /reload %d %flog %veer tip path vane] -- -- :: @@ -2165,10 +2235,10 @@ ^- cage =^ =page fod.dom %- wrap:fusion - (lobe-to-page:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) lobe) + (lobe-to-page:(ford:fusion static-ford-args) lobe) =^ =cage fod.dom %- wrap:fusion - (page-to-cage:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) page) + (page-to-cage:(ford:fusion static-ford-args) page) cage :: ++ get-dais @@ -2176,7 +2246,7 @@ ^- dais =^ =dais fod.dom %- wrap:fusion - (get-mark:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) mark) + (get-mark:(ford:fusion static-ford-args) mark) dais :: :: Diff two files on bob-desk @@ -2389,7 +2459,7 @@ =/ =yaki (~(got by hut.ran) (~(got by hit.dom) let.dom)) =/ changes (~(run by q.yaki) |=(=lobe |+lobe)) =/ =args:ford:fusion - [ank.dom ~ changes lat.ran fod.dom] + [zuse:(need fer.dom) ank.dom ~ changes lat.ran fod.dom] =^ mim ford-cache.args (checkout-mime args ~ ~(key by changes)) =. mim.dom (apply-changes-to-mim mim.dom mim) @@ -2570,12 +2640,10 @@ ++ validate-x |= [car=care cas=case pax=path peg=page] ^- (unit cage) - =/ =args:ford:fusion - [ank.dom ~ ~ lat.ran fod.dom] =/ vale-result %- mule |. %- wrap:fusion - (page-to-cage:(ford:fusion args) peg) + (page-to-cage:(ford:fusion static-ford-args) peg) ?: ?=(%| -.vale-result) %- (slog >%validate-x-failed< p.vale-result) ~ @@ -3198,7 +3266,7 @@ [~ fod.dom] =^ =vase fod.dom %- wrap:fusion - (build-file:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) path) + (build-file:(ford:fusion static-ford-args) path) :_(fod.dom [~ ~ %& %vase !>(vase)]) :: ++ read-b @@ -3213,7 +3281,7 @@ :_(fod.dom [~ ~ %& %dais !>(dais.u.cached)]) =^ =dais fod.dom %- wrap:fusion - (get-mark:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) i.path) + (get-mark:(ford:fusion static-ford-args) i.path) :_(fod.dom [~ ~ %& %dais !>(dais)]) :: ++ read-c @@ -3228,7 +3296,7 @@ :_(fod.dom [~ ~ %& %tube !>(tube.u.cached)]) =^ =tube fod.dom %- wrap:fusion - (get-cast:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) [i i.t]:path) + (get-cast:(ford:fusion static-ford-args) [i i.t]:path) :_(fod.dom [~ ~ %& %tube !>(tube)]) :: :: Gets the permissions that apply to a particular node. @@ -3364,14 +3432,14 @@ =/ =lobe (slav %uv i.t.pax) =^ =page fod.dom %- wrap:fusion - (lobe-to-page:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) lobe) + (lobe-to-page:(ford:fusion static-ford-args) lobe) =^ =cage fod.dom %- wrap:fusion - (page-to-cage:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) page) + (page-to-cage:(ford:fusion static-ford-args) page) ``cage+[-:!>(*^cage) cage] :: %open - ``open+!>(prelude:(ford:fusion ank.dom ~ ~ lat.ran fod.dom)) + ``open+!>(prelude:(ford:fusion static-ford-args)) :: %late :^ ~ ~ %cass From aa033708bf84c8067e7604520a456daeada7b880 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 2 Jun 2020 14:36:56 +1000 Subject: [PATCH 174/280] links: cleanup debugging artifacts --- pkg/arvo/app/link-listen-hook.hoon | 6 ++---- pkg/arvo/lib/link-store.hoon | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/link-listen-hook.hoon b/pkg/arvo/app/link-listen-hook.hoon index 15af6d3df..f6d3b5d74 100644 --- a/pkg/arvo/app/link-listen-hook.hoon +++ b/pkg/arvo/app/link-listen-hook.hoon @@ -596,11 +596,9 @@ %+ turn notes.update |= =^note ^- card - ~! who - ~! note %+ do-link-action - `wire`[%forward %annotation (scot %p who) where] - `action:store`[%read where url.update `comment`[who note]] + [%forward %annotation (scot %p who) where] + [%read where url.update `comment`[who note]] == :: ++ take-forward-sign diff --git a/pkg/arvo/lib/link-store.hoon b/pkg/arvo/lib/link-store.hoon index 85098aad5..494fa8c8f 100644 --- a/pkg/arvo/lib/link-store.hoon +++ b/pkg/arvo/lib/link-store.hoon @@ -97,6 +97,7 @@ :: ++ enjs =, enjs:format + ^? |% ++ update |= upd=^update @@ -171,6 +172,7 @@ :: ++ dejs =, dejs:format + ^? |% :: +action: json into action :: From 818d2231f6755caa7a61c2d724aff164a8be10e5 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 2 Jun 2020 14:13:28 -0700 Subject: [PATCH 175/280] ames: remove jumbo packets --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/ames.hoon | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 57fc07d83..498d5b7fe 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a48d18ab231b26e693158acf3c8f477e086cd771a220fda88855bd068879cd96 -size 15970043 +oid sha256:92e90bddd70810fe78676f27d239b5a19791303853b6f8b68b13d4aac8b8d07f +size 15970161 diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index ee5038d33..1684062b6 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3274,7 +3274,7 @@ |= [=message-num =message-blob] ^- (list static-fragment) :: - =/ fragments=(list fragment) (rip 23 message-blob) + =/ fragments=(list fragment) (rip 13 message-blob) =/ num-fragments=fragment-num (lent fragments) =| counter=@ :: @@ -3299,7 +3299,7 @@ $(index +(index), sorted [(~(got by fragments) index) sorted]) :: %- cue - %+ can 23 + %+ can 13 %+ turn (flop sorted) |=(a=@ [1 a]) :: +bind-duct: find or make new $bone for .duct in .ossuary From 4d93349402c9dece7a9468cd82977ff96ddd7584 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 3 Jun 2020 01:40:32 +0200 Subject: [PATCH 176/280] eyre: provide logout endpoint Set up, by default, on /~/logout. Sending a POST request to this expires the current session and redirects to the login page. If the "all" key is set in the request body, expires all open sessions. --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/eyre.hoon | 105 +++++++++++++++++++++++++----------- pkg/arvo/sys/zuse.hoon | 3 ++ 3 files changed, 79 insertions(+), 33 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 551d747d1..f10d60221 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:960df352aa78135a409e87d0946bf2665605bf3918c19e3e290ad40edb740769 -size 17295261 +oid sha256:dfaee098f2dca396c17aa1ddf1d2755f5f7d8639864b0e970fce0290d67008cc +size 20306202 diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 8f9e16951..f92c126e1 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -834,6 +834,9 @@ :: %authentication (handle-request:authentication secure address request) + :: + %logout + (handle-logout:authentication authenticated request) :: %channel (handle-request:by-channel secure authenticated address request) @@ -884,7 +887,7 @@ %leave ~ == :: - %authentication + ?(%authentication %logout) [~ state] :: %channel @@ -919,7 +922,7 @@ :: ++ authentication |% - :: +handle-request: handles an http request for the + :: +handle-request: handles an http request for the login page :: ++ handle-request |= [secure=? =address =request:http] @@ -969,7 +972,7 @@ (~(put by sessions.authentication-state.state) session expires-at) :: =/ cookie-line=@t - (session-cookie-string session) + (session-cookie-string session &) :: =; out=[moves=(list move) server-state] :: if we didn't have any cookies previously, start the expiry timer @@ -1000,6 +1003,38 @@ data=~ complete=%.y == + :: +handle-logout: handles an http request for logging out + :: + ++ handle-logout + |= [authenticated=? =request:http] + ^- [(list move) server-state] + :: whatever we end up doing, we always redirect to the login page + :: + =/ response=$>(%start http-event:http) + :* %start + response-header=[307 ['location' '/~/login']~] + data=~ + complete=%.y + == + :: + =/ session-id=(unit @uv) + (session-id-from-request request) + =? headers.response-header.response ?=(^ session-id) + :_ headers.response-header.response + ['set-cookie' (session-cookie-string u.session-id |)] + ?. &(authenticated ?=(^ session-id)) + (handle-response response) + :: delete the requesting session, or all sessions if so specified + :: + =. sessions.authentication-state.state + =; all=? + ?: all ~ + (~(del by sessions.authentication-state.state) u.session-id) + ?~ body.request | + =- ?=(^ -) + %+ get-header:http 'all' + (fall (rush q.u.body.request yquy:de-purl:html) ~) + (handle-response response) :: +session-id-from-request: attempt to find a session cookie :: ++ session-id-from-request @@ -1051,15 +1086,16 @@ =+ res=((sloy scry) [151 %noun] %j pax) :: (rsh 3 1 (scot %p (@ (need (need res))))) - :: +session-cookie-string: compose newly-timestamped session cookie + :: +session-cookie-string: compose session cookie :: ++ session-cookie-string - |= session=@uv + |= [session=@uv extend=?] ^- @t %- crip =; max-age=tape "urbauth-{}={}; Path=/; Max-Age={max-age}" %- format-ud-as-integer + ?. extend 0 (div (msec:milly session-timeout) 1.000) -- :: +channel: per-event handling of requests to the channel system @@ -1791,7 +1827,7 @@ :_ (~(put by sessions) u.session-id (add now session-timeout)) =- response-header.http-event(headers -) %^ set-header:http 'set-cookie' - (session-cookie-string u.session-id) + (session-cookie-string u.session-id &) headers.response-header.http-event :: =. response-header.http-event response-header @@ -1869,31 +1905,11 @@ :: ++ add-binding |= [=binding =action] - :: - =/ to-search bindings.state - |- ^- [(list move) server-state] - ?~ to-search - :- [duct %give %bound %.y binding]~ - =. bindings.state - :: store in reverse alphabetical order so that longer paths are first - :: - %- flop - %+ sort [[binding duct action] bindings.state] - |= [[a=^binding *] [b=^binding *]] - :: - ?: =(site.a site.b) - (aor path.a path.b) - :: alphabetize based on site - :: - (aor ?~(site.a '' u.site.a) ?~(site.b '' u.site.b)) - state - :: - ?: =(binding binding.i.to-search) - :- [duct %give %bound %.n binding]~ - state - :: - $(to-search t.to-search) + =^ success bindings.state + (insert-binding [binding duct action] bindings.state) + :_ state + [duct %give %bound success binding]~ :: +remove-binding: removes a binding if it exists and is owned by this duct :: ++ remove-binding @@ -1997,6 +2013,28 @@ |= url=@t ^- [[ext=(unit @ta) site=(list @t)] args=(list [key=@t value=@t])] (fall (rush url ;~(plug apat:de-purl:html yque:de-purl:html)) [[~ ~] ~]) +:: +++ insert-binding + |= [[=binding =duct =action] bindings=(list [=binding =duct =action])] + =/ to-search bindings + |- ^- [? _bindings] + ?^ to-search + ?: =(binding binding.i.to-search) + [| bindings] + :: + $(to-search t.to-search) + :- & + :: store in reverse alphabetical order so that longer paths are first + :: + %- flop + %+ sort [[binding duct action] bindings] + |= [[a=^binding *] [b=^binding *]] + :: + ?: =(site.a site.b) + (aor path.a path.b) + :: alphabetize based on site + :: + (aor ?~(site.a '' u.site.a) ?~(site.b '' u.site.b)) -- :: end the =~ :: @@ -2037,6 +2075,7 @@ :: =. bindings.server-state.ax :~ [[~ /~/login] duct [%authentication ~]] + [[~ /~/logout] duct [%logout ~]] [[~ /~/channel] duct [%channel ~]] == [~ http-server-gate] @@ -2404,12 +2443,16 @@ %~2020.5.29 ..^$(ax old) :: %~2019.10.6 + =^ success bindings.server-state.old + %+ insert-binding + [[~ /~/logout] ~ [%logout ~]] + bindings.server-state.old + ~? !success [%e %failed-to-setup-logout-endpoint] %_ $ date.old %~2020.5.29 sessions.authentication-state.server-state.old ~ == == - :: +stay: produce current state :: ++ stay `axle`ax diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 29977037e..6c4a2c11b 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1314,6 +1314,9 @@ :: internal authentication page :: [%authentication ~] + :: internal logout page + :: + [%logout ~] :: gall channel system :: [%channel ~] From 2f83797a0735188c7f58d64b44da88ce5d2427e4 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 3 Jun 2020 01:40:57 +0200 Subject: [PATCH 177/280] dbug fe: add eyre logout buttons --- pkg/interface/dbug/src/js/views/eyre.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/interface/dbug/src/js/views/eyre.js b/pkg/interface/dbug/src/js/views/eyre.js index 362d3870b..88e4bde91 100644 --- a/pkg/interface/dbug/src/js/views/eyre.js +++ b/pkg/interface/dbug/src/js/views/eyre.js @@ -168,6 +168,12 @@ export class Eyre extends Component {

Cookies

+
+ +
+
+ +
{sessionItems} ); } From 8d330626f0e69ebe65e0db8c3b90eff40b232b53 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 3 Jun 2020 01:48:57 -0400 Subject: [PATCH 178/280] /app: fix merge bugs --- pkg/arvo/app/chat-view.hoon | 33 +++++++-------------------------- pkg/arvo/app/contact-view.hoon | 6 ++---- pkg/arvo/app/link-view.hoon | 2 +- 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/pkg/arvo/app/chat-view.hoon b/pkg/arvo/app/chat-view.hoon index 0f47b129d..47bdfae09 100644 --- a/pkg/arvo/app/chat-view.hoon +++ b/pkg/arvo/app/chat-view.hoon @@ -9,12 +9,12 @@ /- *permission-group-hook /- *chat-hook /- *metadata-hook -/- *rw-security, +/- *rw-security /- hook=chat-hook :: /+ *server, default-agent, verb, dbug - store=chat-store - view=chat-view +/+ store=chat-store +/+ view=chat-view :: /* index-html %html /app/chat/index/html /* index-js %js /app/chat/js/index/js @@ -124,20 +124,11 @@ ++ message-limit 20 :: ++ truncated-inbox-scry -<<<<<<< HEAD - ^- inbox - =/ =inbox - =/ our (scot %p our.bol) - =/ now (scot %da now.bol) - .^(inbox %gx /[our]/chat-store/[now]/all/noun) -||||||| merged common ancestors - ^- inbox - =/ =inbox .^(inbox %gx /=chat-store/(scot %da now.bol)/all/noun) -======= ^- inbox:store =/ =inbox:store - .^(inbox:store %gx /=chat-store/(scot %da now.bol)/all/noun) ->>>>>>> origin/master + =/ our (scot %p our.bol) + =/ now (scot %da now.bol) + .^(inbox:store %gx /[our]/chat-store/[now]/all/noun) %- ~(run by inbox) |= =mailbox:store ^- mailbox:store @@ -444,24 +435,14 @@ :: ++ chat-scry |= pax=path -<<<<<<< HEAD - ^- (unit mailbox) + ^- (unit mailbox:store) =. pax ;: weld /(scot %p our.bol)/chat-store/(scot %da now.bol)/mailbox pax /noun == - .^((unit mailbox) %gx pax) -||||||| merged common ancestors - ^- (unit mailbox) - =. pax ;:(weld /=chat-store/(scot %da now.bol)/mailbox pax /noun) - .^((unit mailbox) %gx pax) -======= - ^- (unit mailbox:store) - =. pax ;:(weld /=chat-store/(scot %da now.bol)/mailbox pax /noun) .^((unit mailbox:store) %gx pax) ->>>>>>> origin/master :: ++ maybe-group-from-chat |= app-path=path diff --git a/pkg/arvo/app/contact-view.hoon b/pkg/arvo/app/contact-view.hoon index e1b03554b..594bdeccb 100644 --- a/pkg/arvo/app/contact-view.hoon +++ b/pkg/arvo/app/contact-view.hoon @@ -16,7 +16,6 @@ /* index-js %js /app/contacts/js/index/js /* tile-js %js /app/contacts/js/tile/js /* index-css %css /app/contacts/css/index/css -/* home-png %png /app/contacts/img/home/png /* tile-png %png /app/contacts/img/tile/png /* search-png %png /app/contacts/img/search/png /* spinner-png %png /app/contacts/img/spinner/png @@ -30,10 +29,9 @@ =/ contact-png=(map @t octs) =- (~(run by -) as-octs:mimes:html) %- ~(gas by *(map @t @)) - :~ [%'Home' home-png] - [%'Tile' tile-png] + :~ [%'Tile' tile-png] search+search-png - [%'Spinner' +spinner-png] + [%'Spinner' spinner-png] == |% +$ card card:agent:gall diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index ea506ecb7..05073d7e6 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -12,7 +12,7 @@ :: /- *link-view /- *invite-store, group-store -/- link-listen-hook, +/- link-listen-hook /- group-hook, permission-hook, permission-group-hook /- metadata-hook, contact-view /+ *link, metadata, *server, default-agent, verb, dbug From 3834860410ce75eddb98f9a9c2c52b51c54e7bab Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 3 Jun 2020 03:00:45 -0400 Subject: [PATCH 179/280] clay: state adapter, still needs :goad --- pkg/arvo/sys/vane/clay.hoon | 119 +++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 00c22e44f..0619dddf1 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3695,7 +3695,7 @@ :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: =| :: instrument state - $: ver=%2 :: vane version + $: ver=%3 :: vane version ruf=raft :: revision tree == :: |= [our=ship now=@da eny=@uvJ ski=sley] :: current invocation @@ -3917,8 +3917,121 @@ :: ++ load !: - |= [%2 =raft] - ..^$(ruf raft) + |^ + |= old=any-state + ~! [old=old new=*state-3] + =? old ?=(%2 -.old) (load-2-to-3 old) + ?> ?=(%3 -.old) + ..^^$(ruf +.old) + :: + ++ load-2-to-3 + |= =state-2 + ^- state-3 + =- state-2(- %3, rom rom.-, hoy hoy.-, |7 pud.-) + :+ ^- pud=(unit [=desk =yoki]) + ~? ?=(^ act.state-2) clay-canceling-write+hen.u.act.state-2 + ~ + ^- rom=room + :- hun.rom.state-2 + %- ~(run by dos.rom.state-2) + |= =dojo-2 + ^- dojo + =- dojo-2(dom -) + ^- dome + [ank let hit lab mim fod=*ford-cache fer=~]:[dom.dojo-2 .] + ^- hoy=(map ship rung) + %- ~(run by hoy.state-2) + |= =rung-2 + ^- rung + %- ~(run by rus.rung-2) + |= =rede-2 + ^- rede + =- rede-2(ref ref.-, dom dom.-) + :- ^- dom=dome + [ank let hit lab mim fod=*ford-cache fer=~]:[dom.rede-2 .] + ^- ref=(unit rind) + ?~ ref.rede-2 + ~ + :: TODO: somehow call +wake later to notify subscribers + :- ~ + ^- rind + =/ rin=rind [nix bom fod haw]:u.ref.rede-2 + =. rin + =/ pur=(list [inx=@ud =rand *]) ~(tap by pur.u.ref.rede-2) + |- ^+ rin + ?~ pur rin + =/ =mood [p.p q.p q]:rand.i.pur + =: haw.rin (~(put by haw.rin) mood ~) + bom.rin (~(del by bom.rin) inx.i.pur) + fod.rin ?~ got=(~(get by bom.rin) inx.i.pur) + fod.rin + (~(del by fod.rin) p.u.got) + == + $(pur t.pur) + =/ pud ~(tap to waiting.pud.u.ref.rede-2) + |- ^+ rin + ?~ pud rin + =: bom.rin (~(del by bom.rin) inx.i.pud) + fod.rin ?~ got=(~(get by bom.rin) inx.i.pud) + fod.rin + (~(del by fod.rin) p.u.got) + == + $(pud t.pud) + :: + +$ any-state $%(state-3 state-2) + +$ state-3 [%3 raft] + +$ state-2 + $: %2 + rom=room-2 :: domestic + hoy=(map ship rung-2) :: foreign + ran=rang :: hashes + mon=(map term beam) :: mount points + hez=(unit duct) :: sync duct + cez=(map @ta crew) :: permission groups + cue=(qeu [=duct task=*]) :: queued requests + act=active-write-2 :: active write + == :: + +$ room-2 + $: hun/duct :: terminal duct + dos/(map desk dojo-2) :: native desk + == :: + +$ dojo-2 + $: qyx/cult :: subscribers + dom/dome-2 :: desk state + per/regs :: read perms per path + pew/regs :: write perms per path + == + +$ dome-2 + $: ank/ankh :: state + let/aeon :: top id + hit/(map aeon tako) :: versions by id + lab/(map @tas aeon) :: labels + mim/(map path mime) :: mime cache + == :: + +$ rung-2 rus=(map desk rede-2) + +$ rede-2 + $: lim/@da :: complete to + ref/(unit rind-2) :: outgoing requests + qyx/cult :: subscribers + dom/dome-2 :: revision state + per/regs :: read perms per path + pew/regs :: write perms per path + == :: + +$ rind-2 + $: nix/@ud :: request index + bom/(map @ud {p/duct q/rave}) :: outstanding + fod/(map duct @ud) :: current requests + haw/(map mood (unit cage)) :: simple cache + pud/update-qeu-2 :: active updates + pur/request-map-2 :: active requests + == :: + +$ request-map-2 (map inx=@ud [=rand eval-form=*]) + +$ update-qeu-2 + $: waiting=(qeu [inx=@ud rut=(unit rand)]) + eval-data=(unit [inx=@ud rut=(unit rand) eval-form=*]) + == + +$ active-write-2 (unit [hen=duct *]) + -- :: ++ scry :: inspect |= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path} From fdd14f93f14a2ad84a42f6ce9b1a3725227e051d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 3 Jun 2020 03:25:49 -0400 Subject: [PATCH 180/280] pill: update solid pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 418b07439..e56c08a75 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:19cd17b12f29d397465a308361c0eddc32ec8fafaf354ea7a4bb396774c3c650 -size 13014936 +oid sha256:d9d035c533db7283b5d5cf7722040de9fe0d4babbfff41e10dddfe2a616c789d +size 13016064 From 062b8ecf5cc35f736f7b68c852d100f8644c04b0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 3 Jun 2020 03:33:16 -0400 Subject: [PATCH 181/280] Revert "pill: update solid pill" This reverts commit fdd14f93f14a2ad84a42f6ce9b1a3725227e051d. --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e56c08a75..418b07439 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d9d035c533db7283b5d5cf7722040de9fe0d4babbfff41e10dddfe2a616c789d -size 13016064 +oid sha256:19cd17b12f29d397465a308361c0eddc32ec8fafaf354ea7a4bb396774c3c650 +size 13014936 From c0d17b94ed00fbe365b912086ebd5fac5b97466a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 3 Jun 2020 03:38:27 -0400 Subject: [PATCH 182/280] Revert "Revert "pill: update solid pill"" This reverts commit 062b8ecf5cc35f736f7b68c852d100f8644c04b0. --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 418b07439..e56c08a75 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:19cd17b12f29d397465a308361c0eddc32ec8fafaf354ea7a4bb396774c3c650 -size 13014936 +oid sha256:d9d035c533db7283b5d5cf7722040de9fe0d4babbfff41e10dddfe2a616c789d +size 13016064 From 6e3284feacdde71c2a7d2f004ec099342496d4df Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 3 Jun 2020 14:28:30 +0200 Subject: [PATCH 183/280] eyre: use 303 to redirect to login post-logout This ensures the client sends a GET request, which is more appropriate. --- pkg/arvo/sys/vane/eyre.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index f92c126e1..350c2d00e 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1012,7 +1012,7 @@ :: =/ response=$>(%start http-event:http) :* %start - response-header=[307 ['location' '/~/login']~] + response-header=[303 ['location' '/~/login']~] data=~ complete=%.y == From a66cfc31da23c0c2b49019f91079a16f3eee7293 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 3 Jun 2020 14:29:13 +0200 Subject: [PATCH 184/280] eyre: fake duct for on-load logout binding Empty duct is considered not good. --- pkg/arvo/sys/vane/eyre.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 350c2d00e..43c3d7596 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -2445,7 +2445,7 @@ %~2019.10.6 =^ success bindings.server-state.old %+ insert-binding - [[~ /~/logout] ~ [%logout ~]] + [[~ /~/logout] [/e/load/logout]~ [%logout ~]] bindings.server-state.old ~? !success [%e %failed-to-setup-logout-endpoint] %_ $ From 4d97aaf55367e6a80fef33295f9685bd0a19204b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 3 Jun 2020 16:52:04 -0400 Subject: [PATCH 185/280] :publish: fix merge syntax errors --- pkg/arvo/app/publish.hoon | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index 4b5c56920..35cd2a5dd 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -1,12 +1,12 @@ -/- *publish, -/- *group-store, -/- *group-hook, -/- *permission-hook, -/- *permission-group-hook, -/- *permission-store, -/- *invite-store, -/- *metadata-store, -/- *metadata-hook, +/- *publish +/- *group-store +/- *group-hook +/- *permission-hook +/- *permission-group-hook +/- *permission-store +/- *invite-store +/- *metadata-store +/- *metadata-hook /- *rw-security /+ *server, *publish, cram, default-agent, dbug :: From 68491420d2a350e948e3a17ed3b8529665bba790 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 4 Jun 2020 17:12:35 +0200 Subject: [PATCH 186/280] eyre: refactor %delete to reuse timeout logic Turns +on-channel-timeout into +discard-channel, which cleans up the entirety of the channel, based on its current state. This allows us to simplify the %delete channel request into a simple function call. --- pkg/arvo/sys/vane/eyre.hoon | 78 +++++++++++-------------------------- 1 file changed, 22 insertions(+), 56 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 43c3d7596..62e402cc1 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -1486,50 +1486,10 @@ $(requests t.requests) :: %delete - =/ unitsession - (~(get by session.channel-state.state) channel-id) - :: - ?~ unitsession - $(requests t.requests) - :: - =/ session u.unitsession - =. session.channel-state.state - (~(del by session.channel-state.state) channel-id) - :: + =^ moves state + (discard-channel channel-id |) =. gall-moves - %+ weld gall-moves - :: - :: produce a list of moves which cancels every gall subscription - :: - %+ turn ~(tap by subscriptions.session) - |= [channel-wire=wire ship=@p app=term =path duc=^duct] - ^- move - :: - [duc %pass channel-wire [%g %deal [our ship] app %leave ~]] - :: - ?: ?=([%& *] state.session) - =. gall-moves - :_ gall-moves - :: - ^- move - ?> ?=([%& *] state.session) - :^ duct.p.state.session %pass /channel/timeout/[channel-id] - [%b %rest date.p.state.session] - :: - $(requests t.requests) - :: - ?> ?=([%| *] state.session) - =. duct-to-key.channel-state.state - (~(del by duct-to-key.channel-state.state) p.state.session) - :: - ?~ heartbeat.session $(requests t.requests) - =. gall-moves - %+ snoc gall-moves - %^ cancel-heartbeat-move - channel-id - date.u.heartbeat.session - duct.u.heartbeat.session - :: + (weld gall-moves moves) $(requests t.requests) :: == @@ -1671,10 +1631,12 @@ channel(heartbeat (some [heartbeat-time duct])) == (snoc http-moves (set-heartbeat-move channel-id heartbeat-time)) - :: +on-channel-timeout: we received a wake to clear an old session + :: +discard-channel: remove a channel from state :: - ++ on-channel-timeout - |= channel-id=@t + :: cleans up state, timers, and gall subscriptions of the channel + :: + ++ discard-channel + |= [channel-id=@t expired=?] ^- [(list move) server-state] :: =/ usession=(unit channel) @@ -1686,6 +1648,10 @@ :_ %_ state session.channel-state (~(del by session.channel-state.state) channel-id) + :: + duct-to-key.channel-state + ?. ?=(%| -.state.session) duct-to-key.channel-state.state + (~(del by duct-to-key.channel-state.state) p.state.session) == =/ heartbeat-cancel=(list move) ?~ heartbeat.session ~ @@ -1694,7 +1660,13 @@ date.u.heartbeat.session duct.u.heartbeat.session == + =/ expire-cancel=(list move) + ?: expired ~ + ?. ?=(%& -.state.session) ~ + =, p.state.session + [(cancel-timeout-move channel-id date duct)]~ %+ weld heartbeat-cancel + %+ weld expire-cancel :: produce a list of moves which cancels every gall subscription :: %+ turn ~(tap by subscriptions.session) @@ -2108,13 +2080,7 @@ [(zing (flop moves)) http-server-gate] :: discard channel state, and cancel any active gall subscriptions :: - =^ mov server-state.ax (on-channel-timeout:by-channel channel-id) - :: cancel channel timer - :: - =/ channel (~(got by session.channel-state) channel-id) - =? mov ?=([%& *] state.channel) - :_ mov - (cancel-timeout-move:by-channel channel-id p.state.channel) + =^ mov server-state.ax (discard-channel:by-channel channel-id |) $(moves [mov moves], inactive t.inactive) :: :: %vega: notifies us of a completed kernel upgrade @@ -2362,10 +2328,10 @@ ?> ?=([%b %wake *] sign) ?^ error.sign [[duct %slip %d %flog %crud %wake u.error.sign]~ http-server-gate] - =/ on-channel-timeout - on-channel-timeout:by-channel:(per-server-event event-args) + =/ discard-channel + discard-channel:by-channel:(per-server-event event-args) =^ moves server-state.ax - (on-channel-timeout i.t.t.wire) + (discard-channel i.t.t.wire &) [moves http-server-gate] :: %heartbeat From b54dc7cd345bf430d44dbdc9dd316698de67f8e1 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 4 Jun 2020 22:06:13 +0200 Subject: [PATCH 187/280] eyre, zuse: expire channels with their sessions Associates channels with the authentication sessions that opened them, and deletes the channel when its associated session expires. Also updates the debug dashboard to display channel counts per session. --- bin/solid.pill | 4 +- pkg/arvo/app/dbug.hoon | 5 +- pkg/arvo/sys/vane/eyre.hoon | 71 +++++++++++++++++++------ pkg/arvo/sys/zuse.hoon | 3 ++ pkg/interface/dbug/src/js/views/eyre.js | 2 +- 5 files changed, 64 insertions(+), 21 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index f10d60221..e6a2605f7 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dfaee098f2dca396c17aa1ddf1d2755f5f7d8639864b0e970fce0290d67008cc -size 20306202 +oid sha256:9f7988e3ffc99ecd8cb66daf469bff3b9cb41ca82895a91cae7d4f7d59bb48a7 +size 20308420 diff --git a/pkg/arvo/app/dbug.hoon b/pkg/arvo/app/dbug.hoon index 90124315b..a45e8d6a2 100644 --- a/pkg/arvo/app/dbug.hoon +++ b/pkg/arvo/app/dbug.hoon @@ -360,12 +360,13 @@ :- %a %+ turn %+ sort ~(tap by sessions:auth-state:v-eyre) - |= [[@uv a=@da] [@uv b=@da]] - (gth a b) + |= [[@uv a=session:eyre] [@uv b=session:eyre]] + (gth expiry-time.a expiry-time.b) |= [cookie=@uv session:eyre] %- pairs :~ 'cookie'^s+(end 3 4 (rsh 3 2 (scot %x (shax cookie)))) 'expiry'^(time expiry-time) + 'channels'^(numb ~(wyt in channels)) == :: :: /eyre/channels.json diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 62e402cc1..64281742c 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -969,7 +969,7 @@ =/ first-session=? =(~ sessions.authentication-state.state) =/ expires-at=@da (add now session-timeout) =. sessions.authentication-state.state - (~(put by sessions.authentication-state.state) session expires-at) + (~(put by sessions.authentication-state.state) session [expires-at ~]) :: =/ cookie-line=@t (session-cookie-string session &) @@ -1026,15 +1026,33 @@ (handle-response response) :: delete the requesting session, or all sessions if so specified :: - =. sessions.authentication-state.state - =; all=? - ?: all ~ - (~(del by sessions.authentication-state.state) u.session-id) - ?~ body.request | - =- ?=(^ -) - %+ get-header:http 'all' - (fall (rush q.u.body.request yquy:de-purl:html) ~) - (handle-response response) + =^ channels=(list @t) sessions.authentication-state.state + =* sessions sessions.authentication-state.state + =/ all=? + ?~ body.request | + =- ?=(^ -) + %+ get-header:http 'all' + (fall (rush q.u.body.request yquy:de-purl:html) ~) + ?. all + :_ (~(del by sessions) u.session-id) + %~ tap in + channels:(~(gut by sessions) u.session-id *session) + :_ ~ + %~ tap in + %+ roll ~(val by sessions) + |= [session all=(set @t)] + (~(uni in all) channels) + :: close all affected channels, then send the response + :: + =| moves=(list move) + |- ^- (quip move server-state) + ?~ channels + =^ moz state + (handle-response response) + [(weld moves moz) state] + =^ moz state + (discard-channel:by-channel i.channels |) + $(moves (weld moves moz), channels t.channels) :: +session-id-from-request: attempt to find a session cookie :: ++ session-id-from-request @@ -1325,6 +1343,16 @@ :: =. duct-to-key.channel-state.state (~(put by duct-to-key.channel-state.state) duct channel-id) + :: associate this channel with the session cookie + :: + =. sessions.authentication-state.state + =/ session-id=(unit @uv) + (session-id-from-request:authentication request) + ?~ session-id sessions.authentication-state.state + %+ ~(jab by sessions.authentication-state.state) + u.session-id + |= =session + session(channels (~(put in channels.session) channel-id)) :: initialize sse heartbeat :: =/ heartbeat-time=@da (add now ~s20) @@ -1796,7 +1824,9 @@ :: tough luck, we don't create/revive sessions here :: no-op - :_ (~(put by sessions) u.session-id (add now session-timeout)) + :_ %+ ~(jab by sessions) u.session-id + |= =session + session(expiry-time (add now session-timeout)) =- response-header.http-event(headers -) %^ set-header:http 'set-cookie' (session-cookie-string u.session-id &) @@ -2363,11 +2393,9 @@ =* sessions sessions.authentication-state.server-state.ax =. sessions.authentication-state.server-state.ax %- ~(gas by *(map @uv session)) - %+ murn ~(tap in sessions) + %+ skip ~(tap in sessions) |= [cookie=@uv session] - ^- (unit [@uv session]) - ?: (lth expiry-time now) ~ - `[cookie expiry-time] + (lth expiry-time now) :: if there's any cookies left, set a timer for the next expected expiry :: ^- [(list move) _http-server-gate] @@ -2399,7 +2427,18 @@ ++ load => |% +$ axle-2019-10-6 - [date=%~2019.10.6 =server-state] + [date=%~2019.10.6 server-state=server-state-2019-10-6] + :: + +$ server-state-2019-10-6 + $: bindings=(list [=binding =duct =action]) + connections=(map duct outstanding-connection) + authentication-state=sessions=(map @uv @da) + =channel-state + domains=(set turf) + =http-config + ports=[insecure=@ud secure=(unit @ud)] + outgoing-duct=duct + == -- |= old=$%(axle axle-2019-10-6) ^+ ..^$ diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 6c4a2c11b..99750fa3c 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1213,6 +1213,9 @@ :: to properly handle cookie expiration as a security mechanism. :: expiry-time=@da + :: channels: channels opened by this session + :: + channels=(set @t) :: :: TODO: We should add a system for individual capabilities; we should :: mint some sort of long lived cookie for mobile apps which only has diff --git a/pkg/interface/dbug/src/js/views/eyre.js b/pkg/interface/dbug/src/js/views/eyre.js index 88e4bde91..738a685cf 100644 --- a/pkg/interface/dbug/src/js/views/eyre.js +++ b/pkg/interface/dbug/src/js/views/eyre.js @@ -146,7 +146,7 @@ export class Eyre extends Component { const sessionItems = props.authentication.map(s => { return (
- {`${s.cookie} expires ${msToDa(s.expiry)}`} + {`${s.cookie} expires ${msToDa(s.expiry)}, uses ${s.channels} channel(s)`}
); }); From 6344a8441dd609cb58a4fb28490499ed480c4534 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 5 Jun 2020 17:59:31 -0700 Subject: [PATCH 188/280] jael: always restart subscription to breached ship --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/jael.hoon | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 30d0e94e1..2851e6e17 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd9ee3401fd2a29fc49ef84aa51754be5929f2cddbb7e378ffac4641695e886c -size 13838435 +oid sha256:46d79f0b3dc1c4ff5f7ca56f1601a26a0fbc67540ab0ebcc672dc282fe8bbe74 +size 13825786 diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index fd024cdc2..4bd3a4463 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -883,9 +883,17 @@ ?=(%rift -.a-diff) (gth to.a-diff rift.point) == - %+ public-keys-give - (subscribers-on-ship who) - [%breach who] + =. ..feel + %+ public-keys-give + (subscribers-on-ship who) + [%breach who] + =/ sor (~(get by sources-reverse) %& who) + ?~ sor + ..feel + :: delay resubscribing because Ames is going to clear any + :: messages we send now. + :: + (emit hen %pass /breach/(scot %ud u.sor) %b %wait now) :: =. point ?- -.a-diff From 8341d99ce0d9daa1b10186feec2bf16e0773b8b8 Mon Sep 17 00:00:00 2001 From: Fang Date: Sat, 6 Jun 2020 18:58:57 +0200 Subject: [PATCH 189/280] shoe: optionally auto-run commands on entry The +command-parser must now produce both a flag and a command noun. If the flag is true, instantly runs the command from the noun. If false, maintains standard behavior and only runs it on-return. --- pkg/arvo/app/chat-cli.hoon | 1 + pkg/arvo/app/shoe.hoon | 4 ++-- pkg/arvo/lib/shoe.hoon | 38 ++++++++++++++++++++++++++------------ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/pkg/arvo/app/chat-cli.hoon b/pkg/arvo/app/chat-cli.hoon index 20065b484..959a1f270 100644 --- a/pkg/arvo/app/chat-cli.hoon +++ b/pkg/arvo/app/chat-cli.hoon @@ -451,6 +451,7 @@ :: ++ parser |^ + %+ stag | %+ knee *command |. ~+ =- ;~(pose ;~(pfix mic -) message) ;~ pose diff --git a/pkg/arvo/app/shoe.hoon b/pkg/arvo/app/shoe.hoon index 504365c59..83f24b9d6 100644 --- a/pkg/arvo/app/shoe.hoon +++ b/pkg/arvo/app/shoe.hoon @@ -40,8 +40,8 @@ :: ++ command-parser |= sole-id=@ta - ^+ |~(nail *(like command)) - (cold ~ (jest 'demo')) + ^+ |~(nail *(like [? command])) + (cold [& ~] (jest 'demo')) :: ++ tab-list |= sole-id=@ta diff --git a/pkg/arvo/lib/shoe.hoon b/pkg/arvo/lib/shoe.hoon index 3727c4624..67ab74404 100644 --- a/pkg/arvo/lib/shoe.hoon +++ b/pkg/arvo/lib/shoe.hoon @@ -35,14 +35,20 @@ |* command-type=mold $_ ^| |_ bowl:gall + :: +command-parser: input parser for a specific session + :: + :: if the head of the result is true, instantly run the command + :: ++ command-parser |~ sole-id=@ta - |~(nail *(like command-type)) + |~(nail *(like [? command-type])) + :: +tab-list: autocomplete options for the session (to match +command-parser) :: ++ tab-list |~ sole-id=@ta :: (list [@t tank]) *(list (option:auto tank)) + :: +on-command: called when a valid command is run :: ++ on-command |~ [sole-id=@ta command=command-type] @@ -106,7 +112,8 @@ |* [shoe=* command-type=mold] |_ =bowl:gall ++ command-parser - (easy *command-type) + |= sole-id=@ta + (easy *[? command-type]) :: ++ tab-list ~ @@ -193,9 +200,9 @@ (~(gut by soles) sole-id *sole-share) |^ =^ [cards=(list card) =_cli-state] shoe ?- -.dat.act - %det [(apply-edit +.dat.act) shoe] + %det (apply-edit +.dat.act) %clr [[~ cli-state] shoe] - %ret run-command + %ret try-command %tab [(tab +.dat.act) shoe] == :- (deal cards) @@ -208,15 +215,18 @@ :: ++ apply-edit |= =sole-change - ^- (quip card _cli-state) + ^+ [[*(list card) cli-state] shoe] =^ inverse cli-state (~(transceive sole cli-state) sole-change) :: res: & for fully parsed, | for parsing failure at location :: - =/ res=(each (unit) @ud) + =/ res=(each (unit [run=? cmd=command-type]) @ud) %+ rose (tufa buf.cli-state) (command-parser:og sole-id) - ?: ?=(%& -.res) [~ cli-state] + ?: ?=(%& -.res) + ?~ p.res [[~ cli-state] shoe] + (run-command cmd.u.p.res) + :_ shoe :: parsing failed :: ?. &(?=(%del -.inverse) =(+(p.inverse) (lent buf.cli-state))) @@ -234,14 +244,18 @@ [%err p.res] :: cursor to error location == :: - ++ run-command + ++ try-command ^+ [[*(list card) cli-state] shoe] - =/ cmd=(unit command-type) + =/ res=(unit [? cmd=command-type]) %+ rust (tufa buf.cli-state) (command-parser:og sole-id) - ?~ cmd - [[[(effect %bel ~)]~ cli-state] shoe] - =^ cards shoe (on-command:og sole-id u.cmd) + ?^ res (run-command cmd.u.res) + [[[(effect %bel ~)]~ cli-state] shoe] + :: + ++ run-command + |= cmd=command-type + ^+ [[*(list card) cli-state] shoe] + =^ cards shoe (on-command:og sole-id cmd) :: clear buffer :: =^ clear cli-state (~(transmit sole cli-state) [%set ~]) From 61de7d560388bea6ee6f2a9302a340cd58560208 Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 7 Jun 2020 15:39:03 +0200 Subject: [PATCH 190/280] shoe: provide usable default for +tab-list It hadn't been updated to account for the sole-id argument. --- pkg/arvo/lib/shoe.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/lib/shoe.hoon b/pkg/arvo/lib/shoe.hoon index 67ab74404..cb985b676 100644 --- a/pkg/arvo/lib/shoe.hoon +++ b/pkg/arvo/lib/shoe.hoon @@ -116,6 +116,7 @@ (easy *[? command-type]) :: ++ tab-list + |= sole-id=@ta ~ :: ++ on-command From f720c346e6f9ccc358c7540a0945c36cee374342 Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 7 Jun 2020 18:06:46 +0200 Subject: [PATCH 191/280] shoe: respect insta-run flag when false --- pkg/arvo/lib/shoe.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/lib/shoe.hoon b/pkg/arvo/lib/shoe.hoon index cb985b676..e8ab3aecb 100644 --- a/pkg/arvo/lib/shoe.hoon +++ b/pkg/arvo/lib/shoe.hoon @@ -225,7 +225,8 @@ %+ rose (tufa buf.cli-state) (command-parser:og sole-id) ?: ?=(%& -.res) - ?~ p.res [[~ cli-state] shoe] + ?. &(?=(^ p.res) run.u.p.res) + [[~ cli-state] shoe] (run-command cmd.u.p.res) :_ shoe :: parsing failed From 6e8822ffb556695c73989bc5961c8233c780bcd0 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 8 Jun 2020 23:24:23 +0200 Subject: [PATCH 192/280] clay: resurrect ':' for file-change notifications Instead of printing '+' for both additions and modifications. --- pkg/arvo/sys/vane/clay.hoon | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 00c22e44f..de9156623 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1360,7 +1360,13 @@ |(!=(~ sys-changes) !=(~ (need-vane-update changes))) == (sys-update yoki new-data changes) - =. ..park (emil (print deletes ~(key by changes))) + =. ..park + %- emil + =/ changed=(set path) ~(key by changes) + =/ existed=(set path) ~(key by old-lobes) + %^ print deletes + (~(int in changed) existed) + (~(dif in changed) existed) :: clear caches if zuse reloaded :: =/ is-zuse-new=? !=(~ sys-changes) @@ -1699,20 +1705,24 @@ :: Print notification to console :: ++ print - |= [deletes=(set path) changes=(set path)] + |= [deletes=(set path) changes=(set path) additions=(set path)] ^- (list move) - |^ ?~ hun ~ ?: =(0 let.dom) ~ - %+ weld - %+ turn ~(tap in deletes) + |^ + ;: weld + (paths-to-notes '-' deletes) + (paths-to-notes ':' changes) + (paths-to-notes '+' additions) + == + :: + ++ paths-to-notes + |= [prefix=@tD paths=(set path)] + %+ turn ~(tap in paths) |= =path - [u.hun %give %note '-' (path-to-tank path)] - %+ turn ~(tap in changes) - |= =path - [u.hun %give %note '+' (path-to-tank path)] + [u.hun %give %note prefix (path-to-tank path)] :: ++ path-to-tank |= =path From 11fa48f57bb6ff6d013d6eef8ec38ec1e363fe2f Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 9 Jun 2020 16:21:30 -0700 Subject: [PATCH 193/280] kiln: ota logic compiles --- pkg/arvo/app/hood.hoon | 30 +++++++++++++------ pkg/arvo/lib/hood/drum.hoon | 8 ++++-- pkg/arvo/lib/hood/helm.hoon | 3 +- pkg/arvo/lib/hood/kiln.hoon | 56 ++++++++++++++++++++++++++++++++++-- pkg/arvo/lib/hood/write.hoon | 1 + 5 files changed, 83 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 254aa8faa..e57234303 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -43,9 +43,9 @@ !: => |% :: ++ hood-old :: unified old-state - {?($1 $2 $3 $4 $5) lac/(map @tas hood-part-old)} + {?($1 $2 $3 $4 $5 $6) lac/(map @tas hood-part-old)} ++ hood-1 :: unified state - {$5 lac/(map @tas hood-part)} :: + {$6 lac/(map @tas hood-part)} :: ++ hood-good :: extract specific =+ hed=$:hood-head |@ ++ $ @@ -68,7 +68,12 @@ $write *part:hood-write == -- - ++ hood-part-old hood-part :: old state for ++prep + ++ hood-part-old + $% [%drum part-old:hood-drum] + [%helm part-old:hood-helm] + [%kiln part-old:hood-kiln] + [%write part-old:hood-write] + == ++ hood-port :: state transition |: paw=$:hood-part-old ^- hood-part :: paw :: @@ -147,12 +152,19 @@ =/ old-state !<(hood-old old-state-vase) =^ cards lac =. lac lac.old-state - ?- -.old-state - %1 ((wrap on-load):from-drum:(help hid) %1) - %2 ((wrap on-load):from-drum:(help hid) %2) - %3 ((wrap on-load):from-drum:(help hid) %3) - %4 ((wrap on-load):from-drum:(help hid) %4) - %5 `lac + ?- -.old-state + %1 ((wrap on-load):from-drum:(help hid) %1) + %2 ((wrap on-load):from-drum:(help hid) %2) + %3 ((wrap on-load):from-drum:(help hid) %3) + %4 ((wrap on-load):from-drum:(help hid) %4) + %5 + =/ start ..$:(from-kiln) + =/ old-kiln-part (~(got by lac.old-state) %kiln) + ?> ?=(%kiln -.old-kiln-part) + %- ably + (on-load:(start hid *part:hood-kiln) old-kiln-part) + :: + %6 `lac == [cards ..on-init] :: diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 6e830eba7..b71ffa7d9 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -8,8 +8,12 @@ :::: :: :: :: :: :: |% :: :: -++ part {$drum $2 pith-2} :: -++ part-old {$drum $1 pith-1} :: ++$ part [%drum %2 pith-2] :: ++$ part-old :: + $: %drum :: + $% [%1 pith-1] :: + [%2 pith-2] :: + == == :: :: :: ++ pith-1 :: pre-style %+ cork pith-2 :: diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index 96ba72bc5..1d1c908d9 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -8,7 +8,8 @@ :::: :: :: :: :: :: |% :: :: -++ part {$helm $0 pith} :: helm state ++$ part {$helm $0 pith} :: helm state ++$ part-old part :: ++ pith :: helm content $: hoc/(map bone session) :: consoles == :: diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index ff263bbf5..aaff3e6ac 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -9,13 +9,31 @@ =, space:userlib =, format |% :: :: -++ part {$kiln $0 pith} :: kiln state -++ pith :: :: ++$ part [%kiln %1 pith] :: kiln state ++$ part-old :: + $: %kiln :: + $% [%0 pith-0] :: + [%1 pith-1] :: + == == :: +++ pith pith-1 :: :: +++ pith-0 :: + $: rem=(map desk per-desk) :: + syn=(map kiln-sync let=@ud) :: + autoload-on=? :: + cur-hoon=@uvI :: + cur-arvo=@uvI :: + cur-zuse=@uvI :: + cur-vanes=(map @tas @uvI) :: + commit-timer=[way=wire nex=@da tim=@dr mon=term] + == :: +:: :: +++ pith-1 :: $: rem=(map desk per-desk) :: syn=(map kiln-sync let/@ud) :: ota=(unit [=ship =desk =aeon]) :: commit-timer=[way=wire nex=@da tim=@dr mon=term] == :: +:: ++ per-desk :: per-desk state $: auto/? :: escalate on failure gem/germ :: strategy @@ -73,6 +91,39 @@ :^ %palm [" " ~ ~ ~] leaf+(weld "kiln: " mez) ~[leaf+"from {}" leaf+"on {}" leaf+"to {}"] :: +++ on-load + |= =part-old + =< abet + =? . ?=(%0 +<.part-old) + =/ recognized-ota=(unit [syd=desk her=ship sud=desk]) + =/ syncs=(list [[syd=desk her=ship sud=desk] =aeon]) + ~(tap by syn.part-old) + |- ^- (unit [syd=desk her=ship sud=desk]) + ?~ syncs + ~ + ?: &(=(%base syd.i.syncs) !=(our her.i.syncs) =(%kids sud.i.syncs)) + `[syd her sud]:i.syncs + $(syncs t.syncs) + :: + =. +<+.$.abet + %= part-old + +< %1 + syn + ?~ recognized-ota + syn + (~(del by syn) [syd her sud]:u.recognized-ota) + :: + |4 [~ commit-timer.part-old] + == + :: + =? ..abet ?=(^ recognized-ota) + (poke-internal:update `[her sud]:u.recognized-ota) + +(part-old +<+.$.abet) + :: + ?> ?=(%1 +<.part-old) + =. +<+.$.abet part-old + ..abet +:: ++ poke-commit |= [mon/kiln-commit auto=?] =< abet @@ -136,7 +187,6 @@ |= =wire ?~ ota | - ~! ota=ota ?& ?=([@ @ @ *] wire) =(i.wire (scot %p ship.u.ota)) =(i.t.wire desk.u.ota) diff --git a/pkg/arvo/lib/hood/write.hoon b/pkg/arvo/lib/hood/write.hoon index dee25db78..4b9643337 100644 --- a/pkg/arvo/lib/hood/write.hoon +++ b/pkg/arvo/lib/hood/write.hoon @@ -8,6 +8,7 @@ =, space:userlib |% +$ part {$write $0 pith} :: no state ++$ part-old part +$ pith ~ -- :: From db21fad4dd0581c7ae6beb8392eafb45d8e394e3 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 10 Jun 2020 04:16:25 -0400 Subject: [PATCH 194/280] gall: WIP load-lost --- pkg/arvo/app/goad.hoon | 20 +++--- pkg/arvo/sys/vane/gall.hoon | 122 ++++++++++++++++++++++++++++++++---- 2 files changed, 122 insertions(+), 20 deletions(-) diff --git a/pkg/arvo/app/goad.hoon b/pkg/arvo/app/goad.hoon index b90a0f0e2..1f55f7b01 100644 --- a/pkg/arvo/app/goad.hoon +++ b/pkg/arvo/app/goad.hoon @@ -11,9 +11,7 @@ |_ =bowl:gall +* this . def ~(. (default-agent this %|) bowl) -++ on-init on-init:def -++ on-save on-save:def -++ on-load on-load:def +:: ++ on-poke |= [=mark =vase] ?: ?=([%noun * %go] +<) @@ -22,10 +20,18 @@ [(goad &) this] (on-poke:def mark vase) :: -++ on-watch on-watch:def -++ on-leave on-leave:def -++ on-peek on-peek:def +++ on-arvo + |= [wir=wire sin=sign-arvo] + ?+ wir (on-arvo:def wir sin) + [%clay ~] `this + == +:: ++ on-agent on-agent:def -++ on-arvo on-arvo:def ++ on-fail on-fail:def +++ on-init on-init:def +++ on-leave on-leave:def +++ on-load on-load:def +++ on-peek on-peek:def +++ on-save on-save:def +++ on-watch on-watch:def -- diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 0f050ee14..ba89ea8c7 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -249,7 +249,7 @@ - %6 running.agents-5 %- ~(run by running.agents-5.state-5) - |=(=yoke-3 `egg`+:yoke-3(agent on-save:agent.yoke-3)) + |=(=yoke-3 `egg`+:yoke-3(agent-3 on-save:agent-3.yoke-3)) == :: ++ state-5 @@ -297,11 +297,63 @@ live=? =stats =watches - =agent + =agent-3 =beak marks=(map duct mark) == :: + ++ agent-3 + =< form + |% + +$ step (quip card form) + +$ card (wind note gift) + +$ note note-2 + +$ task task:agent + +$ sign sign:agent + +$ gift gift:agent + ++ form + $_ ^| + |_ bowl + ++ on-init + *(quip card _^|(..on-init)) + :: + ++ on-save + *vase + :: + ++ on-load + |~ old-state=vase + *(quip card _^|(..on-init)) + :: + ++ on-poke + |~ [mark vase] + *(quip card _^|(..on-init)) + :: + ++ on-watch + |~ path + *(quip card _^|(..on-init)) + :: + ++ on-leave + |~ path + *(quip card _^|(..on-init)) + :: + ++ on-peek + |~ path + *(unit (unit cage)) + :: + ++ on-agent + |~ [wire sign] + *(quip card _^|(..on-init)) + :: + ++ on-arvo + |~ [wire sign-arvo-2] + *(quip card _^|(..on-init)) + :: + ++ on-fail + |~ [term tang] + *(quip card _^|(..on-init)) + -- + -- + :: ++ state-2-to-3 |= =state-2 ^- state-3 @@ -318,14 +370,14 @@ :: ++ agent-2-to-3 |= =agent-2 - ^- agent + ^- agent-3 => |% ++ cards-2-to-3 |= cards=(list card:^agent-2) - ^- (list card:agent) + ^- (list card:agent-3) %+ turn cards |= =card:^agent-2 - ^- card:agent + ^- card:agent-3 ?. ?=([%give ?(%fact %kick) *] card) card %=(card path.p (drop path.p.card)) -- @@ -369,8 +421,8 @@ [(cards-2-to-3 cards) this] :: ++ on-arvo - |= [=wire =sign-arvo] - =^ cards agent-2 (on-arvo:pass wire sign-arvo) + |= [=wire =sign-arvo-2] + =^ cards agent-2 (on-arvo:pass wire sign-arvo-2) [(cards-2-to-3 cards) this] :: ++ on-fail @@ -403,12 +455,56 @@ marks=(map duct mark) == :: + ++ care-2 + |= * + =+ ;;(c=care:clay +<) + ?< ?=(?(%a %b %c %r %s) c) + c + :: + ++ sign-arvo-2 + |= * :: cannot clam + =| s=sign-arvo + ?+ s s + [?(%b %c) %writ *] + ?~ p.s s + s(p.p.u.p ;;(care-2 p.p.u.p.s)) + :: + [?(%b %c) %wris *] + %= s + q + %- ~(run in q.s) + |= [c=care:clay =path] + [;;(care-2 c) path] + == + == + :: + ++ note-arvo-2 + |= * :: cannot clam + =| $= n + $% note-arvo + [%g %conf dock dock] + [%f %build *] + [%f %keep *] + [%f %kill *] + [%f %trim *] + [%f %vega *] + [%f %wegh *] + [%f %wipe *] + == + ?< ?=([%g %conf @tas] n) + n + :: + +$ note-2 + $% [%arvo =note-arvo-2] + [%agent [=ship name=term] =task:agent] + == + :: ++ agent-2 =< form |% +$ step (quip card form) +$ card (wind note gift) - +$ note note:agent + +$ note note-2 +$ task task:agent +$ sign sign:agent +$ gift @@ -451,7 +547,7 @@ *(quip card _^|(..on-init)) :: ++ on-arvo - |~ [wire sign-arvo] + |~ [wire sign-arvo-2] *(quip card _^|(..on-init)) :: ++ on-fail @@ -537,9 +633,9 @@ [cards this] :: ++ on-arvo - |= [=wire =sign-arvo] - ?< ?=([%d %pack *] sign-arvo) - =^ cards agent-0 (on-arvo:pass wire `sign-arvo-0`sign-arvo) + |= [=wire =sign-arvo-2] + ?< ?=([%d %pack *] sign-arvo-2) + =^ cards agent-0 (on-arvo:pass wire `sign-arvo-0`sign-arvo-2) [cards this] :: ++ on-fail @@ -576,7 +672,7 @@ |% +$ step (quip card form) +$ card (wind note gift) - +$ note note:agent + +$ note note-2 +$ task task:agent +$ gift gift:agent-2 +$ sign sign:agent From a4785458d156eed0a0d32c0a2b6d294acae1527c Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 10 Jun 2020 20:37:12 +0200 Subject: [PATCH 195/280] eyre: don't lose redirect upon failing login If we failed the password check, the login page served to us would never include any redirect details, even if they were there in the original request. Now we simply (attempt to) parse out the redirect field a little earlier. --- pkg/arvo/sys/vane/eyre.hoon | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index f5304226e..5cb26cdf3 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -950,12 +950,13 @@ ?~ parsed (return-static-data-on-duct 400 'text/html' (login-page ~ our)) :: + =/ redirect=(unit @t) (get-header:http 'redirect' u.parsed) ?~ password=(get-header:http 'password' u.parsed) - (return-static-data-on-duct 400 'text/html' (login-page ~ our)) + (return-static-data-on-duct 400 'text/html' (login-page redirect our)) :: check that the password is correct :: ?. =(u.password code) - (return-static-data-on-duct 400 'text/html' (login-page ~ our)) + (return-static-data-on-duct 400 'text/html' (login-page redirect our)) :: mint a unique session cookie :: =/ session=@uv @@ -981,7 +982,7 @@ =- out(moves [- moves.out]) [duct %pass /sessions/expire %b %wait expires-at] :: - ?~ redirect=(get-header:http 'redirect' u.parsed) + ?~ redirect %- handle-response :* %start :- status-code=200 From f1fab71d598a09cb24458252659e661fe766b011 Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 11 Jun 2020 01:42:21 +0200 Subject: [PATCH 196/280] eyre: find sub-path for binding In addition to producing the action bound for a given request, now also produces the subset of the request url that comes _after_ the path at which the binding has been established. Will allow some bindings to more easily dispatch off the relevant part of the url. --- pkg/arvo/sys/vane/eyre.hoon | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 8f5a94fb5..7210bea9e 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -724,17 +724,17 @@ :: otherwise, do a straight comparison :: =(u.binding u.host) -:: +path-matches: returns %.y if :prefix is a prefix of :full +:: +find-suffix: returns [~ /tail] if :full is (weld :prefix /tail) :: -++ path-matches +++ find-suffix |= [prefix=path full=path] - ^- ? + ^- (unit path) ?~ prefix - %.y + `full ?~ full - %.n + ~ ?. =(i.prefix i.full) - %.n + ~ $(prefix t.prefix, full t.full) :: +simplified-url-parser: returns [(each @if @t) (unit port=@ud)] :: @@ -788,7 +788,8 @@ (fall (forwarded-for header-list.request) address) :: =/ host (get-header:http 'host' header-list.request) - =/ action (get-action-for-binding host url.request) + =/ [=action suburl=@t] + (get-action-for-binding host url.request) :: =/ authenticated (request-is-logged-in:authentication request) :: record that we started an asynchronous response @@ -1887,7 +1888,7 @@ :: ++ get-action-for-binding |= [raw-host=(unit @t) url=@t] - ^- action + ^- [=action suburl=@t] :: process :raw-host :: :: If we are missing a 'Host:' header, if that header is a raw IP @@ -1935,14 +1936,21 @@ |- :: ?~ bindings - [%four-oh-four ~] + [[%four-oh-four ~] url] :: - ?: ?& (host-matches site.binding.i.bindings raw-host) - (path-matches path.binding.i.bindings parsed-url) - == - action.i.bindings + ?. (host-matches site.binding.i.bindings raw-host) + $(bindings t.bindings) + ?~ suffix=(find-suffix path.binding.i.bindings parsed-url) + $(bindings t.bindings) :: - $(bindings t.bindings) + :- action.i.bindings + %^ cat 3 + %+ roll + ^- (list @t) + (join '/' (flop ['' u.suffix])) + (cury cat 3) + ?~ ext.request-line '' + (cat 3 '.' u.ext.request-line) -- :: ++ forwarded-for From d20877e41485a52b3a8ca2ce291180a15561972c Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 11 Jun 2020 01:45:05 +0200 Subject: [PATCH 197/280] eyre: support %gx scries Exposes a scry endpoint. Any requests made to the /app/scry.mark url under the endpoint will scry into %app using a %gx scry, at the /scry/noun path, and attempt to convert the scry result into the %mark, before converting that into the %mime mark, and sending that as an http response. --- bin/solid.pill | 4 +-- pkg/arvo/sys/vane/eyre.hoon | 70 +++++++++++++++++++++++++++++++++++-- pkg/arvo/sys/zuse.hoon | 3 ++ 3 files changed, 73 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 55acf5687..993021ab3 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2d2a49ab03754ae6ab9d4a956ed4723ce47c93a0e75f18bef46f053743cb6f4 -size 19357530 +oid sha256:f65bd0354541cf2f5b6a6248e7a334f1db923b6cc8c55229dd2f061cc54c0970 +size 19371472 diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 7210bea9e..57e8ffe91 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -857,11 +857,71 @@ :: %channel (handle-request:by-channel secure authenticated address request) + :: + %scry + (handle-scry authenticated address request(url suburl)) :: %four-oh-four %^ return-static-data-on-duct 404 'text/html' (error-page 404 authenticated url.request ~) == + :: +handle-scry: respond with scry result, 404 or 500 + :: + ++ handle-scry + |= [authenticated=? =address =request:http] + |^ ^- (quip move server-state) + :: make sure the path contains an app to scry into + :: + =+ req=(parse-request-line url.request) + ?. ?=(^ site.req) + (error-response 404 "invalid scry target") + :: attempt the scry that was asked for + :: + =/ res=(unit (unit cage)) + (do-scry %gx i.site.req (snoc t.site.req %noun)) + ?~ res (error-response 500 "failed scry") + ?~ u.res (error-response 404 "no scry result") + =* mark p.u.u.res + =* vase q.u.u.res + :: attempt to find conversion gates to the requested mark, then to mime + :: + =/ tub=(unit tube:clay) + ?~ ext.req + (find-tube mark %mime) + ?~ to-mim=(find-tube u.ext.req %mime) ~ + ?: =(mark u.ext.req) to-mim + ?~ to-ext=(find-tube mark u.ext.req) ~ + `|=(=^vase (u.to-mim (u.to-ext vase))) + ?~ tub (error-response 500 "no tube from {(trip mark)} to mime") + :: attempt conversion, then send results + :: + =/ mym=(each mime tang) + (mule |.(!<(mime (u.tub vase)))) + ?- -.mym + %| (error-response 500 "failed tube from {(trip mark)} to mime") + %& %+ return-static-data-on-duct 200 + [(rsh 3 1 (spat p.p.mym)) q.p.mym] + == + :: + ++ find-tube + |= [from=mark to=mark] + ^- (unit tube:clay) + =/ tub=(unit (unit cage)) + (do-scry %cc %home /[from]/[to]) + ?. ?=([~ ~ %tube *] tub) ~ + `!<(tube:clay q.u.u.tub) + :: + ++ do-scry + |= [care=term =desk =path] + ^- (unit (unit cage)) + (scry [%141 %noun] ~ care [our desk da+now] (flop path)) + :: + ++ error-response + |= [status=@ud =tape] + ^- (quip move server-state) + %^ return-static-data-on-duct status 'text/html' + (error-page status authenticated url.request tape) + -- :: +subscribe-to-app: subscribe to app and poke it with request data :: ++ subscribe-to-app @@ -906,8 +966,8 @@ %channel on-cancel-request:by-channel :: - %four-oh-four - :: it should be impossible for a 404 page to be asynchronous + ?(%scry %four-oh-four) + :: it should be impossible for a scry or 404 page to be asynchronous :: !! == @@ -2045,6 +2105,7 @@ :~ [[~ /~/login] duct [%authentication ~]] [[~ /~/logout] duct [%logout ~]] [[~ /~/channel] duct [%channel ~]] + [[~ /~/scry] duct [%scry ~]] == [~ http-server-gate] :: %trim: in response to memory pressure @@ -2392,6 +2453,11 @@ [[~ /~/logout] [/e/load/logout]~ [%logout ~]] bindings.server-state.old ~? !success [%e %failed-to-setup-logout-endpoint] + =^ success bindings.server-state.old + %+ insert-binding + [[~ /~/scry] [/e/load/scry]~ [%scry ~]] + bindings.server-state.old + ~? !success [%e %failed-to-setup-scry-endpoint] %_ $ date.old %~2020.5.29 sessions.authentication-state.server-state.old ~ diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index ab482e039..812460de9 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1413,6 +1413,9 @@ :: gall channel system :: [%channel ~] + :: gall scry endpoint + :: + [%scry ~] :: respond with the default file not found page :: [%four-oh-four ~] From d87d246232a23f5d9fe751c1cc860e84d9b2c0c3 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 11 Jun 2020 16:07:54 -0400 Subject: [PATCH 198/280] gall: +load runs, +molt still fails --- pkg/arvo/sys/vane/gall.hoon | 70 ++++++++++--------------------------- 1 file changed, 18 insertions(+), 52 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index ba89ea8c7..0c4c918e8 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -303,55 +303,23 @@ == :: ++ agent-3 - =< form - |% - +$ step (quip card form) - +$ card (wind note gift) - +$ note note-2 - +$ task task:agent - +$ sign sign:agent - +$ gift gift:agent - ++ form - $_ ^| - |_ bowl - ++ on-init - *(quip card _^|(..on-init)) - :: - ++ on-save - *vase - :: - ++ on-load - |~ old-state=vase - *(quip card _^|(..on-init)) - :: - ++ on-poke - |~ [mark vase] - *(quip card _^|(..on-init)) - :: - ++ on-watch - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-leave - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-peek - |~ path - *(unit (unit cage)) - :: - ++ on-agent - |~ [wire sign] - *(quip card _^|(..on-init)) - :: - ++ on-arvo - |~ [wire sign-arvo-2] - *(quip card _^|(..on-init)) - :: - ++ on-fail - |~ [term tang] - *(quip card _^|(..on-init)) - -- + =/ void _!! + => |% + +$ card * + -- + $_ + ^| + |_ bowl + ++ on-init ** + ++ on-save *vase + ++ on-load |~(void [*(list card) ..^$]) + ++ on-poke |~(void **) + ++ on-watch |~(void **) + ++ on-leave |~(void **) + ++ on-peek |~(void **) + ++ on-agent |~(void **) + ++ on-arvo |~(void **) + ++ on-fail |~(void **) -- :: ++ state-2-to-3 @@ -363,9 +331,7 @@ %- ~(run by running.agents-2.state-2) |= =yoke-2 ^- yoke-3 - %= yoke-2 - agent-2 (agent-2-to-3 agent-2.yoke-2) - == + yoke-2(agent-2 `agent-3`agent-2.yoke-2) == :: ++ agent-2-to-3 From 8c6fd1406fbd7eddcdf6f67ba3aab9f8b9c91b6c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 11 Jun 2020 18:21:52 -0400 Subject: [PATCH 199/280] gall: clean up state adapter using +any-agent --- pkg/arvo/sys/vane/gall.hoon | 691 ++---------------------------------- 1 file changed, 35 insertions(+), 656 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 0c4c918e8..829c84541 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -107,12 +107,7 @@ :: |migrate: data structures for upgrades :: +| %migrate -:: $bolus: incoming move to a pupa, enqueued in a $chrysalis :: -+$ bolus - $% [%call =duct =task:able] - [%take =wire =duct sign=sign-arvo] - == :: $spore: structures for update, produced by +stay :: +$ spore @@ -243,684 +238,68 @@ +$ all-state $%(state-0 state-1 state-2 state-3 state-4 state-5 ^spore) :: ++ state-5-to-spore-6 - |= =state-5 + |= s=state-5 ^- ^spore - %= state-5 + %= s - %6 - running.agents-5 - %- ~(run by running.agents-5.state-5) - |=(=yoke-3 `egg`+:yoke-3(agent-3 on-save:agent-3.yoke-3)) + outstanding ~ :: TODO: do we need to process these somehow? + running + (~(run by running.s) |=(y=yoke-0 +:y(agent on-save:agent.y))) == :: - ++ state-5 - $: %5 - agents-5=agents-3 - == + ++ state-4-to-5 |=(s=state-4 `state-5`s(- %5, outstanding ~)) + ++ state-3-to-4 |=(s=state-3 `state-4`s(- %4, outstanding ~)) + ++ state-2-to-3 |=(s=state-2 `state-3`s(- %3)) + ++ state-1-to-2 |=(s=state-1 `state-2`s(- %2, +< +<.s, +> `+>.s)) + ++ state-0-to-1 |=(s=state-0 `state-1`s(- %1)) :: - ++ state-4-to-5 - |= =state-4 - ^- state-5 - %= state-4 - - %5 - outstanding.agents-4 ~ - == + +$ state-5 [%5 agents-2] + +$ state-4 [%4 agents-2] + +$ state-3 [%3 agents-2] + +$ state-2 [%2 agents-2] + +$ state-1 [%1 agents-0] + +$ state-0 [%0 agents-0] :: - ++ state-4 - $: %4 - agents-4=agents-3 - == - :: - ++ state-3-to-4 - |= =state-3 - ^- state-4 - %= state-3 - - %4 - outstanding.agents-3 ~ - == - :: - ++ state-3 - $: %3 - =agents-3 - == - :: - ++ agents-3 + +$ agents-2 $: system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) - running=(map term yoke-3) + running=(map term yoke-0) blocked=(map term (qeu blocked-move)) == :: - ++ yoke-3 - $: cache=worm - control-duct=duct - live=? - =stats - =watches - =agent-3 - =beak - marks=(map duct mark) - == - :: - ++ agent-3 - =/ void _!! - => |% - +$ card * - -- - $_ - ^| - |_ bowl - ++ on-init ** - ++ on-save *vase - ++ on-load |~(void [*(list card) ..^$]) - ++ on-poke |~(void **) - ++ on-watch |~(void **) - ++ on-leave |~(void **) - ++ on-peek |~(void **) - ++ on-agent |~(void **) - ++ on-arvo |~(void **) - ++ on-fail |~(void **) - -- - :: - ++ state-2-to-3 - |= =state-2 - ^- state-3 - %= state-2 - - %3 - running.agents-2 - %- ~(run by running.agents-2.state-2) - |= =yoke-2 - ^- yoke-3 - yoke-2(agent-2 `agent-3`agent-2.yoke-2) - == - :: - ++ agent-2-to-3 - |= =agent-2 - ^- agent-3 - => |% - ++ cards-2-to-3 - |= cards=(list card:^agent-2) - ^- (list card:agent-3) - %+ turn cards - |= =card:^agent-2 - ^- card:agent-3 - ?. ?=([%give ?(%fact %kick) *] card) card - %=(card path.p (drop path.p.card)) - -- - |_ =bowl:gall - +* this . - pass ~(. agent-2 bowl) - ++ on-init - =^ cards agent-2 on-init:pass - [(cards-2-to-3 cards) this] - :: - ++ on-save - on-save:pass - :: - ++ on-load - |= old-state=vase - =^ cards agent-2 (on-load:pass old-state) - [(cards-2-to-3 cards) this] - :: - ++ on-poke - |= [=mark =vase] - =^ cards agent-2 (on-poke:pass mark vase) - [(cards-2-to-3 cards) this] - :: - ++ on-watch - |= =path - =^ cards agent-2 (on-watch:pass path) - [(cards-2-to-3 cards) this] - :: - ++ on-leave - |= =path - =^ cards agent-2 (on-leave:pass path) - [(cards-2-to-3 cards) this] - :: - ++ on-peek - |= =path - (on-peek:pass path) - :: - ++ on-agent - |= [=wire =sign:agent:gall] - =^ cards agent-2 (on-agent:pass wire sign) - [(cards-2-to-3 cards) this] - :: - ++ on-arvo - |= [=wire =sign-arvo-2] - =^ cards agent-2 (on-arvo:pass wire sign-arvo-2) - [(cards-2-to-3 cards) this] - :: - ++ on-fail - |= [=term =tang] - =^ cards agent-2 (on-fail:pass term tang) - [(cards-2-to-3 cards) this] - -- - :: - ++ state-2 - $: %2 - =agents-2 - == - :: - ++ agents-2 - $: system-duct=duct - outstanding=(map [wire duct] (qeu remote-request)) - contacts=(set ship) - running=(map term yoke-2) - blocked=(map term (qeu blocked-move)) - == - :: - ++ yoke-2 - $: cache=worm - control-duct=duct - live=? - =stats - =watches - =agent-2 - =beak - marks=(map duct mark) - == - :: - ++ care-2 - |= * - =+ ;;(c=care:clay +<) - ?< ?=(?(%a %b %c %r %s) c) - c - :: - ++ sign-arvo-2 - |= * :: cannot clam - =| s=sign-arvo - ?+ s s - [?(%b %c) %writ *] - ?~ p.s s - s(p.p.u.p ;;(care-2 p.p.u.p.s)) - :: - [?(%b %c) %wris *] - %= s - q - %- ~(run in q.s) - |= [c=care:clay =path] - [;;(care-2 c) path] - == - == - :: - ++ note-arvo-2 - |= * :: cannot clam - =| $= n - $% note-arvo - [%g %conf dock dock] - [%f %build *] - [%f %keep *] - [%f %kill *] - [%f %trim *] - [%f %vega *] - [%f %wegh *] - [%f %wipe *] - == - ?< ?=([%g %conf @tas] n) - n - :: - +$ note-2 - $% [%arvo =note-arvo-2] - [%agent [=ship name=term] =task:agent] - == - :: - ++ agent-2 - =< form - |% - +$ step (quip card form) - +$ card (wind note gift) - +$ note note-2 - +$ task task:agent - +$ sign sign:agent - +$ gift - $% [%fact path=(unit path) =cage] - [%kick path=(unit path) ship=(unit ship)] - [%watch-ack p=(unit tang)] - [%poke-ack p=(unit tang)] - == - ++ form - $_ ^| - |_ bowl - ++ on-init - *(quip card _^|(..on-init)) - :: - ++ on-save - *vase - :: - ++ on-load - |~ old-state=vase - *(quip card _^|(..on-init)) - :: - ++ on-poke - |~ [mark vase] - *(quip card _^|(..on-init)) - :: - ++ on-watch - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-leave - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-peek - |~ path - *(unit (unit cage)) - :: - ++ on-agent - |~ [wire sign] - *(quip card _^|(..on-init)) - :: - ++ on-arvo - |~ [wire sign-arvo-2] - *(quip card _^|(..on-init)) - :: - ++ on-fail - |~ [term tang] - *(quip card _^|(..on-init)) - -- - -- - :: - ++ state-1-to-2 - |= =state-1 - ^- state-2 - %= state-1 - - %2 - +.agents-1 [~ +.agents-1.state-1] - == - :: - ++ state-1 - $: %1 - =agents-1 - == - :: - ++ agents-1 - $: system-duct=duct - contacts=(set ship) - running=(map term yoke-2) - blocked=(map term (qeu blocked-move)) - == - :: - ++ state-0-to-1 - |= =state-0 - ^- state-1 - %= state-0 - - %1 - running.agents-0 - %- ~(run by running.agents-0.state-0) - |= =yoke-0 - ^- yoke-2 - %= yoke-0 - agent-0 (agent-0-to-1 agent-0.yoke-0) - == - == - :: - ++ agent-0-to-1 - |= =agent-0 - ^- agent-2 - |_ =bowl:gall - +* this . - pass ~(. agent-0 bowl) - ++ on-init - =^ cards agent-0 on-init:pass - [cards this] - :: - ++ on-save - on-save:pass - :: - ++ on-load - |= old-state=vase - =^ cards agent-0 (on-load:pass old-state) - [cards this] - :: - ++ on-poke - |= [=mark =vase] - =^ cards agent-0 (on-poke:pass mark vase) - [cards this] - :: - ++ on-watch - |= =path - =^ cards agent-0 (on-watch:pass path) - [cards this] - :: - ++ on-leave - |= =path - =^ cards agent-0 (on-leave:pass path) - [cards this] - :: - ++ on-peek - |= =path - (on-peek:pass path) - :: - ++ on-agent - |= [=wire =sign:agent:gall] - =^ cards agent-0 (on-agent:pass wire sign) - [cards this] - :: - ++ on-arvo - |= [=wire =sign-arvo-2] - ?< ?=([%d %pack *] sign-arvo-2) - =^ cards agent-0 (on-arvo:pass wire `sign-arvo-0`sign-arvo-2) - [cards this] - :: - ++ on-fail - |= [=term =tang] - =^ cards agent-0 (on-fail:pass term tang) - [cards this] - -- - :: - ++ state-0 - $: %0 - =agents-0 - == - :: - ++ agents-0 + +$ agents-0 $: system-duct=duct contacts=(set ship) running=(map term yoke-0) blocked=(map term (qeu blocked-move)) == :: - ++ yoke-0 + +$ yoke-0 $: cache=worm control-duct=duct live=? =stats =watches - =agent-0 + agent=any-agent =beak marks=(map duct mark) == :: - ++ agent-0 - =< form - |% - +$ step (quip card form) - +$ card (wind note gift) - +$ note note-2 - +$ task task:agent - +$ gift gift:agent-2 - +$ sign sign:agent - ++ form - $_ ^| - |_ bowl - ++ on-init - *(quip card _^|(..on-init)) - :: - ++ on-save - *vase - :: - ++ on-load - |~ old-state=vase - *(quip card _^|(..on-init)) - :: - ++ on-poke - |~ [mark vase] - *(quip card _^|(..on-init)) - :: - ++ on-watch - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-leave - |~ path - *(quip card _^|(..on-init)) - :: - ++ on-peek - |~ path - *(unit (unit cage)) - :: - ++ on-agent - |~ [wire sign] - *(quip card _^|(..on-init)) - :: - ++ on-arvo - |~ [wire sign-arvo-0] - *(quip card _^|(..on-init)) - :: - ++ on-fail - |~ [term tang] - *(quip card _^|(..on-init)) - -- - -- - :: - ++ sign-arvo-0 - $% {$a gift:able:ames} - $: $b - $% gift:able:behn - $>(%wris gift:able:clay) - $>(%writ gift:able:clay) - $>(%mere gift:able:clay) - $>(%unto gift:able:gall) - == - == - {$c gift:able:clay} - {$d $<(%pack gift:able:dill)} - {$f gift:ford} - [%e gift:able:eyre] - {$g gift:able:gall} - [%i gift:able:iris] - {$j gift:able:jael} - == - :: - ++ ford - |% - += gift - $% :: %made: build result; response to %build +task - :: - $: %made - :: date: formal date of the build - :: - date=@da - :: result: result of the build; either complete build, or error - :: - result=made-result - == == - += made-result - $% :: %complete: contains the result of the completed build - :: - [%complete =build-result] - :: %incomplete: couldn't finish build; contains error message - :: - [%incomplete =tang] - == - += build-result - $% :: %error: the build produced an error whose description is :message - :: - [%error message=tang] - :: %success: result of successful +build, tagged by +schematic sub-type - :: - $: %success - $^ [head=build-result tail=build-result] - $% [%$ =cage] - [%alts =build-result] - [%bake =cage] - [%bunt =cage] - [%call =vase] - [%cast =cage] - [%core =vase] - [%diff =cage] - [%hood =scaffold] - [%join =cage] - [%list results=(list build-result)] - [%mash =cage] - [%mute =cage] - [%pact =cage] - [%path =rail] - [%plan =vase] - [%reef =vase] - [%ride =vase] - [%scry =cage] - [%slim [=type =nock]] - [%slit =type] - [%vale =cage] - [%volt =cage] - [%walk results=(list mark-action)] - == == == - += scaffold - $: :: source-rail: the file this scaffold was parsed from - :: - source-rail=rail - :: zuse-version: the kelvin version of the standard library - :: - zuse-version=@ud - :: structures: files from %/sur which are included - :: - structures=(list cable) - :: libraries: files from %/lib which are included - :: - libraries=(list cable) - :: cranes: a list of resources to transform and include - :: - cranes=(list crane) - :: sources: hoon sources, either parsed or on the filesystem - :: - sources=(list hoon) - == - += mark-action [type=?(%grow %grab) source=term target=term] - += rail [=disc =spur] - +$ cable - $: face=(unit term) - file-path=term - == - += crane - $% $: :: %fssg: `/~` hoon literal - :: - :: `/~ ` produces a crane that evaluates arbitrary hoon. - :: - %fssg - =hoon - == - $: :: %fsbc: `/$` process query string - :: - :: `/$` will call a gate with the query string supplied to this - :: build. If no query string, this errors. - :: - %fsbc - =hoon - == - $: :: %fsbr: `/|` first of many options that succeeds - :: - :: `/|` takes a series of cranes and produces the first one - :: (left-to-right) that succeeds. If none succeed, it produces - :: stack traces from all of its arguments. - :: - %fsbr - :: choices: cranes to try - :: - choices=(list crane) - == - $: :: %fsts: `/=` wrap a face around a crane - :: - :: /= runs a crane (usually produced by another ford rune), takes - :: the result of that crane, and wraps a face around it. - :: - %fsts - :: face: face to apply - :: - face=term - :: crane: internal build step - :: - =crane - == - $: :: %fsdt: `/.` null-terminated list - :: - :: Produce a null-terminated list from a sequence of cranes, - :: terminated by a `==`. - :: - %fsdt - :: items: cranes to evaluate - :: - items=(list crane) - == - $: :: %fscm: `/,` switch by path - :: - :: `/,` is a switch statement, which picks a branch to evaluate - :: based on whether the current path matches the path in the - :: switch statement. Takes a sequence of pairs of (path, crane) - :: terminated by a `==`. - :: - %fscm - :: cases: produces evaluated crane of first +spur match - :: - cases=(list (pair spur crane)) - == - $: :: %fspm: `/&` pass through a series of marks - :: - :: `/&` passes a crane through multiple marks, right-to-left. - :: - %fspm - :: marks: marks to apply to :crane, in reverse order - :: - marks=(list mark) - =crane - == - $: :: %fscb: `/_` run a crane on each file in the current directory - :: - :: `/_` takes a crane as an argument. It produces a new crane - :: representing the result of mapping the supplied crane over the - :: list of files in the current directory. The keys in the - :: resulting map are the basenames of the files in the directory, - :: and each value is the result of running that crane on the - :: contents of the file. - :: - %fscb - =crane - == - $: :: %fssm: `/;` operate on - :: - :: `/;` takes a hoon and a crane. The hoon should evaluate to a - :: gate, which is then called with the result of the crane as its - :: sample. - :: - %fssm - =hoon - =crane - == - $: :: %fscl: `/:` evaluate at path - :: - :: `/:` takes a path and a +crane, and evaluates the crane with - :: the current path set to the supplied path. - :: - %fscl - :: path: late bound path to be resolved relative to current beak - :: - :: This becomes current path of :crane - :: - path=truss - =crane - == - $: :: %fskt: `/^` cast - :: - :: `/^` takes a +mold and a +crane, and casts the result of the - :: crane to the mold. - :: - %fskt - :: mold: evaluates to a mold to be applied to :crane - :: - =spec - =crane - == - $: :: %fstr: `/*` run :crane on all files with current path as prefix - :: - %fstr - =crane - == - $: :: %fszp: `/!mark/` evaluate as hoon, then pass through mark - :: - %fszp - =mark - == - $: :: %fszy: `/mark/` passes current path through :mark - :: - %fszy - =mark - == == - += truss - $: pre=(unit tyke) - pof=(unit [p=@ud q=tyke]) - == + ++ any-agent + $_ + ^| + |_ bowl + ++ on-init ** + ++ on-save *vase + ++ on-load ** + ++ on-poke ** + ++ on-watch ** + ++ on-leave ** + ++ on-peek ** + ++ on-agent ** + ++ on-arvo ** + ++ on-fail ** -- -- -- From b8704669773ee3d15a42f6b4c1bebaa2b385b505 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 12 Jun 2020 00:57:25 +0200 Subject: [PATCH 200/280] eyre: only allow authenticated GET scry requests Lacking any other permissioning mechanism, we must simply reject unauthenticated HTTP-scry requests for now. --- pkg/arvo/sys/vane/eyre.hoon | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 57e8ffe91..059194ef5 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -870,6 +870,10 @@ ++ handle-scry |= [authenticated=? =address =request:http] |^ ^- (quip move server-state) + ?. authenticated + (error-response 403 ~) + ?. =(%'GET' method.request) + (error-response 405 "may only GET scries") :: make sure the path contains an app to scry into :: =+ req=(parse-request-line url.request) From 3c168eddb43cc451fcf818ccb20daee8cb31e902 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 12 Jun 2020 02:03:55 +0200 Subject: [PATCH 201/280] gall: do mark conversion in +ap-peek Attempt to convert the scry result to the mark that was asked for, failing the scry (with ~) if the conversion fails. Eyre's scry logic, then, can pass the requested mark directly into gall. --- pkg/arvo/sys/vane/eyre.hoon | 12 ++++-------- pkg/arvo/sys/vane/gall.hoon | 39 +++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 059194ef5..a36f2c967 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -882,20 +882,15 @@ :: attempt the scry that was asked for :: =/ res=(unit (unit cage)) - (do-scry %gx i.site.req (snoc t.site.req %noun)) + (do-scry %gx i.site.req (snoc t.site.req (fall ext.req %mime))) ?~ res (error-response 500 "failed scry") ?~ u.res (error-response 404 "no scry result") =* mark p.u.u.res =* vase q.u.u.res - :: attempt to find conversion gates to the requested mark, then to mime + :: attempt to find conversion gate to mime :: =/ tub=(unit tube:clay) - ?~ ext.req - (find-tube mark %mime) - ?~ to-mim=(find-tube u.ext.req %mime) ~ - ?: =(mark u.ext.req) to-mim - ?~ to-ext=(find-tube mark u.ext.req) ~ - `|=(=^vase (u.to-mim (u.to-ext vase))) + (find-tube mark %mime) ?~ tub (error-response 500 "no tube from {(trip mark)} to mime") :: attempt conversion, then send results :: @@ -910,6 +905,7 @@ ++ find-tube |= [from=mark to=mark] ^- (unit tube:clay) + ?: =(from to) `(bake same vase) =/ tub=(unit (unit cage)) (do-scry %cc %home /[from]/[to]) ?. ?=([~ ~ %tube *] tub) ~ diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 0f050ee14..8808022f4 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1765,15 +1765,42 @@ ~/ %ap-peek |= [care=term tyl=path] ^- (unit (unit cage)) - :: strip trailing mark off path for %x scrys + :: take trailing mark off path for %x scrys + :: + =^ want=mark tyl + ?. ?=(%x care) [%$ tyl] + =. tyl (flop tyl) + [(head tyl) (flop (tail tyl))] + :: call the app's +on-peek, producing [~ ~] if it crashes :: - =? tyl ?=(%x care) (flop (tail (flop tyl))) =/ peek-result=(each (unit (unit cage)) tang) (ap-mule-peek |.((on-peek:ap-agent-core [care tyl]))) - ?- -.peek-result - %& p.peek-result - %| ((slog leaf+"peek bad result" p.peek-result) [~ ~]) - == + ?: ?=(%| -.peek-result) + ((slog leaf+"peek bad result" p.peek-result) [~ ~]) + :: for non-%x scries, or failed %x scries, or %x results that already + :: have the requested mark, produce the result as-is + :: + ?. ?& ?=(%x care) + ?=([~ ~ *] p.peek-result) + !=(mark p.u.u.p.peek-result) + == + p.peek-result + :: for %x scries, attempt to convert to the requested mark if needed + :: + =* have p.u.u.p.peek-result + =* vase q.u.u.p.peek-result + =/ tub=(unit tube:clay) + ?: =(have want) `(bake same ^vase) + =/ tuc=(unit (unit cage)) + (ski [%141 %noun] ~ %cc [our %home da+now] (flop /[have]/[want])) + ?. ?=([~ ~ *] tuc) ~ + `!<(tube:clay q.u.u.tuc) + ?~ tub + ((slog leaf+"peek no tube from {(trip have)} to {(trip want)}" ~) ~) + =/ res (mule |.((u.tub vase))) + ?: ?=(%& -.res) + ``want^p.res + ((slog leaf+"peek failed tube from {(trip have)} to {(trip want)}" ~) ~) :: +ap-update-subscription: update subscription. :: ++ ap-update-subscription From 4ab55893bce553493d18d304f867bf6f2d03dbe1 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 12 Jun 2020 02:13:13 +0200 Subject: [PATCH 202/280] eyre: slightly better error pages --- pkg/arvo/sys/vane/eyre.hoon | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index a36f2c967..b8a8dad8b 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -453,13 +453,13 @@ :: =/ code-as-tape=tape (format-ud-as-integer code) =/ message=tape - ?: =(code 400) - "Bad Request" - ?: =(code 403) - "Forbidden" - ?: =(code 404) - "Not Found" - "Unknown Error" + ?+ code "{} Error" + %400 "Bad Request" + %403 "Forbidden" + %404 "Not Found" + %405 "Method Not Allowed" + %500 "Internal Server Error" + == :: %- as-octs:mimes:html %- crip @@ -878,7 +878,7 @@ :: =+ req=(parse-request-line url.request) ?. ?=(^ site.req) - (error-response 404 "invalid scry target") + (error-response 400 "scry path must start with app name") :: attempt the scry that was asked for :: =/ res=(unit (unit cage)) From a3e15cd64c304d7d73a3c9844a14c94100fd01f7 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 11 Jun 2020 19:41:22 -0700 Subject: [PATCH 203/280] clay: send notifications on vega --- bin/solid.pill | 4 +-- pkg/arvo/sys/hoon.hoon | 7 +++-- pkg/arvo/sys/vane/clay.hoon | 55 ++++++++++++++++++++++++++++++++----- 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 55acf5687..9d6e38112 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2d2a49ab03754ae6ab9d4a956ed4723ce47c93a0e75f18bef46f053743cb6f4 -size 19357530 +oid sha256:23421b414b6f11d12368bb5bb5fc13d904b8dbe805d93e43115fa494788f74a8 +size 12995971 diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 4bec14bce..43dc11b61 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -14352,10 +14352,11 @@ ++ ride :: end-to-end compiler |= {typ/type txt/@} ^- (pair type nock) - ~> %slog.[0 leaf/"ride: parsing"] + ~> %slog.[0 leaf/"ride-parsing"] =/ gen (ream txt) - ~> %slog.[0 leaf/"ride: compiling"] - ~< %slog.[0 leaf/"ride: compiled"] + ~> %slog.[0 leaf/"ride-compiling"] + =- ~> %slog.[0 leaf/"ride-compiled"] + - (~(mint ut typ) %noun gen) :: :::: 5e: caching compiler diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 0619dddf1..d14592625 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -161,6 +161,7 @@ hez=(unit duct) :: sync duct cez=(map @ta crew) :: permission groups pud=(unit [=desk =yoki]) :: pending update + pun=(list move) :: upgrade moves == :: :: :: Object store. @@ -3878,7 +3879,26 @@ :: %trim [~ ..^$] :: - %vega [~ ..^$] + %vega + :: wake all desks, then send pending notifications + :: + =^ wake-moves ..^$ + =/ desks=(list [=ship =desk]) + %+ welp + (turn ~(tap by dos.rom.ruf) |=([=desk *] [our desk])) + %- zing + %+ turn ~(tap by hoy.ruf) + |= [=ship =rung] + %+ turn ~(tap by rus.rung) + |= [=desk *] + [ship desk] + |- ^+ [*(list move) ..^^$] + ?~ desks + [~ ..^^$] + =^ moves-1 ..^^$ $(desks t.desks) + =^ moves-2 ruf abet:wake:((de our now ski hen ruf) [ship desk]:i.desks) + [(weld moves-1 moves-2) ..^^$] + [(welp wake-moves pun.ruf) ..^$(pun.ruf ~)] :: ?(%warp %werp) :: capture whether this read is on behalf of another ship @@ -3927,10 +3947,31 @@ ++ load-2-to-3 |= =state-2 ^- state-3 - =- state-2(- %3, rom rom.-, hoy hoy.-, |7 pud.-) - :+ ^- pud=(unit [=desk =yoki]) - ~? ?=(^ act.state-2) clay-canceling-write+hen.u.act.state-2 - ~ + =- state-2(- %3, rom rom.-, hoy hoy.-, |7 [pud=~ pun.-]) + :+ ^- pun=(list move) + %+ welp + ?~ act.state-2 + ~ + ?. =(%merge -.eval-data.u.act.state-2) + ~ + =/ err + :- %ford-fusion + [leaf+"active merge canceled due to upgrade to ford fusion" ~] + [hen.u.act.state-2 %slip %b %drip !>([%mere %| err])]~ + ^- (list move) + %+ murn ~(tap to cue.state-2) + :: use ^ so we don't have to track definition of +task + :: + |= [=duct task=^] + ^- (unit move) + ?. =(%merg -.task) + ~& "queued clay write canceled due to upgrade to ford fusion:" + ~& [duct [- +<]:task] + ~ + =/ err + :- %ford-fusion + [leaf+"queued merge canceled due to upgrade to ford fusion" ~] + `[duct %slip %b %drip !>([%mere %| err])] ^- rom=room :- hun.rom.state-2 %- ~(run by dos.rom.state-2) @@ -3988,7 +4029,7 @@ mon=(map term beam) :: mount points hez=(unit duct) :: sync duct cez=(map @ta crew) :: permission groups - cue=(qeu [=duct task=*]) :: queued requests + cue=(qeu [=duct task=^]) :: queued requests act=active-write-2 :: active write == :: +$ room-2 @@ -4030,7 +4071,7 @@ $: waiting=(qeu [inx=@ud rut=(unit rand)]) eval-data=(unit [inx=@ud rut=(unit rand) eval-form=*]) == - +$ active-write-2 (unit [hen=duct *]) + +$ active-write-2 (unit [hen=duct req=* eval-data=^]) -- :: ++ scry :: inspect From e34a1a2e616341ef0b8c1cdd215585c4891e9ecb Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 11 Jun 2020 22:54:19 -0700 Subject: [PATCH 204/280] arvo: filter old-arvo effects for %veer --- pkg/arvo/sys/arvo.hoon | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index f5455f220..df866a7f1 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1059,7 +1059,13 @@ ram ~| ram+ram =| nub=debt:le:part - [%345 nub(out ;;((list ovum) ram))] + =/ =plan:le:part + :- [%$ ~] + %+ turn ;;((list ovum) ram) + |= ovo=ovum + ^- move + [[p.ovo]~ %give %& %noun q.ovo] + [%345 nub(run [plan]~)] :: $prim: old $pram :: +drum: upgrade $prim to $pram, incompatible :: From 05f0e47f6863712cd0661d52688267355a60aed3 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 11 Jun 2020 22:55:08 -0700 Subject: [PATCH 205/280] ames: fix larval +load for fusion --- bin/solid.pill | 4 +-- pkg/arvo/sys/hoon.hoon | 7 ++-- pkg/arvo/sys/vane/ames.hoon | 68 +++++++++++++++++++++++++++++++------ 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 9d6e38112..7e53e7691 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:23421b414b6f11d12368bb5bb5fc13d904b8dbe805d93e43115fa494788f74a8 -size 12995971 +oid sha256:688a6812958f5328ce0409b9808cb5f3479e3d01eaf467d97e0dca54902a749b +size 12994298 diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 43dc11b61..4bec14bce 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -14352,11 +14352,10 @@ ++ ride :: end-to-end compiler |= {typ/type txt/@} ^- (pair type nock) - ~> %slog.[0 leaf/"ride-parsing"] + ~> %slog.[0 leaf/"ride: parsing"] =/ gen (ream txt) - ~> %slog.[0 leaf/"ride-compiling"] - =- ~> %slog.[0 leaf/"ride-compiled"] - - + ~> %slog.[0 leaf/"ride: compiling"] + ~< %slog.[0 leaf/"ride: compiled"] (~(mint ut typ) %noun gen) :: :::: 5e: caching compiler diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 290d156ab..f6fdcc964 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -376,6 +376,16 @@ veb=_veb-all-off == :: ++$ queued-event-1 + $% [%call =duct type=* wrapped-task=(hobo task-1)] + [%take =wire =duct type=* =sign] + == +:: ++$ task-1 + $% [%wegh ~] + task + == +:: +$ ames-state-1 $: peers=(map ship ship-state-1) =unix=duct @@ -520,45 +530,81 @@ :: lifecycle arms; mostly pass-throughs to the contained adult ames :: ++ scry scry:adult-core - ++ stay [%3 %larva queued-events ames-state.adult-gate] + ++ stay [%4 %larva queued-events ames-state.adult-gate] ++ load + |^ |= $= old - $% $: %3 - $% [%larva events=_queued-events state=_ames-state.adult-gate] + $% $: %4 + $% $: %larva + events=(qeu queued-event) + state=_ames-state.adult-gate + == + [%adult state=_ames-state.adult-gate] + == == + :: + $: %3 + $% $: %larva + events=(qeu queued-event-1) + state=_ames-state.adult-gate + == [%adult state=_ames-state.adult-gate] == == :: $: %2 - $% [%larva events=_queued-events state=ames-state-2] + $% [%larva events=(qeu queued-event-1) state=ames-state-2] [%adult state=ames-state-2] == == :: - $% [%larva events=_queued-events state=ames-state-1] + $% [%larva events=(qeu queued-event-1) state=ames-state-1] [%adult state=ames-state-1] == == ?- old + [%4 %adult *] (load:adult-core %4 state.old) [%3 %adult *] (load:adult-core %3 state.old) [%2 %adult *] (load:adult-core %2 state.old) [%adult *] (load:adult-core %1 state.old) :: - [%3 %larva *] + [%4 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. queued-events events.old + =. adult-gate (load:adult-core %4 state.old) + larval-gate + :: + [%3 %larva *] + ~> %slog.1^leaf/"ames: larva: load" + =. queued-events (queued-events-1-to-4 events.old) =. adult-gate (load:adult-core %3 state.old) larval-gate :: [%2 %larva *] ~> %slog.1^leaf/"ames: larva: load" - =. queued-events events.old + =. queued-events (queued-events-1-to-4 events.old) =. adult-gate (load:adult-core %2 state.old) larval-gate :: [%larva *] ~> %slog.0^leaf/"ames: larva: load" - =. queued-events events.old + =. queued-events (queued-events-1-to-4 events.old) =. adult-gate (load:adult-core %1 state.old) larval-gate == + :: + ++ queued-events-1-to-4 + |= events=(qeu queued-event-1) + ^- (qeu queued-event) + %- ~(gas to *(qeu queued-event)) + ^- (list queued-event) + %+ murn ~(tap to events) + |= e=queued-event-1 + ^- (unit queued-event) + ?. ?=(%call -.e) + `e + ?: ?=([%wegh ~] wrapped-task.e) + ~ + ?: ?=([%soft %wegh ~] wrapped-task.e) + ~ + `e + -- -- :: adult ames, after metamorphosis from larva :: @@ -633,7 +679,7 @@ [moves ames-gate] :: +stay: extract state before reload :: -++ stay [%3 %adult ames-state] +++ stay [%4 %adult ames-state] :: +load: load in old state after reload :: ++ load @@ -641,13 +687,15 @@ $% [%1 ames-state-1] [%2 ames-state-2] [%3 ^ames-state] + [%4 ^ames-state] == |^ ^+ ames-gate :: =? old-state ?=(%1 -.old-state) %2^(state-1-to-2 +.old-state) =? old-state ?=(%2 -.old-state) %3^(state-2-to-3 +.old-state) + =? old-state ?=(%3 -.old-state) %4^+.old-state :: - ?> ?=(%3 -.old-state) + ?> ?=(%4 -.old-state) ames-gate(ames-state +.old-state) :: ++ state-1-to-2 From 8cf4e4bb3810851486da68b14f81e60c2e1b0953 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 13 Jun 2020 00:16:09 -0400 Subject: [PATCH 206/280] gall: retry if agent fails first build --- pkg/arvo/sys/vane/gall.hoon | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 829c84541..93bc674b2 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -584,16 +584,26 @@ =/ tim (slav da+dat) =/ =beak [(slav %p her) desk da+tim] ?> ?=([?(%b %c) %writ *] sign-arvo) - ?^ p.sign-arvo - =/ cag=cage r.u.p.sign-arvo - ?. =(%vase p.cag) - (mo-give %onto |+[leaf+"gall: invalid %writ {} for {}"]~) - =/ res (mule |.(!<(agent !<(vase q.cag)))) - ?: ?=(%| -.res) - (mo-give %onto |+[leaf+"gall: {}" p.res]) - =. mo-core (mo-receive-core dap beak p.res) - (mo-subscribe-to-agent-builds tim) - (mo-give %onto |+[leaf+"gall: failed to build agent {}"]~) + |^ ^+ mo-core + ?~ p.sign-arvo + (fail leaf+"gall: failed to build agent {}" ~) + =/ cag=cage r.u.p.sign-arvo + ?. =(%vase p.cag) + (fail leaf+"gall: bad %writ {} for {}" ~) + =/ res (mule |.(!<(agent !<(vase q.cag)))) + ?: ?=(%| -.res) + (fail leaf+["gall: bad agent {}"] p.res) + =. mo-core (mo-receive-core dap beak p.res) + (mo-subscribe-to-agent-builds tim) + :: + ++ fail + |= =tang + ^+ mo-core + =. mo-core (mo-give %onto |+tang) + =/ =case [%da tim] + =/ =wire /sys/cor/[dap]/[her]/[desk]/(scot case) + (mo-pass wire %c %warp p.beak desk ~ %next %a case /app/[dap]/hoon) + -- :: +mo-handle-sys-lyv: handle notice that agents have been rebuilt :: ++ mo-handle-sys-lyv From 3c5541432a561c6d5cbc9382297d39c16ef01b1b Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 12 Jun 2020 21:12:36 -0700 Subject: [PATCH 207/280] chat-hook: upgrade state to stop storing cards The card type has changed, so we need a state upgrade. As I understand it, these existed for a particular upgrade to get around the fact that Ford Turbo updates apps in random order. In Ford Fusion, all apps are started in parallel before any of their moves are emitted, so this is no longer a problem. Since these will no longer be needed and they don't load properly when +card changes, we deleted them. While trying to find a bug that I introduced, I refactored +on-load a little bit -- I can revert this if it's confusing. --- pkg/arvo/app/chat-hook.hoon | 63 ++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index c582ea550..2f45b696b 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -14,11 +14,17 @@ +$ versioned-state $% state-0 state-1 + state-2 + == +:: ++$ state-2 + $: %2 + state-base == :: +$ state-1 $: %1 - loaded-cards=(list card) + loaded-cards=* state-base == +$ state-0 [%0 state-base] @@ -39,7 +45,7 @@ $% [%chat-update update:store] == -- -=| state-1 +=| state-2 =* state - :: %- agent:dbug @@ -66,28 +72,30 @@ ^- (quip card _this) |^ =/ old !<(versioned-state old-vase) - ?: ?=(%1 -.old) - :_ this(state old) - %+ murn ~(tap by wex.bol) - |= [[=wire =ship =term] *] - ^- (unit card) - ?. &(?=([%mailbox *] wire) =(our.bol ship) =(%chat-store term)) - ~ - `[%pass wire %agent [our.bol %chat-store] %leave ~] - :: path structure ugprade logic - :: - =/ keys=(set path) (scry:cc (set path) %chat-store /keys) - =/ upgraded-state - %* . *state-1 - synced synced - invite-created invite-created - allow-history allow-history - loaded-cards - %- zing - ^- (list (list card)) - %+ turn ~(tap in keys) generate-cards - == - [loaded-cards.upgraded-state this(state upgraded-state)] + =^ moves state + ^- (quip card state-2) + ?: ?=(%2 -.old) + ^- (quip card state-2) + `old + :: + ?: ?=(%1 -.old) + ^- (quip card state-2) + :_ [%2 +>.old] + %+ murn ~(tap by wex.bol) + |= [[=wire =ship =term] *] + ^- (unit card) + ?. &(?=([%mailbox *] wire) =(our.bol ship) =(%chat-store term)) + ~ + `[%pass wire %agent [our.bol %chat-store] %leave ~] + ^- (quip card state-2) + :: path structure ugprade logic + :: + =/ keys=(set path) (scry:cc (set path) %chat-store /keys) + :_ [%2 +.old] + %- zing + ^- (list (list card)) + (turn ~(tap in keys) generate-cards) + [moves this] :: ++ generate-cards |= old-chat=path @@ -233,10 +241,7 @@ ?+ mark (on-poke:def mark vase) %json (poke-json:cc !<(json vase)) %chat-action (poke-chat-action:cc !<(action:store vase)) - %noun - ?: =(%store-load q.vase) - [loaded-cards.state state(loaded-cards ~)] - [~ state] + %noun [~ state] :: %chat-hook-action (poke-chat-hook-action:cc !<(action:hook vase)) @@ -457,7 +462,7 @@ (chats-of-group pax) |= chat=path ^- (list card) - =/ owner (~(get by synced) chat) + =/ owner (~(get by synced.state) chat) ?~ owner ~ ?. =(u.owner our.bol) ~ %- zing From 21c0f77321440c09b18470b6e181b15531fb78f7 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 12 Jun 2020 21:38:50 -0700 Subject: [PATCH 208/280] arvo: add +mure for compiling hoon/arvo Also use +mure in clay for building cores --- pkg/arvo/sys/arvo.hoon | 17 ++++++++++------- pkg/arvo/sys/hoon.hoon | 9 +++++++++ pkg/arvo/sys/vane/clay.hoon | 6 ++++-- pkg/arvo/sys/vane/gall.hoon | 2 +- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index df866a7f1..a63269508 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1263,7 +1263,7 @@ :: =/ raw ~> %slog.[0 leaf+"vega: compiling hoon"] - (ride %noun u.hun) + (mure |.((ride %noun u.hun))) :: activate the new compiler gate, producing +ride :: =/ cop .*(0 +.raw) @@ -1274,12 +1274,14 @@ ?> |(=(nex hoon-version) =(+(nex) hoon-version)) :: if we're upgrading language versions, recompile the compiler :: - => ?: =(nex hoon-version) - [hot=`*`raw .] - ~> %slog.[0 leaf+"vega: recompiling hoon {}k"] - ~& [%hoon-compile-upgrade nex] - =/ hot (slum cop [%noun hun]) - .(cop .*(0 +.hot)) + =^ hot=* cop + ?: =(nex hoon-version) + [raw cop] + ~> %slog.[0 leaf+"vega: recompiling hoon {}k"] + ~& [%hoon-compile-upgrade nex] + %- mure |. + =/ hot (slum cop [%noun hun]) + [hot .*(0 +.hot)] :: extract the hoon core from the outer gate (+ride) :: =/ hoc .*(cop [%0 7]) @@ -1292,6 +1294,7 @@ :: =/ rav ~> %slog.[0 leaf+"vega: compiling kernel {(scow %p (mug hyp))}"] + %- mure |. (slum cop [hyp van]) :: activate arvo, and extract the arvo core from the outer gate :: diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 4bec14bce..50f3d301b 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -12035,6 +12035,15 @@ ?~ a !! ~_(i.a $(a t.a)) :: +++ mure + |* =(trap *) + ^+ $:trap + =/ res (mule trap) + ?- -.res + %& p.res + %| (mean leaf+"mure: road" p.res) + == +:: ++ slew :: get axis in vase |= {axe/@ vax/vase} ^- (unit vase) ?. |- ^- ? diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index d14592625..e160638bf 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -379,7 +379,6 @@ `[(weld pax pat) %mime !>(u.mim)] :: [deletes changes] -:: -- => ~% %clay + ~ |% @@ -757,7 +756,7 @@ =^ sut=vase nub (run-tauts sut %lib lib.pile) =^ sut=vase nub (run-raw sut raw.pile) =^ sut=vase nub (run-bar sut bar.pile) - =/ res=vase (slap sut hoon.pile) + =/ res=vase (mure |.((slap sut hoon.pile))) [res nub] :: ++ parse-pile @@ -1545,6 +1544,7 @@ zuse.u.fer :: ++ build-hoon + %- mure |. ~> %slog.0^leaf+"clay: building hoon on {}" =/ gen ~> %mean.%hoon-parse-fail @@ -1554,6 +1554,7 @@ :: ++ build-arvo |= hoon=vase + %- mure |. ~> %slog.0^leaf+"clay: building arvo on {}" =/ gen ~> %mean.%arvo-parse-fail @@ -1563,6 +1564,7 @@ :: ++ build-zuse |= arvo=vase + %- mure |. ~> %slog.0^leaf+"clay: building zuse on {}" =/ gen ~> %mean.%zuse-parse-fail diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 93bc674b2..eeea1970d 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1,4 +1,4 @@ -!: :: %gall, agent execution +:: :: %gall, agent execution !? 163 :: :::: From 0447ac1ee19ec38b87dc2aedbc826d481852ea34 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 12 Jun 2020 21:40:13 -0700 Subject: [PATCH 209/280] arvo: add dummy ford and fix whey scry --- pkg/arvo/sys/arvo.hoon | 2 +- pkg/arvo/sys/vane/ford.hoon | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 pkg/arvo/sys/vane/ford.hoon diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index a63269508..5346c0262 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -752,7 +752,7 @@ %+ turn von =/ bem=beam [[our %home da+now] /whey] |= [lal=@tas =vane] - =/ met (need (need (peek ** ~ lal bem))) + =/ met (need (need (peek ** ~ (rsh 3 5 lal) bem))) lal^|+;;((list mass) q.q.met) :: :+ %caches %| diff --git a/pkg/arvo/sys/vane/ford.hoon b/pkg/arvo/sys/vane/ford.hoon new file mode 100644 index 000000000..6a1d6c4e2 --- /dev/null +++ b/pkg/arvo/sys/vane/ford.hoon @@ -0,0 +1,10 @@ +!: +|= pit=vase +|= [our=ship now=@da eny=@uvJ ski=sley] +|% +++ call |=(* ~&(%ford-call-gone `..^$)) +++ take |=(* ~&(%ford-take-gone `..^$)) +++ scry |=(* ``mass+!>(*(list mass))) +++ stay ~ +++ load |=(* ..^$) +-- From 90f3c7d2a1e862fe89b7c1fc812466bbdd047bc8 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 12 Jun 2020 21:40:32 -0700 Subject: [PATCH 210/280] clay: build reef to prime reef-cache on inital OTA --- pkg/arvo/sys/vane/clay.hoon | 103 +++++++++++++++++++++++++++++++++--- 1 file changed, 95 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index e160638bf..d644001de 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1575,7 +1575,7 @@ ++ same-as-home |= =path ^- ? - =/ our=lobe + =/ our-lobe=lobe =/ datum (~(got by data) path) ?- -.datum %& (page-to-lobe %hoon (page-to-cord p.datum)) @@ -1583,7 +1583,7 @@ == =/ =dome dom:(~(got by dos.rom) %home) =/ =yaki (~(got by hut.ran) (~(got by hit.dome) let.dome)) - =(`our (~(get by q.yaki) path)) + =(`our-lobe (~(get by q.yaki) path)) -- :: ++ page-to-cord @@ -1604,11 +1604,11 @@ =/ datum (~(got by data) path) ?- -.datum %& (page-to-cord p.datum) - %| (lobe-to-cord data p.datum) + %| (lobe-to-cord p.datum) == :: ++ lobe-to-cord - |= [data=(map path (each page lobe)) =lobe] + |= =lobe ^- @t =- ?:(?=(%& -<) p.- (of-wain:format p.-)) |- ^- (each @t wain) @@ -1620,7 +1620,7 @@ %+ lurk:differ =- ?:(?=(%| -<) p.- (to-wain:format p.-)) $(lobe q.q.blob) - ;;((urge:clay cord) r.blob) + ;;((urge cord) q.r.blob) == :: :: Updated q.yaki @@ -3949,6 +3949,7 @@ ++ load-2-to-3 |= =state-2 ^- state-3 + |^ =- state-2(- %3, rom rom.-, hoy hoy.-, |7 [pud=~ pun.-]) :+ ^- pun=(list move) %+ welp @@ -3976,12 +3977,18 @@ `[duct %slip %b %drip !>([%mere %| err])] ^- rom=room :- hun.rom.state-2 - %- ~(run by dos.rom.state-2) - |= =dojo-2 + %- ~(urn by dos.rom.state-2) + |= [=desk =dojo-2] ^- dojo =- dojo-2(dom -) ^- dome - [ank let hit lab mim fod=*ford-cache fer=~]:[dom.dojo-2 .] + =/ fer=(unit reef-cache) + ?~ let.dom.dojo-2 + ~ + =/ =yaki + (~(got by hut.ran.state-2) (~(got by hit.dom.dojo-2) let.dom.dojo-2)) + `(build-reef desk q.yaki) + [ank let hit lab mim fod=*ford-cache fer=fer]:[dom.dojo-2 .] ^- hoy=(map ship rung) %- ~(run by hoy.state-2) |= =rung-2 @@ -4020,6 +4027,86 @@ (~(del by fod.rin) p.u.got) == $(pud t.pud) + :: + ++ build-reef + |= [=desk data=(map path lobe)] + ^- reef-cache + ~> %slog.0^leaf+"clay: building reef on {}" + ?: !=(%homer desk) + [!>(..ride) !>(..is) !>(..zuse)] + |^ + =/ [home=? hoon=vase] + ?: (same-as-home /sys/hoon/hoon) + &+!>(..ride) + |+build-hoon + :- hoon + =/ [home=? arvo=vase] + ?: &(home (same-as-home /sys/arvo/hoon)) + &+!>(..is) + |+(build-arvo hoon) + :- arvo + ?: &(home (same-as-home /sys/zuse/hoon)) + !>(..zuse) + (build-zuse arvo) + :: + ++ build-hoon + %- mure |. + ~> %slog.0^leaf+"clay: building hoon on {}" + =/ gen + ~> %mean.%hoon-parse-fail + %+ rain /sys/hoon/hoon + (lobe-to-cord (~(got by data) /sys/hoon/hoon)) + ~> %mean.%hoon-compile-fail + (slot 7 (slap !>(0) gen)) + :: + ++ build-arvo + |= hoon=vase + %- mure |. + ~> %slog.0^leaf+"clay: building arvo on {}" + =/ gen + ~> %mean.%arvo-parse-fail + %+ rain /sys/arvo/hoon + (lobe-to-cord (~(got by data) /sys/arvo/hoon)) + ~> %mean.%arvo-compile-fail + (slap (slap hoon gen) (ream '..is')) + :: + ++ build-zuse + |= arvo=vase + %- mure |. + ~> %slog.0^leaf+"clay: building zuse on {}" + =/ gen + ~> %mean.%zuse-parse-fail + %+ rain /sys/zuse/hoon + (lobe-to-cord (~(got by data) /sys/zuse/hoon)) + ~> %mean.%zuse-compile-fail + (slap arvo gen) + :: + ++ same-as-home + |= =path + ^- ? + =/ our-lobe=lobe (~(got by data) path) + =/ =dome-2 dom:(~(got by dos.rom.state-2) %home) + =/ =yaki (~(got by hut.ran.state-2) (~(got by hit.dome-2) let.dome-2)) + =(`our-lobe (~(get by q.yaki) path)) + :: + ++ lobe-to-cord + |= =lobe + ^- @t + =- ?:(?=(%& -<) p.- (of-wain:format p.-)) + |- ^- (each @t wain) + =/ =blob (~(got by lat.ran.state-2) lobe) + ?- -.blob + %direct [%& ;;(@t q.q.blob)] + %delta + :- %| + %+ lurk:differ + =- ?:(?=(%| -<) p.- (to-wain:format p.-)) + $(lobe q.q.blob) + ~| diff=r.blob + ;;((urge cord) q.r.blob) + == + -- + -- :: +$ any-state $%(state-3 state-2) +$ state-3 [%3 raft] From 879d846487471cdbdf32fb4f6e3687ce52db7d24 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 13 Jun 2020 01:50:12 -0400 Subject: [PATCH 211/280] arvo: spam %vega on kernel reload --- pkg/arvo/sys/arvo.hoon | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 5346c0262..c20bc3770 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -561,6 +561,8 @@ van=(map term vane) == +* this . + ++ plot run.nub + ++ then |=(paz=(list plan) this(run (weld run paz))) ++ abed |=(nib=debt this(nub nib)) :: +abet: finalize loop :: @@ -1080,7 +1082,7 @@ =/ fyn (turn nyf |=([a=@tas b=vise] [a (slim b)])) =/ rum (drum rim) (load who now yen rum (slim dub) fyn) -:: +load: load compatible +:: +load: load compatible, notifying vanes :: ++ load |= [who=ship now=@da yen=@ ram=pram dub=vase nyf=pane] @@ -1093,7 +1095,8 @@ == =. ram (dram ram) ?> ?=([%345 *] ram) - (leap now (lead now `nub.ram)) + =/ run plot:(spam:(lead now ~) [//arvo %vega ~]) + (leap now (then:(lead now `nub.ram) run)) :: +peek: external inspect :: ++ peek From 8f8ec8bcc5b413e7bed66a5f747ac4e76ba3ab44 Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 14 Jun 2020 18:48:27 +0200 Subject: [PATCH 212/280] language-server: parse commands permissively Parses commands as arbitrary strings, instead of strictly symbols. --- pkg/arvo/lib/language-server/complete.hoon | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/lib/language-server/complete.hoon b/pkg/arvo/lib/language-server/complete.hoon index 42f1f419d..01d54c226 100644 --- a/pkg/arvo/lib/language-server/complete.hoon +++ b/pkg/arvo/lib/language-server/complete.hoon @@ -248,15 +248,15 @@ :: ++ get-id |= [pos=@ud txt=tape] - ^- [forward=(unit term) backward=(unit term) id=(unit term)] - =/ forward=(unit term) - %+ scan `tape`(slag pos txt) - ;~(sfix (punt sym) (star ;~(pose prn (just `@`10)))) - =/ backward=(unit term) + ^- [forward=(unit @t) backward=(unit @t) id=(unit @t)] + =/ seek + ;~(sfix (punt (cook crip (star prn))) (star ;~(pose prn (just `@`10)))) + =/ forward=(unit @t) + (scan (slag pos txt) seek) + =/ backward=(unit @t) %- (lift |=(t=@tas (swp 3 t))) - %+ scan `tape`(flop (scag pos txt)) - ;~(sfix (punt sym) (star ;~(pose prn (just `@`10)))) - =/ id=(unit term) + (scan (flop (scag pos txt)) seek) + =/ id=(unit @t) ?~ forward ?~ backward ~ From d4b4fe67f35299f06e159f5d98efd6ab68050cff Mon Sep 17 00:00:00 2001 From: Fang Date: Sun, 14 Jun 2020 23:36:03 +0200 Subject: [PATCH 213/280] shoe: print tab options less eagerly Turns out that having these pop up on every tab-press is really annoying, and you usually only want them when it didn't manage to autocomplete anything. --- pkg/arvo/lib/shoe.hoon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/lib/shoe.hoon b/pkg/arvo/lib/shoe.hoon index e8ab3aecb..2bffc2f7a 100644 --- a/pkg/arvo/lib/shoe.hoon +++ b/pkg/arvo/lib/shoe.hoon @@ -267,7 +267,6 @@ [%det clear] == :: - ::NOTE cargo-culted ++ tab |= pos=@ud ^- (quip card _cli-state) @@ -287,7 +286,9 @@ %+ add pos (met 3 (fall forward '')) =| cards=(list card) - =? cards ?=(^ options) + :: only render the option list if we couldn't complete anything + :: + =? cards &(?=(~ to-send) ?=(^ options)) [(effect %tab options) cards] |- ^- (quip card _cli-state) ?~ to-send From 01eee03340530b49cc78195e52b2c69d419fbc39 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 16 Jun 2020 03:29:17 -0400 Subject: [PATCH 214/280] kiln: WIP state as tuple --- pkg/arvo/app/hood.hoon | 295 +++++++++++------------------------- pkg/arvo/gen/hood/load.hoon | 15 -- pkg/arvo/lib/hood/drum.hoon | 27 ++-- pkg/arvo/lib/hood/helm.hoon | 106 +++++-------- pkg/arvo/lib/hood/kiln.hoon | 20 +-- 5 files changed, 155 insertions(+), 308 deletions(-) delete mode 100644 pkg/arvo/gen/hood/load.hoon diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index e57234303..98a5cef37 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -1,51 +1,22 @@ -:: :: :: -:::: /hoon/hood/app :: :: - :: :: :: -/? 310 :: zuse version /- *sole -/+ sole :: libraries - :: XX these should really be separate apps, as - :: none of them interact with each other in - :: any fashion; however, to reduce boot-time - :: complexity and work around the current - :: non-functionality of end-to-end acknowledgments, - :: they have been bundled into :hood - :: - :: |command handlers -/+ hood-helm, hood-kiln, hood-drum, hood-write -:: :: :: -:::: :: :: - :: :: :: +/+ sole, default-agent +/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln +:: |% -++ hood-module - :: each hood module follows this general shape - => |% - +$ part [%module %0 pith] - +$ pith ~ - ++ take - |~ [wire sign-arvo] - *(quip card:agent:gall part) - ++ take-agent - |~ [wire gift:agent:gall] - *(quip card:agent:gall part) - ++ poke - |~ [mark vase] - *(quip card:agent:gall part) - -- - |= [bowl:gall own=part] - |_ moz=(list card:agent:gall) - ++ abet [(flop moz) own] - -- ++$ state + $: %7 + drum=state:drum + helm=state:helm + kiln=state:kiln + == -- -:: :: :: -:::: :: :: state handling - :: :: :: -!: -=> |% :: +:: +=> |% + +$ any-state $%(state hood-old) ++ hood-old :: unified old-state {?($1 $2 $3 $4 $5 $6) lac/(map @tas hood-part-old)} ++ hood-1 :: unified state - {$6 lac/(map @tas hood-part)} :: + {$6 lac/(map @tas hood-part)} ++ hood-good :: extract specific =+ hed=$:hood-head |@ ++ $ @@ -57,183 +28,101 @@ $write ?>(?=($write -.paw) `part:hood-write`paw) == -- - ++ hood-head _-:$:hood-part :: initialize state - ++ hood-make :: - =+ $:{our/@p hed/hood-head} :: - |@ ++ $ - ?- hed - $drum (make:hood-drum our) - $helm *part:hood-helm - $kiln *part:hood-kiln - $write *part:hood-write - == - -- ++ hood-part-old - $% [%drum part-old:hood-drum] - [%helm part-old:hood-helm] - [%kiln part-old:hood-kiln] - [%write part-old:hood-write] + $% [%drum part-old:drum] + [%helm part-old:helm] + [%kiln part-old:kiln] + [%write part-old:write] + == + ++ hood-part + $% {$drum $2 pith-2:drum} + {$helm $0 pith:helm} + {$kiln $0 pith:kiln} + {$write $0 pith:write} == - ++ hood-port :: state transition - |: paw=$:hood-part-old ^- hood-part :: - paw :: - :: :: - ++ hood-part :: current module state - $% {$drum $2 pith-2:hood-drum} :: - {$helm $0 pith:hood-helm} :: - {$kiln $0 pith:hood-kiln} :: - {$write $0 pith:hood-write} :: - == :: - -- :: -:: :: :: -:::: :: :: app proper - :: :: :: -^- agent:gall -=| hood-1 :: module states -=> |% - ++ help - |= hid/bowl:gall - |% - ++ able :: find+make part - =+ hed=$:hood-head - |@ ++ $ - =+ rep=(~(get by lac) hed) - =+ par=?^(rep u.rep `hood-part`(hood-make our.hid hed)) - ((hood-good hed) par) - -- - :: - ++ ably :: save part - =+ $:{(list) hood-part} - |@ ++ $ - [+<- (~(put by lac) +<+< +<+)] - -- - :: :: :: - :::: :: :: generic handling - :: :: :: - ++ prep - |= old/(unit hood-old) ^- (quip _!! _+>) - :- ~ - ?~ old +> - +>(lac (~(run by lac.u.old) hood-port)) - :: - ++ poke-hood-load :: recover lost brain - |= dat/hood-part - ?> =(our.hid src.hid) - ~& loaded+-.dat - [~ (~(put by lac) -.dat dat)] - :: - :: - ++ from-module :: create wrapper - |* _[identity=%module start=..$ finish=_abet]:(hood-module) - =- [wrap=- *start] :: usage (wrap handle-arm):from-foo - |* handle/_finish - |= a=_+<.handle - =. +>.handle (start hid (able identity)) - ^- (quip card:agent:gall _lac) - %- ably - ^- (quip card:agent:gall hood-part) - (handle a) - :: per-module interface wrappers - ++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum)) - ++ from-helm (from-module %helm [..$ _abet]:(hood-helm)) - ++ from-kiln (from-module %kiln [..$ _abet]:(hood-kiln)) - ++ from-write (from-module %write [..$ _abet]:(hood-write)) - -- -- -|_ hid/bowl:gall :: gall environment -++ on-init - `..on-init :: -++ on-save - !>([%5 lac]) +^- agent:gall +=| =state +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bol) + drum-core (drum bowl drum.state) + helm-core (helm bowl helm.state) + kiln-core (kiln bowl kiln.state) :: +++ on-fail on-fail:def +++ on-init on-init:def +++ on-leave on-leave:def +++ on-peek on-peek:def +:: +++ on-save !>(state) ++ on-load |= =old-state=vase - =/ old-state !<(hood-old old-state-vase) - =^ cards lac - =. lac lac.old-state - ?- -.old-state - %1 ((wrap on-load):from-drum:(help hid) %1) - %2 ((wrap on-load):from-drum:(help hid) %2) - %3 ((wrap on-load):from-drum:(help hid) %3) - %4 ((wrap on-load):from-drum:(help hid) %4) - %5 - =/ start ..$:(from-kiln) - =/ old-kiln-part (~(got by lac.old-state) %kiln) - ?> ?=(%kiln -.old-kiln-part) - %- ably - (on-load:(start hid *part:hood-kiln) old-kiln-part) - :: - %6 `lac - == - [cards ..on-init] + =/ old-state !<(any-state old-state-vase) + :: TODO rewrite + [~ this] +:: =^ cards lac +:: =. lac lac.old-state +:: ?- -.old-state +:: %1 ((wrap on-load):from-drum:(help hid) %1) +:: %2 ((wrap on-load):from-drum:(help hid) %2) +:: %3 ((wrap on-load):from-drum:(help hid) %3) +:: %4 ((wrap on-load):from-drum:(help hid) %4) +:: %5 +:: =/ start ..$:(from-kiln) +:: =/ old-kiln-part (~(got by lac.old-state) %kiln) +:: ?> ?=(%kiln -.old-kiln-part) +:: %- ably +:: (on-load:(start hid *part:hood-kiln) old-kiln-part) +:: :: +:: %6 `lac +:: == +:: [cards ..on-init] :: ++ on-poke + |^ |= [=mark =vase] - ^- (quip card:agent:gall agent:gall) - =/ h (help hid) - =^ cards lac - ?: =(%helm (end 3 4 mark)) - ((wrap poke):from-helm:h mark vase) - ?: =(%drum (end 3 4 mark)) - ((wrap poke):from-drum:h mark vase) - ?: =(%kiln (end 3 4 mark)) - ((wrap poke):from-kiln:h mark vase) - ?: =(%write (end 3 5 mark)) - ((wrap poke):from-write:h mark vase) - :: XX should rename and move to libs - :: - ?+ mark ~|([%poke-hood-bad-mark mark] !!) - %hood-load (poke-hood-load:h !<(hood-part vase)) - %atom ((wrap poke-atom):from-helm:h !<(@ vase)) - %dill-belt ((wrap poke-dill-belt):from-drum:h !<(dill-belt:dill vase)) - %dill-blit ((wrap poke-dill-blit):from-drum:h !<(dill-blit:dill vase)) - %hood-sync ((wrap poke-sync):from-kiln:h !<([desk ship desk] vase)) - == - [cards ..on-init] + ^- step:agent:gall + :: + =/ fin (end 3 4 mark) + ?: =(%drum fin) (poke-drum mark vase) + ?: =(%helm fin) (poke-helm mark vase) + ?: =(%kiln fin) (poke-kiln mark vase) + :: + ?+ mark (on-poke:def mark vase) + %atom (poke-helm %helm-atom vase) + %dill-belt (poke-drum %drum-dill-belt vase) + %dill-blit (poke-drum %drum-dill-blit vase) + %hood-sync (poke-kiln %kiln-sync vase) + == + ++ poke-drum |=([mark vase] =^(c drum.state (poke:drum-core +<) [c this])) + ++ poke-helm |=([mark vase] =^(c helm.state (poke:helm-core +<) [c this])) + ++ poke-kiln |=([mark vase] =^(c kiln.state (poke:kiln-core +<) [c this])) + -- :: ++ on-watch |= =path - =/ h (help hid) - =^ cards lac - ?+ path ~|([%hood-bad-path wire] !!) - [%drum *] ((wrap peer):from-drum:h t.path) - == - [cards ..on-init] -:: -++ on-leave - |= path - `..on-init -:: -++ on-peek - |= path - *(unit (unit cage)) + ^- step:agent:gall + ?+ path (on-watch:def +<) + [%drum *] =^(c drum.state (peer:drum-core +<) [c this]) + == :: ++ on-agent |= [=wire =sign:agent:gall] - =/ h (help hid) - =^ cards lac - ?+ wire ~|([%hood-bad-wire wire] !!) - [%helm *] ((wrap take-agent):from-helm:h wire sign) - [%kiln *] ((wrap take-agent):from-kiln:h wire sign) - [%drum *] ((wrap take-agent):from-drum:h wire sign) - [%write *] ((wrap take-agent):from-write:h wire sign) - == - [cards ..on-init] + ^- step:agent:gall + ?+ wire ~|([%hood-bad-wire wire] !!) + [%drum *] =^(c drum.state (take-agent:drum-core +<) [c this])) + [%helm *] =^(c helm.state (take-agent:helm-core +<) [c this])) + [%kiln *] =^(c kiln.state (take-agent:kiln-core +<) [c this])) + == :: ++ on-arvo - |= [=wire =sign-arvo] - =/ h (help hid) - =^ cards lac - ?+ wire ~|([%hood-bad-wire wire] !!) - [%helm *] ((wrap take):from-helm:h t.wire sign-arvo) - [%drum *] ((wrap take):from-drum:h t.wire sign-arvo) - [%kiln *] ((wrap take-general):from-kiln:h t.wire sign-arvo) - [%write *] ((wrap take):from-write:h t.wire sign-arvo) - == - [cards ..on-init] -:: -++ on-fail - |= [term tang] - `..on-init + |= [=wire sign=sign-arvo] + ^- step:agent:gall + ?+ wire ~|([%hood-bad-wire wire] !!) + [%drum *] =^(c drum.state (take-arvo:drum-core +<) [c this])) + [%helm *] =^(c helm.state (take-arvo:helm-core +<) [c this])) + [%kiln *] =^(c kiln.state (take-arvo:kiln-core +<) [c this])) + == -- diff --git a/pkg/arvo/gen/hood/load.hoon b/pkg/arvo/gen/hood/load.hoon deleted file mode 100644 index 238e48bc6..000000000 --- a/pkg/arvo/gen/hood/load.hoon +++ /dev/null @@ -1,15 +0,0 @@ -:: Hood, generic: load named hood component's state from backup -:: -:::: /hoon/load/hood/gen - :: -/? 310 -:: -:::: - :: -:- %say -|= $: {now/@da eny/@uvJ byk/beak} - {{dap/term pas/@uw ~} ~} - == -:- %hood-load -~| %hood-load-stub -!! diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index b71ffa7d9..4d57e149c 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -8,8 +8,8 @@ :::: :: :: :: :: :: |% :: :: -+$ part [%drum %2 pith-2] :: -+$ part-old :: ++$ state [%3 pith-2] ++$ state-old :: $: %drum :: $% [%1 pith-1] :: [%2 pith-2] :: @@ -131,18 +131,16 @@ ^- (list gill:gall) [[our %dojo] [our %chat-cli]~] :: -++ make :: initial part +++ initial-state |= our/ship - ^- part - :* %drum - %2 + ^- state + :* %3 eel=(deft-fish our) ray=~ fur=~ bin=~ == :: -:: ++ en-gill :: gill to wire |= gyl/gill:gall ^- wire @@ -152,10 +150,9 @@ |= way/wire ^- gill:gall ?>(?=({@ @ ~} way) [(slav %p i.way) i.t.way]) -- +:: TODO: remove .ost :: -:::: - :: -|= {hid/bowl:gall part} :: main drum work +|: [bowl=*bowl:gall state=initial-state] =/ ost 0 =+ (~(gut by bin) ost *source) =* dev - @@ -220,12 +217,14 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-drum-bad-mark mark] !!) - %drum-put =;(f (f !<(_+<.f vase)) poke-put) - %drum-link =;(f (f !<(_+<.f vase)) poke-link) - %drum-unlink =;(f (f !<(_+<.f vase)) poke-unlink) + %drum-dill-belt =;(f (f !<(_+<.f vase)) poke-dill-belt) + %drum-dill-blit =;(f (f !<(_+<.f vase)) poke-dill-blit) %drum-exit =;(f (f !<(_+<.f vase)) poke-exit) - %drum-start =;(f (f !<(_+<.f vase)) poke-start) + %drum-link =;(f (f !<(_+<.f vase)) poke-link) + %drum-put =;(f (f !<(_+<.f vase)) poke-put) %drum-set-boot-apps =;(f (f !<(_+<.f vase)) poke-set-boot-apps) + %drum-start =;(f (f !<(_+<.f vase)) poke-start) + %drum-unlink =;(f (f !<(_+<.f vase)) poke-unlink) == :: ++ on-load diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index 1d1c908d9..bebab98ad 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -1,56 +1,29 @@ -:: :: :: -:::: /hoon/helm/hood/lib :: :: - :: :: :: -/? 310 :: version /- sole /+ pill -:: :: :: -:::: :: :: - :: :: :: -|% :: :: -+$ part {$helm $0 pith} :: helm state -+$ part-old part :: -++ pith :: helm content - $: hoc/(map bone session) :: consoles - == :: -++ session :: - $: say/sole-share:sole :: console state +=* card card:agent:gall +:: +|% ++$ state + $: %3 + say/sole-share:sole :: console state mud/(unit (sole-dialog:sole @ud)) :: console dialog mass-timer/{way/wire nex/@da tim/@dr} - == :: -:: :: :: -:::: :: :: - :: :: :: -++ hood-reset :: reset command - $~ :: -++ helm-verb :: reset command - $~ :: -++ hood-reload :: reload command - (list term) :: --- :: -:: :: :: -:::: :: :: - :: :: :: -|: $:{bowl:gall part} :: main helm work -=/ ost 0 -=+ sez=(~(gut by hoc) ost $:session) -=| moz=(list card:agent:gall) + == +-- +:: +|= [=bowl:gall =state] +=| moz=(list card) |% -++ abet - [(flop moz) %_(+<+.$ hoc (~(put by hoc) ost sez))] ++* this . +++ abet [(flop moz) state] +++ flog |=(=flog:dill (emit %pass /di %arvo %d %flog flog)) +++ emit |=(card this(moz [+< moz])) +:: +emil: emit multiple cards :: -++ emit - |= card:agent:gall - %_(+> moz [+< moz]) -:: -++ flog - |= =flog:dill - (emit %pass /di %arvo %d %flog flog) -:: -++ emil :: return cards - |= (list card:agent:gall) - ^+ +> - ?~(+< +> $(+< t.+<, +> (emit i.+<))) +++ emil + |= caz=(list card) + ^+ this + ?~(caz this $(caz t.caz, this (emit i.caz))) :: ++ poke-rekey :: rotate private keys |= des=@t @@ -61,17 +34,17 @@ =< abet ?~ sed ~& %invalid-private-key - +>.$ + this ?. =(our who.u.sed) ~& [%wrong-private-key-ship who.u.sed] - +>.$ + this (emit %pass / %arvo %j %rekey lyf.u.sed key.u.sed) :: ++ poke-moon :: rotate moon keys |= sed=(unit [=ship =udiff:point:able:jael]) =< abet ?~ sed - +>.$ + this (emit %pass / %arvo %j %moon u.sed) :: ++ poke-mass @@ -80,13 +53,13 @@ :: ++ poke-automass |= recur=@dr - =. mass-timer.sez + =. mass-timer.state [/helm/automass (add now recur) recur] - abet:(emit %pass way.mass-timer.sez %arvo %b %wait nex.mass-timer.sez) + abet:(emit %pass way.mass-timer.state %arvo %b %wait nex.mass-timer.state) :: ++ poke-cancel-automass |= ~ - abet:(emit %pass way.mass-timer.sez %arvo %b %rest nex.mass-timer.sez) + abet:(emit %pass way.mass-timer.state %arvo %b %rest nex.mass-timer.state) :: ++ poke-pack |= ~ =< abet @@ -98,11 +71,11 @@ %- (slog u.error) ~& %helm-wake-automass-fail abet - =. nex.mass-timer.sez (add now tim.mass-timer.sez) + =. nex.mass-timer.state (add now tim.mass-timer.state) =< abet %- emil :~ [%pass /heft %arvo %d %flog %crud %hax-heft ~] - [%pass way.mass-timer.sez %arvo %b %wait nex.mass-timer.sez] + [%pass way.mass-timer.state %arvo %b %wait nex.mass-timer.state] == :: ++ poke-send-hi @@ -162,7 +135,7 @@ :: Trigger with |reset. :: ++ poke-reset - |= hood-reset + |= hood-reset=~ =< abet %- emil ^- (list card:agent:gall) @@ -202,23 +175,24 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-helm-bad-mark mark] !!) + %helm-ames-sift =;(f (f !<(_+<.f vase)) poke-ames-sift) + %helm-ames-verb =;(f (f !<(_+<.f vase)) poke-ames-verb) + %helm-ames-wake =;(f (f !<(_+<.f vase)) poke-ames-wake) + %helm-atom =;(f (f !<(_+<.f vase)) poke-atom) + %helm-automass =;(f (f !<(_+<.f vase)) poke-automass) + %helm-cancel-automass =;(f (f !<(_+<.f vase)) poke-cancel-automass) %helm-hi =;(f (f !<(_+<.f vase)) poke-hi) + %helm-knob =;(f (f !<(_+<.f vase)) poke-knob) %helm-mass =;(f (f !<(_+<.f vase)) poke-mass) + %helm-moon =;(f (f !<(_+<.f vase)) poke-moon) %helm-pack =;(f (f !<(_+<.f vase)) poke-pack) + %helm-rekey =;(f (f !<(_+<.f vase)) poke-rekey) %helm-reload =;(f (f !<(_+<.f vase)) poke-reload) %helm-reload-desk =;(f (f !<(_+<.f vase)) poke-reload-desk) %helm-reset =;(f (f !<(_+<.f vase)) poke-reset) %helm-send-hi =;(f (f !<(_+<.f vase)) poke-send-hi) - %helm-ames-sift =;(f (f !<(_+<.f vase)) poke-ames-sift) - %helm-ames-verb =;(f (f !<(_+<.f vase)) poke-ames-verb) - %helm-ames-wake =;(f (f !<(_+<.f vase)) poke-ames-wake) - %helm-verb =;(f (f !<(_+<.f vase)) poke-verb) - %helm-knob =;(f (f !<(_+<.f vase)) poke-knob) - %helm-rekey =;(f (f !<(_+<.f vase)) poke-rekey) - %helm-automass =;(f (f !<(_+<.f vase)) poke-automass) - %helm-cancel-automass =;(f (f !<(_+<.f vase)) poke-cancel-automass) - %helm-moon =;(f (f !<(_+<.f vase)) poke-moon) %helm-serve =;(f (f !<(_+<.f vase)) poke-serve) + %helm-verb =;(f (f !<(_+<.f vase)) poke-verb) == :: ++ take-agent @@ -232,7 +206,7 @@ |= [wir=wire success=? binding=binding:eyre] =< abet (flog %text "bound: {}") :: -++ take +++ take-arvo |= [=wire =sign-arvo] ?+ wire ~|([%helm-bad-take-wire wire +<.sign-arvo] !!) [%automass *] %+ take-wake-automass t.wire diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index aaff3e6ac..1217d8f07 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -407,25 +407,25 @@ ++ poke |= [=mark =vase] ?+ mark ~|([%poke-kiln-bad-mark mark] !!) - %kiln-commit =;(f (f !<(_+<.f vase)) poke-commit) %kiln-autocommit =;(f (f !<(_+<.f vase)) poke-autocommit) + %kiln-cancel =;(f (f !<(_+<.f vase)) poke-cancel) + %kiln-cancel-autocommit =;(f (f !<(_+<.f vase)) poke-cancel-autocommit) + %kiln-commit =;(f (f !<(_+<.f vase)) poke-commit) + %kiln-gall-sear =;(f (f !<(_+<.f vase)) poke-gall-sear) + %kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-goad-gall) %kiln-info =;(f (f !<(_+<.f vase)) poke-info) %kiln-label =;(f (f !<(_+<.f vase)) poke-label) - %kiln-cancel =;(f (f !<(_+<.f vase)) poke-cancel) + %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) %kiln-mount =;(f (f !<(_+<.f vase)) poke-mount) + %kiln-ota =;(f (f !<(_+<.f vase)) poke:update) + %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) %kiln-rm =;(f (f !<(_+<.f vase)) poke-rm) %kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule) - %kiln-track =;(f (f !<(_+<.f vase)) poke-track) %kiln-sync =;(f (f !<(_+<.f vase)) poke-sync) - %kiln-ota =;(f (f !<(_+<.f vase)) poke:update) %kiln-syncs =;(f (f !<(_+<.f vase)) poke-syncs) - %kiln-goad-gall =;(f (f !<(_+<.f vase)) poke-goad-gall) - %kiln-gall-sear =;(f (f !<(_+<.f vase)) poke-gall-sear) + %kiln-track =;(f (f !<(_+<.f vase)) poke-track) %kiln-unmount =;(f (f !<(_+<.f vase)) poke-unmount) %kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync) - %kiln-permission =;(f (f !<(_+<.f vase)) poke-permission) - %kiln-cancel-autocommit =;(f (f !<(_+<.f vase)) poke-cancel-autocommit) - %kiln-merge =;(f (f !<(_+<.f vase)) poke-merge) == :: ++ poke-goad-gall @@ -450,7 +450,7 @@ (take-coup-spam t.t.wire p.sign) == :: -++ take-general +++ take-arvo |= [=wire =sign-arvo] ?- wire [%sync %merg *] %+ take-mere-sync t.t.wire From ac77d0a3ecb4ae052e37c80400569a54e5e75ef8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 17 Jun 2020 02:36:09 -0400 Subject: [PATCH 215/280] hood: uncompiled first try at state as tuple --- pkg/arvo/app/hood.hoon | 120 +++++++++++---------------- pkg/arvo/lib/hood/drum.hoon | 88 +++++++------------- pkg/arvo/lib/hood/helm.hoon | 47 +++++++++-- pkg/arvo/lib/hood/kiln.hoon | 154 +++++++++++++++-------------------- pkg/arvo/lib/hood/write.hoon | 118 --------------------------- 5 files changed, 185 insertions(+), 342 deletions(-) delete mode 100644 pkg/arvo/lib/hood/write.hoon diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 98a5cef37..b3141a15c 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -1,7 +1,5 @@ -/- *sole -/+ sole, default-agent +/+ default-agent /+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln -:: |% +$ state $: %7 @@ -9,39 +7,22 @@ helm=state:helm kiln=state:kiln == ++$ any-state + $% state + [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)] + == ++$ any-state-tuple + $: drum=any-state:drum + helm=any-state:helm + kiln=any-state:kiln + == ++$ fin-any-state + $% [%drum any-state:drum] + [%helm any-state:helm] + [%kiln any-state:kiln] + [%write *] :: gets deleted + == -- -:: -=> |% - +$ any-state $%(state hood-old) - ++ hood-old :: unified old-state - {?($1 $2 $3 $4 $5 $6) lac/(map @tas hood-part-old)} - ++ hood-1 :: unified state - {$6 lac/(map @tas hood-part)} - ++ hood-good :: extract specific - =+ hed=$:hood-head - |@ ++ $ - |: paw=$:hood-part - ?- hed - $drum ?>(?=($drum -.paw) `part:hood-drum`paw) - $helm ?>(?=($helm -.paw) `part:hood-helm`paw) - $kiln ?>(?=($kiln -.paw) `part:hood-kiln`paw) - $write ?>(?=($write -.paw) `part:hood-write`paw) - == - -- - ++ hood-part-old - $% [%drum part-old:drum] - [%helm part-old:helm] - [%kiln part-old:kiln] - [%write part-old:write] - == - ++ hood-part - $% {$drum $2 pith-2:drum} - {$helm $0 pith:helm} - {$kiln $0 pith:kiln} - {$write $0 pith:write} - == - -- -:: ^- agent:gall =| =state |_ =bowl:gall @@ -52,53 +33,50 @@ kiln-core (kiln bowl kiln.state) :: ++ on-fail on-fail:def -++ on-init on-init:def +++ on-init + ^- step:agent:gall + =^ d drum.state on-init:drum-core + [d this] ++ on-leave on-leave:def ++ on-peek on-peek:def -:: -++ on-save !>(state) +++ on-save !>(state) ++ on-load |= =old-state=vase - =/ old-state !<(any-state old-state-vase) - :: TODO rewrite - [~ this] -:: =^ cards lac -:: =. lac lac.old-state -:: ?- -.old-state -:: %1 ((wrap on-load):from-drum:(help hid) %1) -:: %2 ((wrap on-load):from-drum:(help hid) %2) -:: %3 ((wrap on-load):from-drum:(help hid) %3) -:: %4 ((wrap on-load):from-drum:(help hid) %4) -:: %5 -:: =/ start ..$:(from-kiln) -:: =/ old-kiln-part (~(got by lac.old-state) %kiln) -:: ?> ?=(%kiln -.old-kiln-part) -:: %- ably -:: (on-load:(start hid *part:hood-kiln) old-kiln-part) -:: :: -:: %6 `lac -:: == -:: [cards ..on-init] + ^- step:agent:gall + =+ !<(old=any-state old-state-vase) + =/ tup=any-state-tuple + ?+ -.old +.old + ?(%1 %2 %3 %4 %5 %6) + :* =-(?>(?=(%drum -<) ->) (~(got by lac.old) %drum)) + =-(?>(?=(%helm -<) ->) (~(got by lac.old) %helm)) + =-(?>(?=(%kiln -<) ->) (~(got by lac.old) %kiln)) + == + == + =/ ver -:*state + =^ d drum.state (on-load:drum-core ver drum.tup) + =^ h helm.state (on-load:helm-core ver helm.tup) + =^ k kiln.state (on-load:kiln-core ver kiln.tup) + [(weld d h k) this] :: ++ on-poke - |^ |= [=mark =vase] ^- step:agent:gall - :: + |^ =/ fin (end 3 4 mark) - ?: =(%drum fin) (poke-drum mark vase) - ?: =(%helm fin) (poke-helm mark vase) - ?: =(%kiln fin) (poke-kiln mark vase) + ?: =(%drum fin) poke-drum + ?: =(%helm fin) poke-helm + ?: =(%kiln fin) poke-kiln :: ?+ mark (on-poke:def mark vase) - %atom (poke-helm %helm-atom vase) - %dill-belt (poke-drum %drum-dill-belt vase) - %dill-blit (poke-drum %drum-dill-blit vase) - %hood-sync (poke-kiln %kiln-sync vase) + %atom poke-helm(mark %helm-atom) + %dill-belt poke-drum(mark %drum-dill-belt) + %dill-blit poke-drum(mark %drum-dill-blit) + %hood-sync poke-kiln(mark %kiln-sync) + %write-sec-atom poke-helm(mark %helm-write-sec-atom) == - ++ poke-drum |=([mark vase] =^(c drum.state (poke:drum-core +<) [c this])) - ++ poke-helm |=([mark vase] =^(c helm.state (poke:helm-core +<) [c this])) - ++ poke-kiln |=([mark vase] =^(c kiln.state (poke:kiln-core +<) [c this])) + ++ poke-drum =^(c drum.state (poke:drum-core mark vase) [c this])) + ++ poke-helm =^(c helm.state (poke:helm-core mark vase) [c this])) + ++ poke-kiln =^(c kiln.state (poke:kiln-core mark vase) [c this])) -- :: ++ on-watch @@ -118,7 +96,7 @@ == :: ++ on-arvo - |= [=wire sign=sign-arvo] + |= [=wire =sign-arvo] ^- step:agent:gall ?+ wire ~|([%hood-bad-wire wire] !!) [%drum *] =^(c drum.state (take-arvo:drum-core +<) [c this])) diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 4d57e149c..0b1726f53 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -1,21 +1,10 @@ -:: :: :: -:::: /hoon/drum/hood/lib :: :: - :: :: :: -/? 310 :: version -/- *sole -/+ sole -:: :: :: -:::: :: :: - :: :: :: -|% :: :: -+$ state [%3 pith-2] -+$ state-old :: - $: %drum :: - $% [%1 pith-1] :: - [%2 pith-2] :: - == == :: -:: :: -++ pith-1 :: pre-style +/- *sole +/+ sole +|% ++$ any-state $%(state [%1 pith-1]) ++$ state [%2 pith-2] +:: +++ pith-1 %+ cork pith-2 :: |:($:pith-2 +<(bin ((map bone source-1)))) :: :: :: @@ -29,9 +18,7 @@ fur/(map dude:gall (unit server)) :: servers bin/(map bone source) :: terminals == :: -:: :: :: -:::: :: :: - :: :: :: +:: :: ++ server :: running server $: syd/desk :: app identity cas/case :: boot case @@ -126,38 +113,28 @@ == :: ++ deft-fish :: default connects - |= our/ship + |= our=ship %- ~(gas in *(set gill:gall)) ^- (list gill:gall) [[our %dojo] [our %chat-cli]~] :: -++ initial-state - |= our/ship - ^- state - :* %3 - eel=(deft-fish our) - ray=~ - fur=~ - bin=~ - == -:: ++ en-gill :: gill to wire - |= gyl/gill:gall + |= gyl=gill:gall ^- wire [%drum %phat (scot %p p.gyl) q.gyl ~] :: ++ de-gill :: gill from wire - |= way/wire ^- gill:gall - ?>(?=({@ @ ~} way) [(slav %p i.way) i.t.way]) + |= way=wire ^- gill:gall + ?>(?=([@ @ ~] way) [(slav %p i.way) i.t.way]) -- :: TODO: remove .ost :: -|: [bowl=*bowl:gall state=initial-state] +|= [hid=bowl:gall state] =/ ost 0 =+ (~(gut by bin) ost *source) =* dev - |_ {moz/(list card:agent:gall) biz/(list dill-blit:dill)} -+* this . +++ on-init se-abet:se-view:this(eel (deft-fish our.hid)) ++ diff-sole-effect-phat :: app event |= {way/wire fec/sole-effect} =< se-abet =< se-view @@ -194,7 +171,7 @@ ++ poke-start :: start app |= wel/well:gall =< se-abet =< se-view - (se-born wel) + (se-born & wel) :: ++ poke-link :: connect app |= gyl/gill:gall @@ -228,25 +205,21 @@ == :: ++ on-load - |= ver=?(%1 %2 %3 %4) + |= [hood-version=?(%7) old=any-state] =< se-abet =< se-view - =? . (lte ver %3) - =. ver %4 - =. ..on-load - =< (se-emit %pass /kiln %arvo %g %sear ~wisrut-nocsub) - =< (se-born %home %goad) - =< (se-born %home %metadata-store) - =< (se-born %home %metadata-hook) - =< (se-born %home %contact-store) - =< (se-born %home %contact-hook) - =< (se-born %home %contact-view) - =< (se-born %home %link-store) - =< (se-born %home %link-proxy-hook) - =< (se-born %home %link-listen-hook) - =< (se-born %home %link-view) - (se-born %home %s3-store) - . - ?> ?=(%4 ver) + =. ..on-load + =< (se-born | %home %goad) + =< (se-born | %home %metadata-store) + =< (se-born | %home %metadata-hook) + =< (se-born | %home %contact-store) + =< (se-born | %home %contact-hook) + =< (se-born | %home %contact-view) + =< (se-born | %home %link-store) + =< (se-born | %home %link-proxy-hook) + =< (se-born | %home %link-listen-hook) + =< (se-born | %home %link-view) + (se-born | %home %s3-store) + :: => (se-drop:(se-pull our.hid %dojo) | our.hid %dojo) (se-drop:(se-pull our.hid %chat-cli) | our.hid %chat-cli) :: @@ -466,9 +439,10 @@ ta-abet:(ta-belt:(se-tame u.gul) bet) :: ++ se-born :: new server - |= wel/well:gall + |= [print-on-repeat=? wel=well:gall] ^+ +> ?: (~(has in ray) wel) + ?. print-on-repeat +> (se-text "[already running {}/{}]") %= +> ray (~(put in ray) wel) diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index bebab98ad..3f48402a4 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -1,16 +1,23 @@ -/- sole -/+ pill +/+ pill =* card card:agent:gall -:: |% ++$ any-state $%(state state-old) +$ state - $: %3 - say/sole-share:sole :: console state - mud/(unit (sole-dialog:sole @ud)) :: console dialog - mass-timer/{way/wire nex/@da tim/@dr} + $: %1 + mass-timer=[way=wire nex=@da tim=@dr] + == ++$ state-old + $% %0 + say=* + mud=* + mass-timer=[way=wire nex=@da tim=@dr] == --- :: +++ state-0-to-1 + |= s=state-0 + ^- state + [%1 mass-timer.s] +-- |= [=bowl:gall =state] =| moz=(list card) |% @@ -25,6 +32,13 @@ ^+ this ?~(caz this $(caz t.caz, this (emit i.caz))) :: +++ on-load + |= [hood-version=?(%7) old=any-state] + =< abet + =? old ?=(%0 -.old) (state-0-to-1 old) + ?> ?=(%1 -.old) + this(state old) +:: ++ poke-rekey :: rotate private keys |= des=@t =/ sed=(unit seed:able:jael) @@ -40,6 +54,22 @@ this (emit %pass / %arvo %j %rekey lyf.u.sed key.u.sed) :: +++ ames-secret + ^- @t + =; pax (crip +:<.^(@p %j pax)>) + /(scot %p our.bowl)/code/(scot %da now.bowl)/(scot %p our.bowl) +:: +++ poke-sec-atom + |= [hot=host:eyre dat=@] + ?> ?=(%& -.hot) + =. p.hot (scag 2 p.hot) :: ignore subdomain + =. dat (scot %uw (en:crub:crypto ames-secret dat)) + =- abet:(emit %pass /write %arvo %c %info -) + =/ byk=path (en-beam:format byk.bowl(r da+now.bowl) ~) + =+ .^(=tube:clay cc+(welp byk /mime/atom)) + =/ =cage atom+(tube !>([/ (as-octs:mimes:html dat)])) + (foal:space:userlib :(welp byk sec+p.hot /atom) cag) +:: ++ poke-moon :: rotate moon keys |= sed=(unit [=ship =udiff:point:able:jael]) =< abet @@ -193,6 +223,7 @@ %helm-send-hi =;(f (f !<(_+<.f vase)) poke-send-hi) %helm-serve =;(f (f !<(_+<.f vase)) poke-serve) %helm-verb =;(f (f !<(_+<.f vase)) poke-verb) + %helm-write-sec-atom =;(f (f !<(_+<.f vase)) poke-sec-atom) == :: ++ take-agent diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 1217d8f07..f82af3224 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -1,81 +1,64 @@ -:: :: :: -:::: /hoon/kiln/hood/lib :: :: - :: :: :: -/? 310 :: version -:: :: :: -:::: :: :: - :: :: :: =, clay =, space:userlib =, format -|% :: :: -+$ part [%kiln %1 pith] :: kiln state -+$ part-old :: - $: %kiln :: - $% [%0 pith-0] :: - [%1 pith-1] :: - == == :: -++ pith pith-1 :: :: -++ pith-0 :: - $: rem=(map desk per-desk) :: - syn=(map kiln-sync let=@ud) :: - autoload-on=? :: - cur-hoon=@uvI :: - cur-arvo=@uvI :: - cur-zuse=@uvI :: - cur-vanes=(map @tas @uvI) :: - commit-timer=[way=wire nex=@da tim=@dr mon=term] - == :: -:: :: -++ pith-1 :: - $: rem=(map desk per-desk) :: - syn=(map kiln-sync let/@ud) :: - ota=(unit [=ship =desk =aeon]) :: - commit-timer=[way=wire nex=@da tim=@dr mon=term] - == :: -:: -++ per-desk :: per-desk state - $: auto/? :: escalate on failure - gem/germ :: strategy - her/@p :: from ship - sud/@tas :: from desk - cas/case :: at case - == :: -:: :: :: -:::: :: :: - :: :: :: -++ kiln-commit term :: -++ kiln-mount :: - $: pax/path :: - pot/term :: - == :: -++ kiln-unmount $@(term {knot path}) :: -++ kiln-sync :: - $: syd/desk :: - her/ship :: - sud/desk :: - == :: -++ kiln-unsync :: - $: syd/desk :: - her/ship :: - sud/desk :: - == :: -++ kiln-merge :: - $: syd/desk :: - ali/ship :: - sud/desk :: - cas/case :: - gim/?($auto germ) :: - == :: --- :: -:: :: :: -:::: :: :: - :: :: :: -|= {bowl:gall part} :: main kiln work +|% ++$ state [%1 pith-1] ++$ any-state + $% state + [%0 pith-0] + == ++$ pith-1 :: + $: rem=(map desk per-desk) :: + syn=(map kiln-sync let=@ud) :: + ota=(unit [=ship =desk =aeon]) :: + commit-timer=[way=wire nex=@da tim=@dr mon=term] :: + == :: ++$ pith-0 :: + $: rem=(map desk per-desk) :: + syn=(map kiln-sync let=@ud) :: + autoload-on=? :: + cur-hoon=@uvI :: + cur-arvo=@uvI :: + cur-zuse=@uvI :: + cur-vanes=(map @tas @uvI) :: + commit-timer=[way=wire nex=@da tim=@dr mon=term] :: + == ++$ per-desk :: per-desk state + $: auto=? :: escalate on failure + gem=germ :: strategy + her=@p :: from ship + sud=@tas :: from desk + cas=case :: at case + == ++$ kiln-commit term :: ++$ kiln-mount :: + $: pax=path :: + pot=term :: + == ++$ kiln-unmount $@(term [knot path]) :: ++$ kiln-sync :: + $: syd=desk :: + her=ship :: + sud=desk :: + == ++$ kiln-unsync :: + $: syd=desk :: + her=ship :: + sud=desk :: + == ++$ kiln-merge :: + $: syd=desk :: + ali=ship :: + sud=desk :: + cas=case :: + gim=?($auto germ) :: + == +-- +|= [bowl:gall state] ?> =(src our) -|_ moz/(list card:agent:gall) +|_ moz=(list card:agent:gall) ++ abet :: resolve - [(flop moz) `part`+<+.$] + [(flop moz) `state`+<+.$] :: ++ emit |= card:agent:gall @@ -92,12 +75,12 @@ ~[leaf+"from {}" leaf+"on {}" leaf+"to {}"] :: ++ on-load - |= =part-old + |= old=any-state =< abet - =? . ?=(%0 +<.part-old) + =? . ?=(%0 -.old) =/ recognized-ota=(unit [syd=desk her=ship sud=desk]) =/ syncs=(list [[syd=desk her=ship sud=desk] =aeon]) - ~(tap by syn.part-old) + ~(tap by syn.old) |- ^- (unit [syd=desk her=ship sud=desk]) ?~ syncs ~ @@ -106,22 +89,17 @@ $(syncs t.syncs) :: =. +<+.$.abet - %= part-old - +< %1 - syn - ?~ recognized-ota - syn - (~(del by syn) [syd her sud]:u.recognized-ota) - :: - |4 [~ commit-timer.part-old] - == + =- old(- %1, |3 [ota=~ commit-timer.old], syn -) + ?~ recognized-ota + syn + (~(del by syn) [syd her sud]:u.recognized-ota) :: =? ..abet ?=(^ recognized-ota) (poke-internal:update `[her sud]:u.recognized-ota) - +(part-old +<+.$.abet) + +(old +<+.$.abet) :: - ?> ?=(%1 +<.part-old) - =. +<+.$.abet part-old + ?> ?=(%1 -.old) + =. +<+.$.abet old ..abet :: ++ poke-commit diff --git a/pkg/arvo/lib/hood/write.hoon b/pkg/arvo/lib/hood/write.hoon deleted file mode 100644 index 4b9643337..000000000 --- a/pkg/arvo/lib/hood/write.hoon +++ /dev/null @@ -1,118 +0,0 @@ -:: File writer module -:: -:::: /hoon/write/hood/lib - :: -/? 310 -=, format -=* as-octs as-octs:mimes:html -=, space:userlib -|% -+$ part {$write $0 pith} :: no state -+$ part-old part -+$ pith ~ --- -:: -:::: - :: -|% -++ data $%({$json json} {$mime mime}) --- -:: -:::: - :: -|= {bowl:gall part} -=* par +<+ -|_ moz/(list card:agent:gall) -++ abet [(flop moz) `part`par] -++ emit - |= =card:agent:gall - %_(+> moz :_(moz card)) -:: -++ beak-now byk(r [%da now]) -++ poke-wipe - |= sup/path ^+ abet :: XX determine extension, beak - =+ ext=%md - ?~ (file (en-beam beak-now [ext sup])) - ~|(not-found+[ext `path`(flop sup)] !!) - =- abet:(emit %pass /write %arvo %c %info -) - (fray (en-beam beak-now [ext sup])) -:: -++ poke-tree - |= {sup/path mim/mime} ^+ abet :: XX determine extension, beak - (poke--data [`%md (flop sup)] %mime mim) -:: -++ poke-paste - |= {typ/?($hoon $md $txt) txt/@t} ^+ abet - (poke--data [`typ /web/paste/(scot %da now)] %mime / (as-octs txt)) -:: -++ poke-comment - |= {sup/path him/ship txt/@t} ^+ abet - =+ pax=(welp (flop sup) /comments/(scot %da now)) - =. txt - %+ rap 3 :~ - '## `' (scot %p him) '`' - '\0a' txt - == - (poke--data [`%md pax] %mime / (as-octs txt)) -:: -++ poke-fora-post - |= {sup/path him/ship hed/@t txt/@t} ^+ abet - =+ pax=(welp (flop sup) /posts/(cat 3 (scot %da now) '~')) - =. txt - %- crip - """ - --- - type: post - date: {} - title: {(trip hed)} - author: {} - navsort: bump - navuptwo: true - comments: reverse - --- - - {(trip txt)} - """ - (poke--data [`%md pax] %mime / (as-octs txt)) -:: -++ ames-secret - ^- @t - =- (crip +:<.^(@p %j pax)>) - pax=/(scot %p our)/code/(scot %da now)/(scot %p our) -:: -++ poke-sec-atom - |= {hot/host:eyre dat/@} - ?> ?=(%& -.hot) - =. p.hot (scag 2 p.hot) :: ignore subdomain - =. dat (scot %uw (en:crub:crypto ames-secret dat)) - (poke--data [`%atom [%sec p.hot]] %mime / (as-octs dat)) -:: -++ poke--data - |= {{ext/(unit @t) pax/path} dat/data} ^+ abet - ?~ ext $(ext [~ -.dat]) - =/ cay=cage ?-(-.dat $json [-.dat !>(+.dat)], $mime [-.dat !>(+.dat)]) - =/ =cage - ?: =(u.ext -.dat) - cay - =+ .^(=tube:clay %cc /(scot %p our)/home/(scot %da now)/[p.cay]/[u.ext]) - [u.ext (tube q.cay)] - =- abet:(emit %pass /write %arvo %c %info -) - (foal :(welp (en-beam beak-now ~) pax /[-.cage]) cage) -:: -++ poke - |= [=mark =vase] - ?+ mark ~|([%poke-write-bad-mark mark] !!) - %write-sec-atom =;(f (f !<(_+<.f vase)) poke-sec-atom) - %write-paste =;(f (f !<(_+<.f vase)) poke-paste) - %write-tree =;(f (f !<(_+<.f vase)) poke-tree) - %write-wipe =;(f (f !<(_+<.f vase)) poke-wipe) - == -:: -++ take - |= [=wire =sign-arvo] - !! -:: -++ take-agent - |= [=wire =sign:agent:gall] - ~|([%write-bad-take-agent wire -.sign] !!) --- From d395c2711df3ec98005a3b915ee01768a7edf45e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 17 Jun 2020 03:54:27 -0400 Subject: [PATCH 216/280] hood: WIP compiles but +on-load crashes --- pkg/arvo/app/hood.hoon | 25 +++++++++++---------- pkg/arvo/lib/hood/drum.hoon | 26 +++++++++++++--------- pkg/arvo/lib/hood/helm.hoon | 44 +++++++++++++++++++------------------ pkg/arvo/lib/hood/kiln.hoon | 4 +++- 4 files changed, 55 insertions(+), 44 deletions(-) diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index b3141a15c..8af890b53 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -27,7 +27,7 @@ =| =state |_ =bowl:gall +* this . - def ~(. (default-agent this %|) bol) + def ~(. (default-agent this %|) bowl) drum-core (drum bowl drum.state) helm-core (helm bowl helm.state) kiln-core (kiln bowl kiln.state) @@ -37,6 +37,7 @@ ^- step:agent:gall =^ d drum.state on-init:drum-core [d this] +:: ++ on-leave on-leave:def ++ on-peek on-peek:def ++ on-save !>(state) @@ -52,11 +53,11 @@ =-(?>(?=(%kiln -<) ->) (~(got by lac.old) %kiln)) == == - =/ ver -:*state + =/ ver -.state =^ d drum.state (on-load:drum-core ver drum.tup) =^ h helm.state (on-load:helm-core ver helm.tup) =^ k kiln.state (on-load:kiln-core ver kiln.tup) - [(weld d h k) this] + [:(weld d h k) this] :: ++ on-poke |= [=mark =vase] @@ -74,9 +75,9 @@ %hood-sync poke-kiln(mark %kiln-sync) %write-sec-atom poke-helm(mark %helm-write-sec-atom) == - ++ poke-drum =^(c drum.state (poke:drum-core mark vase) [c this])) - ++ poke-helm =^(c helm.state (poke:helm-core mark vase) [c this])) - ++ poke-kiln =^(c kiln.state (poke:kiln-core mark vase) [c this])) + ++ poke-drum =^(c drum.state (poke:drum-core mark vase) [c this]) + ++ poke-helm =^(c helm.state (poke:helm-core mark vase) [c this]) + ++ poke-kiln =^(c kiln.state (poke:kiln-core mark vase) [c this]) -- :: ++ on-watch @@ -90,17 +91,17 @@ |= [=wire =sign:agent:gall] ^- step:agent:gall ?+ wire ~|([%hood-bad-wire wire] !!) - [%drum *] =^(c drum.state (take-agent:drum-core +<) [c this])) - [%helm *] =^(c helm.state (take-agent:helm-core +<) [c this])) - [%kiln *] =^(c kiln.state (take-agent:kiln-core +<) [c this])) + [%drum *] =^(c drum.state (take-agent:drum-core +<) [c this]) + [%helm *] =^(c helm.state (take-agent:helm-core +<) [c this]) + [%kiln *] =^(c kiln.state (take-agent:kiln-core +<) [c this]) == :: ++ on-arvo |= [=wire =sign-arvo] ^- step:agent:gall ?+ wire ~|([%hood-bad-wire wire] !!) - [%drum *] =^(c drum.state (take-arvo:drum-core +<) [c this])) - [%helm *] =^(c helm.state (take-arvo:helm-core +<) [c this])) - [%kiln *] =^(c kiln.state (take-arvo:kiln-core +<) [c this])) + [%drum *] =^(c drum.state (take-arvo:drum-core +<) [c this]) + [%helm *] =^(c helm.state (take-arvo:helm-core +<) [c this]) + [%kiln *] =^(c kiln.state (take-arvo:kiln-core +<) [c this]) == -- diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 0b1726f53..23fcc812b 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -63,7 +63,7 @@ :: :: :: |% ++ deft-apes :: default servers - |= [our/ship lit/?] + |= [our=ship lit=?] %- ~(gas in *(set well:gall)) ^- (list well:gall) :: boot all default apps off the home desk @@ -130,11 +130,17 @@ :: TODO: remove .ost :: |= [hid=bowl:gall state] +=* sat +<+ =/ ost 0 =+ (~(gut by bin) ost *source) =* dev - -|_ {moz/(list card:agent:gall) biz/(list dill-blit:dill)} -++ on-init se-abet:se-view:this(eel (deft-fish our.hid)) +=| moz=(list card:agent:gall) +=| biz=(list dill-blit:dill) +|% +++ this . ++$ state ^state :: proxy ++$ any-state ^any-state :: proxy +++ on-init se-abet:this(eel (deft-fish our.hid)) ++ diff-sole-effect-phat :: app event |= {way/wire fec/sole-effect} =< se-abet =< se-view @@ -150,14 +156,15 @@ (se-text "[{}, driving {}]") :: ++ poke-set-boot-apps :: - |= lit/? - ^- (quip card:agent:gall part) + |= lit=? + ^- (quip card:agent:gall ^state) :: We do not run se-abet:se-view here because that starts the apps, :: and some apps are not ready to start (eg Talk crashes because the :: terminal has width 0). It appears the first message to drum must :: be the peer. :: - [~ +<+.^$(ray (deft-apes our.hid lit))] + =. ray (deft-apes our.hid lit) + [~ sat] :: ++ poke-dill-belt :: terminal event |= bet/dill-belt:dill @@ -234,7 +241,7 @@ :: (se-drop & gyl) :: -++ take :: +++ take-arvo |= [=wire =sign-arvo] %+ take-onto wire ?> ?=(%onto +<.sign-arvo) @@ -288,10 +295,9 @@ :::: :: :: :: :: :: ++ se-abet :: resolve - ^- (quip card:agent:gall part) - =* pith +<+.$ + ^- (quip card:agent:gall state) =. . se-subze:se-adze:se-adit - :_ pith(bin (~(put by bin) ost dev)) + :_ sat(bin (~(put by bin) ost dev)) ^- (list card:agent:gall) ?~ biz (flop moz) :_ (flop moz) diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index 3f48402a4..5bca6778c 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -1,14 +1,14 @@ /+ pill =* card card:agent:gall |% -+$ any-state $%(state state-old) ++$ any-state $%(state state-0) +$ state $: %1 mass-timer=[way=wire nex=@da tim=@dr] == -+$ state-old - $% %0 - say=* ++$ state-0 [%0 hoc=(map bone session-0)] ++$ session-0 + $: say=* mud=* mass-timer=[way=wire nex=@da tim=@dr] == @@ -16,13 +16,15 @@ ++ state-0-to-1 |= s=state-0 ^- state - [%1 mass-timer.s] + [%1 mass-timer:(~(got by hoc.s) 0)] -- -|= [=bowl:gall =state] +|= [=bowl:gall sat=state] =| moz=(list card) |% -+* this . -++ abet [(flop moz) state] +++ this . ++$ state ^state :: proxy ++$ any-state ^any-state :: proxy +++ abet [(flop moz) sat] ++ flog |=(=flog:dill (emit %pass /di %arvo %d %flog flog)) ++ emit |=(card this(moz [+< moz])) :: +emil: emit multiple cards @@ -37,7 +39,7 @@ =< abet =? old ?=(%0 -.old) (state-0-to-1 old) ?> ?=(%1 -.old) - this(state old) + this(sat old) :: ++ poke-rekey :: rotate private keys |= des=@t @@ -49,7 +51,7 @@ ?~ sed ~& %invalid-private-key this - ?. =(our who.u.sed) + ?. =(our.bowl who.u.sed) ~& [%wrong-private-key-ship who.u.sed] this (emit %pass / %arvo %j %rekey lyf.u.sed key.u.sed) @@ -68,7 +70,7 @@ =/ byk=path (en-beam:format byk.bowl(r da+now.bowl) ~) =+ .^(=tube:clay cc+(welp byk /mime/atom)) =/ =cage atom+(tube !>([/ (as-octs:mimes:html dat)])) - (foal:space:userlib :(welp byk sec+p.hot /atom) cag) + (foal:space:userlib :(welp byk sec+p.hot /atom) cage) :: ++ poke-moon :: rotate moon keys |= sed=(unit [=ship =udiff:point:able:jael]) @@ -83,13 +85,13 @@ :: ++ poke-automass |= recur=@dr - =. mass-timer.state - [/helm/automass (add now recur) recur] - abet:(emit %pass way.mass-timer.state %arvo %b %wait nex.mass-timer.state) + =. mass-timer.sat + [/helm/automass (add now.bowl recur) recur] + abet:(emit %pass way.mass-timer.sat %arvo %b %wait nex.mass-timer.sat) :: ++ poke-cancel-automass |= ~ - abet:(emit %pass way.mass-timer.state %arvo %b %rest nex.mass-timer.state) + abet:(emit %pass way.mass-timer.sat %arvo %b %rest nex.mass-timer.sat) :: ++ poke-pack |= ~ =< abet @@ -101,11 +103,11 @@ %- (slog u.error) ~& %helm-wake-automass-fail abet - =. nex.mass-timer.state (add now tim.mass-timer.state) + =. nex.mass-timer.sat (add now.bowl tim.mass-timer.sat) =< abet %- emil :~ [%pass /heft %arvo %d %flog %crud %hax-heft ~] - [%pass way.mass-timer.state %arvo %b %wait nex.mass-timer.state] + [%pass way.mass-timer.sat %arvo %b %wait nex.mass-timer.sat] == :: ++ poke-send-hi @@ -123,14 +125,14 @@ ?: =(%fail mes) ~& %poke-hi-fail !! - abet:(flog %text "< {}: {(trip mes)}") + abet:(flog %text "< {}: {(trip mes)}") :: ++ poke-atom |= ato/@ =+ len=(scow %ud (met 3 ato)) =+ gum=(scow %p (mug ato)) =< abet - (flog %text "< {}: atom: {len} bytes, mug {gum}") + (flog %text "< {}: atom: {len} bytes, mug {gum}") :: ++ coup-hi |= {pax/path cop/(unit tang)} =< abet @@ -142,7 +144,7 @@ |: $:{syd/desk all/(list term)} =< abet %- emil %+ turn all - =+ top=`path`/(scot %p our)/[syd]/(scot %da now) + =+ top=`path`/(scot %p our.bowl)/[syd]/(scot %da now.bowl) =/ van/(list {term ~}) :- zus=[%zuse ~] ~(tap by dir:.^(arch %cy (welp top /sys/vane))) @@ -169,7 +171,7 @@ =< abet %- emil ^- (list card:agent:gall) - =/ top=path /(scot %p our)/home/(scot %da now)/sys + =/ top=path /(scot %p our.bowl)/home/(scot %da now.bowl)/sys =/ hun .^(@t %cx (welp top /hoon/hoon)) =/ arv .^(@t %cx (welp top /arvo/hoon)) ~! *task:able:dill diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index f82af3224..40d3396a4 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -57,6 +57,8 @@ |= [bowl:gall state] ?> =(src our) |_ moz=(list card:agent:gall) ++$ state ^state :: proxy ++$ any-state ^any-state :: proxy ++ abet :: resolve [(flop moz) `state`+<+.$] :: @@ -75,7 +77,7 @@ ~[leaf+"from {}" leaf+"on {}" leaf+"to {}"] :: ++ on-load - |= old=any-state + |= [hood-version=?(%7) old=any-state] =< abet =? . ?=(%0 -.old) =/ recognized-ota=(unit [syd=desk her=ship sud=desk]) From 3914c0c0dda9774da945232a243949c3c0a64509 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 17 Jun 2020 23:31:37 -0400 Subject: [PATCH 217/280] ota: works on my machine --- pkg/arvo/app/hood.hoon | 16 ++++++------ pkg/arvo/app/spider.hoon | 50 +++++++++++++++++++++++++++++++------ pkg/arvo/lib/hood/drum.hoon | 15 +++-------- pkg/arvo/lib/hood/helm.hoon | 2 +- pkg/arvo/lib/hood/kiln.hoon | 2 +- pkg/arvo/sys/vane/gall.hoon | 5 +++- 6 files changed, 60 insertions(+), 30 deletions(-) diff --git a/pkg/arvo/app/hood.hoon b/pkg/arvo/app/hood.hoon index 8af890b53..e85a03e0a 100644 --- a/pkg/arvo/app/hood.hoon +++ b/pkg/arvo/app/hood.hoon @@ -53,10 +53,9 @@ =-(?>(?=(%kiln -<) ->) (~(got by lac.old) %kiln)) == == - =/ ver -.state - =^ d drum.state (on-load:drum-core ver drum.tup) - =^ h helm.state (on-load:helm-core ver helm.tup) - =^ k kiln.state (on-load:kiln-core ver kiln.tup) + =^ d drum.state (on-load:drum-core -.old drum.tup) + =^ h helm.state (on-load:helm-core -.old helm.tup) + =^ k kiln.state (on-load:kiln-core -.old kiln.tup) [:(weld d h k) this] :: ++ on-poke @@ -95,13 +94,14 @@ [%helm *] =^(c helm.state (take-agent:helm-core +<) [c this]) [%kiln *] =^(c kiln.state (take-agent:kiln-core +<) [c this]) == +:: TODO: symmetry between adding and stripping wire prefixes :: ++ on-arvo - |= [=wire =sign-arvo] + |= [=wire syn=sign-arvo] ^- step:agent:gall ?+ wire ~|([%hood-bad-wire wire] !!) - [%drum *] =^(c drum.state (take-arvo:drum-core +<) [c this]) - [%helm *] =^(c helm.state (take-arvo:helm-core +<) [c this]) - [%kiln *] =^(c kiln.state (take-arvo:kiln-core +<) [c this]) + [%drum *] =^(c drum.state (take-arvo:drum-core t.wire syn) [c this]) + [%helm *] =^(c helm.state (take-arvo:helm-core t.wire syn) [c this]) + [%kiln *] =^(c kiln.state (take-arvo:kiln-core t.wire syn) [c this]) == -- diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index ece6fe71d..a6286ba8c 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -19,8 +19,27 @@ tid=(map tid yarn) == :: ++$ clean-slate-any + $^ clean-slate-ket + $% clean-slate-sig + clean-slate + == +:: +$ clean-slate - $: starting=(map yarn [=trying =vase]) + $: %1 + starting=(map yarn [=trying =vase]) + running=(list yarn) + tid=(map tid yarn) + == +:: ++$ clean-slate-ket + $: starting=(map yarn [trying=?(%build %find %none) =vase]) + running=(list yarn) + tid=(map tid yarn) + == +:: ++$ clean-slate-sig + $: starting=~ running=(list yarn) tid=(map tid yarn) == @@ -117,12 +136,17 @@ ++ on-init on-init:def ++ on-save clean-state:sc ++ on-load + |^ |= old-state=vase - =+ !<(=clean-slate old-state) - =. tid.state tid.clean-slate + =+ !<(any=clean-slate-any old-state) + =? any ?=(^ -.any) (old-to-1 any) + =? any ?=(~ -.any) (old-to-1 any) + ?> ?=(%1 -.any) + :: + =. tid.state tid.any =/ yarns=(list yarn) - %+ welp running.clean-slate - ~(tap in ~(key by starting.clean-slate)) + %+ welp running.any + ~(tap in ~(key by starting.any)) |- ^- (quip card _this) ?~ yarns `this @@ -131,6 +155,12 @@ =^ cards-2 this $(yarns t.yarns) [(weld cards-1 cards-2) this] + :: + ++ old-to-1 + |= old=clean-slate-ket + ^- clean-slate + 1+old(starting (~(run by starting.old) |=([* v=vase] none+v))) + -- :: ++ on-poke |= [=mark =vase] @@ -350,9 +380,13 @@ :: ++ thread-fail-not-running |= [=tid =term =tang] + ^- (quip card ^state) =/ =yarn (~(got by tid.state) tid) - :- (thread-say-fail tid term tang) - state(starting (~(del by starting.state) yarn)) + :_ state(starting (~(del by starting.state) yarn)) + =/ moz (thread-say-fail tid term tang) + ?. ?=([~ %build *] (~(get by starting.state) yarn)) + moz + :_(moz [%pass /build/[tid] %arvo %c %warp our.bowl %home ~]) :: ++ thread-say-fail |= [=tid =term =tang] @@ -440,5 +474,5 @@ :: ++ clean-state !> ^- clean-slate - state(running (turn (tap-yarn running.state) head)) + 1+state(running (turn (tap-yarn running.state) head)) -- diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 23fcc812b..9080f130d 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -1,17 +1,9 @@ /- *sole /+ sole |% -+$ any-state $%(state [%1 pith-1]) ++$ any-state $%(state) +$ state [%2 pith-2] :: -++ pith-1 - %+ cork pith-2 :: - |:($:pith-2 +<(bin ((map bone source-1)))) :: -:: :: -++ source-1 :: - %+ cork source :: - |:($:source +<(mir ((pair @ud (list @c))))) :: style-less mir -:: :: ++ pith-2 :: $: eel/(set gill:gall) :: connect to ray/(set well:gall) :: @@ -212,9 +204,10 @@ == :: ++ on-load - |= [hood-version=?(%7) old=any-state] + |= [hood-version=?(%1 %2 %3 %4 %5 %6 %7) old=any-state] =< se-abet =< se-view - =. ..on-load + =. sat old + =? ..on-load (lte hood-version %4) =< (se-born | %home %goad) =< (se-born | %home %metadata-store) =< (se-born | %home %metadata-hook) diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index 5bca6778c..c742effce 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -35,7 +35,7 @@ ?~(caz this $(caz t.caz, this (emit i.caz))) :: ++ on-load - |= [hood-version=?(%7) old=any-state] + |= [hood-version=?(%1 %2 %3 %4 %5 %6 %7) old=any-state] =< abet =? old ?=(%0 -.old) (state-0-to-1 old) ?> ?=(%1 -.old) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 40d3396a4..466312264 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -77,7 +77,7 @@ ~[leaf+"from {}" leaf+"on {}" leaf+"to {}"] :: ++ on-load - |= [hood-version=?(%7) old=any-state] + |= [hood-version=?(%1 %2 %3 %4 %5 %6 %7) old=any-state] =< abet =? . ?=(%0 -.old) =/ recognized-ota=(unit [syd=desk her=ship sud=desk]) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index eeea1970d..892750bb1 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -150,6 +150,9 @@ ^- [(list move) _adult-gate] ~> %slog.[0 leaf+"gall: molting"] ~< %slog.[0 leaf+"gall: molted"] + :: +molt should never notify its client about agent changes + :: + =- [(skip -< |=(move ?=([* %give %onto *] +<))) ->] =/ adult adult-core =. state.adult [%6 system-duct outstanding contacts yokes=~ blocked]:spore @@ -1277,7 +1280,7 @@ (ap-install(agent.current-agent agent) `old-state) ?~ error ap-core - (ap-error %load-failed u.error) + (mean >%load-failed< u.error) :: +ap-subscribe-as: apply %watch-as. :: ++ ap-subscribe-as From f2ee0a13800b18f3b6f610b24079fec2fc7cf89e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 18 Jun 2020 00:58:47 -0400 Subject: [PATCH 218/280] drum: fix +on-load resubscribes --- pkg/arvo/lib/hood/drum.hoon | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 9080f130d..e23d0e6ca 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -207,19 +207,22 @@ |= [hood-version=?(%1 %2 %3 %4 %5 %6 %7) old=any-state] =< se-abet =< se-view =. sat old - =? ..on-load (lte hood-version %4) - =< (se-born | %home %goad) - =< (se-born | %home %metadata-store) - =< (se-born | %home %metadata-hook) - =< (se-born | %home %contact-store) - =< (se-born | %home %contact-hook) - =< (se-born | %home %contact-view) - =< (se-born | %home %link-store) - =< (se-born | %home %link-proxy-hook) - =< (se-born | %home %link-listen-hook) - =< (se-born | %home %link-view) - (se-born | %home %s3-store) - :: + =. dev (~(gut by bin) ost *source) + ?: (gth hood-version %4) + ..on-load + ~> %slog.0^leaf+"drum: starting os1 agents" + => (se-born | %home %s3-store) + => (se-born | %home %link-view) + => (se-born | %home %link-listen-hook) + => (se-born | %home %link-store) + => (se-born | %home %link-proxy-hook) + => (se-born | %home %contact-view) + => (se-born | %home %contact-hook) + => (se-born | %home %contact-store) + => (se-born | %home %metadata-hook) + => (se-born | %home %metadata-store) + => (se-born | %home %goad) + ~> %slog.0^leaf+"drum: resubscribing to %dojo and %chat-cli" => (se-drop:(se-pull our.hid %dojo) | our.hid %dojo) (se-drop:(se-pull our.hid %chat-cli) | our.hid %chat-cli) :: From e35bb4b72a945716f61351f805029386d45819af Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 18 Jun 2020 21:48:35 +0200 Subject: [PATCH 219/280] pill: update --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e6a2605f7..073e2fbbe 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f7988e3ffc99ecd8cb66daf469bff3b9cb41ca82895a91cae7d4f7d59bb48a7 -size 20308420 +oid sha256:2c0c3e34876875722a8505d8e98843738460d6d8b3ab8872274a876f7859ae71 +size 17336122 From 7494bf57c68b615f3c7e15a325ecda5979014a28 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 18 Jun 2020 18:56:31 -0700 Subject: [PATCH 220/280] clay: make reachable-takos linear instead of exponential When merging, +reachable-takos is called roughly once per merge commit in the ancestry of the new commit. +reachable-takos was exponential in the number of merge commits in the ancestry of the commit it's looking at, due to mishandling of the accumulator. This makes it linear. Of course, linear x linear is still quadratic, which is not great. I doubt +reachable-takos can be made asymptotically better, but +reduce-merge-points/+find-merge-points probably can. 50 merge commits already gives about 14.000 iterations through the loop in +reachable-takos. Another option is to try to memoize this somehow, but a simple ~+ is insufficient since `s` is usually different. In local tests on macOS with a -L copy of ~wicdev-wisryt, this speeds up OTAs significantly. The majority of time was spent on this. --- pkg/arvo/sys/vane/clay.hoon | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index e08b31dbe..47fc48815 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3209,13 +3209,17 @@ ++ reachable-takos :: reachable |= p/tako ^- (set tako) + =| s=(set tako) + |- ^- (set tako) + =. s (~(put in s) p) =+ y=(tako-to-yaki p) - %+ roll p.y - =< .(s (~(put in *(set tako)) p)) - |= {q/tako s/(set tako)} - ?: (~(has in s) q) :: already done - s :: hence skip - (~(uni in s) ^$(p q)) :: otherwise traverse + |- ^- (set tako) + ?~ p.y + s + ?: (~(has in s) i.p.y) + $(p.y t.p.y) + =. s ^$(p i.p.y) + $(p.y t.p.y) :: :: Gets the data between two commit hashes, assuming the first is an :: ancestor of the second. From d1b4af89fea7922deb7f7660a08f82e34a89ae66 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 19 Jun 2020 00:44:17 -0400 Subject: [PATCH 221/280] sys: s/mure/road --- pkg/arvo/sys/arvo.hoon | 6 +++--- pkg/arvo/sys/hoon.hoon | 4 ++-- pkg/arvo/sys/vane/clay.hoon | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index c20bc3770..a24f1d412 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1266,7 +1266,7 @@ :: =/ raw ~> %slog.[0 leaf+"vega: compiling hoon"] - (mure |.((ride %noun u.hun))) + (road |.((ride %noun u.hun))) :: activate the new compiler gate, producing +ride :: =/ cop .*(0 +.raw) @@ -1282,7 +1282,7 @@ [raw cop] ~> %slog.[0 leaf+"vega: recompiling hoon {}k"] ~& [%hoon-compile-upgrade nex] - %- mure |. + %- road |. =/ hot (slum cop [%noun hun]) [hot .*(0 +.hot)] :: extract the hoon core from the outer gate (+ride) @@ -1297,7 +1297,7 @@ :: =/ rav ~> %slog.[0 leaf+"vega: compiling kernel {(scow %p (mug hyp))}"] - %- mure |. + %- road |. (slum cop [hyp van]) :: activate arvo, and extract the arvo core from the outer gate :: diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 50f3d301b..e6ea13113 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -12035,13 +12035,13 @@ ?~ a !! ~_(i.a $(a t.a)) :: -++ mure +++ road |* =(trap *) ^+ $:trap =/ res (mule trap) ?- -.res %& p.res - %| (mean leaf+"mure: road" p.res) + %| (mean leaf+"road: new" p.res) == :: ++ slew :: get axis in vase diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 47fc48815..8ce041e29 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -756,7 +756,7 @@ =^ sut=vase nub (run-tauts sut %lib lib.pile) =^ sut=vase nub (run-raw sut raw.pile) =^ sut=vase nub (run-bar sut bar.pile) - =/ res=vase (mure |.((slap sut hoon.pile))) + =/ res=vase (road |.((slap sut hoon.pile))) [res nub] :: ++ parse-pile @@ -1550,7 +1550,7 @@ zuse.u.fer :: ++ build-hoon - %- mure |. + %- road |. ~> %slog.0^leaf+"clay: building hoon on {}" =/ gen ~> %mean.%hoon-parse-fail @@ -1560,7 +1560,7 @@ :: ++ build-arvo |= hoon=vase - %- mure |. + %- road |. ~> %slog.0^leaf+"clay: building arvo on {}" =/ gen ~> %mean.%arvo-parse-fail @@ -1570,7 +1570,7 @@ :: ++ build-zuse |= arvo=vase - %- mure |. + %- road |. ~> %slog.0^leaf+"clay: building zuse on {}" =/ gen ~> %mean.%zuse-parse-fail @@ -4064,7 +4064,7 @@ (build-zuse arvo) :: ++ build-hoon - %- mure |. + %- road |. ~> %slog.0^leaf+"clay: building hoon on {}" =/ gen ~> %mean.%hoon-parse-fail @@ -4075,7 +4075,7 @@ :: ++ build-arvo |= hoon=vase - %- mure |. + %- road |. ~> %slog.0^leaf+"clay: building arvo on {}" =/ gen ~> %mean.%arvo-parse-fail @@ -4086,7 +4086,7 @@ :: ++ build-zuse |= arvo=vase - %- mure |. + %- road |. ~> %slog.0^leaf+"clay: building zuse on {}" =/ gen ~> %mean.%zuse-parse-fail From ac864bd42a0db364a7221c8abdfdd496c9e0326a Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Fri, 19 Jun 2020 14:10:22 -0400 Subject: [PATCH 222/280] chat-store: added %trim command as a hack that runs once +on-load and again every 5.000 messages --- pkg/arvo/app/chat-store.hoon | 55 ++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index b37b1f044..26c3fdf8d 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -8,14 +8,19 @@ $% state-zero state-one state-two + state-three == :: -+$ state-zero [%0 =inbox:store] -+$ state-one [%1 =inbox:store] -+$ state-two [%2 =inbox:store] ++$ state-zero [%0 =inbox:store] ++$ state-one [%1 =inbox:store] ++$ state-two [%2 =inbox:store] ++$ state-three [%3 =inbox:store] ++$ admin-action + $% [%trim ~] + == -- :: -=| state-two +=| state-three =* state - :: %- agent:dbug @@ -34,14 +39,18 @@ ++ on-load |= old-vase=vase =/ old !<(versioned-state old-vase) - ?: ?=(%2 -.old) + ?: ?=(%3 -.old) [~ this(state old)] + ?: ?=(%2 -.old) + :_ this(state [%3 inbox.old]) + [%pass /trim %agent [our.bowl %chat-store] %poke %noun !>([%trim ~])]~ =/ reversed-inbox=inbox:store %- ~(run by inbox.old) |= =mailbox:store ^- mailbox:store [config.mailbox (flop envelopes.mailbox)] - [~ this(state [%2 reversed-inbox])] + :_ this(state [%3 reversed-inbox]) + [%pass /trim %agent [our.bowl %chat-store] %poke %noun !>([%trim ~])]~ :: ++ on-poke ~/ %chat-store-poke @@ -52,6 +61,7 @@ ?+ mark (on-poke:def mark vase) %json (poke-json:cc !<(json vase)) %chat-action (poke-chat-action:cc !<(action:store vase)) + %noun (poke-noun:cc !<(admin-action vase)) == [cards this] :: @@ -148,6 +158,31 @@ [~ ~ %noun !>((swag [start (sub end start)] envelopes))] == :: +++ poke-noun + |= nou=admin-action + ^- (quip card _state) + ~& %trimming-chat-store + :- ~ + :- %3 + %- ~(urn by inbox) + |= [=path mailbox:store] + ^- mailbox:store + =/ [a=* out=(list envelope:store)] + %+ roll envelopes + |= $: =envelope:store + o=[[hav=(set serial:store) curr=@] out=(list envelope:store)] + == + ?: (~(has in hav.o) uid.envelope) + [[hav.o curr.o] out.o] + :- + ^- [(set serial:store) @] + [(~(put in hav.o) uid.envelope) +(curr.o)] + ^- (list envelope:store) + [envelope(number curr.o) out.o] + =/ len (lent out) + ~& [path [%old (lent envelopes)] [%new len]] + [[len len] (flop out)] +:: ++ poke-json |= jon=json ^- (quip card _state) @@ -197,8 +232,11 @@ [~ state] =. letter.envelope.action (evaluate-letter [author letter]:envelope.action) =^ envelope u.mailbox (prepend-envelope u.mailbox envelope.action) - :- (send-diff path.action action(envelope envelope)) - state(inbox (~(put by inbox) path.action u.mailbox)) + :_ state(inbox (~(put by inbox) path.action u.mailbox)) + ?: =((mod number.envelope 5.000) 0) + :- [%pass /trim %agent [our.bol %chat-store] %poke %noun !>([%trim ~])] + (send-diff path.action action(envelope envelope)) + (send-diff path.action action(envelope envelope)) :: ++ handle-messages |= act=action:store @@ -213,6 +251,7 @@ |- ^- (quip card _state) ?~ envelopes.act :_ state(inbox (~(put by inbox) path.act u.mailbox)) + :- [%pass /trim %agent [our.bol %chat-store] %poke %noun !>([%trim ~])] %+ send-diff path.act [%messages path.act 0 (lent evaluated-envelopes) evaluated-envelopes] =. letter.i.envelopes.act (evaluate-letter [author letter]:i.envelopes.act) From 05b665f90892f3cc387aaa232e0020e670286efa Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sat, 20 Jun 2020 14:45:52 +1000 Subject: [PATCH 223/280] interface: convert api and reducers to typescript --- pkg/interface/config/webpack.dev.js | 2 +- pkg/interface/config/webpack.prod.js | 2 +- pkg/interface/package-lock.json | Bin 431507 -> 443606 bytes pkg/interface/package.json | 4 +++ pkg/interface/src/api/{base.js => base.ts} | 0 pkg/interface/src/api/{chat.js => chat.ts} | 0 .../src/api/{global.js => global.ts} | 0 .../src/api/{groups.js => groups.ts} | 0 .../src/api/{launch.js => launch.ts} | 0 pkg/interface/src/api/{links.js => links.ts} | 0 .../src/api/{publish.js => publish.ts} | 0 .../{chat-update.js => chat-update.ts} | 0 .../{contact-update.js => contact-update.ts} | 0 .../{group-update.js => group-update.ts} | 0 .../{invite-update.js => invite-update.ts} | 0 .../{launch-update.js => launch-update.ts} | 0 .../{link-update.js => link-update.ts} | 0 .../{listen-update.js => listen-update.ts} | 0 .../src/reducers/{local.js => local.ts} | 0 ...{metadata-update.js => metadata-update.ts} | 0 ...mission-update.js => permission-update.ts} | 0 ...ublish-response.js => publish-response.ts} | 0 .../{publish-update.js => publish-update.ts} | 0 .../reducers/{s3-update.js => s3-update.ts} | 0 pkg/interface/tsconfig.json | 23 ++++++++++++++++++ 25 files changed, 29 insertions(+), 2 deletions(-) rename pkg/interface/src/api/{base.js => base.ts} (100%) rename pkg/interface/src/api/{chat.js => chat.ts} (100%) rename pkg/interface/src/api/{global.js => global.ts} (100%) rename pkg/interface/src/api/{groups.js => groups.ts} (100%) rename pkg/interface/src/api/{launch.js => launch.ts} (100%) rename pkg/interface/src/api/{links.js => links.ts} (100%) rename pkg/interface/src/api/{publish.js => publish.ts} (100%) rename pkg/interface/src/reducers/{chat-update.js => chat-update.ts} (100%) rename pkg/interface/src/reducers/{contact-update.js => contact-update.ts} (100%) rename pkg/interface/src/reducers/{group-update.js => group-update.ts} (100%) rename pkg/interface/src/reducers/{invite-update.js => invite-update.ts} (100%) rename pkg/interface/src/reducers/{launch-update.js => launch-update.ts} (100%) rename pkg/interface/src/reducers/{link-update.js => link-update.ts} (100%) rename pkg/interface/src/reducers/{listen-update.js => listen-update.ts} (100%) rename pkg/interface/src/reducers/{local.js => local.ts} (100%) rename pkg/interface/src/reducers/{metadata-update.js => metadata-update.ts} (100%) rename pkg/interface/src/reducers/{permission-update.js => permission-update.ts} (100%) rename pkg/interface/src/reducers/{publish-response.js => publish-response.ts} (100%) rename pkg/interface/src/reducers/{publish-update.js => publish-update.ts} (100%) rename pkg/interface/src/reducers/{s3-update.js => s3-update.ts} (100%) create mode 100644 pkg/interface/tsconfig.json diff --git a/pkg/interface/config/webpack.dev.js b/pkg/interface/config/webpack.dev.js index 319b1d1d7..cf84ec088 100644 --- a/pkg/interface/config/webpack.dev.js +++ b/pkg/interface/config/webpack.dev.js @@ -50,7 +50,7 @@ module.exports = { use: { loader: 'babel-loader', options: { - presets: ['@babel/preset-env', '@babel/preset-react'], + presets: ['@babel/preset-env', '@babel/typescript', '@babel/preset-react'], plugins: [ '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-optional-chaining', diff --git a/pkg/interface/config/webpack.prod.js b/pkg/interface/config/webpack.prod.js index 65df55fe0..e19e15940 100644 --- a/pkg/interface/config/webpack.prod.js +++ b/pkg/interface/config/webpack.prod.js @@ -15,7 +15,7 @@ module.exports = { use: { loader: 'babel-loader', options: { - presets: ['@babel/preset-env', '@babel/preset-react'], + presets: ['@babel/preset-env', '@babel/typescript', '@babel/preset-react'], plugins: [ '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-optional-chaining', diff --git a/pkg/interface/package-lock.json b/pkg/interface/package-lock.json index 18aa0ffd9084687ab01cf9699164ddce72b4f2ea..0fa9a666162adc3fa08efff3cbe8d486d775cdbb 100644 GIT binary patch delta 4453 zcmd5X3j0&Mdi4IIGOhAmFf2T-6$Qv*ed8E8BVDVh{c2BaHM zU_dF!H@h37P$2S2Z@BiQ!6HoA*qcI6!{!G%rH!c(>oP3D=hJq*SI0 zD(yfeT8fF?>eOOeq?pXoRMJdZhD`T)Sdg330Yt_VTN%a38oZQs*?gQKm}b8wwyLGH zlJG8GTgJiL^oaoCy)asa{N*vQZ*$fA)^7s`g7_H(1{YuR;qG4pZ|3&`YxAgokT|z= z8hr3juquxRbVqdIX0C7iVM@3$HwGR#|( zOcaM3j;h6tQLWmTmIy9cQOi_ytH;Tn78|7|oyeA^b$UIQBHV7n5zHyCK_ZN3 zgBBTy>HK7@LlLgw-Tpy<1eXGb{Wrb(yWnZ?$JY;m7x%1skN+gNaJcuX5uAB^1^j%^ z5&zWt{~vg!N^HqwF;g5S5-Gkg>Q~vmizsL~W8gi5H8W9Zl8cwDl)!bEemhL5C{ZW* zB$VxFLaLBRw_Baru+ZmHPRj9KT?>*xyMAbo&mDU5+1O7+^EU$z`^0TS-8P=R3zv^3p|aAWDFqo>t*L4u zBZ7%>*~CPjR?Rq>tZS4xs@D{OjimYnpKW5psD-K3HWt-K{R!>Fr(0sb5^ax_eCd=4B)Lp*fs%*~I8!&In98BjaxKofS-o-bUNdHsTu6%Qr z+6&Cl$F`Tgb9P|8^36v*xx4fLROl4qpZQ1>sHoKzdv&^0t~O!CtVryj<5CI2aKxUG z*MveNJl36T#WADZPSl~4NDEVtP6jnAJU^Ty@_B+l!#rOf=(I?#&3T@oa9Q0In2ONHgi;UPQphgt#He;-iODKa0&bCG;I}&w5O0Q=qV!Q=oDf_>831+lePlqnwn?*oA1gUs6JKsOVDz7p1rq_ zquv*k&;vE)7P1C7bYq9Vs$6NDo2F%RSRQAM>9m}qHCj^XC?2oY^@)m#<5(=->$5^F zYQQ*&V;n3cny$w5peS1Cx3;8klxSz`*4RPv6R{!}1|+^vnomqv@8z?BKNs>>FYE{B zZ>&F{(`(>`8%MyCv2BmeOJTK)Fg233>+NPsDJslZi^&~Vi^RwlHI}(ZvER=PAVkVJ zd>CmneA*Cm3~XgAw~lw&DHZ2XStN6kE+b8q5NntSB0hc4g9;Au3>XJrQilvdfZt1SgVG{#k z2xE&PCuSMz7#(IPYK|e7oo<$yrQn7KZ-gH89l8pB`J7qVC@9x0riflUFNLL?i#6(7RD2o>Ymj1gL0`3r>8&@`*USLsq?MY-um}?DK2hOJ50uK>qm+@4$t? zI=Jesg7dppf&AJ+wiY$xMs5}S^7(^4+Ie|n36m51#X@dEMsg}$Q6?s{Z< zxkD)a4tp59`5&tf_;UpufBhqjZ(s0L3u^I0v6FY>(R|p1<61E`Dx{|I5m$ppjaC*O z>t!r9i0N8$I0%P(Y@uzI>SGiWP%#5X+RciafQ&*~CL#jXsh~(Q73Sv!=st{pe0>&0 zbGSRI?V@V_`Hz_GdUsw9?FP5}V#;E{koWV8z7jthUwR1K>F>Jo#_stpP*)Ct15d1Y z|MKYay6>6&-aB6j>p3{@+Wc;Oe&3umZHo>lg%M+coK~9O%P5|tu13x)(|)b!;M;rvN?{B;+ZmLWve~Z4tHC$ zo8hySG2G4>6yqX7Q8e?KTN~q(F_I$KDiqTtv@z=DhJX--MMI2Seex3<;=iDwu@V|le0PekQhcE!Wx9a`Re=QyIpD+J#=}C^R@C~NJg`rB%}&n6pUpZtJ_&m!oHJ@Wu;~87l8L z&jgQoAHEejRn5y424jaA-6}IBI*husSt+5hq}vTAEhG&iDKu5E)qI-ZGhKm^JH?c4 zB|2!LoDj0T3EVDYMYh*Q^l3d4XLNtQX(TM~@@nApu0?VJ>A#PKVrLR(Fpqd;8TFmB z@`&A$TC*W~e&0kE*2}N>jF=gs(`ag1u_8gr)}%OO>``+|QH=Z~UsRc7EE|<86xy&M z7vf@5E`k))$utuQx57v^F{;UPU(k_l8BA<;HCjqN_{-6S%a=H=MXp zo8%bp)eo1>?)n%EAJE=~qwK-Z?btJ10RO*-J@{tu5%0@?9g59->hJ9LzJ4=!=&RT7 YeC_(3fPXFd*Rp>FuV23ty7kJR0K)O>p8x;= delta 106 zcmccCDLr|$)P|c$lQ&%AnjD|Tzxh|{8;8lOPw-BkwwpzK@`MgQ5NGl96Jpcf2r+YQ zKKn4kV7sRGy!fS7fAyDXdk FascywDir_# diff --git a/pkg/interface/package.json b/pkg/interface/package.json index 15701e275..d26818432 100644 --- a/pkg/interface/package.json +++ b/pkg/interface/package.json @@ -34,6 +34,10 @@ "@babel/plugin-proposal-optional-chaining": "^7.9.0", "@babel/preset-env": "^7.9.5", "@babel/preset-react": "^7.9.4", + "@babel/preset-typescript": "^7.10.1", + "@types/lodash": "^4.14.155", + "@types/react": "^16.9.38", + "@types/react-router-dom": "^5.1.5", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", diff --git a/pkg/interface/src/api/base.js b/pkg/interface/src/api/base.ts similarity index 100% rename from pkg/interface/src/api/base.js rename to pkg/interface/src/api/base.ts diff --git a/pkg/interface/src/api/chat.js b/pkg/interface/src/api/chat.ts similarity index 100% rename from pkg/interface/src/api/chat.js rename to pkg/interface/src/api/chat.ts diff --git a/pkg/interface/src/api/global.js b/pkg/interface/src/api/global.ts similarity index 100% rename from pkg/interface/src/api/global.js rename to pkg/interface/src/api/global.ts diff --git a/pkg/interface/src/api/groups.js b/pkg/interface/src/api/groups.ts similarity index 100% rename from pkg/interface/src/api/groups.js rename to pkg/interface/src/api/groups.ts diff --git a/pkg/interface/src/api/launch.js b/pkg/interface/src/api/launch.ts similarity index 100% rename from pkg/interface/src/api/launch.js rename to pkg/interface/src/api/launch.ts diff --git a/pkg/interface/src/api/links.js b/pkg/interface/src/api/links.ts similarity index 100% rename from pkg/interface/src/api/links.js rename to pkg/interface/src/api/links.ts diff --git a/pkg/interface/src/api/publish.js b/pkg/interface/src/api/publish.ts similarity index 100% rename from pkg/interface/src/api/publish.js rename to pkg/interface/src/api/publish.ts diff --git a/pkg/interface/src/reducers/chat-update.js b/pkg/interface/src/reducers/chat-update.ts similarity index 100% rename from pkg/interface/src/reducers/chat-update.js rename to pkg/interface/src/reducers/chat-update.ts diff --git a/pkg/interface/src/reducers/contact-update.js b/pkg/interface/src/reducers/contact-update.ts similarity index 100% rename from pkg/interface/src/reducers/contact-update.js rename to pkg/interface/src/reducers/contact-update.ts diff --git a/pkg/interface/src/reducers/group-update.js b/pkg/interface/src/reducers/group-update.ts similarity index 100% rename from pkg/interface/src/reducers/group-update.js rename to pkg/interface/src/reducers/group-update.ts diff --git a/pkg/interface/src/reducers/invite-update.js b/pkg/interface/src/reducers/invite-update.ts similarity index 100% rename from pkg/interface/src/reducers/invite-update.js rename to pkg/interface/src/reducers/invite-update.ts diff --git a/pkg/interface/src/reducers/launch-update.js b/pkg/interface/src/reducers/launch-update.ts similarity index 100% rename from pkg/interface/src/reducers/launch-update.js rename to pkg/interface/src/reducers/launch-update.ts diff --git a/pkg/interface/src/reducers/link-update.js b/pkg/interface/src/reducers/link-update.ts similarity index 100% rename from pkg/interface/src/reducers/link-update.js rename to pkg/interface/src/reducers/link-update.ts diff --git a/pkg/interface/src/reducers/listen-update.js b/pkg/interface/src/reducers/listen-update.ts similarity index 100% rename from pkg/interface/src/reducers/listen-update.js rename to pkg/interface/src/reducers/listen-update.ts diff --git a/pkg/interface/src/reducers/local.js b/pkg/interface/src/reducers/local.ts similarity index 100% rename from pkg/interface/src/reducers/local.js rename to pkg/interface/src/reducers/local.ts diff --git a/pkg/interface/src/reducers/metadata-update.js b/pkg/interface/src/reducers/metadata-update.ts similarity index 100% rename from pkg/interface/src/reducers/metadata-update.js rename to pkg/interface/src/reducers/metadata-update.ts diff --git a/pkg/interface/src/reducers/permission-update.js b/pkg/interface/src/reducers/permission-update.ts similarity index 100% rename from pkg/interface/src/reducers/permission-update.js rename to pkg/interface/src/reducers/permission-update.ts diff --git a/pkg/interface/src/reducers/publish-response.js b/pkg/interface/src/reducers/publish-response.ts similarity index 100% rename from pkg/interface/src/reducers/publish-response.js rename to pkg/interface/src/reducers/publish-response.ts diff --git a/pkg/interface/src/reducers/publish-update.js b/pkg/interface/src/reducers/publish-update.ts similarity index 100% rename from pkg/interface/src/reducers/publish-update.js rename to pkg/interface/src/reducers/publish-update.ts diff --git a/pkg/interface/src/reducers/s3-update.js b/pkg/interface/src/reducers/s3-update.ts similarity index 100% rename from pkg/interface/src/reducers/s3-update.js rename to pkg/interface/src/reducers/s3-update.ts diff --git a/pkg/interface/tsconfig.json b/pkg/interface/tsconfig.json new file mode 100644 index 000000000..7779aa9df --- /dev/null +++ b/pkg/interface/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "noFallthroughCasesInSwitch": true, + "noUnusedParameters": false, + "noImplicitReturns": true, + "moduleResolution": "node", + "esModuleInterop": true, + "noUnusedLocals": false, + "noImplicitAny": false, + "target": "es2015", + "module": "es2015", + "strict": true, + "jsx": "react" + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules", + "dist" + ] +} From 652dc70304d44ddef5f39de62d17abe42e050350 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 20 Jun 2020 03:45:53 -0400 Subject: [PATCH 224/280] clay,dojo: clean up stack traces --- pkg/arvo/app/dojo.hoon | 4 +++- pkg/arvo/sys/vane/clay.hoon | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index e4a050903..84ed2247f 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -673,6 +673,7 @@ (slop (dy-vase p.i.src) $(src t.src)) :: ++ dy-run-generator + !. |= [cay=cage cig=dojo-config] ^+ +>+> ?. (~(nest ut [%cell [%atom %$ ~] %noun]) | p.q.cay) @@ -699,7 +700,7 @@ (he-diff(poy ~) %tan p.wat) =- =/ res (mule -) ?: ?=(%| -.res) - (he-diff(poy ~) %tan p.res) + (he-diff(poy ~) %tan leaf+"dojo: generator failure" p.res) ?- p.wat %ask (dy-made-dial %noun p.res) %say (dy-made-gent %noun p.res) @@ -844,6 +845,7 @@ ^- (each cage tang) ?^ val=(dy-hoon-var hoon) &+u.val + !. %- mule |. :- %noun =/ vaz=(list [term vase]) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 8ce041e29..9aab66223 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -440,6 +440,7 @@ [+<- +<+>-] :: cache.state :: ++ ford + !. => |% +$ build $% [%file =path] @@ -499,6 +500,7 @@ =^ cage nub (validate-page path page) [cage nub] ?< (~(has in deletes) path) + ~| %file-not-found^path :_(nub (need (~(get an ankh) path))) :: +get-mark: build a mark definition :: @@ -3266,6 +3268,7 @@ :: ford :: ++ read-a + !. |= [=aeon =path] ^- [(unit (unit (each cage lobe))) ford-cache] ?. =(aeon let.dom) @@ -3287,6 +3290,7 @@ :_(fod.dom [~ ~ %& %vase !>(vase)]) :: ++ read-b + !. |= [=aeon =path] ^- [(unit (unit (each cage lobe))) ford-cache] ?. =(aeon let.dom) @@ -3302,6 +3306,7 @@ :_(fod.dom [~ ~ %& %dais !>(dais)]) :: ++ read-c + !. |= [=aeon =path] ^- [(unit (unit (each cage lobe))) ford-cache] ?. =(aeon let.dom) @@ -3650,9 +3655,9 @@ [~ fod] :: virtualize to catch and produce deterministic failures :: + !. =- ?:(?=(%& -<) p.- ((slog p.-) [[~ ~] fod])) %- mule |. - :: ?- care.mun %d :_ fod From 4dfce2a7570570e2a240345e3134bf1a18962803 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sat, 20 Jun 2020 21:26:44 +1000 Subject: [PATCH 225/280] interface: correct order of arguments in resubscribe logic --- pkg/interface/src/subscription/base.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/interface/src/subscription/base.js b/pkg/interface/src/subscription/base.js index d710425e2..be56b6563 100644 --- a/pkg/interface/src/subscription/base.js +++ b/pkg/interface/src/subscription/base.js @@ -12,10 +12,10 @@ export default class BaseSubscription { onChannelError(err) { console.error('event source error: ', err); - setTimeout(2000, () => { + setTimeout(() => { this.store.clear(); this.start(); - }); + }, 2000); } subscribe(path, app) { From 60ff310422d74a4f28a4cff3aa35b936b4e16c80 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 22 Jun 2020 14:59:02 +1000 Subject: [PATCH 226/280] interface: make store global --- pkg/arvo/app/link-view.hoon | 6 + pkg/interface/config/webpack.dev.js | 4 +- pkg/interface/src/App.js | 7 +- pkg/interface/src/api/base.ts | 44 ++-- pkg/interface/src/api/chat.ts | 241 +++++++----------- pkg/interface/src/api/contacts.ts | 62 +++++ pkg/interface/src/api/global.ts | 41 +-- pkg/interface/src/api/groups.ts | 54 +--- pkg/interface/src/api/invite.ts | 27 ++ pkg/interface/src/api/launch.ts | 39 +-- pkg/interface/src/api/links.ts | 157 +++--------- pkg/interface/src/api/local.ts | 28 ++ pkg/interface/src/api/metadata.ts | 31 +++ pkg/interface/src/api/publish.ts | 37 +-- pkg/interface/src/components/GroupFilter.js | 2 +- pkg/interface/src/components/SidebarSwitch.js | 2 +- pkg/interface/src/reducers/chat-update.ts | 38 +-- pkg/interface/src/reducers/contact-update.ts | 21 +- pkg/interface/src/reducers/group-update.ts | 21 +- pkg/interface/src/reducers/invite-update.ts | 25 +- pkg/interface/src/reducers/launch-update.ts | 17 +- pkg/interface/src/reducers/link-update.ts | 75 +++--- pkg/interface/src/reducers/listen-update.ts | 21 +- pkg/interface/src/reducers/local.ts | 25 +- pkg/interface/src/reducers/metadata-update.ts | 21 +- .../src/reducers/permission-update.ts | 19 +- .../src/reducers/publish-response.ts | 16 +- pkg/interface/src/reducers/publish-update.ts | 30 ++- pkg/interface/src/reducers/s3-update.ts | 38 +-- pkg/interface/src/store/{base.js => base.ts} | 14 +- pkg/interface/src/store/store.ts | 92 +++++++ pkg/interface/src/store/type.ts | 53 ++++ .../src/subscription/{base.js => base.ts} | 23 +- pkg/interface/src/subscription/global.js | 9 - pkg/interface/src/subscription/global.ts | 69 +++++ pkg/interface/src/types/cage.ts | 35 +++ pkg/interface/src/types/chat-hook-update.ts | 5 + pkg/interface/src/types/chat-update.ts | 95 +++++++ pkg/interface/src/types/contact-update.ts | 85 ++++++ pkg/interface/src/types/global.ts | 7 + pkg/interface/src/types/group-update.ts | 59 +++++ pkg/interface/src/types/invite-update.ts | 67 +++++ pkg/interface/src/types/launch-update.ts | 53 ++++ pkg/interface/src/types/link-listen-update.ts | 18 ++ pkg/interface/src/types/link-update.ts | 84 ++++++ pkg/interface/src/types/local-update.ts | 15 ++ pkg/interface/src/types/metadata-update.ts | 54 ++++ pkg/interface/src/types/noun.ts | 25 ++ pkg/interface/src/types/permission-update.ts | 55 ++++ pkg/interface/src/types/publish-response.ts | 48 ++++ pkg/interface/src/types/publish-update.ts | 158 ++++++++++++ pkg/interface/src/types/s3-update.ts | 63 +++++ 52 files changed, 1750 insertions(+), 585 deletions(-) create mode 100644 pkg/interface/src/api/contacts.ts create mode 100644 pkg/interface/src/api/invite.ts create mode 100644 pkg/interface/src/api/local.ts create mode 100644 pkg/interface/src/api/metadata.ts rename pkg/interface/src/store/{base.js => base.ts} (63%) create mode 100644 pkg/interface/src/store/store.ts create mode 100644 pkg/interface/src/store/type.ts rename pkg/interface/src/subscription/{base.js => base.ts} (53%) delete mode 100644 pkg/interface/src/subscription/global.js create mode 100644 pkg/interface/src/subscription/global.ts create mode 100644 pkg/interface/src/types/cage.ts create mode 100644 pkg/interface/src/types/chat-hook-update.ts create mode 100644 pkg/interface/src/types/chat-update.ts create mode 100644 pkg/interface/src/types/contact-update.ts create mode 100644 pkg/interface/src/types/global.ts create mode 100644 pkg/interface/src/types/group-update.ts create mode 100644 pkg/interface/src/types/invite-update.ts create mode 100644 pkg/interface/src/types/launch-update.ts create mode 100644 pkg/interface/src/types/link-listen-update.ts create mode 100644 pkg/interface/src/types/link-update.ts create mode 100644 pkg/interface/src/types/local-update.ts create mode 100644 pkg/interface/src/types/metadata-update.ts create mode 100644 pkg/interface/src/types/noun.ts create mode 100644 pkg/interface/src/types/permission-update.ts create mode 100644 pkg/interface/src/types/publish-response.ts create mode 100644 pkg/interface/src/types/publish-update.ts create mode 100644 pkg/interface/src/types/s3-update.ts diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index 23bbb3b51..c41a93bae 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -453,6 +453,7 @@ [%give %kick ~ ~]~ =; =json [%give %fact ~ %json !>(json)] + %+ frond:enjs:format 'link-update' %+ frond:enjs:format 'initial-submissions' %- pairs:enjs:format %+ turn @@ -514,6 +515,7 @@ :_ [%give %kick ~ ~]~ =; =json [%give %fact ~ %json !>(json)] + %+ frond:enjs:format 'link-update' %+ frond:enjs:format 'submission' ^- json =; sub=(unit submission) @@ -538,6 +540,7 @@ [%give %kick ~ ~]~ =; =json [%give %fact ~ %json !>(json)] + %+ frond:enjs:format 'link-update' %+ frond:enjs:format 'initial-discussions' %^ page-to-json p %+ get-paginated `p @@ -552,6 +555,7 @@ ?+ -.update ~|([dap.bowl %unexpected-update -.update] !!) %submissions %+ give-json + %+ frond:enjs:format 'link-update' (update:en-json update) :~ /json/0/submissions (weld /json/0/submissions path.update) @@ -559,6 +563,7 @@ :: %discussions %+ give-json + %+ frond:enjs:format 'link-update' (update:en-json update) :_ ~ %+ weld /json/0/discussions @@ -566,6 +571,7 @@ :: %observation %+ give-json + %+ frond:enjs:format 'link-update' (update:en-json update) ~[/json/seen] == diff --git a/pkg/interface/config/webpack.dev.js b/pkg/interface/config/webpack.dev.js index cf84ec088..75e68ac1e 100644 --- a/pkg/interface/config/webpack.dev.js +++ b/pkg/interface/config/webpack.dev.js @@ -46,7 +46,7 @@ module.exports = { module: { rules: [ { - test: /\.js?$/, + test: /\.(j|t)sx?$/, use: { loader: 'babel-loader', options: { @@ -74,7 +74,7 @@ module.exports = { ] }, resolve: { - extensions: ['.js'] + extensions: ['.js', '.ts', '.tsx'] }, devtool: 'inline-source-map', // devServer: { diff --git a/pkg/interface/src/App.js b/pkg/interface/src/App.js index e763554dc..68e06d04b 100644 --- a/pkg/interface/src/App.js +++ b/pkg/interface/src/App.js @@ -15,7 +15,7 @@ import PublishApp from './apps/publish/app'; import StatusBar from './components/StatusBar'; import NotFound from './components/404'; -import GlobalStore from './store/global'; +import GlobalStore from './store/store'; import GlobalSubscription from './subscription/global'; import GlobalApi from './api/global'; @@ -55,11 +55,11 @@ export default class App extends React.Component { this.appChannel = new window.channel(); this.api = new GlobalApi(this.ship, this.appChannel, this.store); + this.subscription = + new GlobalSubscription(this.store, this.api, this.appChannel); } componentDidMount() { - this.subscription = - new GlobalSubscription(this.store, this.api, this.appChannel); this.subscription.start(); } @@ -68,6 +68,7 @@ export default class App extends React.Component { const associations = this.state.associations ? this.state.associations : { contacts: {} }; const selectedGroups = this.state.selectedGroups ? this.state.selectedGroups : []; + const { state } = this; return ( diff --git a/pkg/interface/src/api/base.ts b/pkg/interface/src/api/base.ts index eaffa3dc6..1aec1b22c 100644 --- a/pkg/interface/src/api/base.ts +++ b/pkg/interface/src/api/base.ts @@ -1,19 +1,24 @@ -import _ from 'lodash'; -import { uuid } from '../lib/util'; +import _ from "lodash"; +import { uuid } from "../lib/util"; +import { Patp, Path } from "../types/noun"; +import BaseStore from '../store/base'; +export default class BaseApi { + bindPaths: Path[] = []; + constructor(public ship: Patp, public channel: any, public store: BaseStore) {} + + unsubscribe(id: number) { + this.channel.unsubscribe(id); -export default class BaseApi { - constructor(ship, channel, store) { - this.ship = ship; - this.channel = channel; - this.store = store; - this.bindPaths = []; } - subscribe(path, method, ship = this.ship, app, success, fail, quit) { + subscribe(path: Path, method, ship = this.ship, app: string, success, fail, quit) { this.bindPaths = _.uniq([...this.bindPaths, path]); - window.subscriptionId = this.channel.subscribe(ship, app, path, + return this.channel.subscribe( + this.ship, + app, + path, (err) => { fail(err); }, @@ -22,25 +27,30 @@ export default class BaseApi { data: event, from: { ship, - path - } + path, + }, }); }, (qui) => { quit(qui); - }); + } + ); } - action(appl, mark, data) { + action(appl: string, mark: string, data: any): Promise { return new Promise((resolve, reject) => { - this.channel.poke(window.ship, appl, mark, data, + this.channel.poke( + (window as any).ship, + appl, + mark, + data, (json) => { resolve(json); }, (err) => { reject(err); - }); + } + ); }); } } - diff --git a/pkg/interface/src/api/chat.ts b/pkg/interface/src/api/chat.ts index aeb7d23e9..bfc8d3e5a 100644 --- a/pkg/interface/src/api/chat.ts +++ b/pkg/interface/src/api/chat.ts @@ -1,85 +1,31 @@ import BaseApi from './base'; import { uuid } from '../lib/util'; +import { Letter, ChatAction, Envelope } from '../types/chat-update'; +import { Patp, Path, PatpNoSig } from '../types/noun'; +import { StoreState } from '../store/type'; +import BaseStore from '../store/base'; -export default class ChatApi { - constructor(ship, channel, store) { - const helper = new PrivateHelper(ship, channel, store); - this.ship = ship; - this.subscribe = helper.subscribe.bind(helper); +export default class ChatApi extends BaseApi { - this.groups = { - add: helper.groupAdd.bind(helper), - remove: helper.groupRemove.bind(helper) - }; - - this.chat = { - message: helper.chatMessage.bind(helper), - read: helper.chatRead.bind(helper) - }; - - this.chatView = { - create: helper.chatViewCreate.bind(helper), - delete: helper.chatViewDelete.bind(helper), - join: helper.chatViewJoin.bind(helper), - groupify: helper.chatViewGroupify.bind(helper) - }; - - this.chatHook = { - addSynced: helper.chatHookAddSynced.bind(helper) - }; - - this.invite = { - accept: helper.inviteAccept.bind(helper), - decline: helper.inviteDecline.bind(helper) - }; - - this.metadata = { - add: helper.metadataAdd.bind(helper) - }; - this.sidebarToggle = helper.sidebarToggle.bind(helper); - } -} - -class PrivateHelper extends BaseApi { - groupsAction(data) { - return this.action('group-store', 'group-action', data); + /** + * Fetch backlog + */ + fetchMessages(start: number, end: number, path: Path) { + fetch(`/chat-view/paginate/${start}/${end}${path}`) + .then(response => response.json()) + .then((json) => { + this.store.handleEvent({ + data: json + }); + }); } - groupAdd(members, path) { - return this.groupsAction({ - add: { - members, path - } - }); - } - - groupRemove(members, path) { - this.groupsAction({ - remove: { - members, path - } - }); - } - - chatAction(data) { - this.action('chat-store', 'json', data); - } - - addPendingMessage(msg) { - if (this.store.state.pendingMessages.has(msg.path)) { - this.store.state.pendingMessages.get(msg.path).unshift(msg.envelope); - } else { - this.store.state.pendingMessages.set(msg.path, [msg.envelope]); - } - - this.store.setState({ - pendingMessages: this.store.state.pendingMessages - }); - } - - chatMessage(path, author, when, letter) { - const data = { + /** + * Send a message to the chat at path + */ + message(path: Path, author: Patp, when: string, letter: Letter): Promise { + const data: ChatAction = { message: { path, envelope: { @@ -92,36 +38,30 @@ class PrivateHelper extends BaseApi { } }; - this.action('chat-hook', 'json', data).then(() => { - this.chatRead(path); + const promise = this.proxyHookAction(data).then(() => { + this.read(path); }); data.message.envelope.author = data.message.envelope.author.substr(1); - this.addPendingMessage(data.message); + this.addPendingMessage(data.message.path, data.message.envelope); + return promise; } - chatRead(path, read) { - this.chatAction({ read: { path } }); + /** + * Mark chat as read + */ + read(path: Path): Promise { + return this.storeAction({ read: { path } }); } - chatHookAddSynced(ship, path, askHistory) { - return this.action('chat-hook', 'chat-hook-action', { - 'add-synced': { - ship, - path, - 'ask-history': askHistory - } - }); - } - chatViewAction(data) { - return this.action('chat-view', 'json', data); - } - - chatViewCreate( - title, description, appPath, groupPath, - security, members, allowHistory - ) { - return this.chatViewAction({ + /** + * Create a chat and setup metadata + */ + create( + title: string, description: string, appPath: string, groupPath: string, + security: any, members: PatpNoSig[], allowHistory: boolean + ): Promise { + return this.viewAction({ create: { title, description, @@ -134,12 +74,20 @@ class PrivateHelper extends BaseApi { }); } - chatViewDelete(path) { - this.chatViewAction({ delete: { 'app-path': path } }); + /** + * Deletes a chat + * + * If we don't host the chat, then it just leaves + */ + delete(path: Path) { + this.viewAction({ delete: { 'app-path': path } }); } - chatViewJoin(ship, path, askHistory) { - this.chatViewAction({ + /** + * Join a chat + */ + join(ship: Patp, path: Path, askHistory: boolean): Promise { + return this.viewAction({ join: { ship, 'app-path': path, @@ -148,75 +96,64 @@ class PrivateHelper extends BaseApi { }); } - chatViewGroupify(path, group = null, inclusive = false) { - const action = { groupify: { 'app-path': path, existing: null } }; + /** + * Groupify a chat that we host + * + * Will delete the old chat, recreate it based on a proper group, + * and invite the current whitelist to that group. + * existing messages get moved over. + * + * :existing is provided, associates chat with that group instead + * creating a new one. :inclusive indicates whether or not to add + * chat members to the group, if they aren't there already. + */ + groupify(path: Path, group: Path | null = null, inclusive = false) { + let action: any = { groupify: { 'app-path': path, existing: null } }; if (group) { action.groupify.existing = { 'group-path': group, inclusive: inclusive }; } - return this.chatViewAction(action); + return this.viewAction(action); } - inviteAction(data) { - this.action('invite-store', 'json', data); - } - - inviteAccept(uid) { - this.inviteAction({ - accept: { - path: '/chat', - uid + /** + * Begin syncing a chat from the host + */ + addSynced(ship: Patp, path: Path, askHistory: boolean): Promise { + return this.action('chat-hook', 'chat-hook-action', { + 'add-synced': { + ship, + path, + 'ask-history': askHistory } }); } - inviteDecline(uid) { - this.inviteAction({ - decline: { - path: '/chat', - uid - } - }); + + private storeAction(action: ChatAction): Promise { + return this.action('chat-store', 'json', action) } - metadataAction(data) { - return this.action('metadata-hook', 'metadata-action', data); + private proxyHookAction(action: ChatAction): Promise { + return this.action('chat-hook', 'json', action); } - metadataAdd(appPath, groupPath, title, description, dateCreated, color) { - const creator = `~${window.ship}`; - return this.metadataAction({ - add: { - 'group-path': groupPath, - resource: { - 'app-path': appPath, - 'app-name': 'chat' - }, - metadata: { - title, - description, - color, - 'date-created': dateCreated, - creator - } - } - }); + private viewAction(action: unknown): Promise { + return this.action('chat-view', 'json', action); } - sidebarToggle() { - let sidebarBoolean = true; - if (this.store.state.sidebarShown === true) { - sidebarBoolean = false; + private addPendingMessage(path: Path, envelope: Envelope) { + const pending = this.store.state.pendingMessages.get(path); + if (pending) { + pending.unshift(envelope); + } else { + this.store.state.pendingMessages.set(path, [envelope]); } - this.store.handleEvent({ - data: { - local: { - sidebarToggle: sidebarBoolean - } - } + + this.store.setState({ + pendingMessages: this.store.state.pendingMessages }); } } - diff --git a/pkg/interface/src/api/contacts.ts b/pkg/interface/src/api/contacts.ts new file mode 100644 index 000000000..d2db3ce1d --- /dev/null +++ b/pkg/interface/src/api/contacts.ts @@ -0,0 +1,62 @@ +import BaseApi from './base'; +import { StoreState } from '../store/type'; +import { Patp, Path } from '../types/noun'; +import { Contact, ContactEdit } from '../types/contact-update'; + +export default class ContactsApi extends BaseApi { + + create(path: Path, ships: Patp[] = [], title: string, description: string) { + return this.viewAction({ + create: { + path, + ships, + title, + description + } + }); + } + + share(recipient: Patp, path: Patp, ship: Patp, contact: Contact) { + return this.viewAction({ + share: { + recipient, path, ship, contact + } + }); + } + + contactDelete(path: Path) { + return this.viewAction({ delete: { path } }); + } + + contactRemove(path: Path, ship: Patp) { + return this.viewAction({ remove: { path, ship } }); + } + + + + contactEdit(path: Path, ship: Patp, editField: ContactEdit) { + /* editField can be... + {nickname: ''} + {email: ''} + {phone: ''} + {website: ''} + {notes: ''} + {color: 'fff'} // with no 0x prefix + {avatar: null} + {avatar: {url: ''}} + */ + return this.hookAction({ + edit: { + path, ship, 'edit-field': editField + } + }); + } + + private hookAction(data) { + return this.action('contact-hook', 'contact-action', data); + } + + private viewAction(data) { + return this.action('contact-view', 'json', data); + } +} diff --git a/pkg/interface/src/api/global.ts b/pkg/interface/src/api/global.ts index 0ed286464..15802b3f3 100644 --- a/pkg/interface/src/api/global.ts +++ b/pkg/interface/src/api/global.ts @@ -1,26 +1,29 @@ +import { Patp } from '../types/noun'; import BaseApi from './base'; +import ChatApi from './chat'; +import { StoreState } from '../store/type'; +import GlobalStore from '../store/store'; +import LocalApi from './local'; +import InviteApi from './invite'; +import MetadataApi from './metadata'; +import ContactsApi from './contacts'; +import GroupsApi from './groups'; +import LaunchApi from './launch'; +import LinksApi from './links'; -class PrivateHelper extends BaseApi { - setSelected(selected) { - this.store.handleEvent({ - data: { - local: { - selected: selected - } - } - }); - } +export default class GlobalApi extends BaseApi { + chat = new ChatApi(this.ship, this.channel, this.store); + local = new LocalApi(this.ship, this.channel, this.store); + invite = new InviteApi(this.ship, this.channel, this.store); + metadata = new MetadataApi(this.ship, this.channel, this.store); + contacts = new ContactsApi(this.ship, this.channel, this.store); + groups = new GroupsApi(this.ship, this.channel, this.store); + launch = new LaunchApi(this.ship, this.channel, this.store); + links = new LinksApi(this.ship, this.channel, this.store); -} -export default class GlobalApi { - constructor(ship, channel, store) { - const helper = new PrivateHelper(ship, channel, store); - - this.ship = ship; - this.subscribe = helper.subscribe.bind(helper); - - this.setSelected = helper.setSelected.bind(helper); + constructor(public ship: Patp, public channel: any, public store: GlobalStore) { + super(ship,channel,store); } } diff --git a/pkg/interface/src/api/groups.ts b/pkg/interface/src/api/groups.ts index a735201c8..73ed398c4 100644 --- a/pkg/interface/src/api/groups.ts +++ b/pkg/interface/src/api/groups.ts @@ -1,37 +1,19 @@ import BaseApi from './base'; +import { StoreState } from '../store/type'; +import { Path, Patp } from '../types/noun'; -export default class GroupsApi { - constructor(ship, channel, store) { - const helper = new PrivateHelper(ship, channel, store); +export default class GroupsApi extends BaseApi { + add(path: Path, ships: Patp[] = []) { + return this.action('group-store', 'group-action', { + add: { members: ships, path } + }); + } - this.ship = ship; - this.subscribe = helper.subscribe.bind(helper); - - this.contactHook = { - edit: helper.contactEdit.bind(helper) - }; - - this.contactView = { - create: helper.contactCreate.bind(helper), - delete: helper.contactDelete.bind(helper), - remove: helper.contactRemove.bind(helper), - share: helper.contactShare.bind(helper) - }; - - this.group = { - add: helper.groupAdd.bind(helper), - remove: helper.groupRemove.bind(helper) - }; - - this.metadata = { - add: helper.metadataAdd.bind(helper) - }; - - this.invite = { - accept: helper.inviteAccept.bind(helper), - decline: helper.inviteDecline.bind(helper) - }; + remove(path: Path, ships: Patp[] = []) { + return this.action('group-store', 'group-action', { + remove: { members: ships, path } + }); } } @@ -51,17 +33,9 @@ class PrivateHelper extends BaseApi { }); } - groupAdd(path, ships = []) { - return this.action('group-store', 'group-action', { - add: { members: ships, path } - }); - } - groupRemove(path, ships) { - return this.action('group-store', 'group-action', { - remove: { members: ships, path } - }); - } + + contactShare(recipient, path, ship, contact) { return this.contactViewAction({ diff --git a/pkg/interface/src/api/invite.ts b/pkg/interface/src/api/invite.ts new file mode 100644 index 000000000..0e81ffec3 --- /dev/null +++ b/pkg/interface/src/api/invite.ts @@ -0,0 +1,27 @@ +import BaseApi from "./base"; +import { StoreState } from "../store/type"; +import { Serial, Path } from "../types/noun"; + +export default class InviteApi extends BaseApi { + accept(app: Path, uid: Serial) { + return this.inviteAction({ + accept: { + path: app, + uid + } + }); + } + + decline(app: Path, uid: Serial) { + return this.inviteAction({ + decline: { + path: app, + uid + } + }); + } + + private inviteAction(action) { + return this.action('invite-store', 'json', action); + } +} diff --git a/pkg/interface/src/api/launch.ts b/pkg/interface/src/api/launch.ts index 214e1ee9e..1e6fa4a33 100644 --- a/pkg/interface/src/api/launch.ts +++ b/pkg/interface/src/api/launch.ts @@ -1,51 +1,36 @@ import BaseApi from './base'; +import { StoreState } from '../store/type'; -class PrivateHelper extends BaseApi { - launchAction(data) { - this.action('launch', 'launch-action', data); - } - launchAdd(name, tile = { basic : { title: '', linkedUrl: '', iconUrl: '' }}) { +export default class LaunchApi extends BaseApi { + + add(name: string, tile = { basic : { title: '', linkedUrl: '', iconUrl: '' }}) { this.launchAction({ add: { name, tile } }); } - launchRemove(name) { + remove(name: string) { this.launchAction({ remove: name }); } - launchChangeOrder(orderedTiles = []) { + changeOrder(orderedTiles = []) { this.launchAction({ 'change-order': orderedTiles }); } - launchChangeFirstTime(firstTime = true) { + changeFirstTime(firstTime = true) { this.launchAction({ 'change-first-time': firstTime }); } - launchChangeIsShown(name, isShown = true) { + changeIsShown(name: string, isShown = true) { this.launchAction({ 'change-is-shown': { name, isShown }}); } - weatherAction(latlng) { + weather(latlng: any) { this.action('weather', 'json', latlng); } -} -export default class LaunchApi { - constructor(ship, channel, store) { - const helper = new PrivateHelper(ship, channel, store); - - this.ship = ship; - this.subscribe = helper.subscribe.bind(helper); - - this.launch = { - add: helper.launchAdd.bind(helper), - remove: helper.launchRemove.bind(helper), - changeOrder: helper.launchChangeOrder.bind(helper), - changeFirstTime: helper.launchChangeFirstTime.bind(helper), - changeIsShown: helper.launchChangeIsShown.bind(helper) - }; - - this.weather = helper.weatherAction.bind(helper); + private launchAction(data) { + this.action('launch', 'launch-action', data); } + } diff --git a/pkg/interface/src/api/links.ts b/pkg/interface/src/api/links.ts index 683a3d069..de4af1e90 100644 --- a/pkg/interface/src/api/links.ts +++ b/pkg/interface/src/api/links.ts @@ -1,82 +1,23 @@ import { stringToTa } from '../lib/util'; import BaseApi from './base'; +import { StoreState } from '../store/type'; +import { Path } from '../types/noun'; -export default class LinksApi extends BaseApi { - constructor(ship, channel, store) { - super(ship, channel, store); - this.ship = ship; +export default class LinksApi extends BaseApi { - this.invite = { - accept: this.inviteAccept.bind(this), - decline: this.inviteDecline.bind(this) - }; - this.groups = { - remove: this.groupRemove.bind(this) - }; - - this.fetchLink = this.fetchLink.bind(this); - } - - fetchLink(path, result, fail, quit) { - this.subscribe.bind(this)( - path, - 'PUT', - this.ship, - 'link-view', - result, - fail, - quit - ); - } - - groupsAction(data) { - this.action('group-store', 'group-action', data); - } - - groupRemove(path, members) { - this.groupsAction({ - remove: { - path, - members - } - }); - } - - inviteAction(data) { - this.action('invite-store', 'json', data); - } - - inviteAccept(uid) { - this.inviteAction({ - accept: { - path: '/link', - uid - } - }); - } - - inviteDecline(uid) { - this.inviteAction({ - decline: { - path: '/link', - uid - } - }); - } - - getCommentsPage(path, url, page) { + getCommentsPage(path: Path, url: string, page: number) { const strictUrl = stringToTa(url); const endpoint = '/json/' + page + '/discussions/' + strictUrl + path; this.fetchLink( endpoint, (res) => { - if (res.data['initial-discussions']) { + if (res.data['link-update']['initial-discussions']) { // these aren't returned with the response, // so this ensures the reducers know them. - res.data['initial-discussions'].path = path; - res.data['initial-discussions'].url = url; + res.data['link-update']['initial-discussions'].path = path; + res.data['link-update']['initial-discussions'].url = url; } this.store.handleEvent(res); }, @@ -85,7 +26,7 @@ export default class LinksApi extends BaseApi { ); } - getPage(path, page) { + getPage(path: Path, page: number) { const endpoint = '/json/' + page + '/submissions' + path; this.fetchLink( endpoint, @@ -97,7 +38,7 @@ export default class LinksApi extends BaseApi { ); } - getSubmission(path, url, callback) { + getSubmission(path: Path, url: string, callback) { const strictUrl = stringToTa(url); const endpoint = '/json/0/submission/' + strictUrl + path; this.fetchLink( @@ -114,34 +55,28 @@ export default class LinksApi extends BaseApi { ); } - linkViewAction(data) { - return this.action('link-view', 'link-view-action', data); - } + createCollection(path, title, description, members, realGroup) { // members is either {group:'/group-path'} or {'ships':[~zod]}, // with realGroup signifying if ships should become a managed group or not. - return this.linkViewAction({ + return this.viewAction({ create: { path, title, description, members, realGroup } }); } deleteCollection(path) { - return this.linkViewAction({ + return this.viewAction({ delete: { path } }); } inviteToCollection(path, ships) { - return this.linkViewAction({ + return this.viewAction({ invite: { path, ships } }); } - linkListenAction(data) { - return this.action('link-listen-hook', 'link-listen-action', data); - } - joinCollection(path) { return this.linkListenAction({ watch: path }); } @@ -150,73 +85,47 @@ export default class LinksApi extends BaseApi { return this.linkListenAction({ leave: path }); } - linkAction(data) { - return this.action('link-store', 'link-action', data); - } - postLink(path, url, title) { + postLink(path: Path, url: string, title: string) { return this.linkAction({ save: { path, url, title } }); } - postComment(path, url, comment) { + postComment(path: Path, url: string, comment: string) { return this.linkAction({ note: { path, url, udon: comment } }); } // leave url as null to mark all under path as read - seenLink(path, url = null) { + seenLink(path: Path, url?: string) { return this.linkAction({ - seen: { path, url } + seen: { path, url: url || null } }); } - metadataAction(data) { - return this.action('metadata-hook', 'metadata-action', data); + private linkAction(data) { + return this.action('link-store', 'link-action', data); } - metadataAdd(appPath, groupPath, title, description, dateCreated, color) { - return this.metadataAction({ - add: { - 'group-path': groupPath, - resource: { - 'app-path': appPath, - 'app-name': 'link' - }, - metadata: { - title, - description, - color, - 'date-created': dateCreated, - creator: `~${window.ship}` - } - } - }); + private viewAction(data) { + return this.action('link-view', 'link-view-action', data); } - sidebarToggle() { - let sidebarBoolean = true; - if (this.store.state.sidebarShown === true) { - sidebarBoolean = false; - } - this.store.handleEvent({ - data: { - local: { - sidebarToggle: sidebarBoolean - } - } - }); + private linkListenAction(data) { + return this.action('link-listen-hook', 'link-listen-action', data); } - setSelected(selected) { - this.store.handleEvent({ - data: { - local: { - selected: selected - } - } - }); + private fetchLink(path: Path, result, fail, quit) { + this.subscribe.bind(this)( + path, + 'PUT', + this.ship, + 'link-view', + result, + fail, + quit + ); } } diff --git a/pkg/interface/src/api/local.ts b/pkg/interface/src/api/local.ts new file mode 100644 index 000000000..9ae9716d0 --- /dev/null +++ b/pkg/interface/src/api/local.ts @@ -0,0 +1,28 @@ +import BaseApi from "./base"; +import { StoreState } from "../store/type"; +import { SelectedGroup } from "../types/local-update"; + + + +export default class LocalApi extends BaseApi { + setSelected(selected: SelectedGroup[]) { + this.store.handleEvent({ + data: { + local: { + selected + } + } + }) + } + + sidebarToggle() { + this.store.handleEvent({ + data: { + local: { + sidebarToggle: true + } + } + }) + } + +} diff --git a/pkg/interface/src/api/metadata.ts b/pkg/interface/src/api/metadata.ts new file mode 100644 index 000000000..779e8196c --- /dev/null +++ b/pkg/interface/src/api/metadata.ts @@ -0,0 +1,31 @@ + +import BaseApi from './base'; +import { StoreState } from '../store/type'; +import { Path, Patp } from '../types/noun'; + +export default class MetadataApi extends BaseApi { + + metadataAdd(appPath: Path, groupPath: Path, title: string, description: string, dateCreated: string, color: string) { + const creator = `~${this.ship}`; + return this.metadataAction({ + add: { + 'group-path': groupPath, + resource: { + 'app-path': appPath, + 'app-name': 'contacts' + }, + metadata: { + title, + description, + color, + 'date-created': dateCreated, + creator + } + } + }); + } + + private metadataAction(data) { + return this.action('metadata-hook', 'metadata-action', data); + } +} diff --git a/pkg/interface/src/api/publish.ts b/pkg/interface/src/api/publish.ts index 68480118b..4b60e66a1 100644 --- a/pkg/interface/src/api/publish.ts +++ b/pkg/interface/src/api/publish.ts @@ -1,7 +1,10 @@ import BaseApi from './base'; +import { PublishResponse } from '../types/publish-response'; +import { PatpNoSig } from '../types/noun'; +import { BookId, NoteId } from '../types/publish-update'; export default class PublishApi extends BaseApi { - handleEvent(data) { + handleEvent(data: PublishResponse) { this.store.handleEvent({ data: { 'publish-response' : data } }); } @@ -16,7 +19,7 @@ export default class PublishApi extends BaseApi { }); } - fetchNotebook(host, book) { + fetchNotebook(host: PatpNoSig, book: BookId) { fetch(`/publish-view/${host}/${book}.json`) .then(response => response.json()) .then((json) => { @@ -29,7 +32,7 @@ export default class PublishApi extends BaseApi { }); } - fetchNote(host, book, note) { + fetchNote(host: PatpNoSig, book: BookId, note: NoteId) { fetch(`/publish-view/${host}/${book}/${note}.json`) .then(response => response.json()) .then((json) => { @@ -43,7 +46,7 @@ export default class PublishApi extends BaseApi { }); } - fetchNotesPage(host, book, start, length) { + fetchNotesPage(host: PatpNoSig, book: BookId, start: number, length: number) { fetch(`/publish-view/notes/${host}/${book}/${start}/${length}.json`) .then(response => response.json()) .then((json) => { @@ -58,7 +61,7 @@ export default class PublishApi extends BaseApi { }); } - fetchCommentsPage(host, book, note, start, length) { + fetchCommentsPage(host: PatpNoSig, book: BookId, note: NoteId, start: number, length: number) { fetch(`/publish-view/comments/${host}/${book}/${note}/${start}/${length}.json`) .then(response => response.json()) .then((json) => { @@ -74,30 +77,8 @@ export default class PublishApi extends BaseApi { }); } - groupAction(act) { - return this.action('group-store', 'group-action', act); - } - - inviteAction(act) { - return this.action('invite-store', 'invite-action', act); - } - - publishAction(act) { + publishAction(act: any) { return this.action('publish', 'publish-action', act); } - - sidebarToggle() { - let sidebarBoolean = true; - if (this.store.state.sidebarShown === true) { - sidebarBoolean = false; - } - this.store.handleEvent({ - data: { - local: { - sidebarToggle: sidebarBoolean - } - } - }); - } } diff --git a/pkg/interface/src/components/GroupFilter.js b/pkg/interface/src/components/GroupFilter.js index 9f29ce563..3d4f4c197 100644 --- a/pkg/interface/src/components/GroupFilter.js +++ b/pkg/interface/src/components/GroupFilter.js @@ -26,7 +26,7 @@ export default class GroupFilter extends Component { const selected = localStorage.getItem('urbit-selectedGroups'); if (selected) { this.setState({ selected: JSON.parse(selected) }, (() => { - this.props.api.setSelected(this.state.selected); + this.props.api.local.setSelected(this.state.selected); })); } } diff --git a/pkg/interface/src/components/SidebarSwitch.js b/pkg/interface/src/components/SidebarSwitch.js index 6733a4ca4..285784ea0 100644 --- a/pkg/interface/src/components/SidebarSwitch.js +++ b/pkg/interface/src/components/SidebarSwitch.js @@ -15,7 +15,7 @@ export class SidebarSwitcher extends Component {
{ - this.props.api.sidebarToggle(); + this.props.api.local.sidebarToggle(); }} > ; + +export default class ChatReducer { + reduce(json: Cage, state: S) { + const data = json['chat-update']; if (data) { this.initial(data, state); this.pending(data, state); @@ -13,13 +19,13 @@ export default class ChatReducer { this.delete(data, state); } - data = _.get(json, 'chat-hook-update', false); - if (data) { - this.hook(data, state); + const hookUpdate = json['chat-hook-update']; + if (hookUpdate) { + this.hook(hookUpdate, state); } } - initial(json, state) { + initial(json: ChatUpdate, state: S) { const data = _.get(json, 'initial', false); if (data) { state.inbox = data; @@ -27,11 +33,11 @@ export default class ChatReducer { } } - hook(json, state) { + hook(json: ChatHookUpdate, state: S) { state.chatSynced = json; } - message(json, state) { + message(json: ChatUpdate, state: S) { const data = _.get(json, 'message', false); if (data) { state.inbox[data.path].envelopes.unshift(data.envelope); @@ -40,7 +46,7 @@ export default class ChatReducer { } } - messages(json, state) { + messages(json: ChatUpdate, state: S) { const data = _.get(json, 'messages', false); if (data) { state.inbox[data.path].envelopes = @@ -48,7 +54,7 @@ export default class ChatReducer { } } - read(json, state) { + read(json: ChatUpdate, state: S) { const data = _.get(json, 'read', false); if (data) { state.inbox[data.path].config.read = @@ -56,7 +62,7 @@ export default class ChatReducer { } } - create(json, state) { + create(json: ChatUpdate, state: S) { const data = _.get(json, 'create', false); if (data) { state.inbox[data.path] = { @@ -69,25 +75,25 @@ export default class ChatReducer { } } - delete(json, state) { + delete(json: ChatUpdate, state: S) { const data = _.get(json, 'delete', false); if (data) { delete state.inbox[data.path]; } } - pending(json, state) { + pending(json: ChatUpdate, state: S) { const msg = _.get(json, 'message', false); if (!msg || !state.pendingMessages.has(msg.path)) { return; } - const mailbox = state.pendingMessages.get(msg.path); + const mailbox = state.pendingMessages.get(msg.path) || []; for (const pendingMsg of mailbox) { if (msg.envelope.uid === pendingMsg.uid) { const index = mailbox.indexOf(pendingMsg); - state.pendingMessages.get(msg.path).splice(index, 1); + mailbox.splice(index, 1); } } } diff --git a/pkg/interface/src/reducers/contact-update.ts b/pkg/interface/src/reducers/contact-update.ts index 56d4fda75..2cc7d04dc 100644 --- a/pkg/interface/src/reducers/contact-update.ts +++ b/pkg/interface/src/reducers/contact-update.ts @@ -1,7 +1,12 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { Cage } from '../types/cage'; +import { ContactUpdate } from '../types/contact-update'; -export default class ContactReducer { - reduce(json, state) { +type ContactState = Pick; + +export default class ContactReducer { + reduce(json: Cage, state: S) { const data = _.get(json, 'contact-update', false); if (data) { this.initial(data, state); @@ -13,28 +18,28 @@ export default class ContactReducer { } } - initial(json, state) { + initial(json: ContactUpdate, state: S) { const data = _.get(json, 'initial', false); if (data) { state.contacts = data; } } - create(json, state) { + create(json: ContactUpdate, state: S) { const data = _.get(json, 'create', false); if (data) { state.contacts[data.path] = {}; } } - delete(json, state) { + delete(json: ContactUpdate, state: S) { const data = _.get(json, 'delete', false); if (data) { delete state.contacts[data.path]; } } - add(json, state) { + add(json: ContactUpdate, state: S) { const data = _.get(json, 'add', false); if ( data && @@ -44,7 +49,7 @@ export default class ContactReducer { } } - remove(json, state) { + remove(json: ContactUpdate, state: S) { const data = _.get(json, 'remove', false); if ( data && @@ -55,7 +60,7 @@ export default class ContactReducer { } } - edit(json, state) { + edit(json: ContactUpdate, state: S) { const data = _.get(json, 'edit', false); if ( data && diff --git a/pkg/interface/src/reducers/group-update.ts b/pkg/interface/src/reducers/group-update.ts index f9bcb1321..a2d8e03de 100644 --- a/pkg/interface/src/reducers/group-update.ts +++ b/pkg/interface/src/reducers/group-update.ts @@ -1,8 +1,13 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { Cage } from '../types/cage'; +import { GroupUpdate } from '../types/group-update'; -export default class GroupReducer { +type GroupState = Pick; - reduce(json, state) { +export default class GroupReducer { + + reduce(json: Cage, state: S) { const data = _.get(json, "group-update", false); if (data) { this.initial(data, state); @@ -15,7 +20,7 @@ export default class GroupReducer { } } - initial(json, state) { + initial(json: GroupUpdate, state: S) { const data = _.get(json, 'initial', false); if (data) { for (let group in data) { @@ -24,7 +29,7 @@ export default class GroupReducer { } } - add(json, state) { + add(json: GroupUpdate, state: S) { const data = _.get(json, 'add', false); if (data) { for (const member of data.members) { @@ -33,7 +38,7 @@ export default class GroupReducer { } } - remove(json, state) { + remove(json: GroupUpdate, state: S) { const data = _.get(json, 'remove', false); if (data) { for (const member of data.members) { @@ -42,21 +47,21 @@ export default class GroupReducer { } } - bundle(json, state) { + bundle(json: GroupUpdate, state: S) { const data = _.get(json, 'bundle', false); if (data) { state.groups[data.path] = new Set(); } } - unbundle(json, state) { + unbundle(json: GroupUpdate, state: S) { const data = _.get(json, 'unbundle', false); if (data) { delete state.groups[data.path]; } } - keys(json, state) { + keys(json: GroupUpdate, state: S) { const data = _.get(json, 'keys', false); if (data) { state.groupKeys = new Set(data.keys); diff --git a/pkg/interface/src/reducers/invite-update.ts b/pkg/interface/src/reducers/invite-update.ts index d9be947d0..d4b0f670c 100644 --- a/pkg/interface/src/reducers/invite-update.ts +++ b/pkg/interface/src/reducers/invite-update.ts @@ -1,10 +1,15 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { Cage } from '../types/cage'; +import { InviteUpdate } from '../types/invite-update'; -export default class InviteReducer { - reduce(json, state) { - const data = _.get(json, 'invite-update', false); +type InviteState = Pick; + + +export default class InviteReducer { + reduce(json: Cage, state: S) { + const data = json['invite-update']; if (data) { - console.log(data); this.initial(data, state); this.create(data, state); this.delete(data, state); @@ -14,35 +19,35 @@ export default class InviteReducer { } } - initial(json, state) { + initial(json: InviteUpdate, state: S) { const data = _.get(json, 'initial', false); if (data) { state.invites = data; } } - create(json, state) { + create(json: InviteUpdate, state: S) { const data = _.get(json, 'create', false); if (data) { state.invites[data.path] = {}; } } - delete(json, state) { + delete(json: InviteUpdate, state: S) { const data = _.get(json, 'delete', false); if (data) { delete state.invites[data.path]; } } - invite(json, state) { + invite(json: InviteUpdate, state: S) { const data = _.get(json, 'invite', false); if (data) { state.invites[data.path][data.uid] = data.invite; } } - accepted(json, state) { + accepted(json: InviteUpdate, state: S) { const data = _.get(json, 'accepted', false); if (data) { console.log(data); @@ -50,7 +55,7 @@ export default class InviteReducer { } } - decline(json, state) { + decline(json: InviteUpdate, state: S) { const data = _.get(json, 'decline', false); if (data) { delete state.invites[data.path][data.uid]; diff --git a/pkg/interface/src/reducers/launch-update.ts b/pkg/interface/src/reducers/launch-update.ts index a46e0f2c8..bb9e18efb 100644 --- a/pkg/interface/src/reducers/launch-update.ts +++ b/pkg/interface/src/reducers/launch-update.ts @@ -1,7 +1,12 @@ import _ from 'lodash'; +import { LaunchUpdate } from '../types/launch-update'; +import { Cage } from '../types/cage'; +import { StoreState } from '../store/type'; -export default class LaunchReducer { - reduce(json, state) { +type LaunchState = Pick; + +export default class LaunchReducer { + reduce(json: Cage, state: S) { const data = _.get(json, 'launch-update', false); if (data) { this.initial(data, state); @@ -22,28 +27,28 @@ export default class LaunchReducer { } } - initial(json, state) { + initial(json: LaunchUpdate, state: S) { const data = _.get(json, 'initial', false); if (data) { state.launch = data; } } - changeFirstTime(json, state) { + changeFirstTime(json: LaunchUpdate, state: S) { const data = _.get(json, 'changeFirstTime', false); if (data) { state.launch.firstTime = data; } } - changeOrder(json, state) { + changeOrder(json: LaunchUpdate, state: S) { const data = _.get(json, 'changeOrder', false); if (data) { state.launch.tileOrdering = data; } } - changeIsShown(json, state) { + changeIsShown(json: LaunchUpdate, state: S) { const data = _.get(json, 'changeIsShown', false); console.log(json, data); if (data) { diff --git a/pkg/interface/src/reducers/link-update.ts b/pkg/interface/src/reducers/link-update.ts index 027a5c56f..d960ec0bb 100644 --- a/pkg/interface/src/reducers/link-update.ts +++ b/pkg/interface/src/reducers/link-update.ts @@ -1,20 +1,28 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { LinkUpdate, Pagination } from '../types/link-update'; // page size as expected from link-view. // must change in parallel with the +page-size in /app/link-view to // ensure sane behavior. const PAGE_SIZE = 25; -export default class LinkUpdateReducer { - reduce(json, state) { - this.submissionsPage(json, state); - this.submissionsUpdate(json, state); - this.discussionsPage(json, state); - this.discussionsUpdate(json, state); - this.observationUpdate(json, state); +type LinkState = Pick; + +export default class LinkUpdateReducer { + reduce(json: any, state: S) { + const data = _.get(json, 'link-update', false); + if(data) { + this.submissionsPage(data, state); + this.submissionsUpdate(data, state); + this.discussionsPage(data, state); + this.discussionsUpdate(data, state); + this.observationUpdate(data, state); + } + } - submissionsPage(json, state) { + submissionsPage(json: LinkUpdate, state: S) { const data = _.get(json, 'initial-submissions', false); if (data) { // { "initial-submissions": { @@ -32,7 +40,12 @@ export default class LinkUpdateReducer { // if we didn't have any state for this path yet, initialize. if (!state.links[path]) { - state.links[path] = { local: {} }; + state.links[path] = { + local: {}, + totalItems: here.totalItems, + totalPages: here.totalPages, + unseenCount: here.unseenCount + }; } // since data contains an up-to-date full version of the page, @@ -47,17 +60,17 @@ export default class LinkUpdateReducer { // write seen status to a separate structure, // for easier modification later. - if (!state.seen[path]) { - state.seen[path] = {}; + if (!state.linksSeen[path]) { + state.linksSeen[path] = {}; } (here.page || []).map((submission) => { - state.seen[path][submission.url] = submission.seen; + state.linksSeen[path][submission.url] = submission.seen; }); } } } - submissionsUpdate(json, state) { + submissionsUpdate(json: LinkUpdate, state: S) { const data = _.get(json, 'submissions', false); if (data) { // { "submissions": { @@ -70,7 +83,7 @@ export default class LinkUpdateReducer { // stub in a comment count, which is more or less guaranteed to be 0 data.pages = data.pages.map((submission) => { submission.commentCount = 0; - state.seen[path][submission.url] = false; + state.linksSeen[path][submission.url] = false; return submission; }); @@ -83,7 +96,7 @@ export default class LinkUpdateReducer { } } - discussionsPage(json, state) { + discussionsPage(json: LinkUpdate, state: S) { const data = _.get(json, 'initial-discussions', false); if (data) { // { "initial-discussions": { @@ -100,13 +113,17 @@ export default class LinkUpdateReducer { const page = data.pageNumber; // if we didn't have any state for this path yet, initialize. - if (!state.comments[path]) { - state.comments[path] = {}; + if (!state.linkComments[path]) { + state.linkComments[path] = {}; } - if (!state.comments[path][url]) { - state.comments[path][url] = { local: {} }; - } - const here = state.comments[path][url]; + let comments = {...{ + local: {}, + totalPages: data.totalPages, + totalItems: data.totalItems + }, ...state.linkComments[path][url] }; + + state.linkComments[path][url] = comments; + const here = state.linkComments[path][url]; // since data contains an up-to-date full version of the page, // we can safely overwrite the one in state. @@ -117,7 +134,7 @@ export default class LinkUpdateReducer { } } - discussionsUpdate(json, state) { + discussionsUpdate(json: LinkUpdate, state: S) { const data = _.get(json, 'discussions', false); if (data) { // { "discussions": { @@ -130,13 +147,13 @@ export default class LinkUpdateReducer { const url = data.url; // add new comments to state, update totals - state.comments[path][url] = this._addNewItems( - data.comments, state.comments[path][url] + state.linkComments[path][url] = this._addNewItems( + data.comments || [], state.linkComments[path][url] ); } } - observationUpdate(json, state) { + observationUpdate(json: LinkUpdate, state: S) { const data = _.get(json, 'observation', false); if (data) { // { "observation": { @@ -145,10 +162,10 @@ export default class LinkUpdateReducer { // } } const path = data.path; - if (!state.seen[path]) { - state.seen[path] = {}; + if (!state.linksSeen[path]) { + state.linksSeen[path] = {}; } - const seen = state.seen[path]; + const seen = state.linksSeen[path]; // mark urls as seen data.urls.map((url) => { @@ -163,7 +180,7 @@ export default class LinkUpdateReducer { // - _addNewItems(items, pages, page = 0) { + _addNewItems(items: S[], pages: Pagination, page = 0) { if (!pages) { pages = { local: {}, diff --git a/pkg/interface/src/reducers/listen-update.ts b/pkg/interface/src/reducers/listen-update.ts index 401b15ca3..018204870 100644 --- a/pkg/interface/src/reducers/listen-update.ts +++ b/pkg/interface/src/reducers/listen-update.ts @@ -1,7 +1,12 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { Cage } from '../types/cage'; +import { LinkListenUpdate } from '../types/link-listen-update'; -export default class ListenUpdateReducer { - reduce(json, state) { +type LinkListenState = Pick; + +export default class LinkListenReducer { + reduce(json: Cage, state: S) { const data = _.get(json, 'link-listen-update', false); if (data) { this.listening(data, state); @@ -10,24 +15,24 @@ export default class ListenUpdateReducer { } } - listening(json, state) { + listening(json: LinkListenUpdate, state: S) { const data = _.get(json, 'listening', false); if (data) { - state.listening = new Set(data); + state.linkListening = new Set(data); } } - watch(json, state) { + watch(json: LinkListenUpdate, state: S) { const data = _.get(json, 'watch', false); if (data) { - state.listening.add(data); + state.linkListening.add(data); } } - leave(json, state) { + leave(json: LinkListenUpdate, state: S) { const data = _.get(json, 'leave', false); if (data) { - state.listening.delete(data); + state.linkListening.delete(data); } } } diff --git a/pkg/interface/src/reducers/local.ts b/pkg/interface/src/reducers/local.ts index 2df3edb4b..2825a9152 100644 --- a/pkg/interface/src/reducers/local.ts +++ b/pkg/interface/src/reducers/local.ts @@ -1,24 +1,27 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { Cage } from '../types/cage'; +import { LocalUpdate } from '../types/local-update'; -export default class LocalReducer { - reduce(json, state) { - const data = _.get(json, 'local', false); +type LocalState = Pick; + +export default class LocalReducer { + reduce(json: Cage, state: S) { + const data = json['local']; if (data) { this.sidebarToggle(data, state); this.setSelected(data, state); } } - sidebarToggle(obj, state) { - const data = _.has(obj, 'sidebarToggle', false); - if (data) { - state.sidebarShown = obj.sidebarToggle; - } + sidebarToggle(obj: LocalUpdate, state: S) { + if ('sidebarToggle' in obj) { + state.sidebarShown = !state.sidebarShown; + } } - setSelected(obj, state) { - const data = _.has(obj, 'selected', false); - if (data) { + setSelected(obj: LocalUpdate, state: S) { + if ('selected' in obj) { state.selectedGroups = obj.selected; } } diff --git a/pkg/interface/src/reducers/metadata-update.ts b/pkg/interface/src/reducers/metadata-update.ts index 58fd1d257..43d8b0492 100644 --- a/pkg/interface/src/reducers/metadata-update.ts +++ b/pkg/interface/src/reducers/metadata-update.ts @@ -1,8 +1,15 @@ import _ from 'lodash'; -export default class MetadataReducer { - reduce(json, state) { - let data = _.get(json, 'metadata-update', false); +import { StoreState } from '../store/type'; + +import { MetadataUpdate } from '../types/metadata-update'; +import { Cage } from '../types/cage'; + +type MetadataState = Pick; + +export default class MetadataReducer { + reduce(json: Cage, state: S) { + let data = json['metadata-update'] if (data) { console.log('data: ', data); this.associations(data, state); @@ -13,7 +20,7 @@ export default class MetadataReducer { } } - associations(json, state) { + associations(json: MetadataUpdate, state: S) { let data = _.get(json, 'associations', false); if (data) { let metadata = state.associations; @@ -34,7 +41,7 @@ export default class MetadataReducer { } } - add(json, state) { + add(json: MetadataUpdate, state: S) { let data = _.get(json, 'add', false); if (data) { let metadata = state.associations; @@ -53,7 +60,7 @@ export default class MetadataReducer { } } - update(json, state) { + update(json: MetadataUpdate, state: S) { let data = _.get(json, 'update-metadata', false); if (data) { let metadata = state.associations; @@ -72,7 +79,7 @@ export default class MetadataReducer { } } - remove(json, state) { + remove(json: MetadataUpdate, state: S) { let data = _.get(json, 'remove', false); if (data) { let metadata = state.associations; diff --git a/pkg/interface/src/reducers/permission-update.ts b/pkg/interface/src/reducers/permission-update.ts index 929ee9dfd..6fc70188c 100644 --- a/pkg/interface/src/reducers/permission-update.ts +++ b/pkg/interface/src/reducers/permission-update.ts @@ -1,7 +1,12 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { Cage } from '../types/cage'; +import { PermissionUpdate } from '../types/permission-update'; -export default class PermissionReducer { - reduce(json, state) { +type PermissionState = Pick; + +export default class PermissionReducer { + reduce(json: Cage, state: S) { const data = _.get(json, 'permission-update', false); if (data) { this.initial(data, state); @@ -12,7 +17,7 @@ export default class PermissionReducer { } } - initial(json, state) { + initial(json: PermissionUpdate, state: S) { const data = _.get(json, 'initial', false); if (data) { for (const perm in data) { @@ -24,7 +29,7 @@ export default class PermissionReducer { } } - create(json, state) { + create(json: PermissionUpdate, state: S) { const data = _.get(json, 'create', false); if (data) { state.permissions[data.path] = { @@ -34,14 +39,14 @@ export default class PermissionReducer { } } - delete(json, state) { + delete(json: PermissionUpdate, state: S) { const data = _.get(json, 'delete', false); if (data) { delete state.permissions[data.path]; } } - add(json, state) { + add(json: PermissionUpdate, state: S) { const data = _.get(json, 'add', false); if (data) { for (const member of data.who) { @@ -50,7 +55,7 @@ export default class PermissionReducer { } } - remove(json, state) { + remove(json: PermissionUpdate, state: S) { const data = _.get(json, 'remove', false); if (data) { for (const member of data.who) { diff --git a/pkg/interface/src/reducers/publish-response.ts b/pkg/interface/src/reducers/publish-response.ts index d4cd66f02..260cae526 100644 --- a/pkg/interface/src/reducers/publish-response.ts +++ b/pkg/interface/src/reducers/publish-response.ts @@ -1,7 +1,11 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { Cage } from '../types/cage'; -export default class PublishResponseReducer { - reduce(json, state) { +type PublishState = Pick; + +export default class PublishResponseReducer { + reduce(json: Cage, state: S) { const data = _.get(json, 'publish-response', false); if (!data) { return; } switch(data.type) { @@ -194,12 +198,4 @@ export default class PublishResponseReducer { throw Error("tried to fetch paginated comments, but we don't have the note"); } } - - sidebarToggle(json, state) { - let data = _.has(json.data, 'sidebarToggle', false); - if (data) { - state.sidebarShown = json.data.sidebarToggle; - } - } - } diff --git a/pkg/interface/src/reducers/publish-update.ts b/pkg/interface/src/reducers/publish-update.ts index 7d0d96301..91a2c0d0b 100644 --- a/pkg/interface/src/reducers/publish-update.ts +++ b/pkg/interface/src/reducers/publish-update.ts @@ -1,9 +1,21 @@ import _ from 'lodash'; -export default class PublishUpdateReducer { - reduce(preJson, state){ - let json = _.get(preJson, "publish-update", false); - switch(Object.keys(json)[0]){ +import { PublishUpdate } from '../types/publish-update'; +import { Cage } from '../types/cage'; +import { StoreState } from '../store/type'; +import { getTagFromFrond } from '../types/noun'; + +type PublishState = Pick; + + +export default class PublishUpdateReducer { + reduce(data: Cage, state: S){ + let json = data["publish-update"]; + if(!json) { + return; + } + const tag = getTagFromFrond(json); + switch(tag){ case "add-book": this.addBook(json["add-book"], state); break; @@ -39,7 +51,7 @@ export default class PublishUpdateReducer { } } - addBook(json, state) { + addBook(json, state: S) { let host = Object.keys(json)[0]; let book = Object.keys(json[host])[0]; if (state.notebooks[host]) { @@ -49,7 +61,7 @@ export default class PublishUpdateReducer { } } - addNote(json, state) { + addNote(json, state: S) { let host = Object.keys(json)[0]; let book = Object.keys(json[host])[0]; let noteId = json[host][book]["note-id"]; @@ -77,13 +89,13 @@ export default class PublishUpdateReducer { let prevNoteId = state.notebooks[host][book]["notes-by-date"][1] || null; state.notebooks[host][book].notes[noteId]["prev-note"] = prevNoteId state.notebooks[host][book].notes[noteId]["next-note"] = null; - if (state.notebooks[host][book].notes[prevNoteId]) { + if (prevNoteId && state.notebooks[host][book].notes[prevNoteId]) { state.notebooks[host][book].notes[prevNoteId]["next-note"] = noteId; } } } - addComment(json, state) { + addComment(json, state: S) { let host = json.host let book = json.book let note = json.note @@ -97,7 +109,7 @@ export default class PublishUpdateReducer { if (state.notebooks[host][book].notes[note].comments) { let limboCommentIdx = _.findIndex(state.notebooks[host][book].notes[note].comments, (o) => { - let oldVal = o[Object.keys(o)[0]]; + let oldVal = o[getTagFromFrond(o)]; let newVal = comment[Object.keys(comment)[0]]; return (oldVal.pending && (oldVal.author === newVal.author) && diff --git a/pkg/interface/src/reducers/s3-update.ts b/pkg/interface/src/reducers/s3-update.ts index 47c397e51..1915feec1 100644 --- a/pkg/interface/src/reducers/s3-update.ts +++ b/pkg/interface/src/reducers/s3-update.ts @@ -1,7 +1,12 @@ import _ from 'lodash'; +import { StoreState } from '../store/type'; +import { Cage } from '../types/cage'; +import { S3Update } from '../types/s3-update'; -export default class S3Reducer{ - reduce(json, state) { +type S3State = Pick; + +export default class S3Reducer { + reduce(json: Cage, state: S) { const data = _.get(json, 's3-update', false); if (data) { this.credentials(data, state); @@ -15,14 +20,14 @@ export default class S3Reducer{ } } - credentials(json, state) { + credentials(json: S3Update, state: S) { const data = _.get(json, 'credentials', false); if (data) { state.s3.credentials = data; } } - configuration(json, state) { + configuration(json: S3Update, state: S) { const data = _.get(json, 'configuration', false); if (data) { state.s3.configuration = { @@ -32,14 +37,14 @@ export default class S3Reducer{ } } - currentBucket(json, state) { + currentBucket(json: S3Update, state: S) { const data = _.get(json, 'setCurrentBucket', false); - if (data) { - state.s3.configuration.currentBucket = data; + if (data && state.s3) { + } } - addBucket(json, state) { + addBucket(json: S3Update, state: S) { const data = _.get(json, 'addBucket', false); if (data) { state.s3.configuration.buckets = @@ -47,31 +52,30 @@ export default class S3Reducer{ } } - removeBucket(json, state) { + removeBucket(json: S3Update, state: S) { const data = _.get(json, 'removeBucket', false); if (data) { - state.s3.configuration.buckets = - state.s3.configuration.buckets.delete(data); + state.s3.configuration.buckets.delete(data); } } - endpoint(json, state) { + endpoint(json: S3Update, state: S) { const data = _.get(json, 'setEndpoint', false); - if (data) { + if (data && state.s3.credentials) { state.s3.credentials.endpoint = data; } } - accessKeyId(json, state) { + accessKeyId(json: S3Update , state: S) { const data = _.get(json, 'setAccessKeyId', false); - if (data) { + if (data && state.s3.credentials) { state.s3.credentials.accessKeyId = data; } } - secretAccessKey(json, state) { + secretAccessKey(json: S3Update, state: S) { const data = _.get(json, 'setSecretAccessKey', false); - if (data) { + if (data && state.s3.credentials) { state.s3.credentials.secretAccessKey = data; } } diff --git a/pkg/interface/src/store/base.js b/pkg/interface/src/store/base.ts similarity index 63% rename from pkg/interface/src/store/base.js rename to pkg/interface/src/store/base.ts index d54a23bed..da026c33e 100644 --- a/pkg/interface/src/store/base.js +++ b/pkg/interface/src/store/base.ts @@ -1,20 +1,21 @@ -export default class BaseStore { +export default class BaseStore { + state: S; + setState: (s: Partial) => void = (s) => {}; constructor() { this.state = this.initialState(); - this.setState = () => {}; } initialState() { - return {}; + return {} as S; } - setStateHandler(setState) { + setStateHandler(setState: (s: Partial) => void) { this.setState = setState; } clear() { this.handleEvent({ - data: { clear: true } + data: { clear: true }, }); } @@ -25,7 +26,7 @@ export default class BaseStore { return; } - if ('clear' in json && json.clear) { + if ("clear" in json && json.clear) { this.setState(this.initialState()); return; } @@ -38,4 +39,3 @@ export default class BaseStore { // extend me! } } - diff --git a/pkg/interface/src/store/store.ts b/pkg/interface/src/store/store.ts new file mode 100644 index 000000000..4a4a0d47d --- /dev/null +++ b/pkg/interface/src/store/store.ts @@ -0,0 +1,92 @@ +import BaseStore from './base'; +import InviteReducer from '../reducers/invite-update'; +import MetadataReducer from '../reducers/metadata-update'; +import LocalReducer from '../reducers/local'; +import ChatReducer from '../reducers/chat-update'; + +import { StoreState } from './type'; +import { Cage } from '../types/cage'; +import ContactReducer from '../reducers/contact-update'; +import LinkUpdateReducer from '../reducers/link-update'; +import S3Reducer from '../reducers/s3-update'; +import GroupReducer from '../reducers/group-update'; +import PermissionReducer from '../reducers/permission-update'; +import PublishUpdateReducer from '../reducers/publish-update'; +import PublishResponseReducer from '../reducers/publish-response'; +import LaunchReducer from '../reducers/launch-update'; +import LinkListenReducer from '../reducers/listen-update'; + + +export default class GlobalStore extends BaseStore { + inviteReducer = new InviteReducer(); + metadataReducer = new MetadataReducer(); + localReducer = new LocalReducer(); + chatReducer = new ChatReducer(); + contactReducer = new ContactReducer(); + linkReducer = new LinkUpdateReducer(); + linkListenReducer = new LinkListenReducer(); + s3Reducer = new S3Reducer(); + groupReducer = new GroupReducer(); + permissionReducer = new PermissionReducer(); + publishUpdateReducer = new PublishUpdateReducer(); + publishResponseReducer = new PublishResponseReducer(); + launchReducer = new LaunchReducer(); + + + initialState(): StoreState { + return { + pendingMessages: new Map(), + chatInitialized: false, + sidebarShown: true, + invites: {}, + associations: { + chat: {}, + contacts: {}, + link: {}, + publish: {} + }, + groups: {}, + groupKeys: new Set(), + launch: { + firstTime: false, + tileOrdering: [], + tiles: {}, + }, + weather: {}, + location: '', + permissions: {}, + s3: { + configuration: { + buckets: new Set(), + currentBucket: '' + }, + credentials: null + }, + links: {}, + linksSeen: {}, + linkListening: new Set(), + linkComments: {}, + notebooks: {}, + contacts: {}, + selectedGroups: [], + inbox: {}, + chatSynced: null, + }; + } + + reduce(data: Cage, state: StoreState) { + this.inviteReducer.reduce(data, this.state); + this.metadataReducer.reduce(data, this.state); + this.localReducer.reduce(data, this.state); + this.chatReducer.reduce(data, this.state); + this.contactReducer.reduce(data, this.state); + this.linkReducer.reduce(data, this.state); + this.s3Reducer.reduce(data, this.state); + this.groupReducer.reduce(data, this.state); + this.permissionReducer.reduce(data, this.state); + this.publishUpdateReducer.reduce(data, this.state); + this.publishResponseReducer.reduce(data, this.state); + this.launchReducer.reduce(data, this.state); + this.linkListenReducer.reduce(data, this.state); + } +} diff --git a/pkg/interface/src/store/type.ts b/pkg/interface/src/store/type.ts new file mode 100644 index 000000000..51e8bc3e3 --- /dev/null +++ b/pkg/interface/src/store/type.ts @@ -0,0 +1,53 @@ +import { Inbox, Envelope } from '../types/chat-update'; +import { ChatHookUpdate } from '../types/chat-hook-update'; +import { Path } from '../types/noun'; +import { Invites } from '../types/invite-update'; +import { SelectedGroup } from '../types/local-update'; +import { Associations } from '../types/metadata-update'; +import { Rolodex } from '../types/contact-update'; +import { Notebooks } from '../types/publish-update'; +import { Groups } from '../types/group-update'; +import { S3State } from '../types/s3-update'; +import { Permissions } from '../types/permission-update'; +import { LaunchState } from '../types/launch-update'; +import { LinkComments, LinkCollections, LinkSeen } from '../types/link-update'; + +export interface StoreState { + // local state + sidebarShown: boolean; + selectedGroups: SelectedGroup[]; + // invite state + invites: Invites; + // metadata state + associations: Associations; + // contact state + contacts: Rolodex; + // groups state + groups: Groups; + groupKeys: Set; + permissions: Permissions; + s3: S3State; + + + // App specific states + // + // launch state + launch: LaunchState; + weather: any; + location: any; + + // links state + linksSeen: LinkSeen; + linkListening: Set; + links: LinkCollections; + linkComments: LinkComments; + + // publish state + notebooks: Notebooks; + + // Chat state + chatInitialized: boolean; + chatSynced: ChatHookUpdate | null; + inbox: Inbox; + pendingMessages: Map; +} diff --git a/pkg/interface/src/subscription/base.js b/pkg/interface/src/subscription/base.ts similarity index 53% rename from pkg/interface/src/subscription/base.js rename to pkg/interface/src/subscription/base.ts index d710425e2..7a4e6fdb7 100644 --- a/pkg/interface/src/subscription/base.js +++ b/pkg/interface/src/subscription/base.ts @@ -1,8 +1,9 @@ -export default class BaseSubscription { - constructor(store, api, channel) { - this.store = store; - this.api = api; - this.channel = channel; +import BaseStore from "../store/base"; +import BaseApi from "../api/base"; +import { Path } from "../types/noun"; + +export default class BaseSubscription { + constructor(public store: BaseStore, public api: BaseApi, public channel: any) { this.channel.setOnChannelError(this.onChannelError.bind(this)); } @@ -12,14 +13,14 @@ export default class BaseSubscription { onChannelError(err) { console.error('event source error: ', err); - setTimeout(2000, () => { + setTimeout(() => { this.store.clear(); this.start(); - }); + }, 2000); } - subscribe(path, app) { - this.api.subscribe(path, 'PUT', this.api.ship, app, + subscribe(path: Path, app: string) { + return this.api.subscribe(path, 'PUT', this.api.ship, app, this.handleEvent.bind(this), (err) => { console.log(err); @@ -30,6 +31,10 @@ export default class BaseSubscription { }); } + unsubscribe(id: number) { + this.api.unsubscribe(id); + } + start() { // extend } diff --git a/pkg/interface/src/subscription/global.js b/pkg/interface/src/subscription/global.js deleted file mode 100644 index 993b885aa..000000000 --- a/pkg/interface/src/subscription/global.js +++ /dev/null @@ -1,9 +0,0 @@ -import BaseSubscription from './base'; - -export default class GlobalSubscription extends BaseSubscription { - start() { - this.subscribe('/all', 'invite-store'); - this.subscribe('/app-name/contacts', 'metadata-store'); - } -} - diff --git a/pkg/interface/src/subscription/global.ts b/pkg/interface/src/subscription/global.ts new file mode 100644 index 000000000..2a3c7cb57 --- /dev/null +++ b/pkg/interface/src/subscription/global.ts @@ -0,0 +1,69 @@ +import BaseSubscription from './base'; +import { StoreState } from '../store/type'; +import { Path } from '../types/noun'; + + +/** + * Path to subscribe on and app to subscribe to + */ +type AppSubscription = [Path, string]; + +const chatSubscriptions: AppSubscription[] = [ + ['/primary', 'chat-view'], + ['/synced', 'chat-hook'] +]; + +const publishSubscriptions: AppSubscription[] = [ + ['/primary', 'publish'] +]; + +const linkSubscriptions: AppSubscription[] = [ + ['/json/seen', 'link-view'], + ['/listening', 'link-listen-hook'] +] + +const groupSubscriptions: AppSubscription[] = [ + ['/all', 'group-store'], + ['/synced', 'contact-hook'] +]; + +type AppName = 'publish' | 'chat' | 'link' | 'groups'; +const appSubscriptions: Record = { + chat: chatSubscriptions, + publish: publishSubscriptions, + link: linkSubscriptions, + groups: groupSubscriptions +}; + +export default class GlobalSubscription extends BaseSubscription { + openSubscriptions: Record = { + chat: [], + publish: [], + link: [], + groups: [] + }; + start() { + this.subscribe('/all', 'invite-store'); + this.subscribe('/app-name/contacts', 'metadata-store'); + this.subscribe('/all', 'invite-store'); + this.subscribe('/all', 'permission-store'); + this.subscribe('/primary', 'contact-view'); + this.subscribe('/all', 'metadata-store'); + this.subscribe('/all', 's3-store'); + this.subscribe('/all', 'launch'); + this.subscribe('/all', 'weather'); + } + + startApp(app: AppName) { + if(this.openSubscriptions[app].length > 0) { + console.log(`${app} already started`); + return; + } + this.openSubscriptions[app] = appSubscriptions[app].map(([path, agent]) => this.subscribe(path, agent)); + } + + stopApp(app: AppName) { + this.openSubscriptions[app].map(id => this.unsubscribe(id)) + this.openSubscriptions[app] = []; + } +} diff --git a/pkg/interface/src/types/cage.ts b/pkg/interface/src/types/cage.ts new file mode 100644 index 000000000..bc5e1b04b --- /dev/null +++ b/pkg/interface/src/types/cage.ts @@ -0,0 +1,35 @@ +import { ChatUpdate } from "./chat-update"; +import { ChatHookUpdate } from "./chat-hook-update"; +import { ContactUpdate } from "./contact-update"; +import { InviteUpdate } from "./invite-update"; +import { LocalUpdate } from "./local-update"; +import { MetadataUpdate } from "./metadata-update"; +import { PublishUpdate } from './publish-update'; +import { PublishResponse } from "./publish-response"; +import { GroupUpdate } from "./group-update"; +import { PermissionUpdate } from "./permission-update"; +import { LaunchUpdate } from "./launch-update"; +import { LinkListenUpdate } from './link-listen-update'; + +interface MarksToTypes { + readonly json: any; + readonly "chat-update": ChatUpdate; + readonly "chat-hook-update": ChatHookUpdate; + readonly "contact-update": ContactUpdate; + readonly "invite-update": InviteUpdate; + readonly "metadata-update": MetadataUpdate; + readonly 'publish-update': PublishUpdate; + readonly "publish-response": PublishResponse; + readonly "group-update": GroupUpdate; + readonly "permission-update": PermissionUpdate; + readonly "launch-update": LaunchUpdate; + readonly "link-listen-update": LinkListenUpdate; + // not really marks but w/e + readonly 'local': LocalUpdate; + readonly 'weather': any; + readonly 'location': any; +} + +export type Cage = Partial; + +export type Mark = keyof MarksToTypes; diff --git a/pkg/interface/src/types/chat-hook-update.ts b/pkg/interface/src/types/chat-hook-update.ts new file mode 100644 index 000000000..3ee335407 --- /dev/null +++ b/pkg/interface/src/types/chat-hook-update.ts @@ -0,0 +1,5 @@ +import { Patp } from './noun'; + +export interface ChatHookUpdate { + [p: string]: Patp; +} diff --git a/pkg/interface/src/types/chat-update.ts b/pkg/interface/src/types/chat-update.ts new file mode 100644 index 000000000..63b23eee1 --- /dev/null +++ b/pkg/interface/src/types/chat-update.ts @@ -0,0 +1,95 @@ +import { Path, Patp } from './noun'; + +export type ChatUpdate = + ChatUpdateInitial +| ChatUpdateCreate +| ChatUpdateDelete +| ChatUpdateMessage +| ChatUpdateMessages +| ChatUpdateRead; + +export type ChatAction = + ChatUpdateCreate +| ChatUpdateDelete +| ChatUpdateMessage +| ChatUpdateRead; + +interface ChatUpdateInitial { + initial: Inbox; +} + +interface ChatUpdateCreate { + create: Path; +} + +interface ChatUpdateDelete { + delete: Path; +} + +interface ChatUpdateMessage { + message: { + path: Path; + envelope: Envelope; + } +} + +interface ChatUpdateMessages { + messages: { + path: Path; + envelopes: Envelope[]; + } +} + +interface ChatUpdateRead { + read: { + path: Path; + }; +} + + + +// Data structures +// TODO: move to seperate file? + +export interface Inbox { + [chatName: string]: Mailbox; +} + +interface Mailbox { + config: MailboxConfig; + envelopes: Envelope[]; +} + +interface MailboxConfig { + length: number; + read: number; +} + +export interface Envelope { + uid: string; + number: number; + author: Patp; + when: string; + letter: Letter; +} + +interface LetterText { + text: string; +} + +interface LetterUrl { + url: string; +} + +interface LetterCode { + code: { + expression: string; + output: string; + } +} + +interface LetterMe { + narrative: string; +} + +export type Letter = LetterText | LetterUrl | LetterCode | LetterMe; diff --git a/pkg/interface/src/types/contact-update.ts b/pkg/interface/src/types/contact-update.ts new file mode 100644 index 000000000..c08509af3 --- /dev/null +++ b/pkg/interface/src/types/contact-update.ts @@ -0,0 +1,85 @@ +import { Path, Patp } from "./noun"; + +export type ContactUpdate = + | ContactUpdateCreate + | ContactUpdateDelete + | ContactUpdateAdd + | ContactUpdateRemove + | ContactUpdateEdit + | ContactUpdateInitial + | ContactUpdateContacts; + +interface ContactUpdateCreate { + create: Path; +} + +interface ContactUpdateDelete { + delete: Path; +} + +interface ContactUpdateAdd { + add: { + path: Path; + ship: Patp; + contact: Contact; + }; +} + +interface ContactUpdateRemove { + remove: { + path: Path; + ship: Patp; + }; +} + +interface ContactUpdateEdit { + edit: { + path: Path; + ship: Patp; + "edit-field": ContactEdit; + }; +} + +interface ContactUpdateInitial { + initial: Rolodex; +} + +interface ContactUpdateContacts { + contacts: { + path: Path; + contacts: Contacts; + }; +} + +// + +type ContactAvatar = ContactAvatarUrl | ContactAvatarOcts; + +export type Rolodex = { + [p in Path]: Contacts; +}; + +export type Contacts = { + [p in Patp]: Contact; +}; + +interface ContactAvatarUrl { + url: string; +} + +interface ContactAvatarOcts { + octs: string; +} +export interface Contact { + nickname: string; + email: string; + phone: string; + website: string; + notes: string; + color: string; + avatar: ContactAvatar | null; +} + +export type ContactEdit = { + [k in keyof Contact]: Contact[k]; +}; diff --git a/pkg/interface/src/types/global.ts b/pkg/interface/src/types/global.ts new file mode 100644 index 000000000..d43a77b1b --- /dev/null +++ b/pkg/interface/src/types/global.ts @@ -0,0 +1,7 @@ +import { PatpNoSig } from "./noun"; + +declare global { + interface Window { + ship: PatpNoSig; + } +} diff --git a/pkg/interface/src/types/group-update.ts b/pkg/interface/src/types/group-update.ts new file mode 100644 index 000000000..588468f27 --- /dev/null +++ b/pkg/interface/src/types/group-update.ts @@ -0,0 +1,59 @@ +import { PatpNoSig, Path } from './noun'; + +export type Group = Set + +export type Groups = { + [p in Path]: Group; +} + +interface GroupUpdateInitial { + initial: Groups; +} + +interface GroupUpdateAdd { + add: { + members: PatpNoSig[]; + path: Path; + } +} + +interface GroupUpdateRemove { + remove: { + members: PatpNoSig[]; + path: Path; + } +} + +interface GroupUpdateBundle { + bundle: { + path: Path; + } +} + +interface GroupUpdateUnbundle { + unbundle: { + path: Path; + } +} + +interface GroupUpdateKeys { + keys: { + keys: Path[]; + } +} + +interface GroupUpdatePath { + path: { + path: Path; + members: PatpNoSig[]; + } +} + +export type GroupUpdate = + GroupUpdateInitial +| GroupUpdateAdd +| GroupUpdateRemove +| GroupUpdateBundle +| GroupUpdateUnbundle +| GroupUpdateKeys +| GroupUpdatePath; diff --git a/pkg/interface/src/types/invite-update.ts b/pkg/interface/src/types/invite-update.ts new file mode 100644 index 000000000..a1eb2ed91 --- /dev/null +++ b/pkg/interface/src/types/invite-update.ts @@ -0,0 +1,67 @@ +import { Serial, PatpNoSig, Path } from './noun'; + +export type InviteUpdate = + InviteUpdateInitial +| InviteUpdateCreate +| InviteUpdateDelete +| InviteUpdateInvite +| InviteUpdateAccepted +| InviteUpdateDecline; + + +interface InviteUpdateInitial { + initial: Invites; +} + +interface InviteUpdateCreate { + create: { + path: Path; + }; +} + +interface InviteUpdateDelete { + delete: { + path: Path; + }; +} + +interface InviteUpdateInvite { + invite: { + path: Path; + uid: Serial; + invite: Invite; + }; +} + +interface InviteUpdateAccepted { + accepted: { + path: Path; + uid: Serial; + }; +} + +interface InviteUpdateDecline { + decline: { + path: Path; + uid: Serial; + }; +} + +// actual datastructures + + +export type Invites = { + [p in Path]: AppInvites; +}; + +export type AppInvites = { + [s in Serial]: Invite; +}; + +export interface Invite { + app: string; + path: Path; + recipeint: PatpNoSig; + ship: PatpNoSig; + text: string; +} diff --git a/pkg/interface/src/types/launch-update.ts b/pkg/interface/src/types/launch-update.ts new file mode 100644 index 000000000..59636a4ad --- /dev/null +++ b/pkg/interface/src/types/launch-update.ts @@ -0,0 +1,53 @@ + +export type LaunchUpdate = + LaunchUpdateInitial +| LaunchUpdateFirstTime +| LaunchUpdateOrder +| LaunchUpdateIsShown; + + +interface LaunchUpdateInitial { + initial: LaunchState; +} + +interface LaunchUpdateFirstTime { + changeFirstTime: boolean; +} + +interface LaunchUpdateOrder { + changeOrder: string[]; +} + +interface LaunchUpdateIsShown { + changeIsShown: { + name: string; + isShown: boolean; + } +} + +export interface LaunchState { + firstTime: boolean; + tileOrdering: string[]; + tiles: { + [app: string]: Tile; + } +} + +interface Tile { + isShown: boolean; + type: TileType; +} + +type TileType = TileTypeBasic | TileTypeCustom; + +interface TileTypeBasic { + basic: { + iconUrl: string; + linkedUrl: string; + title: string; + } +} + +interface TileTypeCustom { + custom: null; +} diff --git a/pkg/interface/src/types/link-listen-update.ts b/pkg/interface/src/types/link-listen-update.ts new file mode 100644 index 000000000..3ba9f76c7 --- /dev/null +++ b/pkg/interface/src/types/link-listen-update.ts @@ -0,0 +1,18 @@ +import { Path } from './noun'; + +interface LinkListenUpdateListening { + listening: Path[]; +} + +interface LinkListenUpdateWatch { + watch: Path; +} + +interface LinkListenUpdateLeave { + leave: Path; +} + +export type LinkListenUpdate = + LinkListenUpdateListening +| LinkListenUpdateWatch +| LinkListenUpdateLeave; diff --git a/pkg/interface/src/types/link-update.ts b/pkg/interface/src/types/link-update.ts new file mode 100644 index 000000000..4cbfeb1d5 --- /dev/null +++ b/pkg/interface/src/types/link-update.ts @@ -0,0 +1,84 @@ +import { PatpNoSig, Path } from "./noun"; + +export type LinkCollections = { + [p in Path]: Collection; +}; + +export type LinkSeen = { + [p in Path]: { + [url: string]: boolean; + }; +}; + +export type Pagination = { + local: LocalPages; + [p: number]: S[]; + totalItems: number; + totalPages: number; +} + +export type LinkComments = { + [p in Path]: { + [url: string]: Pagination & { + totalItems: number; + totalPages: number; + } + } +} + +interface LinkComment { + ship: PatpNoSig; + time: number; + udon: string; +} + +interface CollectionStats { + unseenCount: number; +} + +type LocalPages = { + [p: number]: boolean; +} + +type Collection = CollectionStats & Pagination; + +interface Link { + commentCount: number; + seen: boolean; + ship: PatpNoSig; + time: number; + title: string; + url: string; +} + +interface LinkInitialSubmissions { + 'initial-submissions': { + [p in Path]: CollectionStats & { + pageNumber?: number; + pages?: Link[]; + } + }; +}; + +interface LinkUpdateSubmission { + 'submissions': { + path: Path; + pages: Link[]; + } +} + +interface LinkInitialDiscussion { + 'intitial-discussion': { + path: Path; + url: string; + page: Comment[]; + totalItems: number; + totalPages: number; + pageNumber: number; + } +} + +export type LinkUpdate = + LinkInitialSubmissions +| LinkUpdateSubmission +| LinkInitialDiscussion; diff --git a/pkg/interface/src/types/local-update.ts b/pkg/interface/src/types/local-update.ts new file mode 100644 index 000000000..f4a5df60a --- /dev/null +++ b/pkg/interface/src/types/local-update.ts @@ -0,0 +1,15 @@ +import { Path } from './noun'; + +export type LocalUpdate = + LocalUpdateSidebarToggle +| LocalUpdateSelectedGroups; + +interface LocalUpdateSidebarToggle { + sidebarToggle: boolean; +} + +interface LocalUpdateSelectedGroups { + selected: SelectedGroup[]; +} + +export type SelectedGroup = [Path, string]; diff --git a/pkg/interface/src/types/metadata-update.ts b/pkg/interface/src/types/metadata-update.ts new file mode 100644 index 000000000..1489201f3 --- /dev/null +++ b/pkg/interface/src/types/metadata-update.ts @@ -0,0 +1,54 @@ +import { AppName, Path, Patp } from './noun'; + + +export type MetadataUpdate = + MetadataUpdateInitial +| MetadataUpdateAdd +| MetadataUpdateUpdate +| MetadataUpdateRemove; + +interface MetadataUpdateInitial { + associations: ResourceAssociations; +} + +type ResourceAssociations = { + [p in Path]: Association; +} + +type MetadataUpdateAdd = { + add: Association; +} + +type MetadataUpdateUpdate = { + update: Association; +} + +type MetadataUpdateRemove = { + remove: Resource & { + 'group-path': Path; + } +} + +export type Associations = Record; + +type AppAssociations = { + [p in Path]: Association; +} + +interface Resource { + 'app-path': Path; + 'app-name': AppName; +} + +export type Association = Resource & { + 'group-path': Path; + metadata: Metadata; +}; + +interface Metadata { + color: string; + creator: Patp; + 'date-created': string; + description: string; + title: string; +} diff --git a/pkg/interface/src/types/noun.ts b/pkg/interface/src/types/noun.ts new file mode 100644 index 000000000..1cda24f02 --- /dev/null +++ b/pkg/interface/src/types/noun.ts @@ -0,0 +1,25 @@ +// an urbit style path render as string +export type Path = string; + +// patp including leading sig +export type Patp = string; + +// patp excluding leading sig +export type PatpNoSig = string; + +// @uvH encoded string +export type Serial = string; + +// name of app +export type AppName = 'chat' | 'link' | 'contacts' | 'publish'; + +export function getTagFromFrond(frond: O): keyof O { + const tags = Object.keys(frond) as Array; + const tag = tags[0]; + if(!tag) { + throw new Error("bad frond"); + } + return tag; + + +} diff --git a/pkg/interface/src/types/permission-update.ts b/pkg/interface/src/types/permission-update.ts new file mode 100644 index 000000000..6d076f2c7 --- /dev/null +++ b/pkg/interface/src/types/permission-update.ts @@ -0,0 +1,55 @@ +import { Path, PatpNoSig } from './noun'; + +export type PermissionUpdate = + PermissionUpdateInitial +| PermissionUpdateCreate +| PermissionUpdateDelete +| PermissionUpdateRemove +| PermissionUpdateAdd; + +interface PermissionUpdateInitial { + initial: { + [p in Path]: { + who: PatpNoSig[]; + kind: PermissionKind; + }; + } +} + +interface PermissionUpdateCreate { + create: { + path: Path; + kind: PermissionKind; + who: PatpNoSig[]; + } +} + +interface PermissionUpdateDelete { + delete: { + path: Path; + } +} + +interface PermissionUpdateAdd { + add: { + path: Path; + who: PatpNoSig[]; + } +} + +interface PermissionUpdateRemove { + remove: { + path: Path; + who: PatpNoSig[]; + } +} + +export type Permissions = { + [p in Path]: Permission; +}; +export interface Permission { + who: Set; + kind: PermissionKind; +} + +export type PermissionKind = 'white' | 'black'; diff --git a/pkg/interface/src/types/publish-response.ts b/pkg/interface/src/types/publish-response.ts new file mode 100644 index 000000000..addc55921 --- /dev/null +++ b/pkg/interface/src/types/publish-response.ts @@ -0,0 +1,48 @@ +import { Notebooks, Notebook, Note, BookId, NoteId } from './publish-update'; +import { Patp } from './noun'; + +export type PublishResponse = + NotebooksResponse +| NotebookResponse +| NoteResponse +| NotesPageResponse +| CommentsPageResponse; + +interface NotebooksResponse { + type: 'notebooks'; + data: Notebooks; +} + +interface NotebookResponse { + type: 'notebook'; + data: Notebook; + host: Patp; + notebook: BookId; +} + +interface NoteResponse { + type: 'note'; + data: Note; + host: Patp; + notebook: BookId; + note: NoteId; +} + +interface NotesPageResponse { + type: 'notes-page'; + data: Note[]; + host: Patp; + notebook: BookId; + startIndex: number; + length: number; +} + +interface CommentsPageResponse { + type: 'comments-page'; + data: Comment[]; + host: Patp; + notebook: BookId; + note: NoteId; + startIndex: number; + length: number; +} diff --git a/pkg/interface/src/types/publish-update.ts b/pkg/interface/src/types/publish-update.ts new file mode 100644 index 000000000..7dec8a82b --- /dev/null +++ b/pkg/interface/src/types/publish-update.ts @@ -0,0 +1,158 @@ +import { Patp, PatpNoSig, Path } from './noun'; + + +export type NoteId = string; +export type BookId = string; + + +export type PublishUpdate = + PublishUpdateAddBook +| PublishUpdateAddNote +| PublishUpdateAddComment +| PublishUpdateEditBook +| PublishUpdateEditNote +| PublishUpdateEditComment +| PublishUpdateDelBook +| PublishUpdateDelNote +| PublishUpdateDelComment; + + +type PublishUpdateBook = { + [s in Patp]: { + [b in BookId]: { + title: string; + 'date-created': number; + about: string; + 'num-notes': number; + 'num-unread': number; + comments: boolean; + 'writers-group-path': Path; + 'subscribers-group-path': Path; + }; + }; +} + +type PublishUpdateNote = { + [s in Patp]: { + [b in BookId]: { + 'note-id': NoteId; + author: Patp; + title: string; + 'date-created': string; + snippet: string; + file: string; + 'num-comments': number; + comments: Comment[]; + read: boolean; + pending: boolean; + }; + }; +}; + +interface PublishUpdateAddBook { + 'add-book': PublishUpdateBook; +} + +interface PublishUpdateEditBook { + 'edit-book': PublishUpdateBook; +} + +interface PublishUpdateDelBook { + 'del-book': { + host: Patp; + book: string; + } +} + +interface PublishUpdateAddNote { + 'add-note': PublishUpdateNote; +} + +interface PublishUpdateEditNote { + 'edit-note': PublishUpdateNote; +} + +interface PublishUpdateDelNote { + 'del-note': { + host: Patp; + book: BookId; + note: NoteId; + } +} + +interface PublishUpdateAddComment { + 'add-comment': { + who: Patp; + host: BookId; + note: NoteId; + body: string; + } +} + +interface PublishUpdateEditComment { + 'edit-comment': { + host: Patp; + book: BookId; + note: NoteId; + body: string; + comment: Comment; + } +} + +interface PublishUpdateDelComment { + 'del-comment': { + host: Patp; + book: BookId; + note: NoteId; + comment: string; + } +} + +export type Notebooks = { + [host in Patp]: { + [book in BookId]: Notebook; + } +} + + +export interface Notebook { + about: string; + comments: boolean; + 'date-created': number; + notes: Notes; + 'notes-by-date': NoteId[]; + 'num-notes': number; + 'num-unread': number; + subscribers: PatpNoSig[]; + 'subscribers-group-path': Path; + title: string; + 'writers-group-path': Path; +} + +type Notes = { + [id in NoteId]: Note; +}; + +export interface Note { + author: Patp; + comments: Comment[]; + 'date-created': number; + file: string; + 'next-note': NoteId | null; + 'note-id': NoteId; + 'num-comments': number; + pending: boolean; + 'prev-note': NoteId | null; + read: boolean; + snippet: string; + title: string; +} + +interface Comment { + [date: string]: { + author: Patp; + content: string; + 'date-created': number; + pending: boolean; + }; +} diff --git a/pkg/interface/src/types/s3-update.ts b/pkg/interface/src/types/s3-update.ts new file mode 100644 index 000000000..3dfa51622 --- /dev/null +++ b/pkg/interface/src/types/s3-update.ts @@ -0,0 +1,63 @@ + + + export interface S3Credentials { + endpoint: string; + accessKeyId: string; + secretAccessKey: string; + } + +export interface S3Configuration { + buckets: Set; + currentBucket: string; +} + +export interface S3State { + configuration: S3Configuration; + credentials: S3Credentials | null; +} + +interface S3UpdateCredentials { + credentials: S3Credentials; +} + +interface S3UpdateConfiguration { + configuration: { + buckets: string[]; + currentBucket: string; + } +} + +interface S3UpdateCurrentBucket { + setCurrentBucket: string; +} + +interface S3UpdateAddBucket { + addBucket: string; +} + +interface S3UpdateRemoveBucket { + removeBucket: string; +} + +interface S3UpdateEndpoint { + setEndpoint: string; +} + +interface S3UpdateAccessKeyId { + setAccessKeyId: string; +} + +interface S3UpdateSecretAccessKey { + setSecretAccessKey: string; +} + + +export type S3Update = + S3UpdateCredentials +| S3UpdateConfiguration +| S3UpdateCurrentBucket +| S3UpdateAddBucket +| S3UpdateRemoveBucket +| S3UpdateEndpoint +| S3UpdateAccessKeyId +| S3UpdateSecretAccessKey; From 076e52c27e2a947df7815b2ac6fc38d08d043670 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 22 Jun 2020 15:15:46 +1000 Subject: [PATCH 227/280] links-js: update to global store --- pkg/interface/src/App.js | 6 +- pkg/interface/src/api/metadata.ts | 4 +- pkg/interface/src/apps/links/app.js | 99 +++++++++---------- .../src/apps/links/components/lib/comments.js | 2 +- .../links/components/lib/invite-element.js | 2 +- .../apps/links/components/lib/link-item.js | 2 +- .../apps/links/components/lib/link-submit.js | 2 +- .../links/components/lib/sidebar-invite.js | 4 +- .../src/apps/links/components/link.js | 4 +- .../src/apps/links/components/links-list.js | 2 +- .../src/apps/links/components/new.js | 2 +- .../src/apps/links/components/settings.js | 13 ++- 12 files changed, 68 insertions(+), 74 deletions(-) diff --git a/pkg/interface/src/App.js b/pkg/interface/src/App.js index 68e06d04b..30066cb1f 100644 --- a/pkg/interface/src/App.js +++ b/pkg/interface/src/App.js @@ -121,8 +121,10 @@ export default class App extends React.Component { ( )} diff --git a/pkg/interface/src/api/metadata.ts b/pkg/interface/src/api/metadata.ts index 779e8196c..723abb9b1 100644 --- a/pkg/interface/src/api/metadata.ts +++ b/pkg/interface/src/api/metadata.ts @@ -5,14 +5,14 @@ import { Path, Patp } from '../types/noun'; export default class MetadataApi extends BaseApi { - metadataAdd(appPath: Path, groupPath: Path, title: string, description: string, dateCreated: string, color: string) { + metadataAdd(appName: string, appPath: Path, groupPath: Path, title: string, description: string, dateCreated: string, color: string) { const creator = `~${this.ship}`; return this.metadataAction({ add: { 'group-path': groupPath, resource: { 'app-path': appPath, - 'app-name': 'contacts' + 'app-name': appName }, metadata: { title, diff --git a/pkg/interface/src/apps/links/app.js b/pkg/interface/src/apps/links/app.js index 04f628b67..97a544bc7 100644 --- a/pkg/interface/src/apps/links/app.js +++ b/pkg/interface/src/apps/links/app.js @@ -22,10 +22,7 @@ import { makeRoutePath, amOwnerOfGroup, base64urlDecode } from '../../lib/util'; export class LinksApp extends Component { constructor(props) { super(props); - this.store = new LinksStore(); - this.state = this.store.state; this.totalUnseen = 0; - this.resetControllers(); } componentDidMount() { @@ -33,38 +30,26 @@ export class LinksApp extends Component { // preload spinner asset new Image().src = '/~landscape/img/Spinner.png'; - this.store.setStateHandler(this.setState.bind(this)); - - const channel = new this.props.channel(); - this.api = new LinksApi(this.props.ship, channel, this.store); - - this.subscription = new LinksSubscription(this.store, this.api, channel); - this.subscription.start(); + this.props.api.links.getPage('', 0); + this.props.subscription.startApp('link'); } componentWillUnmount() { - this.subscription.delete(); - this.store.clear(); - this.store.setStateHandler(() => {}); - this.resetControllers(); + this.props.subscription.stopApp('link'); } - resetControllers() { - this.api = null; - this.subscription = null; - } render() { - const { state, props } = this; + const { props } = this; - const contacts = state.contacts ? state.contacts : {}; - const groups = state.groups ? state.groups : {}; + const contacts = props.contacts ? props.contacts : {}; + const groups = props.groups ? props.groups : {}; - const associations = state.associations ? state.associations : { link: {}, contacts: {} }; - const links = state.links ? state.links : {}; - const comments = state.comments ? state.comments : {}; + const associations = props.associations ? props.associations : { link: {}, contacts: {} }; + const links = props.links ? props.links : {}; + const comments = props.linkComments ? props.linkComments : {}; - const seen = state.seen ? state.seen : {}; + const seen = props.linksSeen ? props.linksSeen : {}; const totalUnseen = _.reduce( seen, @@ -77,11 +62,15 @@ export class LinksApp extends Component { this.totalUnseen = totalUnseen; } - const invites = state.invites ? - state.invites : {}; + const invites = props.invites ? + props.invites : {}; const selectedGroups = props.selectedGroups ? props.selectedGroups : []; + const listening = props.linkListening; + + const { api, sidebarShown } = this.props; + return ( @@ -111,17 +100,17 @@ export class LinksApp extends Component { associations={associations} invites={invites} groups={groups} - sidebarShown={state.sidebarShown} + sidebarShown={sidebarShown} selectedGroups={selectedGroups} links={links} - listening={state.listening} - api={this.api} + listening={listening} + api={api} > @@ -134,7 +123,7 @@ export class LinksApp extends Component { const autoJoin = () => { try { - this.api.joinCollection(resourcePath); + api.links.joinCollection(resourcePath); props.history.push(makeRoutePath(resourcePath)); } catch(err) { setTimeout(autoJoin, 2000); @@ -159,14 +148,14 @@ export class LinksApp extends Component { invites={invites} groups={groups} selected={resourcePath} - sidebarShown={state.sidebarShown} + sidebarShown={sidebarShown} selectedGroups={selectedGroups} links={links} - listening={state.listening} - api={this.api} + listening={listening} + api={api} > @@ -198,15 +187,15 @@ export class LinksApp extends Component { invites={invites} groups={groups} selected={resourcePath} - sidebarShown={state.sidebarShown} + sidebarShown={sidebarShown} selectedGroups={selectedGroups} popout={popout} links={links} - listening={state.listening} - api={this.api} + listening={listening} + api={api} > @@ -253,13 +242,13 @@ export class LinksApp extends Component { invites={invites} groups={groups} selected={resourcePath} - sidebarShown={state.sidebarShown} + sidebarShown={sidebarShown} selectedGroups={selectedGroups} sidebarHideMobile={true} popout={popout} links={links} - listening={state.listening} - api={this.api} + listening={listening} + api={api} > ); @@ -311,13 +300,13 @@ export class LinksApp extends Component { invites={invites} groups={groups} selected={resourcePath} - sidebarShown={state.sidebarShown} + sidebarShown={sidebarShown} selectedGroups={selectedGroups} sidebarHideMobile={true} popout={popout} links={links} - listening={state.listening} - api={this.api} + listening={listening} + api={api} > ); diff --git a/pkg/interface/src/apps/links/components/lib/comments.js b/pkg/interface/src/apps/links/components/lib/comments.js index 6db7444ad..bce3e456a 100644 --- a/pkg/interface/src/apps/links/components/lib/comments.js +++ b/pkg/interface/src/apps/links/components/lib/comments.js @@ -16,7 +16,7 @@ export class Comments extends Component { this.props.comments.local[page] ) { this.setState({ requested: this.props.commentPage }); - this.props.api.getCommentsPage( + this.props.api.links.getCommentsPage( this.props.resourcePath, this.props.url, this.props.commentPage); diff --git a/pkg/interface/src/apps/links/components/lib/invite-element.js b/pkg/interface/src/apps/links/components/lib/invite-element.js index 864478a71..94da5d575 100644 --- a/pkg/interface/src/apps/links/components/lib/invite-element.js +++ b/pkg/interface/src/apps/links/components/lib/invite-element.js @@ -34,7 +34,7 @@ export class InviteElement extends Component { success: true, members: [] }, () => { - props.api.inviteToCollection(props.resourcePath, aud).then(() => { + props.api.links.inviteToCollection(props.resourcePath, aud).then(() => { this.setState({ awaiting: false }); }); }); diff --git a/pkg/interface/src/apps/links/components/lib/link-item.js b/pkg/interface/src/apps/links/components/lib/link-item.js index 10fcea921..805e91ed5 100644 --- a/pkg/interface/src/apps/links/components/lib/link-item.js +++ b/pkg/interface/src/apps/links/components/lib/link-item.js @@ -34,7 +34,7 @@ export class LinkItem extends Component { } markPostAsSeen() { - this.props.api.seenLink(this.props.resourcePath, this.props.url); + this.props.api.links.seenLink(this.props.resourcePath, this.props.url); } render() { diff --git a/pkg/interface/src/apps/links/components/lib/link-submit.js b/pkg/interface/src/apps/links/components/lib/link-submit.js index 73d2d90aa..36a5078db 100644 --- a/pkg/interface/src/apps/links/components/lib/link-submit.js +++ b/pkg/interface/src/apps/links/components/lib/link-submit.js @@ -21,7 +21,7 @@ export class LinkSubmit extends Component { ? this.state.linkTitle : this.state.linkValue; this.setState({ disabled: true }); - this.props.api.postLink(this.props.resourcePath, link, title).then((r) => { + this.props.api.links.postLink(this.props.resourcePath, link, title).then((r) => { this.setState({ disabled: false, linkValue: '', diff --git a/pkg/interface/src/apps/links/components/lib/sidebar-invite.js b/pkg/interface/src/apps/links/components/lib/sidebar-invite.js index df4e0f2f9..218c04b7f 100644 --- a/pkg/interface/src/apps/links/components/lib/sidebar-invite.js +++ b/pkg/interface/src/apps/links/components/lib/sidebar-invite.js @@ -1,11 +1,11 @@ import React, { Component } from 'react'; export class SidebarInvite extends Component { onAccept() { - this.props.api.invite.accept(this.props.uid); + this.props.api.invite.accept('/link', this.props.uid); } onDecline() { - this.props.api.invite.decline(this.props.uid); + this.props.api.invite.decline('/link', this.props.uid); } render() { diff --git a/pkg/interface/src/apps/links/components/link.js b/pkg/interface/src/apps/links/components/link.js index 7c8cde9af..a4fdc1e48 100644 --- a/pkg/interface/src/apps/links/components/link.js +++ b/pkg/interface/src/apps/links/components/link.js @@ -36,7 +36,7 @@ export class LinkDetail extends Component { componentDidUpdate(prevProps) { // if we have no preloaded data, and we aren't expecting it, get it if ((!this.state.data.title) && (this.props.api)) { - this.props.api?.getSubmission( + this.props.api?.links.getSubmission( this.props.resourcePath, this.props.url, this.updateData.bind(this) ); } @@ -69,7 +69,7 @@ export class LinkDetail extends Component { pending.add(this.state.comment); this.setState({ pending: pending, disabled: true }); - this.props.api.postComment( + this.props.api.links.postComment( this.props.resourcePath, url, this.state.comment diff --git a/pkg/interface/src/apps/links/components/links-list.js b/pkg/interface/src/apps/links/components/links-list.js index 9636a76e4..56cb7872a 100644 --- a/pkg/interface/src/apps/links/components/links-list.js +++ b/pkg/interface/src/apps/links/components/links-list.js @@ -35,7 +35,7 @@ export class Links extends Component { !this.props.links[linkPage] || // don't have info? this.props.links.local[linkPage] // waiting on post confirmation? ) { - this.props.api?.getPage(this.props.resourcePath, this.props.page); + this.props.api?.links.getPage(this.props.resourcePath, this.props.page); } } diff --git a/pkg/interface/src/apps/links/components/new.js b/pkg/interface/src/apps/links/components/new.js index fc95a0f71..844c14154 100644 --- a/pkg/interface/src/apps/links/components/new.js +++ b/pkg/interface/src/apps/links/components/new.js @@ -119,7 +119,7 @@ export class NewScreen extends Component { ships: [], disabled: true }, () => { - const submit = props.api.createCollection( + const submit = props.api.links.createCollection( appPath, state.title, state.description, diff --git a/pkg/interface/src/apps/links/components/settings.js b/pkg/interface/src/apps/links/components/settings.js index f7ddbbfa2..7b9f38fb6 100644 --- a/pkg/interface/src/apps/links/components/settings.js +++ b/pkg/interface/src/apps/links/components/settings.js @@ -96,6 +96,7 @@ export class SettingsScreen extends Component { if (props.amOwner) { this.setState({ disabled: true }); props.api.metadataAdd( + 'link', props.resourcePath, props.groupPath, resource.metadata.title, @@ -117,7 +118,7 @@ export class SettingsScreen extends Component { disabled: true, type: 'Removing' }); - props.api.removeCollection(props.resourcePath) + props.api.links.removeCollection(props.resourcePath) .then(() => { this.setState({ isLoading: false @@ -133,7 +134,7 @@ export class SettingsScreen extends Component { disabled: true, type: 'Deleting' }); - props.api.deleteCollection(props.resourcePath) + props.api.links.deleteCollection(props.resourcePath) .then(() => { this.setState({ isLoading: false @@ -142,7 +143,7 @@ export class SettingsScreen extends Component { } markAllAsSeen() { - this.props.api.seenLink(this.props.resourcePath); + this.props.api.links.seenLink(this.props.resourcePath); } renderRemove() { @@ -208,7 +209,8 @@ export class SettingsScreen extends Component { onBlur={() => { if (props.amOwner) { this.setState({ disabled: true }); - props.api.metadataAdd( + props.api.metadata.metadataAdd( + 'link', props.resourcePath, props.groupPath, state.title, @@ -238,7 +240,8 @@ export class SettingsScreen extends Component { onBlur={() => { if (props.amOwner) { this.setState({ disabled: true }); - props.api.metadataAdd( + props.api.metadata.metadataAdd( + 'link', props.resourcePath, props.groupPath, resource.metadata.title, From 3a3a6ab25407d5f9f91a1e4daec6d975a879942a Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 22 Jun 2020 15:40:43 +1000 Subject: [PATCH 228/280] publish-js: update to global store --- pkg/interface/src/api/global.ts | 1 + pkg/interface/src/apps/publish/app.js | 102 ++++++++---------- .../apps/publish/components/lib/comments.js | 10 +- .../apps/publish/components/lib/edit-post.js | 4 +- .../src/apps/publish/components/lib/join.js | 2 +- .../apps/publish/components/lib/new-post.js | 6 +- .../src/apps/publish/components/lib/new.js | 2 +- .../src/apps/publish/components/lib/note.js | 8 +- .../apps/publish/components/lib/notebook.js | 8 +- .../apps/publish/components/lib/settings.js | 10 +- .../publish/components/lib/sidebar-invite.js | 16 +-- .../publish/components/lib/subscribers.js | 16 +-- pkg/interface/src/subscription/global.ts | 3 +- 13 files changed, 76 insertions(+), 112 deletions(-) diff --git a/pkg/interface/src/api/global.ts b/pkg/interface/src/api/global.ts index 15802b3f3..9c6568190 100644 --- a/pkg/interface/src/api/global.ts +++ b/pkg/interface/src/api/global.ts @@ -20,6 +20,7 @@ export default class GlobalApi extends BaseApi { groups = new GroupsApi(this.ship, this.channel, this.store); launch = new LaunchApi(this.ship, this.channel, this.store); links = new LinksApi(this.ship, this.channel, this.store); + publish = new PublishApi(this.ship, this.channel, this.store); constructor(public ship: Patp, public channel: any, public store: GlobalStore) { diff --git a/pkg/interface/src/apps/publish/app.js b/pkg/interface/src/apps/publish/app.js index 4551e5127..43a2e50d1 100644 --- a/pkg/interface/src/apps/publish/app.js +++ b/pkg/interface/src/apps/publish/app.js @@ -19,15 +19,7 @@ import { EditPost } from './components/lib/edit-post'; export default class PublishApp extends React.Component { constructor(props) { super(props); - this.store = new PublishStore(); - this.state = this.store.state; this.unreadTotal = 0; - this.resetControllers(); - } - - resetControllers() { - this.api = null; - this.subscription = null; } componentDidMount() { @@ -35,31 +27,23 @@ export default class PublishApp extends React.Component { // preload spinner asset new Image().src = '/~landscape/img/Spinner.png'; - this.store.setStateHandler(this.setState.bind(this)); + this.props.subscription.startApp('publish'); - const channel = new this.props.channel(); - this.api = new PublishApi(this.props.ship, channel, this.store); - - this.subscription = new PublishSubscription(this.store, this.api, channel); - this.subscription.start(); - this.api.fetchNotebooks(); + this.props.api.publish.fetchNotebooks(); } componentWillUnmount() { - this.subscription.delete(); - this.store.clear(); - this.store.setStateHandler(() => {}); - this.resetControllers(); + this.props.subscription.stopApp('publish'); } render() { - const { state, props } = this; + const { props } = this; - const contacts = state.contacts ? state.contacts : {}; - const associations = state.associations ? state.associations : { contacts: {} }; + const contacts = props.contacts ? props.contacts : {}; + const associations = props.associations ? props.associations : { contacts: {} }; const selectedGroups = props.selectedGroups ? props.selectedGroups : []; - const notebooks = state.notebooks ? state.notebooks : {}; + const notebooks = props.notebooks ? props.notebooks : {}; const unreadTotal = _.chain(notebooks) .values() @@ -80,6 +64,8 @@ export default class PublishApp extends React.Component { this.unreadTotal = unreadTotal; } + const { api, groups, permissions, sidebarShown } = props; + return (
@@ -146,19 +132,19 @@ export default class PublishApp extends React.Component { popout={false} active={'rightPanel'} rightPanelHide={false} - sidebarShown={state.sidebarShown} - invites={state.invites} + sidebarShown={sidebarShown} + invites={props.invites} notebooks={notebooks} associations={associations} selectedGroups={selectedGroups} contacts={contacts} - api={this.api} + api={api} > @@ -190,22 +176,22 @@ export default class PublishApp extends React.Component { popout={popout} active={'rightPanel'} rightPanelHide={false} - sidebarShown={state.sidebarShown} - invites={state.invites} + sidebarShown={sidebarShown} + invites={props.invites} notebooks={notebooks} associations={associations} selectedGroups={selectedGroups} contacts={contacts} path={path} - api={this.api} + api={api} > @@ -216,28 +202,28 @@ export default class PublishApp extends React.Component { popout={popout} active={'rightPanel'} rightPanelHide={false} - sidebarShown={state.sidebarShown} - invites={state.invites} + sidebarShown={sidebarShown} + invites={props.invites} notebooks={notebooks} associations={associations} contacts={contacts} selectedGroups={selectedGroups} path={path} - api={this.api} + api={api} > @@ -256,7 +242,7 @@ export default class PublishApp extends React.Component { const bookGroupPath = notebooks?.[ship]?.[notebook]?.['subscribers-group-path']; - const notebookContacts = (bookGroupPath in state.contacts) + const notebookContacts = (bookGroupPath in contacts) ? contacts[bookGroupPath] : {}; const edit = Boolean(props.match.params.edit) || false; @@ -267,23 +253,23 @@ export default class PublishApp extends React.Component { popout={popout} active={'rightPanel'} rightPanelHide={false} - sidebarShown={state.sidebarShown} - invites={state.invites} + sidebarShown={sidebarShown} + invites={props.invites} notebooks={notebooks} selectedGroups={selectedGroups} associations={associations} contacts={contacts} path={path} - api={this.api} + api={api} > @@ -294,25 +280,25 @@ export default class PublishApp extends React.Component { popout={popout} active={'rightPanel'} rightPanelHide={false} - sidebarShown={state.sidebarShown} - invites={state.invites} + sidebarShown={sidebarShown} + invites={props.invites} notebooks={notebooks} associations={associations} selectedGroups={selectedGroups} contacts={contacts} path={path} - api={this.api} + api={api} > diff --git a/pkg/interface/src/apps/publish/components/lib/comments.js b/pkg/interface/src/apps/publish/components/lib/comments.js index 9e6ac6eb1..32fdca68c 100644 --- a/pkg/interface/src/apps/publish/components/lib/comments.js +++ b/pkg/interface/src/apps/publish/components/lib/comments.js @@ -53,7 +53,7 @@ export class Comments extends Component { this.textArea.value = ''; this.setState({ commentBody: '', awaiting: 'new' }); - const submit = this.props.api.publishAction(comment); + const submit = this.props.api.publish.publishAction(comment); submit.then(() => { this.setState({ awaiting: null }); }); @@ -87,11 +87,11 @@ export class Comments extends Component { this.setState({ awaiting: 'edit' }); - window.api + this.props.api.publish .publishAction(comment) .then(() => { - this.setState({ awaiting: null, editing: null }); -}); + this.setState({ awaiting: null, editing: null }); + }); } commentDelete(idx) { @@ -106,7 +106,7 @@ export class Comments extends Component { }; this.setState({ awaiting: { kind: 'del', what: idx } }); - window.api + this.props.api.publish .publishAction(comment) .then(() => { this.setState({ awaiting: null }); diff --git a/pkg/interface/src/apps/publish/components/lib/edit-post.js b/pkg/interface/src/apps/publish/components/lib/edit-post.js index beee1727c..8ff5805d1 100644 --- a/pkg/interface/src/apps/publish/components/lib/edit-post.js +++ b/pkg/interface/src/apps/publish/components/lib/edit-post.js @@ -27,7 +27,7 @@ export class EditPost extends Component { const { props, state } = this; if (prevProps && prevProps.api !== props.api) { if (!(props.notebooks[props.ship]?.[props.book]?.notes?.[props.note]?.file)) { - props.api?.fetchNote(props.ship, props.book, props.note); + props.api?.publish.fetchNote(props.ship, props.book, props.note); } else if (state.body === '') { const notebook = props.notebooks[props.ship][props.book]; const note = notebook.notes[props.note]; @@ -53,7 +53,7 @@ export class EditPost extends Component { } }; this.setState({ awaiting: true }); - this.props.api.publishAction(editNote).then(() => { + this.props.api.publish.publishAction(editNote).then(() => { const editIndex = props.location.pathname.indexOf('/edit'); const noteHref = props.location.pathname.slice(0, editIndex); this.setState({ awaiting: false }); diff --git a/pkg/interface/src/apps/publish/components/lib/join.js b/pkg/interface/src/apps/publish/components/lib/join.js index 9aec0e615..3dfad2aa1 100644 --- a/pkg/interface/src/apps/publish/components/lib/join.js +++ b/pkg/interface/src/apps/publish/components/lib/join.js @@ -95,7 +95,7 @@ export class JoinScreen extends Component { // TODO: askHistory setting this.setState({ disable: true }); - this.props.api.publishAction(actionData).catch((err) => { + this.props.api.publish.publishAction(actionData).catch((err) => { console.log(err); }).then(() => { this.setState({ awaiting: text }); diff --git a/pkg/interface/src/apps/publish/components/lib/new-post.js b/pkg/interface/src/apps/publish/components/lib/new-post.js index ab8f74285..3700ba359 100644 --- a/pkg/interface/src/apps/publish/components/lib/new-post.js +++ b/pkg/interface/src/apps/publish/components/lib/new-post.js @@ -37,14 +37,14 @@ export class NewPost extends Component { }; this.setState({ disabled: true }); - this.props.api.publishAction(newNote).then(() => { + this.props.api.publish.publishAction(newNote).then(() => { this.setState({ awaiting: newNote['new-note'].note }); }).catch((err) => { if (err.includes('note already exists')) { const timestamp = Math.floor(Date.now() / 1000); newNote['new-note'].note += '-' + timestamp; this.setState({ awaiting: newNote['new-note'].note }); - this.props.api.publishAction(newNote); + this.props.api.publish.publishAction(newNote); } else { this.setState({ disabled: false, awaiting: null }); } @@ -58,7 +58,7 @@ export class NewPost extends Component { componentDidUpdate(prevProps) { if (prevProps && prevProps.api !== this.props.api) { - this.props.api.fetchNotebook(this.props.ship, this.props.book); + this.props.api.publish.fetchNotebook(this.props.ship, this.props.book); } const notebook = this.props.notebooks[this.props.ship][this.props.book]; diff --git a/pkg/interface/src/apps/publish/components/lib/new.js b/pkg/interface/src/apps/publish/components/lib/new.js index 7b89f333c..3a4ff3878 100644 --- a/pkg/interface/src/apps/publish/components/lib/new.js +++ b/pkg/interface/src/apps/publish/components/lib/new.js @@ -93,7 +93,7 @@ export class NewScreen extends Component { } }; this.setState({ awaiting: bookId, disabled: true }, () => { - props.api.publishAction(action).then(() => { + props.api.publish.publishAction(action).then(() => { }); }); } diff --git a/pkg/interface/src/apps/publish/components/lib/note.js b/pkg/interface/src/apps/publish/components/lib/note.js index a230d10ce..01433fb9e 100644 --- a/pkg/interface/src/apps/publish/components/lib/note.js +++ b/pkg/interface/src/apps/publish/components/lib/note.js @@ -49,7 +49,7 @@ export class Note extends Component { const { props } = this; if ((prevProps && prevProps.api !== props.api) || props.api) { if (!(props.notebooks[props.ship]?.[props.book]?.notes?.[props.note]?.file)) { - props.api.fetchNote(props.ship, props.book, props.note); + props.api.publish.fetchNote(props.ship, props.book, props.note); } if (prevProps) { @@ -63,7 +63,7 @@ export class Note extends Component { note: props.note } }; - props.api.publishAction(readAction); + props.api.publish.publishAction(readAction); } } } @@ -92,7 +92,7 @@ export class Note extends Component { const fullyLoaded = (loadedComments === allComments); if (atBottom && !fullyLoaded) { - this.props.api.fetchCommentsPage(this.props.ship, + this.props.api.publish.fetchCommentsPage(this.props.ship, this.props.book, this.props.note, loadedComments, 30); } } @@ -109,7 +109,7 @@ export class Note extends Component { const popout = (props.popout) ? 'popout/' : ''; const baseUrl = `/~publish/${popout}notebook/${props.ship}/${props.book}`; this.setState({ deleting: true }); - this.props.api.publishAction(deleteAction) + this.props.api.publish.publishAction(deleteAction) .then(() => { props.history.push(baseUrl); }); diff --git a/pkg/interface/src/apps/publish/components/lib/notebook.js b/pkg/interface/src/apps/publish/components/lib/notebook.js index 45088586c..710e17278 100644 --- a/pkg/interface/src/apps/publish/components/lib/notebook.js +++ b/pkg/interface/src/apps/publish/components/lib/notebook.js @@ -25,7 +25,7 @@ export class Notebook extends Component { atBottom = true; } if (!notebook.notes && this.props.api) { - this.props.api.fetchNotebook(this.props.ship, this.props.book); + this.props.api.publish.fetchNotebook(this.props.ship, this.props.book); return; } @@ -35,7 +35,7 @@ export class Notebook extends Component { const fullyLoaded = (loadedNotes === allNotes); if (atBottom && !fullyLoaded) { - this.props.api.fetchNotesPage(this.props.ship, this.props.book, loadedNotes, 30); + this.props.api.publish.fetchNotesPage(this.props.ship, this.props.book, loadedNotes, 30); } } @@ -44,7 +44,7 @@ export class Notebook extends Component { if ((prevProps && (prevProps.api !== props.api)) || props.api) { const notebook = props.notebooks?.[props.ship]?.[props.book]; if (!notebook?.subscribers) { - props.api.fetchNotebook(props.ship, props.book); + props.api.publish.fetchNotebook(props.ship, props.book); } } } @@ -64,7 +64,7 @@ export class Notebook extends Component { book: this.props.book } }; - this.props.api.publishAction(action); + this.props.api.publish.publishAction(action); this.props.history.push('/~publish'); } diff --git a/pkg/interface/src/apps/publish/components/lib/settings.js b/pkg/interface/src/apps/publish/components/lib/settings.js index 409a794c4..13980e0b5 100644 --- a/pkg/interface/src/apps/publish/components/lib/settings.js +++ b/pkg/interface/src/apps/publish/components/lib/settings.js @@ -63,7 +63,7 @@ export class Settings extends Component { changeComments() { this.setState({ comments: !this.state.comments, disabled: true }, (() => { - this.props.api.publishAction({ + this.props.api.publish.publishAction({ 'edit-book': { book: this.props.book, title: this.props.notebook.title, @@ -84,7 +84,7 @@ export class Settings extends Component { } }; this.setState({ disabled: true, type: 'Deleting' }); - this.props.api.publishAction(action).then(() => { + this.props.api.publish.publishAction(action).then(() => { this.props.history.push('/~publish'); }); } @@ -108,7 +108,7 @@ export class Settings extends Component { disabled: true, type: 'Converting' }, (() => { - this.props.api.publishAction({ + this.props.api.publish.publishAction({ groupify: { book: props.book, target: state.targetGroup, @@ -253,7 +253,7 @@ export class Settings extends Component { disabled={this.state.disabled} onBlur={() => { this.setState({ disabled: true }); - this.props.api + this.props.api.publish .publishAction({ 'edit-book': { book: this.props.book, @@ -280,7 +280,7 @@ export class Settings extends Component { onChange={this.changeDescription} onBlur={() => { this.setState({ disabled: true }); - this.props.api + this.props.api.publish .publishAction({ 'edit-book': { book: this.props.book, diff --git a/pkg/interface/src/apps/publish/components/lib/sidebar-invite.js b/pkg/interface/src/apps/publish/components/lib/sidebar-invite.js index 13f96193d..cbaed7421 100644 --- a/pkg/interface/src/apps/publish/components/lib/sidebar-invite.js +++ b/pkg/interface/src/apps/publish/components/lib/sidebar-invite.js @@ -2,23 +2,11 @@ import React, { Component } from 'react'; export class SidebarInvite extends Component { onAccept() { - const action = { - accept: { - path: '/publish', - uid: this.props.uid - } - }; - this.props.api.inviteAction(action); + this.props.api.invite.accept('/publish', this.props.uid); } onDecline() { - const action = { - decline: { - path: '/publish', - uid: this.props.uid - } - }; - this.props.api.inviteAction(action); + this.props.api.invite.decline('/publish', this.props.uid); } render() { diff --git a/pkg/interface/src/apps/publish/components/lib/subscribers.js b/pkg/interface/src/apps/publish/components/lib/subscribers.js index 8d48153f5..9d932e656 100644 --- a/pkg/interface/src/apps/publish/components/lib/subscribers.js +++ b/pkg/interface/src/apps/publish/components/lib/subscribers.js @@ -11,23 +11,11 @@ export class Subscribers extends Component { } addUser(who, path) { - const action = { - add: { - members: [who], - path: path - } - }; - this.props.api.groupAction(action); + this.props.api.groups.add(path, [who]); } removeUser(who, path) { - const action = { - remove: { - members: [who], - path: path - } - }; - this.props.api.groupAction(action); + this.props.api.groups.remove(path, [who]); } redirect(url) { diff --git a/pkg/interface/src/subscription/global.ts b/pkg/interface/src/subscription/global.ts index 2a3c7cb57..b28b2c29d 100644 --- a/pkg/interface/src/subscription/global.ts +++ b/pkg/interface/src/subscription/global.ts @@ -14,7 +14,8 @@ const chatSubscriptions: AppSubscription[] = [ ]; const publishSubscriptions: AppSubscription[] = [ - ['/primary', 'publish'] + ['/primary', 'publish'], + ['/all', 'group-store'] ]; const linkSubscriptions: AppSubscription[] = [ From 85aa12a5a9a3f3ea40a46f8fcd4814ef175b8ff2 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 22 Jun 2020 16:04:21 +1000 Subject: [PATCH 229/280] contacts-js: update to global store --- pkg/interface/src/api/contacts.ts | 6 +- pkg/interface/src/api/global.ts | 1 + pkg/interface/src/apps/groups/app.js | 72 ++++++++----------- .../apps/groups/components/lib/add-contact.js | 2 +- .../groups/components/lib/contact-card.js | 34 ++++----- .../groups/components/lib/contact-sidebar.js | 2 +- .../groups/components/lib/group-detail.js | 8 ++- .../groups/components/lib/sidebar-invite.js | 4 +- .../src/apps/groups/components/new.js | 2 +- pkg/interface/src/subscription/global.ts | 2 - 10 files changed, 60 insertions(+), 73 deletions(-) diff --git a/pkg/interface/src/api/contacts.ts b/pkg/interface/src/api/contacts.ts index d2db3ce1d..7c7d7689c 100644 --- a/pkg/interface/src/api/contacts.ts +++ b/pkg/interface/src/api/contacts.ts @@ -24,17 +24,17 @@ export default class ContactsApi extends BaseApi { }); } - contactDelete(path: Path) { + delete(path: Path) { return this.viewAction({ delete: { path } }); } - contactRemove(path: Path, ship: Patp) { + remove(path: Path, ship: Patp) { return this.viewAction({ remove: { path, ship } }); } - contactEdit(path: Path, ship: Patp, editField: ContactEdit) { + edit(path: Path, ship: Patp, editField: ContactEdit) { /* editField can be... {nickname: ''} {email: ''} diff --git a/pkg/interface/src/api/global.ts b/pkg/interface/src/api/global.ts index 9c6568190..9a06e48b5 100644 --- a/pkg/interface/src/api/global.ts +++ b/pkg/interface/src/api/global.ts @@ -10,6 +10,7 @@ import ContactsApi from './contacts'; import GroupsApi from './groups'; import LaunchApi from './launch'; import LinksApi from './links'; +import PublishApi from './publish'; export default class GlobalApi extends BaseApi { chat = new ChatApi(this.ship, this.channel, this.store); diff --git a/pkg/interface/src/apps/groups/app.js b/pkg/interface/src/apps/groups/app.js index 6ead32d3c..2739486fb 100644 --- a/pkg/interface/src/apps/groups/app.js +++ b/pkg/interface/src/apps/groups/app.js @@ -17,9 +17,6 @@ import GroupDetail from './components/lib/group-detail'; export default class GroupsApp extends Component { constructor(props) { super(props); - this.store = new GroupsStore(); - this.state = this.store.state; - this.resetControllers(); } componentDidMount() { @@ -27,41 +24,30 @@ export default class GroupsApp extends Component { // preload spinner asset new Image().src = '/~landscape/img/Spinner.png'; - this.store.setStateHandler(this.setState.bind(this)); - const channel = new this.props.channel(); - this.api = new GroupsApi(this.props.ship, channel, this.store); - - this.subscription = new GroupsSubscription(this.store, this.api, channel); - this.subscription.start(); + this.props.subscription.startApp('groups') } componentWillUnmount() { - this.subscription.delete(); - this.store.clear(); - this.store.setStateHandler(() => {}); - this.resetControllers(); + this.props.subscription.stopApp('groups') } - resetControllers() { - this.api = null; - this.subscription = null; - } render() { - const { state, props } = this; + const { props } = this; - const contacts = state.contacts ? state.contacts : {}; + const contacts = props.contacts || {}; const defaultContacts = - (Boolean(state.contacts) && '/~/default' in state.contacts) ? - state.contacts['/~/default'] : {}; - const groups = state.groups ? state.groups : {}; + (Boolean(props.contacts) && '/~/default' in props.contacts) ? + props.contacts['/~/default'] : {}; + const groups = props.groups ? props.groups : {}; const invites = - (Boolean(state.invites) && '/contacts' in state.invites) ? - state.invites['/contacts'] : {}; - const associations = state.associations ? state.associations : {}; + (Boolean(props.invites) && '/contacts' in props.invites) ? + props.invites['/contacts'] : {}; + const associations = props.associations ? props.associations : {}; const selectedGroups = props.selectedGroups ? props.selectedGroups : []; - const s3 = state.s3 ? state.s3 : {}; + const s3 = props.s3 ? props.s3 : {}; + const { api } = props; return ( @@ -72,7 +58,7 @@ export default class GroupsApp extends Component { activeDrawer="groups" selectedGroups={selectedGroups} history={props.history} - api={this.api} + api={api} contacts={contacts} groups={groups} invites={invites} @@ -95,7 +81,7 @@ export default class GroupsApp extends Component { ); @@ -129,7 +115,7 @@ export default class GroupsApp extends Component { @@ -153,7 +139,7 @@ export default class GroupsApp extends Component { activeDrawer={(detail || settings) ? 'detail' : 'contacts'} settings={settings} associations={associations} - api={this.api} + api={api} {...props} /> @@ -171,7 +157,7 @@ export default class GroupsApp extends Component { { - const submit = props.api.group.add(props.path, aud); + const submit = props.api.groups.add(props.path, aud); submit.then(() => { this.setState({ awaiting: false }); props.history.push('/~groups' + props.path); diff --git a/pkg/interface/src/apps/groups/components/lib/contact-card.js b/pkg/interface/src/apps/groups/components/lib/contact-card.js index 4e84fe104..c92877f4c 100644 --- a/pkg/interface/src/apps/groups/components/lib/contact-card.js +++ b/pkg/interface/src/apps/groups/components/lib/contact-card.js @@ -141,7 +141,7 @@ export class ContactCard extends Component { type: 'Saving to group' }, () => { - props.api.contactHook.edit(props.path, ship, { + props.api.contacts.edit(props.path, ship, { avatar: { url: state.avatarToSet }}) @@ -161,7 +161,7 @@ export class ContactCard extends Component { if (hexTest && hexTest[1] !== currentColor && !props.share) { this.setState({ awaiting: true, type: 'Saving to group' }, () => { - props.api.contactHook.edit( + props.api.contacts.edit( props.path, `~${props.ship}`, { color: hexTest[1] }) .then(() => { this.setState({ awaiting: false }); @@ -180,7 +180,7 @@ export class ContactCard extends Component { const emailTestResult = emailTest.exec(state.emailToSet); if (emailTestResult) { this.setState({ awaiting: true, type: 'Saving to group' }, () => { - props.api.contactHook.edit( + props.api.contacts.edit( props.path, ship, { email: state.emailToSet }) .then(() => { this.setState({ awaiting: false }); @@ -197,7 +197,7 @@ export class ContactCard extends Component { return false; } this.setState({ awaiting: true, type: 'Saving to group' }, () => { - props.api.contactHook.edit( + props.api.contacts.edit( props.path, ship, { nickname: state.nickNameToSet }) .then(() => { this.setState({ awaiting: false }); @@ -214,7 +214,7 @@ export class ContactCard extends Component { return false; } this.setState({ awaiting: true, type: 'Saving to group' }, () => { - props.api.contactHook.edit( + props.api.contacts.edit( props.path, ship, { notes: state.notesToSet }) .then(() => { this.setState({ awaiting: false }); @@ -232,7 +232,7 @@ export class ContactCard extends Component { const phoneTestResult = phoneTest.exec(state.phoneToSet); if (phoneTestResult) { this.setState({ awaiting: true, type: 'Saving to group' }, () => { - props.api.contactHook.edit( + props.api.contacts.edit( props.path, ship, { phone: state.phoneToSet }) .then(() => { this.setState({ awaiting: false }); @@ -251,7 +251,7 @@ export class ContactCard extends Component { const websiteTestResult = websiteTest.exec(state.websiteToSet); if (websiteTestResult) { this.setState({ awaiting: true, type: 'Saving to group' }, () => { - props.api.contactHook.edit( + props.api.contacts.edit( props.path, ship, { website: state.websiteToSet }) .then(() => { this.setState({ awaiting: false }); @@ -264,7 +264,7 @@ export class ContactCard extends Component { this.setState( { emailToSet: '', awaiting: true, type: 'Removing from group' }, () => { - props.api.contactHook.edit(props.path, ship, { email: '' }) + props.api.contacts.edit(props.path, ship, { email: '' }) .then(() => { this.setState({ awaiting: false }); }); @@ -276,7 +276,7 @@ export class ContactCard extends Component { this.setState( { nicknameToSet: '', awaiting: true, type: 'Removing from group' }, () => { - props.api.contactHook.edit(props.path, ship, { nickname: '' }) + props.api.contacts.edit(props.path, ship, { nickname: '' }) .then(() => { this.setState({ awaiting: false }); }); @@ -288,7 +288,7 @@ export class ContactCard extends Component { this.setState( { phoneToSet: '', awaiting: true, type: 'Removing from group' }, () => { - props.api.contactHook.edit(props.path, ship, { phone: '' }).then(() => { + props.api.contacts.edit(props.path, ship, { phone: '' }).then(() => { this.setState({ awaiting: false }); }); } @@ -299,7 +299,7 @@ export class ContactCard extends Component { this.setState( { websiteToSet: '', awaiting: true, type: 'Removing from group' }, () => { - props.api.contactHook.edit(props.path, ship, { website: '' }).then(() => { + props.api.contacts.edit(props.path, ship, { website: '' }).then(() => { this.setState({ awaiting: false }); }); } @@ -314,7 +314,7 @@ export class ContactCard extends Component { type: 'Removing from group' }, () => { - props.api.contactHook.edit(props.path, ship, { avatar: null }).then(() => { + props.api.contacts.edit(props.path, ship, { avatar: null }).then(() => { this.setState({ awaiting: false }); }); } @@ -325,7 +325,7 @@ export class ContactCard extends Component { this.setState( { notesToSet: '', awaiting: true, type: 'Removing from group' }, () => { - props.api.contactHook.edit(props.path, ship, { notes: '' }).then(() => { + props.api.contacts.edit(props.path, ship, { notes: '' }).then(() => { this.setState({ awaiting: false }); }); } @@ -380,7 +380,7 @@ export class ContactCard extends Component { }; this.setState({ awaiting: true, type: 'Sharing with group' }, () => { - props.api.contactView + props.api.contacts .share(`~${props.ship}`, props.path, `~${window.ship}`, contact) .then(() => { props.history.push(`/~groups/view${props.path}/${window.ship}`); @@ -402,7 +402,7 @@ export class ContactCard extends Component { avatar: null }; - props.api.contactView.share( + props.api.contacts.share( `~${props.ship}`, props.path, `~${window.ship}`, @@ -410,7 +410,7 @@ export class ContactCard extends Component { ); this.setState({ awaiting: true, type: 'Removing from group' }, () => { - props.api.contactView.delete(props.path).then(() => { + props.api.contacts.delete(props.path).then(() => { this.setState({ awaiting: false }); props.history.push('/~groups'); }); @@ -421,7 +421,7 @@ export class ContactCard extends Component { const { props } = this; this.setState({ awaiting: true, type: 'Removing from group' }, () => { - props.api.contactView.remove(props.path, `~${props.ship}`).then(() => { + props.api.contacts.remove(props.path, `~${props.ship}`).then(() => { this.setState({ awaiting: false }); props.history.push(`/~groups${props.path}`); }); diff --git a/pkg/interface/src/apps/groups/components/lib/contact-sidebar.js b/pkg/interface/src/apps/groups/components/lib/contact-sidebar.js index 80838ac35..620f75b52 100644 --- a/pkg/interface/src/apps/groups/components/lib/contact-sidebar.js +++ b/pkg/interface/src/apps/groups/components/lib/contact-sidebar.js @@ -99,7 +99,7 @@ export class ContactSidebar extends Component { style={{ paddingTop: 6 }} onClick={() => { this.setState({ awaiting: true }, (() => { - props.api.group.remove(props.path, [`~${member}`]) + props.api.groups.remove(props.path, [`~${member}`]) .then(() => { this.setState({ awaiting: false }); }); diff --git a/pkg/interface/src/apps/groups/components/lib/group-detail.js b/pkg/interface/src/apps/groups/components/lib/group-detail.js index 9d71acb0e..5e1cc3343 100644 --- a/pkg/interface/src/apps/groups/components/lib/group-detail.js +++ b/pkg/interface/src/apps/groups/components/lib/group-detail.js @@ -198,7 +198,8 @@ export class GroupDetail extends Component { onBlur={() => { if (groupOwner) { this.setState({ awaiting: true }, (() => { - props.api.metadata.add( + props.api.metadata.metadataAdd( + 'contacts', association['app-path'], association['group-path'], this.state.title, @@ -227,7 +228,8 @@ export class GroupDetail extends Component { onBlur={() => { if (groupOwner) { this.setState({ awaiting: true }, (() => { - props.api.metadata.add( + props.api.metadata.metadataAdd( + 'contacts', association['app-path'], association['group-path'], association.metadata.title, @@ -250,7 +252,7 @@ export class GroupDetail extends Component { onClick={() => { if (groupOwner) { this.setState({ awaiting: true, type: 'Deleting' }, (() => { - props.api.contactView.delete(props.path).then(() => { + props.api.contacts.delete(props.path).then(() => { props.history.push('/~groups'); }); })); diff --git a/pkg/interface/src/apps/groups/components/lib/sidebar-invite.js b/pkg/interface/src/apps/groups/components/lib/sidebar-invite.js index fe05912d7..7fee7cb7f 100644 --- a/pkg/interface/src/apps/groups/components/lib/sidebar-invite.js +++ b/pkg/interface/src/apps/groups/components/lib/sidebar-invite.js @@ -3,12 +3,12 @@ import React, { Component } from 'react'; export class SidebarInvite extends Component { onAccept() { const { props } = this; - props.api.invite.accept(props.uid); + props.api.invite.accept('/contacts', props.uid); props.history.push(`/~groups${props.invite.path}`); } onDecline() { - this.props.api.invite.decline(this.props.uid); + this.props.api.invite.decline('/contacts', this.props.uid); } render() { diff --git a/pkg/interface/src/apps/groups/components/new.js b/pkg/interface/src/apps/groups/components/new.js index 6a68781a2..46d1c1d00 100644 --- a/pkg/interface/src/apps/groups/components/new.js +++ b/pkg/interface/src/apps/groups/components/new.js @@ -67,7 +67,7 @@ export class NewScreen extends Component { invites: '', awaiting: true }, () => { - props.api.contactView.create( + props.api.contacts.create( group, aud, this.state.title, diff --git a/pkg/interface/src/subscription/global.ts b/pkg/interface/src/subscription/global.ts index b28b2c29d..e7682c8eb 100644 --- a/pkg/interface/src/subscription/global.ts +++ b/pkg/interface/src/subscription/global.ts @@ -44,8 +44,6 @@ export default class GlobalSubscription extends BaseSubscription { groups: [] }; start() { - this.subscribe('/all', 'invite-store'); - this.subscribe('/app-name/contacts', 'metadata-store'); this.subscribe('/all', 'invite-store'); this.subscribe('/all', 'permission-store'); this.subscribe('/primary', 'contact-view'); From 535f415ebdc1206ff2a103a7eecba1ac9482dd6b Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 22 Jun 2020 16:05:43 +1000 Subject: [PATCH 230/280] chat-js: update to global store --- pkg/interface/src/App.js | 20 +- .../src/apps/chat/{app.js => app.tsx} | 269 +++++++------ .../chat/components/{chat.js => chat.tsx} | 371 ++++++++++-------- .../src/apps/chat/components/join.js | 4 +- .../components/lib/resubscribe-element.js | 2 +- .../chat/components/lib/sidebar-invite.js | 4 +- .../src/apps/chat/components/new-dm.js | 2 +- pkg/interface/src/apps/chat/components/new.js | 2 +- .../src/apps/chat/components/settings.js | 13 +- pkg/interface/src/apps/launch/app.js | 36 +- pkg/interface/src/store/chat.js | 51 --- 11 files changed, 386 insertions(+), 388 deletions(-) rename pkg/interface/src/apps/chat/{app.js => app.tsx} (51%) rename pkg/interface/src/apps/chat/components/{chat.js => chat.tsx} (56%) delete mode 100644 pkg/interface/src/store/chat.js diff --git a/pkg/interface/src/App.js b/pkg/interface/src/App.js index 30066cb1f..7e2e62afb 100644 --- a/pkg/interface/src/App.js +++ b/pkg/interface/src/App.js @@ -85,8 +85,8 @@ export default class App extends React.Component { render={ p => ( )} @@ -94,8 +94,9 @@ export default class App extends React.Component { ( )} @@ -105,6 +106,7 @@ export default class App extends React.Component { ship={this.ship} channel={channel} selectedGroups={selectedGroups} + subscription={this.subscription} {...p} /> )} @@ -112,8 +114,9 @@ export default class App extends React.Component { ( )} @@ -132,8 +135,9 @@ export default class App extends React.Component { ( )} diff --git a/pkg/interface/src/apps/chat/app.js b/pkg/interface/src/apps/chat/app.tsx similarity index 51% rename from pkg/interface/src/apps/chat/app.js rename to pkg/interface/src/apps/chat/app.tsx index 675910546..5c0730fe0 100644 --- a/pkg/interface/src/apps/chat/app.js +++ b/pkg/interface/src/apps/chat/app.tsx @@ -1,68 +1,62 @@ -import React from 'react'; -import { Route, Switch } from 'react-router-dom'; +import React from "react"; +import { Route, Switch } from "react-router-dom"; -import ChatApi from '../../api/chat'; -import ChatStore from '../../store/chat'; -import ChatSubscription from '../../subscription/chat'; +import "./css/custom.css"; +import { Skeleton } from "./components/skeleton"; +import { Sidebar } from "./components/sidebar"; +import { ChatScreen } from "./components/chat"; +import { MemberScreen } from "./components/member"; +import { SettingsScreen } from "./components/settings"; +import { NewScreen } from "./components/new"; +import { JoinScreen } from "./components/join"; +import { NewDmScreen } from "./components/new-dm"; +import { PatpNoSig } from "../../types/noun"; +import GlobalApi from "../../api/global"; +import { StoreState } from "../../store/type"; +import GlobalSubscription from "../../subscription/global"; -import './css/custom.css'; +type ChatAppProps = StoreState & { + ship: PatpNoSig; + api: GlobalApi; + subscription: GlobalSubscription; +}; -import { Skeleton } from './components/skeleton'; -import { Sidebar } from './components/sidebar'; -import { ChatScreen } from './components/chat'; -import { MemberScreen } from './components/member'; -import { SettingsScreen } from './components/settings'; -import { NewScreen } from './components/new'; -import { JoinScreen } from './components/join'; -import { NewDmScreen } from './components/new-dm'; +export default class ChatApp extends React.Component { + totalUnreads = 0; -export default class ChatApp extends React.Component { constructor(props) { super(props); - this.store = new ChatStore(); - this.state = this.store.state; - this.totalUnreads = 0; - this.resetControllers(); - } - - resetControllers() { - this.api = null; - this.subscription = null; } componentDidMount() { - document.title = 'OS1 - Chat'; + document.title = "OS1 - Chat"; // preload spinner asset - new Image().src = '/~landscape/img/Spinner.png'; + new Image().src = "/~landscape/img/Spinner.png"; + + this.props.subscription.startApp('chat'); - this.store.setStateHandler(this.setState.bind(this)); - const channel = new this.props.channel(); - this.api = new ChatApi(this.props.ship, channel, this.store); - this.subscription = new ChatSubscription(this.store, this.api, channel); - this.subscription.start(); } componentWillUnmount() { - this.subscription.delete(); - this.store.clear(); - this.store.setStateHandler(() => {}); - this.resetControllers(); + this.props.subscription.stopApp('chat'); } render() { - const { state, props } = this; + const { props } = this; const messagePreviews = {}; const unreads = {}; let totalUnreads = 0; const selectedGroups = props.selectedGroups ? props.selectedGroups : []; - const associations = state.associations ? state.associations : { chat: {}, contacts: {} }; + const associations = props.associations + ? props.associations + : { chat: {}, contacts: {} }; - Object.keys(state.inbox).forEach((stat) => { - const envelopes = state.inbox[stat].envelopes; + Object.keys(props.inbox).forEach((stat) => { + const envelopes = props.inbox[stat].envelopes; if (envelopes.length === 0) { messagePreviews[stat] = false; @@ -70,42 +64,61 @@ export default class ChatApp extends React.Component { messagePreviews[stat] = envelopes[0]; } - const unread = Math.max(state.inbox[stat].config.length - state.inbox[stat].config.read, 0); + const unread = Math.max( + props.inbox[stat].config.length - props.inbox[stat].config.read, + 0 + ); unreads[stat] = Boolean(unread); - if (unread && - (selectedGroups.length === 0 || selectedGroups.map(((e) => { - return e[0]; - })).includes(associations.chat?.[stat]?.['group-path']) || - associations.chat?.[stat]?.['group-path'].startsWith('/~/'))) { - totalUnreads += unread; + if ( + unread && + (selectedGroups.length === 0 || + selectedGroups + .map((e) => { + return e[0]; + }) + .includes(associations.chat?.[stat]?.["group-path"]) || + associations.chat?.[stat]?.["group-path"].startsWith("/~/")) + ) { + totalUnreads += unread; } }); if (totalUnreads !== this.totalUnreads) { - document.title = totalUnreads > 0 ? `OS1 - Chat (${totalUnreads})` : 'OS1 - Chat'; + document.title = + totalUnreads > 0 ? `OS1 - Chat (${totalUnreads})` : "OS1 - Chat"; this.totalUnreads = totalUnreads; } - const invites = state.invites ? state.invites : { '/chat': {}, '/contacts': {} }; - const contacts = state.contacts ? state.contacts : {}; - const s3 = state.s3 ? state.s3 : {}; + const { + invites, + s3, + sidebarShown, + inbox, + contacts, + permissions, + chatSynced, + api, + chatInitialized, + pendingMessages + } = props; - const renderChannelSidebar = (props, station) => ( + const renderChannelSidebar = (props, station?) => ( ); + return (

Select, create, or join a chat to begin. -

+

@@ -143,15 +156,15 @@ export default class ChatApp extends React.Component { invites={invites} sidebarHideOnMobile={true} sidebar={renderChannelSidebar(props)} - sidebarShown={state.sidebarShown} + sidebarShown={sidebarShown} > @@ -169,15 +182,15 @@ export default class ChatApp extends React.Component { invites={invites} sidebarHideOnMobile={true} sidebar={renderChannelSidebar(props)} - sidebarShown={state.sidebarShown} + sidebarShown={sidebarShown} > @@ -188,11 +201,10 @@ export default class ChatApp extends React.Component { exact path="/~chat/join/(~)?/:ship?/:station?" render={(props) => { - let station = - `/${props.match.params.ship}/${props.match.params.station}`; - const sig = props.match.url.includes('/~/'); + let station = `/${props.match.params.ship}/${props.match.params.station}`; + const sig = props.match.url.includes("/~/"); if (sig) { - station = '/~' + station; + station = "/~" + station; } return ( @@ -201,13 +213,13 @@ export default class ChatApp extends React.Component { invites={invites} sidebarHideOnMobile={true} sidebar={renderChannelSidebar(props)} - sidebarShown={state.sidebarShown} + sidebarShown={sidebarShown} > @@ -218,40 +230,41 @@ export default class ChatApp extends React.Component { exact path="/~chat/(popout)?/room/(~)?/:ship/:station+" render={(props) => { - let station = - `/${props.match.params.ship}/${props.match.params.station}`; - const sig = props.match.url.includes('/~/'); + let station = `/${props.match.params.ship}/${props.match.params.station}`; + const sig = props.match.url.includes("/~/"); if (sig) { - station = '/~' + station; + station = "/~" + station; } - const mailbox = state.inbox[station] || { + const mailbox = inbox[station] || { config: { read: 0, - length: 0 + length: 0, }, - envelopes: [] + envelopes: [], }; let roomContacts = {}; const associatedGroup = - station in associations['chat'] && - 'group-path' in associations.chat[station] - ? associations.chat[station]['group-path'] - : ''; + station in associations["chat"] && + "group-path" in associations.chat[station] + ? associations.chat[station]["group-path"] + : ""; - if ((associations.chat[station]) && (associatedGroup in contacts)) { + if (associations.chat[station] && associatedGroup in contacts) { roomContacts = contacts[associatedGroup]; } const association = - station in associations['chat'] ? associations.chat[station] : {}; + station in associations["chat"] ? associations.chat[station] : {}; const permission = - station in state.permissions ? state.permissions[station] : { - who: new Set([]), - kind: 'white' - }; - const popout = props.match.url.includes('/popout/'); + station in permissions + ? permissions[station] + : { + who: new Set([]), + kind: "white", + }; + const popout = props.match.url.includes("/popout/"); return ( @@ -290,39 +302,39 @@ export default class ChatApp extends React.Component { path="/~chat/(popout)?/members/(~)?/:ship/:station+" render={(props) => { let station = `/${props.match.params.ship}/${props.match.params.station}`; - const sig = props.match.url.includes('/~/'); + const sig = props.match.url.includes("/~/"); if (sig) { - station = '/~' + station; + station = "/~" + station; } - const permission = state.permissions[station] || { - kind: '', - who: new Set([]) + const permission = permissions[station] || { + kind: "", + who: new Set([]), }; - const popout = props.match.url.includes('/popout/'); + const popout = props.match.url.includes("/popout/"); const association = - station in associations['chat'] ? associations.chat[station] : {}; + station in associations["chat"] ? associations.chat[station] : {}; return ( ); @@ -332,22 +344,21 @@ export default class ChatApp extends React.Component { exact path="/~chat/(popout)?/settings/(~)?/:ship/:station+" render={(props) => { - let station = - `/${props.match.params.ship}/${props.match.params.station}`; - const sig = props.match.url.includes('/~/'); + let station = `/${props.match.params.ship}/${props.match.params.station}`; + const sig = props.match.url.includes("/~/"); if (sig) { - station = '/~' + station; + station = "/~" + station; } - const popout = props.match.url.includes('/popout/'); + const popout = props.match.url.includes("/popout/"); - const permission = state.permissions[station] || { - kind: '', - who: new Set([]) + const permission = permissions[station] || { + kind: "", + who: new Set([]), }; const association = - station in associations['chat'] ? associations.chat[station] : {}; + station in associations["chat"] ? associations.chat[station] : {}; return ( ); }} />
- ); + ); } } diff --git a/pkg/interface/src/apps/chat/components/chat.js b/pkg/interface/src/apps/chat/components/chat.tsx similarity index 56% rename from pkg/interface/src/apps/chat/components/chat.js rename to pkg/interface/src/apps/chat/components/chat.tsx index 4662758cc..cd943f2ef 100644 --- a/pkg/interface/src/apps/chat/components/chat.js +++ b/pkg/interface/src/apps/chat/components/chat.tsx @@ -1,19 +1,26 @@ -import React, { Component } from 'react'; -import _ from 'lodash'; -import moment from 'moment'; +import React, { Component } from "react"; +import _ from "lodash"; +import moment from "moment"; -import { Link } from 'react-router-dom'; +import { Link, RouteComponentProps } from "react-router-dom"; -import { ResubscribeElement } from './lib/resubscribe-element'; -import { BacklogElement } from './lib/backlog-element'; -import { Message } from './lib/message'; -import { SidebarSwitcher } from '../../../components/SidebarSwitch'; -import { ChatTabBar } from './lib/chat-tabbar'; -import { ChatInput } from './lib/chat-input'; -import { UnreadNotice } from './lib/unread-notice'; -import { deSig } from '../../../lib/util'; +import { ResubscribeElement } from "./lib/resubscribe-element"; +import { BacklogElement } from "./lib/backlog-element"; +import { Message } from "./lib/message"; +import { SidebarSwitcher } from "../../../components/SidebarSwitch"; +import { ChatTabBar } from "./lib/chat-tabbar"; +import { ChatInput } from "./lib/chat-input"; +import { UnreadNotice } from "./lib/unread-notice"; +import { deSig } from "../../../lib/util"; +import { ChatHookUpdate } from "../../../types/chat-hook-update"; +import ChatApi from "../../../api/chat"; +import { Inbox, Envelope } from "../../../types/chat-update"; +import { Contacts } from "../../../types/contact-update"; +import { Path, Patp } from "../../../types/noun"; +import GlobalApi from "../../../api/global"; +import { Association } from "../../../types/metadata-update"; -function getNumPending(props) { +function getNumPending(props: any) { const result = props.pendingMessages.has(props.station) ? props.pendingMessages.get(props.station).length : 0; @@ -25,26 +32,32 @@ const DEFAULT_BACKLOG_SIZE = 300; const MAX_BACKLOG_SIZE = 1000; function scrollIsAtTop(container) { - if ((navigator.userAgent.includes("Safari") && + if ( + (navigator.userAgent.includes("Safari") && navigator.userAgent.includes("Chrome")) || - navigator.userAgent.includes("Firefox") + navigator.userAgent.includes("Firefox") ) { return container.scrollTop === 0; } else if (navigator.userAgent.includes("Safari")) { - return container.scrollHeight + Math.round(container.scrollTop) <= - container.clientHeight + 10; + return ( + container.scrollHeight + Math.round(container.scrollTop) <= + container.clientHeight + 10 + ); } else { return false; } } function scrollIsAtBottom(container) { - if ((navigator.userAgent.includes("Safari") && + if ( + (navigator.userAgent.includes("Safari") && navigator.userAgent.includes("Chrome")) || - navigator.userAgent.includes("Firefox") + navigator.userAgent.includes("Firefox") ) { - return container.scrollHeight - Math.round(container.scrollTop) <= - container.clientHeight + 10; + return ( + container.scrollHeight - Math.round(container.scrollTop) <= + container.clientHeight + 10 + ); } else if (navigator.userAgent.includes("Safari")) { return container.scrollTop === 0; } else { @@ -52,7 +65,50 @@ function scrollIsAtBottom(container) { } } -export class ChatScreen extends Component { +type IMessage = Envelope & { pending?: boolean }; + +type ChatScreenProps = RouteComponentProps<{ + ship: Patp; + station: string; +}> & { + chatSynced: ChatHookUpdate; + station: any; + association: Association; + api: GlobalApi; + read: number; + length: number; + inbox: Inbox; + contacts: Contacts; + permission: any; + pendingMessages: Map; + s3: any; + popout: boolean; + sidebarShown: boolean; + chatInitialized: boolean; + envelopes: Envelope[]; +}; + +interface ChatScreenState { + numPages: number; + scrollLocked: boolean; + read: number; + active: boolean; + lastScrollHeight: number | null; +} + +export class ChatScreen extends Component { + hasAskedForMessages = false; + lastNumPending = 0; + + scrollContainer: HTMLElement | null = null; + + unreadMarker = null; + scrolledToMarker = false; + + activityTimeout: NodeJS.Timeout | null = null; + + scrollElement: HTMLElement | null = null; + constructor(props) { super(props); @@ -65,29 +121,22 @@ export class ChatScreen extends Component { lastScrollHeight: null, }; - this.hasAskedForMessages = false; - this.lastNumPending = 0; - - this.scrollContainer = null; this.onScroll = this.onScroll.bind(this); - this.unreadMarker = null; - this.scrolledToMarker = false; this.setUnreadMarker = this.setUnreadMarker.bind(this); - this.activityTimeout = true; this.handleActivity = this.handleActivity.bind(this); this.setInactive = this.setInactive.bind(this); - moment.updateLocale('en', { + moment.updateLocale("en", { calendar: { - sameDay: '[Today]', - nextDay: '[Tomorrow]', - nextWeek: 'dddd', - lastDay: '[Yesterday]', - lastWeek: '[Last] dddd', - sameElse: 'DD/MM/YYYY' - } + sameDay: "[Today]", + nextDay: "[Tomorrow]", + nextWeek: "dddd", + lastDay: "[Yesterday]", + lastWeek: "[Last] dddd", + sameElse: "DD/MM/YYYY", + }, }); } @@ -104,17 +153,17 @@ export class ChatScreen extends Component { document.removeEventListener("mousedown", this.handleActivity, false); document.removeEventListener("keypress", this.handleActivity, false); document.removeEventListener("touchmove", this.handleActivity, false); - if(this.activityTimeout) { + if (this.activityTimeout) { clearTimeout(this.activityTimeout); } } handleActivity() { - if(!this.state.active) { + if (!this.state.active) { this.setState({ active: true }); } - if(this.activityTimeout) { + if (this.activityTimeout) { clearTimeout(this.activityTimeout); } @@ -139,13 +188,13 @@ export class ChatScreen extends Component { const unreadUnloaded = unread - props.envelopes.length; const excessUnread = unreadUnloaded > MAX_BACKLOG_SIZE; - if(!excessUnread && unreadUnloaded + 20 > DEFAULT_BACKLOG_SIZE) { + if (!excessUnread && unreadUnloaded + 20 > DEFAULT_BACKLOG_SIZE) { this.askForMessages(unreadUnloaded + 20); } else { this.askForMessages(DEFAULT_BACKLOG_SIZE); } - if(excessUnread || props.read === props.length){ + if (excessUnread || props.read === props.length) { this.scrolledToMarker = true; this.setState( { @@ -156,7 +205,7 @@ export class ChatScreen extends Component { } ); } else { - this.setState({ scrollLocked: true, numPages: Math.ceil(unread/100) }); + this.setState({ scrollLocked: true, numPages: Math.ceil(unread / 100) }); } } @@ -168,34 +217,36 @@ export class ChatScreen extends Component { prevProps.match.params.ship !== props.match.params.ship ) { this.receivedNewChat(); - } else if (props.chatInitialized && - !(props.station in props.inbox) && - (Boolean(props.chatSynced) && !(props.station in props.chatSynced))) { - props.history.push('/~chat'); } else if ( - props.envelopes.length >= prevProps.envelopes.length + 10 + props.chatInitialized && + !(props.station in props.inbox) && + Boolean(props.chatSynced) && + !(props.station in props.chatSynced) ) { + props.history.push("/~chat"); + } else if (props.envelopes.length >= prevProps.envelopes.length + 10) { this.hasAskedForMessages = false; - } else if(props.length !== prevProps.length && - prevProps.length === prevState.read && - state.active + } else if ( + props.length !== prevProps.length && + prevProps.length === prevState.read && + state.active ) { this.setState({ read: props.length }); this.props.api.chat.read(this.props.station); } - if(!prevProps.chatInitialized && props.chatInitialized) { + if (!prevProps.chatInitialized && props.chatInitialized) { this.receivedNewChat(); } if ( - (props.length !== prevProps.length || - props.envelopes.length !== prevProps.envelopes.length || - getNumPending(props) !== this.lastNumPending || - state.numPages !== prevState.numPages) + props.length !== prevProps.length || + props.envelopes.length !== prevProps.envelopes.length || + getNumPending(props) !== this.lastNumPending || + state.numPages !== prevState.numPages ) { this.scrollToBottom(); - if(navigator.userAgent.includes("Firefox")) { + if (navigator.userAgent.includes("Firefox")) { this.recalculateScrollTop(); } @@ -219,7 +270,7 @@ export class ChatScreen extends Component { if (start > 0) { const end = start + size < props.length ? start + size : props.length; this.hasAskedForMessages = true; - props.subscription.fetchMessages(start + 1, end, props.station); + props.api.chat.fetchMessages(start + 1, end, props.station); } } @@ -231,31 +282,31 @@ export class ChatScreen extends Component { // Restore chat position on FF when new messages come in recalculateScrollTop() { - if(!this.scrollContainer) { + const { lastScrollHeight } = this.state; + if (!this.scrollContainer || !lastScrollHeight) { return; } - const { lastScrollHeight } = this.state; const target = this.scrollContainer; const newScrollTop = this.scrollContainer.scrollHeight - lastScrollHeight; - if(target.scrollTop !== 0 || newScrollTop === target.scrollTop) { + if (target.scrollTop !== 0 || newScrollTop === target.scrollTop) { return; } target.scrollTop = target.scrollHeight - lastScrollHeight; } onScroll(e) { - if(scrollIsAtTop(e.target)) { + if (scrollIsAtTop(e.target)) { // Save scroll position for FF - if (navigator.userAgent.includes('Firefox')) { + if (navigator.userAgent.includes("Firefox")) { this.setState({ - lastScrollHeight: e.target.scrollHeight + lastScrollHeight: e.target.scrollHeight, }); } this.setState( { numPages: this.state.numPages + 1, - scrollLocked: true + scrollLocked: true, }, () => { this.askForMessages(DEFAULT_BACKLOG_SIZE); @@ -265,21 +316,20 @@ export class ChatScreen extends Component { this.dismissUnread(); this.setState({ numPages: 1, - scrollLocked: false + scrollLocked: false, }); } } setUnreadMarker(ref) { - if(ref && !this.scrolledToMarker) { + if (ref && !this.scrolledToMarker) { this.setState({ scrollLocked: true }, () => { - ref.scrollIntoView({ block: 'center' }); - if(ref.offsetParent && - scrollIsAtBottom(ref.offsetParent)) { + ref.scrollIntoView({ block: "center" }); + if (ref.offsetParent && scrollIsAtBottom(ref.offsetParent)) { this.dismissUnread(); this.setState({ numPages: 1, - scrollLocked: false + scrollLocked: false, }); } }); @@ -298,38 +348,32 @@ export class ChatScreen extends Component { const { props, state } = this; - let messages = props.envelopes.slice(0); + let messages: IMessage[] = props.envelopes.slice(0); const lastMsgNum = messages.length > 0 ? messages.length : 0; if (messages.length > 100 * state.numPages) { messages = messages.slice(0, 100 * state.numPages); } - const pendingMessages = props.pendingMessages.has(props.station) - ? props.pendingMessages.get(props.station) - : []; - - pendingMessages.map((value) => { - return (value.pending = true); - }); + const pendingMessages: IMessage[] = ( + props.pendingMessages.get(props.station) || [] + ).map((value) => ({ ...value, pending: true })); messages = pendingMessages.concat(messages); const messageElements = messages.map((msg, i) => { // Render sigil if previous message is not by the same sender - const aut = ['author']; + const aut = ["author"]; const renderSigil = - _.get(messages[i + 1], aut) !== - _.get(msg, aut, msg.author); + _.get(messages[i + 1], aut) !== _.get(msg, aut, msg.author); const paddingTop = renderSigil; const paddingBot = - _.get(messages[i - 1], aut) !== - _.get(msg, aut, msg.author); + _.get(messages[i - 1], aut) !== _.get(msg, aut, msg.author); - const when = ['when']; + const when = ["when"]; const dayBreak = - moment(_.get(messages[i+1], when)).format('YYYY.MM.DD') !== - moment(_.get(messages[i], when)).format('YYYY.MM.DD'); + moment(_.get(messages[i + 1], when)).format("YYYY.MM.DD") !== + moment(_.get(messages[i], when)).format("YYYY.MM.DD"); const messageElem = ( ); - if(unread > 0 && i === unread - 1) { + if (unread > 0 && i === unread - 1) { return ( <> {messageElem} -
+

-

- New messages below -

+

New messages below


- { dayBreak && ( -

- {moment(_.get(messages[i], when)).calendar()} -

+ {dayBreak && ( +

+ {moment(_.get(messages[i], when)).calendar()} +

)} -
+
); - } else if(dayBreak) { + } else if (dayBreak) { return ( <> {messageElem} -
-

- {moment(_.get(messages[i], when)).calendar()} -

+
+

{moment(_.get(messages[i], when)).calendar()}

); @@ -378,47 +428,47 @@ export class ChatScreen extends Component { } }); - if (navigator.userAgent.includes('Firefox')) { + if (navigator.userAgent.includes("Firefox")) { return ( -
{ - this.scrollContainer = e; -}} +
{ + this.scrollContainer = e; + }} >
{ this.scrollElement = el; }} >
- {(props.chatInitialized && - !(props.station in props.inbox)) && ( - + {props.chatInitialized && !(props.station in props.inbox) && ( + + )} + {props.chatSynced && + !(props.station in props.chatSynced) && + messages.length > 0 ? ( + + ) : ( +
)} - {( - props.chatSynced && - !(props.station in props.chatSynced) && - (messages.length > 0) - ) ? ( - - ) : (
) - } {messageElements}
); -} else { + } else { return (
{ this.scrollElement = el; }} >
- {(props.chatInitialized && - !(props.station in props.inbox)) && ( - + {props.chatInitialized && !(props.station in props.inbox) && ( + + )} + {props.chatSynced && + !(props.station in props.chatSynced) && + messages.length > 0 ? ( + + ) : ( +
)} - {( - props.chatSynced && - !(props.station in props.chatSynced) && - (messages.length > 0) - ) ? ( - - ) : (
) - } {messageElements}
); -} + } } render() { @@ -457,16 +505,16 @@ ref={(e) => { const group = Array.from(props.permission.who.values()); - const isinPopout = props.popout ? 'popout/' : ''; + const isinPopout = props.popout ? "popout/" : ""; - const ownerContact = (window.ship in props.contacts) - ? props.contacts[window.ship] : false; + const ownerContact = + window.ship in props.contacts ? props.contacts[window.ship] : false; let title = props.station.substr(1); - if (props.association && 'metadata' in props.association) { + if (props.association && "metadata" in props.association) { title = - props.association.metadata.title !== '' + props.association.metadata.title !== "" ? props.association.metadata.title : props.station.substr(1); } @@ -475,8 +523,8 @@ ref={(e) => { const unreadMsg = unread > 0 && messages[unread - 1]; - - const showUnreadNotice = props.length !== props.read && props.read === state.read; + const showUnreadNotice = + props.length !== props.read && props.read === state.read; return (
{ >
- {'⟵ All Chats'} + {"⟵ All Chats"}
{ popout={props.popout} api={props.api} /> -

{title}

@@ -520,13 +573,13 @@ ref={(e) => { api={props.api} />
- { !!unreadMsg && showUnreadNotice && ( + {!!unreadMsg && showUnreadNotice && ( this.dismissUnread()} /> - ) } + )} {this.chatWindow(unread)} props.api.chatView.join(ship, station, true)); + }, () => props.api.chat.join(ship, station, true)); } if (state.station in props.inbox || @@ -78,7 +78,7 @@ export class JoinScreen extends Component { station, awaiting: true }, () => { - props.api.chatView.join(ship, station, true); + props.api.chat.join(ship, station, true); }); } diff --git a/pkg/interface/src/apps/chat/components/lib/resubscribe-element.js b/pkg/interface/src/apps/chat/components/lib/resubscribe-element.js index 1209008cc..61186a375 100644 --- a/pkg/interface/src/apps/chat/components/lib/resubscribe-element.js +++ b/pkg/interface/src/apps/chat/components/lib/resubscribe-element.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; export class ResubscribeElement extends Component { onClickResubscribe() { - this.props.api.chatHook.addSynced( + this.props.api.chat.addSynced( this.props.host, this.props.station, true); diff --git a/pkg/interface/src/apps/chat/components/lib/sidebar-invite.js b/pkg/interface/src/apps/chat/components/lib/sidebar-invite.js index eca773d36..de914c255 100644 --- a/pkg/interface/src/apps/chat/components/lib/sidebar-invite.js +++ b/pkg/interface/src/apps/chat/components/lib/sidebar-invite.js @@ -2,11 +2,11 @@ import React, { Component } from 'react'; export class SidebarInvite extends Component { onAccept() { - this.props.api.invite.accept(this.props.uid); + this.props.api.invite.accept('/chat', this.props.uid); } onDecline() { - this.props.api.invite.decline(this.props.uid); + this.props.api.invite.decline('/chat', this.props.uid); } render() { diff --git a/pkg/interface/src/apps/chat/components/new-dm.js b/pkg/interface/src/apps/chat/components/new-dm.js index 4c63603d5..72b384e74 100644 --- a/pkg/interface/src/apps/chat/components/new-dm.js +++ b/pkg/interface/src/apps/chat/components/new-dm.js @@ -63,7 +63,7 @@ export class NewDmScreen extends Component { }, () => { const groupPath = station; - props.api.chatView.create( + props.api.chat.create( `~${window.ship} <-> ~${state.ship}`, '', station, diff --git a/pkg/interface/src/apps/chat/components/new.js b/pkg/interface/src/apps/chat/components/new.js index d52c31e7c..d6ba81b84 100644 --- a/pkg/interface/src/apps/chat/components/new.js +++ b/pkg/interface/src/apps/chat/components/new.js @@ -146,7 +146,7 @@ export class NewScreen extends Component { if (state.groups.length > 0) { groupPath = state.groups[0]; } - const submit = props.api.chatView.create( + const submit = props.api.chat.create( state.title, state.description, appPath, diff --git a/pkg/interface/src/apps/chat/components/settings.js b/pkg/interface/src/apps/chat/components/settings.js index 804ceebcc..9eee56b0a 100644 --- a/pkg/interface/src/apps/chat/components/settings.js +++ b/pkg/interface/src/apps/chat/components/settings.js @@ -108,7 +108,8 @@ export class SettingsScreen extends Component { if (chatOwner) { this.setState({ awaiting: true, type: 'Editing chat...' }, (() => { - props.api.metadata.add( + props.api.metadata.metadataAdd( + 'chat', association['app-path'], association['group-path'], association.metadata.title, @@ -133,7 +134,7 @@ export class SettingsScreen extends Component { ? 'Deleting chat...' : 'Leaving chat...' }, (() => { - props.api.chatView.delete(props.station); + props.api.chat.delete(props.station); })); } @@ -145,7 +146,7 @@ export class SettingsScreen extends Component { awaiting: true, type: 'Converting chat...' }, (() => { - props.api.chatView.groupify( + props.api.chat.groupify( props.station, state.targetGroup, state.inclusive ).then(() => this.setState({ awaiting: false })); })); @@ -278,7 +279,8 @@ export class SettingsScreen extends Component { onBlur={() => { if (chatOwner) { this.setState({ awaiting: true, type: 'Editing chat...' }, (() => { - props.api.metadata.add( + props.api.metadata.metadataAdd( + 'chat', association['app-path'], association['group-path'], state.title, @@ -307,7 +309,8 @@ export class SettingsScreen extends Component { onBlur={() => { if (chatOwner) { this.setState({ awaiting: true, type: 'Editing chat...' }, (() => { - props.api.metadata.add( + props.api.metadata.metadataAdd( + 'chat', association['app-path'], association['group-path'], association.metadata.title, diff --git a/pkg/interface/src/apps/launch/app.js b/pkg/interface/src/apps/launch/app.js index 6e065e62c..daefbced5 100644 --- a/pkg/interface/src/apps/launch/app.js +++ b/pkg/interface/src/apps/launch/app.js @@ -10,50 +10,28 @@ import Tiles from './components/tiles'; import Welcome from './components/welcome'; export default class LaunchApp extends React.Component { - constructor(props) { - super(props); - this.store = new LaunchStore(); - this.state = this.store.state; - this.resetControllers(); - } - - resetControllers() { - this.api = null; - this.subscription = null; - } componentDidMount() { document.title = 'OS1 - Home'; // preload spinner asset new Image().src = '/~landscape/img/Spinner.png'; - this.store.setStateHandler(this.setState.bind(this)); - const channel = new this.props.channel(); - this.api = new LaunchApi(this.props.ship, channel, this.store); - - this.subscription = new LaunchSubscription(this.store, this.api, channel); - this.subscription.start(); } - componentWillUnmount() { - this.subscription.delete(); - this.store.clear(); - this.store.setStateHandler(() => {}); - this.resetControllers(); - } + componentWillUnmount() {} render() { - const { state } = this; + const { props } = this; return (
- +
); diff --git a/pkg/interface/src/store/chat.js b/pkg/interface/src/store/chat.js deleted file mode 100644 index fc3881b99..000000000 --- a/pkg/interface/src/store/chat.js +++ /dev/null @@ -1,51 +0,0 @@ -import ContactReducer from '../reducers/contact-update'; -import ChatReducer from '../reducers/chat-update'; -import InviteReducer from '../reducers/invite-update'; -import PermissionReducer from '../reducers/permission-update'; -import MetadataReducer from '../reducers/metadata-update'; -import S3Reducer from '../reducers/s3-update'; -import LocalReducer from '../reducers/local'; - -import BaseStore from './base'; - -export default class ChatStore extends BaseStore { - constructor() { - super(); - this.permissionReducer = new PermissionReducer(); - this.contactReducer = new ContactReducer(); - this.chatReducer = new ChatReducer(); - this.inviteReducer = new InviteReducer(); - this.s3Reducer = new S3Reducer(); - this.metadataReducer = new MetadataReducer(); - this.localReducer = new LocalReducer(); - } - - initialState() { - return { - inbox: {}, - chatSynced: null, - contacts: {}, - permissions: {}, - invites: {}, - associations: { - chat: {}, - contacts: {} - }, - sidebarShown: true, - pendingMessages: new Map([]), - chatInitialized: false, - s3: {} - }; - } - - reduce(data, state) { - this.permissionReducer.reduce(data, this.state); - this.contactReducer.reduce(data, this.state); - this.chatReducer.reduce(data, this.state); - this.inviteReducer.reduce(data, this.state); - this.metadataReducer.reduce(data, this.state); - this.localReducer.reduce(data, this.state); - this.s3Reducer.reduce(data, this.state); - } -} - From 70ce1d6d5fda346f8801b2e97104f3b7e2316db6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jun 2020 18:05:55 -0400 Subject: [PATCH 231/280] -test: fixed clay tests --- pkg/arvo/tests/sys/vane/clay.hoon | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index a4c627543..6ae08e19d 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -8,8 +8,8 @@ !: =, format :: -=/ test-pit=vase !>(..zuse) -=/ clay-gate (clay-raw test-pit) +=/ bud=vase !>(..zuse) +=/ clay-gate (clay-raw bud) =/ fusion fusion:clay-gate :: |% @@ -76,6 +76,7 @@ |. =/ ford %: ford:fusion + bud ankh deletes=~ changes=~ @@ -100,6 +101,7 @@ == == == =/ ford %: ford:fusion + bud ankh deletes=~ changes=(my [/gen/hello/hoon &+hoon+hello-gen]~) @@ -141,6 +143,7 @@ == == == =/ ford %: ford:fusion + bud ankh deletes=~ changes=~ From 555857513a2bff6757fbb65bb56c4c9212175bb8 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 23 Jun 2020 10:19:57 +1000 Subject: [PATCH 232/280] launch-js: update to global store --- pkg/interface/package.json | 2 ++ pkg/interface/src/apps/launch/app.js | 4 +-- .../apps/launch/components/tiles/weather.js | 2 +- pkg/interface/src/reducers/launch-update.ts | 4 +-- pkg/interface/src/store/store.ts | 2 +- pkg/interface/src/store/type.ts | 7 ++--- pkg/interface/src/types/cage.ts | 6 ++-- pkg/interface/src/types/launch-update.ts | 30 +++++++++++++++++++ pkg/interface/tsconfig.json | 1 + 9 files changed, 45 insertions(+), 13 deletions(-) diff --git a/pkg/interface/package.json b/pkg/interface/package.json index d26818432..b2be946bd 100644 --- a/pkg/interface/package.json +++ b/pkg/interface/package.json @@ -55,6 +55,8 @@ "scripts": { "lint": "eslint ./**/*.js", "lint-file": "eslint", + "tsc": "tsc", + "tsc:watch": "tsc --watch", "build:dev": "cross-env NODE_ENV=development webpack --config config/webpack.dev.js", "build:prod": "cross-env NODE_ENV=production webpack --config config/webpack.prod.js", "start": "webpack-dev-server", diff --git a/pkg/interface/src/apps/launch/app.js b/pkg/interface/src/apps/launch/app.js index daefbced5..8c22cef35 100644 --- a/pkg/interface/src/apps/launch/app.js +++ b/pkg/interface/src/apps/launch/app.js @@ -29,8 +29,8 @@ export default class LaunchApp extends React.Component {
diff --git a/pkg/interface/src/apps/launch/components/tiles/weather.js b/pkg/interface/src/apps/launch/components/tiles/weather.js index 05b54421c..2874b1e4b 100644 --- a/pkg/interface/src/apps/launch/components/tiles/weather.js +++ b/pkg/interface/src/apps/launch/components/tiles/weather.js @@ -37,7 +37,7 @@ export default class WeatherTile extends React.Component { this.setState({ latlng }, (err) => { console.log(err); }, { maximumAge: Infinity, timeout: 10000 }); - this.props.api.weather(latlng); + this.props.api.launch.weather(latlng); this.setState({ manualEntry: !this.state.manualEntry }); } else { this.setState({ error: true }); diff --git a/pkg/interface/src/reducers/launch-update.ts b/pkg/interface/src/reducers/launch-update.ts index bb9e18efb..5e74af793 100644 --- a/pkg/interface/src/reducers/launch-update.ts +++ b/pkg/interface/src/reducers/launch-update.ts @@ -3,7 +3,7 @@ import { LaunchUpdate } from '../types/launch-update'; import { Cage } from '../types/cage'; import { StoreState } from '../store/type'; -type LaunchState = Pick; +type LaunchState = Pick; export default class LaunchReducer { reduce(json: Cage, state: S) { @@ -23,7 +23,7 @@ export default class LaunchReducer { const locationData = _.get(json, 'location', false); if (locationData) { - state.location = locationData; + state.userLocation = locationData; } } diff --git a/pkg/interface/src/store/store.ts b/pkg/interface/src/store/store.ts index 4a4a0d47d..71021e80e 100644 --- a/pkg/interface/src/store/store.ts +++ b/pkg/interface/src/store/store.ts @@ -53,7 +53,7 @@ export default class GlobalStore extends BaseStore { tiles: {}, }, weather: {}, - location: '', + userLocation: null, permissions: {}, s3: { configuration: { diff --git a/pkg/interface/src/store/type.ts b/pkg/interface/src/store/type.ts index 51e8bc3e3..bd82148fe 100644 --- a/pkg/interface/src/store/type.ts +++ b/pkg/interface/src/store/type.ts @@ -9,7 +9,7 @@ import { Notebooks } from '../types/publish-update'; import { Groups } from '../types/group-update'; import { S3State } from '../types/s3-update'; import { Permissions } from '../types/permission-update'; -import { LaunchState } from '../types/launch-update'; +import { LaunchState, WeatherState } from '../types/launch-update'; import { LinkComments, LinkCollections, LinkSeen } from '../types/link-update'; export interface StoreState { @@ -30,11 +30,10 @@ export interface StoreState { // App specific states - // // launch state launch: LaunchState; - weather: any; - location: any; + weather: WeatherState | {} | null; + userLocation: string | null; // links state linksSeen: LinkSeen; diff --git a/pkg/interface/src/types/cage.ts b/pkg/interface/src/types/cage.ts index bc5e1b04b..6ff126bef 100644 --- a/pkg/interface/src/types/cage.ts +++ b/pkg/interface/src/types/cage.ts @@ -8,7 +8,7 @@ import { PublishUpdate } from './publish-update'; import { PublishResponse } from "./publish-response"; import { GroupUpdate } from "./group-update"; import { PermissionUpdate } from "./permission-update"; -import { LaunchUpdate } from "./launch-update"; +import { LaunchUpdate, WeatherState } from "./launch-update"; import { LinkListenUpdate } from './link-listen-update'; interface MarksToTypes { @@ -26,8 +26,8 @@ interface MarksToTypes { readonly "link-listen-update": LinkListenUpdate; // not really marks but w/e readonly 'local': LocalUpdate; - readonly 'weather': any; - readonly 'location': any; + readonly 'weather': WeatherState | {}; + readonly 'location': string; } export type Cage = Partial; diff --git a/pkg/interface/src/types/launch-update.ts b/pkg/interface/src/types/launch-update.ts index 59636a4ad..b8a337b5e 100644 --- a/pkg/interface/src/types/launch-update.ts +++ b/pkg/interface/src/types/launch-update.ts @@ -51,3 +51,33 @@ interface TileTypeBasic { interface TileTypeCustom { custom: null; } + +interface WeatherDay { + apparentTemperature: number; + cloudCover: number; + dewPoint: number; + humidity: number; + icon: string; + ozone: number; + precipIntensity: number; + precipProbability: number; + precipType: string; + pressure: number; + summary: string; + temperature: number; + time: number; + uvIndex: number; + visibility: number; + windBearing: number; + windGust: number; + windSpeed: number; +} + +export interface WeatherState { + currently: WeatherDay; + daily: { + data: WeatherDay[]; + icon: string; + summary: string; + } +} diff --git a/pkg/interface/tsconfig.json b/pkg/interface/tsconfig.json index 7779aa9df..5ec2a3e51 100644 --- a/pkg/interface/tsconfig.json +++ b/pkg/interface/tsconfig.json @@ -8,6 +8,7 @@ "esModuleInterop": true, "noUnusedLocals": false, "noImplicitAny": false, + "noEmit": true, "target": "es2015", "module": "es2015", "strict": true, From 292c5625e3faa20e092da3fa451f4d207ea8940e Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 23 Jun 2020 10:43:13 +1000 Subject: [PATCH 233/280] interface: always show sidebar on nav --- pkg/interface/src/apps/chat/app.tsx | 98 +++++++++++++-------------- pkg/interface/src/apps/links/app.js | 3 + pkg/interface/src/apps/publish/app.js | 5 ++ 3 files changed, 57 insertions(+), 49 deletions(-) diff --git a/pkg/interface/src/apps/chat/app.tsx b/pkg/interface/src/apps/chat/app.tsx index 5c0730fe0..371912ef6 100644 --- a/pkg/interface/src/apps/chat/app.tsx +++ b/pkg/interface/src/apps/chat/app.tsx @@ -1,20 +1,20 @@ -import React from "react"; -import { Route, Switch } from "react-router-dom"; +import React from 'react'; +import { Route, Switch } from 'react-router-dom'; -import "./css/custom.css"; +import './css/custom.css'; -import { Skeleton } from "./components/skeleton"; -import { Sidebar } from "./components/sidebar"; -import { ChatScreen } from "./components/chat"; -import { MemberScreen } from "./components/member"; -import { SettingsScreen } from "./components/settings"; -import { NewScreen } from "./components/new"; -import { JoinScreen } from "./components/join"; -import { NewDmScreen } from "./components/new-dm"; -import { PatpNoSig } from "../../types/noun"; -import GlobalApi from "../../api/global"; -import { StoreState } from "../../store/type"; -import GlobalSubscription from "../../subscription/global"; +import { Skeleton } from './components/skeleton'; +import { Sidebar } from './components/sidebar'; +import { ChatScreen } from './components/chat'; +import { MemberScreen } from './components/member'; +import { SettingsScreen } from './components/settings'; +import { NewScreen } from './components/new'; +import { JoinScreen } from './components/join'; +import { NewDmScreen } from './components/new-dm'; +import { PatpNoSig } from '../../types/noun'; +import GlobalApi from '../../api/global'; +import { StoreState } from '../../store/type'; +import GlobalSubscription from '../../subscription/global'; type ChatAppProps = StoreState & { ship: PatpNoSig; @@ -30,13 +30,15 @@ export default class ChatApp extends React.Component { } componentDidMount() { - document.title = "OS1 - Chat"; + document.title = 'OS1 - Chat'; // preload spinner asset - new Image().src = "/~landscape/img/Spinner.png"; + new Image().src = '/~landscape/img/Spinner.png'; this.props.subscription.startApp('chat'); - + if (!this.props.sidebarShown) { + this.props.api.local.sidebarToggle(); + } } componentWillUnmount() { @@ -76,8 +78,8 @@ export default class ChatApp extends React.Component { .map((e) => { return e[0]; }) - .includes(associations.chat?.[stat]?.["group-path"]) || - associations.chat?.[stat]?.["group-path"].startsWith("/~/")) + .includes(associations.chat?.[stat]?.['group-path']) || + associations.chat?.[stat]?.['group-path'].startsWith('/~/')) ) { totalUnreads += unread; } @@ -85,11 +87,10 @@ export default class ChatApp extends React.Component { if (totalUnreads !== this.totalUnreads) { document.title = - totalUnreads > 0 ? `OS1 - Chat (${totalUnreads})` : "OS1 - Chat"; + totalUnreads > 0 ? `OS1 - Chat (${totalUnreads})` : 'OS1 - Chat'; this.totalUnreads = totalUnreads; } - const { invites, s3, @@ -110,7 +111,7 @@ export default class ChatApp extends React.Component { associations={associations} selectedGroups={selectedGroups} contacts={contacts} - invites={invites["/chat"] || {}} + invites={invites['/chat'] || {}} unreads={unreads} api={api} station={station} @@ -118,7 +119,6 @@ export default class ChatApp extends React.Component { /> ); - return ( { path="/~chat/join/(~)?/:ship?/:station?" render={(props) => { let station = `/${props.match.params.ship}/${props.match.params.station}`; - const sig = props.match.url.includes("/~/"); + const sig = props.match.url.includes('/~/'); if (sig) { - station = "/~" + station; + station = '/~' + station; } return ( @@ -231,40 +231,40 @@ export default class ChatApp extends React.Component { path="/~chat/(popout)?/room/(~)?/:ship/:station+" render={(props) => { let station = `/${props.match.params.ship}/${props.match.params.station}`; - const sig = props.match.url.includes("/~/"); + const sig = props.match.url.includes('/~/'); if (sig) { - station = "/~" + station; + station = '/~' + station; } const mailbox = inbox[station] || { config: { read: 0, - length: 0, + length: 0 }, - envelopes: [], + envelopes: [] }; let roomContacts = {}; const associatedGroup = - station in associations["chat"] && - "group-path" in associations.chat[station] - ? associations.chat[station]["group-path"] - : ""; + station in associations['chat'] && + 'group-path' in associations.chat[station] + ? associations.chat[station]['group-path'] + : ''; if (associations.chat[station] && associatedGroup in contacts) { roomContacts = contacts[associatedGroup]; } const association = - station in associations["chat"] ? associations.chat[station] : {}; + station in associations['chat'] ? associations.chat[station] : {}; const permission = station in permissions ? permissions[station] : { who: new Set([]), - kind: "white", + kind: 'white' }; - const popout = props.match.url.includes("/popout/"); + const popout = props.match.url.includes('/popout/'); return ( { path="/~chat/(popout)?/members/(~)?/:ship/:station+" render={(props) => { let station = `/${props.match.params.ship}/${props.match.params.station}`; - const sig = props.match.url.includes("/~/"); + const sig = props.match.url.includes('/~/'); if (sig) { - station = "/~" + station; + station = '/~' + station; } const permission = permissions[station] || { - kind: "", - who: new Set([]), + kind: '', + who: new Set([]) }; - const popout = props.match.url.includes("/popout/"); + const popout = props.match.url.includes('/popout/'); const association = - station in associations["chat"] ? associations.chat[station] : {}; + station in associations['chat'] ? associations.chat[station] : {}; return ( { path="/~chat/(popout)?/settings/(~)?/:ship/:station+" render={(props) => { let station = `/${props.match.params.ship}/${props.match.params.station}`; - const sig = props.match.url.includes("/~/"); + const sig = props.match.url.includes('/~/'); if (sig) { - station = "/~" + station; + station = '/~' + station; } - const popout = props.match.url.includes("/popout/"); + const popout = props.match.url.includes('/popout/'); const permission = permissions[station] || { - kind: "", - who: new Set([]), + kind: '', + who: new Set([]) }; const association = - station in associations["chat"] ? associations.chat[station] : {}; + station in associations['chat'] ? associations.chat[station] : {}; return ( Date: Mon, 22 Jun 2020 21:37:17 -0400 Subject: [PATCH 234/280] gall: fix routes in +ap-yoke --- pkg/arvo/sys/vane/gall.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 52c02e2bd..f3fa530e1 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1001,7 +1001,7 @@ ~/ %ap-abed |= [dap=term =routes] ^+ ap-core - (ap-yoke dap (~(got by yokes.state) dap)) + (ap-yoke dap routes (~(got by yokes.state) dap)) :: +ap-hatch: initialize agent state from $egg, after upgrade :: ++ ap-abut @@ -1011,18 +1011,19 @@ ?: ?=(%| -.res) (mean p.res) =/ =yoke egg(old-state `agent`p.res) - (ap-yoke dap yoke) + =/ =routes [disclosing=~ attributing=our] + (ap-yoke dap routes yoke) :: +ap-yoke: initialize agent state, starting from a $yoke :: ++ ap-yoke - |= [dap=term =yoke] + |= [dap=term =routes =yoke] ^+ ap-core =. stats.yoke :+ +(change.stats.yoke) (shaz (mix (add dap change.stats.yoke) eny)) now =. agent-name dap - =. agent-routes [disclosing=~ attributing=our] + =. agent-routes routes =. current-agent yoke =. agent-duct hen ap-core From ceff9626c5cd58d641e65c22420485e671622f99 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Mon, 22 Jun 2020 22:36:39 -0400 Subject: [PATCH 235/280] publish: edit post content no longer tied to api The component for editing a post was tied up in checking for API instantiation -- we want the check for a blank body to be independent of that. Fixes #3040. --- .../apps/publish/components/lib/edit-post.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/interface/src/apps/publish/components/lib/edit-post.js b/pkg/interface/src/apps/publish/components/lib/edit-post.js index beee1727c..c46eb32cd 100644 --- a/pkg/interface/src/apps/publish/components/lib/edit-post.js +++ b/pkg/interface/src/apps/publish/components/lib/edit-post.js @@ -25,17 +25,19 @@ export class EditPost extends Component { componentDidUpdate(prevProps) { const { props, state } = this; + const contents = props.notebooks[props.ship]?.[props.book]?.notes?.[props.note]?.file; if (prevProps && prevProps.api !== props.api) { - if (!(props.notebooks[props.ship]?.[props.book]?.notes?.[props.note]?.file)) { + if (!contents) { props.api?.fetchNote(props.ship, props.book, props.note); - } else if (state.body === '') { - const notebook = props.notebooks[props.ship][props.book]; - const note = notebook.notes[props.note]; - const file = note.file; - const body = file.slice(file.indexOf(';>') + 3); - this.setState({ body: body }); } } + if (contents && state.body === '') { + const notebook = props.notebooks[props.ship][props.book]; + const note = notebook.notes[props.note]; + const file = note.file; + const body = file.slice(file.indexOf(';>') + 3); + this.setState({ body: body }); + } } postSubmit() { @@ -95,7 +97,7 @@ export class EditPost extends Component { }; return ( -
+
Date: Mon, 22 Jun 2020 22:38:21 -0400 Subject: [PATCH 236/280] groups: fix broken image upload src --- pkg/interface/src/apps/groups/components/lib/s3-upload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/interface/src/apps/groups/components/lib/s3-upload.js b/pkg/interface/src/apps/groups/components/lib/s3-upload.js index e21e0c3fa..ead7cb7e6 100644 --- a/pkg/interface/src/apps/groups/components/lib/s3-upload.js +++ b/pkg/interface/src/apps/groups/components/lib/s3-upload.js @@ -84,7 +84,7 @@ export class S3Upload extends Component { accept="image/*" onChange={this.onChange.bind(this)} /> From 5bcbfe25a414d299e20a2f6ccbd324f21b5ac213 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 24 Jun 2020 11:11:13 +1000 Subject: [PATCH 237/280] contacts-js: dismiss spinner on share --- pkg/interface/src/apps/groups/components/lib/contact-card.js | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/interface/src/apps/groups/components/lib/contact-card.js b/pkg/interface/src/apps/groups/components/lib/contact-card.js index c92877f4c..2402ea400 100644 --- a/pkg/interface/src/apps/groups/components/lib/contact-card.js +++ b/pkg/interface/src/apps/groups/components/lib/contact-card.js @@ -383,6 +383,7 @@ export class ContactCard extends Component { props.api.contacts .share(`~${props.ship}`, props.path, `~${window.ship}`, contact) .then(() => { + this.setState({ awaiting: false }); props.history.push(`/~groups/view${props.path}/${window.ship}`); }); }); From 67a09d7d19b75ac8345db93fd80bd1f5e1f5374a Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 23 Jun 2020 21:46:20 -0400 Subject: [PATCH 238/280] dbug: init new channel on start --- pkg/arvo/app/debug/index.html | 4 ++-- pkg/interface/dbug/src/index.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/debug/index.html b/pkg/arvo/app/debug/index.html index b16e317b0..eb37ada11 100644 --- a/pkg/arvo/app/debug/index.html +++ b/pkg/arvo/app/debug/index.html @@ -12,8 +12,8 @@
- - + + diff --git a/pkg/interface/dbug/src/index.js b/pkg/interface/dbug/src/index.js index 16e1127c5..26798ac2a 100644 --- a/pkg/interface/dbug/src/index.js +++ b/pkg/interface/dbug/src/index.js @@ -9,6 +9,7 @@ api.setAuthTokens({ ship: window.ship }); +window.urb = new window.channel(); subscription.start(); ReactDOM.render(( From fc42bf603962890a347161990e1dd785fa705ab0 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 24 Jun 2020 20:26:04 -0700 Subject: [PATCH 239/280] clay: special-case +run-pact for %hoon --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/clay.hoon | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index fb6e1ff72..3ada6c01d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1063ab985b86314e4977d2d89932ac295cfbdabd4d38e5444f11d6e3a4724907 -size 16796647 +oid sha256:f41c00b072d8b4a8e18908b038f65602e698b92d02846f44d463c4f3d425680c +size 7313574 diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 9aab66223..6aa8c6eb5 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -716,6 +716,11 @@ ++ run-pact |= [old=page diff=page] ^- [cage state] + ?: ?=(%hoon p.old) + =/ txt=wain (to-wain:format ;;(@t q.old)) + =+ ;;(dif=(urge cord) q.diff) + =/ new=@t (of-wain:format (lurk:differ txt dif)) + :_(nub [%hoon !>(new)]) =^ dys=dais nub (get-mark p.old) =^ syd=dais nub (get-mark p.diff) :_(nub [p.old (~(pact dys (vale:dys q.old)) (vale:syd q.diff))]) From 3a662881be132c83bca29bc1f3c3a1372aed1f80 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 24 Jun 2020 21:13:31 -0700 Subject: [PATCH 240/280] clay: don't be evil --- pkg/arvo/sys/vane/clay.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 6aa8c6eb5..149c9cb89 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -3533,7 +3533,7 @@ |= {yon/aeon pax/path} ^- (unit (unit {$dome (hypo dome:clay)})) ?: (lth yon let.dom) - :* ~ ~ %dome -:!>(%dome) + :* ~ ~ %dome -:!>(*dome:clay) ^- dome:clay :* ank=`[[%ank-in-old-v-not-implemented *ankh] ~ ~] let=yon From 7044f1fae6c0a199cd4ba46ef8d7cb02bcd72be3 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 24 Jun 2020 21:13:53 -0700 Subject: [PATCH 241/280] dojo: too many nouns --- pkg/arvo/app/dojo.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 84ed2247f..524c0886c 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -681,7 +681,7 @@ :: ?. &(?=({* ~} p.cig) ?=(~ q.cig)) ~|(%one-argument !!) - =/ res (mule |.((slop !>(%noun) (slam q.cay (dy-vase p.i.p.cig))))) + =/ res (mule |.((slam q.cay (dy-vase p.i.p.cig)))) ?: ?=(%| -.res) (he-diff(poy ~) %tan p.res) :: TODO: or +dy-rash ? (dy-hand %noun p.res) From 51c6faaa3102fd43a2fb0cd936a8d7c7482bf40a Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 24 Jun 2020 21:19:46 -0700 Subject: [PATCH 242/280] ford,kiln: nicer errors --- pkg/arvo/lib/hood/kiln.hoon | 2 +- pkg/arvo/sys/vane/ford.hoon | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 466312264..28c9e8f1f 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -443,7 +443,7 @@ ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) [%ota *] abet:(take:update t.wire sign-arvo) * - ?+ +<.sign-arvo ~|([%kiln-bad-take-card +<.sign-arvo] !!) + ?+ +<.sign-arvo ~|([%kiln-bad-take-card +<.sign-arvo wire] !!) %done %+ done wire ?>(?=(%done +<.sign-arvo) +>.sign-arvo) %mere %+ take-mere wire diff --git a/pkg/arvo/sys/vane/ford.hoon b/pkg/arvo/sys/vane/ford.hoon index 6a1d6c4e2..65567bff2 100644 --- a/pkg/arvo/sys/vane/ford.hoon +++ b/pkg/arvo/sys/vane/ford.hoon @@ -2,8 +2,8 @@ |= pit=vase |= [our=ship now=@da eny=@uvJ ski=sley] |% -++ call |=(* ~&(%ford-call-gone `..^$)) -++ take |=(* ~&(%ford-take-gone `..^$)) +++ call |=(* ((slog leaf+"ford: gone (+call)" ~) `..^$)) +++ take |=(* ((slog leaf+"ford: gone (+take)" ~) `..^$)) ++ scry |=(* ``mass+!>(*(list mass))) ++ stay ~ ++ load |=(* ..^$) From 82cfc691ce9a7883e7b030ed19572f87acc7947d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jun 2020 02:14:16 -0400 Subject: [PATCH 243/280] ci: fix herb tests; update pills --- bin/brass.pill | 4 +-- bin/ivory.pill | 4 +-- bin/solid.pill | 4 +-- nix/ops/test/builder.sh | 65 +++++++++++++++++++++++------------------ pkg/herb/herb | 10 +++++-- 5 files changed, 51 insertions(+), 36 deletions(-) diff --git a/bin/brass.pill b/bin/brass.pill index 72a256ae6..cc8c83ed8 100644 --- a/bin/brass.pill +++ b/bin/brass.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:29a948ebcf5d82577b3d1271cb8d0c6cf1fa8b63a324ad2ef43e73ad5dcfe62c -size 4846052 +oid sha256:f738f60e9e028081864f317106f623d2f21a5fe5c2f6fdd83576e22d21a8c6a6 +size 14862847 diff --git a/bin/ivory.pill b/bin/ivory.pill index 3bdc23eab..829304a93 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c9cec5d3dd639a82b1b867375225e6becb9f234338ef0a4cb2626ae72ba8944 -size 1265620 +oid sha256:9fbfbe75a6685df444621ebd27677716fd0abf7113020f3274c3b5c209e3616e +size 1304972 diff --git a/bin/solid.pill b/bin/solid.pill index 3ada6c01d..5153fcaa6 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f41c00b072d8b4a8e18908b038f65602e698b92d02846f44d463c4f3d425680c -size 7313574 +oid sha256:931d45c23b409ddab979c8e42ad3e105e1aed13a3e02d58b6c29f283f6e81422 +size 16653347 diff --git a/nix/ops/test/builder.sh b/nix/ops/test/builder.sh index 4a852ab3f..68f03fa8e 100644 --- a/nix/ops/test/builder.sh +++ b/nix/ops/test/builder.sh @@ -22,50 +22,59 @@ trap shutdown EXIT herb ./ship -p hood -d '+hood/mass' -# Start the test app +# Run the unit tests and then print scrollback +herb ./ship -d '~& ~ ~& %test-unit-start ~' +herb ./ship -d '####-test /' +herb ./ship -d '~& ~ ~& %test-unit-end ~' + +# Start and run the test app herb ./ship -p hood -d '+hood/start %test' -# Run the %cores tests -herb ./ship -d '~& ~ ~& %start-test-cores ~' -herb ./ship -p test -d ':- %cores /' -herb ./ship -d '~& %finish-test-cores ~' +herb ./ship -d '~& ~ ~& %test-agents-start ~' +herb ./ship -p test -d '%agents' +herb ./ship -d '~& ~ ~& %test-agents-end ~' +herb ./ship -d '~& ~ ~& %test-generators-start ~' +herb ./ship -p test -d '%generators' +herb ./ship -d '~& ~ ~& %test-generators-end ~' + +herb ./ship -d '~& ~ ~& %test-marks-start ~' +herb ./ship -p test -d '%marks' +herb ./ship -d '~& ~ ~& %test-marks-end ~' + +# compact the loom, comparing memory use before and after herb ./ship -p hood -d '+hood/mass' -# Run the %renders tests -herb ./ship -d '~& ~ ~& %start-test-renders ~' -herb ./ship -p test -d ':- %renders /' -herb ./ship -d '~& %finish-test-renders ~' - -# Run the test generator -herb ./ship -d '+test, =seed `@uvI`(shaz %reproducible)' > test-generator-output - -cat test-generator-output || true - -herb ./ship -p hood -d '+hood/mass' - -herb ./ship -d '~& ~ ~& %start-pack ~' +herb ./ship -d '~& ~ ~& %pack-start ~' herb ./ship -p hood -d '+hood/pack' -herb ./ship -d '~& ~ ~& %finish-pack ~' +herb ./ship -d '~& ~ ~& %pack-end ~' + +herb ./ship -p hood -d '+hood/mass' shutdown # Collect output -cp urbit-output test-cores-output -cp urbit-output test-renders-output +cp urbit-output test-output-unit +cp urbit-output test-output-agents +cp urbit-output test-output-generators +cp urbit-output test-output-marks rm urbit-output -sed -i '0,/start-test-renders/d' test-renders-output -sed -i '/finish-test-renders/,$d' test-renders-output +sed -i '0,/test-unit-start/d' test-output-unit +sed -i '/test-unit-end/,$d' test-output-unit -sed -i '0,/start-test-cores/d' test-cores-output -sed -i '/finish-test-cores/,$d' test-cores-output +sed -i '0,/test-agents-start/d' test-output-agents +sed -i '/test-agents-end/,$d' test-output-agents + +sed -i '0,/test-generators-start/d' test-output-generators +sed -i '/test-generators-end/,$d' test-output-generators + +sed -i '0,/test-marks-start/d' test-output-marks +sed -i '/test-marks-end/,$d' test-output-marks mkdir $out -cp test-renders-output $out/renders -cp test-cores-output $out/cores -cp test-generator-output $out/generator +cp -r test-output-* $out/ set +x diff --git a/pkg/herb/herb b/pkg/herb/herb index 30f6834bd..633e7c5a9 100755 --- a/pkg/herb/herb +++ b/pkg/herb/herb @@ -13,7 +13,7 @@ import argparse import base64 logging.basicConfig( - level=logging.WARNING, + level=logging.DEBUG, format='%(levelname)s %(funcName)s %(lineno)s - %(message)s', stream=sys.stderr, ) @@ -55,7 +55,8 @@ def preprocess_args(old_args): return ['--close'] + preprocess_args(old_args[1:]) return [old_args[0]] + preprocess_args(old_args[1:]) -args = preprocess_args(sys.argv[1:]) +#args = preprocess_args(sys.argv[1:]) +args = sys.argv[1:] logging.debug(['preprocessed', args]) @@ -76,6 +77,7 @@ class sourceAction(argparse.Action): def __init__(self, option_strings, dest, **kwargs): self.which = kwargs['which'] del kwargs['which'] + logging.debug('args %s %s %s' % (option_strings, dest, kwargs)) super(sourceAction, self).__init__(option_strings, dest, **kwargs) def __call__(self, parser, res, new_value, option_string): @@ -104,6 +106,10 @@ class sourceAction(argparse.Action): logging.debug(res.source) def construct_value(self, new_value): + # hack to allow dojo commands like '-test' without them parsing + # as bash command-line arguments + if new_value[0:4] == '####': + return self.construct_value(new_value[4:]) if new_value == '-': return self.construct_value(''.join(sys.stdin.readlines())) elif new_value[0:2] == '@@': From 1216510fdb8a7d4ea179cc8de43f2b025344b2b8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jun 2020 03:25:31 -0400 Subject: [PATCH 244/280] Squashed commit of the following: commit 8f6aee0fdb29bbe4049f99c6d79b25f9e5fca303 Author: Ted Blackman Date: Thu Jun 25 03:13:19 2020 -0400 ci: revert debugging artifacts commit e13a7fc050fd3e87cf9ae449d7fd4f14558b8092 Author: Ted Blackman Date: Thu Jun 25 02:48:55 2020 -0400 ci: try @joemfb's one weird trick --- .travis.yml | 1 + pkg/herb/herb | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6fbfc591e..0a575fc1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ jobs: nix: 2.3.6 before_install: - git lfs pull + - echo "trusted-users = root travis" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon install: - nix-env -iA cachix -f https://cachix.org/api/v1/install script: diff --git a/pkg/herb/herb b/pkg/herb/herb index 633e7c5a9..315992f01 100755 --- a/pkg/herb/herb +++ b/pkg/herb/herb @@ -13,7 +13,7 @@ import argparse import base64 logging.basicConfig( - level=logging.DEBUG, + level=logging.WARNING, format='%(levelname)s %(funcName)s %(lineno)s - %(message)s', stream=sys.stderr, ) @@ -55,8 +55,7 @@ def preprocess_args(old_args): return ['--close'] + preprocess_args(old_args[1:]) return [old_args[0]] + preprocess_args(old_args[1:]) -#args = preprocess_args(sys.argv[1:]) -args = sys.argv[1:] +args = preprocess_args(sys.argv[1:]) logging.debug(['preprocessed', args]) From 68802ea0416d4aab258e8abef6df33dd664f1b48 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jun 2020 15:38:15 -0400 Subject: [PATCH 245/280] dojo: print generator type errors --- pkg/arvo/app/dojo.hoon | 60 ++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 524c0886c..3a56309f4 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -705,31 +705,45 @@ %ask (dy-made-dial %noun p.res) %say (dy-made-gent %noun p.res) == + :: gat: generator gate + :: som: default gat sample + :: ven: event arguments + :: poz: positional arguments + :: kev: key-value named arguments + :: kuv: default keyword arguments + :: sam: fully populated sample + :: rog: default gat sample + :: |. ^- vase =/ gat=vase (slot 3 q.cay) - %+ slam gat - %+ slop !>([now=now.hid eny=eny.hid bec=he-beak]) - %+ slop (dy-sore p.cig) - ^- vase - =/ sam (slew 27 gat) :: |2.+< - ?: =(~ q.cig) - (fall sam !>(~)) - =/ soz=(list [var=term vax=vase]) - %+ turn ~(tap by q.cig) - |= [var=term val=(unit dojo-source)] - ^- [term vase] - :- var - ?~ val - !>([~ ~]) - (dy-vase p.u.val) - ~| keyword-arg-failure+~(key by q.cig) - %+ slap - (with-faces sam+(need sam) rep+(with-faces soz) ~) - :+ %cncb [%sam]~ - %+ turn soz - |= [var=term *] - ^- [wing hoon] - [[var]~ [%wing var %rep ~]] + =/ som=vase (slot 6 gat) + =/ ven=vase !>([now=now.hid eny=eny.hid bec=he-beak]) + =/ poz=vase (dy-sore p.cig) + =/ kev=vase + =/ kuv=(unit vase) (slew 7 som) + ?: =(~ q.cig) + (fall kuv !>(~)) + =/ soz=(list [var=term vax=vase]) + %~ tap by + %- ~(run by q.cig) + |=(val=(unit dojo-source) ?~(val !>([~ ~]) (dy-vase p.u.val))) + ~| keyword-arg-failure+~(key by q.cig) + %+ slap + (with-faces kuv+(need kuv) rep+(with-faces soz) ~) + :+ %cncb [%kuv]~ + %+ turn soz + |= [var=term *] + ^- [wing hoon] + [[var]~ [%wing var %rep ~]] + :: + =/ sam=vase :(slop ven poz kev) + ?. (~(nest ut p.som) | p.sam) + ~> %slog.1^leaf+"dojo: nest-need" + ~> %slog.0^(skol p.som) + ~> %slog.1^leaf+"dojo: nest-have" + ~> %slog.0^(skol p.sam) + !! + (slam gat sam) :: ++ dy-made-dial :: dialog product |= cag/cage From 48ae088bbdf28d3ce450f3da595826ea0d31b587 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 19 Jun 2020 19:17:01 +1000 Subject: [PATCH 246/280] links-js: calculate header unread count correctly --- pkg/interface/src/apps/links/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/interface/src/apps/links/app.js b/pkg/interface/src/apps/links/app.js index 6703f9d76..5ce2b5cce 100644 --- a/pkg/interface/src/apps/links/app.js +++ b/pkg/interface/src/apps/links/app.js @@ -55,8 +55,8 @@ export class LinksApp extends Component { const seen = props.linksSeen ? props.linksSeen : {}; const totalUnseen = _.reduce( - seen, - (acc, links) => acc + _.reduce(links, (total, hasSeen) => total + (hasSeen ? 0 : 1), 0), + links, + (acc, collection) => acc + collection.unseenCount, 0 ); From 9aa4d96fb5c32a246434b7cfe2b97952db944b82 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 19 Jun 2020 19:22:44 +1000 Subject: [PATCH 247/280] chat: refine image scaling --- pkg/interface/src/apps/chat/components/lib/message.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/interface/src/apps/chat/components/lib/message.js b/pkg/interface/src/apps/chat/components/lib/message.js index ce1d4bd89..ead51131f 100644 --- a/pkg/interface/src/apps/chat/components/lib/message.js +++ b/pkg/interface/src/apps/chat/components/lib/message.js @@ -88,7 +88,8 @@ export class Message extends Component { src={letter.url} style={{ height: 'min(250px, 20vh)', - maxWidth: '80vw' + maxWidth: 'calc(100% - 36px - 1.5rem)', + objectFit: 'contain' }} > ); From f27037d2de16b13020157bf89d15a6f35fe41789 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sat, 20 Jun 2020 02:54:37 +1000 Subject: [PATCH 248/280] links: filter unread count on selected groups --- pkg/interface/src/apps/links/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/interface/src/apps/links/app.js b/pkg/interface/src/apps/links/app.js index 5ce2b5cce..ed9e1dba1 100644 --- a/pkg/interface/src/apps/links/app.js +++ b/pkg/interface/src/apps/links/app.js @@ -54,9 +54,18 @@ export class LinksApp extends Component { const seen = props.linksSeen ? props.linksSeen : {}; + const selectedGroups = props.selectedGroups ? props.selectedGroups : []; + + const selGroupPaths = selectedGroups.map(g => g[0]); const totalUnseen = _.reduce( links, - (acc, collection) => acc + collection.unseenCount, + (acc, collection, path) => { + if(selGroupPaths.length > 0 + && !selGroupPaths.includes(associations.link?.[path]?.['group-path'])) { + return acc; + } + return acc + collection.unseenCount; + }, 0 ); @@ -68,7 +77,6 @@ export class LinksApp extends Component { const invites = props.invites ? props.invites : {}; - const selectedGroups = props.selectedGroups ? props.selectedGroups : []; const listening = props.linkListening; From d9b00b086910dd261182bb6085ea4c0d1ba27741 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jun 2020 22:07:40 -0400 Subject: [PATCH 249/280] pill: solid --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 5153fcaa6..4bd61c83b 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:931d45c23b409ddab979c8e42ad3e105e1aed13a3e02d58b6c29f283f6e81422 -size 16653347 +oid sha256:e56c9761cd1d5a4a37dd8168d38fbd53b0a904c0cd208ff0fc84f009dbb3b92e +size 16655606 From ef138bb007fea466f9570e564b32a61c95587354 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jun 2020 22:54:37 -0400 Subject: [PATCH 250/280] ames: use +cut in +encrypt --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/ames.hoon | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e3904db4b..f608c8ca1 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f979e590824c3b7776214fe9e9c26da8ff15d342ec1d9bccd3b781c9a034184 -size 16663090 +oid sha256:0b727bafa4d479d0cb6df411b7f414132a2c1d05fd415ec4d606cb43747dfc58 +size 16662916 diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index f6fdcc964..acfe13b8b 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3004,16 +3004,13 @@ |= [=symmetric-key plaintext=shut-packet] ^- @ :: - =. meat.plaintext - ?. ?& ?=(%& -.meat.plaintext) - (gth (met 13 fragment.p.meat.plaintext) 1) - == - meat.plaintext - %= meat.plaintext + =? meat.plaintext + ?& ?=(%& -.meat.plaintext) + (gth (met 13 fragment.p.meat.plaintext) 1) + == + %_ meat.plaintext fragment.p - %^ end 13 1 - %^ rsh 13 fragment-num.p.meat.plaintext - fragment.p.meat.plaintext + (cut 13 [[fragment-num 1] fragment]:p.meat.plaintext) == (en:crub:crypto symmetric-key (jam plaintext)) :: +decrypt: decrypt packet content to a $shut-packet or die From 77df80d60398b92e6a4f20344496207310cfe169 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 26 Jun 2020 09:20:17 -0700 Subject: [PATCH 251/280] gall: don't make large stack trace --- pkg/arvo/sys/vane/gall.hoon | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index f3fa530e1..451d2e5ee 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1388,7 +1388,6 @@ leaf+"{}: got ack for nonexistent subscription" leaf+"{}: {}" >wire=wire< - >out=outbound.watches.current-agent< ~ == ap-core From 42de99902408bf6053f36a3c8ac7c32080ee2416 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Fri, 26 Jun 2020 19:21:09 -0700 Subject: [PATCH 252/280] kiln: don't implicitly create syncs Also silence some spurious errors. --- bin/solid.pill | 4 ++-- pkg/arvo/lib/hood/kiln.hoon | 14 ++++++++++++-- pkg/arvo/sys/vane/clay.hoon | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index f608c8ca1..dbd85a26f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b727bafa4d479d0cb6df411b7f414132a2c1d05fd415ec4d606cb43747dfc58 -size 16662916 +oid sha256:9210b8244f5cd76654c3e8546f77dfa88a500e14ba0e593ededef318fd9d0f32 +size 16948743 diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 28c9e8f1f..6a0cbd955 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -329,7 +329,10 @@ ++ poke-syncs :: print sync config |= ~ =< abet %- spam - :- [%leaf "OTAs from {}"] + :- :- %leaf + ?~ ota + "OTAs disabled" + "OTAs from {} on {}" ?: =(0 ~(wyt by syn)) [%leaf "no syncs configured"]~ %+ turn ~(tap in ~(key by syn)) @@ -443,7 +446,8 @@ ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) [%ota *] abet:(take:update t.wire sign-arvo) * - ?+ +<.sign-arvo ~|([%kiln-bad-take-card +<.sign-arvo wire] !!) + ?+ +<.sign-arvo + ((slog leaf+"kiln: strange card {<+<.sign-arvo wire>}" ~) abet) %done %+ done wire ?>(?=(%done +<.sign-arvo) +>.sign-arvo) %mere %+ take-mere wire @@ -472,6 +476,8 @@ her=(slav %p i.t.way) sud=(slav %tas i.t.t.way) == + ?. (~(has by syn) hos) + abet abet:abet:(mere:(auto hos) mes) :: ++ take-writ-find-ship :: @@ -482,6 +488,8 @@ her=(slav %p i.t.way) sud=(slav %tas i.t.t.way) == + ?. (~(has by syn) hos) + abet abet:abet:(take-find-ship:(auto hos) rot) :: ++ take-writ-sync :: @@ -492,6 +500,8 @@ her=(slav %p i.t.way) sud=(slav %tas i.t.t.way) == + ?. (~(has by syn) hos) + abet abet:abet:(writ:(auto hos) rot) :: ++ take-wake-autocommit diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 149c9cb89..50127e914 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -4365,7 +4365,9 @@ :: %boon !! %lost !! - %writ !! + %writ + %- (slog leaf+"clay: strange writ (expected on upgrade to Fusion)" ~) + [~ ..^$] :: %done ?~ error=error.q.hin From 7266b3f5c3ddde60b15427a8aa35e0fe97bfae18 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jun 2020 00:59:02 -0400 Subject: [PATCH 253/280] hoon: re-fix +slab; /tests: fix clay tests --- pkg/arvo/sys/hoon.hoon | 4 ++-- pkg/arvo/tests/sys/vane/clay.hoon | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 2a288cb22..824b3a2cd 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -12024,8 +12024,8 @@ :: ++ slab :: test if contains |= [way=?(%read %rite %both) cog=@tas typ=type] - ?= [%| *] - (~(find ut typ) way ~[cog]) + ?= [%& *] + (~(fond ut typ) way ~[cog]) :: ++ slap |= {vax/vase gen/hoon} ^- vase :: untyped vase .* diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 6ae08e19d..76b0f43de 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -153,7 +153,7 @@ =/ [res=vase nub=state:ford:fusion] (build-file:ford /lib/strandio/hoon) ;: weld %- expect - !>((slab %get-our -.res)) + !>((slab %read %get-our -.res)) :: %+ expect-eq !> %- ~(gas in *(set path)) From f6171042aeb708b09ddd5446a60716d58b225997 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jun 2020 01:13:42 -0400 Subject: [PATCH 254/280] arvo: use date instead of kelvin --- bin/solid.pill | 4 ++-- pkg/arvo/sys/arvo.hoon | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index dbd85a26f..a400e5b06 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9210b8244f5cd76654c3e8546f77dfa88a500e14ba0e593ededef318fd9d0f32 -size 16948743 +oid sha256:19d6cb7e5a323590455d641161b911190b3dcd1a0f601bef1304b6b340fa0dc9 +size 16662878 diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index a24f1d412..f9b34e976 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -1050,14 +1050,14 @@ :: +dram: upgrade $pram, compatible :: +$ pram - $~ [%345 nub=*debt:le:part] - $% [%345 nub=debt:le:part] + $~ [%~2020.6.28 nub=*debt:le:part] + $% [%~2020.6.28 nub=debt:le:part] (list ovum) == ++ dram |= ram=pram ^- pram - ?: ?=([%345 *] ram) + ?: ?=([%~2020.6.28 *] ram) ram ~| ram+ram =| nub=debt:le:part @@ -1067,7 +1067,7 @@ |= ovo=ovum ^- move [[p.ovo]~ %give %& %noun q.ovo] - [%345 nub(run [plan]~)] + [%~2020.6.28 nub(run [plan]~)] :: $prim: old $pram :: +drum: upgrade $prim to $pram, incompatible :: @@ -1094,7 +1094,7 @@ vanes (turn nyf |=({a/@tas b/vise} [a [b *worm]])) == =. ram (dram ram) - ?> ?=([%345 *] ram) + ?> ?=([%~2020.6.28 *] ram) =/ run plot:(spam:(lead now ~) [//arvo %vega ~]) (leap now (then:(lead now `nub.ram) run)) :: +peek: external inspect @@ -1323,7 +1323,7 @@ :* our now eny - 345+nub + [%~2020.6.28 nub] bud (turn vanes |=([label=@tas =vane] [label vase.vane])) == From d7b9889b4ad3d5ff337744fc30d01c0a9f3fb54a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jun 2020 05:06:16 -0400 Subject: [PATCH 255/280] -test: support other desks (full beams in args) --- nix/ops/test/builder.sh | 2 +- pkg/arvo/ted/test.hoon | 43 ++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/nix/ops/test/builder.sh b/nix/ops/test/builder.sh index 68f03fa8e..2746797ab 100644 --- a/nix/ops/test/builder.sh +++ b/nix/ops/test/builder.sh @@ -24,7 +24,7 @@ herb ./ship -p hood -d '+hood/mass' # Run the unit tests and then print scrollback herb ./ship -d '~& ~ ~& %test-unit-start ~' -herb ./ship -d '####-test /' +herb ./ship -d '####-test %/tests' herb ./ship -d '~& ~ ~& %test-unit-end ~' # Start and run the test app diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index 1c1563b22..d9f428ea7 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -73,43 +73,42 @@ =((end 3 5 a) 'test-') :: ++ find-test-files - =| fiz=(set [=spur test=(unit term)]) + =| fiz=(set [=beam test=(unit term)]) =/ m (strand ,_fiz) - |= [bek=beak paz=(list path)] + |= bez=(list beam) ^- form:m =* loop $ - ?~ paz + ?~ bez (pure:m fiz) - =/ xap=path (flop i.paz) - ;< hav=? bind:m (check-for-file:strandio bek hoon+xap) + ;< hav=? bind:m (check-for-file:strandio -.i.bez hoon+s.i.bez) ?: hav - loop(paz t.paz, fiz (~(put in fiz) [hoon+xap ~])) - ;< fez=(list path) bind:m (list-tree:strandio bek xap) + loop(bez t.bez, fiz (~(put in fiz) [i.bez(s hoon+s.i.bez) ~])) + ;< fez=(list path) bind:m (list-tree:strandio i.bez) ?. =(~ fez) - =/ foz (turn fez |=(path [(flop +<) ~])) - loop(paz t.paz, fiz (~(gas in fiz) foz)) - ~| bad-test-path+i.paz - =/ tex=term =-(?>(((sane %tas) -) -) (head xap)) - =/ xup=path (tail xap) - ;< hov=? bind:m (check-for-file:strandio bek hoon+xup) + =/ foz (turn fez |=(path [[-.i.bez (flop +<)] ~])) + loop(bez t.bez, fiz (~(gas in fiz) foz)) + ~| bad-test-beam+i.bez + =/ tex=term =-(?>(((sane %tas) -) -) (head s.i.bez)) + =/ xup=path (tail s.i.bez) + ;< hov=? bind:m (check-for-file:strandio i.bez(s hoon+xup)) ?. hov - ~|(no-tests-at-path+paz !!) - loop(paz t.paz, fiz (~(put in fiz) [hoon+xup `tex])) + ~|(no-tests-at-path+i.bez !!) + loop(bez t.bez, fiz (~(put in fiz) [[-.i.bez hoon+xup] `tex])) -- ^- thread:spider |= arg=vase =/ m (strand ,vase) ^- form:m -=/ paz=(list path) (turn !<((list path) arg) |=(path [%tests +<])) -;< bek=beak bind:m get-beak:strandio -;< fiz=(set [=spur test=(unit term)]) bind:m (find-test-files bek paz) -=> .(fiz ~(tap in fiz)) +=/ bez=(list beam) + (turn !<((list path) arg) |=(p=path (need (de-beam:format p)))) +;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez) +=> .(fiz (sort ~(tap in fiz) aor)) =| test-arms=(map path (list test-arm)) |- ^- form:m =* gather-tests $ ?^ fiz - ~> %slog.0^leaf+"test: building {(spud (flop spur.i.fiz))}" - ;< cor=vase bind:m (build-file:strandio bek spur.i.fiz) + ~> %slog.0^leaf+"test: building {(spud (flop s.beam.i.fiz))}" + ;< cor=vase bind:m (build-file:strandio beam.i.fiz) =/ arms=(list test-arm) (get-test-arms cor) =? arms ?=(^ test.i.fiz) |- ^+ arms @@ -117,7 +116,7 @@ ?: =(name.i.arms u.test.i.fiz) [i.arms]~ $(arms t.arms) - =. test-arms (~(put by test-arms) (flop (tail spur.i.fiz)) arms) + =. test-arms (~(put by test-arms) (flop (tail s.beam.i.fiz)) arms) gather-tests(fiz t.fiz) %- pure:m !> ^= ok %+ roll (resolve-test-paths test-arms) From 3b8790cc04fa5ef35dba8a53c564c4cae68fbb42 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Fri, 26 Jun 2020 15:51:55 -0400 Subject: [PATCH 256/280] chat-store: responded to comments, cleaned up --- pkg/arvo/app/chat-store.hoon | 85 +++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index 26c3fdf8d..0466d98f7 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -5,22 +5,20 @@ |% +$ card card:agent:gall +$ versioned-state - $% state-zero - state-one - state-two - state-three + $% state-0 + state-1 + state-2 == :: -+$ state-zero [%0 =inbox:store] -+$ state-one [%1 =inbox:store] -+$ state-two [%2 =inbox:store] -+$ state-three [%3 =inbox:store] ++$ state-0 [%0 =inbox:store] ++$ state-1 [%1 =inbox:store] ++$ state-2 [%2 =inbox:store] +$ admin-action $% [%trim ~] == -- :: -=| state-three +=| state-2 =* state - :: %- agent:dbug @@ -38,19 +36,25 @@ ++ on-save !>(state) ++ on-load |= old-vase=vase + ^- (quip card _this) + |^ =/ old !<(versioned-state old-vase) - ?: ?=(%3 -.old) - [~ this(state old)] - ?: ?=(%2 -.old) - :_ this(state [%3 inbox.old]) - [%pass /trim %agent [our.bowl %chat-store] %poke %noun !>([%trim ~])]~ - =/ reversed-inbox=inbox:store - %- ~(run by inbox.old) + =? old ?=(%0 -.old) + (old-to-2 inbox.old) + =? old ?=(%1 -.old) + (old-to-2 inbox.old) + :_ this(state [%2 inbox.old]) + [%pass /trim %agent [our.bowl %chat-store] %poke %noun !>([%trim ~])]~ + :: + ++ old-to-2 + |= =inbox:store + ^- state-2 + :- %2 + %- ~(run by inbox) |= =mailbox:store ^- mailbox:store [config.mailbox (flop envelopes.mailbox)] - :_ this(state [%3 reversed-inbox]) - [%pass /trim %agent [our.bowl %chat-store] %poke %noun !>([%trim ~])]~ + -- :: ++ on-poke ~/ %chat-store-poke @@ -61,7 +65,7 @@ ?+ mark (on-poke:def mark vase) %json (poke-json:cc !<(json vase)) %chat-action (poke-chat-action:cc !<(action:store vase)) - %noun (poke-noun:cc !<(admin-action vase)) + %noun [~ (poke-noun:cc !<(admin-action vase))] == [cards this] :: @@ -160,28 +164,29 @@ :: ++ poke-noun |= nou=admin-action - ^- (quip card _state) + ^- _state ~& %trimming-chat-store - :- ~ - :- %3 - %- ~(urn by inbox) - |= [=path mailbox:store] - ^- mailbox:store - =/ [a=* out=(list envelope:store)] - %+ roll envelopes - |= $: =envelope:store - o=[[hav=(set serial:store) curr=@] out=(list envelope:store)] - == - ?: (~(has in hav.o) uid.envelope) - [[hav.o curr.o] out.o] - :- - ^- [(set serial:store) @] - [(~(put in hav.o) uid.envelope) +(curr.o)] - ^- (list envelope:store) - [envelope(number curr.o) out.o] - =/ len (lent out) - ~& [path [%old (lent envelopes)] [%new len]] - [[len len] (flop out)] + %_ state + inbox + %- ~(urn by inbox) + |= [=path mailbox:store] + ^- mailbox:store + =/ [a=* out=(list envelope:store)] + %+ roll envelopes + |= $: =envelope:store + o=[[hav=(set serial:store) curr=@] out=(list envelope:store)] + == + ?: (~(has in hav.o) uid.envelope) + [[hav.o curr.o] out.o] + :- + ^- [(set serial:store) @] + [(~(put in hav.o) uid.envelope) +(curr.o)] + ^- (list envelope:store) + [envelope(number curr.o) out.o] + =/ len (lent out) + ~& [path [%old (lent envelopes)] [%new len]] + [[len len] (flop out)] + == :: ++ poke-json |= jon=json From 043b8a4cc0bb64167d8ce5d31f796baf78a70444 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jun 2020 02:43:52 -0400 Subject: [PATCH 257/280] goad: don't crash on pre-OTA sign --- pkg/arvo/app/goad.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/app/goad.hoon b/pkg/arvo/app/goad.hoon index 1f55f7b01..5e34f2151 100644 --- a/pkg/arvo/app/goad.hoon +++ b/pkg/arvo/app/goad.hoon @@ -24,6 +24,7 @@ |= [wir=wire sin=sign-arvo] ?+ wir (on-arvo:def wir sin) [%clay ~] `this + [%behn ~] `this :: backcompat == :: ++ on-agent on-agent:def From 29a62346331647e466d5d1f792fd871db4a71b06 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jun 2020 05:15:25 -0400 Subject: [PATCH 258/280] invite-view: reinstate as potato --- pkg/arvo/app/invite-view.hoon | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pkg/arvo/app/invite-view.hoon diff --git a/pkg/arvo/app/invite-view.hoon b/pkg/arvo/app/invite-view.hoon new file mode 100644 index 000000000..666ed5473 --- /dev/null +++ b/pkg/arvo/app/invite-view.hoon @@ -0,0 +1,17 @@ +/+ default-agent +^- agent:gall +|_ =bowl:gall ++* this . + def ~(. (default-agent this %|) bowl) + step `step:agent:gall`[~ this] +++ on-init on-init:def +++ on-save on-save:def +++ on-load on-load:def +++ on-poke |=(* step) +++ on-watch on-watch:def +++ on-leave |=(* step) +++ on-peek |=(* ~) +++ on-agent |=(* step) +++ on-arvo |=(* step) +++ on-fail on-fail:def +-- From 7611c2fc0801b119979a9c210f718f870a857fcd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jun 2020 05:26:41 -0400 Subject: [PATCH 259/280] landscape/img/codeeval.png: typo in filename --- .../app/landscape/img/{codeval.png => codeeval.png} | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename pkg/arvo/app/landscape/img/{codeval.png => codeeval.png} (100%) diff --git a/pkg/arvo/app/landscape/img/codeval.png b/pkg/arvo/app/landscape/img/codeeval.png similarity index 100% rename from pkg/arvo/app/landscape/img/codeval.png rename to pkg/arvo/app/landscape/img/codeeval.png From ede710582046ccc07316072525993e4ce105ac8e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jun 2020 11:01:23 -0400 Subject: [PATCH 260/280] clay: flop syntax error trace --- pkg/arvo/sys/vane/clay.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 50127e914..20b62773c 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -771,7 +771,7 @@ ^- pile =/ [=hair res=(unit [=pile =nail])] ((pile-rule pax) [1 1] tex) ?^ res pile.u.res - %- mean + %- mean %- flop =/ lyn p.hair =/ col q.hair :~ leaf+"syntax error at [{} {}] in {}" From a958cb9288bc7a01322e60644aac0455eb31b9e7 Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Sun, 28 Jun 2020 21:12:46 -0600 Subject: [PATCH 261/280] metadata-store: add cleanup utility, use on-poke:def instead of no-op --- pkg/arvo/app/metadata-store.hoon | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/metadata-store.hoon b/pkg/arvo/app/metadata-store.hoon index 8e52aaa41..e50bdcdb2 100644 --- a/pkg/arvo/app/metadata-store.hoon +++ b/pkg/arvo/app/metadata-store.hoon @@ -61,9 +61,27 @@ ^- (quip card _this) ?> (team:title our.bowl src.bowl) =^ cards state - ?: ?=(%metadata-action mark) + ?+ mark (on-poke:def mark vase) + %metadata-action (poke-metadata-action:mc !<(metadata-action vase)) - (on-poke:def mark vase) + %noun + =/ val=(each [%cleanup path] tang) + (mule |.(!<([%cleanup path] vase))) + ?. ?=(%& -.val) + (on-poke:def mark vase) + =/ group=path +.p.val + =/ res=(set resource) (~(get ju group-indices) group) + =. group-indices (~(del by group-indices) group) + :- ~ + %+ roll ~(tap in res) + |= [r=resource out=_state] + =. resource-indices.out (~(del by resource-indices.out) r) + =. app-indices.out + %- ~(del ju app-indices.out) + [app-name.r group app-path.r] + =. associations.out (~(del by associations.out) group r) + out + == [cards this] :: ++ on-watch From 40db8ea580f7aa2b5104c37e9ac9e8804a32033b Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 29 Jun 2020 13:25:10 -0700 Subject: [PATCH 262/280] kiln: make otas continue even if they failed to apply --- pkg/arvo/lib/hood/kiln.hoon | 60 +++++++++++++++++++++---------------- pkg/arvo/sys/vane/clay.hoon | 2 +- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index 6a0cbd955..e3bfb0fe2 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -240,6 +240,7 @@ ?+ i.t.t.t.wire ~&([%strange-ota-take t.t.t.wire] ..abet) %find (take-find sign-arvo) %sync (take-sync sign-arvo) + %download (take-download sign-arvo) %merge-home (take-merge-home sign-arvo) %merge-kids (take-merge-kids sign-arvo) == @@ -255,20 +256,39 @@ == :: ++ take-sync + |= =sign-arvo + ?> ?=(%writ +<.sign-arvo) + ?> ?=(^ ota) + ?~ p.sign-arvo + =. ..abet (render-ket "OTA cancelled (1), retrying" ~) + (poke-internal `[ship desk]:u.ota) + =. ..abet (render-ket "downloading OTA update" ~) + =? aeon.u.ota ?=($w p.p.u.p.sign-arvo) + ud:;;(cass:clay q.q.r.u.p.sign-arvo) + %: emit + %pass (make-wire /download) %arvo %c + %warp ship.u.ota desk.u.ota `[%sing %v ud+aeon.u.ota /] + == + :: + ++ take-download |= =sign-arvo ^+ ..abet ?> ?=(%writ +<.sign-arvo) ?> ?=(^ ota) ?~ p.sign-arvo - =. ..abet (render-ket "OTA cancelled, retrying" ~) + =. ..abet (render-ket "OTA cancelled (2), retrying" ~) (poke-internal `[ship desk]:u.ota) - =? aeon.u.ota ?=($w p.p.u.p.sign-arvo) - ud:;;(cass:clay q.q.r.u.p.sign-arvo) + =. ..abet (render-ket "finished downloading OTA" ~) + =. aeon.u.ota +(aeon.u.ota) =/ =germ (get-germ %home) - =. ..abet (render-ket "beginning OTA to %home" ~) - %: emit - %pass (make-wire /merge-home) %arvo %c - %merg %home ship.u.ota desk.u.ota ud+aeon.u.ota germ + =. ..abet (render-ket "applying OTA to %home" ~) + %- emil + :~ :* %pass (make-wire /merge-home) %arvo %c + %merg %home ship.u.ota desk.u.ota ud+(dec aeon.u.ota) germ + == + :* %pass (make-wire /sync) %arvo %c + %warp ship.u.ota desk.u.ota `[%sing %z ud+aeon.u.ota /] + == == :: ++ take-merge-home @@ -282,20 +302,14 @@ (poke-internal `[ship desk]:u.ota) :: ?: ?=(%| -.p.sign-arvo) - =. ..abet - =/ =tape "OTA to %home failed, waiting for next revision" - (render-ket tape `p.p.sign-arvo) - =. aeon.u.ota +(aeon.u.ota) - %: emit - %pass (make-wire /sync) %arvo %c - %warp ship.u.ota desk.u.ota `[%sing %z ud+aeon.u.ota /] - == + =/ =tape "OTA to %home failed, waiting for next revision" + (render-ket tape `p.p.sign-arvo) =. ..abet (render-ket "OTA to %home succeeded" ~) - =. ..abet (render-ket "beginning OTA to %kids" ~) + =. ..abet (render-ket "applying OTA to %kids" ~) =/ =germ (get-germ %kids) %: emit %pass (make-wire /merge-kids) %arvo %c - %merg %kids ship.u.ota desk.u.ota ud+aeon.u.ota germ + %merg %kids ship.u.ota desk.u.ota ud+(dec aeon.u.ota) germ == :: ++ take-merge-kids @@ -308,15 +322,9 @@ (render-ket tape `p.p.sign-arvo) (poke-internal `[ship desk]:u.ota) :: - =. ..abet - ?- -.p.sign-arvo - %& (render-ket "OTA to %kids succeeded" ~) - %| (render-ket "OTA to %kids failed" `p.p.sign-arvo) - == - =. aeon.u.ota +(aeon.u.ota) - %: emit - %pass (make-wire /sync) %arvo %c - %warp ship.u.ota desk.u.ota `[%sing %z ud+aeon.u.ota /] + ?- -.p.sign-arvo + %& (render-ket "OTA to %kids succeeded" ~) + %| (render-ket "OTA to %kids failed" `p.p.sign-arvo) == -- :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 20b62773c..e5cbb91be 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2733,7 +2733,7 @@ :: traverse updated state and sanity check :: =+ ~| :* %bad-foreign-update - [gar=gar let=let.nako nut=(turn nut head) nat=(turn nat head)] + [gar=gar.nako let=let.nako nut=(turn nut head) nat=(turn nat head)] [hitdom=hit.dom letdom=let.dom] == ?: =(0 let.nako) From e7e2c07d6ff4c55048254dcace78111353c99898 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 29 Jun 2020 14:30:33 -0700 Subject: [PATCH 263/280] clay: remove scaffolding --- pkg/arvo/app/chat-store.hoon | 2 +- pkg/arvo/sys/vane/clay.hoon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/chat-store.hoon b/pkg/arvo/app/chat-store.hoon index 0466d98f7..70daf9ecf 100644 --- a/pkg/arvo/app/chat-store.hoon +++ b/pkg/arvo/app/chat-store.hoon @@ -184,7 +184,7 @@ ^- (list envelope:store) [envelope(number curr.o) out.o] =/ len (lent out) - ~& [path [%old (lent envelopes)] [%new len]] + ~? !=(len (lent envelopes)) [path [%old (lent envelopes)] [%new len]] [[len len] (flop out)] == :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index e5cbb91be..1389d79f8 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -4056,7 +4056,7 @@ |= [=desk data=(map path lobe)] ^- reef-cache ~> %slog.0^leaf+"clay: building reef on {}" - ?: !=(%homer desk) + ?: =(%home desk) [!>(..ride) !>(..is) !>(..zuse)] |^ =/ [home=? hoon=vase] From 137e4428f617c13f28ed31e520eff98d251ed3e9 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 29 Jun 2020 16:14:45 -0700 Subject: [PATCH 264/280] release: urbit-os-v1.0.24 --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a400e5b06..bc6fa88e9 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:19d6cb7e5a323590455d641161b911190b3dcd1a0f601bef1304b6b340fa0dc9 -size 16662878 +oid sha256:581c9b713aa12126f3a618d75bf4254bb431f633fbfc76941663391d3d13cdb0 +size 16742515 From ad4e2c0c9d90003190d7b96216930d7f0eb8a00a Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 30 Jun 2020 01:19:44 +0200 Subject: [PATCH 265/280] chat fe: don't embed webms as images --- pkg/interface/src/apps/chat/components/lib/message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/interface/src/apps/chat/components/lib/message.js b/pkg/interface/src/apps/chat/components/lib/message.js index ce1d4bd89..c58cf5e89 100644 --- a/pkg/interface/src/apps/chat/components/lib/message.js +++ b/pkg/interface/src/apps/chat/components/lib/message.js @@ -72,7 +72,7 @@ export class Message extends Component { ); } else if ('url' in letter) { let imgMatch = - /(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM|svg|SVG)$/ + /(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|svg|SVG)$/ .exec(letter.url); const youTubeRegex = new RegExp(String(/(?:https?:\/\/(?:[a-z]+.)?)/.source) // protocol + /(?:youtu\.?be(?:\.com)?\/)(?:embed\/)?/.source // short and long-links From 9686f3483a06f12c7bf3cc5a5fc479524cca9d37 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Mon, 29 Jun 2020 22:48:17 -0400 Subject: [PATCH 266/280] interface: update production build for typescript --- pkg/interface/config/webpack.prod.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/interface/config/webpack.prod.js b/pkg/interface/config/webpack.prod.js index e19e15940..3e00ad14d 100644 --- a/pkg/interface/config/webpack.prod.js +++ b/pkg/interface/config/webpack.prod.js @@ -11,7 +11,7 @@ module.exports = { module: { rules: [ { - test: /\.js?$/, + test: /\.(j|t)sx?$/, use: { loader: 'babel-loader', options: { @@ -39,7 +39,7 @@ module.exports = { ] }, resolve: { - extensions: ['.js'] + extensions: ['.js', '.ts', '.tsx'] }, devtool: 'inline-source-map', // devServer: { @@ -58,7 +58,7 @@ module.exports = { output: { filename: 'index.js', chunkFilename: 'index.js', - path: path.resolve(urbitrc.URBIT_PIERS[0] + '/app/landscape/', 'js'), + path: path.resolve(__dirname, '../../arvo/app/landscape/js'), publicPath: '/' }, optimization: { From 1adca22298a93f0a4b2f1a35701f445c4fc271ca Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 30 Jun 2020 16:21:01 -0400 Subject: [PATCH 267/280] release: urbit-os-v1.0.25 --- bin/solid.pill | 4 ++-- pkg/arvo/app/landscape/js/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index bc6fa88e9..acf25b991 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:581c9b713aa12126f3a618d75bf4254bb431f633fbfc76941663391d3d13cdb0 -size 16742515 +oid sha256:07701886e00c91a5b05ab14d9243508bdfd0a26c14dd3994994d451f4f360770 +size 16637399 diff --git a/pkg/arvo/app/landscape/js/index.js b/pkg/arvo/app/landscape/js/index.js index 50745101d..8f75d1081 100644 --- a/pkg/arvo/app/landscape/js/index.js +++ b/pkg/arvo/app/landscape/js/index.js @@ -347,5 +347,5 @@ var r=n(378),i=n(379),o=n(380);function a(){return l.TYPED_ARRAY_SUPPORT?2147483 * @author Feross Aboukhadijeh * @license MIT */ -e.exports=function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,n){"use strict";var r=n(253);e.exports=o,o.wrap=r;var i=[].slice;function o(){var e=[],t={run:function(){var t=-1,n=i.call(arguments,0,-1),o=arguments[arguments.length-1];if("function"!=typeof o)throw new Error("Expected function as last argument, not "+o);function a(s){var l=e[++t],c=i.call(arguments,0),u=c.slice(1),d=n.length,f=-1;if(s)o(s);else{for(;++fa.length;s&&a.push(i);try{t=e.apply(null,a)}catch(e){if(s&&n)throw e;return i(e)}s||(t&&"function"==typeof t.then?t.then(o,i):t instanceof Error?i(t):o(t))};function i(){n||(n=!0,t.apply(null,arguments))}function o(e){i(null,e)}}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return"[object String]"===n.call(e)}},function(e,t,n){"use strict";var r=Object.prototype.toString;e.exports=function(e){var t;return"[object Object]"===r.call(e)&&(null===(t=Object.getPrototypeOf(e))||t===Object.getPrototypeOf({}))}},function(e,t,n){"use strict";var r=n(257),i=n(8),o=n(259);function a(e){var t=r(o);t.prototype.options=i(t.prototype.options,this.data("settings"),e),this.Parser=t}e.exports=a,a.Parser=o},function(e,t,n){"use strict";var r=n(8),i=n(258);e.exports=function(e){var t,n,o;for(n in i(s,e),i(a,s),t=s.prototype)(o=t[n])&&"object"==typeof o&&(t[n]="concat"in o?o.concat():r(o));return s;function a(t){return e.apply(this,t)}function s(){return this instanceof s?e.apply(this,arguments):new a(arguments)}}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},function(e,t,n){"use strict";var r=n(8),i=n(260),o=n(261),a=n(262),s=n(263),l=n(269);function c(e,t){this.file=t,this.offset={},this.options=r(this.options),this.setOptions({}),this.inList=!1,this.inBlock=!1,this.inLink=!1,this.atStart=!0,this.toOffset=o(t).toOffset,this.unescape=a(this,"escape"),this.decode=s(this)}e.exports=c;var u=c.prototype;function d(e){var t,n=[];for(t in e)n.push(t);return n}u.setOptions=n(270),u.parse=n(273),u.options=n(63),u.exitStart=i("atStart",!0),u.enterList=i("inList",!1),u.enterLink=i("inLink",!1),u.enterBlock=i("inBlock",!1),u.interruptParagraph=[["thematicBreak"],["atxHeading"],["fencedCode"],["blockquote"],["html"],["setextHeading",{commonmark:!1}],["definition",{commonmark:!1}],["footnote",{commonmark:!1}]],u.interruptList=[["atxHeading",{pedantic:!1}],["fencedCode",{pedantic:!1}],["thematicBreak",{pedantic:!1}],["definition",{commonmark:!1}],["footnote",{commonmark:!1}]],u.interruptBlockquote=[["indentedCode",{commonmark:!0}],["fencedCode",{commonmark:!0}],["atxHeading",{commonmark:!0}],["setextHeading",{commonmark:!0}],["thematicBreak",{commonmark:!0}],["html",{commonmark:!0}],["list",{commonmark:!0}],["definition",{commonmark:!1}],["footnote",{commonmark:!1}]],u.blockTokenizers={newline:n(277),indentedCode:n(278),fencedCode:n(279),blockquote:n(280),atxHeading:n(281),thematicBreak:n(282),list:n(283),setextHeading:n(285),html:n(286),footnote:n(287),definition:n(289),table:n(290),paragraph:n(291)},u.inlineTokenizers={escape:n(292),autoLink:n(294),url:n(295),html:n(297),link:n(298),reference:n(299),strong:n(300),emphasis:n(302),deletion:n(305),code:n(307),break:n(309),text:n(311)},u.blockMethods=d(u.blockTokenizers),u.inlineMethods=d(u.inlineTokenizers),u.tokenizeBlock=l("block"),u.tokenizeInline=l("inline"),u.tokenizeFactory=l},function(e,t,n){"use strict";e.exports=function(e,t,n){return function(){var r=n||this,i=r[e];return r[e]=!t,function(){r[e]=i}}}},function(e,t,n){"use strict";function r(e){return function(t){var n=-1,r=e.length;if(t<0)return{};for(;++nt)return{line:n+1,column:t-(e[n-1]||0)+1,offset:t};return{}}}function i(e){return function(t){var n=t&&t.line,r=t&&t.column;if(!isNaN(n)&&!isNaN(r)&&n-1 in e)return(e[n-2]||0)+r-1||0;return-1}}e.exports=function(e){var t=function(e){var t=[],n=e.indexOf("\n");for(;-1!==n;)t.push(n+1),n=e.indexOf("\n",n+1);return t.push(e.length+1),t}(String(e));return{toPosition:r(t),toOffset:i(t)}}},function(e,t,n){"use strict";e.exports=function(e,t){return function(n){var r,i=0,o=n.indexOf("\\"),a=e[t],s=[];for(;-1!==o;)s.push(n.slice(i,o)),i=o+1,(r=n.charAt(i))&&-1!==a.indexOf(r)||s.push("\\"),o=n.indexOf("\\",i);return s.push(n.slice(i)),s.join("")}}},function(e,t,n){"use strict";var r=n(8),i=n(39);e.exports=function(e){return o.raw=function(e,o,a){return i(e,r(a,{position:t(o),warning:n}))},o;function t(t){for(var n=e.offset,r=t.line,i=[];++r&&r in n;)i.push((n[r]||0)+1);return{start:t,indent:i}}function n(t,n,r){3!==r&&e.file.message(t,n)}function o(r,o,a){i(r,{position:t(o),warning:n,text:a,reference:a,textContext:e,referenceContext:e})}}},function(e){e.exports=JSON.parse('{"AElig":"Æ","AMP":"&","Aacute":"Á","Acirc":"Â","Agrave":"À","Aring":"Å","Atilde":"Ã","Auml":"Ä","COPY":"©","Ccedil":"Ç","ETH":"Ð","Eacute":"É","Ecirc":"Ê","Egrave":"È","Euml":"Ë","GT":">","Iacute":"Í","Icirc":"Î","Igrave":"Ì","Iuml":"Ï","LT":"<","Ntilde":"Ñ","Oacute":"Ó","Ocirc":"Ô","Ograve":"Ò","Oslash":"Ø","Otilde":"Õ","Ouml":"Ö","QUOT":"\\"","REG":"®","THORN":"Þ","Uacute":"Ú","Ucirc":"Û","Ugrave":"Ù","Uuml":"Ü","Yacute":"Ý","aacute":"á","acirc":"â","acute":"´","aelig":"æ","agrave":"à","amp":"&","aring":"å","atilde":"ã","auml":"ä","brvbar":"¦","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","curren":"¤","deg":"°","divide":"÷","eacute":"é","ecirc":"ê","egrave":"è","eth":"ð","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","iacute":"í","icirc":"î","iexcl":"¡","igrave":"ì","iquest":"¿","iuml":"ï","laquo":"«","lt":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","ntilde":"ñ","oacute":"ó","ocirc":"ô","ograve":"ò","ordf":"ª","ordm":"º","oslash":"ø","otilde":"õ","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\\"","raquo":"»","reg":"®","sect":"§","shy":"­","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","thorn":"þ","times":"×","uacute":"ú","ucirc":"û","ugrave":"ù","uml":"¨","uuml":"ü","yacute":"ý","yen":"¥","yuml":"ÿ"}')},function(e){e.exports=JSON.parse('{"0":"�","128":"€","130":"‚","131":"ƒ","132":"„","133":"…","134":"†","135":"‡","136":"ˆ","137":"‰","138":"Š","139":"‹","140":"Œ","142":"Ž","145":"‘","146":"’","147":"“","148":"”","149":"•","150":"–","151":"—","152":"˜","153":"™","154":"š","155":"›","156":"œ","158":"ž","159":"Ÿ"}')},function(e,t,n){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}},function(e,t,n){"use strict";var r=n(62),i=n(29);e.exports=function(e){return r(e)||i(e)}},function(e,t,n){"use strict";var r;e.exports=function(e){var t,n="&"+e+";";if((r=r||document.createElement("i")).innerHTML=n,59===(t=r.textContent).charCodeAt(t.length-1)&&"semi"!==e)return!1;return t!==n&&t}},function(e,t,n){"use strict";e.exports=function(e){return function(t,n){var o,a,s,l,c,u,d=this,f=d.offset,h=[],p=d[e+"Methods"],m=d[e+"Tokenizers"],b=n.line,g=n.column;if(!t)return h;k.now=v,k.file=d.file,y("");for(;t;){for(o=-1,a=p.length,c=!1;++o"],i=r.concat(["~","|"]),o=i.concat(["\n",'"',"$","%","&","'",",","/",":",";","<","=","?","@","^"]);function a(e){var t=e||{};return t.commonmark?o:t.gfm?i:r}a.default=r,a.gfm=i,a.commonmark=o},function(e){e.exports=JSON.parse('["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","legend","li","link","main","menu","menuitem","meta","nav","noframes","ol","optgroup","option","p","param","pre","section","source","title","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]')},function(e,t,n){"use strict";var r=n(8),i=n(274);e.exports=function(){var e,t=String(this.file),n={line:1,column:1,offset:0},a=r(n);65279===(t=t.replace(o,"\n")).charCodeAt(0)&&(t=t.slice(1),a.column++,a.offset++);e={type:"root",children:this.tokenizeBlock(t,a),position:{start:n,end:this.eof||r(n)}},this.options.position||i(e,!0);return e};var o=/\r\n|\r/g},function(e,t,n){"use strict";var r=n(25);function i(e){delete e.position}function o(e){e.position=void 0}e.exports=function(e,t){return r(e,t?i:o),e}},function(e,t,n){"use strict";e.exports=i;var r=n(276);function i(e,t,n,i){var a;function s(e,r,l){var c,u=[];return(t&&!a(e,r,l[l.length-1]||null)||!1!==(u=o(n(e,l)))[0])&&e.children&&"skip"!==u[0]&&!1===(c=o(function(e,t){var n,r=i?-1:1,o=(i?e.length:-1)+r;for(;o>-1&&o=4)){for(l="";g"!==t.charAt(x))return;if(n)return!0;x=0;for(;x"===t.charAt(x)?(x++,f=!0," "===t.charAt(x)&&x++):x=d,c=t.slice(x,l),!f&&!r(c)){x=d;break}if(!f&&(s=t.slice(x),i(b,m,this,[e,s,!0])))break;u=d===x?c:t.slice(d,l),w.push(x-d),_.push(u),k.push(c),x=l+1}x=-1,v=w.length,o=e(_.join("\n"));for(;++x6)return;if(!o||!a.pedantic&&"#"===t.charAt(l+1))return;s=t.length+1,i="";for(;++l=3&&(!r||"\n"===r)?(c+=a,!!n||e(c)({type:"thematicBreak"})):void 0;a+=r}}},function(e,t,n){"use strict";var r=n(23),i=n(40),o=n(29),a=n(64),s=n(284),l=n(42);e.exports=function(e,t,n){var i,a,s,c,u,d,f,h,y,v,_,k,w,x,M,S,L,C,E,T,O,D,j,Y,P=this.options.commonmark,A=this.options.pedantic,N=this.blockTokenizers,R=this.interruptList,H=0,I=t.length,F=null,z=0;for(;H=4)return;if(c=t.charAt(H),i=P?b:m,!0===p[c])u=c,s=!1;else{for(s=!0,a="";H=4&&(Y=!0),L&&z>=L.indent&&(Y=!0),c=t.charAt(H),y=null,!Y){if(!0===p[c])y=c,H++,z++;else{for(a="";H=L.indent||z>4):Y=!0,h=!1,H=f;if(_=t.slice(f,d),v=f===H?_:t.slice(H,d),("*"===y||"_"===y||"-"===y)&&N.thematicBreak.call(this,e,_,!0))break;if(k=w,w=!r(v).length,Y&&L)L.value=L.value.concat(S,_),M=M.concat(S,_),S=[];else if(h)0!==S.length&&(L.value.push(""),L.trail=S.concat()),L={value:[_],indent:z,trail:[]},x.push(L),M=M.concat(S,_),S=[];else if(w){if(k)break;S.push(_)}else{if(k)break;if(l(R,N,this,[e,_,!0]))break;L.value=L.value.concat(S,_),M=M.concat(S,_),S=[]}H=d+1}O=e(M.join("\n")).reset({type:"list",ordered:s,start:F,loose:null,children:[]}),C=this.enterList(),E=this.enterBlock(),T=!1,H=-1,I=x.length;for(;++H0&&a.indent=3){d--;break}f+=a}i="",o="";for(;++d|$))/i,/<\/(script|pre|style)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(r.source+"\\s*$"),/^$/,!1]];for(;h"!==e&&"["!==e&&"]"!==e}function s(e){return"["!==e&&"]"!==e&&!r(e)}a.delimiter=">"},function(e,t,n){"use strict";var r=n(7);e.exports=function(e,t,n){var i,o,a,s,l,c,u,d,f,h,p,m,b,g,y,v,_,k,w,x,M,S,L,C;if(!this.options.gfm)return;i=0,k=0,c=t.length+1,u=[];for(;iS){if(k<2)return;break}u.push(t.slice(i,S)),k++,i=S+1}s=u.join("\n"),o=u.splice(1,1)[0]||[],i=0,c=o.length,k--,a=!1,p=[];for(;i1&&(f?(s+=d.slice(0,d.length-1),d=d.charAt(d.length-1)):(s+=d,d="")),v=e.now(),e(s)({type:"tableCell",children:this.tokenizeInline(m,v)},l)),e(d+f),d="",m=""}else if(d&&(m+=d,d=""),m+=f,"\\"===f&&i!==c-2&&(m+=w.charAt(i+1),i++),"`"===f){for(g=1;w.charAt(i+1)===f;)m+=f,i++,g++;y?g>=y&&(y=0):y=g}b=!1,i++}else m?d+=f:e(f),i++;_||e("\n"+o)}return M}},function(e,t,n){"use strict";var r=n(23),i=n(29),o=n(41),a=n(42);e.exports=function(e,t,n){var s,l,c,u,d,f=this.options,h=f.commonmark,p=f.gfm,m=this.blockTokenizers,b=this.interruptParagraph,g=t.indexOf("\n"),y=t.length;for(;g=4){g=t.indexOf("\n",g+1);continue}}if(l=t.slice(g+1),a(b,m,this,[e,l,!0]))break;if(m.list.call(this,e,l,!0)&&(this.inList||h||p&&!i(r.left(l).charAt(0))))break;if(s=g,-1!==(g=t.indexOf("\n",g+1))&&""===r(t.slice(s,g))){g=s;break}}if(l=t.slice(0,g),""===r(l))return e(l),null;if(n)return!0;return d=e.now(),l=o(l),e(l)({type:"paragraph",children:this.tokenizeInline(l,d)})}},function(e,t,n){"use strict";var r=n(293);function i(e,t,n){var r,i;if("\\"===t.charAt(0)&&(r=t.charAt(1),-1!==this.escape.indexOf(r)))return!!n||(i="\n"===r?{type:"break"}:{type:"text",value:r},e("\\"+r)(i))}e.exports=i,i.locator=r},function(e,t,n){"use strict";e.exports=function(e,t){return e.indexOf("\\",t)}},function(e,t,n){"use strict";var r=n(7),i=n(39),o=n(66);e.exports=s,s.locator=o,s.notInLink=!0;var a="mailto:".length;function s(e,t,n){var o,s,l,c,u,d,f,h,p,m,b;if("<"===t.charAt(0)){for(this,o="",s=t.length,l=0,c="",d=!1,f="",l++,o="<";l"===u||"@"===u||":"===u&&"/"===t.charAt(l+1)));)c+=u,l++;if(c){if(f+=c,c="",f+=u=t.charAt(l),l++,"@"===u)d=!0;else{if(":"!==u||"/"!==t.charAt(l+1))return;f+="/",l++}for(;l"!==u);)c+=u,l++;if(u=t.charAt(l),c&&">"===u)return!!n||(p=f+=c,o+=f+u,(h=e.now()).column++,h.offset++,d&&("mailto:"===f.slice(0,a).toLowerCase()?(p=p.substr(a),h.column+=a,h.offset+=a):f="mailto:"+f),m=this.inlineTokenizers,this.inlineTokenizers={text:m.text},b=this.enterLink(),p=this.tokenizeInline(p,h),this.inlineTokenizers=m,b(),e(o)({type:"link",title:null,url:i(f,{nonTerminated:!1}),children:p}))}}}},function(e,t,n){"use strict";var r=n(39),i=n(7),o=n(296);e.exports=l,l.locator=o,l.notInLink=!0;var a=["http://","https://","mailto:"],s=a.length;function l(e,t,n){var o,l,c,u,d,f,h,p,m,b,g,y;if(this.options.gfm){for(o="",u=-1,p=s;++u/i;function l(e,t,n){var i,l,c=t.length;if(!("<"!==t.charAt(0)||c<3)&&(i=t.charAt(1),(r(i)||"?"===i||"!"===i||"/"===i)&&(l=t.match(o))))return!!n||(l=l[0],!this.inLink&&a.test(l)?this.inLink=!0:this.inLink&&s.test(l)&&(this.inLink=!1),e(l)({type:"html",value:l}))}},function(e,t,n){"use strict";var r=n(7),i=n(67);e.exports=l,l.locator=i;var o={}.hasOwnProperty,a={'"':'"',"'":"'"},s={};function l(e,t,n){var i,l,c,u,d,f,h,p,m,b,g,y,v,_,k,w,x,M,S,L="",C=0,E=t.charAt(0),T=this.options.pedantic,O=this.options.commonmark,D=this.options.gfm;if("!"===E&&(m=!0,L=E,E=t.charAt(++C)),"["===E&&(m||!this.inLink)){for(L+=E,k="",C++,y=t.length,_=0,(x=e.now()).column+=C,x.offset+=C;C=c&&(c=0):c=l}else if("\\"===E)C++,f+=t.charAt(C);else if(c&&!D||"["!==E){if((!c||D)&&"]"===E){if(!_){if(!T)for(;C"!==(E=t.charAt(C));){if(O&&"\n"===E)return;k+=E,C++}if(">"!==t.charAt(C))return;L+="<"+k+">",w=k,C++}else{for(E=null,f="";Ct&&" "===e.charAt(n-1);)n--;return n}},function(e,t,n){"use strict";e.exports=function(e,t,n){var r,i,o,a,s,l,c,u,d,f;if(n)return!0;r=this.inlineMethods,a=r.length,i=this.inlineTokenizers,o=-1,d=t.length;for(;++o$/i,o=/^<(\/?)([a-z]+)\s*>$/;e.exports=function(e){var t,n;return r(e,"html",(function(e,r,a){n!==a&&(t=[],n=a);var s=function(e){var t=e.value.match(i);return!!t&&t[1]}(e);if(s)return a.children.splice(r,1,{type:"virtualHtml",tag:s,position:e.position}),!0;var l=function(e,t){var n=e.value.match(o);return!!n&&{tag:n[2],opening:!n[1],node:e}}(e);if(!l)return!0;var c=function(e,t){var n=e.length;for(;n--;)if(e[n].tag===t)return e.splice(n,1)[0];return!1}(t,l.tag);return c?a.children.splice(r,0,function(e,t,n){var r=n.children.indexOf(e.node),i=n.children.indexOf(t.node),o=n.children.splice(r,i-r+1).slice(1,-1);return{type:"virtualHtml",children:o,tag:e.tag,position:{start:e.node.position.start,end:t.node.position.end,indent:[]}}}(l,c,a)):l.opening||t.push(l),!0}),!0),e}},function(e,t,n){"use strict";var r=n(25);function i(e,t,n,r){if("remove"===r)n.children.splice(t,1);else if("unwrap"===r){var i=[t,1];e.children&&(i=i.concat(e.children)),Array.prototype.splice.apply(n.children,i)}}t.ofType=function(e,t){return function(t){return e.forEach((function(e){return r(t,e,n,!0)})),t};function n(e,n,r){r&&i(e,n,r,t)}},t.ifNotMatch=function(e,t){return function(e){return r(e,n,!0),e};function n(n,r,o){o&&!e(n,r,o)&&i(n,r,o,t)}}},function(e,t,n){"use strict";var r=n(0),i=n(8),o=n(24),a={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0}};function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=t.renderers[e.type];void 0===e.position&&(e.position=n.node&&n.node.position||a);var u=e.position.start,d=[e.type,u.line,u.column,i].join("-");if(!o.isValidElementType(c))throw new Error("Renderer for type `".concat(e.type,"` not defined or is not renderable"));var f=l(e,d,t,c,n,i);return r.createElement(c,f,f.children||h()||void 0);function h(){return e.children&&e.children.map((function(n,r){return s(n,t,{node:e,props:f},r)}))}}function l(e,t,n,o,a,l){var u,d={key:t},f="string"==typeof o;n.sourcePos&&e.position&&(d["data-sourcepos"]=[(u=e.position).start.line,":",u.start.column,"-",u.end.line,":",u.end.column].map(String).join("")),n.rawSourcePos&&!f&&(d.sourcePosition=e.position),n.includeNodeIndex&&a.node&&a.node.children&&!f&&(d.index=a.node.children.indexOf(e),d.parentChildCount=a.node.children.length);var h=null!==e.identifier&&void 0!==e.identifier?n.definitions[e.identifier]||{}:null;switch(e.type){case"root":c(d,{className:n.className});break;case"text":d.nodeKey=t,d.children=e.value;break;case"heading":d.level=e.depth;break;case"list":d.start=e.start,d.ordered=e.ordered,d.tight=!e.loose,d.depth=e.depth;break;case"listItem":d.checked=e.checked,d.tight=!e.loose,d.ordered=e.ordered,d.index=e.index,d.children=function(e,t){if(e.loose)return e.children;if(t.node&&e.index>0&&t.node.children[e.index-1].loose)return e.children;return function(e){return e.children.reduce((function(e,t){return e.concat("paragraph"===t.type?t.children||[]:[t])}),[])}(e)}(e,a).map((function(t,r){return s(t,n,{node:e,props:d},r)}));break;case"definition":c(d,{identifier:e.identifier,title:e.title,url:e.url});break;case"code":c(d,{language:e.lang&&e.lang.split(/\s/,1)[0]});break;case"inlineCode":d.children=e.value,d.inline=!0;break;case"link":c(d,{title:e.title||void 0,target:"function"==typeof n.linkTarget?n.linkTarget(e.url,e.children,e.title):n.linkTarget,href:n.transformLinkUri?n.transformLinkUri(e.url,e.children,e.title):e.url});break;case"image":c(d,{alt:e.alt||void 0,title:e.title||void 0,src:n.transformImageUri?n.transformImageUri(e.url,e.children,e.title,e.alt):e.url});break;case"linkReference":c(d,i(h,{href:n.transformLinkUri?n.transformLinkUri(h.href):h.href}));break;case"imageReference":c(d,{src:n.transformImageUri&&h.href?n.transformImageUri(h.href,e.children,h.title,e.alt):h.href,title:h.title||void 0,alt:e.alt||void 0});break;case"table":case"tableHead":case"tableBody":d.columnAlignment=e.align;break;case"tableRow":d.isHeader="tableHead"===a.node.type,d.columnAlignment=a.props.columnAlignment;break;case"tableCell":c(d,{isHeader:a.props.isHeader,align:a.props.columnAlignment[l]});break;case"virtualHtml":d.tag=e.tag;break;case"html":d.isBlock=e.position.start.line!==e.position.end.line,d.escapeHtml=n.escapeHtml,d.skipHtml=n.skipHtml;break;case"parsedHtml":var p;e.children&&(p=e.children.map((function(t,r){return s(t,n,{node:e,props:d},r)}))),d.escapeHtml=n.escapeHtml,d.skipHtml=n.skipHtml,d.element=function(e,t){var n=e.element;if(Array.isArray(n)){var i=r.Fragment||"div";return r.createElement(i,null,n)}if(n.props.children||t){var o=r.Children.toArray(n.props.children).concat(t);return r.cloneElement(n,null,o)}return r.cloneElement(n,null)}(e,p);break;default:c(d,i(e,{type:void 0,position:void 0,children:void 0}))}return!f&&e.value&&(d.value=e.value),d}function c(e,t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])}e.exports=s},function(e,t,n){"use strict";var r=n(25);function i(e){var t=e.children;e.children=[{type:"tableHead",align:e.align,children:[t[0]],position:t[0].position}],t.length>1&&e.children.push({type:"tableBody",align:e.align,children:t.slice(1),position:{start:t[1].position.start,end:t[t.length-1].position.end}})}e.exports=function(e){return r(e,"table",i),e}},function(e,t,n){"use strict";e.exports=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(t.children||[]).reduce((function(t,n){return"definition"===n.type&&(t[n.identifier]={href:n.url,title:n.title}),e(n,t)}),n)}},function(e,t,n){"use strict";var r=["http","https","mailto","tel"];e.exports=function(e){var t=(e||"").trim(),n=t.charAt(0);if("#"===n||"/"===n)return t;var i=t.indexOf(":");if(-1===i)return t;for(var o=r.length,a=-1;++aa||-1!==(a=t.indexOf("#"))&&i>a?t:"javascript:void(0)"}},function(e,t,n){"use strict";var r=n(8),i=n(0),o=parseInt((i.version||"16").slice(0,2),10)>=16,a=i.createElement;function s(e,t){return a(e,l(t),t.children)}function l(e){return e["data-sourcepos"]?{"data-sourcepos":e["data-sourcepos"]}:{}}e.exports={break:"br",paragraph:"p",emphasis:"em",strong:"strong",thematicBreak:"hr",blockquote:"blockquote",delete:"del",link:"a",image:"img",linkReference:"a",imageReference:"img",table:s.bind(null,"table"),tableHead:s.bind(null,"thead"),tableBody:s.bind(null,"tbody"),tableRow:s.bind(null,"tr"),tableCell:function(e){var t=e.align?{textAlign:e.align}:void 0,n=l(e);return a(e.isHeader?"th":"td",t?r({style:t},n):n,e.children)},root:function(e){var t=!e.className,n=t&&i.Fragment||"div";return a(n,t?null:e,e.children)},text:function(e){return o?e.children:a("span",null,e.children)},list:function(e){var t=l(e);null!==e.start&&1!==e.start&&void 0!==e.start&&(t.start=e.start.toString());return a(e.ordered?"ol":"ul",t,e.children)},listItem:function(e){var t=null;if(null!==e.checked&&void 0!==e.checked){var n=e.checked;t=a("input",{type:"checkbox",checked:n,readOnly:!0})}return a("li",l(e),t,e.children)},definition:function(){return null},heading:function(e){return a("h".concat(e.level),l(e),e.children)},inlineCode:function(e){return a("code",l(e),e.children)},code:function(e){var t=e.language&&"language-".concat(e.language),n=a("code",t?{className:t}:null,e.value);return a("pre",l(e),n)},html:function(e){if(e.skipHtml)return null;var t=e.isBlock?"div":"span";if(e.escapeHtml){var n=i.Fragment||t;return a(n,null,e.value)}var r={dangerouslySetInnerHTML:{__html:e.value}};return a(t,r)},virtualHtml:function(e){return a(e.tag,l(e),e.children)},parsedHtml:function(e){return e["data-sourcepos"]?i.cloneElement(e.element,{"data-sourcepos":e["data-sourcepos"]}):e.element}}},function(e,t,n){"use strict";var r=n(0),i=n(8),o=n(25),a=n(322),s=n(68),l="parsedHtml",c=/^<(area|base|br|col|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)\s*\/?>$/i,u=/^<([a-z]+)\b/i,d=/^<\/([a-z]+)\s*>$/,f=new a.Parser,h={isValidNode:function(e){return"script"!==e.type},processingInstructions:[{shouldProcessNode:function(){return!0},processNode:new a.ProcessNodeDefinitions(r).processDefaultNode}]};function p(e,t,n){var i,a;return o(t,"html",(function(t,o,s){if(n.escapeHtml)return s.children.splice(o,1,{type:"text",position:t.position,value:t.value}),!0;if(n.skipHtml)return s.children.splice(o,1),!0;a!==s&&(i=[],a=s);var h=function(e){var t=e.value.match(c);return!!t&&t[1]}(t);if(h)return s.children.splice(o,1,{type:"virtualHtml",tag:h,position:t.position}),!0;var p=function(e,t){var n=e.value.trim().match(d);if(n)return{tag:n[1],opening:!1,node:e};var i=f.parseWithInstructions(e.value,t.isValidNode,t.processingInstructions);if(!i)return!1;var o=r.Children.count(i)>1,a=!o&&c.test("<".concat(i.type,">"));if(o||a)return{type:l,position:e.position,node:i};var s=e.value.trim().match(u);return{tag:s?s[1]:i.type,opening:!0,node:e,element:i}}(t,e);if(!p||p.type===l)return!0;var m=function(e,t){var n=e.length;for(;n--;)if(e[n].tag===t)return e.splice(n,1)[0];return!1}(i,p.tag);return m?s.children.splice(o,0,function(e,t,n){var r=n.children.indexOf(e.node),i=n.children.indexOf(t.node),o=n.children.splice(r,i-r+1).slice(1,-1);return{type:l,children:o,tag:e.tag,element:e.element,value:e.node.value,position:{start:e.node.position.start,end:t.node.position.end,indent:[]}}}(p,m,s)):p.opening||i.push(p),!0}),!0),o(t,"html",(function(t,n,r){var i=f.parseWithInstructions(t.value,e.isValidNode,e.processingInstructions);return i?(r.children.splice(n,1,{type:l,element:i,value:t.value,position:t.position}),!0):(r.children.splice(n,1),!0)})),t}e.exports=function(e,t){if(t&&(void 0!==e.source||void 0!==e.children))throw new Error("react-markdown: `html-parser` must be called before use - see https://github.com/rexxars/react-markdown#parsing-html");var n=i(h,e||{}),r=p.bind(null,n);return r.identity=s.HtmlParser,r}},function(e,t,n){"use strict";var r=n(323),i=n(80),o=n(83),a=n(81);e.exports={Parser:r,ProcessingInstructions:i,IsValidNodeDefinitions:o,ProcessNodeDefinitions:a}},function(e,t,n){"use strict";var r=n(324),i=n(326),o=n(330),a=n(341),s=n(344),l=n(347).Parser,c=n(52).DomHandler,u=n(80),d=n(83),f=n(82);e.exports=function(e){function t(t,n,u,d){var h=function(t){(e=e||{}).decodeEntities=!0;var n=new c;return new l(n,e).parseComplete(t),n.dom.filter((function(e){return"directive"!==e.type}))}(t).map((function(e,t){return function e(t,n,l,c,u){if(n(t)){r((function(e){e.shouldPreprocessNode(t)&&e.preprocessNode(t,u)}),c||[]);var d=i((function(e){return e.shouldProcessNode(t)}),l||[]);if(null!=d){var h=o((function(e){return null==e||!1===e}),a(s)((function(t,r){return e(t,n,l,c,r)}),t.children||[]));return d.replaceChildren?f.createElement(t,u,t.data,[d.processNode(t,h,u)]):d.processNode(t,h,u)}return!1}return!1}(e,n,u,d,t)}));return h.length<=1?h[0]:h}return{parse:function(e){var n=new u;return t(e,d.alwaysValid,n.defaultProcessingInstructions)},parseWithInstructions:t}}},function(e,t,n){var r=n(325),i=n(9)(r("forEach",(function(e,t){for(var n=t.length,r=0;r0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))}));e.exports=a},function(e,t){e.exports=function(e){return"[object String]"===Object.prototype.toString.call(e)}},function(e,t){var n=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}();e.exports=function(e){return new n(e)}},function(e,t,n){var r=n(48),i=n(9)((function(e,t){return r(e.length,(function(){return e.apply(t,arguments)}))}));e.exports=i},function(e,t,n){var r=n(9),i=n(46),o=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=i.init,e.prototype["@@transducer/result"]=i.result,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}(),a=r((function(e,t){return new o(e,t)}));e.exports=a},function(e,t,n){var r=n(49),i=Object.prototype.toString,o=function(){return"[object Arguments]"===i.call(arguments)?function(e){return"[object Arguments]"===i.call(e)}:function(e){return r("callee",e)}}();e.exports=o},function(e,t,n){var r=n(342),i=n(20),o=n(70),a=i((function(e){return o(e.length,(function(){var t=0,n=arguments[0],i=arguments[arguments.length-1],o=Array.prototype.slice.call(arguments,0);return o[0]=function(){var e=n.apply(this,r(arguments,[t,i]));return t+=1,e},e.apply(this,o)}))}));e.exports=a},function(e,t){e.exports=function(e,t){var n;t=t||[];var r=(e=e||[]).length,i=t.length,o=[];for(n=0;n=arguments.length)?u=n[c]:(u=arguments[s],s+=1),a[c]=u,i(u)||(l-=1),c+=1}return l<=0?o.apply(this,a):r(l,e(t,a,o))}}},function(e,t,n){var r=n(9),i=n(45),o=n(345),a=n(47),s=n(346),l=n(70),c=n(69),u=r(i(["fantasy-land/map","map"],s,(function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return l(t.length,(function(){return e.call(this,t.apply(this,arguments))}));case"[object Object]":return a((function(n,r){return n[r]=e(t[r]),n}),{},c(t));default:return o(e,t)}})));e.exports=u},function(e,t){e.exports=function(e,t){for(var n=0,r=t.length,i=Array(r);n0&&a.length>i&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=i[e];if(void 0===l)return!1;if("function"==typeof l)o(l,this,t);else{var c=l.length,u=b(l,c);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=new Map([["tag",1],["script",1],["style",1],["directive",1],["text",3],["cdata",4],["comment",8]]),a=function(){function e(e){this.type=e,this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return o.get(this.type)||1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent||null},set:function(e){this.parent=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev||null},set:function(e){this.prev=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next||null},set:function(e){this.next=e},enumerable:!0,configurable:!0}),e}();t.Node=a;var s=function(e){function t(t,n){var r=e.call(this,t)||this;return r.data=n,r}return i(t,e),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!0,configurable:!0}),t}(a);t.DataNode=s;var l=function(e){function t(t,n){var r=e.call(this,"directive",n)||this;return r.name=t,r}return i(t,e),t}(s);t.ProcessingInstruction=l;var c=function(e){function t(t,n){var r=e.call(this,t)||this;return r.children=n,r}return i(t,e),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this.children[0]||null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!0,configurable:!0}),t}(a);t.NodeWithChildren=c;var u=function(e){function t(t,n){var r=e.call(this,"script"===t?"script":"style"===t?"style":"tag",[])||this;return r.name=t,r.attribs=n,r.attribs=n,r}return i(t,e),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!0,configurable:!0}),t}(c);t.Element=u},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(26),o=r(n(352));t.getOuterHTML=o.default,t.getInnerHTML=function(e,n){return i.hasChildren(e)?e.children.map((function(e){return t.getOuterHTML(e,n)})).join(""):""},t.getText=function e(t){return Array.isArray(t)?t.map(e).join(""):i.isTag(t)?"br"===t.name?"\n":e(t.children):i.isCDATA(t)?e(t.children):i.isText(t)?t.data:""}},function(e,t,n){var r=n(53),i=n(353),o=n(354);o.elementNames.__proto__=null,o.attributeNames.__proto__=null;var a={__proto__:null,style:!0,script:!0,xmp:!0,iframe:!0,noembed:!0,noframes:!0,plaintext:!0,noscript:!0};var s={__proto__:null,area:!0,base:!0,basefont:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,isindex:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},l=e.exports=function(e,t){Array.isArray(e)||e.cheerio||(e=[e]),t=t||{};for(var n="",i=0;i=0&&(t=Object.assign({},t,{xmlMode:!1}))),!t.xmlMode&&["svg","math"].indexOf(e.name)>=0&&(t=Object.assign({},t,{xmlMode:"foreign"}));var n="<"+e.name,r=function(e,t){if(e){var n,r="";for(var a in e)n=e[a],r&&(r+=" "),"foreign"===t.xmlMode&&(a=o.attributeNames[a]||a),r+=a,(null!==n&&""!==n||t.xmlMode)&&(r+='="'+(t.decodeEntities?i.encodeXML(n):n.replace(/\"/g,"""))+'"');return r}}(e.attribs,t);return r&&(n+=" "+r),!t.xmlMode||e.children&&0!==e.children.length?(n+=">",e.children&&(n+=l(e.children,t)),s[e.name]&&!t.xmlMode||(n+="")):n+="/>",n}function d(e){return"<"+e.data+">"}function f(e,t){var n=e.data||"";return!t.decodeEntities||e.parent&&e.parent.name in a||(n=i.encodeXML(n)),n}function h(e){return""}function p(e){return"\x3c!--"+e.data+"--\x3e"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77),i=n(78);t.decode=function(e,t){return(!t||t<=0?r.decodeXML:r.decodeHTML)(e)},t.decodeStrict=function(e,t){return(!t||t<=0?r.decodeXML:r.decodeHTMLStrict)(e)},t.encode=function(e,t){return(!t||t<=0?i.encodeXML:i.encodeHTML)(e)};var o=n(78);t.encodeXML=o.encodeXML,t.encodeHTML=o.encodeHTML,t.escape=o.escape,t.encodeHTML4=o.encodeHTML,t.encodeHTML5=o.encodeHTML;var a=n(77);t.decodeXML=a.decodeXML,t.decodeHTML=a.decodeHTML,t.decodeHTMLStrict=a.decodeHTMLStrict,t.decodeHTML4=a.decodeHTML,t.decodeHTML5=a.decodeHTML,t.decodeHTML4Strict=a.decodeHTMLStrict,t.decodeHTML5Strict=a.decodeHTMLStrict,t.decodeXMLStrict=a.decodeXML},function(e){e.exports=JSON.parse('{"elementNames":{"altglyph":"altGlyph","altglyphdef":"altGlyphDef","altglyphitem":"altGlyphItem","animatecolor":"animateColor","animatemotion":"animateMotion","animatetransform":"animateTransform","clippath":"clipPath","feblend":"feBlend","fecolormatrix":"feColorMatrix","fecomponenttransfer":"feComponentTransfer","fecomposite":"feComposite","feconvolvematrix":"feConvolveMatrix","fediffuselighting":"feDiffuseLighting","fedisplacementmap":"feDisplacementMap","fedistantlight":"feDistantLight","fedropshadow":"feDropShadow","feflood":"feFlood","fefunca":"feFuncA","fefuncb":"feFuncB","fefuncg":"feFuncG","fefuncr":"feFuncR","fegaussianblur":"feGaussianBlur","feimage":"feImage","femerge":"feMerge","femergenode":"feMergeNode","femorphology":"feMorphology","feoffset":"feOffset","fepointlight":"fePointLight","fespecularlighting":"feSpecularLighting","fespotlight":"feSpotLight","fetile":"feTile","feturbulence":"feTurbulence","foreignobject":"foreignObject","glyphref":"glyphRef","lineargradient":"linearGradient","radialgradient":"radialGradient","textpath":"textPath"},"attributeNames":{"definitionurl":"definitionURL","attributename":"attributeName","attributetype":"attributeType","basefrequency":"baseFrequency","baseprofile":"baseProfile","calcmode":"calcMode","clippathunits":"clipPathUnits","diffuseconstant":"diffuseConstant","edgemode":"edgeMode","filterunits":"filterUnits","glyphref":"glyphRef","gradienttransform":"gradientTransform","gradientunits":"gradientUnits","kernelmatrix":"kernelMatrix","kernelunitlength":"kernelUnitLength","keypoints":"keyPoints","keysplines":"keySplines","keytimes":"keyTimes","lengthadjust":"lengthAdjust","limitingconeangle":"limitingConeAngle","markerheight":"markerHeight","markerunits":"markerUnits","markerwidth":"markerWidth","maskcontentunits":"maskContentUnits","maskunits":"maskUnits","numoctaves":"numOctaves","pathlength":"pathLength","patterncontentunits":"patternContentUnits","patterntransform":"patternTransform","patternunits":"patternUnits","pointsatx":"pointsAtX","pointsaty":"pointsAtY","pointsatz":"pointsAtZ","preservealpha":"preserveAlpha","preserveaspectratio":"preserveAspectRatio","primitiveunits":"primitiveUnits","refx":"refX","refy":"refY","repeatcount":"repeatCount","repeatdur":"repeatDur","requiredextensions":"requiredExtensions","requiredfeatures":"requiredFeatures","specularconstant":"specularConstant","specularexponent":"specularExponent","spreadmethod":"spreadMethod","startoffset":"startOffset","stddeviation":"stdDeviation","stitchtiles":"stitchTiles","surfacescale":"surfaceScale","systemlanguage":"systemLanguage","tablevalues":"tableValues","targetx":"targetX","targety":"targetY","textlength":"textLength","viewbox":"viewBox","viewtarget":"viewTarget","xchannelselector":"xChannelSelector","ychannelselector":"yChannelSelector","zoomandpan":"zoomAndPan"}}')},function(e,t,n){"use strict";function r(e){return e.children||null}function i(e){return e.parent||null}function o(e,t){return e.attribs&&e.attribs[t]}Object.defineProperty(t,"__esModule",{value:!0}),t.getChildren=r,t.getParent=i,t.getSiblings=function(e){var t=i(e);return t?r(t):[e]},t.getAttributeValue=o,t.hasAttrib=function(e,t){return!!o(e,t)},t.getName=function(e){return e.name}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeElement=function(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){var t=e.parent.children;t.splice(t.lastIndexOf(e),1)}},t.replaceElement=function(e,t){var n=t.prev=e.prev;n&&(n.next=t);var r=t.next=e.next;r&&(r.prev=t);var i=t.parent=e.parent;if(i){var o=i.children;o[o.lastIndexOf(e)]=t}},t.appendChild=function(e,t){if(t.parent=e,1!==e.children.push(t)){var n=e.children[e.children.length-2];n.next=t,t.prev=n,t.next=null}},t.append=function(e,t){var n=e.parent,r=e.next;if(t.next=r,t.prev=e,e.next=t,t.parent=n,r){if(r.prev=t,n){var i=n.children;i.splice(i.lastIndexOf(r),0,t)}}else n&&n.children.push(t)},t.prepend=function(e,t){var n=e.parent;if(n){var r=n.children;r.splice(r.lastIndexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=n,t.prev=e.prev,t.next=e,e.prev=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(79),i=n(26);function o(e){return"text"===e.type}var a={tag_name:function(e){return"function"==typeof e?function(t){return i.isTag(t)&&e(t.name)}:"*"===e?i.isTag:function(t){return i.isTag(t)&&t.name===e}},tag_type:function(e){return"function"==typeof e?function(t){return e(t.type)}:function(t){return t.type===e}},tag_contains:function(e){return"function"==typeof e?function(t){return o(t)&&e(t.data)}:function(t){return o(t)&&t.data===e}}};function s(e,t){return"function"==typeof t?function(n){return i.isTag(n)&&t(n.attribs[e])}:function(n){return i.isTag(n)&&n.attribs[e]===t}}function l(e,t){return function(n){return e(n)||t(n)}}function c(e){var t=Object.keys(e).map((function(t){var n=e[t];return t in a?a[t](n):s(t,n)}));return 0===t.length?null:t.reduce(l)}t.testElement=function(e,t){var n=c(e);return!n||n(t)},t.getElements=function(e,t,n,i){void 0===i&&(i=1/0);var o=c(e);return o?r.filter(o,t,n,i):[]},t.getElementById=function(e,t,n){return void 0===n&&(n=!0),Array.isArray(t)||(t=[t]),r.findOne(s("id",e),t,n)},t.getElementsByTagName=function(e,t,n,i){return void 0===i&&(i=1/0),r.filter(a.tag_name(e),t,n,i)},t.getElementsByTagType=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),r.filter(a.tag_type(e),t,n,i)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(26);function i(e,t){var n=[],i=[];if(e===t)return 0;for(var o=r.hasChildren(e)?e:e.parent;o;)n.unshift(o),o=o.parent;for(o=r.hasChildren(t)?t:t.parent;o;)i.unshift(o),o=o.parent;for(var a=0;n[a]===i[a];)a++;if(0===a)return 1;var s=n[a-1],l=s.children,c=n[a],u=i[a];return l.indexOf(c)>l.indexOf(u)?s===t?20:4:s===e?10:2}t.removeSubsets=function(e){for(var t=e.length;--t>=0;){var n=e[t];if(t>0&&e.lastIndexOf(n,t-1)>=0)e.splice(t,1);else for(var r=n.parent;r;r=r.parent)if(e.indexOf(r)>-1){e.splice(t,1);break}}return e},t.compareDocumentPosition=i,t.uniqueSort=function(e){return(e=e.filter((function(e,t,n){return!n.includes(e,t+1)}))).sort((function(e,t){var n=i(e,t);return 2&n?-1:4&n?1:0})),e}},function(e,t){},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){void 0===t&&(t={});var n=e.call(this,(function(e){for(var t,r=[],i=1;i=r?e:function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r]*>\s*$/,!1)){for(;d.prev&&!d.startOfLine;)d=d.prev;d.startOfLine?u-=r.indentUnit:c.prev.state.lexical&&(u=c.prev.state.lexical.indented)}else 1==c.depth&&(u+=r.indentUnit);return i.context=new t(e.startState(a,u),a,0,i.context),null}if(1==c.depth){if("<"==n.peek())return o.skipAttribute(c.state),i.context=new t(e.startState(o,s(c.state)),o,0,i.context),null;if(n.match("//"))return n.skipToEnd(),"comment";if(n.match("/*"))return c.depth=2,l(n,i)}var f,h=o.token(n,c.state),p=n.current();return/\btag\b/.test(h)?/>$/.test(p)?c.state.context?c.depth=0:i.context=i.context.prev:/^-1&&n.backUp(p.length-f),h}(n,i,i.context):function(n,r,i){if("<"==n.peek()&&a.expressionAllowed(n,i.state))return a.skipExpression(i.state),r.context=new t(e.startState(o,a.indent(i.state,"","")),o,0,r.context),null;var s=a.token(n,i.state);if(!s&&null!=i.depth){var l=n.current();"{"==l?i.depth++:"}"==l&&0==--i.depth&&(r.context=r.context.prev)}return s}(n,i,i.context)}return{startState:function(){return{context:new t(e.startState(a),a)}},copyState:function(e){return{context:n(e.context)}},token:l,indent:function(e,t,n){return e.context.mode.indent(e.context.state,t,n)},innerMode:function(e){return e.context}}}),"xml","javascript"),e.defineMIME("text/jsx","jsx"),e.defineMIME("text/typescript-jsx",{name:"jsx",base:{name:"javascript",typescript:!0}})}(n(11),n(60),n(369))},function(e,t,n){!function(e){"use strict";e.defineMode("javascript",(function(t,n){var r,i,o=t.indentUnit,a=n.statementIndent,s=n.jsonld,l=n.json||s,c=n.typescript,u=n.wordCharacters||/[\w$\xa1-\uffff]/,d=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("keyword d"),o=e("operator"),a={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:e("new"),delete:r,void:r,throw:r,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:r,export:e("export"),import:e("import"),extends:r,await:r}}(),f=/[+\-*&%=<>!?|~^@]/,h=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function p(e,t,n){return r=e,i=n,t}function m(e,t){var n,r=e.next();if('"'==r||"'"==r)return t.tokenize=(n=r,function(e,t){var r,i=!1;if(s&&"@"==e.peek()&&e.match(h))return t.tokenize=m,p("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=n||i);)i=!i&&"\\"==r;return i||(t.tokenize=m),p("string","string")}),t.tokenize(e,t);if("."==r&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if("."==r&&e.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return p(r);if("="==r&&e.eat(">"))return p("=>","operator");if("0"==r&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(r))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if("/"==r)return e.eat("*")?(t.tokenize=b,b(e,t)):e.eat("/")?(e.skipToEnd(),p("comment","comment")):Ze(e,t,1)?(function(e){for(var t,n=!1,r=!1;null!=(t=e.next());){if(!n){if("/"==t&&!r)return;"["==t?r=!0:r&&"]"==t&&(r=!1)}n=!n&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string-2")):(e.eat("="),p("operator","operator",e.current()));if("`"==r)return t.tokenize=g,g(e,t);if("#"==r)return e.skipToEnd(),p("error","error");if("<"==r&&e.match("!--")||"-"==r&&e.match("->"))return e.skipToEnd(),p("comment","comment");if(f.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),p("operator","operator",e.current());if(u.test(r)){e.eatWhile(u);var i=e.current();if("."!=t.lastType){if(d.propertyIsEnumerable(i)){var o=d[i];return p(o.type,o.style,i)}if("async"==i&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",i)}return p("variable","variable",i)}}function b(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=m;break}r="*"==n}return p("comment","comment")}function g(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=m;break}r=!r&&"\\"==n}return p("quasi","string-2",e.current())}function y(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(n<0)){if(c){var r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n));r&&(n=r.index)}for(var i=0,o=!1,a=n-1;a>=0;--a){var s=e.string.charAt(a),l="([{}])".indexOf(s);if(l>=0&&l<3){if(!i){++a;break}if(0==--i){"("==s&&(o=!0);break}}else if(l>=3&&l<6)++i;else if(u.test(s))o=!0;else if(/["'\/`]/.test(s))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==s&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var v={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function _(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function k(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(n=r.vars;n;n=n.next)if(n.name==t)return!0}var w={state:null,column:null,marked:null,cc:null};function x(){for(var e=arguments.length-1;e>=0;e--)w.cc.push(arguments[e])}function M(){return x.apply(null,arguments),!0}function S(e,t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}function L(e){var t=w.state;if(w.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var r=function e(t,n){if(n){if(n.block){var r=e(t,n.prev);return r?r==n.prev?n:new E(r,n.vars,!0):null}return S(t,n.vars)?n:new E(n.prev,new T(t,n.vars),!1)}return null}(e,t.context);if(null!=r)return void(t.context=r)}else if(!S(e,t.localVars))return void(t.localVars=new T(e,t.localVars));n.globalVars&&!S(e,t.globalVars)&&(t.globalVars=new T(e,t.globalVars))}function C(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function E(e,t,n){this.prev=e,this.vars=t,this.block=n}function T(e,t){this.name=e,this.next=t}var O=new T("this",new T("arguments",null));function D(){w.state.context=new E(w.state.context,w.state.localVars,!1),w.state.localVars=O}function j(){w.state.context=new E(w.state.context,w.state.localVars,!0),w.state.localVars=null}function Y(){w.state.localVars=w.state.context.vars,w.state.context=w.state.context.prev}function P(e,t){var n=function(){var n=w.state,r=n.indented;if("stat"==n.lexical.type)r=n.lexical.indented;else for(var i=n.lexical;i&&")"==i.type&&i.align;i=i.prev)r=i.indented;n.lexical=new _(r,w.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function A(){var e=w.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function N(e){return function t(n){return n==e?M():";"==e||"}"==n||")"==n||"]"==n?x():M(t)}}function R(e,t){return"var"==e?M(P("vardef",t),ye,N(";"),A):"keyword a"==e?M(P("form"),z,R,A):"keyword b"==e?M(P("form"),R,A):"keyword d"==e?w.stream.match(/^\s*$/,!1)?M():M(P("stat"),B,N(";"),A):"debugger"==e?M(N(";")):"{"==e?M(P("}"),j,oe,A,Y):";"==e?M():"if"==e?("else"==w.state.lexical.info&&w.state.cc[w.state.cc.length-1]==A&&w.state.cc.pop()(),M(P("form"),z,R,A,Me)):"function"==e?M(Ee):"for"==e?M(P("form"),Se,R,A):"class"==e||c&&"interface"==t?(w.marked="keyword",M(P("form","class"==e?e:t),Ye,A)):"variable"==e?c&&"declare"==t?(w.marked="keyword",M(R)):c&&("module"==t||"enum"==t||"type"==t)&&w.stream.match(/^\s*\w/,!1)?(w.marked="keyword","enum"==t?M(Ve):"type"==t?M(Oe,N("operator"),ue,N(";")):M(P("form"),ve,N("{"),P("}"),oe,A,A)):c&&"namespace"==t?(w.marked="keyword",M(P("form"),I,R,A)):c&&"abstract"==t?(w.marked="keyword",M(R)):M(P("stat"),X):"switch"==e?M(P("form"),z,N("{"),P("}","switch"),j,oe,A,A,Y):"case"==e?M(I,N(":")):"default"==e?M(N(":")):"catch"==e?M(P("form"),D,H,R,A,Y):"export"==e?M(P("stat"),Re,A):"import"==e?M(P("stat"),Ie,A):"async"==e?M(R):"@"==t?M(I,R):x(P("stat"),I,N(";"),A)}function H(e){if("("==e)return M(De,N(")"))}function I(e,t){return W(e,t,!1)}function F(e,t){return W(e,t,!0)}function z(e){return"("!=e?x():M(P(")"),B,N(")"),A)}function W(e,t,n){if(w.state.fatArrowAt==w.stream.start){var r=n?$:G;if("("==e)return M(D,P(")"),re(De,")"),A,N("=>"),r,Y);if("variable"==e)return x(D,ve,N("=>"),r,Y)}var i=n?V:U;return v.hasOwnProperty(e)?M(i):"function"==e?M(Ee,i):"class"==e||c&&"interface"==t?(w.marked="keyword",M(P("form"),je,A)):"keyword c"==e||"async"==e?M(n?F:I):"("==e?M(P(")"),B,N(")"),A,i):"operator"==e||"spread"==e?M(n?F:I):"["==e?M(P("]"),Ue,A,i):"{"==e?ie(ee,"}",null,i):"quasi"==e?x(q,i):"new"==e?M(function(e){return function(t){return"."==t?M(e?K:J):"variable"==t&&c?M(me,e?V:U):x(e?F:I)}}(n)):"import"==e?M(I):M()}function B(e){return e.match(/[;\}\)\],]/)?x():x(I)}function U(e,t){return","==e?M(B):V(e,t,!1)}function V(e,t,n){var r=0==n?U:V,i=0==n?I:F;return"=>"==e?M(D,n?$:G,Y):"operator"==e?/\+\+|--/.test(t)||c&&"!"==t?M(r):c&&"<"==t&&w.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?M(P(">"),re(ue,">"),A,r):"?"==t?M(I,N(":"),i):M(i):"quasi"==e?x(q,r):";"!=e?"("==e?ie(F,")","call",r):"."==e?M(Q,r):"["==e?M(P("]"),B,N("]"),A,r):c&&"as"==t?(w.marked="keyword",M(ue,r)):"regexp"==e?(w.state.lastType=w.marked="operator",w.stream.backUp(w.stream.pos-w.stream.start-1),M(i)):void 0:void 0}function q(e,t){return"quasi"!=e?x():"${"!=t.slice(t.length-2)?M(q):M(I,Z)}function Z(e){if("}"==e)return w.marked="string-2",w.state.tokenize=g,M(q)}function G(e){return y(w.stream,w.state),x("{"==e?R:I)}function $(e){return y(w.stream,w.state),x("{"==e?R:F)}function J(e,t){if("target"==t)return w.marked="keyword",M(U)}function K(e,t){if("target"==t)return w.marked="keyword",M(V)}function X(e){return":"==e?M(A,R):x(U,N(";"),A)}function Q(e){if("variable"==e)return w.marked="property",M()}function ee(e,t){return"async"==e?(w.marked="property",M(ee)):"variable"==e||"keyword"==w.style?(w.marked="property","get"==t||"set"==t?M(te):(c&&w.state.fatArrowAt==w.stream.start&&(n=w.stream.match(/^\s*:\s*/,!1))&&(w.state.fatArrowAt=w.stream.pos+n[0].length),M(ne))):"number"==e||"string"==e?(w.marked=s?"property":w.style+" property",M(ne)):"jsonld-keyword"==e?M(ne):c&&C(t)?(w.marked="keyword",M(ee)):"["==e?M(I,ae,N("]"),ne):"spread"==e?M(F,ne):"*"==t?(w.marked="keyword",M(ee)):":"==e?x(ne):void 0;var n}function te(e){return"variable"!=e?x(ne):(w.marked="property",M(Ee))}function ne(e){return":"==e?M(F):"("==e?x(Ee):void 0}function re(e,t,n){function r(i,o){if(n?n.indexOf(i)>-1:","==i){var a=w.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),M((function(n,r){return n==t||r==t?x():x(e)}),r)}return i==t||o==t?M():n&&n.indexOf(";")>-1?x(e):M(N(t))}return function(n,i){return n==t||i==t?M():x(e,r)}}function ie(e,t,n){for(var r=3;r"),ue):void 0}function de(e){if("=>"==e)return M(ue)}function fe(e,t){return"variable"==e||"keyword"==w.style?(w.marked="property",M(fe)):"?"==t||"number"==e||"string"==e?M(fe):":"==e?M(ue):"["==e?M(N("variable"),se,N("]"),fe):"("==e?x(Te,fe):void 0}function he(e,t){return"variable"==e&&w.stream.match(/^\s*[?:]/,!1)||"?"==t?M(he):":"==e?M(ue):"spread"==e?M(he):x(ue)}function pe(e,t){return"<"==t?M(P(">"),re(ue,">"),A,pe):"|"==t||"."==e||"&"==t?M(ue):"["==e?M(ue,N("]"),pe):"extends"==t||"implements"==t?(w.marked="keyword",M(ue)):"?"==t?M(ue,N(":"),ue):void 0}function me(e,t){if("<"==t)return M(P(">"),re(ue,">"),A,pe)}function be(){return x(ue,ge)}function ge(e,t){if("="==t)return M(ue)}function ye(e,t){return"enum"==t?(w.marked="keyword",M(Ve)):x(ve,ae,we,xe)}function ve(e,t){return c&&C(t)?(w.marked="keyword",M(ve)):"variable"==e?(L(t),M()):"spread"==e?M(ve):"["==e?ie(ke,"]"):"{"==e?ie(_e,"}"):void 0}function _e(e,t){return"variable"!=e||w.stream.match(/^\s*:/,!1)?("variable"==e&&(w.marked="property"),"spread"==e?M(ve):"}"==e?x():"["==e?M(I,N("]"),N(":"),_e):M(N(":"),ve,we)):(L(t),M(we))}function ke(){return x(ve,we)}function we(e,t){if("="==t)return M(F)}function xe(e){if(","==e)return M(ye)}function Me(e,t){if("keyword b"==e&&"else"==t)return M(P("form","else"),R,A)}function Se(e,t){return"await"==t?M(Se):"("==e?M(P(")"),Le,A):void 0}function Le(e){return"var"==e?M(ye,Ce):"variable"==e?M(Ce):x(Ce)}function Ce(e,t){return")"==e?M():";"==e?M(Ce):"in"==t||"of"==t?(w.marked="keyword",M(I,Ce)):x(I,Ce)}function Ee(e,t){return"*"==t?(w.marked="keyword",M(Ee)):"variable"==e?(L(t),M(Ee)):"("==e?M(D,P(")"),re(De,")"),A,le,R,Y):c&&"<"==t?M(P(">"),re(be,">"),A,Ee):void 0}function Te(e,t){return"*"==t?(w.marked="keyword",M(Te)):"variable"==e?(L(t),M(Te)):"("==e?M(D,P(")"),re(De,")"),A,le,Y):c&&"<"==t?M(P(">"),re(be,">"),A,Te):void 0}function Oe(e,t){return"keyword"==e||"variable"==e?(w.marked="type",M(Oe)):"<"==t?M(P(">"),re(be,">"),A):void 0}function De(e,t){return"@"==t&&M(I,De),"spread"==e?M(De):c&&C(t)?(w.marked="keyword",M(De)):c&&"this"==e?M(ae,we):x(ve,ae,we)}function je(e,t){return"variable"==e?Ye(e,t):Pe(e,t)}function Ye(e,t){if("variable"==e)return L(t),M(Pe)}function Pe(e,t){return"<"==t?M(P(">"),re(be,">"),A,Pe):"extends"==t||"implements"==t||c&&","==e?("implements"==t&&(w.marked="keyword"),M(c?ue:I,Pe)):"{"==e?M(P("}"),Ae,A):void 0}function Ae(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||c&&C(t))&&w.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(w.marked="keyword",M(Ae)):"variable"==e||"keyword"==w.style?(w.marked="property",M(c?Ne:Ee,Ae)):"number"==e||"string"==e?M(c?Ne:Ee,Ae):"["==e?M(I,ae,N("]"),c?Ne:Ee,Ae):"*"==t?(w.marked="keyword",M(Ae)):c&&"("==e?x(Te,Ae):";"==e||","==e?M(Ae):"}"==e?M():"@"==t?M(I,Ae):void 0}function Ne(e,t){if("?"==t)return M(Ne);if(":"==e)return M(ue,we);if("="==t)return M(F);var n=w.state.lexical.prev;return x(n&&"interface"==n.info?Te:Ee)}function Re(e,t){return"*"==t?(w.marked="keyword",M(Be,N(";"))):"default"==t?(w.marked="keyword",M(I,N(";"))):"{"==e?M(re(He,"}"),Be,N(";")):x(R)}function He(e,t){return"as"==t?(w.marked="keyword",M(N("variable"))):"variable"==e?x(F,He):void 0}function Ie(e){return"string"==e?M():"("==e?x(I):x(Fe,ze,Be)}function Fe(e,t){return"{"==e?ie(Fe,"}"):("variable"==e&&L(t),"*"==t&&(w.marked="keyword"),M(We))}function ze(e){if(","==e)return M(Fe,ze)}function We(e,t){if("as"==t)return w.marked="keyword",M(Fe)}function Be(e,t){if("from"==t)return w.marked="keyword",M(I)}function Ue(e){return"]"==e?M():x(re(F,"]"))}function Ve(){return x(P("form"),ve,N("{"),P("}"),re(qe,"}"),A,A)}function qe(){return x(ve,we)}function Ze(e,t,n){return t.tokenize==m&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}return Y.lex=!0,A.lex=!0,{startState:function(e){var t={tokenize:m,lastType:"sof",cc:[],lexical:new _((e||0)-o,0,"block",!1),localVars:n.localVars,context:n.localVars&&new E(null,null,!1),indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),y(e,t)),t.tokenize!=b&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==r?n:(t.lastType="operator"!=r||"++"!=i&&"--"!=i?r:"incdec",function(e,t,n,r,i){var o=e.cc;for(w.state=e,w.stream=i,w.marked=null,w.cc=o,w.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():l?I:R)(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return w.marked?w.marked:"variable"==n&&k(e,r)?"variable-2":t}}(t,n,r,i,e))},indent:function(t,r){if(t.tokenize==b)return e.Pass;if(t.tokenize!=m)return 0;var i,s=r&&r.charAt(0),l=t.lexical;if(!/^\s*else\b/.test(r))for(var c=t.cc.length-1;c>=0;--c){var u=t.cc[c];if(u==A)l=l.prev;else if(u!=Me)break}for(;("stat"==l.type||"form"==l.type)&&("}"==s||(i=t.cc[t.cc.length-1])&&(i==U||i==V)&&!/^[,\.=+\-*:?[\(]/.test(r));)l=l.prev;a&&")"==l.type&&"stat"==l.prev.type&&(l=l.prev);var d=l.type,h=s==d;return"vardef"==d?l.indented+("operator"==t.lastType||","==t.lastType?l.info.length+1:0):"form"==d&&"{"==s?l.indented:"form"==d?l.indented+o:"stat"==d?l.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||f.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,r)?a||o:0):"switch"!=l.info||h||0==n.doubleIndentSwitch?l.align?l.column+(h?0:1):l.indented+(h?0:o):l.indented+(/^(?:case|default)\b/.test(r)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:l?null:"/*",blockCommentEnd:l?null:"*/",blockCommentContinue:l?null:" * ",lineComment:l?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:l?"json":"javascript",jsonldMode:s,jsonMode:l,expressionAllowed:Ze,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=I&&t!=F||e.cc.pop()}}})),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}(n(11))},function(e,t,n){!function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},n=e.Pos;function r(e,n){return"pairs"==n&&"string"==typeof e?e:"object"==typeof e&&null!=e[n]?e[n]:t[n]}e.defineOption("autoCloseBrackets",!1,(function(t,n,a){a&&a!=e.Init&&(t.removeKeyMap(i),t.state.closeBrackets=null),n&&(o(r(n,"pairs")),t.state.closeBrackets=n,t.addKeyMap(i))}));var i={Backspace:function(t){var i=s(t);if(!i||t.getOption("disableInput"))return e.Pass;for(var o=r(i,"pairs"),a=t.listSelections(),c=0;c=0;c--){var d=a[c].head;t.replaceRange("",n(d.line,d.ch-1),n(d.line,d.ch+1),"+delete")}},Enter:function(t){var n=s(t),i=n&&r(n,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var o=t.listSelections(),a=0;a1&&f.indexOf(i)>=0&&t.getRange(n(v.line,v.ch-2),v)==i+i){if(v.ch>2&&/\bstring/.test(t.getTokenTypeAt(n(v.line,v.ch-2))))return e.Pass;g="addFour"}else if(h){var k=0==v.ch?" ":t.getRange(n(v.line,v.ch-1),v);if(e.isWordChar(_)||k==i||e.isWordChar(k))return e.Pass;g="both"}else{if(!m||!(0===_.length||/\s/.test(_)||d.indexOf(_)>-1))return e.Pass;g="both"}else g=h&&c(t,v)?"both":f.indexOf(i)>=0&&t.getRange(v,n(v.line,v.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=g)return e.Pass}else u=g}var w=l%2?a.charAt(l-1):i,x=l%2?i:a.charAt(l+1);t.operation((function(){if("skip"==u)t.execCommand("goCharRight");else if("skipThree"==u)for(var r=0;r<3;r++)t.execCommand("goCharRight");else if("surround"==u){var i=t.getSelections();for(r=0;r0,{anchor:new n(o.anchor.line,o.anchor.ch+(a?-1:1)),head:new n(o.head.line,o.head.ch+(a?1:-1))});t.setSelections(i)}else"both"==u?(t.replaceSelection(w+x,null),t.triggerElectric(w+x),t.execCommand("goCharLeft")):"addFour"==u&&(t.replaceSelection(w+w+w+w,"before"),t.execCommand("goCharRight"));var o,a}))}(i,t)}}function s(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function l(e,t){var r=e.getRange(n(t.line,t.ch-1),n(t.line,t.ch+1));return 2==r.length?r:null}function c(e,t){var r=e.getTokenAt(n(t.line,t.ch+1));return/\bstring/.test(r.type)&&r.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}o(t.pairs+"`")}(n(11))},function(e,t,n){var r=n(13),i=n(372);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},function(e,t,n){(t=n(14)(!1)).push([e.i,'body,html{width:100%;height:100%;font-family:"Inter",sans-serif;-webkit-font-smoothing:antialiased}p,h1,h2,h3,h4,h5,h6,a,input,textarea,button{margin-block-end:unset;margin-block-start:unset;-webkit-margin-before:unset;-webkit-margin-after:unset;font-family:Inter,sans-serif}textarea,select,input,button{outline:none}.c-default{cursor:default}.mono{font-family:"Source Code Pro",monospace}.mix-blend-diff{mix-blend-mode:difference}@media all and (prefers-color-scheme: dark){body{background-color:#333}.bg-gray0-d{background-color:#333}.bg-gray1-d{background-color:#4d4d4d}.bg-gray2-d{background-color:#7f7f7f}.b--gray1-d{border-color:#4d4d4d}.white-d{color:#fff}.invert-d{filter:invert(1)}.hover-bg-gray1-d:hover{background-color:#4d4d4d}}',""]),e.exports=t},function(e,t){e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},function(e,t,n){var r={"./af":84,"./af.js":84,"./ar":85,"./ar-dz":86,"./ar-dz.js":86,"./ar-kw":87,"./ar-kw.js":87,"./ar-ly":88,"./ar-ly.js":88,"./ar-ma":89,"./ar-ma.js":89,"./ar-sa":90,"./ar-sa.js":90,"./ar-tn":91,"./ar-tn.js":91,"./ar.js":85,"./az":92,"./az.js":92,"./be":93,"./be.js":93,"./bg":94,"./bg.js":94,"./bm":95,"./bm.js":95,"./bn":96,"./bn.js":96,"./bo":97,"./bo.js":97,"./br":98,"./br.js":98,"./bs":99,"./bs.js":99,"./ca":100,"./ca.js":100,"./cs":101,"./cs.js":101,"./cv":102,"./cv.js":102,"./cy":103,"./cy.js":103,"./da":104,"./da.js":104,"./de":105,"./de-at":106,"./de-at.js":106,"./de-ch":107,"./de-ch.js":107,"./de.js":105,"./dv":108,"./dv.js":108,"./el":109,"./el.js":109,"./en-au":110,"./en-au.js":110,"./en-ca":111,"./en-ca.js":111,"./en-gb":112,"./en-gb.js":112,"./en-ie":113,"./en-ie.js":113,"./en-il":114,"./en-il.js":114,"./en-in":115,"./en-in.js":115,"./en-nz":116,"./en-nz.js":116,"./en-sg":117,"./en-sg.js":117,"./eo":118,"./eo.js":118,"./es":119,"./es-do":120,"./es-do.js":120,"./es-us":121,"./es-us.js":121,"./es.js":119,"./et":122,"./et.js":122,"./eu":123,"./eu.js":123,"./fa":124,"./fa.js":124,"./fi":125,"./fi.js":125,"./fil":126,"./fil.js":126,"./fo":127,"./fo.js":127,"./fr":128,"./fr-ca":129,"./fr-ca.js":129,"./fr-ch":130,"./fr-ch.js":130,"./fr.js":128,"./fy":131,"./fy.js":131,"./ga":132,"./ga.js":132,"./gd":133,"./gd.js":133,"./gl":134,"./gl.js":134,"./gom-deva":135,"./gom-deva.js":135,"./gom-latn":136,"./gom-latn.js":136,"./gu":137,"./gu.js":137,"./he":138,"./he.js":138,"./hi":139,"./hi.js":139,"./hr":140,"./hr.js":140,"./hu":141,"./hu.js":141,"./hy-am":142,"./hy-am.js":142,"./id":143,"./id.js":143,"./is":144,"./is.js":144,"./it":145,"./it-ch":146,"./it-ch.js":146,"./it.js":145,"./ja":147,"./ja.js":147,"./jv":148,"./jv.js":148,"./ka":149,"./ka.js":149,"./kk":150,"./kk.js":150,"./km":151,"./km.js":151,"./kn":152,"./kn.js":152,"./ko":153,"./ko.js":153,"./ku":154,"./ku.js":154,"./ky":155,"./ky.js":155,"./lb":156,"./lb.js":156,"./lo":157,"./lo.js":157,"./lt":158,"./lt.js":158,"./lv":159,"./lv.js":159,"./me":160,"./me.js":160,"./mi":161,"./mi.js":161,"./mk":162,"./mk.js":162,"./ml":163,"./ml.js":163,"./mn":164,"./mn.js":164,"./mr":165,"./mr.js":165,"./ms":166,"./ms-my":167,"./ms-my.js":167,"./ms.js":166,"./mt":168,"./mt.js":168,"./my":169,"./my.js":169,"./nb":170,"./nb.js":170,"./ne":171,"./ne.js":171,"./nl":172,"./nl-be":173,"./nl-be.js":173,"./nl.js":172,"./nn":174,"./nn.js":174,"./oc-lnc":175,"./oc-lnc.js":175,"./pa-in":176,"./pa-in.js":176,"./pl":177,"./pl.js":177,"./pt":178,"./pt-br":179,"./pt-br.js":179,"./pt.js":178,"./ro":180,"./ro.js":180,"./ru":181,"./ru.js":181,"./sd":182,"./sd.js":182,"./se":183,"./se.js":183,"./si":184,"./si.js":184,"./sk":185,"./sk.js":185,"./sl":186,"./sl.js":186,"./sq":187,"./sq.js":187,"./sr":188,"./sr-cyrl":189,"./sr-cyrl.js":189,"./sr.js":188,"./ss":190,"./ss.js":190,"./sv":191,"./sv.js":191,"./sw":192,"./sw.js":192,"./ta":193,"./ta.js":193,"./te":194,"./te.js":194,"./tet":195,"./tet.js":195,"./tg":196,"./tg.js":196,"./th":197,"./th.js":197,"./tl-ph":198,"./tl-ph.js":198,"./tlh":199,"./tlh.js":199,"./tr":200,"./tr.js":200,"./tzl":201,"./tzl.js":201,"./tzm":202,"./tzm-latn":203,"./tzm-latn.js":203,"./tzm.js":202,"./ug-cn":204,"./ug-cn.js":204,"./uk":205,"./uk.js":205,"./ur":206,"./ur.js":206,"./uz":207,"./uz-latn":208,"./uz-latn.js":208,"./uz.js":207,"./vi":209,"./vi.js":209,"./x-pseudo":210,"./x-pseudo.js":210,"./yo":211,"./yo.js":211,"./zh-cn":212,"./zh-cn.js":212,"./zh-hk":213,"./zh-hk.js":213,"./zh-mo":214,"./zh-mo.js":214,"./zh-tw":215,"./zh-tw.js":215};function i(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}i.keys=function(){return Object.keys(r)},i.resolve=o,e.exports=i,i.id=374},function(e,t,n){var r=n(13),i=n(376);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},function(e,t,n){(t=n(14)(!1)).push([e.i,'*{-webkit-font-smoothing:antialiased;-webkit-touch-callout:none}html,body{height:100%;width:100%;margin:0;padding:0;position:fixed}#root{height:100%;width:100%;margin:0;padding:0}p,h1,h2,h3,h4,h5,h6,a,input,textarea,button{margin-block-end:unset;margin-block-start:unset;-webkit-margin-before:unset;-webkit-margin-after:unset;font-family:Inter,sans-serif;padding:0}textarea,input,button{outline:none;-webkit-appearance:none;border:none;background-color:#fff}a{color:#000;font-weight:400;text-decoration:none}h2{font-weight:400}.inter{font-family:Inter,sans-serif}.clamp-3{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-webkit-line-clamp:2;-webkit-box-orient:vertical}.clamp-message{max-width:calc(100% - 36px - 1.5rem)}.clamp-attachment{overflow:auto;max-height:10em;max-width:100%}.lh-16{line-height:16px}.chat-md-message>pre{overflow-x:auto}.mono{font-family:"Source Code Pro",monospace}.bg-welcome-green{background-color:#ecf6f2}.list-ship{line-height:2.2}.c-default{cursor:default}.word-break-all{word-break:break-all}.focus-b--black:focus{border-color:#000}.mix-blend-diff{mix-blend-mode:difference}.placeholder-inter::placeholder{font-family:"Inter",sans-serif}.spin-active{animation:spin 2s infinite}@keyframes spin{0%{transform:rotate(0deg)}25%{transform:rotate(90deg)}50%{transform:rotate(180deg)}75%{transform:rotate(270deg)}100%{transform:rotate(360deg)}}.embed-container{position:relative;height:0;overflow:hidden;padding-bottom:28.125%}.embed-container iframe,.embed-container object,.embed-container embed{position:absolute;top:0;left:0;width:100%;height:100%}.mh-16{max-height:16rem}.toggle::after{content:"";height:12px;width:12px;background:#fff;position:absolute;top:2px;left:2px;border-radius:100%}.toggle.checked::after{content:"";height:12px;width:12px;background:#fff;position:absolute;top:2px;left:14px;border-radius:100%}.shadow-6{box-shadow:2px 4px 20px rgba(0,0,0,.25)}.brt2{border-radius:.25rem .25rem 0 0}.green3{color:#7ea899}.unread-notice{top:48px}@media all and (max-width: 34.375em){.dn-s{display:none}.flex-basis-full-s{flex-basis:100%}.h-100-minus-96-s{height:calc(100% - 96px)}.embed-container{padding-bottom:56.25%}.unread-notice{top:96px}}@media all and (min-width: 34.375em)and (max-width: 46.875em){.flex-basis-250-m{flex-basis:250px}.embed-container{padding-bottom:56.25%}}@media all and (min-width: 46.875em)and (max-width: 60em){.flex-basis-250-l{flex-basis:250px}.embed-container{padding-bottom:37.5%}}@media all and (min-width: 60em){.flex-basis-250-xl{flex-basis:250px}}blockquote{padding-left:24px;padding-top:8px;padding-bottom:8px;margin-left:0;margin-right:0;margin-top:8px;margin-bottom:8px;border-left:1px solid #000}:root{--dark-gray: #555555;--gray: #7F7F7F;--medium-gray: #CCCCCC;--light-gray: rgba(0,0,0,0.08)}.chat .react-codemirror2{width:100%}.chat .CodeMirror{height:100% !important;width:100% !important;cursor:text}.chat .CodeMirror *{font-family:"Inter"}.chat .CodeMirror.cm-s-code.chat .cm-s-tlon *{font-family:"Source Code Pro"}.chat .CodeMirror-selected{background:#bae3fe !important;color:#000}pre.CodeMirror-placeholder.CodeMirror-line-like{color:var(--gray)}.chat .cm-s-tlon span{font-family:"Inter"}.chat .cm-s-tlon span.cm-meta{color:var(--gray)}.chat .cm-s-tlon span.cm-number{color:var(--gray)}.chat .cm-s-tlon span.cm-keyword{line-height:1em;font-weight:bold;color:var(--gray)}.chat .cm-s-tlon span.cm-atom{font-weight:bold;color:var(--gray)}.chat .cm-s-tlon span.cm-def{color:#000}.chat .cm-s-tlon span.cm-variable{color:#000}.chat .cm-s-tlon span.cm-variable-2{color:#000}.chat .cm-s-tlon span.cm-variable-3,.chat .cm-s-tlon span.cm-type{color:#000}.chat .cm-s-tlon span.cm-property{color:#000}.chat .cm-s-tlon span.cm-operator{color:#000}.chat .cm-s-tlon span.cm-comment{font-family:"Source Code Pro";color:#000;background-color:var(--light-gray);display:inline-block;border-radius:2px}.chat .cm-s-tlon span.cm-string{color:var(--dark-gray)}.chat .cm-s-tlon span.cm-string-2{color:var(--gray)}.chat .cm-s-tlon span.cm-qualifier{color:#555}.chat .cm-s-tlon span.cm-error{color:red}.chat .cm-s-tlon span.cm-attribute{color:var(--gray)}.chat .cm-s-tlon span.cm-tag{color:var(--gray)}.chat .cm-s-tlon span.cm-link{color:var(--dark-gray);text-decoration:none}.chat .cm-s-tlon .CodeMirror-activeline-background{background:var(--gray)}.chat .cm-s-tlon .CodeMirror-cursor{border-left:2px solid #3687ff}.chat .cm-s-tlon span.cm-builtin{color:var(--gray)}.chat .cm-s-tlon span.cm-bracket{color:var(--gray)}.chat .cm-s-tlon .CodeMirror-matchingbracket{outline:1px solid gray;color:#000 !important}.chat .CodeMirror-hints.tlon{color:#616569;background-color:#ebf3fd !important}.chat .CodeMirror-hints.tlon .CodeMirror-hint-active{background-color:#a2b8c9 !important;color:#5c6065 !important}.title-input[placeholder]:empty:before{content:attr(placeholder);color:#7f7f7f}@media(prefers-color-scheme: dark){body{background-color:#333}.bg-black-d{background-color:#000}.white-d{color:#fff}.gray1-d{color:#4d4d4d}.gray2-d{color:#7f7f7f}.gray3-d{color:#b1b2b3}.gray4-d{color:#e6e6e6}.bg-gray0-d{background-color:#333}.bg-gray1-d{background-color:#4d4d4d}.b--gray0-d{border-color:#333}.b--gray1-d{border-color:#4d4d4d}.b--gray2-d{border-color:#7f7f7f}.b--white-d{border-color:#fff}.b--green2-d{border-color:#2aa779}.bb-d{border-bottom-width:1px;border-bottom-style:solid}.invert-d{filter:invert(1)}.o-80-d{opacity:.8}.focus-b--white-d:focus{border-color:#fff}a{color:#fff}.hover-bg-gray1-d:hover{background-color:#4d4d4d}blockquote{border-left:1px solid #fff}.contrast-10-d{filter:contrast(0.1)}.bg-none-d{background:none}.chat .cm-s-tlon.CodeMirror{background:#333;color:#fff}.chat .cm-s-tlon span.cm-def{color:#fff}.chat .cm-s-tlon span.cm-variable{color:#fff}.chat .cm-s-tlon span.cm-variable-2{color:#fff}.chat .cm-s-tlon span.cm-variable-3,.chat .cm-s-tlon span.cm-type{color:#fff}.chat .cm-s-tlon span.cm-property{color:#fff}.chat .cm-s-tlon span.cm-operator{color:#fff}.chat .cm-s-tlon span.cm-string{color:var(--gray)}.chat .cm-s-tlon span.cm-string-2{color:var(--gray)}.chat .cm-s-tlon span.cm-attribute{color:var(--gray)}.chat .cm-s-tlon span.cm-tag{color:var(--gray)}.chat .cm-s-tlon span.cm-link{color:var(--gray)}.chat .CodeMirror-selected{background:var(--medium-gray) !important;color:#fff}.chat .cm-s-tlon span.cm-comment{color:#000;display:inline-block;padding:0;background-color:rgba(255,255,255,.3);border-radius:2px}}',""]),e.exports=t},function(e,t,n){(function(t){const r=n(54),i=n(382),o=n(383),a=n(217),s=new r(0),l=new r(1),c=new r(2),u=new r(3),d=new r(4),f=new r(5),h="\nzodnecbudwessevpersutletfulpensytdurwepserwylsunrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnexlunmeplutseppesdelsulpedtemledtulmetwenbynhexfebpyldulhetmevruttylwydtepbesdexsefwycburderneppurrysrebdennutsubpetrulsynregtydsupsemwynrecmegnetsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsymselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpelsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmedlytdusnebrumtynseglyxpunresredfunrevrefmectedrusbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermertenlusnussyltecmexpubrymtucfyllepdebbermughuttunbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmylwedducfurfexnulluclennerlexrupnedlecrydlydfenwelnydhusrelrudneshesfetdesretdunlernyrsebhulrylludremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmunlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes",p=e=>e.replace(/[\^~-]/g,"").match(/.{1,3}/g)||[],m="\ndozmarbinwansamlitsighidfidlissogdirwacsabwissibrigsoldopmodfoglidhopdardorlorhodfolrintogsilmirholpaslacrovlivdalsatlibtabhanticpidtorbolfosdotlosdilforpilramtirwintadbicdifrocwidbisdasmidloprilnardapmolsanlocnovsitnidtipsicropwitnatpanminritpodmottamtolsavposnapnopsomfinfonbanmorworsipronnorbotwicsocwatdolmagpicdavbidbaltimtasmalligsivtagpadsaldivdactansidfabtarmonranniswolmispallasdismaprabtobrollatlonnodnavfignomnibpagsopralbilhaddocridmocpacravripfaltodtiltinhapmicfanpattaclabmogsimsonpinlomrictapfirhasbosbatpochactidhavsaplindibhosdabbitbarracparloddosbortochilmactomdigfilfasmithobharmighinradmashalraglagfadtopmophabnilnosmilfopfamdatnoldinhatnacrisfotribhocnimlarfitwalrapsarnalmoslandondanladdovrivbacpollaptalpitnambonrostonfodponsovnocsorlavmatmipfip".match(/.{1,3}/g),b=h.match(/.{1,3}/g),g=e=>c.pow(e),y=(e,t,n)=>n.div(g(g(e).mul(t))),v=(e,t,n=s)=>t.eq(s)?n:v(e,y(e,l,t),n.add(l)),_=(e,t,n)=>n.mod(g(g(e).mul(t))),k=e=>{if(!1===T(e))throw new Error("patp2hex: not a valid @p");const t=p(e),n=e=>e.toString(2).padStart(8,"0"),i=t.reduce((e,r,i)=>i%2!=0||1===t.length?e+n(b.indexOf(r)):e+n(m.indexOf(r)),""),o=new r(i,2),s=a.fynd(o).toString("hex");return s.length%2!=0?s.padStart(s.length+1,"0"):s},w=e=>new r(k(e),"hex"),x=e=>{let t;try{t=w(e)}catch(e){throw new Error("patp2dec: not a valid @p")}return t.toString()},M=e=>{const n=new r(e).toArrayLike(t);return S(n)},S=e=>{const t=e.length%2!=0&&e.length>1?[[e[0]]].concat(i(e.slice(1),2)):i(e,2),n=e=>{return e.length%2!=0&&t.length>1?void 0===(n=e)[1]?m[0]+b[n[0]]:m[n[0]]+b[n[1]]:(e=>void 0===e[1]?b[e[0]]:m[e[0]]+b[e[1]])(e);var n};return t.reduce((e,t)=>e+("~"===e?"":"-")+n(t),"~")},L=e=>{if(!1===T(e))throw new Error("patq2hex: not a valid @q");const t=e.slice(1).split("-"),n=e=>e.toString(16).padStart(2,"0"),r=t.map(e=>{let t=(r=3,[(i=e).slice(0,r),i.slice(r)]);var r,i;return""===t[1]?n(b.indexOf(t[0])):n(m.indexOf(t[0]))+n(b.indexOf(t[1]))});return 0===e.length?"00":r.join("")},C=e=>{let t;try{t=(e=>new r(L(e),"hex"))(e)}catch(e){throw new Error("patq2dec: not a valid @q")}return t.toString()},E=e=>{let t;try{t=w(e)}catch(e){throw new Error("clan: not a valid @p")}const n=v(u,t);return n.lte(l)?"galaxy":n.eq(c)?"star":n.lte(d)?"planet":n.lte(new r(8))?"moon":"comet"},T=e=>{if("string"!=typeof e)throw new Error("isValidPat: non-string input");if(!1===("~"===e.slice(0,1))||e.length<4)return!1;{const t=p(e),n=t.length%2!=0&&1!==t.length,r=t.reduce((e,n,r)=>e&&(r%2!=0||1===t.length?b.includes(n):m.includes(n)),!0);return!n&&r}},O=e=>"00"===e.slice(0,2)?O(e.slice(2)):e,D=(e,t)=>{let n,r;try{n=L(e)}catch(e){throw new Error("eqPatq: not a valid @q")}try{r=L(t)}catch(e){throw new Error("eqPatq: not a valid @q")}return i=r,o(O(n),O(i));var i},j=e=>{const t=new r(e),n=a.fein(t),i=v(d,n),o=(e,t,n)=>{const r=_(d,l,e),a=m[y(u,l,r)]+b[_(u,l,r)]+(t.mod(d).eq(s)?t.eq(s)?"":"--":"-")+n;return t.eq(i)?n:o(y(d,l,e),t.add(l),a)};return"~"+(v(u,n).lte(l)?b[n]:o(n,s,""))};e.exports={patp:j,patp2hex:k,hex2patp:e=>j(new r(e,"hex")),patp2dec:x,sein:e=>{let t,n;try{t=w(e)}catch(e){throw new Error("sein: not a valid @p")}try{n=E(e)}catch(e){throw new Error("sein: not a valid @p")}const r="galaxy"===n?t:"star"===n?_(u,l,t):"planet"===n?_(d,l,t):"moon"===n?_(f,l,t):s;return j(r)},clan:E,patq:M,patq2hex:L,hex2patq:e=>{const n=e.length%2!=0?e.padStart(e.length+1,"0"):e,r=t.from(n,"hex");return S(r)},patq2dec:C,eqPatq:D,isValidPat:T,isValidPatp:e=>T(e)&&e===j(x(e)),isValidPatq:e=>T(e)&&D(e,M(C(e)))}}).call(this,n(216).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),a=r[0],s=r[1],l=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),u=0,d=s>0?a-4:a;for(n=0;n>16&255,l[u++]=t>>8&255,l[u++]=255&t;2===s&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[u++]=255&t);1===s&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t);return l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,s=n-i;as?s:a+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,n){for(var i,o,a=[],s=t;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<>1,u=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-u)-1,h>>=-u,u+=s;u>0;o=256*o+e[t+d],d+=f,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+d],d+=f,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=c}return(h?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,u=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?f/l:f*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=u?(s=0,a=u):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,c-=8);e[n+h-p]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=/^(?:0|[1-9]\d*)$/,s=parseInt,l=Object.prototype.toString,c=Math.ceil,u=Math.max;function d(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r-1&&e%1==0&&e<=9007199254740991}(e.length)&&!function(e){var t=h(e)?l.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)}(n)&&function(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||a.test(e))&&e>-1&&e%1==0&&es))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var u=-1,d=!0,f=2&n?new oe:void 0;for(o.set(e,t),o.set(t,e);++u-1},re.prototype.set=function(e,t){var n=this.__data__,r=le(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ie.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(U||re),string:new ne}},ie.prototype.delete=function(e){var t=be(this,e).delete(e);return this.size-=t?1:0,t},ie.prototype.get=function(e){return be(this,e).get(e)},ie.prototype.has=function(e){return be(this,e).has(e)},ie.prototype.set=function(e,t){var n=be(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},oe.prototype.add=oe.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},oe.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.clear=function(){this.__data__=new re,this.size=0},ae.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ae.prototype.get=function(e){return this.__data__.get(e)},ae.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.set=function(e,t){var n=this.__data__;if(n instanceof re){var r=n.__data__;if(!U||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ie(r)}return n.set(e,t),this.size=n.size,this};var ye=F?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}function Ee(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Te(e){return null!=e&&"object"==typeof e}var Oe=y?function(e){return function(t){return e(t)}}(y):function(e){return Te(e)&&Ce(e.length)&&!!c[ce(e)]};function De(e){return null!=(t=e)&&Ce(t.length)&&!Le(t)?se(e):he(e);var t}n.exports=function(e,t){return de(e,t)}}).call(this,n(19),n(31)(e))},function(e,t,n){const r=n(54),i=new r(255),o=new r(65280),a=new r(256),s=(e,t)=>{let n,r,i,o,a,s,l,c;for(n=3&e.length,r=e.length-n,i=t,a=3432918353,s=461845907,c=0;c>>16)*a&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,i^=l,i=i<<13|i>>>19,o=5*(65535&i)+((5*(i>>>16)&65535)<<16)&4294967295,i=27492+(65535&o)+((58964+(o>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:l^=255&e.charCodeAt(c),l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,i^=l}return i^=e.length,i^=i>>>16,i=2246822507*(65535&i)+((2246822507*(i>>>16)&65535)<<16)&4294967295,i^=i>>>13,i=3266489909*(65535&i)+((3266489909*(i>>>16)&65535)<<16)&4294967295,i^=i>>>16,i>>>0};e.exports={muk:(e,t,n)=>{const l=n.and(i).toNumber(),c=n.and(o).div(a).toNumber(),u=String.fromCharCode(l)+String.fromCharCode(c);return new r(s(u,e))}}},function(e,t,n){(function(t){var n=function(){"use strict";function e(e,t){return null!=t&&e instanceof t}var n,r,i;try{n=Map}catch(e){n=function(){}}try{r=Set}catch(e){r=function(){}}try{i=Promise}catch(e){i=function(){}}function o(a,l,c,u,d){"object"==typeof l&&(c=l.depth,u=l.prototype,d=l.includeNonEnumerable,l=l.circular);var f=[],h=[],p=void 0!==t;return void 0===l&&(l=!0),void 0===c&&(c=1/0),function a(c,m){if(null===c)return null;if(0===m)return c;var b,g;if("object"!=typeof c)return c;if(e(c,n))b=new n;else if(e(c,r))b=new r;else if(e(c,i))b=new i((function(e,t){c.then((function(t){e(a(t,m-1))}),(function(e){t(a(e,m-1))}))}));else if(o.__isArray(c))b=[];else if(o.__isRegExp(c))b=new RegExp(c.source,s(c)),c.lastIndex&&(b.lastIndex=c.lastIndex);else if(o.__isDate(c))b=new Date(c.getTime());else{if(p&&t.isBuffer(c))return b=t.allocUnsafe?t.allocUnsafe(c.length):new t(c.length),c.copy(b),b;e(c,Error)?b=Object.create(c):void 0===u?(g=Object.getPrototypeOf(c),b=Object.create(g)):(b=Object.create(u),g=u)}if(l){var y=f.indexOf(c);if(-1!=y)return h[y];f.push(c),h.push(b)}for(var v in e(c,n)&&c.forEach((function(e,t){var n=a(t,m-1),r=a(e,m-1);b.set(n,r)})),e(c,r)&&c.forEach((function(e){var t=a(e,m-1);b.add(t)})),c){var _;g&&(_=Object.getOwnPropertyDescriptor(g,v)),_&&null==_.set||(b[v]=a(c[v],m-1))}if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(c);for(v=0;vspan::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:none}',""]),e.exports=t},function(e,t,n){var r=n(13),i=n(390);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},function(e,t,n){(t=n(14)(!1)).push([e.i,"input#dojo{background-color:inherit;color:inherit}@media all and (max-width: 34.375em){.h-100-m40-s{height:calc(100% - 40px)}}",""]),e.exports=t},function(e,t,n){var r=n(13),i=n(392);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},function(e,t,n){(t=n(14)(!1)).push([e.i,".c-default{cursor:default}.m0a{margin:0 auto}@media all and (max-width: 34.375em){.dn-s{display:none}.flex-basis-100-s{flex-basis:100%}}@media all and (min-width: 34.375em){.db-ns{display:block}.flex-basis-30-ns{flex-basis:30vw}}@media all and (prefers-color-scheme: dark){.o-60-d{opacity:.6}}",""]),e.exports=t},function(e,t,n){var r=n(13),i=n(394);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},function(e,t,n){(t=n(14)(!1)).push([e.i,".links.embed-container{position:relative;height:0;overflow:hidden;padding-bottom:56.25%}.links.embed-container iframe,.links.embed-container object,.links.embed-container embed{position:absolute;top:0;left:0;width:100%;height:100%}@media all and (max-width: 34.375em){.dn-s{display:none}.flex-basis-100-s,.flex-basis-full-s{flex-basis:100%}}@media all and (min-width: 34.375em){.db-ns{display:block}.flex-basis-30-ns{flex-basis:30vw}}",""]),e.exports=t},function(e,t,n){var r=n(13),i=n(396);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},function(e,t,n){(t=n(14)(!1)).push([e.i,':root{--dark-gray: #555555;--gray: #7F7F7F;--medium-gray: #CCCCCC;--light-gray: rgba(0,0,0,0.08)}.bg-welcome-green{background-color:#ecf6f2}@media all and (max-width: 34.375em){.dn-s{display:none}.flex-basis-100-s,.flex-basis-full-s{flex-basis:100%}.h-100-m-40-s{height:calc(100% - 40px)}.black-s{color:#000}}@media all and (min-width: 34.375em){.db-ns{display:block}.flex-basis-250-ns{flex-basis:250px}.h-100-m-40-ns{height:calc(100% - 40px)}}.bg-light-green{background:rgba(42,167,121,.1)}.NotebookButton{border-radius:2px;cursor:pointer}.NewPost{width:100%;height:calc(100vh - 184px);display:flex;padding-top:8px}.EditPost{width:100%;height:calc(100vh - 120px);display:flex;padding-top:8px}.placeholder-inter::placeholder{font-family:"Inter",sans-serif}.publish .react-codemirror2{width:100%}.publish .CodeMirror{padding:12px;height:100% !important;max-width:700px;width:100% !important;cursor:text;font-size:12px;line-height:20px}.publish .CodeMirror *{font-family:"Source Code Pro"}.publish .CodeMirror-selected{background:#bae3fe !important;color:#000}.publish .cm-s-tlon span{font-family:"Source Code Pro"}.publish .cm-s-tlon span.cm-meta{color:var(--gray)}.publish .cm-s-tlon span.cm-number{color:var(--gray)}.publish .cm-s-tlon span.cm-keyword{line-height:1em;font-weight:bold;color:var(--gray)}.publish .cm-s-tlon span.cm-atom{font-weight:bold;color:var(--gray)}.publish .cm-s-tlon span.cm-def{color:#000}.publish .cm-s-tlon span.cm-variable{color:#000}.publish .cm-s-tlon span.cm-variable-2{color:#000}.publish .cm-s-tlon span.cm-variable-3,.publish .cm-s-tlon span.cm-type{color:#000}.publish .cm-s-tlon span.cm-property{color:#000}.publish .cm-s-tlon span.cm-operator{color:#000}.publish .cm-s-tlon span.cm-comment{color:#000;background-color:var(--light-gray);display:inline-block;border-radius:2px}.publish .cm-s-tlon span.cm-string{color:var(--dark-gray)}.publish .cm-s-tlon span.cm-string-2{color:var(--gray)}.publish .cm-s-tlon span.cm-qualifier{color:#555}.publish .cm-s-tlon span.cm-error{color:red}.publish .cm-s-tlon span.cm-attribute{color:var(--gray)}.publish .cm-s-tlon span.cm-tag{color:var(--gray)}.publish .cm-s-tlon span.cm-link{color:var(--dark-gray);text-decoration:none}.publish .cm-s-tlon .CodeMirror-activeline-background{background:var(--gray)}.publish .cm-s-tlon .CodeMirror-cursor{border-left:2px solid #3687ff}.publish .cm-s-tlon span.cm-builtin{color:var(--gray)}.publish .cm-s-tlon span.cm-bracket{color:var(--gray)}.publish .cm-s-tlon .CodeMirror-matchingbracket{outline:1px solid gray;color:#000 !important}.publish .CodeMirror-hints.tlon{color:#616569;background-color:#ebf3fd !important}.publish .CodeMirror-hints.tlon .CodeMirror-hint-active{background-color:#a2b8c9 !important;color:#5c6065 !important}.title-input[placeholder]:empty:before{content:attr(placeholder);color:#7f7f7f}.options.open{background-color:#e6e6e6}.options.closed{background-color:#fff}.options::after{content:"⌃";transform:rotate(180deg);position:absolute;right:8px;top:4px;color:#7f7f7f}[contenteditable]:focus{outline:0px solid transparent}.dropdown::after{content:"⌃";transform:rotate(180deg);position:absolute;right:8px;top:16px;color:#7f7f7f}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.no-scrollbar::-webkit-scrollbar{display:none}.md h1,.md h2,.md h3,.md h4,.md h5,.md p,.md a,.md ul,.md ol,.md blockquote,.md code,.md pre{font-size:14px;margin-bottom:16px}.md h2,.md h3,.md h4,.md h5,.md p,.md a,.md ul{font-weight:400}.md h1{font-weight:600}.md h2,.md h3,.md h4,.md h5{color:var(--gray)}.md p{line-height:1.5}.md code,.md pre{font-family:"Source Code Pro",mono}.md ul>li,.md ol>li{line-height:1.5}.md a{border-bottom-style:solid;border-bottom-width:1px}md img{margin-bottom:8px}@media all and (prefers-color-scheme: dark){body{background-color:#333}.bg-black-d{background-color:#000}.white-d{color:#fff}.gray1-d{color:#4d4d4d}.gray2-d{color:#7f7f7f}.gray3-d{color:#b1b2b3}.gray4-d{color:#e6e6e6}.bg-gray0-d{background-color:#333}.bg-gray1-d{background-color:#4d4d4d}.b--gray0-d{border-color:#333}.b--gray1-d{border-color:#4d4d4d}.b--gray2-d{border-color:#7f7f7f}.b--white-d{border-color:#fff}.invert-d{filter:invert(1)}.o-60-d{opacity:.6}a{color:#fff}.focus-b--white-d:focus{border-color:#fff}.hover-bg-gray1-d:hover{background-color:#4d4d4d}.options.open{background-color:#4d4d4d}.options.closed{background-color:#333}.publish .cm-s-tlon.CodeMirror{background:#333;color:#fff}.publish .cm-s-tlon span.cm-def{color:#fff}.publish .cm-s-tlon span.cm-variable{color:#fff}.publish .cm-s-tlon span.cm-variable-2{color:#fff}.publish .cm-s-tlon span.cm-variable-3,.publish .cm-s-tlon span.cm-type{color:#fff}.publish .cm-s-tlon span.cm-property{color:#fff}.publish .cm-s-tlon span.cm-operator{color:#fff}.publish .cm-s-tlon span.cm-string{color:var(--gray)}.publish .cm-s-tlon span.cm-string-2{color:var(--gray)}.publish .cm-s-tlon span.cm-attribute{color:var(--gray)}.publish .cm-s-tlon span.cm-tag{color:var(--gray)}.publish .cm-s-tlon span.cm-link{color:var(--gray)}.publish .CodeMirror-selected{background:var(--medium-gray) !important;color:#fff}.publish .cm-s-tlon span.cm-comment{color:#000;display:inline-block;padding:0;background-color:rgba(255,255,255,.3);border-radius:2px}}',""]),e.exports=t},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r),o=n(32);function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var s=n(17),l=n.n(s);function c(){return(c=Object.assign||function(e){for(var t=1;t=0;f--){var h=i[f];"."===h?d(i,f):".."===h?(d(i,f),c++):c&&(d(i,f),c--)}if(!s)for(;c--;c)i.unshift("..");!s||""===i[0]||i[0]&&u(i[0])||i.unshift("");var p=i.join("/");return n&&"/"!==p.substr(-1)&&(p+="/"),p};var h=function(e,t){if(!e)throw new Error("Invariant failed")};function p(e){return"/"===e.charAt(0)?e:"/"+e}function m(e){return"/"===e.charAt(0)?e.substr(1):e}function b(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function g(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function y(e){var t=e.pathname,n=e.search,r=e.hash,i=t||"/";return n&&"?"!==n&&(i+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(i+="#"===r.charAt(0)?r:"#"+r),i}function v(e,t,n,r){var i;"string"==typeof e?(i=function(e){var t=e||"/",n="",r="",i=t.indexOf("#");-1!==i&&(r=t.substr(i),t=t.substr(0,i));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e)).state=t:(void 0===(i=c({},e)).pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==t&&void 0===i.state&&(i.state=t));try{i.pathname=decodeURI(i.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+i.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n&&(i.key=n),r?i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=f(i.pathname,r.pathname)):i.pathname=r.pathname:i.pathname||(i.pathname="/"),i}function _(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,i){if(null!=e){var o="function"==typeof e?e(t,n):e;"string"==typeof o?"function"==typeof r?r(o,i):i(!0):i(!1!==o)}else i(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,r):n.push(r),d({action:"PUSH",location:r,index:t,entries:n})}}))},replace:function(e,t){var r=v(e,t,f(),g.location);u.confirmTransitionTo(r,"REPLACE",n,(function(e){e&&(g.entries[g.index]=r,d({action:"REPLACE",location:r}))}))},go:b,goBack:function(){b(-1)},goForward:function(){b(1)},canGo:function(e){var t=g.index+e;return t>=0&&t=0||(i[n]=e[n]);return i}var z=n(18),W=n.n(z),B=function(e){var t=R();return t.displayName=e,t}("Router"),U=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._isMounted?n.setState({location:e}):n._pendingLocation=e}))),n}a(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&this.unlisten()},n.render=function(){return i.a.createElement(B.Provider,{children:this.props.children||null,value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}})},t}(i.a.Component);i.a.Component;i.a.Component;var V={},q=0;function Z(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var n=t,r=n.path,i=n.exact,o=void 0!==i&&i,a=n.strict,s=void 0!==a&&a,l=n.sensitive,c=void 0!==l&&l;return[].concat(r).reduce((function(t,n){if(!n&&""!==n)return null;if(t)return t;var r=function(e,t){var n=""+t.end+t.strict+t.sensitive,r=V[n]||(V[n]={});if(r[e])return r[e];var i=[],o={regexp:I()(e,i,t),keys:i};return q<1e4&&(r[e]=o,q++),o}(n,{end:o,strict:s,sensitive:c}),i=r.regexp,a=r.keys,l=i.exec(e);if(!l)return null;var u=l[0],d=l.slice(1),f=e===u;return o&&!f?null:{path:n,url:"/"===n&&""===u?"/":u,isExact:f,params:a.reduce((function(e,t,n){return e[t.name]=d[n],e}),{})}}),null)}var G=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.render=function(){var e=this;return i.a.createElement(B.Consumer,null,(function(t){t||h(!1);var n=e.props.location||t.location,r=c({},t,{location:n,match:e.props.computedMatch?e.props.computedMatch:e.props.path?Z(n.pathname,e.props):t.match}),o=e.props,a=o.children,s=o.component,l=o.render;return Array.isArray(a)&&0===a.length&&(a=null),i.a.createElement(B.Provider,{value:r},r.match?a?"function"==typeof a?a(r):a:s?i.a.createElement(s,r):l?l(r):null:"function"==typeof a?a(r):null)}))},t}(i.a.Component);function $(e){return"/"===e.charAt(0)?e:"/"+e}function J(e,t){if(!e)return t;var n=$(e);return 0!==t.pathname.indexOf(n)?t:c({},t,{pathname:t.pathname.substr(n.length)})}function K(e){return"string"==typeof e?e:y(e)}function X(e){return function(){h(!1)}}function Q(){}i.a.Component;var ee=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.render=function(){var e=this;return i.a.createElement(B.Consumer,null,(function(t){t||h(!1);var n,r,o=e.props.location||t.location;return i.a.Children.forEach(e.props.children,(function(e){if(null==r&&i.a.isValidElement(e)){n=e;var a=e.props.path||e.props.from;r=a?Z(o.pathname,c({},e.props,{path:a})):t.match}})),r?i.a.cloneElement(n,{location:o,computedMatch:r}):null}))},t}(i.a.Component);var te=i.a.useContext;function ne(){return te(B).location}var re=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n=10?e:"0"+e};return"~".concat(e.getUTCFullYear(),".")+"".concat(e.getUTCMonth()+1,".")+"".concat(n(e.getUTCDate()),"..")+"".concat(n(e.getUTCHours()),".")+"".concat(n(e.getUTCMinutes()),".")+"".concat(n(e.getUTCSeconds()))+"".concat(t?"..0000":"")}function _e(e){return e.replace("~","")}function ke(e){return e.length>2&&"0x"===e.substr(0,2)?e.substr(2).replace(".","").padStart(6,"0"):e.replace(".","").padStart(6,"0")}function we(e){var t="0123456789ABCDEF".split("");return e.reverse().reduce((function(n,r,i){var o=t.findIndex((function(e){return e===r.toUpperCase()}));if(o<0)throw console.error(e),new Error("Incorrect hex formatting");return n+o*Math.pow(16,i)}),0)}function xe(e){return new Promise((function(t,n){var r=document.createRange();r.selectNodeContents(document.body),document.getSelection().addRange(r);var i=!1;function o(t){t.clipboardData.setData("text/plain",e),t.preventDefault(),i=!0}document.addEventListener("copy",o),document.execCommand("copy"),document.removeEventListener("copy",o),document.getSelection().removeAllRanges(),i?t():n()})).catch((function(e){console.error(e)}))}function Me(e){var t=e;return t.startsWith("~")&&(t=t.substr(1)),56===t.length?"~"+t.slice(0,6)+"_"+t.slice(50,56):27===t.length?"~"+t.slice(14,20)+"^"+t.slice(21,27):"~".concat(t)}function Se(e){var t={};return Object.keys(e).sort((function(t,n){var r=t.substr(1),i=n.substr(1);return e[t].metadata&&e[t].metadata.title&&(r=""!==e[t].metadata.title?e[t].metadata.title:t.substr(1)),e[n].metadata&&e[n].metadata.title&&(i=""!==e[n].metadata.title?e[n].metadata.title:n.substr(1)),r.toLowerCase().localeCompare(i.toLowerCase())})).map((function(n){t[n]=e[n]})),t}function Le(e){return window.btoa(e).split("+").join("-").split("/").join("_")}function Ce(e){for(var t="",n=0;n=97&&o<=122||o>=48&&o<=57||"-"===r?r:"~"+o.toString(16)+"."}t+=i}return"~."+t}function Ee(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a="/~link"+(t?"/popout":"")+e;return r?(a="".concat(a,"/").concat(n,"/").concat(i,"/").concat(Le(r)),0!==o&&(a=a+"/"+o)):0!==n&&(a=a+"/"+n),a}function Te(e){if(!e)return!1;var t=/(\/~)?\/~([a-z-]{3,})\/.*/.exec(e)[2];return window.ship===t}function Oe(e){var t=!e;return{nickname:(e=e||{nickname:"",avatar:null,color:"0x0"}).nickname||"",color:ke(e.color||"0x0"),member:t,avatar:e.avatar||null}}function De(e){for(var t="",n=0;n=97&&r<=122||r>=48&&r<=57?e[n]:r>=65&&r<=90?String.fromCharCode(r+32):"-"}return""===(t=(t=t.replace(/^[\-\d]+|\-+/g,"-")).replace(/^\-+|\-+$/g,""))?ve(new Date):t}function je(e){return function(e){if(Array.isArray(e))return Ye(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ye(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ye(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:this.ship,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;this.bindPaths=me.a.uniq([].concat(je(this.bindPaths),[e])),window.subscriptionId=this.channel.subscribe(n,r,e,(function(e){o(e)}),(function(t){i({data:t,from:{ship:n,path:e}})}),(function(e){a(e)}))}},{key:"action",value:function(e,t,n){var r=this;return new Promise((function(i,o){r.channel.poke(window.ship,e,t,n,(function(e){i(e)}),(function(e){o(e)}))}))}}])&&Pe(t.prototype,n),r&&Pe(t,r),e}();function Ne(e){return(Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function He(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{basic:{title:"",linkedUrl:"",iconUrl:""}};this.launchAction({add:{name:e,tile:t}})}},{key:"launchRemove",value:function(e){this.launchAction({remove:e})}},{key:"launchChangeOrder",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.launchAction({"change-order":e})}},{key:"launchChangeFirstTime",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.launchAction({"change-first-time":e})}},{key:"launchChangeIsShown",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.launchAction({"change-is-shown":{name:e,isShown:t}})}},{key:"weatherAction",value:function(e){this.action("weather","json",e)}}])&&He(t.prototype,n),r&&He(t,r),o}(Ae),Ue=function e(t,n,r){Re(this,e);var i=new Be(t,n,r);this.ship=t,this.subscribe=i.subscribe.bind(i),this.launch={add:i.launchAdd.bind(i),remove:i.launchRemove.bind(i),changeOrder:i.launchChangeOrder.bind(i),changeFirstTime:i.launchChangeFirstTime.bind(i),changeIsShown:i.launchChangeIsShown.bind(i)},this.weather=i.weatherAction.bind(i)};function Ve(e,t){for(var n=0;non(t.sunriseEnd,t.nightEnd)&&an(this.angle)1&&void 0!==arguments[1]?arguments[1]:{gradient1:"white",gradient2:"white",text:"black"};return i.a.createElement(kt,null,i.a.createElement("div",{className:"relative "+t.text,style:{width:126,height:126,background:"linear-gradient(135deg, ".concat(t.gradient1," 0%,")+"".concat(t.gradient2," 45%, ").concat(t.gradient2," 65%,")+"".concat(t.gradient1," 100%)")}},e))}},{key:"renderManualEntry",value:function(){var e,t,n=this;return!0===this.state.error&&(t=i.a.createElement("p",{className:"f9 red2 pt1"},"Please try again.")),"https:"===location.protocol&&(e=i.a.createElement("a",{className:"black white-d f9 absolute pointer",style:{right:8,top:8},onClick:function(){return n.locationSubmit()}},"Detect ->")),this.renderWrapper(i.a.createElement("div",{className:"pa2 w-100 h-100 bg-white bg-gray0-d black white-d b--black b--gray1-d ba"},i.a.createElement("a",{className:"f9 black white-d pointer absolute",style:{top:8},onClick:function(){return n.setState({manualEntry:!n.state.manualEntry})}},"<-"),e,i.a.createElement("p",{className:"f9 pt5"},"Please enter your"," ",i.a.createElement("a",{className:"black bb white-d",href:"https://latitudeandlongitude.org/",target:"_blank"},"latitude and longitude"),"."),t,i.a.createElement("div",{className:"absolute",style:{left:8,bottom:8}},i.a.createElement("form",{className:"flex",style:{marginBlockEnd:0}},i.a.createElement("input",{id:"gps",className:"w-100 black white-d bg-transparent bn f9",type:"text",placeholder:"29.558107, -95.089023",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),n.manualLocationSubmit(e.target.value))}}),i.a.createElement("input",{className:"bg-transparent black white-d bn pointer f9 flex-shrink-0 pr1",type:"submit",onClick:function(){return n.manualLocationSubmit()},value:"->"})))))}},{key:"renderNoData",value:function(){var e=this;return this.renderWrapper(i.a.createElement("div",{className:"pa2 w-100 h-100 b--black b--gray1-d ba bg-white bg-gray0-d black white-d",onClick:function(){return e.setState({manualEntry:!e.state.manualEntry})}},i.a.createElement("p",{className:"f9 absolute",style:{left:8,top:8}},"Weather"),i.a.createElement("p",{className:"absolute w-100 flex-col f9",style:{bottom:8,left:8,cursor:"pointer"}},"-> Set location")))}},{key:"renderWithData",value:function(e,t){var n=this,r=e.currently,o=e.daily.data[0],a=It.a.unix(o.sunsetTime).format("h:mm a")||"";return this.renderWrapper(i.a.createElement("div",{className:"w-100 h-100 b--black b--gray1-d ba",style:{backdropFilter:"blur(80px)"}},i.a.createElement("p",{className:"f9 absolute",style:{left:8,top:8}},"Weather"),i.a.createElement("a",{className:"f9 absolute pointer",style:{right:8,top:8},onClick:function(){return n.setState({manualEntry:!n.state.manualEntry})}},"->"),i.a.createElement("div",{className:"w-100 absolute",style:{left:8,bottom:8}},i.a.createElement("p",{className:"f9"},r.summary),i.a.createElement("p",{className:"f9 pt1"},Math.round(r.temperature),"°"),i.a.createElement("p",{className:"f9 pt1"},"Sunset at ",a))),t)}},{key:"render",value:function(){var e=this.props.weather?this.props.weather:{};if(!0===this.state.manualEntry)return this.renderManualEntry();if("currently"in e&&"daily"in e){var t=this.setColors(e);return this.renderWithData(e,t)}return this.props.location?this.renderWrapper(i.a.createElement("div",{className:"pa2 w-100 h-100 b--black b--gray1-d ba bg-white bg-gray0-d black white-d"},i.a.createElement("p",{className:"f9 absolute",style:{left:8,top:8}},"Weather"),i.a.createElement("p",{className:"absolute w-100 flex-col f9",style:{bottom:8,left:8}},"Loading, please check again later..."))):this.renderNoData()}}])&&bn(t.prototype,n),r&&bn(t,r),a}(i.a.Component);function wn(e){return(wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function xn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mn(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r={groupify:{"app-path":e,existing:null}};return t&&(r.groupify.existing={"group-path":t,inclusive:n}),this.chatViewAction(r)}},{key:"inviteAction",value:function(e){this.action("invite-store","json",e)}},{key:"inviteAccept",value:function(e){this.inviteAction({accept:{path:"/chat",uid:e}})}},{key:"inviteDecline",value:function(e){this.inviteAction({decline:{path:"/chat",uid:e}})}},{key:"metadataAction",value:function(e){return this.action("metadata-hook","metadata-action",e)}},{key:"metadataAdd",value:function(e,t,n,r,i,o){var a="~".concat(window.ship);return this.metadataAction({add:{"group-path":t,resource:{"app-path":e,"app-name":"chat"},metadata:{title:n,description:r,color:o,"date-created":i,creator:a}}})}},{key:"sidebarToggle",value:function(){var e=!0;!0===this.store.state.sidebarShown&&(e=!1),this.store.handleEvent({data:{local:{sidebarToggle:e}}})}}])&&qn(t.prototype,n),r&&qn(t,r),o}(Ae);function er(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function rr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n14?i.a.createElement("div",{className:"bg-black dib "+t,style:{width:e.size,height:e.size}}):i.a.createElement("div",{className:"dib "+t,style:{flexBasis:e.size,backgroundColor:e.color}},Object(xi.sigil)({patp:e.ship,renderer:xi.reactRenderer,size:e.size,colors:[e.color,n],class:e.svgClass}))}}])&&Li(t.prototype,n),r&&Li(t,r),a}(r.Component);function ji(e){return(ji="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Yi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pi(e){for(var t=1;t0&&this.setState({suggestions:[]}),void this.unbindShortcuts();null===t.searchTerm&&t.searchTerm!==e.searchTerm&&t.searchTerm.startsWith(e.searchTerm)?this.updateSuggestions():e.searchTerm!==t.searchTerm&&this.updateSuggestions(!0)}},{key:"updateSuggestions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.props.searchTerm,n=function(e){return(e=e.toLowerCase()).startsWith(t)||me.a.some(me.a.words(e),(function(e){return e.startsWith(t)}))},r=this.state.suggestions;if(e||0===this.state.suggestions.length){var i=me.a.chain(this.props.contacts).defaultTo({}).map((function(e,t){return Pi(Pi({},e),{},{ship:t})})).filter((function(e){var t=e.nickname,r=e.ship;return n(t)||n(r)})).map("ship").value(),o=_i.a.isValidPatp("~".concat(t))?[t]:[];r=me.a.chain(this.props.candidates).defaultTo([]).union(i).union(o).value()}var a=me.a.chain(r).filter(n).filter((function(e){return e.length<28})).value();this.bindShortcuts(),this.setState({suggestions:a,selected:a[0]})}},{key:"bindCmShortcuts",value:function(){this.props.cm&&this.props.cm.addKeyMap(this.keymap)}},{key:"unbindCmShortcuts",value:function(){this.props.cm&&this.props.cm.removeKeyMap(this.keymap)}},{key:"bindShortcuts",value:function(){var e=this;if(!this.state.bound){if(!this.props.inputRef)return this.bindCmShortcuts();this.setState({bound:!0}),this.mousetrap||(this.mousetrap=new wi.a(this.props.inputRef)),this.mousetrap.bind("enter",(function(t){t.preventDefault(),t.stopPropagation(),e.state.selected&&(e.unbindShortcuts(),e.props.onSelect(e.state.selected))})),this.mousetrap.bind("tab",(function(t){t.preventDefault(),t.stopPropagation(),e.nextAutocompleteSuggestion(!1)})),this.mousetrap.bind(["up","shift+tab"],(function(t){t.preventDefault(),t.stopPropagation(),e.nextAutocompleteSuggestion(!0)})),this.mousetrap.bind("down",(function(t){t.preventDefault(),t.stopPropagation(),e.nextAutocompleteSuggestion(!1)})),this.mousetrap.bind("esc",(function(t){t.preventDefault(),t.stopPropagation(),e.props.onClear()}))}}},{key:"unbindShortcuts",value:function(){this.props.inputRef||this.unbindCmShortcuts(),this.state.bound&&(this.setState({bound:!1}),this.mousetrap.unbind("enter"),this.mousetrap.unbind("tab"),this.mousetrap.unbind(["up","shift+tab"]),this.mousetrap.unbind("down"),this.mousetrap.unbind("esc"))}},{key:"nextAutocompleteSuggestion",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.state.suggestions,r=n.findIndex((function(t){return t===e.state.selected}));r=t?r-1:r+1,(r%=Math.min(n.length,5))<0&&(r=n.length-1),this.setState({selected:n[r]})}},{key:"render",value:function(){var e=this.props,t=e.onSelect,n=e.contacts,r=e.popover,o=e.className,a=this.state,s=a.selected,l=a.suggestions;if(0===l.length)return null;var c=r?" absolute ":" ";return i.a.createElement("div",{style:r?{bottom:"90%",left:"48px"}:{},className:"black white-d bg-white bg-gray0-d w7 pv3 z-1 mt1 ba b--gray1-d b--gray4"+c+o||!1},l.slice(0,5).map((function(e){return i.a.createElement(Vi,{onSelect:t,key:e,selected:s,contacts:n,ship:e})})))}}]),n}(r.Component),Zi=function(e){Ii(n,e);var t=zi(n);function n(){var e;return Ni(this,n),(e=t.call(this)).state={searchTerm:""},e.inputRef=null,e.popoverRef=null,e.search=e.search.bind(Bi(e)),e.onClick=e.onClick.bind(Bi(e)),e.setInputRef=e.setInputRef.bind(Bi(e)),e}return Hi(n,[{key:"onClick",value:function(e){var t=this.popoverRef;t&&!t.contains(e.target)&&this.props.onClear()}},{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.onClick),document.addEventListener("touchstart",this.onClick)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.onClick),document.removeEventListener("touchstart",this.onClick)}},{key:"setInputRef",value:function(e){this.inputRef=e,e&&e.focus(),this.forceUpdate()}},{key:"search",value:function(e){var t=e.target.value;this.setState({searchTerm:t})}},{key:"render",value:function(){var e=this,t=this.state,n=this.props;return i.a.createElement("div",{ref:function(t){return e.popoverRef=t},style:{top:"150%",left:"-80px"},className:"b--gray2 b--solid ba absolute bg-white bg-gray0-d"},i.a.createElement("textarea",{style:{resize:"none",maxWidth:"200px"},className:"ma2 pa2 b--gray4 ba b--solid w7 db bg-gray0-d white-d",rows:1,autocapitalise:"none",autoFocus:!/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent),placeholder:"Search for a ship",value:t.searchTerm,onChange:this.search,ref:this.setInputRef}),i.a.createElement(qi,{contacts:n.contacts,candidates:n.candidates,searchTerm:_e(t.searchTerm),inputRef:this.inputRef,onSelect:n.onSelect,onClear:n.onClear}))}}]),n}(r.Component);function Gi(e){return(Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $i(){return($i=Object.assign||function(e){for(var t=1;t0?i.a.createElement("pre",{className:"f7 clamp-attachment pa1 mt0 mb0 b--gray4 b--gray1-d bl br bb"},t.code.output[0].join("\n")):null;return i.a.createElement("div",{className:"mv2"},i.a.createElement("pre",{className:"f7 clamp-attachment pa1 mt0 mb0 bg-light-gray b--gray4 b--gray1-d ba"},t.code.expression),n)}if("url"in t){var r,o=/(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM|svg|SVG)$/.exec(t.url),a=new RegExp(String(/(?:https?:\/\/(?:[a-z]+.)?)/.source)+/(?:youtu\.?be(?:\.com)?\/)(?:embed\/)?/.source+/(?:(?:(?:(?:watch\?)?(?:time_continue=(?:[0-9]+))?.+v=)?([a-zA-Z0-9_-]+))(?:\?t\=(?:[0-9a-zA-Z]+))?)/.source).exec(t.url),s=t.url;return o?(s=i.a.createElement("img",{className:"o-80-d",src:t.url,style:{height:"min(250px, 20vh)",maxWidth:"80vw"}}),i.a.createElement("a",{className:"f7 lh-copy v-top word-break-all",href:t.url,target:"_blank",rel:"noopener noreferrer"},s)):a?(s=i.a.createElement("div",{className:"embed-container mb2 w-100 w-75-l w-50-xl "+(!0===this.state.unfold?"db":"dn")},i.a.createElement("iframe",{ref:"iframe",width:"560",height:"315","data-src":"https://www.youtube.com/embed/".concat(a[1]),frameBorder:"0",allow:"picture-in-picture, fullscreen"})),i.a.createElement("div",null,i.a.createElement("a",(Fo(r={href:t.url,className:"f7 lh-copy v-top bb b--white-d word-break-all"},"href",t.url),Fo(r,"target","_blank"),Fo(r,"rel","noopener noreferrer"),r),t.url),i.a.createElement("a",{className:"ml2 f7 pointer lh-copy v-top",onClick:function(t){return e.unFoldEmbed()}},"[embed]"),s)):i.a.createElement("a",{className:"f7 lh-copy v-top bb b--white-d b--black word-break-all",href:t.url,target:"_blank",rel:"noopener noreferrer"},s)}return"me"in t?i.a.createElement("p",{className:"f7 i lh-copy v-top"},t.me):i.a.createElement("section",{className:"chat-md-message"},i.a.createElement(Jo,{source:t.text}))}},{key:"render",value:function(){var e=this,t=this.props,n=this.state,r=t.msg.pending?" o-40":"",o="~"+It.a.unix(t.msg.when/1e3).format("YYYY.M.D"),a=t.paddingTop?{paddingTop:"6px"}:"";if(t.renderSigil){var s=It.a.unix(t.msg.when/1e3).format("hh:mm a"),l=t.msg.author in t.contacts&&t.contacts[t.msg.author],c="~".concat(t.msg.author),u="#000000",d="mix-blend-diff";return l&&(c=l.nickname.length>0?l.nickname:"~".concat(t.msg.author),u="#".concat(ke(l.color)),d=""),"~".concat(t.msg.author)===c&&(c=Me(t.msg.author)),i.a.createElement("div",{ref:this.containerRef,className:"w-100 f7 pl3 pt4 pr3 cf flex lh-copy "+r,style:{minHeight:"min-content"}},i.a.createElement(Po,{ship:t.msg.author,contact:l,color:u,sigilClass:d,group:t.group,className:"fl pr3 v-top bg-white bg-gray0-d"}),i.a.createElement("div",{className:"fr clamp-message white-d",style:{flexGrow:1,marginTop:-8}},i.a.createElement("div",{className:"hide-child",style:a},i.a.createElement("p",{className:"v-mid f9 gray2 dib mr3 c-default"},i.a.createElement("span",{className:"pointer "+(l.nickname||n.copied?null:"mono"),onClick:function(){xe(t.msg.author),e.setState({copied:!0}),setTimeout((function(){e.setState({copied:!1})}),800)},title:"~".concat(t.msg.author)},n.copied?"Copied":c)),i.a.createElement("p",{className:"v-mid mono f9 gray2 dib"},s),i.a.createElement("p",{className:"v-mid mono f9 ml2 gray2 dib child dn-s"},o)),this.renderContent()))}var f=It.a.unix(t.msg.when/1e3).format("hh:mm");return i.a.createElement("div",{className:"w-100 pr3 cf hide-child flex"+r,style:{minHeight:"min-content"}},i.a.createElement("p",{className:"child pt2 pl2 pr1 mono f9 gray2 dib"},f),i.a.createElement("div",{className:"fr f7 clamp-message white-d pr3 lh-copy",style:{flexGrow:1}},this.renderContent()))}}])&&zo(t.prototype,n),r&&zo(t,r),a}(r.Component);function Xo(e){return(Xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ea(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],n=this.state.patpSuggestions,r=n.findIndex((function(t){return t===e.state.selectedSuggestion}));r=t?r-1:r+1,(r%=n.length)<0&&(r=n.length-1),this.setState({selectedSuggestion:n[r]})}},{key:"patpAutocomplete",value:function(e){var t=/~([a-zA-Z\-]*)$/.exec(e);t?this.setState({patpSearch:t[1].toLowerCase()}):this.setState({patpSearch:null})}},{key:"clearSearch",value:function(){this.setState({patpSearch:null})}},{key:"completePatp",value:function(e){if(this.editor){var t=this.editor.getValue().replace(/[a-zA-Z\-]*$/,e);this.editor.setValue(t);var n=this.editor.lastLine(),r=this.editor.getLineHandle(n).text.length;this.editor.setCursor(n,r),this.setState({patpSearch:null})}}},{key:"messageChange",value:function(e,t,n){null!==this.state.patpSearch&&this.patpAutocomplete(n,!1)}},{key:"getLetterType",value:function(e){if(e.startsWith("/me ")){for(e=e.slice(4);"\n"===e[0];)e=e.slice(1);return{me:e}}return this.isUrl(e)?{url:e}:{text:e}}},{key:"isUrl",value:function(e){try{return new RegExp(String(/^((\w+:\/\/)[-a-zA-Z0-9:@;?&=\/%\+\.\*!'\(\),\$_\{\}\^~\[\]`#|]+)/.source)).test(e)}catch(e){return!1}}},{key:"messageSubmit",value:function(){var e=this;if(this.editor){var t=this.props,n=this.state,r=this.editor.getValue();if(""!==r){if(t.onEnter(),n.code)return t.api.chat.message(t.station,"~".concat(window.ship),Date.now(),{code:{expression:r,output:void 0}}),void this.editor.setValue("");var i=[];r.split(" ").map((function(n){if(!e.isUrl(n))return i.push(n);i.length>0&&(i=i.join(" "),i=e.getLetterType(i),t.api.chat.message(t.station,"~".concat(window.ship),Date.now(),i),i=[]);var r=e.getLetterType(n);t.api.chat.message(t.station,"~".concat(window.ship),Date.now(),r)})),i.length>0&&(i=i.join(" "),i=this.getLetterType(i),t.api.chat.message(t.station,"~".concat(window.ship),Date.now(),i),i=[]),this.editor.setValue("")}}}},{key:"toggleCode",value:function(){this.state.code?(this.setState({code:!1}),this.editor.setOption("mode",Pa),this.editor.setOption("placeholder",this.props.placeholder)):(this.setState({code:!0}),this.editor.setOption("mode",null),this.editor.setOption("placeholder","Code...")),0===this.editor.getValue().length&&(this.editor.setValue(" "),this.editor.setValue(""))}},{key:"uploadSuccess",value:function(e){var t=this.props;t.api.chat.message(t.station,"~".concat(window.ship),Date.now(),{url:e})}},{key:"uploadError",value:function(e){}},{key:"render",value:function(){var e=this,t=this.props,n=this.state,r=t.ownerContact?ke(t.ownerContact.color):"000000",o=t.ownerContact?"":"mix-blend-diff",a=t.ownerContact&&null!==t.ownerContact.avatar?i.a.createElement("img",{src:t.ownerContact.avatar,height:24,width:24,className:"dib"}):i.a.createElement(Di,{ship:window.ship,size:24,color:"#".concat(r),classes:o}),s=me.a.chain(this.props.envelopes).defaultTo([]).map("author").uniq().reverse().value(),l=n.code?" code":"",c={mode:Pa,theme:"tlon"+l,lineNumbers:!1,lineWrapping:!0,scrollbarStyle:"native",cursorHeight:.85,placeholder:n.code?"Code...":t.placeholder,extraKeys:{Tab:function(t){return e.patpAutocomplete(t.getValue(),!0)},Enter:function(){e.messageSubmit(),e.state.code&&e.toggleCode()},"Shift-3":function(t){return 0===t.getValue().length?e.toggleCode():ga.a.Pass}}};return i.a.createElement("div",{className:"chat pa3 cf flex black white-d bt b--gray4 b--gray1-d bg-white bg-gray0-d relative",style:{flexGrow:1}},i.a.createElement(qi,{popover:!0,onSelect:this.completePatp,onClear:this.clearSearch,contacts:t.contacts,candidates:s,searchTerm:this.state.patpSearch,cm:this.editor}),i.a.createElement("div",{className:"fl",style:{marginTop:6,flexBasis:24,height:24}},a),i.a.createElement("div",{className:"fr h-100 flex bg-gray0-d lh-copy pl2 w-100 items-center",style:{flexGrow:1,maxHeight:"224px",width:"calc(100% - 72px)"}},i.a.createElement(ma.UnControlled,{options:c,editorDidMount:function(t){e.editor=t,/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)||t.focus()},onChange:function(t,n,r){return e.messageChange(t,n,r)}})),i.a.createElement("div",{className:"ml2 mr2",style:{height:"16px",width:"16px",flexBasis:16,marginTop:10}},i.a.createElement(La,{configuration:t.s3.configuration,credentials:t.s3.credentials,uploadSuccess:this.uploadSuccess.bind(this),uploadError:this.uploadError.bind(this)})),i.a.createElement("div",{style:{height:"16px",width:"16px",flexBasis:16,marginTop:10}},i.a.createElement("img",{style:{filter:n.code&&"invert(100%)",height:"14px",width:"14px"},onClick:this.toggleCode,src:"/~chat/img/CodeEval.png",className:"contrast-10-d bg-white bg-none-d ba b--gray1-d br1"})))}}])&&Ea(t.prototype,n),r&&Ea(t,r),a}(r.Component);function Na(e){return(Na="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ra(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ha(e,t){for(var n=0;n1e3;!i&&r+20>300?this.askForMessages(r+20):this.askForMessages(300),i||t.read===t.length?(this.scrolledToMarker=!0,this.setState({scrollLocked:!1},(function(){e.scrollToBottom()}))):this.setState({scrollLocked:!0,numPages:Math.ceil(n/100)})}},{key:"componentDidUpdate",value:function(e,t){var n=this.props,r=this.state;e.match.params.station!==n.match.params.station||e.match.params.ship!==n.match.params.ship?this.receivedNewChat():n.chatInitialized&&!(n.station in n.inbox)&&Boolean(n.chatSynced)&&!(n.station in n.chatSynced)?n.history.push("/~chat"):n.envelopes.length>=e.envelopes.length+10?this.hasAskedForMessages=!1:n.length!==e.length&&e.length===t.read&&r.active&&(this.setState({read:n.length}),this.props.api.chat.read(this.props.station)),!e.chatInitialized&&n.chatInitialized&&this.receivedNewChat(),n.length===e.length&&n.envelopes.length===e.envelopes.length&&Xa(n)===this.lastNumPending&&r.numPages===t.numPages||(this.scrollToBottom(),navigator.userAgent.includes("Firefox")&&this.recalculateScrollTop(),this.lastNumPending=Xa(n))}},{key:"askForMessages",value:function(e){var t=this.props;if(this.state,!(t.envelopes.length>=t.length||this.hasAskedForMessages||t.length<=0)){var n=t.length-t.envelopes[t.envelopes.length-1].number;if(n>0){var r=n+e0&&o.length,o.length>100*r.numPages&&(o=o.slice(0,100*r.numPages));var a=n.pendingMessages.has(n.station)?n.pendingMessages.get(n.station):[];a.map((function(e){return e.pending=!0}));var s=(o=a.concat(o)).map((function(r,a){var s=["author"],l=me.a.get(o[a+1],s)!==me.a.get(r,s,r.author),c=l,u=me.a.get(o[a-1],s)!==me.a.get(r,s,r.author),d=["when"],f=It()(me.a.get(o[a+1],d)).format("YYYY.MM.DD")!==It()(me.a.get(o[a],d)).format("YYYY.MM.DD"),h=i.a.createElement(Ko,{key:r.uid,msg:r,contacts:n.contacts,renderSigil:l,paddingTop:c,paddingBot:u,pending:Boolean(r.pending),group:n.association});return e>0&&a===e-1?i.a.createElement(i.a.Fragment,null,h,i.a.createElement("div",{key:"unreads"+r.uid,ref:t.setUnreadMarker,className:"mv2 green2 flex items-center f9"},i.a.createElement("hr",{className:"dn-s ma0 w2 b--green2 bt-0"}),i.a.createElement("p",{className:"mh4"},"New messages below"),i.a.createElement("hr",{className:"ma0 flex-grow-1 b--green2 bt-0"}),f&&i.a.createElement("p",{className:"gray2 mh4"},It()(me.a.get(o[a],d)).calendar()),i.a.createElement("hr",{style:{width:"calc(50% - 48px)"},className:"b--green2 ma0 bt-0"}))):f?i.a.createElement(i.a.Fragment,null,h,i.a.createElement("div",{key:"daybreak"+r.uid,className:"pv3 gray2 b--gray2 flex items-center justify-center f9 "},i.a.createElement("p",null,It()(me.a.get(o[a],d)).calendar()))):h}));return navigator.userAgent.includes("Firefox")?i.a.createElement("div",{className:"relative overflow-y-scroll h-100",onScroll:this.onScroll,ref:function(e){t.scrollContainer=e}},i.a.createElement("div",{className:"bg-white bg-gray0-d pt3 pb2 flex flex-column-reverse",style:{resize:"vertical"}},i.a.createElement("div",{ref:function(e){t.scrollElement=e}}),n.chatInitialized&&!(n.station in n.inbox)&&i.a.createElement(yo,null),n.chatSynced&&!(n.station in n.chatSynced)&&o.length>0?i.a.createElement(co,{api:n.api,host:n.match.params.ship,station:n.station}):i.a.createElement("div",null),s)):i.a.createElement("div",{className:"overflow-y-scroll bg-white bg-gray0-d pt3 pb2 flex flex-column-reverse relative",style:{height:"100%",resize:"vertical"},onScroll:this.onScroll},i.a.createElement("div",{ref:function(e){t.scrollElement=e}}),n.chatInitialized&&!(n.station in n.inbox)&&i.a.createElement(yo,null),n.chatSynced&&!(n.station in n.chatSynced)&&o.length>0?i.a.createElement(co,{api:n.api,host:n.match.params.ship,station:n.station}):i.a.createElement("div",null),s)}},{key:"render",value:function(){var e=this,t=this.props,n=this.state,r=t.envelopes.slice(0),o=r.length>0?r.length:0,a=Array.from(t.permission.who.values()),s=t.popout?"popout/":"",l=window.ship in t.contacts&&t.contacts[window.ship],c=t.station.substr(1);t.association&&"metadata"in t.association&&(c=""!==t.association.metadata.title?t.association.metadata.title:t.station.substr(1));var u=t.length-n.read,d=u>0&&r[u-1],f=t.length!==t.read&&t.read===n.read;return i.a.createElement("div",{key:t.station,className:"h-100 w-100 overflow-hidden flex flex-column relative"},i.a.createElement("div",{className:"w-100 dn-m dn-l dn-xl inter pt4 pb6 pl3 f8",style:{height:"1rem"}},i.a.createElement(ce,{to:"/~chat/"},"⟵ All Chats")),i.a.createElement("div",{className:"pl4 pt2 bb b--gray4 b--gray1-d bg-gray0-d flex relative overflow-x-auto overflow-y-hidden flex-shrink-0 ",style:{height:48}},i.a.createElement(oa,{sidebarShown:t.sidebarShown,popout:t.popout,api:t.api}),i.a.createElement(ce,{to:"/~chat/"+s+"room"+t.station,className:"pt2 white-d"},i.a.createElement("h2",{className:"dib f9 fw4 lh-solid v-top "+(c===t.station.substr(1)?"mono":""),style:{width:"max-content"}},c)),i.a.createElement(pa,Va({},t,{station:t.station,numPeers:a.length,isOwner:_e(t.match.params.ship)===window.ship,popout:t.popout,api:t.api}))),!!d&&f&&i.a.createElement(Ba,{unread:u,unreadMsg:d,onRead:function(){return e.dismissUnread()}}),this.chatWindow(u),i.a.createElement(Aa,{api:t.api,numMsgs:o,station:t.station,owner:_e(t.match.params.ship),ownerContact:l,envelopes:t.envelopes,contacts:t.contacts,onEnter:function(){return e.setState({scrollLocked:!1})},s3:t.s3,placeholder:"Message..."}))}}])&&qa(t.prototype,n),r&&qa(t,r),a}(r.Component);function ts(e){return(ts="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ns(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rs(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function fs(e,t){if(e){if("string"==typeof e)return hs(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hs(e,t):void 0}}function hs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var n,o=ds(e.props.groups[t].values());try{for(o.s();!(n=o.n()).done;){var a=n.value;r.add(a)}}catch(e){o.e(e)}finally{o.f()}}if(e.props.contacts[t]){var s,l=ds(e.props.groups[t].values());try{for(l.s();!(s=l.n()).done;){var c=s.value;e.props.contacts[t][c]&&(i.has(c)?i.get(c).push(e.props.contacts[t][c].nickname):i.set(c,[e.props.contacts[t][c].nickname]))}}catch(e){l.e(e)}finally{l.f()}}})),n=Array.from(r),this.setState({groups:t,peers:n,contacts:i})}},{key:"search",value:function(e){var t=this,n=e.target.value.toLowerCase().replace("~","");if(this.setState({searchValue:e.target.value}),n.length<1&&this.setState({searchResults:{groups:[],ships:[]}}),n.length>0){!0===this.state.inviteError&&this.setState({inviteError:!1});var r=[];this.props.groupResults&&(r=this.state.groups.filter((function(e){return e[0].includes(n)||e[1].toLowerCase().includes(n)})));var i=[];if(this.props.shipResults){i=this.state.peers.filter((function(e){return e.includes(n)&&!t.props.invites.ships.includes(e)}));var o,a=ds(this.state.contacts.keys());try{for(a.s();!(o=a.n()).done;){var s=o.value;this.state.contacts.get(s).filter((function(e){return e.toLowerCase().includes(n)})).length>0&&(s in i||i.push(s))}}catch(e){a.e(e)}finally{a.f()}var l=!0;_i.a.isValidPatp("~"+n)||(l=!1),l&&i.findIndex((function(e){return e===n}))<0&&i.unshift(n)}var c=this.state.selected,u=r.findIndex((function(e){return us(e,1)[0]===c})),d=i.findIndex((function(e){return e===c}));if(!c||u<0&&d<0){var f=me.a.get(r,"[0][0]")||i[0];this.setState({selected:f})}n.length<3&&(r=r.filter((function(e){return us(e,2)[1].toLowerCase().split(" ").some((function(e){return e.startsWith(n)}))})).sort((function(e,t){return e[1].length-t[1].length})),i=i.slice(0,3)),this.setState({searchResults:{groups:r,ships:i}})}}},{key:"bindShortcuts",value:function(){var e=this,t=wi()(this.textarea.current);t.bind(["down","tab"],(function(t){t.preventDefault(),t.stopPropagation(),e.nextSelection()})),t.bind(["up","shift+tab"],(function(t){t.preventDefault(),t.stopPropagation(),e.nextSelection("backward")})),t.bind("enter",(function(t){t.preventDefault(),t.stopPropagation();var n=e.state.selected;n.startsWith("/")?e.addGroup(n):e.addShip(n),e.setState({selected:null})}))}},{key:"nextSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.state,n=t.selected,r=t.searchResults,i=r.ships,o=r.groups;if(n){var a=o.findIndex((function(e){return us(e,1)[0]===n})),s=i.findIndex((function(e){return e===n}));if(a>=0){e?a--:a++;var l=me.a.get(o,[a],"[0]");return a===o.length&&(l=0===i.length?o[0][0]:i[0]),a<0&&(l=0===i.length?o[o.length-1][0]:i[i.length-1]),void this.setState({selected:l})}if(s>=0){e?s--:s++;var c=i[s];s===i.length&&(c=0===o.length?i[0]:o[0][0]),s<0&&(c=0===o.length?i[i.length-1]:o[o.length-1][0]),this.setState({selected:c})}}}},{key:"deleteGroup",value:function(){var e=this.props.invites.ships;this.setState({searchValue:"",searchResults:{groups:[],ships:[]}}),this.props.setInvite({groups:[],ships:e})}},{key:"deleteShip",value:function(e){var t=this.props.invites,n=t.groups,r=t.ships;this.setState({searchValue:"",searchResults:{groups:[],ships:[]}}),r=r.filter((function(t){return t!==e})),this.props.setInvite({groups:n,ships:r})}},{key:"addGroup",value:function(e){this.setState({searchValue:"",searchResults:{groups:[],ships:[]}}),this.props.setInvite({groups:[e],ships:[]})}},{key:"addShip",value:function(e){var t=this.props.invites,n=t.groups,r=t.ships;if(this.setState({searchValue:"",searchResults:{groups:[],ships:[]}}),r.includes(e)||r.push(e),n.length>0)return!1;this.props.setInvite({groups:n,ships:r})}},{key:"submitShipToAdd",value:function(e){var t=e.toLowerCase().replace("~","").trim(),n=!0;_i.a.isValidPatp("~"+t)||(n=!1),n?n&&(this.addShip(t),this.setState({searchValue:""})):this.setState({inviteError:!0,searchValue:""})}},{key:"render",value:function(){var e=this,t=this.props,n=this.state,r=t.disabled;t.invites.groups&&t.invites.groups.length>0&&(r=!0);var o=i.a.createElement("div",null),a=i.a.createElement("div",null),s="";t.shipResults&&(s="ships"),t.groupResults&&(s.length>0&&(s+=" or "),s+="existing groups"),s="Search for "+s;var l=i.a.createElement("span",null);if(n.inviteError&&(l=i.a.createElement("span",{className:"f9 inter red2 db pt2"},"Invited ships must be validly formatted ship names.")),n.searchResults.groups.length>0||n.searchResults.ships.length>0){var c=n.searchResults.groups.length>0?i.a.createElement("p",{className:"f9 gray2 ph3 pb2"},"Groups"):"",u=n.searchResults.ships.length>0?i.a.createElement("p",{className:"f9 gray2 pv2 ph3"},"Ships"):"",d=n.searchResults.groups.map((function(t){return i.a.createElement("li",{key:t[0],className:"list white-d f8 pv2 ph3 pointer hover-bg-gray4 hover-bg-gray1-d "+(t[1]?"inter":"mono")+(t[0]===n.selected?" bg-gray1-d bg-gray4":""),onClick:function(){return e.addGroup(t[0])}},i.a.createElement("span",{className:"mix-blend-diff white"},t[1]?t[1]:t[0]))})),f=n.searchResults.ships.map((function(t){var r=e.state.contacts.has(t)?e.state.contacts.get(t).filter((function(e){return!(""===e)})).join(", "):"";return i.a.createElement("li",{key:t,className:"list mono white-d f8 pv1 ph3 pointer hover-bg-gray4 hover-bg-gray1-d relative"+(t===n.selected?" bg-gray1-d bg-gray4":""),onClick:function(n){return e.addShip(t)}},i.a.createElement(Di,{ship:"~"+t,size:24,color:"#000000",classes:"mix-blend-diff v-mid"}),i.a.createElement("span",{className:"v-mid ml2 mw5 truncate dib mix-blend-diff white"},"~"+t),i.a.createElement("span",{className:"absolute right-1 di truncate mw4 inter f9 pt1 mix-blend-diff white"},r))}));a=i.a.createElement("div",{className:"absolute bg-white bg-gray0-d white-d pv3 z-1 w-100 mt1 ba b--white-d overflow-y-scroll mh-16"},c,d,u,f)}var h=t.invites.groups||[],p=t.invites.ships||[];if(h.length>0||p.length>0){var m=h.map((function(t){return i.a.createElement("span",{key:t,className:"f9 mono black pa2 bg-gray5 bg-gray1-d ba b--gray4 b--gray2-d white-d dib mr2 mt2 c-default"},t,i.a.createElement("span",{className:"white-d ml3 mono pointer",onClick:function(n){return e.deleteGroup(t)}},"x"))})),b=p.map((function(t){return i.a.createElement("span",{key:t,className:"f9 mono black pa2 bg-gray5 bg-gray1-d ba b--gray4 b--gray2-d white-d dib mr2 mt2 c-default"},"~"+t,i.a.createElement("span",{className:"white-d ml3 mono pointer",onClick:function(n){return e.deleteShip(t)}},"x"))}));o=i.a.createElement("div",{className:"f9 gray2 bb bl br b--gray3 b--gray2-d bg-gray0-d white-d pa3 db w-100 inter"},i.a.createElement("span",{className:"db gray2"},"Participants"),m," ",b)}return i.a.createElement("div",{className:"relative"},i.a.createElement("img",{src:"/~chat/img/search.png",className:"absolute invert-d",style:{height:16,width:16,top:14,left:12}}),i.a.createElement("textarea",{ref:this.textarea,className:"f7 ba b--gray3 b--gray2-d bg-gray0-d white-d pa3 w-100 db focus-b--black focus-b--white-d",placeholder:s,disabled:r,rows:1,spellCheck:!1,style:{resize:"none",paddingLeft:36},onChange:this.search,value:n.searchValue}),a,o,l)}}])&&ps(t.prototype,n),r&&ps(t,r),a}(r.Component);function ks(e){return(ks="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ws(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xs(e,t){for(var n=0;n0;if(n.title){var i="/".concat(n.idName)+(r?"-".concat(Math.floor(1e4*Math.random())):"");if(i in t.inbox)this.setState({inviteError:!1,idError:!0,success:!1});else{var o=!0,a=n.ships.map((function(e){return"~".concat(_e(e.trim()))}));a.forEach((function(e){_i.a.isValidPatp(e)||(o=!1)})),1!==n.ships.length||"village"!==n.security||n.createGroup||t.history.push("/~chat/new/dm/".concat(a[0])),o?(this.textarea&&(this.textarea.value=""),this.setState({error:!1,success:!0,group:[],ships:[],awaiting:!0},(function(){var r="/~".concat(window.ship).concat(i);n.createGroup||0!==n.groups.length||(r="/~".concat(r));var o=r;n.groups.length>0&&(o=n.groups[0]),t.api.chatView.create(n.title,n.description,r,o,n.security,a,n.allowHistory).then((function(){e.setState({awaiting:!1}),t.history.push("/~chat/room".concat(r))}))}))):this.setState({inviteError:!0,idError:!1,success:!1})}}else this.setState({idError:!0,inviteError:!1})}},{key:"render",value:function(){var e=this.props,t=this.state;t.security,t.createGroup;var n=t.createGroup?"relative checked bg-green2 br3 h1 toggle v-mid z-0":"relative bg-gray4 bg-gray1-d br3 h1 toggle v-mid z-0",r=t.idName?"pointer db f9 green2 bg-gray0-d ba pv3 ph4 b--green2":"pointer db f9 gray2 ba bg-gray0-d pa2 pv3 ph4 b--gray3",o="f7 ba b--gray3 b--gray2-d bg-gray0-d white-d pa3 db w-100 focus-b--black focus-b--white-d ",a=i.a.createElement("span",null);t.idError&&(a=i.a.createElement("span",{className:"f9 inter red2 db pt2"},"Chat must have a valid name."));var s=i.a.createElement("div",null);0===t.groups.length&&(s=i.a.createElement("div",{className:"mv7"},i.a.createElement("input",{type:"checkbox",style:{WebkitAppearance:"none",width:28},className:n,onChange:this.createGroupChange}),i.a.createElement("span",{className:"dib f9 white-d inter ml3"},"Create Group"),i.a.createElement("p",{className:"f9 gray2 pt1",style:{paddingLeft:40}},"Participants will share this group across applications")));var l={};return Object.keys(e.permissions).forEach((function(t){l[t]=e.permissions[t].who})),i.a.createElement("div",{className:"h-100 w-100 mw6 pa3 pt4 overflow-x-hidden bg-gray0-d white-d flex flex-column"},i.a.createElement("div",{className:"w-100 dn-m dn-l dn-xl inter pt1 pb6 f8"},i.a.createElement(ce,{to:"/~chat/"},"⟵ All Chats")),i.a.createElement("h2",{className:"mb3 f8"},"New Chat"),i.a.createElement("div",{className:"w-100"},i.a.createElement("p",{className:"f8 mt3 lh-copy db"},"Name"),i.a.createElement("textarea",{className:o,placeholder:"Secret Chat",rows:1,style:{resize:"none"},onChange:this.titleChange}),a,i.a.createElement("p",{className:"f8 mt3 lh-copy db"},"Description",i.a.createElement("span",{className:"gray3"}," (Optional)")),i.a.createElement("textarea",{className:o,placeholder:"The coolest chat",rows:1,style:{resize:"none"},onChange:this.descriptionChange}),i.a.createElement("p",{className:"f8 mt4 lh-copy db"},"Invite",i.a.createElement("span",{className:"gray3"}," (Optional)")),i.a.createElement("p",{className:"f9 gray2 db mb2 pt1"},"Selected groups or ships will be able to post to chat"),i.a.createElement(_s,{groups:l,contacts:e.contacts,associations:e.associations,groupResults:!0,shipResults:!0,invites:{groups:t.groups,ships:t.ships},setInvite:this.setInvite}),s,i.a.createElement("button",{onClick:this.onClickCreate.bind(this),className:r},"Start Chat"),i.a.createElement(Es,{awaiting:this.state.awaiting,classes:"mt4",text:"Creating chat..."})))}}])&&nl(t.prototype,n),r&&nl(t,r),a}(r.Component);function cl(e){return(cl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ul(e,t){for(var n=0;n ~").concat(t.ship),"",n,r,"village",t.ship!==window.ship?["~".concat(t.ship)]:[],!0)}))}},{key:"render",value:function(){return i.a.createElement("div",{className:"h-100 w-100 mw6 pa3 pt4 overflow-x-hidden bg-gray0-d white-d flex flex-column"},i.a.createElement("div",{className:"w-100 dn-m dn-l dn-xl inter pt1 pb6 f8"},i.a.createElement(ce,{to:"/~chat/"},"⟵ All Chats")),i.a.createElement("h2",{className:"mb3 f8"},"New DM"),i.a.createElement("div",{className:"w-100"},i.a.createElement(Es,{awaiting:this.state.awaiting,classes:"mt4",text:"Creating chat..."})))}}])&&yl(t.prototype,n),r&&yl(t,r),a}(r.Component);function Sl(e){return(Sl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ll(){return(Ll=Object.assign||function(e){for(var t=1;t0?"OS1 - Chat (".concat(a,")"):"OS1 - Chat",this.totalUnreads=a);var c=t.invites?t.invites:{"/chat":{},"/contacts":{}},u=t.contacts?t.contacts:{},d=t.s3?t.s3:{},f=function(n,a){return i.a.createElement(to,Ll({inbox:t.inbox,messagePreviews:r,associations:l,selectedGroups:s,contacts:u,invites:c["/chat"]||{},unreads:o,api:e.api,station:a},n))};return i.a.createElement(ee,null,i.a.createElement(G,{exact:!0,path:"/~chat",render:function(e){return i.a.createElement(Fr,{associations:l,invites:c,chatHideonMobile:!0,sidebarShown:t.sidebarShown,sidebar:f(e)},i.a.createElement("div",{className:"h-100 w-100 overflow-x-hidden flex flex-column bg-white bg-gray0-d"},i.a.createElement("div",{className:"pl3 pr3 pt2 dt pb3 w-100 h-100"},i.a.createElement("p",{className:"f8 pt3 gray2 w-100 h-100 dtc v-mid tc"},"Select, create, or join a chat to begin."))))}}),i.a.createElement(G,{exact:!0,path:"/~chat/new/dm/:ship",render:function(n){var r=n.match.params.ship;return i.a.createElement(Fr,{associations:l,invites:c,sidebarHideOnMobile:!0,sidebar:f(n),sidebarShown:t.sidebarShown},i.a.createElement(Ml,Ll({api:e.api,inbox:t.inbox||{},permissions:t.permissions||{},contacts:t.contacts||{},associations:l.contacts,chatSynced:t.chatSynced||{},autoCreate:r},n)))}}),i.a.createElement(G,{exact:!0,path:"/~chat/new",render:function(n){return i.a.createElement(Fr,{associations:l,invites:c,sidebarHideOnMobile:!0,sidebar:f(n),sidebarShown:t.sidebarShown},i.a.createElement(ll,Ll({api:e.api,inbox:t.inbox||{},permissions:t.permissions||{},contacts:t.contacts||{},associations:l.contacts,chatSynced:t.chatSynced||{}},n)))}}),i.a.createElement(G,{exact:!0,path:"/~chat/join/(~)?/:ship?/:station?",render:function(n){var r="/".concat(n.match.params.ship,"/").concat(n.match.params.station);return n.match.url.includes("/~/")&&(r="/~"+r),i.a.createElement(Fr,{associations:l,invites:c,sidebarHideOnMobile:!0,sidebar:f(n),sidebarShown:t.sidebarShown},i.a.createElement(bl,Ll({api:e.api,inbox:t.inbox,autoJoin:r,chatSynced:t.chatSynced||{}},n)))}}),i.a.createElement(G,{exact:!0,path:"/~chat/(popout)?/room/(~)?/:ship/:station+",render:function(n){var r="/".concat(n.match.params.ship,"/").concat(n.match.params.station);n.match.url.includes("/~/")&&(r="/~"+r);var o=t.inbox[r]||{config:{read:0,length:0},envelopes:[]},a={},s=r in l.chat&&"group-path"in l.chat[r]?l.chat[r]["group-path"]:"";l.chat[r]&&s in u&&(a=u[s]);var h=r in l.chat?l.chat[r]:{},p=r in t.permissions?t.permissions[r]:{who:new Set([]),kind:"white"},m=n.match.url.includes("/popout/");return i.a.createElement(Fr,{associations:l,invites:c,sidebarHideOnMobile:!0,popout:m,sidebarShown:t.sidebarShown,sidebar:f(n,r)},i.a.createElement(es,Ll({chatSynced:t.chatSynced,station:r,association:h,api:e.api,subscription:e.subscription,read:o.config.read,length:o.config.length,envelopes:o.envelopes,inbox:t.inbox,contacts:a,permission:p,pendingMessages:t.pendingMessages,s3:d,popout:m,sidebarShown:t.sidebarShown,chatInitialized:t.chatInitialized},n)))}}),i.a.createElement(G,{exact:!0,path:"/~chat/(popout)?/members/(~)?/:ship/:station+",render:function(n){var r="/".concat(n.match.params.ship,"/").concat(n.match.params.station);n.match.url.includes("/~/")&&(r="/~"+r);var o=t.permissions[r]||{kind:"",who:new Set([])},a=n.match.url.includes("/popout/"),s=r in l.chat?l.chat[r]:{};return i.a.createElement(Fr,{associations:l,invites:c,sidebarHideOnMobile:!0,sidebarShown:t.sidebarShown,popout:a,sidebar:f(n,r)},i.a.createElement(Vs,Ll({},n,{api:e.api,station:r,association:s,permission:o,contacts:u,permissions:t.permissions,popout:a,sidebarShown:t.sidebarShown})))}}),i.a.createElement(G,{exact:!0,path:"/~chat/(popout)?/settings/(~)?/:ship/:station+",render:function(n){var r="/".concat(n.match.params.ship,"/").concat(n.match.params.station);n.match.url.includes("/~/")&&(r="/~"+r);var o=n.match.url.includes("/popout/"),a=t.permissions[r]||{kind:"",who:new Set([])},s=r in l.chat?l.chat[r]:{};return i.a.createElement(Fr,{associations:l,invites:c,sidebarHideOnMobile:!0,popout:o,sidebarShown:t.sidebarShown,sidebar:f(n,r)},i.a.createElement(el,Ll({},n,{station:r,association:s,permission:a,permissions:t.permissions||{},contacts:t.contacts||{},associations:l.contacts,api:e.api,inbox:t.inbox,popout:o,sidebarShown:t.sidebarShown})))}}))}}])&&Cl(t.prototype,n),r&&Cl(t,r),a}(i.a.Component);function Yl(e){return(Yl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Al(e,t){for(var n=0;n1)||["Enter","Backspace","ArrowLeft","ArrowRight","Tab"].includes(e.key)))if("Enter"===e.key)t.setState({awaiting:!0,type:"Sending to Dojo"}),t.props.api.soto("ret").then((function(){t.setState({awaiting:!1})}));else{if("Backspace"===e.key&&t.props.cursor>0)return t.props.store.doEdit({del:t.props.cursor-1}),t.props.store.setState({cursor:t.props.cursor-1});if("Backspace"===e.key)return;e.key.startsWith("Arrow")?"ArrowLeft"===e.key?t.props.cursor>0&&t.props.store.setState({cursor:t.props.cursor-1}):"ArrowRight"===e.key&&t.props.cursore.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:this.ship,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"dojo",i=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;this.bindPaths=me.a.uniq([].concat(rc(this.bindPaths),[e])),window.subscriptionId=this.channel.subscribe(n,r,e,(function(e){o(e)}),(function(t){i({data:t,from:{ship:n,path:e}})}),(function(e){o(e)}))}},{key:"soto",value:function(e){return this.action("dojo","sole-action",{id:this.dojoId,dat:e})}},{key:"action",value:function(e,t,n){var r=this;return new Promise((function(i,o){r.channel.poke(window.ship,e,t,n,(function(e){i(e)}),(function(e){o(e)}))}))}}])&&oc(t.prototype,n),r&&oc(t,r),e}();function sc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function lc(e){for(var t=1;t=t.ins.at&&(t.ins.at=i,t.ins.at++)}return t;default:throw"%sole-edit -lost.".concat(dc(e))}}}},{key:"commit",value:function(e){return this.ven[0]++,this.leg.push(e),this.apply(e)}},{key:"inverse",value:function(e){var t=this;switch(!1){case"nop"!==e:return e;case!e.map:return e.map((function(e){var n=t.inverse(e);return t.apply(e),n})).reverse();default:switch(Object.keys(e)[0]){case"set":return{set:this.buf};case"ins":return{del:e.ins};case"del":return{ins:{at:e.del,cha:this.buf[e.del]}};default:throw"%sole-edit -lost.".concat(dc(e))}}}},{key:"receive",value:function(e){var t=e.ler,n=e.ted;if(t[1]!==this.ven[1])throw"-out-of-sync.[".concat(dc(t)," ").concat(dc(this.ven),"]");this.leg=this.leg.slice(this.leg.length+t[0]-this.ven[0]);var r=this.transmute(this.leg,n);return this.ven[1]++,this.apply(r),r}},{key:"remit",value:function(){throw"stub"}},{key:"transmit",value:function(e){var t={ted:e,ler:[this.ven[1],this.ven[0]]};return this.commit(e),t}},{key:"transceive",value:function(t){var n=t.ler,r=t.ted,i=new e(this.buf),o=this.receive({ler:n,ted:r});return i.inverse(o)}},{key:"transpose",value:function(e,t){return void 0===t?this.transpose(this.leg,e):(null!=(n=this.transmute(e,{ins:{at:t}}).ins)?n:{at:0}).at;var n}}])&&uc(t.prototype,n),r&&uc(t,r),e}();function hc(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return this.contactViewAction({create:{path:e,ships:t,title:n,description:r}})}},{key:"groupAdd",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return this.action("group-store","group-action",{add:{members:t,path:e}})}},{key:"groupRemove",value:function(e,t){return this.action("group-store","group-action",{remove:{members:t,path:e}})}},{key:"contactShare",value:function(e,t,n,r){return this.contactViewAction({share:{recipient:e,path:t,ship:n,contact:r}})}},{key:"contactDelete",value:function(e){return this.contactViewAction({delete:{path:e}})}},{key:"contactRemove",value:function(e,t){return this.contactViewAction({remove:{path:e,ship:t}})}},{key:"contactHookAction",value:function(e){return this.action("contact-hook","contact-action",e)}},{key:"contactEdit",value:function(e,t,n){return this.contactHookAction({edit:{path:e,ship:t,"edit-field":n}})}},{key:"inviteAction",value:function(e){return this.action("invite-store","json",e)}},{key:"inviteAccept",value:function(e){return this.inviteAction({accept:{path:"/contacts",uid:e}})}},{key:"inviteDecline",value:function(e){return this.inviteAction({decline:{path:"/contacts",uid:e}})}},{key:"metadataAction",value:function(e){return this.action("metadata-hook","metadata-action",e)}},{key:"metadataAdd",value:function(e,t,n,r,i,o){var a="~".concat(window.ship);return this.metadataAction({add:{"group-path":t,resource:{"app-path":e,"app-name":"contacts"},metadata:{title:n,description:r,color:o,"date-created":i,creator:a}}})}},{key:"setSelected",value:function(e){this.store.handleEvent({data:{local:{selected:e}}})}}])&&Lc(t.prototype,n),r&&Lc(t,r),o}(Ae);function Pc(e){return(Pc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ac(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nc(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i,o=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function Bc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n