Require validation for DiffCommits when posting
Review Request #9920 — Created May 9, 2018 and submitted
Information | |
---|---|
brennie | |
Review Board | |
release-4.0.x | |
|
|
9921 | |
1e5bd7d... | |
Reviewers | |
reviewboard | |
We now require that diffs for an entire series of commits be validated
before posting to theDraftDiffCommitResource
. Validation is performed
by making a series ofPOST
requests to the
ValidateDiffCommitResource
, each of which returns validation data to
be included in the next request. The validation data from each request
to the validation resource must then be used toPOST
to the
DraftDiffCommitResource
.This ensures that we do not upload broken diffs and also allows us to
upload more complex commit series. Previously, only linear commit series
where each commit modified different files were capable of being
uploaded. Now all linear commit series can be uploaded.
Posted /r/9609/ through to this commit to a single review request.
Ran unit tests.
Description | From | Last Updated |
---|---|---|
Can you rename the file to "commit_utils.py"? |
|
|
F401 'djblets.webapi.errors.INVALID_FORM_DATA' imported but unused |
![]() |
|
This is way too generic a name. I'd prefer get_file_exists_for_validation. Not sure this file is the right place, actually. This … |
|
|
This can wrap. |
|
|
You can now split this across lines at a . |
|
|
bool |
|
|
Did you mean to unindent the line? Doesn't seem like it would particularly matter in this change. |
|
|
Can you import specifically waht you need from the module, instead of the module itself? |
|
|
I imagine this should be a HiddenInput? We don't want users mucking about in it if we display this anywhere. |
|
|
"Validation metadata" |
|
|
The text should specifically be self.fields['validation_info'].error_messages['required']. No need for ugettext. |
|
|
Shouldn't include literals in summaries. |
|
|
Extra period on this line. |
|
|
Too many periods. |
|
|
"exceptions" |
|
|
Maybe better as: if not validation_info: return {} # .. rest of the method |
|
|
b64decode can also raise TypeError. |
|
|
The return can be inline. |
|
|
Maybe "A form for validating DiffCommits." |
|
|
"Parent diff" |
|
|
"Validation metadata" |
|
|
"Base commit ID" |
|
|
No literals in summaries. |
|
|
Too many periods. |
|
|
Same comments as above. Seems we have some stuff we could easily pull out into a base class? |
|
|
This seems like code we have elsewhere. I'd like to deduplicate this if possible. |
|
|
We should pull out the specific functions we need. |
|
|
This can be wrapped. |
|
|
This can be broken into multiple lines now at any . |
|
|
No literals in summaries. |
|
|
Mixing import groups here. |
|
|
Shouldn't DiffCommit be handling this? |
|
|
Ordering issues. |
|
|
The DIFF_* should be in alphabetical order. |
|
|
E501 line too long (90 > 79 characters) |
![]() |
|
E501 line too long (84 > 79 characters) |
![]() |
|
E126 continuation line over-indented for hanging indent |
![]() |
|
Can we include the error details in this? That'd help with debugging. |
|
|
Trailing comma. |
|
|
Can we use keyword arguments for all calls to this, here and everywhere else in the change? It's a complex … |
|
|
This will create a tuple of strings. |
|
|
This creates a tuple. |
|
|
This too. |
|
|
Can you use references throughout the docstrings whenever you're referencing another resource? They're in the form of webapi2.0-<blah>-resource or webapi2.0-<blah>-list-resource. |
|
|
It doesn't really return "OK." I feel that can be misleading. We probably can remove the whole "either OK or … |
|
|
Double backticks for validation_info. Also, "field" and not "parameter." |
|
|
Can you switch to a named logger for the module? |
|
|
Missing trailing comma. |
|
|
F841 local variable 'validation_info' is assigned to but never used |
![]() |
|
F821 undefined name 'on_info' |
![]() |
|
E501 line too long (120 > 79 characters) |
![]() |
|
F841 local variable 'validation_info' is assigned to but never used |
![]() |
|
F821 undefined name 'on_info' |
![]() |
|
E501 line too long (82 > 79 characters) |
![]() |
|
E501 line too long (91 > 79 characters) |
![]() |
|
W391 blank line at end of file |
![]() |
|
F841 local variable 'parent_diff' is assigned to but never used |
![]() |
|
Newlines in exceptions are generally not going to be handled well, either in HTML or in logs. Maybe: Could not … |
|
|
Missing trailing comma. |
|
|
You can consolidate these. |
|
|
Missing a trailing period. |
|
|
Name should be GetFileExistsInHistoryTests. |
|
|
For here and any others, can we use called_with() and check the arguments? |
|
|
Extra blank line here. |
|
|
Missing a period. |
|
|
Extra blank line. |
|
|
You can align these starting on the initial call. There should be plenty of room. |
|
|
Can you include the repository ID? That'll help with RBCommons. |
|
|
This line's too long. You can break at a . |
|
|
Can you explain why here? |
|
|
E501 line too long (82 > 79 characters) |
![]() |
|
F821 undefined name 'revision' |
![]() |
|
E501 line too long (80 > 79 characters) |
![]() |
|
This sounds confusing. Can you say: The "%s" repository does not support review requests with commit history. |
|
|
Blank line between these. |
|
Change Summary:
Fix unit test failures.
Depends On: |
|
||||
---|---|---|---|---|---|
Commit: |
|
||||
Diff: |
Revision 2 (+1703 -9) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/webapi/tests/test_validate_diff_commit.py (Diff revision 2) Show all issues
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+1714 -9) |
Checks run (2 succeeded)
Change Summary:
diff_commit_count -> diffcommit_count
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+1714 -9) |
Checks run (2 succeeded)
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+1717 -10) |
Checks run (2 succeeded)
-
Apparently I never published this review, which I made a while back. My apologies if comments are pretty stale now. I'll do another as I get through the chain back to this.
-
-
reviewboard/diffviewer/commitutils.py (Diff revision 4) This is way too generic a name. I'd prefer
get_file_exists_for_validation
.Not sure this file is the right place, actually. This is about validation and not commits themselves.
-
-
-
reviewboard/diffviewer/filediff_creator.py (Diff revision 4) Did you mean to unindent the line? Doesn't seem like it would particularly matter in this change.
-
reviewboard/diffviewer/forms.py (Diff revision 4) Can you import specifically waht you need from the module, instead of the module itself?
-
reviewboard/diffviewer/forms.py (Diff revision 4) I imagine this should be a
HiddenInput
? We don't want users mucking about in it if we display this anywhere. -
-
reviewboard/diffviewer/forms.py (Diff revision 4) The text should specifically be
self.fields['validation_info'].error_messages['required']
. No need forugettext
. -
-
-
-
reviewboard/diffviewer/forms.py (Diff revision 4) Maybe better as:
if not validation_info: return {} # .. rest of the method
-
-
-
-
-
-
-
-
-
reviewboard/diffviewer/forms.py (Diff revision 4) Same comments as above.
Seems we have some stuff we could easily pull out into a base class?
-
reviewboard/diffviewer/forms.py (Diff revision 4) This seems like code we have elsewhere. I'd like to deduplicate this if possible.
-
reviewboard/diffviewer/managers.py (Diff revision 4) We should pull out the specific functions we need.
-
reviewboard/diffviewer/managers.py (Diff revision 4) This can be broken into multiple lines now at any
.
-
-
-
-
-
reviewboard/webapi/resources/validate_diff_commit.py (Diff revision 4) The
DIFF_*
should be in alphabetical order.
Change Summary:
Addressed the majority of open issues.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+1711 -29) |
Checks run (2 succeeded)
Change Summary:
Addressed remaining feedback
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 7 (+1711 -29) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/diffviewer/tests/test_commit_utils.py (Diff revision 7) E501 line too long (90 > 79 characters)
-
reviewboard/diffviewer/tests/test_commit_utils.py (Diff revision 7) E501 line too long (84 > 79 characters)
Change Summary:
Fixup Flake8 issues
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 8 (+1713 -29) |
Checks run (2 succeeded)
Change Summary:
Keep track of add/modify/remove in parent diff
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 9 (+1923 -29) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/webapi/tests/test_validate_diffcommit.py (Diff revision 9) E126 continuation line over-indented for hanging indent
Change Summary:
flake8
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 10 (+1923 -29) |
Checks run (2 succeeded)
-
-
reviewboard/diffviewer/forms.py (Diff revision 10) Can we include the error details in this? That'd help with debugging.
-
-
reviewboard/diffviewer/tests/test_commit_utils.py (Diff revision 10) Can we use keyword arguments for all calls to this, here and everywhere else in the change? It's a complex enough function where we should ensure calls are self-documenting.
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 10) This will create a tuple of strings.
-
-
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 10) Can you use references throughout the docstrings whenever you're referencing another resource? They're in the form of
webapi2.0-<blah>-resource
orwebapi2.0-<blah>-list-resource
. -
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 10) It doesn't really return "OK." I feel that can be misleading. We probably can remove the whole "either OK or an error" and just say "a result representing whether ..."
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 10) Double backticks for
validation_info
.Also, "field" and not "parameter."
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 10) Can you switch to a named logger for the module?
-
Change Summary:
Addressed issues, added docs.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 11 (+1924 -29) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/diffviewer/tests/test_commit_utils.py (Diff revision 11) F841 local variable 'validation_info' is assigned to but never used
-
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 11) E501 line too long (120 > 79 characters)
Change Summary:
actually commit changes >.>
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 12 (+1934 -29) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/diffviewer/tests/test_commit_utils.py (Diff revision 12) F841 local variable 'validation_info' is assigned to but never used
-
Change Summary:
fixups
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 13 (+1934 -29) |
Checks run (2 succeeded)
Change Summary:
fix unit tests
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 14 (+1938 -29) |
Checks run (2 succeeded)
Change Summary:
- Do not include parent diff into in validation_info
- Allow parent_diff in subsequent commit validation
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 15 (+1905 -29) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 15) E501 line too long (82 > 79 characters)
-
reviewboard/webapi/tests/test_validate_diffcommit.py (Diff revision 15) E501 line too long (91 > 79 characters)
-
reviewboard/webapi/tests/test_validate_diffcommit.py (Diff revision 15) W391 blank line at end of file
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 16 (+1906 -29) |
Checks run (2 succeeded)
Change Summary:
Clean up unit tests due to validation changes. No longer process parent filediffs in validator
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 17 (+1895 -29) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/diffviewer/forms.py (Diff revision 17) F841 local variable 'parent_diff' is assigned to but never used
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 18 (+1899 -29) |
Checks run (2 succeeded)
-
-
reviewboard/diffviewer/forms.py (Diff revision 18) Newlines in exceptions are generally not going to be handled well, either in HTML or in logs. Maybe:
Could not parse validation info %(validation_info)s: %(exc)s
-
-
-
-
reviewboard/diffviewer/tests/test_commit_utils.py (Diff revision 18) Name should be
GetFileExistsInHistoryTests
. -
reviewboard/diffviewer/tests/test_commit_utils.py (Diff revision 18) For here and any others, can we use
called_with()
and check the arguments? -
-
-
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 18) You can align these starting on the initial call. There should be plenty of room.
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 18) Can you include the repository ID? That'll help with RBCommons.
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 18) This line's too long. You can break at a
.
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 19 (+1898 -29) |
Checks run (1 failed, 1 succeeded)
flake8
Change Summary:
Fix issues introduced with git rerere
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 20 (+1886 -33) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/diffviewer/tests/test_forms.py (Diff revision 20) E501 line too long (80 > 79 characters)
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 21 (+1886 -33) |
Checks run (2 succeeded)
-
Small issues.
-
reviewboard/webapi/resources/validate_diffcommit.py (Diff revision 21) This sounds confusing. Can you say:
The "%s" repository does not support review requests with commit history.
-
Change Summary:
Addressed Christian's feedback.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 22 (+1882 -29) |
Checks run (2 succeeded)
Change Summary:
Addressed Christian's feedback.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 23 (+1886 -29) |
Checks run (2 succeeded)
Change Summary:
Unit test fixes
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 24 (+1888 -29) |