Merge pull request #4404 from urbit/la/sane-contact

sane: fix contact desyncs
This commit is contained in:
matildepark 2021-02-10 11:54:12 -05:00 committed by GitHub
commit ebeb789ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,11 +20,10 @@
:: their hooks :: their hooks
:: - Each group has its associated metadata and contacts :: - Each group has its associated metadata and contacts
:: - Each graph is being synced :: - Each graph is being synced
:: - Each chat is being synced
:: ::
/- *metadata-store, contacts=contact-store, *group /- *metadata-store, contacts=contact-store, *group
/+ default-agent, verb, dbug, resource, graph, mdl=metadata, group /+ default-agent, verb, dbug, resource, graph, mdl=metadata, group
~% %sane-app ..card ~ ~% %sane-app ..part ~
|% |%
+$ card card:agent:gall +$ card card:agent:gall
:: ::
@ -33,7 +32,6 @@
+$ issue +$ issue
$% [%lib-pull-hook-desync app=term =resource] $% [%lib-pull-hook-desync app=term =resource]
[%lib-push-hook-desync app=term =resource] [%lib-push-hook-desync app=term =resource]
[%contact-hook-desync =path]
[%dangling-md =resource] [%dangling-md =resource]
== ==
:: ::
@ -51,10 +49,10 @@
^- agent:gall ^- agent:gall
=< =<
|_ =bowl:gall |_ =bowl:gall
+* this . +* this .
sane-core +> sane-core +>
sc ~(. sane-core bowl) sc ~(. sane-core bowl)
def ~(. (default-agent this %|) bowl) def ~(. (default-agent this %|) bowl)
:: ::
++ on-init ++ on-init
^- (quip card _this) ^- (quip card _this)
@ -73,7 +71,7 @@
=/ act=action !<(action vase) =/ act=action !<(action vase)
=^ cards state =^ cards state
?- act ?- act
%fix fix-sane:sc %fix fix-sane:sc
%check print-sane:sc %check print-sane:sc
== ==
[cards this] [cards this]
@ -85,20 +83,16 @@
++ on-peek ++ on-peek
|= =path |= =path
^- (unit (unit cage)) ^- (unit (unit cage))
?. ?=([%x %bad-path ~] path) ?: ?=([%x %bad-path ~] path) ~
(on-peek:def path) (on-peek:def path)
~
:: ::
++ on-arvo on-arvo:def ++ on-arvo on-arvo:def
++ on-fail on-fail:def ++ on-fail on-fail:def
-- --
:: ::
|_ =bowl:gall |_ =bowl:gall
::
++ gra ~(. graph bowl) ++ gra ~(. graph bowl)
::
++ md ~(. mdl bowl) ++ md ~(. mdl bowl)
::
++ grp ~(. group bowl) ++ grp ~(. group bowl)
:: ::
++ foreign-keys ++ foreign-keys
@ -125,10 +119,10 @@
=> (lib-hooks-desync %group scry-groups) => (lib-hooks-desync %group scry-groups)
=> (lib-hooks-desync %graph get-keys:gra) => (lib-hooks-desync %graph get-keys:gra)
=> (lib-hooks-desync %metadata scry-groups) => (lib-hooks-desync %metadata scry-groups)
=> groups => contacts
metadata metadata
:: ::
++ groups ++ contacts
^+ fk-core ^+ fk-core
=/ groups=(list resource) =/ groups=(list resource)
~(tap in scry-groups) ~(tap in scry-groups)
@ -136,8 +130,12 @@
?~ groups ?~ groups
fk-core fk-core
=* group i.groups =* group i.groups
=? fk-core &((is-managed:grp group) !(~(has in scry-contact-syncs) group)) =? fk-core
(report %contact-hook-desync (en-path:resource group)) ?& (is-managed:grp group)
!=(our.bowl entity.group)
!(~(has in (tracking-pull-hook %contact-pull-hook)) group)
==
(report %lib-pull-hook-desync %contact-pull-hook group)
$(groups t.groups) $(groups t.groups)
:: ::
++ metadata ++ metadata
@ -209,15 +207,6 @@
%lib-push-hook-desync %lib-push-hook-desync
(poke-our app.issue push-hook-action+!>([%add resource.issue]))^~ (poke-our app.issue push-hook-action+!>([%add resource.issue]))^~
:: ::
%contact-hook-desync
=/ rid=resource
(de-path:resource path.issue)
=/ act
?: =(entity.rid our.bowl)
[%add-owned path.issue]
[%add-synced entity.rid path.issue]
(poke-our %contact-hook contact-hook-action+!>(act))^~
::
%dangling-md %dangling-md
=/ app-indices =/ app-indices
(~(get ju md-group-indices) resource.issue) (~(get ju md-group-indices) resource.issue)
@ -252,26 +241,6 @@
,(set resource) ,(set resource)
/x/[hook]/sharing/noun /x/[hook]/sharing/noun
:: ::
++ scry-contact-syncs
^- (set resource)
=- (~(run in -) de-path:resource)
%+ scry
,(set path)
/x/contact-hook/synced/noun
::
++ scry-chat-syncs
^- (set path)
%+ scry
,(set path)
/x/chat-hook/synced/noun
::
++ scry-chats
^- (set path)
%+ scry
,(set path)
/x/chat-store/keys/noun
::
::
++ md-group-indices ++ md-group-indices
(scry (jug resource md-resource) /y/metadata-store/group-indices) (scry (jug resource md-resource) /y/metadata-store/group-indices)
:: ::