Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/remove internal context #701

Merged
merged 66 commits into from
Dec 13, 2023
Merged

Fix/remove internal context #701

merged 66 commits into from
Dec 13, 2023

Conversation

zonotope
Copy link
Contributor

This patch removes default contexts from connection, ledger, and database objects and updates the tests not to rely on them. Now the only contexts ever considered while processing a query or transaction are the contexts supplied along with said query or transaction.

@zonotope zonotope added this to the 3.0.0-beta2 milestone Dec 12, 2023
@zonotope zonotope requested a review from a team December 12, 2023 15:52
@zonotope zonotope self-assigned this Dec 12, 2023
Copy link
Contributor

@mpoffald mpoffald left a comment

Choose a reason for hiding this comment

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

🧹

(let [ctx (:context parsed-opts)
s-ctx (:supplied-context parsed-opts)
parsed-txn (q-parse/parse-txn txn ctx)
db* (if-let [policy-identity (perm/parse-policy-identity parsed-opts s-ctx)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a separate ctx and s-ctx? I think the ctx removes the fluree named context just so we don't shadow the user's vocab terms by accident (if they want to define where or insert or whatever. I think we do need the fluree named context for the policy-identity, though, so maybe that should just be a documentation note.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good point. I don't think the policy stuff is done. I have a TODO somewhere else regarding that, but I'll add a todo here too so we can clean this up when we streamline the apis and do the required parsing/validation/transformation steps all at once.

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 we do need the fluree named context for the policy-identity, though

The context passed to the policy-identity process is just used to expand the role iri. That doesn't require the fluree named context

Copy link
Contributor

Choose a reason for hiding this comment

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

When I added expansion for role iris that doesn't use default context (in this PR #693), I added the :supplied-context opt to differentiate it from the context used elsewhere in the transaction process. At the time, the "txn context" was the result of a calculation which included default context. So this was a workaround to remove dependency on default-context from role iri expansion, without ripping out default context altogether. But I think there should just be one context, and it should be the one supplied by the user in the request. That's what should be used to expand role iris

I see now that the TODO I left was misleading, I didn't mean that we were to preserve the separate :supplied-context opt itself, rather the opposite

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 ideally we would just have ctx, and if I understand Marcela's point then the s-ctx idea was just a workaround until we removed default context, so I think we would be safe just using ctx here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just pushed a commit removing it and cleaning up some more context handling.

Copy link
Contributor

@dpetran dpetran left a comment

Choose a reason for hiding this comment

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

🧹

@zonotope zonotope merged commit 1142992 into main Dec 13, 2023
7 checks passed
@zonotope zonotope deleted the fix/remove-internal-context branch December 13, 2023 17:02
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.

3 participants