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(send_kcidb): Do not crash if optional field is missing #869

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nuclearcat
Copy link
Member

Some fields might be not present, as they are optional in model. Also add this field in custom checkout, even it is not mandatory, it is better to have it for consistency.

'git_repository_branch_tip':
checkout_node['data']['kernel_revision']['tip_of_branch'],
checkout_node['data']['kernel_revision'].get('tip_of_branch', False),
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can keep it None instead of False if the flag is not set.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok

@@ -600,7 +600,8 @@ async def checkout(data: ManualCheckout, request: Request,
"tree": treename,
"branch": branch,
"commit": commit,
"url": treeurl
"url": treeurl,
"tip_of_branch": False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Custom checkout can also have a commit from the tip of the branch. Why is it set False?

Copy link
Member Author

Choose a reason for hiding this comment

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

We cannot trust user to indicate if it is TOT, but to test it separately on our side will need additional logic to implement (or fix existing one).
We might check it later, as it is not critical right now, custom checkout events should not be sent to kcidb anyway (yet).

Some fields might be not present, as they are optional in model.
Also add this field in custom checkout, even it is not mandatory,
it is better to have it for consistency.

Signed-off-by: Denys Fedoryshchenko <[email protected]>
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.

2 participants