Skip to content

Fix/hydrate shape cache#995

Merged
dpetran merged 4 commits intomainfrom
fix/hydrate-shape-cache
Apr 10, 2025
Merged

Fix/hydrate shape cache#995
dpetran merged 4 commits intomainfrom
fix/hydrate-shape-cache

Conversation

@dpetran
Copy link
Contributor

@dpetran dpetran commented Apr 9, 2025

When loading an existing ledger we need to hydrate the SHACL shape cache. If no cached shapes are found in a transaction that has no shape flakes, no validation will be performed.

dpetran added 2 commits April 9, 2025 13:36
If no cached shapes are found in a transaction that has no shape flakes, no validation
will be performed.
@dpetran
Copy link
Contributor Author

dpetran commented Apr 9, 2025

Tests are currently in the server PR: I've got some tests in fluree/server#130.

@dpetran dpetran requested a review from a team April 9, 2025 20:14
@dpetran dpetran force-pushed the fix/hydrate-shape-cache branch from 10f5ba1 to ae525a9 Compare April 9, 2025 20:46
@dpetran
Copy link
Contributor Author

dpetran commented Apr 9, 2025

The CI linter revealed that we have no -class-ids implementation for an AsyncDB, so I added that. I've also added a -contains-key? implementation to Flake to flesh out the IAssociative protocol.

I'm not sure why the linter started complaining now, but they were pretty straightforward.

(if (= commit-t index-t)
indexed-db*
(<? (load-novelty commit-catalog indexed-db* index-t commit-jsonld)))))))
(<? (shacl/hydrate-shape-cache!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should add another let binding here instead of this deeply nested async call.

(let [new-shapes (<? (rebuild-shapes db))]
(reset-shape-cache! db new-shapes) ;; TODO - there is really no reason this needs to be an atom any longer
(vals new-shapes))))
(reset-shape-cache! db new-shapes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should change the reset-shape-cache! function to return the db it was passed in.

@dpetran dpetran merged commit a1f562e into main Apr 10, 2025
8 checks passed
@dpetran dpetran deleted the fix/hydrate-shape-cache branch April 10, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants