refactor(platform): centralized config, OpenAPI validation, domain modules, error code registry#550
Open
CeceOs92 wants to merge 1 commit into
Conversation
…dules, error code registry
|
@CeceOs92 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@CeceOs92 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.
This PR implements 4 foundational refactors for AgenticPay: centralized configuration with dynamic reload, OpenAPI-driven validation, domain-driven frontend modules, and unified error code registry.
What's Changed
Centralized Configuration Service - #481
backend/src/services/config/with hierarchical resolution: defaults < env < database < runtime overrideconfig-store.tsabstracts storage via Prisma + Redis pub/sub for change notificationsconfig.updatedevent, refresh without restartGET/PATCH /api/admin/configfor read/updateConfigAuditLogmodel tracks who changed what + when/admin/configurationUI with typed forms, validation, live previewAppConfigurationtableconfig.changedpublished to Redis for downstream servicesOpenAPI-Based Validation - #482
packages/api-spec/with OpenAPI 3.1 definitions as single source of truthopenapi-zod-clientfor request validationbackend/src/middleware/openapi-validator.ts: auto-validates all requests, serializes responses/api-docsusing ScalarvalidateResponseAgainstOpenAPIhelper catches violations in CIoneOf,anyOf,allOf, file uploads, binary responses@deprecatedin OpenAPI addsSunsetheaderFrontend Domain-Driven Modules - #483
frontend/src/domains/into:payments,merchants,wallets,analytics,settings,developerscomponents/,hooks/,api/,types/,pages/colocatedfrontend/src/shared/andfrontend/src/ui/for design system@payments/hooks/usePaymentListCONTRIBUTING.mdshared/stores/and global providers inapp/providers.tsxUnified Error Code Registry - #484
ERR_<DOMAIN>_<TYPE>e.g.ERR_PAYMENT_INSUFFICIENT_FUNDSpackages/error-codes/registry with description, HTTP status, resolution hints{ error: { code, message, details, requestId } }backend/src/middleware/error-handler.tsmaps all exceptions to standard formatGET /api/errorsreturns full registry for discoverabilitypackages/sdk/src/errors/auth,validation,payment,blockchain,rate_limit,internalTesting Done
/paymentswith missing field → 400 with Zod error; response schema violation fails CIpnpm lint→ no boundary violations; codemod migrated 214 files; app builds/runsPaymentError.InsufficientFunds→ response matches standard format; SDK throws typed errorGET /api/errorsreturns registry;/api-docsrenders all endpoints + error codespnpm test→ 64 new tests pass across backend/frontendpnpm lint && pnpm typecheck→ cleanNotes
Breaking change: all error responses now standardized; SDK users must update catch blocks. Config migration script provided. OpenAPI spec is now required for new endpoints. Domain restructure improves codebase navigation and reduces coupling.
Closes #481
Closes #482
Closes #483
Closes #484