Require validation for DiffCommits when posting
Review Request #9920 — Created May 9, 2018 and submitted
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"? |
chipx86 | |
F401 'djblets.webapi.errors.INVALID_FORM_DATA' imported but unused |
reviewbot | |
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 … |
chipx86 | |
This can wrap. |
david | |
You can now split this across lines at a . |
chipx86 | |
bool |
chipx86 | |
Did you mean to unindent the line? Doesn't seem like it would particularly matter in this change. |
chipx86 | |
Can you import specifically waht you need from the module, instead of the module itself? |
chipx86 | |
I imagine this should be a HiddenInput? We don't want users mucking about in it if we display this anywhere. |
chipx86 | |
"Validation metadata" |
chipx86 | |
The text should specifically be self.fields['validation_info'].error_messages['required']. No need for ugettext. |
chipx86 | |
Shouldn't include literals in summaries. |
chipx86 | |
Extra period on this line. |
david | |
Too many periods. |
chipx86 | |
"exceptions" |
chipx86 | |
Maybe better as: if not validation_info: return {} # .. rest of the method |
chipx86 | |
b64decode can also raise TypeError. |
chipx86 | |
The return can be inline. |
chipx86 | |
Maybe "A form for validating DiffCommits." |
chipx86 | |
"Parent diff" |
chipx86 | |
"Validation metadata" |
chipx86 | |
"Base commit ID" |
chipx86 | |
No literals in summaries. |
chipx86 | |
Too many periods. |
chipx86 | |
Same comments as above. Seems we have some stuff we could easily pull out into a base class? |
chipx86 | |
This seems like code we have elsewhere. I'd like to deduplicate this if possible. |
chipx86 | |
We should pull out the specific functions we need. |
chipx86 | |
This can be wrapped. |
david | |
This can be broken into multiple lines now at any . |
chipx86 | |
No literals in summaries. |
chipx86 | |
Mixing import groups here. |
chipx86 | |
Shouldn't DiffCommit be handling this? |
chipx86 | |
Ordering issues. |
chipx86 | |
The DIFF_* should be in alphabetical order. |
chipx86 | |
E501 line too long (90 > 79 characters) |
reviewbot | |
E501 line too long (84 > 79 characters) |
reviewbot | |
E126 continuation line over-indented for hanging indent |
reviewbot | |
Can we include the error details in this? That'd help with debugging. |
chipx86 | |
Trailing comma. |
chipx86 | |
Can we use keyword arguments for all calls to this, here and everywhere else in the change? It's a complex … |
chipx86 | |
This will create a tuple of strings. |
chipx86 | |
This creates a tuple. |
chipx86 | |
This too. |
chipx86 | |
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. |
chipx86 | |
It doesn't really return "OK." I feel that can be misleading. We probably can remove the whole "either OK or … |
chipx86 | |
Double backticks for validation_info. Also, "field" and not "parameter." |
chipx86 | |
Can you switch to a named logger for the module? |
chipx86 | |
Missing trailing comma. |
chipx86 | |
F841 local variable 'validation_info' is assigned to but never used |
reviewbot | |
F821 undefined name 'on_info' |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
F841 local variable 'validation_info' is assigned to but never used |
reviewbot | |
F821 undefined name 'on_info' |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E501 line too long (91 > 79 characters) |
reviewbot | |
W391 blank line at end of file |
reviewbot | |
F841 local variable 'parent_diff' is assigned to but never used |
reviewbot | |
Newlines in exceptions are generally not going to be handled well, either in HTML or in logs. Maybe: Could not … |
chipx86 | |
Missing trailing comma. |
chipx86 | |
You can consolidate these. |
chipx86 | |
Missing a trailing period. |
chipx86 | |
Name should be GetFileExistsInHistoryTests. |
chipx86 | |
For here and any others, can we use called_with() and check the arguments? |
chipx86 | |
Extra blank line here. |
chipx86 | |
Missing a period. |
chipx86 | |
Extra blank line. |
chipx86 | |
You can align these starting on the initial call. There should be plenty of room. |
chipx86 | |
Can you include the repository ID? That'll help with RBCommons. |
chipx86 | |
This line's too long. You can break at a . |
chipx86 | |
Can you explain why here? |
chipx86 | |
E501 line too long (82 > 79 characters) |
reviewbot | |
F821 undefined name 'revision' |
reviewbot | |
E501 line too long (80 > 79 characters) |
reviewbot | |
This sounds confusing. Can you say: The "%s" repository does not support review requests with commit history. |
chipx86 | |
Blank line between these. |
chipx86 |
- Change Summary:
-
Fix unit test failures.
- Depends On:
-
- Commit:
c73a8395ee5a8c463733f9933cd1693ef85a84a226ef4844d2fe1de202a5e98cb3e484ea1f1e2bd2- Diff:
Revision 2 (+1703 -9)
Checks run (1 failed, 1 succeeded)
flake8 failed.JSHint passed.flake8
- Commit:
-
26ef4844d2fe1de202a5e98cb3e484ea1f1e2bd290b94c870b0149f30290da2bd19efffcf43bead4
- Diff:
-
Revision 3 (+1714 -9)
Checks run (2 succeeded)
- Change Summary:
-
diff_commit_count -> diffcommit_count
- Commit:
-
90b94c870b0149f30290da2bd19efffcf43bead4ab0115dee1837598f148d9a5cb3ebc3e39611400
- Diff:
-
Revision 4 (+1714 -9)
Checks run (2 succeeded)
- Commit:
-
ab0115dee1837598f148d9a5cb3ebc3e39611400217c9d617955dd76067c65ba86faf201bc86c73f
- 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.
-
-
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.
-
-
-
-
-
I imagine this should be a
HiddenInput
? We don't want users mucking about in it if we display this anywhere. -
-
The text should specifically be
self.fields['validation_info'].error_messages['required']
. No need forugettext
. -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Change Summary:
-
Addressed the majority of open issues.
- Commit:
-
217c9d617955dd76067c65ba86faf201bc86c73fefd916a5a0e84bc2a7904c7970ecbf576d1933e0
- Diff:
-
Revision 6 (+1711 -29)
Checks run (2 succeeded)
- Change Summary:
-
Addressed remaining feedback
- Commit:
-
efd916a5a0e84bc2a7904c7970ecbf576d1933e01ac95ff3d8d386703ac12ca8aaadc9fce9e515b3
- Diff:
-
Revision 7 (+1711 -29)
- Change Summary:
-
Fixup Flake8 issues
- Commit:
-
1ac95ff3d8d386703ac12ca8aaadc9fce9e515b3b91eaa8d612bfcedd7a453a5e531e36964349ce0
- Diff:
-
Revision 8 (+1713 -29)
Checks run (2 succeeded)
- Change Summary:
-
Keep track of add/modify/remove in parent diff
- Commit:
-
b91eaa8d612bfcedd7a453a5e531e36964349ce08f0ea175b4fa6f17d0516a4bb5d62ef7a5ef968a
- Diff:
-
Revision 9 (+1923 -29)
- Change Summary:
-
flake8
- Commit:
-
8f0ea175b4fa6f17d0516a4bb5d62ef7a5ef968a255222c19ecfa14618aba5461f65a599aacac551
- Diff:
-
Revision 10 (+1923 -29)
Checks run (2 succeeded)
-
-
-
-
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.
-
-
-
-
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
. -
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 ..."
-
-
-
- Change Summary:
-
Addressed issues, added docs.
- Commit:
-
255222c19ecfa14618aba5461f65a599aacac55174eab7d1571527aba49415f4f887f065dd0900a8
- Diff:
-
Revision 11 (+1924 -29)
- Change Summary:
-
actually commit changes >.>
- Commit:
-
74eab7d1571527aba49415f4f887f065dd0900a855fd26fa7172fbfc4137b0c2dc9190add0a6831a
- Diff:
-
Revision 12 (+1934 -29)
- Change Summary:
-
fixups
- Commit:
-
55fd26fa7172fbfc4137b0c2dc9190add0a6831a564905b15f0b53120c34a7f55874c6da7de28496
- Diff:
-
Revision 13 (+1934 -29)
Checks run (2 succeeded)
- Change Summary:
-
fix unit tests
- Commit:
-
564905b15f0b53120c34a7f55874c6da7de2849646b58240dddcd476a501b02e14637bfcf0ef8625
- 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:
-
46b58240dddcd476a501b02e14637bfcf0ef862525c580136748405934fa83a92cd8a2ad5763f26b
- Diff:
-
Revision 15 (+1905 -29)
- Commit:
-
25c580136748405934fa83a92cd8a2ad5763f26b2c175870b6f9daf20059e7c2ce98d2e601ac6b78
- 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:
-
2c175870b6f9daf20059e7c2ce98d2e601ac6b784ca0eb376ddd68f25e24767e89afa03a40dfd336
- Diff:
-
Revision 17 (+1895 -29)
- Commit:
-
4ca0eb376ddd68f25e24767e89afa03a40dfd336858f8d77098b2ad76f1e06d3d518111923b05905
- Diff:
-
Revision 18 (+1899 -29)
Checks run (2 succeeded)
- Commit:
-
858f8d77098b2ad76f1e06d3d518111923b059055973997c843000d9dd417f41feb5e88f12bae3eb
- Diff:
-
Revision 19 (+1898 -29)
- Change Summary:
-
Fix issues introduced with git rerere
- Commit:
-
5973997c843000d9dd417f41feb5e88f12bae3ebc23ee9cf286fbca7de21d4b0a45fa3d68ecb0a0c
- Diff:
-
Revision 20 (+1886 -33)
- Commit:
-
c23ee9cf286fbca7de21d4b0a45fa3d68ecb0a0c6e738dc6bdd3c1b89c5fb09f1ccae8112908fbc2
- Diff:
-
Revision 21 (+1886 -33)
Checks run (2 succeeded)
- Change Summary:
-
Addressed Christian's feedback.
- Commit:
-
6e738dc6bdd3c1b89c5fb09f1ccae8112908fbc24dd62e1f5b24d4afae452697b6192c443f62ad02
- Diff:
-
Revision 22 (+1882 -29)
Checks run (2 succeeded)
- Change Summary:
-
Addressed Christian's feedback.
- Commit:
-
4dd62e1f5b24d4afae452697b6192c443f62ad025646814021cf8c50db323eb606610908cdc34d04
- Diff:
-
Revision 23 (+1886 -29)
Checks run (2 succeeded)
- Change Summary:
-
Unit test fixes
- Commit:
-
5646814021cf8c50db323eb606610908cdc34d041e5bd7dd0edc08635c571706bf50defad3b54fae
- Diff:
-
Revision 24 (+1888 -29)