Skip to content

fix(quality): rename ct to cancellationToken in all MediatR handlers - #144

Merged
mpaulosky merged 1 commit into
sprint/6-code-qualityfrom
squad/137-rename-ct-to-cancellationtoken
Apr 24, 2026
Merged

fix(quality): rename ct to cancellationToken in all MediatR handlers#144
mpaulosky merged 1 commit into
sprint/6-code-qualityfrom
squad/137-rename-ct-to-cancellationtoken

Conversation

@mpaulosky

Copy link
Copy Markdown
Owner

Closes #137

Working as Sam (Backend Developer)

Renames the ct parameter to cancellationToken in every Handle method signature and all usages inside the method body across all MediatR handlers, plus the private GetManagementClientAsync helper in UserManagementHandler. Addresses CA1725.

…closes #137

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 24, 2026 18:43
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ PR Added to Squad Triage Queue

This PR has been labeled with squad and added to the triage queue.

Next steps:

  • The squad Lead will review and assign to an appropriate team member
  • A squad:member label will be added after triage

If you know which squad member should handle this, you can add the appropriate squad:member label yourself.

@github-actions github-actions Bot added the squad Squad triage inbox — Lead will assign to a member label Apr 24, 2026

Copilot AI 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

Renames MediatR handler Handle method CancellationToken parameters from ct to cancellationToken (and updates all in-method usages) to resolve CA1725 and align with MediatR’s interface parameter naming.

Changes:

  • Updated all affected MediatR Handle method signatures to use cancellationToken.
  • Updated all downstream calls within handlers to pass cancellationToken.
  • Renamed UserManagementHandler’s private GetManagementClientAsync parameter and updated its call sites.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Web/Features/UserManagement/UserManagementHandler.cs Renames ctcancellationToken across all handler methods and the GetManagementClientAsync helper, updating all usages.
src/Web/Features/BlogPosts/List/GetBlogPostsHandler.cs Renames handler token parameter and updates repository/cache calls accordingly.
src/Web/Features/BlogPosts/Edit/EditBlogPostHandler.cs Renames token parameter in both Handle overloads and updates repository/cache calls.
src/Web/Features/BlogPosts/Delete/DeleteBlogPostHandler.cs Renames token parameter and updates repository/cache invalidation calls.
src/Web/Features/BlogPosts/Create/CreateBlogPostHandler.cs Renames token parameter and updates repository/cache invalidation calls.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results Summary

206 tests  ±0   206 ✅ ±0   14s ⏱️ ±0s
  5 suites ±0     0 💤 ±0 
  5 files   ±0     0 ❌ ±0 

Results for commit 7a03948. ± Comparison against base commit 475185e.

@codecov

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.16667% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.93%. Comparing base (475185e) to head (7a03948).
⚠️ Report is 15 commits behind head on sprint/6-code-quality.

Files with missing lines Patch % Lines
...b/Features/UserManagement/UserManagementHandler.cs 0.00% 11 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           sprint/6-code-quality     #144   +/-   ##
======================================================
  Coverage                  76.93%   76.93%           
======================================================
  Files                         43       43           
  Lines                        672      672           
  Branches                     111      111           
======================================================
  Hits                         517      517           
  Misses                       105      105           
  Partials                      50       50           
Files with missing lines Coverage Δ
...Features/BlogPosts/Create/CreateBlogPostHandler.cs 100.00% <100.00%> (ø)
...Features/BlogPosts/Delete/DeleteBlogPostHandler.cs 100.00% <100.00%> (ø)
...Web/Features/BlogPosts/Edit/EditBlogPostHandler.cs 86.20% <100.00%> (ø)
...Web/Features/BlogPosts/List/GetBlogPostsHandler.cs 100.00% <100.00%> (ø)
...b/Features/UserManagement/UserManagementHandler.cs 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mpaulosky
mpaulosky merged commit 2a2c257 into sprint/6-code-quality Apr 24, 2026
20 checks passed
@mpaulosky
mpaulosky deleted the squad/137-rename-ct-to-cancellationtoken branch April 24, 2026 19:31
mpaulosky added a commit that referenced this pull request Apr 25, 2026
## Sprint 6: Code Quality

**Goal:** Eliminate analyzer warnings, enforce internal visibility on
Web feature types, expand test coverage, and migrate Unit.Tests into
Web.Tests.

---

## Merged Feature PRs

- Closes #137 — PR #144 — fix(quality): rename `ct` →
`cancellationToken` in all MediatR handlers
- Closes #138 — PR #145 — test: add unit tests for BlogPost, Result, and
ValidationBehavior (42 tests)
- Closes #139 — PR #146 — test: add unit tests for UserManagementHandler
(16 tests)
- Closes #140 — PR #147 — fix(quality): make Web feature types
`internal` (CA1515, ~28 types)
- Closes #141 — PR #148 — test: add unit tests for BlogPostMappings (22
tests)
- Closes #142 — PR #149 — fix(quality): add ConfigureAwait(false) and
specific exception catches
- Closes #143 — PR #150 — fix(quality): address Domain and
ServiceDefaults analyzer warnings
- Closes #151 — PR #152 — feat(tests): migrate Unit.Tests → Web.Tests
and remove Unit.Tests project

---

## Test Summary

- **80+ new tests** added across all PRs
- **105 Web.Tests passing** (0 failures)
- `DynamicProxyGenAssembly2` added to `InternalsVisibleTo` in Web.csproj
for NSubstitute support

## Notable Changes

- `Unit.Tests` project removed; all tests now live in `Web.Tests`
- ~28 Web feature types changed from `public` to `internal` (CA1515
compliance)
- All MediatR handler parameters renamed from `ct` to
`cancellationToken` for clarity
- `ConfigureAwait(false)` applied to all async calls in service layer
- Domain and ServiceDefaults analyzer warnings resolved

---

## Checklist

- [x] All sprint issues closed (#137#143, #151)
- [x] CI green (0 build errors)
- [x] 105 Web.Tests passing
- [x] Milestone at 100%

---------

Co-authored-by: Boromir <boromir@squad.dev>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squad Squad triage inbox — Lead will assign to a member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants