Skip to content

feat: add IWorkPackages.UpdateAsync; tidy the handler and read-only tests - #58

Merged
davidnmbond merged 1 commit into
mainfrom
fix/codacy-and-coverage
Nov 9, 2026
Merged

davidnmbond merged 1 commit into
mainfrom
fix/codacy-and-coverage

Conversation

@davidnmbond

Copy link
Copy Markdown
Contributor
  • Adds IWorkPackages.UpdateAsync (PATCH /work_packages/{id}) using the existing, previously unused WorkPackageUpdate model. Relates to Missing methods #1.
  • AuthenticatedHttpClientHandler.SendAsync (Lizard complexity 17, CQ-05/CQ-06): the read-method check and the request/response debug logging move into IsRead, LogRequestAsync and LogResponseAsync; behaviour unchanged.
  • ReadOnlyOptionTests (12% duplication): cases share WasRefusedAsync, and a case covers UpdateAsync being refused while read-only.
  • SortByTests: renders field/direction pairs and an empty sort.

Local run with CI's filter (Category!=Integration): 8 passed; line coverage 58.2% to 68.7% (TST-10 needs 60%).

Not changed, noted for review: FilterOperatorExtensions maps FilterOperator.NotEqualsOneOf to gt; OpenProject's not-equal operator is !.

…ests

UpdateAsync PATCHes /work_packages/{id} with the existing WorkPackageUpdate model. The handler's read check and debug logging move into small helpers, the read-only tests share one helper, and SortBy gains tests.
@codacy-production

codacy-production Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity · -2 duplication

Metric Results
Complexity 5
Duplication -2

View in Codacy

🟢 Coverage 100.00% diff coverage · +10.49% coverage variation

Metric Results
Coverage variation ✅ +10.49% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d206234) 165 96 58.18%
Head commit (ada3c93) 166 (+1) 114 (+18) 68.67% (+10.49%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#58) 1 1 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

⚠️ Resolve issues before merging

The response logging condition in AuthenticatedHttpClientHandler can prevent response bodies from being logged for ordinary requests. This should be corrected before merging.

Additional tests are missing for successful updates, HEAD/OPTIONS handling, and extracted logging behavior.

Test suggestions

  • Read-only UpdateAsync is rejected before an HTTP request is sent
  • UpdateAsync successfully issues a PATCH request with the expected path and body
  • Read-only GET requests remain allowed and non-read-only write requests are attempted
  • Read-only HEAD and OPTIONS requests remain allowed
  • Request and response debug logging continues to work after extraction
  • SortBy renders populated and empty values
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. UpdateAsync successfully issues a PATCH request with the expected path and body
2. Read-only HEAD and OPTIONS requests remain allowed
3. Request and response debug logging continues to work after extraction

TIP How was this review? Give us feedback

_logger.LogDebug("{Guid}:{ResponseStatusCode}:{Body}",
guid.ToString(),
response.StatusCode,
request.Content is null ? null : await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Check response.Content before reading and logging the response body. Using request.Content here prevents response bodies from being logged for typical GET requests.

TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.

@davidnmbond
davidnmbond merged commit 8ac75f1 into main Nov 9, 2026
8 checks passed
@davidnmbond
davidnmbond deleted the fix/codacy-and-coverage branch November 9, 2026 01:21
@davidnmbond davidnmbond mentioned this pull request Nov 9, 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.

1 participant