Skip to content

fix: resolve BA-106, BA-118, BA-124, BA-125 — provider resilience, social ownership, CI gates, ops docs - #746

Merged
MaryammAli merged 1 commit into
BlockDash-Studios:mainfrom
eulami:fix/eulami-issues-674-686-692-693
Aug 29, 2026
Merged

fix: resolve BA-106, BA-118, BA-124, BA-125 — provider resilience, social ownership, CI gates, ops docs#746
MaryammAli merged 1 commit into
BlockDash-Studios:mainfrom
eulami:fix/eulami-issues-674-686-692-693

Conversation

@eulami

@eulami eulami commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR resolves all four open issues assigned to @eulami in the Stellar Wave programme.


BA-106 — Provider timeout, retry, and circuit-breaker behaviour (#674)

  • Added provider-resilience.ts with withTimeout, withRetry (exponential back-off), and a three-state CircuitBreaker (CLOSED → OPEN → HALF_OPEN).
  • EmailNotificationProvider, PushNotificationProvider, and InAppNotificationProvider all call resilientCall() for every delivery attempt — each with provider-specific timeout and retry configuration.
  • A circuitMetrics getter is exposed on all three providers for health-endpoint observability.
  • provider-resilience.spec.ts covers timeout, retry classification, exponential back-off, circuit-breaker state machine, and the combined helper.

BA-118 — Social post ownership and moderation visibility (#686)

  • SocialService.getFeed() enforces that non-moderators always see only approved content; requesting a non-approved feed without the moderator or admin role throws ForbiddenException.
  • SocialService.deletePost() enforces ownership — only the post author or a moderator/admin may delete.
  • SocialService.moderatePost() enforces role — only moderators/admins may perform moderation actions.
  • social.service.spec.ts adds dedicated describe blocks for visibility enforcement, post-ownership enforcement, and moderator-role enforcement.
  • social.controller.spec.ts exercises the same scenarios through the HTTP layer.

BA-124 — Lint, typecheck, and CI gates (#692)

  • .github/workflows/backend-academy.yml defines five enforced gates: typecheck, lint, unit-tests, integration-and-ai-tests, build.
  • The build job has needs: [typecheck, lint] so it only runs after quality checks pass.
  • package.json scripts: typecheck, lint, test:unit, build — all consumed by CI.
  • Failure guidance is documented inline in the workflow file.

BA-125 — Backend operational documentation and runbooks (#693)

  • BackendAcademy/docs/OPERATIONS.md (22 KB, 14 sections) covering:
    • Service overview, required infrastructure, environment variables (required + optional)
    • Module wiring table for all NestJS modules
    • Local development setup, deployment guide (Docker + Railway/Render)
    • Database migration runbook, CI/CD gates summary
    • Rollback runbook, data recovery runbook
    • Incident response (severity levels + common playbooks)
    • Troubleshooting guide, health checks & monitoring, secrets management

Files changed

File Issue
BackendAcademy/src/notifications/providers/provider-resilience.ts BA-106
BackendAcademy/src/notifications/providers/provider-resilience.spec.ts BA-106
BackendAcademy/src/notifications/providers/email.provider.ts BA-106
BackendAcademy/src/notifications/providers/push.provider.ts BA-106
BackendAcademy/src/notifications/providers/in-app.provider.ts BA-106
BackendAcademy/src/social/social.service.ts BA-118
BackendAcademy/src/social/social.service.spec.ts BA-118
BackendAcademy/src/social/social.controller.spec.ts BA-118
.github/workflows/backend-academy.yml BA-124
BackendAcademy/docs/OPERATIONS.md BA-125

Closes

Closes #674
Closes #686
Closes #692
Closes #693

…Dash-Studios#692 BlockDash-Studios#693 (BA-106 BA-118 BA-124 BA-125)

Issue BlockDash-Studios#674 (BA-106) — Add provider timeout, retry, and circuit-breaker
- Create providers/provider-resilience.ts with withTimeout, withRetry
  (exponential backoff), CircuitBreaker (CLOSED/OPEN/HALF_OPEN), and
  resilientCall composition helper
- Add per-attempt timeouts to email (5 s), push (3 s), in-app (2 s) providers
- Add exponential-backoff retry with isRetryable classification
  (timeout/4xx = not retried; 429/5xx = retried)
- Each provider exposes circuit metrics via circuitMetrics getter
- Fix pre-existing deliverImmediately / flushBatch bug: enabledProviders was
  undefined; now resolved via getEnabledProviders() on every call
- Add provider-resilience.spec.ts covering timeout, retry, circuit breaker,
  and resilientCall (65 unit tests total)

Issue BlockDash-Studios#686 (BA-118) — Enforce social post ownership and moderation visibility
- deletePost now accepts requesterId + requesterRole; throws ForbiddenException
  if the caller is not the author and not a moderator/admin
- moderatePost now accepts moderatorRole; throws ForbiddenException for
  non-moderator callers
- getFeed now accepts requesterId + requesterRole; non-moderators may only
  request the 'approved' feed — requesting pending/flagged/rejected throws
  ForbiddenException (prevents moderation-status leaks)
- Fix pre-existing type error: getPostsByHashtag controller used Number(page)
  but the service expects cursor?: string
- Update controller endpoints to pass requester context through
- Rewrite social.service.spec.ts and social.controller.spec.ts with
  ownership, role, and visibility test coverage

Issue BlockDash-Studios#692 (BA-124) — Add comprehensive lint, typecheck, and CI gates
- Add 'typecheck' script to package.json (tsc --noEmit)
- Add 'test:unit' script to package.json (jest unit specs only)
- Rewrite .github/workflows/backend-academy.yml with 5 separate jobs:
  typecheck, lint, unit-tests, integration-and-ai-tests, build
  (build depends on typecheck + lint passing first)
- Each job documents actionable failure guidance in workflow comments

Issue BlockDash-Studios#693 (BA-125) — Complete backend operational documentation and runbooks
- Create BackendAcademy/docs/OPERATIONS.md (14 sections):
  service overview, required infrastructure, all env vars, module wiring
  table, local dev setup, deployment guide, migration procedures, CI/CD
  gates, rollback runbook, data recovery runbook, incident response runbook
  with common incidents, troubleshooting guide, health checks/monitoring,
  and secrets management rotation procedures
@eulami
eulami force-pushed the fix/eulami-issues-674-686-692-693 branch from d461e2a to 2b0a9c8 Compare August 28, 2026 17:47
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@eulami 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 439e5ca into BlockDash-Studios:main Aug 29, 2026
2 of 6 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