TO-51: API supports reviewers in environments#599
Open
almeidaraul wants to merge 18 commits intomainfrom
Open
Conversation
…iewer from the list)
…iling because feature is not implemented yet)
…ironments for an artefact
Base automatically changed from
TO-51/add-reviewer-list-to-environments
to
main
March 13, 2026 15:21
There was a problem hiding this comment.
Pull request overview
Adds API support for environment review “reviewers” by extending the environment-reviews response schema and ensuring the relevant relationships are eagerly loaded so reviewer data is returned consistently.
Changes:
- Extend
ArtefactBuildEnvironmentReviewResponseto include areviewersfield and add a dedicated reviewer response model. - Eager-load
ArtefactBuildEnvironmentReview.reviewersin the GET and single-review PATCH endpoints. - Update/extend controller tests and OpenAPI schema to reflect the new
reviewersfield.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/tests/data_generator.py | Allows generating environment reviews with attached reviewers for tests. |
| backend/tests/controllers/artefacts/test_environment_reviews.py | Updates expected payloads to include reviewers and adds new reviewer-focused tests. |
| backend/test_observer/controllers/artefacts/models.py | Adds reviewer response schema and includes reviewers in environment review response model. |
| backend/test_observer/controllers/artefacts/environment_reviews.py | Ensures reviewers are eagerly loaded for GET and single-review PATCH responses. |
| backend/schemata/openapi.json | Updates OpenAPI components to document the new reviewer schema and field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+387
to
+399
| def test_get_environment_reviews_includes_reviewers(test_client: TestClient, generator: DataGenerator): | ||
| a = generator.gen_artefact(StageName.beta) | ||
| ab = generator.gen_artefact_build(a) | ||
| e = generator.gen_environment("env1") | ||
| user1 = generator.gen_user(name="User One", email="user1@test.com") | ||
| user2 = generator.gen_user(name="User Two", email="user2@test.com") | ||
| review = generator.gen_artefact_build_environment_review(ab, e, reviewers=[user1, user2]) | ||
|
|
||
| response = make_authenticated_request( | ||
| lambda: test_client.get(f"/v1/artefacts/{a.id}/environment-reviews"), | ||
| Permission.view_environment_review, | ||
| ) | ||
|
|
Comment on lines
+181
to
197
| class EnvironmentReviewReviewerResponse(BaseModel): | ||
| model_config = ConfigDict(from_attributes=True) | ||
|
|
||
| id: int | ||
| launchpad_handle: str | None = None | ||
| email: str | ||
| name: str | ||
|
|
||
|
|
||
| class ArtefactBuildEnvironmentReviewResponse(BaseModel): | ||
| id: int | ||
| review_decision: list[ArtefactBuildEnvironmentReviewDecision] | ||
| review_comment: str | ||
| environment: EnvironmentResponse | ||
| artefact_build: ArtefactBuildMinimalResponse | ||
| reviewers: list[EnvironmentReviewReviewerResponse] = [] | ||
|
|
| review_comment: str | ||
| environment: EnvironmentResponse | ||
| artefact_build: ArtefactBuildMinimalResponse | ||
| reviewers: list[EnvironmentReviewReviewerResponse] = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add API support to reviewers in environments i.e. change endpoints to reflect those changes in previous PRs