From 17e1f6a043c74a4a2c37399cc32fd1d7ebc5b1e4 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Thu, 1 Oct 2020 20:31:34 -0500 Subject: [PATCH 1/6] chat-hook: fix dumb mistake --- pkg/arvo/app/chat-hook.hoon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index d2d3756f1f..46664679c3 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -94,8 +94,9 @@ %+ murn ~(tap in ~(key by synced.old)) |= =app=path ^- (unit path) - ?~ (groups-of-chat:cc app-path) ~ - `app-path + ?~ (groups-of-chat:cc app-path) + `app-path + ~ |- ?~ list-paths ^$(-.old %9) From 1db605646a0622db33c38771bf24e5afd9fe6e76 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Thu, 1 Oct 2020 20:45:20 -0500 Subject: [PATCH 2/6] chat-hook: wip recover state --- pkg/arvo/app/chat-hook.hoon | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index 46664679c3..cbc9948d70 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -24,8 +24,10 @@ state-7 state-8 state-9 + state-10 == :: ++$ state-10 [%10 state-base] +$ state-9 [%9 state-base] +$ state-8 [%8 state-base] +$ state-7 [%7 state-base] @@ -58,7 +60,7 @@ $% [%chat-update update:store] == -- -=| state-9 +=| state-10 =* state - :: %- agent:dbug @@ -87,9 +89,22 @@ =/ old !<(versioned-state old-vase) =| cards=(list card) |- - ?: ?=(%9 -.old) + ?: ?=(%10 -.old) [cards this(state old)] - ?: ?=(%8 -.old) + ?: ?=(%9 -.old) + =/ chat-keys=(set path) (scry-for (set path) %chat-store [%keys ~]) + =. cards + %+ weld cards + ^- (list card) + %+ turn ~(tap in chat-keys) + |= =app=path + ^- card + ?> ?=([@ @ ~] app-path) + =/ =ship (slav %p i.app-path) + ?: =(ship our.bol) + (add-owned app-path %.y) + (add-synced ship app-path) + :: =/ list-paths=(list path) %+ murn ~(tap in ~(key by synced.old)) |= =app=path @@ -102,6 +117,8 @@ ^$(-.old %9) =. synced.old (~(del by synced.old) i.list-paths) $(list-paths t.list-paths) + ?: ?=(%8 -.old) + $(-.old %9) ?: ?=(%7 -.old) =/ subscribers=(jug path ship) %+ roll ~(val by sup.bol) @@ -203,6 +220,17 @@ ^- (list (list card)) (turn ~(tap in keys) generate-cards) == + :: + ++ scry-for + |* [=mold app=term =path] + .^ mold + %gx + (scot %p our.bol) + app + (scot %da now.bol) + (snoc `^path`path %noun) + == + :: ++ kick-old-subs |= old-path=path ^- (list card) From f83674e985ae640ca6c789cbff61adff32991a0e Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Fri, 2 Oct 2020 01:59:14 +0000 Subject: [PATCH 3/6] chat-hook: do not remove chat if watch-nack --- pkg/arvo/app/chat-hook.hoon | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index cbc9948d70..143e23dc0c 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -860,13 +860,7 @@ ?: =(i.t.wir '~') ?> ?=(^ chat) (migrate-listen t.chat) - :_ state - %. ~[(chat-view-poke %delete chat)] - %- slog - :* leaf+"chat-hook failed subscribe on {(spud chat)}" - leaf+"stack trace:" - u.saw - == + [~ state] == :: ++ chat-poke From 43139fa38d3de5b00e611ee2da1f832b7b262db6 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Fri, 2 Oct 2020 02:04:20 +0000 Subject: [PATCH 4/6] chat-hook: fix infinite loop --- pkg/arvo/app/chat-hook.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index 143e23dc0c..4ef4528f9f 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -114,7 +114,7 @@ ~ |- ?~ list-paths - ^$(-.old %9) + ^$(-.old %10) =. synced.old (~(del by synced.old) i.list-paths) $(list-paths t.list-paths) ?: ?=(%8 -.old) From f34c1ba614bdc7f77df96404247a871340c76268 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Thu, 1 Oct 2020 21:18:51 -0500 Subject: [PATCH 5/6] chat-hook: added assert to remove infinite loop case --- pkg/arvo/app/chat-hook.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index cbc9948d70..e843fe1163 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -594,6 +594,7 @@ :: %add-synced ?> (team:title our.bol src.bol) + ?< =(ship.act our.bol) ?: (~(has by synced) path.act) [~ state] =. synced (~(put by synced) path.act ship.act) ?. ask-history.act From a968bb004b35ea3d33bade7fc70370f55f213369 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Thu, 1 Oct 2020 21:27:57 -0500 Subject: [PATCH 6/6] chat-hook: fix infinite loop from reconnecting to own dm --- pkg/arvo/app/chat-hook.hoon | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/arvo/app/chat-hook.hoon b/pkg/arvo/app/chat-hook.hoon index e9e6e8820f..c4141470b2 100644 --- a/pkg/arvo/app/chat-hook.hoon +++ b/pkg/arvo/app/chat-hook.hoon @@ -92,6 +92,17 @@ ?: ?=(%10 -.old) [cards this(state old)] ?: ?=(%9 -.old) + =. cards + %+ weld cards + ^- (list card) + %+ roll ~(tap in ~(key by wex.bol)) + |= [[=wire =ship =term] out=(list card)] + ?> ?=([@ *] wire) + ?. ?&(=(ship our.bol) =(term %chat-hook)) + out + :_ out + =- [%pass / %agent [our.bol %chat-hook] %poke %chat-hook-action !>(-)] + [%remove t.wire] =/ chat-keys=(set path) (scry-for (set path) %chat-store [%keys ~]) =. cards %+ weld cards