Refactor: DTOs to records and finalize soft-delete audit trail#23
Conversation
- Propose full CRUD endpoints for Issue, Comment, User, Category, Status - Define soft-delete pattern for audit-tracked models (IsArchived flag) - Colocate commands/queries in src/Shared/Validators/ following existing pattern - Require pagination from day one (page, pageSize, totalPages) - Three-sprint decomposition: Issue → Comment → Reference Data - Risk assessment: cascade delete, concurrent updates, breaking changes - Authorization: user context from JWT, owner/admin checks in handlers Decision prepared for team consensus review. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Converted all DTOs in src/Shared/DTOs/ from classes to records (UserDto, StatusDto, CategoryDto, CommentDto, IssueDto) - Restored MongoDB.Bson attributes and proper type mapping in domain models - Implemented audit trail with ArchivedBy and ArchivedAt for soft-delete pattern - Updated handlers and repository for soft-delete support - Added exception types (NotFoundException, ConflictException) - Reorganized domain model structure Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Updated ListIssuesHandler to use IssueDto instead of removed IssueResponseDto - Fixed Program.cs to import Shared.DTOs and update Produces attribute - Updated IssueDto constructor to accept Domain.Issue model Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the Shared layer namespaces/types (DTOs → records, new MongoDB/BSON mapping, soft-delete audit fields) and updates API/test wiring to match, while also introducing extensive Squad metadata and workflow/template updates.
Changes:
- Renames
IssueManager.Shared.*→Shared.*, adds new commands/queries/validators, and extends Issue soft-delete/audit fields. - Updates API repository/handlers/endpoints for paging + archiving and adjusts tests accordingly.
- Adds Squad team state/docs/templates and modifies multiple GitHub workflows.
Reviewed changes
Copilot reviewed 118 out of 174 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/Validators/UpdateIssueStatusValidatorTests.cs | Updates usings to new Shared.* namespaces. |
| tests/Unit/Validators/ListIssuesQueryValidatorTests.cs | Adds unit tests for pagination query validator. |
| tests/Unit/Validators/DeleteIssueValidatorTests.cs | Adds unit tests for soft-delete command validator. |
| tests/Unit/Validators/CreateIssueValidatorTests.cs | Updates usings to new validator namespace. |
| tests/Unit/Unit.csproj | Adds project references for unit test compilation. |
| tests/Unit/Domain/LabelTests.cs | Updates domain namespace import. |
| tests/Unit/Domain/IssueTests.cs | Updates domain namespace import. |
| tests/Unit/Builders/IssueBuilder.cs | Adds fluent builder for Shared.Domain.Issue test data. |
| tests/Integration/Handlers/UpdateIssueStatusHandlerTests.cs | Updates usings for new namespaces. |
| tests/Integration/Handlers/GetIssueHandlerTests.cs | Updates usings for new namespaces. |
| tests/Integration/Handlers/CreateIssueHandlerTests.cs | Updates usings for new namespaces. |
| tests/Integration/GlobalUsings.cs | Removes old Shared global usings. |
| tests/BlazorTests/GlobalUsings.cs | Removes old Shared global using. |
| tests/BlazorTests/Components/IssueFormTests.cs | Updates domain using for component tests. |
| tests/Architecture/ArchitectureTests.cs | Updates assembly type anchors to new namespaces. |
| src/Web/Components/IssueForm.razor | Updates @using to Shared.Domain. |
| src/Web/Components/CreateIssueRequest.cs | Updates domain using to new namespace. |
| src/Shared/Validators/UpdateIssueValidator.cs | Adds validator for UpdateIssueCommand. |
| src/Shared/Validators/UpdateIssueStatusValidator.cs | Moves validator namespace/imports to Shared.*. |
| src/Shared/Validators/UpdateIssueCommand.cs | Adds update command contract. |
| src/Shared/Validators/ListIssuesQueryValidator.cs | Adds validator for paging query. |
| src/Shared/Validators/ListIssuesQuery.cs | Adds paging query contract. |
| src/Shared/Validators/DeleteIssueValidator.cs | Adds validator for archive command. |
| src/Shared/Validators/DeleteIssueCommand.cs | Adds archive (soft-delete) command contract. |
| src/Shared/Validators/CreateIssueValidator.cs | Moves validator namespace to Shared.Validators. |
| src/Shared/Utilities.cs | Renames root namespace to Shared. |
| src/Shared/Shared.csproj | Changes RootNamespace to Shared and adds MongoDB.Bson dependency. |
| src/Shared/Models/User.cs | Introduces BSON-ready model class. |
| src/Shared/Models/Status.cs | Introduces BSON-ready model class with archive fields. |
| src/Shared/Models/Issue.cs | Introduces BSON-ready issue model class. |
| src/Shared/Models/Comment.cs | Introduces BSON-ready comment model class. |
| src/Shared/Models/Category.cs | Introduces BSON-ready category model class. |
| src/Shared/GlobalUsings.cs | Adds MongoDB + DTO/model global usings. |
| src/Shared/Exceptions/NotFoundException.cs | Adds shared not-found exception type. |
| src/Shared/Exceptions/ConflictException.cs | Adds shared conflict exception type. |
| src/Shared/Domain/Models/User.cs | Removes old domain model record. |
| src/Shared/Domain/Models/Status.cs | Removes old domain model record. |
| src/Shared/Domain/Models/Issue.cs | Removes old domain model record. |
| src/Shared/Domain/Models/Comment.cs | Removes old domain model record. |
| src/Shared/Domain/Models/Category.cs | Removes old domain model record. |
| src/Shared/Domain/Label.cs | Renames namespace to Shared.Domain. |
| src/Shared/Domain/IssueStatus.cs | Renames namespace to Shared.Domain. |
| src/Shared/Domain/Issue.cs | Adds soft-delete/audit fields and updates namespace. |
| src/Shared/Domain/Enums/IssueStatus.cs | Renames enum namespace to Shared.Domain.Enums. |
| src/Shared/Domain/DTOs/UserDto.cs | Removes old DTO location. |
| src/Shared/Domain/DTOs/StatusDto.cs | Removes old DTO location. |
| src/Shared/Domain/DTOs/IssueDto.cs | Removes old DTO location. |
| src/Shared/Domain/DTOs/CommentDto.cs | Removes old DTO location. |
| src/Shared/Domain/DTOs/CategoryDto.cs | Removes old DTO location. |
| src/Shared/DTOs/UserDto.cs | Adds new record-based DTO in Shared.DTOs. |
| src/Shared/DTOs/StatusDto.cs | Adds new record-based DTO in Shared.DTOs. |
| src/Shared/DTOs/IssueDto.cs | Adds new record-based DTO in Shared.DTOs. |
| src/Shared/DTOs/CommentDto.cs | Adds new record-based DTO in Shared.DTOs. |
| src/Shared/DTOs/CategoryDto.cs | Adds new record-based DTO in Shared.DTOs. |
| src/Api/Program.cs | Wires repository, validators, handlers, and new Issue CRUD endpoints. |
| src/Api/Handlers/UpdateIssueStatusHandler.cs | Updates usings to new namespaces. |
| src/Api/Handlers/UpdateIssueHandler.cs | Adds handler for updating title/description. |
| src/Api/Handlers/ListIssuesHandler.cs | Adds handler for paginated list response. |
| src/Api/Handlers/GetIssueHandler.cs | Updates usings to new namespaces. |
| src/Api/Handlers/DeleteIssueHandler.cs | Adds handler for soft-delete (archive) using HttpContext user. |
| src/Api/Handlers/CreateIssueHandler.cs | Updates usings to new namespaces. |
| src/Api/Data/IssueRepository.cs | Adds paging + archive update, updates entity BSON mapping. |
| src/Api/Data/IIssueRepository.cs | Extends repository contract for paging + archiving. |
| README.md | Minor formatting tweak. |
| .squad/team.md | Adds Squad roster/team metadata. |
| .squad/skills/xunit-test-builders/SKILL.md | Adds testing skill doc for builder pattern. |
| .squad/skills/squad-conventions/SKILL.md | Adds Squad conventions doc. |
| .squad/routing.md | Adds routing rules doc. |
| .squad/identity/wisdom.md | Adds team wisdom scaffold. |
| .squad/identity/now.md | Adds “current focus” scaffold. |
| .squad/decisions/inbox/legolas-gitignore.md | Adds decision record. |
| .squad/decisions/inbox/legolas-e2e-workflow-removal.md | Adds decision record. |
| .squad/decisions/inbox/legolas-ci-compatibility.md | Adds decision record. |
| .squad/decisions/inbox/gimli-testing-docs.md | Adds decision record. |
| .squad/decisions/inbox/gandalf-pr14-workflow-review.md | Adds decision record. |
| .squad/decisions/inbox/gandalf-e2e-removal.md | Adds decision record. |
| .squad/decisions/inbox/gandalf-base-model-abstraction.md | Adds decision record. |
| .squad/decisions/inbox/elrond-gitversion-release.md | Adds decision record. |
| .squad/decisions/inbox/elrond-github-config-fix.md | Adds decision record. |
| .squad/decisions/inbox/copilot-directive-slnx-only.md | Adds directive record. |
| .squad/decisions/inbox/copilot-directive-sln-revert.md | Adds directive record. |
| .squad/decisions/inbox/copilot-directive-branch-sync.md | Adds directive record. |
| .squad/decisions/inbox/copilot-directive-20260219.md | Adds directive record. |
| .squad/decisions/inbox/aragorn-shared-library-design.md | Adds decision record. |
| .squad/decisions/inbox/aragorn-fix-test-projects.md | Adds decision record. |
| .squad/decisions/gandalf-docs-critical-fix.md | Adds decision record. |
| .squad/decisions.md | Adds decisions ledger. |
| .squad/ceremonies.md | Adds ceremonies configuration. |
| .squad/casting/registry.json | Adds casting registry. |
| .squad/casting/history.json | Adds casting history. |
| .squad/agents/scribe/history.md | Adds agent history. |
| .squad/agents/legolas/charter.md | Adds agent charter. |
| .squad/agents/gimli/charter.md | Adds agent charter. |
| .squad/agents/gandalf/history.md | Updates agent history. |
| .squad/agents/gandalf/charter.md | Adds agent charter. |
| .squad/agents/galadriel/history.md | Adds agent history. |
| .squad/agents/galadriel/charter.md | Adds agent charter. |
| .squad/agents/elrond/charter.md | Adds agent charter. |
| .squad/agents/arwen/history.md | Adds agent history. |
| .squad/agents/arwen/charter.md | Adds agent charter. |
| .squad/agents/aragorn/history.md | Updates agent history. |
| .squad/agents/aragorn/charter.md | Adds agent charter. |
| .squad-templates/workflows/sync-squad-labels.yml | Updates template to read .squad/ first. |
| .squad-templates/workflows/squad-triage.yml | Updates template to read .squad/ first. |
| .squad-templates/workflows/squad-release.yml | Adds CHANGELOG validation in template. |
| .squad-templates/workflows/squad-promote.yml | Adds promote workflow template. |
| .squad-templates/workflows/squad-preview.yml | Adds preview validation workflow template. |
| .squad-templates/workflows/squad-main-guard.yml | Adds main guard workflow template. |
| .squad-templates/workflows/squad-issue-assign.yml | Updates template to read .squad/ first. |
| .squad-templates/workflows/squad-insider-release.yml | Adds insider release workflow template. |
| .squad-templates/workflows/squad-heartbeat.yml | Updates heartbeat template to read .squad/ first. |
| .squad-templates/workflows/squad-docs.yml | Adds docs workflow template. |
| .squad-templates/workflows/squad-ci.yml | Updates CI template branch triggers. |
| .squad-templates/skills/squad-conventions/SKILL.md | Updates template conventions references to .squad/. |
| .squad-templates/skill.md | Adds skill template. |
| .squad-templates/scribe-charter.md | Updates scribe template paths to .squad/. |
| .squad-templates/run-output.md | Adds run output template. |
| .squad-templates/routing.md | Adds routing template. |
| .squad-templates/roster.md | Updates roster template paths. |
| .squad-templates/raw-agent-output.md | Adds raw output template. |
| .squad-templates/plugin-marketplace.md | Adds plugin marketplace doc. |
| .squad-templates/orchestration-log.md | Updates orchestration log template path. |
| .squad-templates/multi-agent-format.md | Adds multi-agent output format doc. |
| .squad-templates/mcp-config.md | Adds MCP config doc. |
| .squad-templates/identity/wisdom.md | Adds identity template. |
| .squad-templates/identity/now.md | Adds identity template. |
| .squad-templates/history.md | Updates history template fields. |
| .squad-templates/copilot-instructions.md | Updates Copilot instructions to .squad/. |
| .squad-templates/constraint-tracking.md | Adds constraint tracking doc. |
| .squad-templates/charter.md | Updates charter template paths. |
| .squad-templates/ceremonies.md | Adds ceremonies template. |
| .squad-templates/casting-registry.json | Adds casting registry template. |
| .squad-templates/casting-policy.json | Extends casting policy template. |
| .squad-templates/casting-history.json | Adds casting history template. |
| .github/workflows/sync-squad-labels.yml | Updates workflow to read .squad/ first and modernizes actions versions. |
| .github/workflows/squad-triage.yml | Updates workflow to read .squad/ first and modernizes actions versions. |
| .github/workflows/squad-release.yml | Replaces release pipeline with placeholder steps. |
| .github/workflows/squad-promote.yml | Adds promote workflow. |
| .github/workflows/squad-preview.yml | Replaces preview validation with placeholder steps. |
| .github/workflows/squad-main-guard.yml | Extends guard to pushes/insider and .squad/ paths. |
| .github/workflows/squad-label-enforce.yml | Modernizes actions versions. |
| .github/workflows/squad-issue-assign.yml | Updates workflow to read .squad/ first and modernizes actions versions. |
| .github/workflows/squad-insider-release.yml | Adds insider release workflow (placeholder). |
| .github/workflows/squad-heartbeat.yml | Updates workflow to read .squad/ first and modernizes actions versions. |
| .github/workflows/squad-docs.yml | Replaces docs deploy with placeholder steps. |
| .github/workflows/squad-ci.yml | Replaces CI pipeline with placeholder steps. |
| .gitattributes | Switches union-merge paths from .ai-team/ to .squad/. |
| .ai-team/agents/gimli/history.md | Removes old team history file. |
| .ai-team-templates/workflows/squad-preview.yml | Removes old template file. |
| .ai-team-templates/workflows/squad-main-guard.yml | Removes old template file. |
Comments suppressed due to low confidence (1)
.github/workflows/squad-release.yml:35
- This workflow currently only echoes "No build commands configured" / "No release commands configured" and will still succeed, effectively disabling releases on main. Either restore the actual .NET build/test + GitVersion/tag/release steps, or fail the workflow (exit 1) until it’s properly configured to avoid false-green releases.
- name: Build and test
run: |
# TODO: Add your dotnet build/test commands here
# Go: go test ./...
# Python: pip install -r requirements.txt && pytest
# .NET: dotnet test
# Java (Maven): mvn test
# Java (Gradle): ./gradlew test
echo "No build commands configured — update squad-release.yml"
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# TODO: Add your release commands here (e.g., git tag, gh release create)
echo "No release commands configured — update squad-release.yml"
|
@mpaulosky I've opened a new pull request, #24, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@mpaulosky I've opened a new pull request, #25, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@mpaulosky I've opened a new pull request, #26, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@mpaulosky I've opened a new pull request, #27, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@mpaulosky I've opened a new pull request, #28, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
* Initial plan * fix: add AsClosed() builder method and align SKILL.md examples with actual IssueBuilder API Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com>
…unt vs ModifiedCount) (#27) * Initial plan * fix: use MatchedCount instead of ModifiedCount in ArchiveAsync to distinguish not-found from no-op Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com>
* Initial plan * fix: replace mojibake characters with plain ASCII in squad-main-guard.yml Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com>
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@mpaulosky I've opened a new pull request, #29, to work on those changes. Once the pull request is ready, I'll request review from you. |
* Initial plan * Fix Enum.Parse to Enum.TryParse with ignoreCase and safe fallback in IssueEntity.ToDomain Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> * Update src/Api/Data/IssueRepository.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…sing props, exception middleware, squad-ci wiring (#29) * Initial plan * fix: address PR review feedback - validator tests, Issue init-only, IssueRepository, exception middleware, squad-ci Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com>
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@mpaulosky I've opened a new pull request, #30, to work on those changes. Once the pull request is ready, I'll request review from you. |
… property init, unit test alignment (#30) * Initial plan * fix: resolve namespace resolution, fix unit tests, improve handler error handling Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> * fix: use global:: prefix consistently for Shared.* namespaces, fix test indentation Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> * fix: FromDomain mapping, DeleteIssueHandler uses ArchiveAsync, UpdateIssueHandler null guard, integration test alignment Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com>
….com/mpaulosky/IssueManager into feature/dto-refactor-and-soft-delete
…y interfaces - Restored all deleted Model files from Shared/Models/ (Issue, Status, Comment, Category, User) - Restored Shared/Api/Extensions/Extensions.cs from git - Fixed GlobalUsings.cs to import Shared.Models instead of Shared.Domain - Updated repository interface imports to use correct namespaces - Fixed DTO constructors to map Model properties correctly - Resolved ambiguous Issue references using type alias in ICommentRepository - Deleted incorrectly-added Domain files (User, Category, Status, Comment domain duplicates) This restores the correct architecture where: - Shared.Domain contains domain models (Issue, IssueStatus, Label) - Shared.Models contains MongoDB persistence models (Status, Category, Comment, User) - Shared.DTOs contains DTO records for API contracts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Changes
Ready for review.