-
Notifications
You must be signed in to change notification settings - Fork 309
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: Update group dependencies for new rfc model #6773
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6773 +/- ##
=======================================
Coverage 88.80% 88.81%
=======================================
Files 285 285
Lines 40280 40287 +7
=======================================
+ Hits 35771 35779 +8
+ Misses 4509 4508 -1 ☔ View full report in Codecov by Sentry. |
ietf/group/views.py
Outdated
@@ -737,26 +737,35 @@ def dependencies(request, acronym, group_type=None): | |||
|
|||
references = Q( | |||
Q(source__group=group) | Q(source__in=cl_docs), | |||
source__type="draft", | |||
source__type="draft", # does this need to be type__in=["draft", "rfc"]? Check for informative ref rfc->draft |
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.
I think likely not, but it might be a change from previous behavior without it.
Since this is only used for groups, we don't have to worry about rfcs that didn't come from drafts here.
The only use such data might have to the consumer of this function is knowing that some RFC inf-reffed this group's active draft. But that's a done deal, so the group won't really be motivated to do anything with the draft given this knowledge. So it's probably noise and shouldn't be on the graph in the first place.
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.
I looked at a handful of cases comparing against the 11.16.0 release (i.e., for posterity, the release before the one with the "new" rfc modeling) and did not see any where nodes were missing. That included some selected specifically because they had a refinfo
relationship pointing from an RFC to a group draft.
Also, I think the only way this could miss a relationship is if there was a relationship from an RFC to a group draft without there also having been a relationship from the draft that became the RFC to the group draft. Does that happen (aside from April 1 RFCs, which I feel pretty comfortable leaving off these plots except perhaps for amusement value)?
"expired": x.get_state("draft").slug == "expired", | ||
"replaced": x.get_state("draft").slug == "repl", | ||
"group": x.group.acronym if x.group.acronym != "none" else "", | ||
"id": x.became_rfc().name if x.became_rfc() else x.name, |
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.
Check this on a busy group and if the time is noticeable, I think we can get the db to grab this with the primary query instead of n+1 -ing it here.
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.
We might do that in a way the puts the conditional into the query as well, so that we don't see this pattern repeating.
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.
On the idr group (see below to gauge whether this is "busy", but it looks it to me), this brute force approach takes the request from 2-2.4 seconds up to 2.2-2.5 seconds on my dev machine. The code here is taking advantage of the caching in became_rfc()
, so I believe it's at least only paying the N+1 penalty and not hammering the db any worse than that.
(edit to add: the faster time is what I get if I replace all the became_rfc()
calls with simple references to name
or remove them entirely in the nodes.rfc
logic)
![image](https://private-user-images.githubusercontent.com/19472766/290356610-2c34c700-296d-4d77-a7a2-f28ddc891d02.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3NTAxNDksIm5iZiI6MTcxOTc0OTg0OSwicGF0aCI6Ii8xOTQ3Mjc2Ni8yOTAzNTY2MTAtMmMzNGM3MDAtMjk2ZC00ZDc3LWE3YTItZjI4ZGRjODkxZDAyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDEyMTcyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTllZWU5NjgxNjdjZTY3ZTkxNTI0MjY5MWZmMTQ3ODFhNjUyZWYwNDUzY2MxY2JhYjAwODY0YzRhYWVmN2FlMWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-mTB4LR4-VlndQsqU0dwh_gnv83WF_JAfuIwjuKwAZU)
We're only admitting source__type="draft", so no need to check it again in filter queries
This eliminates the attempts to get
state.slug
whenstate is None
, which superficially fixes the error in ticket #6768.PR is put up as a draft because I think more attention may be needed - some of the logic identifies RFCs by using the
draft
state. I think that should look at the type instead but I'm still sorting out what's meant to be going on.Fixes #6768