[codex] Resolve open issues with reliability, analytics, and test hardening - #34
Merged
Merged
Conversation
This was referenced Feb 16, 2026
nickbeau
marked this pull request as ready for review
February 16, 2026 22:58
There was a problem hiding this comment.
Pull request overview
This PR resolves seven open repository issues by addressing reliability gaps in outbound email dispatch, performance issues in analytics queries, security concerns in knowledge-base search, backup integrity risks, and documentation gaps for release readiness.
Changes:
- Refactored outbound email retry logic to perform one send attempt per dispatch cycle and consolidated duplicate dead-letter transitions into a single code path
- Optimized analytics dashboard queries by materializing ticket data once and replacing per-ticket subqueries with grouped queries
- Added LIKE wildcard escaping for knowledge-base search to prevent unintended pattern matching
- Updated backup script to use SQLite
.backupcommand for transactional consistency - Added comprehensive release readiness and security hardening documentation with checklists
- Included GitHub Actions CI/CD workflow files for automated build, test, and release processes
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Helpdesk.Light.Infrastructure/Services/OutboundEmailService.cs | Refactored retry logic to single attempt per cycle with consolidated dead-letter helper |
| src/Helpdesk.Light.Infrastructure/Services/AnalyticsService.cs | Optimized dashboard queries with single materialization and grouped first-response lookup |
| src/Helpdesk.Light.Infrastructure/Services/KnowledgeBaseService.cs | Added LIKE pattern escaping for literal wildcard character handling |
| scripts/backup-helpdesk.sh | Replaced file copy with SQLite .backup command for consistent snapshots |
| docs/release-readiness-security.md | New security hardening checklist with authorization, sanitization, and AI guardrail documentation |
| README.md | Added reference link to release readiness documentation |
| tests/Helpdesk.Light.UnitTests/OutboundEmailServiceTests.cs | New unit tests for single-attempt retry and single dead-letter transition |
| tests/Helpdesk.Light.UnitTests/AnalyticsServiceTests.cs | New unit tests for dashboard metrics calculation |
| tests/Helpdesk.Light.UnitTests/KnowledgeBaseServiceSearchTests.cs | New unit tests for literal wildcard character handling |
| tests/Helpdesk.Light.UnitTests/BackupScriptTests.cs | New unit tests verifying backup script uses SQLite .backup command |
| .github/workflows/ci.yml | CI workflow for build and test automation on pull requests and pushes |
| .github/workflows/release.yml | CD workflow for creating release artifacts and publishing to GitHub releases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
This PR resolves all currently open repository issues:
#21,#27,#28,#29,#30,#31, and#32.The previous implementation had four concrete reliability/performance gaps and one release-readiness documentation gap:
%and_as unescaped LIKE wildcards,Root Cause and User Impact
Outbound email retry handling used an inner loop that exhausted retry budget immediately under transient provider failures, reducing recovery opportunities between worker cycles and inflating risk of premature dead-lettering. The same method had two dead-letter paths, which could duplicate audit/metric side effects.
Analytics dashboard calculations materialized similar ticket sets multiple times and used a projection pattern for first response that risked inefficient query plans as data volume grows.
Knowledge article search assembled LIKE patterns without escaping user-entered wildcard characters. This produced broad, unintended matches when users searched for literal
%or_characters.Backup logic performed raw file copy against a potentially active SQLite database. Under concurrent writes, this can produce an inconsistent backup image.
What Changed
1) Outbound email reliability
OutboundEmailService.DispatchPendingAsyncto perform exactly one send attempt per message per dispatch run.MarkDeadLetter) to prevent duplicate dead-letter events.2) Analytics query efficiency
AnalyticsService.GetDashboardAsyncto materialize ranged tickets once into a lightweight projection.3) Knowledge-base search hardening
KnowledgeBaseServicefor\\,%,_, and[.EF.Functions.Like(..., pattern, "\\")so wildcard characters are interpreted literally when escaped.4) Backup safety
scripts/backup-helpdesk.shto use SQLite snapshot backup:sqlite3 "$DB_PATH" ".backup '$PAYLOAD_DIR/helpdesk.db'"5) Release hardening documentation
docs/release-readiness-security.mdwith:6) Added regression/unit tests
OutboundEmailServiceTests:AnalyticsServiceTests:KnowledgeBaseServiceSearchTests:%and_are treated as literals in search.BackupScriptTests:.backupand no longer uses raw DBcp.Validation
Executed locally on this branch:
dotnet restore Helpdesk.Light.slnxdotnet build Helpdesk.Light.slnx -warnaserrordotnet test Helpdesk.Light.slnxResults:
0 Warning(s)and0 Error(s).29 passed,0 failed.35 passed,0 failed.Additional Included Files
This branch also includes the previously untracked GitHub workflow files in
.github/workflows/(ci.ymlandrelease.yml) so the repository state is consistent with the new README CI/CD references.Closes #21
Closes #27
Closes #28
Closes #29
Closes #30
Closes #31
Closes #32