Skip to content

[server] Add blame information to the execution path - #5207

Open
gulyasgergely902 wants to merge 2 commits into
Ericsson:masterfrom
gulyasgergely902:add-extended-blame-info
Open

gulyasgergely902 wants to merge 2 commits into
Ericsson:masterfrom
gulyasgergely902:add-extended-blame-info

Conversation

@gulyasgergely902

@gulyasgergely902 gulyasgergely902 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

fixes CODECHKR-7084

Previously blame information was only available at the end of the execution path.

This change adds an optional BlameInfo to both BugPathEvent and BugPathPos in the Thrift file which is populated
by the report server if the user asks for extended blame info via the --extended-blame-info toggle.

@thrift_client_call
def getRunResults(self, runIds, limit, offset, sortType, reportFilter,
cmpData, getDetails):
cmpData, getDetails, extendedBlameInfo=None):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we shouldn't add default parameters for this function.
Similarly the optional getDetails parameter also has no default value.

compare_data,
query_report_details):
query_report_details,
extended_blame_info=False):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would also remove the default parameter as False from here.

query_report_details = 'details' in args and args.details and \
args.output_format == 'json'

extended_blame_info = 'extended_blame_info' in args and \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you drop default=argparse.SUPPRESS from the argparse section, it is no longer needed to check 'extended_blame_info' in args

def getRunResults(self, run_ids, limit, offset, sort_types,
report_filter, cmp_data, get_details):
report_filter, cmp_data, get_details,
extended_blame_info=False):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Similarly, I would drop the default parameter.

report.runName = run_id2name[report.runId]

# The object blameInfo is coming from the server regardless of
# the state of the argument --extended-blame-info. This is a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The object blameInfo is coming from the server regardless of the state of the argument --extended-blame-info

Is this comment accurate? On the server side, I see if extended_blame_info: checks.

Can you explain why is the code below needed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The struct is set by the thrift generated python class and inside the blameInfo field is set to None. If the server does not send the blameInfo, it stays null and it is displayed in the returned JSON object. I've used this workaround to omit it if the user wants no extended blame info. I can leave the None there as it is for fixedAt right now for example, just thought it is cleaner not having it at all.

extended_blame_info = 'extended_blame_info' in args and \
args.extended_blame_info

if extended_blame_info and not query_report_details:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

query_report_details is only true if the output format was set to JSON.
Do we not plan to add extended blame info to the regular output?

Regardless, there error message "The --extended-blame-info option can be used only together with --details." is therefore misleading

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I was debating on this but for now I think only JSON should have the feature but later on we can implement it into other formats as well.
I've modified the error message to include ".. and the output format set to JSON.

# Get report details if it is required.
report_details = {}
blame_infos = {}
blame_cache = {}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why was another blame_cache added here? There is already one defined on line 2316.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good call, I've moved it along with blame_infos and report_details out of the if/else so it is not duplicated.

for r in query_result:
report_ids.append(r[0].id)
blame_infos[r[0].id] = self.getBlameInfo(r[0].file_id)
blame_infos[r[0].id] = self.__get_cached_blame_info(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This piece of code seems duplicated and was added to two different places.
I see that the surrounding code is also duplicated, but I think this code duplication should be fixed and not increased further.
I know it is generally out-of-scope of this PR, but I suggest adding a shared function that removes this entire duplicated part.

Previously blame information was only available at the end of the
execution path.

This change adds the blame info for every execution points.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants