feat(reporting-api): add PUT review endpoint and wire ReportStatus.Reviewed#303
Merged
willvelida merged 3 commits intomainfrom Apr 20, 2026
Merged
Conversation
…viewed
- add 4 nullable review fields to ReportMetadata model
- add UpdateReviewResultAsync to IBlobStorageService and BlobStorageService
- create PUT /api/reports/{jobId}/review endpoint (204 No Content)
- add ReportsReviewed OTel counter to ReportingTelemetry
- add unit tests and contract tests for review endpoint
Signed-off-by: Will Velida <willvelida@hotmail.co.uk>
agent: github-copilot
model: Claude Opus 4.6
contribution: code-generation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds durable persistence of report review results to Biotrackr.Reporting.Api by introducing a new PUT /api/reports/{jobId}/review endpoint that transitions reports from generated → reviewed and writes review metadata to blob storage, plus telemetry and tests to support the new flow.
Changes:
- Extended
ReportMetadatawith nullable review fields and wiredReportStatus.Reviewed. - Added
IBlobStorageService.UpdateReviewResultAsync+BlobStorageServiceimplementation to persist review results. - Introduced
ReviewEndpointsPUT handler, aReportsReviewedmetric, and unit/contract/auth tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api/Telemetry/ReportingTelemetry.cs | Adds ReportsReviewed counter for review submissions. |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api/Services/IBlobStorageService.cs | Extends blob service contract with UpdateReviewResultAsync. |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api/Services/BlobStorageService.cs | Implements review persistence + status transition to Reviewed. |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api/Program.cs | Wires MapReviewEndpoints() into the app pipeline. |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api/Models/ReportMetadata.cs | Adds persisted review fields (ReviewedAt, approval, concerns, validated summary). |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api/Endpoints/ReviewEndpoints.cs | New PUT endpoint handler for submitting review results. |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api.UnitTests/Models/ReportMetadataShould.cs | Adds default/null tests for new metadata fields. |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api.UnitTests/Endpoints/ReviewEndpointsShould.cs | Unit-tests handler responses for success/not found/conflict/bad request. |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api.IntegrationTests/Contract/SubmitReviewTests.cs | Contract tests validating routing and status-code mapping for the new endpoint. |
| src/Biotrackr.Reporting.Api/Biotrackr.Reporting.Api.IntegrationTests/Contract/AuthorizationPolicyShould.cs | Verifies the new endpoint is protected by the expected authorization policy. |
- add null-coalesce for Concerns and ValidatedSummary in endpoint handler - use KeyNotFoundException for job-not-found instead of message matching - add ArgumentNullException.ThrowIfNull guards in BlobStorageService Signed-off-by: Will Velida <willvelida@hotmail.co.uk> agent: github-copilot model: Claude Opus 4.6 contribution: code-generation
- block background Task.Run via UpdateJobStatusAsync mock to ensure semaphore is held when second call executes Signed-off-by: Will Velida <willvelida@hotmail.co.uk> agent: github-copilot model: Claude Opus 4.6 contribution: code-generation
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.
Summary
Adds durable persistence for report review results in Reporting.Api (Phase 2 of the ReportReviewerService fail-closed fix, Issue #269). After this change, the
PUT /api/reports/{jobId}/reviewendpoint transitions reports fromGenerated→Reviewedstatus with review metadata persisted to blob storage.Changes
Model
ReportMetadata:ReviewedAt,ReviewApproved,ReviewConcerns,ReviewValidatedSummary[JsonPropertyName]with camelCase convention, nullable for backward compatibilityService Layer
UpdateReviewResultAsynctoIBlobStorageServiceinterfaceBlobStorageServicefollowing the existingUpdateJobStatusAsyncpattern (get → guard status → mutate → dual-write)"generated"reports withInvalidOperationExceptionEndpoint
PUT /api/reports/{jobId}/reviewinReviewEndpoints.csChatApiAgentauthorization policy (same as all other endpoints)SubmitReviewRequestPOCO defined in same file (matchesGenerateReportRequestpattern)Telemetry
ReportsReviewedcounter toReportingTelemetry(auto-exported to Application Insights via existing OpenTelemetry pipeline)Tests
ReviewEndpointsShould.cs(handler logic in isolation)ReportMetadataShould.csfor new fieldsSubmitReviewTests.cs(HTTP pipeline via WebApplicationFactory)AuthorizationPolicyShould.csValidation
SubmitReviewRequest100%,ReportMetadata100%,ReportingTelemetry100%Context