Fix regressions, add future-proofing for URI templates and new APIs.

Review Request #12726 — Created Nov. 16, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

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:

  1. The root review/comment APIs had registered item APIs, which don't
    actually work, due to the lack of uri_object_key = None.

  2. 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 of all_diff_comments).

  3. The review request file attachment comments API mistakenly had a
    all_reviews_file_attachment_comments URI template, which doesn't
    represent that resource.

  4. 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.

Commits

Files