This PR hardens the backend by guarding replay operations with a mandatory dry-run mode and resolving all outstanding TypeScript build errors and failing test cases across the backend suite.
- Replay Security Controls:
- Implemented
dry-runpreview support in the Replay Service. - Added
confirmedflag enforcement to prevent accidental mutating replay executions. - Replay endpoints now return detailed execution plans, summary statistics, and target ranges.
- Implemented
- Backend Stabilization (Build Fixes):
- Corrected truncated Zod types in
env.schema.ts(METADATA_CACHE_TTL_SECONDSandRAFFLE_CREATE_RATE_WINDOW_SECONDS) and removed the duplicateREDIS_URLdefinition. - Fixed Zod readonly array assignment issues in
subscribe.dto.tsanddevice-token.dto.ts. - Removed unused
eventsproperty mapping when calling service functions fromnotifications.controller.ts. - Added missing NestJS decorators and Swagger imports (
@Res,@Throttle,@ApiHeader) toraffles.controller.ts. - Removed the duplicate
MetadataServiceprovider fromRafflesModule. - Added missing
cursorandoffsetproperties to theLeaderboardQueryDtoclass.
- Corrected truncated Zod types in
- Test Suite Enhancements (Fixes):
env.schema.spec.ts: Updated expectations to reflect the newMETADATA_CACHE_TTL_SECONDS3600-second default and the removed duplicateREDIS_URLentry.search.service.spec.ts/search.controller.spec.ts: Fixed mocks to reflect the updatedSearchOptionsobject argument signature.sentry.spec.ts: Updated Sentry configuration expectations to includeintegrationsandprofilesSampleRateappended by the Node profiling module.auth.service.spec.ts: Corrected the Supabase.update().eq()query builder mock to emulate chaining correctly, and updated expected error messages to match the implementation.
- Tests cover dry-run, confirmed replay, invalid range, and permission failure.
- Monitor UI can show dry-run results before execution.
- Clean build (
npm run buildsucceeds without TypeScript errors). - Test suite passes cleanly (
npm run test).
Fixes #547