-
Notifications
You must be signed in to change notification settings - Fork 20
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 issue that causes illegal diff query #5291
Conversation
CodSpeed Performance ReportMerging #5291 will not alter performanceComparing Summary
|
# keep the diff that covers the larger time frame | ||
if candidate_interval > previous_interval: | ||
ordered_diffs_no_overlaps[-1] = candidate_diff_pair | ||
return ordered_diffs_no_overlaps |
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.
strip out overlapping diffs. when two diffs overlap, keep the one that covers the greater time range
remaining_diffs = sorted(partial_enriched_diffs, key=lambda d: d.diff_branch_diff.from_time) | ||
ordered_diffs = self._get_ordered_diff_pairs(diff_pairs=partial_enriched_diffs, allow_overlap=False) | ||
ordered_diff_reprs = [repr(d) for d in ordered_diffs] | ||
log.debug(f"Ordered diffs for aggregation: {ordered_diff_reprs}") |
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.
a little logging to help us troubleshoot if this comes up again
if sorted_time_ranges[-1].to_time < to_time: | ||
missing_time_ranges.append(TimeRange(from_time=sorted_time_ranges[-1].to_time, to_time=to_time)) | ||
return missing_time_ranges | ||
|
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.
dead code
AND ( | ||
(from_time <= diff_rel.from < $to_time) | ||
OR (from_time <= diff_rel.to < $to_time) | ||
) |
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.
fix in the query to calculate a diff
assert property_diff.previous_value is False | ||
assert property_diff.new_value is None | ||
assert property_diff.action is DiffAction.REMOVED | ||
assert before_main_change < property_diff.changed_at < after_main_change |
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.
fix to this unit test after the fix to the diff query
IFC-1013
when aggregating multiple diffs as part of a diff update, if any diffs in the aggregation list overlapped it would cause an illegal diff query to be created in which the
to_time
was before thefrom_time
this fix is to go through the list of diffs to aggregate and remove any that overlap, giving preference to the diff that covers the greater time range
also fixes a small bug in the diff query that could cause a diff for an arbitrary time frame (meaning a
to_time
other than "right now") to not include changes. this is not something a user would encounter unless they are using GraphQL to generate their own diffs with arbitrary time ranges outside of the branch/proposed change process. and I highly doubt anyone is doing that