sane: add dangling metadata checker

This commit is contained in:
Liam Fitzgerald 2021-01-12 14:52:52 +10:00
parent 2cd5e462b0
commit aec6b1d754
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -24,7 +24,7 @@
::
/- *metadata-store, contacts=contact-store, *group
/+ default-agent, verb, dbug, resource, graph, mdl=metadata, group
~% %sane-app ..is ~
~% %sane-app ..card ~
|%
+$ card card:agent:gall
::
@ -35,7 +35,7 @@
[%lib-push-hook-desync app=term =resource]
[%md-hook-desync =path]
[%contact-hook-desync =path]
[%chat-desync =path]
[%dangling-md =path]
==
::
+$ issues
@ -112,7 +112,7 @@
::
++ abet-fix
^- (list card)
(turn issues fix-issue)
(zing (turn issues fix-issue))
::
++ report
|= =issue
@ -125,18 +125,8 @@
++ check-all
=> (lib-hooks-desync %group scry-groups)
=> (lib-hooks-desync %graph get-keys:gra)
groups
::
++ chat
^+ fk-core
=/ missing=(set path)
(~(dif in scry-chats) scry-chat-syncs)
%- report-many
%+ turn
~(tap in missing)
|= =path
^- issue
[%chat-desync path]
=> groups
metadata
::
++ groups
^+ fk-core
@ -152,6 +142,19 @@
(report %contact-hook-desync (en-path:resource group))
$(groups t.groups)
::
++ metadata
^+ fk-core
=/ md-groups=(list path)
~(tap in ~(key by md-group-indices))
|-
?~ md-groups
fk-core
=/ rid=resource
(de-path:resource i.md-groups)
=? fk-core !(~(has in scry-groups) rid)
(report %dangling-md i.md-groups)
$(md-groups t.md-groups)
::
++ lib-hooks-desync
|= [app=term storing=(set resource)]
^+ fk-core
@ -194,20 +197,21 @@
=> foreign-keys
=> check-all
abet
~& issues
`state
::
++ fix-issue
|= =issue
^- card
|^
^- (list card)
?- -.issue
::
%lib-pull-hook-desync
=* rid resource.issue
(poke-our app.issue pull-hook-action+!>([%add entity.rid rid]))
(poke-our app.issue pull-hook-action+!>([%add entity.rid rid]))^~
::
%lib-push-hook-desync
(poke-our app.issue push-hook-action+!>([%add resource.issue]))
(poke-our app.issue push-hook-action+!>([%add resource.issue]))^~
::
%md-hook-desync
=/ rid=resource
@ -216,7 +220,7 @@
?: =(entity.rid our.bowl)
[%add-owned path.issue]
[%add-synced entity.rid path.issue]
(poke-our %metadata-hook metadata-hook-action+!>(act))
(poke-our %metadata-hook metadata-hook-action+!>(act))^~
::
%contact-hook-desync
=/ rid=resource
@ -225,15 +229,16 @@
?: =(entity.rid our.bowl)
[%add-owned path.issue]
[%add-synced entity.rid path.issue]
(poke-our %contact-hook contact-hook-action+!>(act))
%chat-desync
=/ =ship
(slav %p (snag 0 path.issue))
=/ act
?: =(ship our.bowl)
[%add-owned path.issue %.n]
[%add-synced ship path.issue %.n]
(poke-our %chat-hook chat-hook-action+!>(act))
(poke-our %contact-hook contact-hook-action+!>(act))^~
::
%dangling-md
=/ app-indices
(~(get ju md-group-indices) path.issue)
%+ turn
~(tap in app-indices)
|= =md-resource
^- card
(poke-our %metadata-store metadata-action+!>([%remove path.issue md-resource]))
==
::
++ poke-our
@ -286,6 +291,9 @@
,(set path)
/x/chat-store/keys/noun
::
++ md-group-indices
(scry (jug group-path md-resource) /y/metadata-store/group-indices)
::
++ scry
|* [=mold =path]
^- mold