fix(#485-#488): sync API_SPEC error codes/events, add email DLQ, validate templates at startup#613
Merged
hman38705 merged 1 commit intosolutions-plug:mainfrom Apr 27, 2026
Conversation
…DLQ, validate templates at startup solutions-plug#485: Correct error code values in API_SPEC.md to match #[repr(u32)] enum (100-148). Expand events table with 7 missing events (ref_dist, mkt_prune, upg_init, upg_vote, upg_exec, upg_rej, mkt_state), fix OracleResultSet data payload to include oracle_id, correct topic layouts for mon_reset/rep_set/ dep_set. Bump spec version to 1.1.0. solutions-plug#486: Exponential backoff already present in mark_failed (2^n * 60s). solutions-plug#487: Add EMAIL_DEAD_LETTER_KEY Redis sorted set. mark_failed now pushes permanently-failed jobs to the DLQ. Add list_dead_letter() and requeue_dead_letter() methods. Expose via admin API: GET /api/v1/email/queue/dead-letter POST /api/v1/email/queue/dead-letter/:job_id/requeue QueueStats gains dead_letter field. Audit middleware covers new routes. solutions-plug#488: EmailTemplateEngine::new() calls validate_all_templates() which renders all 4 templates with representative fixture data. Invalid syntax or missing variables now cause a startup error instead of a runtime send failure.
|
@Haroldwonder Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
#485 — Refresh API_SPEC to match current contract and error enums
#[repr(u32)]enum (100–148). The spec previously used sequential 1–50 values that did not match the contract.ref_dist,mkt_prune,upg_init,upg_vote,upg_exec,upg_rej,mkt_state); corrected topic layouts formon_reset,rep_set,dep_set; fixedOracleResultSetdata payload to includeoracle_id(multi-oracle support added in Emit accurate oracle source metadata in oracle result events #405).#486 — Email retry backoff with exponential delay
Exponential backoff was already implemented in
mark_failed(2^attempt × 60s). No code change needed; confirmed and documented.#487 — Email queue dead-letter handling
EMAIL_DEAD_LETTER_KEY = "email:dead_letter"Redis sorted set.mark_failednow pushes permanently-failed jobs (max attempts reached) to the DLQ with afailed_atscore for time-ordered inspection.EmailQueuemethods:list_dead_letter(),requeue_dead_letter(job_id).QueueStatsgains adead_letterfield (visible in existingGET /api/v1/email/queue/stats).GET /api/v1/email/queue/dead-letter— list all DLQ job IDsPOST /api/v1/email/queue/dead-letter/:job_id/requeue— move a job back to the main queue#488 — Email template validation on startup
EmailTemplateEngine::new()now callsvalidate_all_templates()before returning.strict_modeenabled, any missing variable or syntax error causes the server to refuse to start with a clear error message, rather than failing silently at send time.Files changed
API_SPEC.mdservices/api/src/email/queue.rsmark_failed,list_dead_letter,requeue_dead_letter,QueueStats.dead_letterservices/api/src/email/templates.rsvalidate_all_templates()called innew()services/api/src/handlers.rsemail_dead_letter_list,email_dead_letter_requeuehandlersservices/api/src/main.rsservices/api/src/audit_middleware.rsCloses #485, closes #486, closes #487, closes #488