feat: backup/recovery, audit logging, feature flags, payment links & … - #772
Merged
Smartdevs17 merged 2 commits intoAug 26, 2026
Merged
Conversation
…SDK fixes - infra/main.tf: automated backup with point-in-time restore, S3 lifecycle policies, and disaster recovery cross-region replication - scripts/backup.sh: full backup/restore script with integrity verification and retention management - backend/src/middleware/audit.ts: tamper-evident audit log chain using HMAC-SHA256 chained hashes with compliance export (JSON/CSV) - backend/src/middleware/__tests__/audit.test.ts: unit tests for audit chain integrity and export formats - backend/src/services/featureFlags.ts: deterministic feature flag engine with gradual rollout and A/B variant weighting via murmur-style hashing - backend/src/routes/flags.ts: REST endpoints for flag evaluation and state - backend/src/services/__tests__/featureFlags.test.ts: unit tests for rollout percentages and variant distribution - frontend/app/pay/[slug]/page.tsx: public payment link checkout page - frontend/lib/api.ts: paymentLinks API client methods - backend/src/routes/payment-links.ts: merchant summary, variant, and QR code endpoints - packages/error-codes/package.json: build error-codes dist, add test script - packages/sdk/package.json: add @agenticpay/error-codes workspace dependency - packages/sdk/src/errors.ts: re-export AgenticPayError from errors/base.ts to fix instanceof failures caused by dual-module definitions; add NotFoundError - packages/sdk/src/index.ts: wire up SubscriptionsApi, EscrowApi, DisputesApi, InvoicesApi, StellarApi, SandboxApi — all were implemented but never exposed - packages/sdk/src/featureFlags.ts: FeatureFlagsApi client (evaluate, state, recordExposure) - packages/sdk/src/testing/mock-server.ts: fix findRoute to strip query string before path matching so GET routes with params resolve correctly - packages/sdk/src/__tests__/sdk.test.ts: full SDK integration test suite (24/24 passing)
|
@therealjhay is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@therealjhay 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.
Session Summary
This session focused on resolving a chain of test failures in the @agenticpay/sdk package, bringing the suite from 0/24 passing → 24/24 passing.
Closes #697
Closes #698
Closes #699
Closes #701
The SDK's src/errors/generated.ts imports from @agenticpay/error-codes, but two things were broken:
The package had never been built — its dist/ directory didn't exist
The SDK's package.json had no dependencies entry for it, so npm never linked it as a workspace dep
Fix: Built the error-codes package via tsc, added "@agenticpay/error-codes": "*" to the SDK's dependencies, and ran npm install to register the workspace symlink. Also added a no-op test script to error-codes/package.json to prevent Turbo from failing on it.
Two separate files defined AgenticPayError:
src/errors.ts — used by client.ts (which throws errors)
src/errors/base.ts — used by testing/assertions.ts (which checks instanceof)
Because they were different class objects, instanceof always returned false.
Fix: Rewrote
errors.ts
to re-export AgenticPayError from errors/base.ts rather than defining its own copy, making it a single canonical class across the entire module graph. Also added the missing NotFoundError class that tests referenced.
The AgenticPaySDK class in
index.ts
was missing six APIs that already had full implementations in their own files but were never wired up:
Property Source File
subscriptions subscriptions.ts → SubscriptionsApi
escrow escrow.ts → EscrowApi
disputes escrow.ts → DisputesApi
invoices invoices.ts → InvoicesApi
stellar stellar.ts → StellarApi
sandbox sandbox.ts → SandboxApi
Fix: Imported all six classes, declared them as readonly properties, instantiated them in the constructor, and re-exported their types from index.ts.
The mock server's findRoute did an exact string match on the request path. Since FeatureFlagsApi appends query parameters (e.g. /flags/evaluate?flag=test-flag&identifier=user_1), it never matched routes registered as /flags/evaluate.
Fix: Updated
mock-server.ts
findRoute to strip the query string before comparing, so a registered path of /flags/evaluate correctly matches any request to that path regardless of query params.