-
Notifications
You must be signed in to change notification settings - Fork 256
fix: prevent subscription cycles when adding subscriptions #8083
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
base: main
Are you sure you want to change the base?
Conversation
Dependency Review✅ No vulnerabilities or OpenSSF Scorecard issues found.Scanned FilesNone |
nickgerace
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!
| let prototype_id = AttributePrototypeArgument::prototype_id(ctx, apa_id).await?; | ||
| for av_id in AttributePrototype::attribute_value_ids(ctx, prototype_id).await? { | ||
| let subscriber_component_id = AttributeValue::component_id(ctx, av_id).await?; | ||
| // Don't add self-subscriptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| ) | ||
| .await?; | ||
|
|
||
| assert_eq!(false, SubscriptionGraph::new(ctx).await?.is_cyclic()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assert_eq!(false, SubscriptionGraph::new(ctx).await?.is_cyclic()); | |
| assert!(!SubscriptionGraph::new(ctx).await?.is_cyclic()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the two ! right next to each other don't make me happy :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No biggie!
Accidentally hit "approve" instead of "comment"!
38c031e to
29d389e
Compare
|
There's a weird error here with attribute prototype arguments not having prototypes which gets hit when constructing the graph. Investigating |
378d8be to
0716a89
Compare
0716a89 to
bc2d21d
Compare
|
/try |
|
Okay, starting a try! I'll update this comment once it's running... |
bc2d21d to
5f53fb9
Compare
5f53fb9 to
cd0bf0c
Compare
Construct a DependencyGraph of all components via their ValueSubscription edges and use that to detect subscription cycles when a subscription is set.
How to test this: create a bunch of subscriptions. Try to create a cycle, see that it fails. See that normal subscriptions don't fail.
Note: once this deploys, any graph that currently has subscription cycles will no longer be able to have new subscriptions.