Skip to content

refactor: rename _clearMutex to _dbMutex in MongoDbResourceBuilderExtensions#267

Merged
mpaulosky merged 1 commit into
devfrom
squad/266-rename-clear-mutex-to-db-mutex
May 8, 2026
Merged

refactor: rename _clearMutex to _dbMutex in MongoDbResourceBuilderExtensions#267
mpaulosky merged 1 commit into
devfrom
squad/266-rename-clear-mutex-to-db-mutex

Conversation

@mpaulosky

Copy link
Copy Markdown
Owner

Summary

Renames the shared semaphore _clearMutex_dbMutex in MongoDbResourceBuilderExtensions.

The semaphore guards all three MongoDB dev commands (Clear, Seed, Stats), not just clear. The old name was misleading.

Changes

  • src/AppHost/MongoDbResourceBuilderExtensions.cs: rename field declaration and all 6 usage sites (3× WaitAsync + 3× Release) plus updated comment

Testing

  • Build: ✅ 0 errors
  • Architecture.Tests: ✅ 15/15
  • Domain.Tests: ✅ 42/42
  • Integration.Tests: ✅ 12/12
  • No behavior change — rename only

Closes #266

Working as Sam (Backend / .NET)

…ensions

The semaphore guards all three MongoDB dev commands (Clear, Seed, Stats),
not just the clear operation. Rename to _dbMutex for clarity.

Closes #266

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 8, 2026 18:10
@github-actions github-actions Bot added the squad Squad triage inbox — Lead will assign to a member label May 8, 2026
@github-actions

github-actions Bot commented May 8, 2026

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.

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

This PR renames the process-wide semaphore in MongoDbResourceBuilderExtensions from _clearMutex to _dbMutex to better reflect that it serializes all MongoDB dev commands (Clear, Seed, Stats) rather than only the clear operation.

Changes:

  • Renamed the shared SemaphoreSlim field _clearMutex_dbMutex.
  • Updated all call sites to use the new field name and adjusted the top-level comment accordingly.

@@ -45,7 +45,7 @@ private static void WithClearDatabaseCommand(
executeCommand: async context =>
{
// AC2: Non-blocking acquire — return immediately if another clear is already in flight.
Comment on lines 50 to 51
context.Logger.LogWarning(
"Clear MyBlog data skipped on {ResourceName} — a clear operation is already in progress.",
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Test Results Summary

331 tests  ±0   330 ✅ ±0   19s ⏱️ ±0s
  6 suites ±0     1 💤 ±0 
  6 files   ±0     0 ❌ ±0 

Results for commit 8108b18. ± Comparison against base commit 002b5bb.

@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.57%. Comparing base (002b5bb) to head (8108b18).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #267   +/-   ##
=======================================
  Coverage   86.57%   86.57%           
=======================================
  Files          44       44           
  Lines        1043     1043           
  Branches      116      116           
=======================================
  Hits          903      903           
  Misses         96       96           
  Partials       44       44           
Files with missing lines Coverage Δ
src/AppHost/MongoDbResourceBuilderExtensions.cs 94.88% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mpaulosky
mpaulosky merged commit d1d7e79 into dev May 8, 2026
23 checks passed
@mpaulosky
mpaulosky deleted the squad/266-rename-clear-mutex-to-db-mutex branch May 8, 2026 18:22
mpaulosky added a commit that referenced this pull request May 8, 2026
## Sprint 18 — AppHost MongoDB Dev Commands Refactor

This release promotes all Sprint 18 work from `dev` to `main`.

### What's included

#### Feature work
- **#262** — `refactor(apphost): extract WithClearDatabaseCommand into
MongoDbResourceBuilderExtensions`
- **#263** — `feat(AppHost): add WithSeedDataCommand for local dev
seeding`
- **#264** — `feat(AppHost): add WithShowStatsCommand for local dev
stats`
- **#267** — `refactor: rename _clearMutex to _dbMutex in
MongoDbResourceBuilderExtensions`

#### CI fixes
- **#270** — `fix(ci): Blog → README Sync — push to dev instead of main`
- **#271** — `fix(ci): add pre-flight token validation and fix
permissions block in squad-mark-released`

### CI status

- ✅ **Squad CI** (`ci.yml`) — green on latest `dev` commit
- ⚠️ **Test Suite** — 1 flaky test failure: `SeedMyBlogData Concurrent
Invocations Allow Only One Run` (timing-sensitive concurrency test; race
condition in test harness, not production code). All other 47 tests
pass. Squad CI gate is the authoritative pass/fail gate.

### Notes

- Last release tag: `v1.5.0`
- `dev` is 55 commits ahead of `main`
- No open Sprint 18 issues, no open PRs
- Merge strategy: squash merge per playbook

---

## Release Checklist

- [ ] Latest `dev` Squad CI is green ✅
- [ ] Release scope reviewed (Sprint 18 milestone closed, all 4 issues
merged)
- [ ] Breaking changes documented (none — additive AppHost extension
methods only)
- [ ] Flaky test acknowledged (`SeedMyBlogData Concurrent` — timing race
in test, not prod)
- [ ] Release notes drafted (see sprint summary above)
- [ ] Aragorn approval received
- [ ] Boromir confirms branch state and workflow health
- [ ] PR CI passes before merge
- [ ] Merge to `main` with squash merge
- [ ] Tag `main` with appropriate `vX.Y.Z` after merge + CI green

Closes the Sprint 18 release gate.
Working as Boromir (DevOps)

---------

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.

refactor: rename _clearMutex to _dbMutex in MongoDbResourceBuilderExtensions

2 participants