Fixed a bug where rbt land was unable to determine the approval state of a review request.
Review Request #8401 — Created Sept. 17, 2016 and submitted
Fixed a bug where rbt land was unable to determine the approval state
of a review request.This change introduces default values to
is_rr_approved
and
approval_failure
before attempting to retrieve information from the
review request. In the event an exception is encountered, RBTools will
fail gracefully without disclosing a stack trace.
Ran the land command multiple times, and observed its functionality
with and without ship-its. Noted that functionality is unaffected
for normal use cases.
Description | From | Last Updated |
---|---|---|
Can you wrap your description and testing done at 72 characters? |
brennie | |
You cleaned up the description but not the summary. Can you do that as well? |
brennie | |
Nit: Needs period. |
mike_conley | |
Add a blank line after this. |
david | |
So there are a couple states that can be hit where defaults come into play, not all of which are … |
chipx86 | |
Now that we have a generic exception handler I don't think we need to set the default values. |
david | |
These are indented too far. |
david | |
This should be raise CommandError(...) |
brennie | |
Alphabetize these. |
brennie | |
e on next line. |
brennie |
- Change Summary:
-
Addressed mconley's nit.
- Commit:
-
5c43cbcd5ee02ba7af2a584d41ab825234f3f1786f033809de52b5921b0a5f4befa6d3b9bf0e8307
- Diff:
-
Revision 2 (+5)
-
Tool: Pyflakes Processed Files: rbtools/commands/land.py Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py
- Change Summary:
-
Updated bug tracker on review request.
- Bugs:
-
Can you fix up your summary to be a bit less specific about the code change? Something like "Fix a bug where rbt land was unable to find the approval state".
In the description, it looks like your code blocks (things in `) have escape characters. Mind editing that so that any reference to
is_rr_approved
shows up with the nice code block syntax? Things likeException
andAttributeError
should be similarly marked. -
- Description:
-
~ Currently, 'is_rr_approved' may not be set during execution of RBTools' land command
~ Fixed a bug where rbt land was unable to determine the approval state of a review request.
- if an Exception other than AttributeError is encountered. ~ This change introduces default values to `is_rr_approved` and `approval_failure` before
~ This change introduces default values to
is_rr_approved
andapproval_failure
beforeattempting to retrieve information from the review request. In the event an exception is encountered, RBTools will fail gracefully without disclosing a stack trace. - Commit:
-
6f033809de52b5921b0a5f4befa6d3b9bf0e83071dc2a8a05ce9b251889213ab3039a4d28266f4e5
- Diff:
-
Revision 3 (+6)
-
Tool: Pyflakes Processed Files: rbtools/commands/land.py Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py
- Summary:
-
Setting a default 'is_rr_approved' value for land command outside try block.Fixed a bug where rbt land was unable to determine the approval state of a review request.
- Description:
-
~ Fixed a bug where rbt land was unable to determine the approval state of a review request.
~ Fixed a bug where rbt land was unable to determine the approval state
+ of a review request. ~ This change introduces default values to
is_rr_approved
andapproval_failure
before~ attempting to retrieve information from the review request. In the event an exception is ~ encountered, RBTools will fail gracefully without disclosing a stack trace. ~ This change introduces default values to
is_rr_approved
and~ approval_failure
before attempting to retrieve information from the~ review request. In the event an exception is encountered, RBTools will + fail gracefully without disclosing a stack trace. - Testing Done:
-
~ Ran the land command multiple times, and observed its functionality with and without ship-its. Noted that functionality is unaffected for normal use cases.
~ Ran the land command multiple times, and observed its functionality
+ with and without ship-its. Noted that functionality is unaffected + for normal use cases.
-
Can you wrap your Description/Testing Done to about 75 characters per line? The text is used directly for commit messages, and having those at the proper length will help us land your changes sooner. Thanks!
-
So there are a couple states that can be hit where defaults come into play, not all of which are errors.
1) It's an older Review Board, which doesn't have these fields (thus the
AttributeError
where we simulate it).
2) We get an unknown exception (maybereview_request
isn't what we think, or something else goes very wrong).
3) This doesn't get hit in practice (but a linter would have a problem with it):is_rr_approved
can beTrue
whileapproval_failure
can be undefined. This would happen if we hit theAttributeError
andship_it_count > 0
. While not used directly, it would be nice to have some default here.The default added for
approval_failure
is only appropriate in case #2, where there's some unknown exception. Now, it's not clear from the bug report what sort of exception was hit, but I think what we should have here is anexcept Exception as e:
in that wholetry/except
block.This handler wouldn't need to set a default, but rather would:
1) Log the exception (using
logging.exception
and saying something like'Unexpected error when looking up review request approval state: %s' % e
)
2) Immediately raise aCommandError
with the text you're currently setting as the default forapproval_failure
.It might still make sense to set the defaults above, but I'd set
approval_failure
toNone
. This would just be to satisfy any linters, but it's too early to assume anything about the failure at this part of the code.
- Commit:
-
1dc2a8a05ce9b251889213ab3039a4d28266f4e56aa61bc09c1f0dcfbe934b26f990effde7f39d70
- Diff:
-
Revision 4 (+13)
-
Tool: Pyflakes Processed Files: rbtools/commands/land.py Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py
- Commit:
-
6aa61bc09c1f0dcfbe934b26f990effde7f39d70224f4264c58efed36940c9eeda4c7f64705db751
- Diff:
-
Revision 5 (+8)
-
Tool: Pyflakes Processed Files: rbtools/commands/land.py Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py
- Commit:
-
224f4264c58efed36940c9eeda4c7f64705db751fbabfe7289804f72309e93826ed9365dea43023b
- Diff:
-
Revision 6 (+8)
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/land.py Tool: Pyflakes Processed Files: rbtools/commands/land.py
- Commit:
-
fbabfe7289804f72309e93826ed9365dea43023b49c4e269721d03b4f00f7896a288c15d3fd5c621
- Diff:
-
Revision 7 (+9)