Fix regressions, add future-proofing for URI templates and new APIs.
Review Request #12726 — Created Nov. 16, 2022 and submitted
We recently had some conflicts with the new root resources for reviews
and comments, and added collision detection for URI template
registrations.Since these went in, a couple regressions were discovered:
The root review/comment APIs had registered item APIs, which don't
actually work, due to the lack ofuri_object_key = None
.The root diff comment API had the wrong URL
(/api/review-diff-comment/
instead of/api/diff-comments
/) and
URI template (review_diff_comment
instead ofall_diff_comments
).The review request file attachment comments API mistakenly had a
all_reviews_file_attachment_comments
URI template, which doesn't
represent that resource.Some of the URI templates were pointing to the wrong API resources,
based on a comparison to the Review Board 3 API on RBCommons.Some of these were just wrong resources or attributes being set, which
regressed in 5.0.1. However, most of this is just due to the shaky
foundation that URI templates have historically been on. We didn't have
proper management of any of this, and any kind of testing is brand-new.
So a big part of this change is simply an audit of the URI templates.To address the problems we've hit, we're now deprecating the older
confusing URI templates that triggered collisions before, and are
instead replacing them with namespaced versions. These are all ones that
pertain to diffs, reviews, review replies, and review requests.The complete list of URI templates have been added to the
RootResource
documentation, as have the legacy names. These are versioned (starting
with 4.0) to help users and us.All legacy names are now considered deprecated, but will still point to
the old locations pertaining to the Review Board 3 API.Legacy URI templates are also registered in a way that doesn't create
an entry per API root resource location, which will save memory for
installs using Local Sites.
Unit tests pass.
Diffed the list against the 5.0.1 and 3.0.x releases to verify
that the resulting URI templates seem to be compatible with what we
intended before and what we're wanting to point to now, and that
all legacy URLs correctly match.Built the docs and checked that the resulting Root Resource's docs
on URI templates correctly linked to each target resource page.
Summary | ID |
---|---|
ea89ed33ec37861bfcfd96f92cf7d18053fd0983 |
Description | From | Last Updated |
---|---|---|
I went through the resources that exist in our expected_uri_templates reference and found some that are missing from the RootResource … |
maubin | |
'typing.Dict' imported but unused Column: 1 Error code: F401 |
reviewbot | |
I'm thinking maybe file_diff would be a better name? Since it matches the policy_id here and would follow the URI … |
maubin | |
Should move this one to the deprecated section since you're replacing it with review_request_draft. |
maubin | |
This key should be extensions instead of extension-list. |
maubin | |
These were actually added in 5.0.1. |
maubin | |
I think it could be worthwhile to add comments here to show which URI templates and names are legacy/deprecated. Or … |
maubin | |
review_request_draft will be added in 5.0.2. |
maubin |
- Change Summary:
-
Removed an unused import.
- Description:
-
We recently had some conflicts with the new root resources for reviews
and comments, and added collision detection for URI template registrations. Since these went in, a couple regressions were discovered:
-
The root review/comment APIs had registered item APIs, which don't
actually work, due to the lack ofuri_object_key = None
.
-
The root diff comment API had the wrong URL
(/api/review-diff-comment/
instead of/api/diff-comments
/) and
URI template (review_diff_comment
instead ofall_diff_comments
).
-
The review request file attachment comments API mistakenly had a
all_reviews_file_attachment_comments
URI template, which doesn't
represent that resource.
-
Some of the URI templates were pointing to the wrong API resources,
based on a comparison to the Review Board 3 API on RBCommons.
Some of these were just wrong resources or attributes being set, which
regressed in 5.0.1. However, most of this is just due to the shaky foundation that URI templates have historically been on. We didn't have proper management of any of this, and any kind of testing is brand-new. So a big part of this change is simply an audit of the URI templates. To address the problems we've hit, we're now deprecating the older
confusing URI templates that triggered collisions before, and are instead replacing them with namespaced versions. These are all ones that pertain to diffs, reviews, review replies, and review requests. The complete list of URI templates have been added to the
RootResource
documentation, as have the legacy names. These are versioned (starting with 4.0) to help users and us. All legacy names are now considered deprecated, but will still point to
the old locations pertaining to the Review Board 3 API. + + Legacy URI templates are also registered in a way that doesn't create
+ an entry per API root resource location, which will save memory for + installs using Local Sites. -
- Commits:
-
Summary ID 0bf4bb5938ca8f70412d73bc572b46d53c6d737f 4c75c7854f9569dd7f507adf40bae0e3b1bc3b71 - Diff:
-
Revision 2 (+1558 -120)
Checks run (2 succeeded)
-
Good stuff, thanks for doing this! Really helps to clear things up with the URI templates while keeping legacy behaviour. And good catch for the root reviews/comments fixes.
-
I went through the resources that exist in our
expected_uri_templates
reference and found some that are missing from theRootResource
documentation:
Resource | URI template name
---------|-------------------
File Diff Comment List | file_diff_comments
Diff Context | diff_context
File Attachment | file_attachment
File Attachment List | file_attachments -
I'm thinking maybe
file_diff
would be a better name? Since it matches thepolicy_id
here and would follow the URI naming for theFileDiffCommentResource
(which I set tofile_diff_comment
in 5.0.1). Or you could change theFileDiffCommentResource
URI name todiff_file_comment
. -
-
-
I think it could be worthwhile to add comments here to show which URI templates and names are legacy/deprecated. Or move them so that they have their own section in the dict, like how you did it in the
RootResource
documentation. But then again we could always just refer to the documentation for this info.
- Change Summary:
-
- Standardized naming for filediff templates.
- Added some missing URI templates and fixed up versioning for others.
- Fixed some ReST syntax errors.
- Added comments in the unit tests to help see which URI templates are deprecated and as of when.
- Commits:
-
Summary ID 4c75c7854f9569dd7f507adf40bae0e3b1bc3b71 5a2c4809842f4e959161020f462125784deb0bc0 - Diff:
-
Revision 3 (+1874 -352)
Checks run (2 succeeded)
- Change Summary:
-
Updated deprecation info for
draft
vs.review_request_draft
. - Commits:
-
Summary ID 5a2c4809842f4e959161020f462125784deb0bc0 ea89ed33ec37861bfcfd96f92cf7d18053fd0983 - Diff:
-
Revision 4 (+1876 -352)