logseq / graph-validator

Validate your logseq graphs
MIT License
48 stars 0 forks source link

Understanding Output #4

Closed kerim closed 1 year ago

kerim commented 1 year ago

I think I finally got proper output from graph-validator, but I'm not sure how to interpret it, or what to do about the issues it raises?

I have 51 messages that start with: "Logseq will assign a new id for this block"

And I have 6 error messages in the form:

FAIL in (block-refs-link-to-blocks-that-exist) (:42) FAIL in (advanced-queries-have-valid-schema) (:82) FAIL in (advanced-queries-have-valid-schema) (:88) FAIL in (assets-exist-and-are-used) (:121) FAIL in (tags-and-page-refs-have-pages) (:203) FAIL in (tags-and-page-refs-have-pages) (:206)

What do I do with this information?

Thanks.

kerim commented 1 year ago

I don't want to share the full output here because of privacy concerns (it is hard to know what sensitive data might be in there, because it is a very long document), but I could DM it to you or share it on Discord if you want to look.

logseq-cldwalker commented 1 year ago

Good question on what to do with the errors. I've added https://github.com/logseq/graph-validator/tree/main#default-validations which explains what each of those validations are. I'd recommend disabling all the validations except for one so you can focus on just getting one to pass. You can do this by creating a .graph-validator/config.edn file. For example, this config would disable all except for block-refs-link-to-blocks-that-exist.

{:exclude
  [embed-block-refs-link-to-blocks-that-exist advanced-queries-have-valid-schema invalid-properties-dont-exist assets-exist-and-are-used tags-and-page-refs-have-pages]}
kerim commented 1 year ago

Thanks. That helps a lot...

I still don't understand "Logseq will assign a new id for this block"? Should I just ignore those?

kerim commented 1 year ago

I also seem to not be creating the config.edn file correctly. I tried in both ~/graph-validator as well as creating a new folder called .graph-vaildator and moving it in there, but the output was the same every time... Does this .graph-vaildator folder need to be in a special location?

logseq-cldwalker commented 1 year ago

Should I just ignore those?

For now yep

Does this .graph-vaildator folder need to be in a special location?

Looks like a typo. It's .graph-validator, with config.edn in that directory

kerim commented 1 year ago

I just checked. There may have been a typo in my post, but there is no typo in the name of the folder. But the folder is in the root level of my user directory. Should it be inside the ~/graph-validator directory, or somewhere else? Something is wrong, because it isn't doing anything. Or maybe it is the content of the file? I just have the text you posted above, is some other text necessary before or after that?

logseq-cldwalker commented 1 year ago

.graph-validator is in the graph directory. Worth reading https://github.com/logseq/graph-validator#configuration if you haven't yet

kerim commented 1 year ago

Ah, that explains it. Somehow missed that. Thanks.

kerim commented 1 year ago

So now that I've narrowed the results down to one error (apart from those pesky "Logseq will assign a new id for this block" notifications), I still don't know what to do with this information. For instance:

FAIL in (block-refs-link-to-blocks-that-exist) (:42)
expected: (empty? (set/difference (set block-refs) (->> (d/q (quote [:find (pull ?b [:block/properties]) :in $ % :where (has-property ?b :id)]) (clojure.core/deref state/db-conn) (vals rules/query-dsl-rules)) (map first) (map (comp :id :block/properties)) set)))
  actual: (not (empty? #{"619cc735-8d1a-4843-aef6-da2186f8cc2e" "619cc735-78ce-47d9-b3fe-22d9cfc18f40" "619cc735-221b-4c03-b36d-ff9fa9aefe98" "619cc735-131c-4e43-ba08-d858199bbabb" "619cc735-f04b-4410-944d-f2888e2d5b53" ...  "619cc735-0491-44e8-b23f-b68ee3782b18" "619cc735-5c47-4b31-8562-33ca685b4946"}))

I've actually shorted that greatly, it goes on for pages and pages...

kerim commented 1 year ago

I did a finder search for the first block ref and found it in a bak file. Seems like I should probably archive this entire bak folder somewhere and run everything again. More on the bak folder for anyone interested in what it is and how the files get created: https://discuss.logseq.com/t/can-i-delete-the-contents-within-the-bak-folder/8068/3

UPDATE: after removing this folder, be sure to toggle git versioning off and on again in the settings, otherwise you will get an error when running the script.

kerim commented 1 year ago

So, archiving the bak folder removed hundreds and hundreds of error messages. Now there are just a handful which I can probably find manually. I think I can manage from here... thanks again!