Skip to content

uplift: add API endpoint to link revisions to assessments (Bug 2029072)#1064

Closed
cgsheeh wants to merge 7 commits intomozilla-conduit:mainfrom
cgsheeh:assessment-id-phab-auth
Closed

uplift: add API endpoint to link revisions to assessments (Bug 2029072)#1064
cgsheeh wants to merge 7 commits intomozilla-conduit:mainfrom
cgsheeh:assessment-id-phab-auth

Conversation

@cgsheeh
Copy link
Copy Markdown
Member

@cgsheeh cgsheeh commented Apr 7, 2026

Introduce a new Ninja API at POST /api/uplift/assessments/link that
allows moz-phab to associate a Phabricator revision with an existing
uplift assessment after a developer submits their revision. The endpoint
creates or updates an UpliftRevision record and triggers a Celery task
to push the uplift request form back to Phabricator.

Authentication uses a new reusable PhabricatorTokenAuth class for
Django Ninja, which delegates to the existing
PhabricatorTokenAuthenticationMiddleware rather than re-implementing
token verification. The X-Phabricator-API-Key header name is extracted
into a shared constant in lando.utils.phabricator and adopted by the
existing phabricator_api_key_required decorator in api/views.py.

Introduce a new Ninja API at POST /api/uplift/assessments/link that
allows moz-phab to associate a Phabricator revision with an existing
uplift assessment after a developer submits their revision. The endpoint
creates or updates an `UpliftRevision` record and triggers a Celery task
to push the uplift request form back to Phabricator.

Authentication uses a new reusable `PhabricatorTokenAuth` class for
Django Ninja, which delegates to the existing
`PhabricatorTokenAuthenticationMiddleware` rather than re-implementing
token verification. The `X-Phabricator-API-Key` header name is extracted
into a shared constant in `lando.utils.phabricator` and adopted by the
existing `phabricator_api_key_required` decorator in `api/views.py`.
@cgsheeh cgsheeh requested a review from a team as a code owner April 7, 2026 19:29
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

View this pull request in Lando to land it once approved.

Copy link
Copy Markdown
Member

@shtrom shtrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+ w/nits

Comment thread src/lando/utils/ninja_auth.py Outdated
Comment thread src/lando/api/uplift_api.py Outdated
Comment thread src/lando/api/tests/test_uplift_api.py Outdated
Comment thread src/lando/utils/phabricator.py
Comment thread src/lando/utils/ninja_auth.py
details: str


class PhabricatorTokenAuth(APIKeyHeader):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug 2021423 may be relevant to this as well, out of scope for this PR though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I pictured when I read "adapters" in that bug. Does this match your expectation as well? :)

@lando-worker
Copy link
Copy Markdown

lando-worker bot commented Apr 8, 2026

Pull request closed by commit a75881f

lando-worker bot pushed a commit that referenced this pull request Apr 8, 2026
…2) r=shtrom,zeid

Introduce a new Ninja API at POST /api/uplift/assessments/link that
allows moz-phab to associate a Phabricator revision with an existing
uplift assessment after a developer submits their revision. The endpoint
creates or updates an `UpliftRevision` record and triggers a Celery task
to push the uplift request form back to Phabricator.

Authentication uses a new reusable `PhabricatorTokenAuth` class for
Django Ninja, which delegates to the existing
`PhabricatorTokenAuthenticationMiddleware` rather than re-implementing
token verification. The `X-Phabricator-API-Key` header name is extracted
into a shared constant in `lando.utils.phabricator` and adopted by the
existing `phabricator_api_key_required` decorator in `api/views.py`.

Pull request: #1064
@lando-worker lando-worker bot closed this Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants