feat: resolve #536 #537 #538 #539 — migrate-all, /metrics docs, pkg-dupe CI, rate-limit config - #659
Merged
Dev-AdeTutu merged 3 commits intoAug 3, 2026
Conversation
…ev-AdeTutu#539 Dev-AdeTutu#539 — Consolidate rate-limit config - Add backend/src/config/rateLimits.ts as single source of truth for all rate-limit env-var parsing (RATE_LIMIT_WINDOW_MS, RATE_LIMIT_MAX, WRITE_RATE_LIMIT_MAX, PAYMENTS_RATE_LIMIT_MAX, RATE_LIMIT_MESSAGE) - Update middleware/rateLimit.ts to import from config/rateLimits.ts - Update index.ts to import from config/rateLimits.ts; also clean up duplicate imports and duplicate route registrations that had accumulated from multiple merged drafts Dev-AdeTutu#536 — Bulk migrate-all helper - Add scripts/migrate-all.js: fetches all meters via get_all_meters, calls migrate_meter for each, logs per-meter success/failure, prints summary, exits 1 if any meter fails (CI-safe) - Add make migrate-all target to Makefile with required-var guards and DRY_RUN support - Update README Contract Upgrades / Migration flow section to reference make migrate-all as the recommended path Dev-AdeTutu#537 — Document /metrics intentional public exposure - Add detailed design-decision comment above GET /metrics in index.ts explaining why no auth is needed and how network isolation makes it safe - Add /metrics — intentionally public section to README Observability with guidance for hardening when port is publicly exposed - Add metrics_path: /metrics and doc comment to infra/prometheus.yml Dev-AdeTutu#538 — CI guard against duplicate package.json keys - Add scripts/check-duplicate-pkg-keys.js: custom recursive-descent JSON parser that counts key occurrences and exits 1 on any duplicate (standard JSON.parse silently keeps last value, so npm install succeeding is insufficient proof) - Add check-pkg-duplicates job to .github/workflows/ci.yml that runs against both backend/package.json and frontend/package.json Also fix pre-existing compile errors in main that blocked tsc --noEmit: - bridge.ts: add MqttPayloadSchema export to validation.ts; remove undefined WEBHOOK_URL reference - meters.ts: remove orphaned old-style handler fragments injected mid-handler; complete pagination handler body - payments.ts: remove duplicate POST / preamble; remove orphaned handler body fragment; remove out-of-scope idempotencyKey reference - stats.ts: remove duplicate old-version preamble - stellar.ts: remove duplicate top-level CONTRACT_ID/server declarations that shadowed back-compat alias exports - webhooks.ts: resolve merged POST /low-balance handler body Closes Dev-AdeTutu#536 Closes Dev-AdeTutu#537 Closes Dev-AdeTutu#538 Closes Dev-AdeTutu#539
|
@Good-Coded 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! 🚀 |
Owner
|
@Good-Coded pls fix conflicts |
Contributor
Author
@Dev-AdeTutu fixed! |
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.
Summary
Resolves four open feature issues in a single cohesive PR. Also fixes pre-existing TypeScript compile errors in
mainthat were blockingtsc --noEmit(those are documented in the commit message and unrelated to the four issues).#539 — Consolidate rate-limit config into one module
Problem:
middleware/rateLimit.tsandindex.tseach parsed the sameRATE_LIMIT_WINDOW_MS/RATE_LIMIT_MAXenv vars independently — two diverging sources of truth that could silently drift.Fix:
backend/src/config/rateLimits.tsis the single source of truth for all five rate-limit env vars (RATE_LIMIT_WINDOW_MS,RATE_LIMIT_MAX,WRITE_RATE_LIMIT_MAX,PAYMENTS_RATE_LIMIT_MAX,RATE_LIMIT_MESSAGE)middleware/rateLimit.tsandindex.tsnow import from itindex.tswas also cleaned up: duplicate imports and duplicate route registrations accumulated from multiple merged drafts were removedCloses #539
#536 — Bulk migrate-all helper
Problem: The migration flow required running
stellar contract invoke … migrate_meteronce per meter by hand — error-prone at scale.Fix:
scripts/migrate-all.js— fetches all meters viaget_all_meters, callsmigrate_meter(meter_id)for each, logs per-meter success/failure, prints a final summary, and exits non-zero if any meter fails (CI-safe)make migrate-all CONTRACT_ID=… ADMIN_SECRET_KEY=…Makefile target with required-var guards andDRY_RUN=truesupportmake migrate-allas the recommended pathmake migrate-all CONTRACT_ID=C... ADMIN_SECRET_KEY=S... NETWORK=testnet make migrate-all CONTRACT_ID=C... ADMIN_SECRET_KEY=S... DRY_RUN=true # dry runCloses #536
#537 — Document intentional public exposure of
/metricsProblem:
GET /metricshad no auth and no written rationale — ambiguous whether this was intentional.Decision confirmed: Intentionally public. Prometheus's pull model requires unauthenticated HTTP GET. The backend port
3001is only on the internal Dockerapp-network— not forwarded publicly. Network isolation is the guard.Fix:
app.get('/metrics', …)inindex.ts/metrics— intentionally public section in README Observability, including reverse-proxy hardening guidance for public deploymentsinfra/prometheus.ymlnow explicitly setsmetrics_path: /metricswith an explanatory commentCloses #537
#538 — CI guard against duplicate package.json keys
Problem:
backend/package.jsonpreviously shipped with duplicate dependency entries (issue #262).JSON.parsesilently keeps the last value, sonpm installsucceeding gave no signal.Fix:
scripts/check-duplicate-pkg-keys.js— custom recursive-descent JSON parser that counts key occurrences and exits 1 on any duplicate, with a clear error message showing the offending path and countcheck-pkg-duplicatesjob in.github/workflows/ci.ymlruns against bothbackend/package.jsonandfrontend/package.jsonon every push/PRCloses #538
Testing
tsc --noEmitnpx vitest runmain(was 21 passed / 23 failed before this PR)node scripts/check-duplicate-pkg-keys.js backend/package.json frontend/package.json