Skip to content

fix: resolve all Mercy60-assigned issues (#653, #654, #663, #666) - #733

Merged
MaryammAli merged 2 commits into
BlockDash-Studios:mainfrom
mercy60:fix/mercy60-issues-653-654-663-666
Aug 27, 2026
Merged

fix: resolve all Mercy60-assigned issues (#653, #654, #663, #666)#733
MaryammAli merged 2 commits into
BlockDash-Studios:mainfrom
mercy60:fix/mercy60-issues-653-654-663-666

Conversation

@mercy60

@mercy60 mercy60 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves all four currently-open issues assigned to Mercy60:

  • Closes BA-085 — Add prompt-template approval and audit metadata #653 — BA-085: Add prompt-template approval and audit metadata

    • PromptTemplate now records author, approval (status/approver/timestamp/review notes), effectiveAt, and rollback metadata.
    • Active-version selection only considers approved versions whose effective time has been reached and that haven't been rolled back.
    • New approveTemplate, rollbackTemplate, getActiveTemplate, and getTemplateAuditTrail APIs expose and record the governance trail.
    • Default templates carry baseline author/approval/effective metadata.
  • Closes BA-086 — Improve prompt-injection detection beyond substring patterns #654 — BA-086: Improve prompt-injection detection beyond substring patterns

    • SecurityService.sanitisePrompt now runs layered detection:
      1. Normalisation: Unicode NFKC, case folding, zero-width/soft-hyphen removal, whitespace collapsing, repeated URL- and HTML-decoding, homoglyph transliteration.
      2. Direct layer against the normalised text (whitespace-tolerant patterns).
      3. Deobfuscated layer against separator-stripped text (e.g. i.g.n.o.r.e, d.e.v.e.l.o.p.e.r m.o.d.e) — only when separators were actually present to keep false positives low.
      4. Decoded layer for base64-encoded payloads.
      5. Multilingual patterns (FR/ES/DE override phrases).
    • detectPromptInjection exposes the matched reasons and layers.
    • Fixtures in security.service.spec.ts cover bypass attempts (case, spacing, zero-width, URL/HTML/base64 encoding, full-width, homoglyphs, multilingual) and false positives.
  • Closes BA-095 — Make webhook idempotency durable and status-aware #663 — BA-095: Make webhook idempotency durable and status-aware

    • Process-local replay maps replaced with a durable store in DatabaseService (claimWebhookIdempotency / completeWebhookIdempotency / failWebhookIdempotency).
    • Claims carry a payload fingerprint, a processing status (in_progress / completed / failed), and an expiry, with atomic claim semantics (in-progress, completed, key-conflict, failed-retry, expired-reclaim).
    • The live webhook path (PaymentsControllerAntiCheatService) now awaits the durable claim and fingerprints the raw payload; SecurityService and RedisService delegate to the same store (with the old in-memory behavior as a fallback when no DatabaseService is injected, e.g. isolated tests).
  • Closes BA-098 — Add durable webhook delivery records and outbox processing #666 — BA-098: Add durable webhook delivery records and outbox processing

    • New durable outbox in DatabaseService: enqueueWebhookDelivery (stored before delivery), claimDueWebhookDeliveries (atomic claims), completeWebhookDelivery, recordWebhookDeliveryFailure (resumable retrying + nextRetryAt), and inspectable terminal failed records (getTerminalWebhookFailures, listWebhookOutbox).
    • PaymentsService gains enqueueWebhook, deliverDueWebhooks, getWebhookDeliveryRecord, listWebhookOutbox, and getTerminalWebhookFailures; deliverWebhookWithRetry now drives delivery through the outbox (also repairing the previously mangled constructor/imports in payments.service.ts).

Verification

  • 4 new spec files, 55 tests, all passing:
    • security.service.spec.ts (injection fixtures + durable idempotency)
    • database/database.service.spec.ts (claim semantics + outbox lifecycle)
    • payments/payments.service.spec.ts (outbox delivery + webhook processing regression)
    • ai/prompt-template.service.spec.ts (approval/effective-time/rollback/audit)
  • tsc --noEmit shows zero errors in every changed file (project-wide error count dropped 320 → 289; the remaining errors are pre-existing in unrelated files).
  • No new lint errors introduced (pre-existing no-var-requires / unused-import warnings in touched-but-unchanged lines remain).

…kDash-Studios#654, BlockDash-Studios#663, BlockDash-Studios#666)

- BA-085 (BlockDash-Studios#653): record active version, author, approval, effective time,
  and rollback metadata for prompt templates, with an audit trail.
- BA-086 (BlockDash-Studios#654): layered prompt-injection detection with normalisation
  (NFKC, URL/HTML decoding, zero-width removal, homoglyph folding),
  deobfuscated and base64-decoded layers, multilingual patterns, and
  false-positive/bypass fixtures.
- BA-095 (BlockDash-Studios#663): durable, fingerprint- and status-aware webhook
  idempotency claims in the database layer with atomic claim semantics.
- BA-098 (BlockDash-Studios#666): durable webhook outbox — events stored before delivery,
  resumable retries, and inspectable terminal failures.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@mercy60 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! 🚀

Learn more about application limits

@MaryammAli
MaryammAli merged commit 64cc698 into BlockDash-Studios:main Aug 27, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants