Millicentogalanya/stellar earn#1651
Open
millicentogalanya wants to merge 4 commits into
Open
Conversation
|
@millicentogalanya 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.
Linked Issue
Closes #1165
Closes #1175
Description
This PR implements a pre-push hook to run fast backend quality gates (ESLint, Prettier, and TypeScript type checking) before code is pushed, ensuring early detection of code quality issues. It also adds SLA instrumentation to track submission review times by introducing histogram and counter metrics that measure the duration from submission creation to approval or rejection. The changes enable the team to monitor moderation workflow performance and ensure SLA compliance while improving overall code quality through automated quality gates. Both implementations are non-breaking and follow existing project patterns for metrics and DevOps configuration.
What changed?
Added a pre-push hook (c:/Users/USER/stellar_Earn/scripts/pre-push.bat) to run fast backend quality gates before pushing code
Added SLA instrumentation metrics to track submission review times in the moderation workflow
Updated MetricsService with new histogram and counter metrics for submission review tracking
Modified SubmissionsService to emit SLA metrics when submissions are approved or rejected
Why was it changed?
Pre-push hook: To catch code quality issues early before they reach the remote repository, improving code quality and reducing CI failures
SLA instrumentation: To enable monitoring and tracking of submission review times, allowing the team to measure and improve moderation workflow performance and ensure SLA compliance
How was it implemented?
Created a Windows batch script that checks if backend files changed, then runs ESLint, Prettier format check, and TypeScript type check
Added histogram metric submission_review_duration_seconds with appropriate time buckets (1min to 24h) to track review duration distribution
Added counter metrics submission_review_total, submission_approval_total, and submission_rejection_total to track review volume
Injected MetricsService into SubmissionsService and added metric emission in approveSubmission and rejectSubmission methods
Calculated review duration as the time difference between submission creation and approval/rejection timestamps
Type of Change
Contract Changelog Discipline
contracts/earn-quest/CHANGELOG.mdunder## [Unreleased]### Breaking Changesentry with impact, affected files, and migration stepstype(scope)!:) in the PR title or commit historyBREAKING CHANGE:explanation belowBREAKING CHANGE details (required for breaking contract changes):
Test Evidence
Unit Tests
npm run test)npm run test:cov)Test output / screenshot:
E2E / Integration Tests
npm run test:e2e)Endpoints tested:
GET/api/...Swagger / API Documentation
@ApiOperation,@ApiResponse, and@ApiBearerAuthdecorators@ApiProperty/@ApiPropertyOptional/api/docsand responses are accurateError Handling Checklist
HTTP Exceptions
NotFoundException,BadRequestException,ForbiddenException,UnauthorizedException,ConflictException, etc.)Errorthrown where an HTTP exception is expectedInput Validation (DTOs)
class-validatordecorators (@IsString,@IsUUID,@IsNotEmpty,@IsOptional, etc.)class-transformerdecorators applied where necessary (@Transform,@Type,@Expose)ValidationPipeis applied globally or at the controller level - raw unvalidated input is never usedGuards & Authorization
@UseGuards(JwtAuthGuard)or equivalent@Public()decorator where applicableLogging
LoggerService)errorlevel with stack tracesLoggerMiddleware- no duplicate logs addedStellar / Soroban Contract Interactions
Database / Migration
npm run typeorm:generate-migration)seed.ts)Breaking Type / Model Changes (Frontend — FE-068)
breaking-types☐breaking-runtime☐added☐changed☐deprecated☐removed☐fixed☐security## [Unreleased]inFrontEnd/my-app/CHANGELOG.mdOR a new file inFrontEnd/my-app/.changeset/.Migration:code block.cd FrontEnd/my-app && npm run changelog:checkpasses locally.changelog-skiplabel or[changelog-skip]to the PR title.Final Pre-Merge Checklist
main/masternpm run lint)npm run format)console.log/ debug statements left in production code.env.exampleupdated if new environment variables were introducedReadMe Backend.mdorReadMe Frontend.mdupdated if setup steps changedScreenshots / Recordings (if applicable)
Additional Notes for Reviewer