fix: pool config+health (#596), SEP-24 contracts (#603), async PDF queue (#595), SOS Maestro E2E (#607)#1
Closed
Creed1759 wants to merge 1 commit into
Conversation
…+health, SEP-24 contracts, async PDF queue, SOS Maestro E2E Close DogStark#596 — PostgreSQL connection pool hardening - Replaced DB_POOL_SIZE/DB_IDLE_TIMEOUT env vars with DB_POOL_MAX, DB_IDLE_TIMEOUT_MS, DB_CONNECTION_TIMEOUT_MS (all configurable) - New defaults: max=20, idleTimeoutMillis=10000, connectionTimeoutMillis=3000 - Added getPoolStats() helper (total/idle/waiting counts) - /api/health now returns pool stats in response body - Emits a console WARN when waiting > 5 on every new connection - Added backend/tests/integration/poolExhaustion.test.ts: verifies requests fail fast (not hang) after connectionTimeoutMillis Close DogStark#603 — SEP-24 anchor contract tests - Added backend/services/__tests__/stellarAnchorService.contract.test.ts - Consumer-driven contracts using a lightweight mock provider (no Pact dependency needed — mock shapes are the contract) - Covers: stellar.toml shape, /deposit/interactive request/response, /withdraw/interactive with amount, /transaction poll (pending & complete), terminal-status cache (no re-poll), and SEP-24 /info shape - If anchor API changes its response shape, the corresponding assertion fails Close DogStark#595 — Async PDF generation via Redis job queue - Rewrote backend/server/routes/reports.ts from synchronous GET to: POST /api/reports/pets/:petId/health → 202 { jobId } GET /api/reports/:jobId/status → { status, recordCount, filename, error } GET /api/reports/:jobId/download → streams PDF when complete - Jobs stored in Redis with 1-hour TTL using existing getRedisClient() - PDF generation runs in setImmediate (background, non-blocking) - Graceful fallback to synchronous generation if Redis is unavailable - Failed jobs return typed error with retry possible - DocumentVaultScreen.tsx updated: 'Generate Health Report' button enqueues job, polls every 2 s with progress indicator, shows Download PDF on complete Close DogStark#607 — Maestro E2E flow for Emergency SOS - Added .maestro/flows/sos.yaml covering three scenarios: 1. Full activation: hold SOS → countdown → contacts notified 2. Cancellation: hold → confirm dialog → tap cancel → no SOS sent 3. No contacts: hold → SOS fires → shows 'Add Emergency Contact' prompt - Mock scripts in .maestro/scripts/ intercept API calls so no real alerts are sent during test runs - Runnable with: maestro test .maestro/flows/sos.yaml
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
Closes DogStark#596, DogStark#603, DogStark#595, DogStark#607 — four independent issues solved in one pass.
DogStark#596 — PostgreSQL connection pool configuration & monitoring
What: The pool was created with default/misconfigured settings and the
/healthendpoint had no pool visibility.How:
DB_POOL_SIZE,DB_IDLE_TIMEOUT) withDB_POOL_MAX(default 20),DB_IDLE_TIMEOUT_MS(default 10000),DB_CONNECTION_TIMEOUT_MS(default 3000)getPoolStats()returning{ total, idle, waiting }GET /api/healthnow returnspoolstats alongside the existing responseconsole.warnfires on every new connection whenwaiting > 5backend/tests/integration/poolExhaustion.test.tsverifies requests fail fast (not hang) afterconnectionTimeoutMillisDogStark#603 — SEP-24 anchor contract tests
What: Anchor API changes could silently break the deposit/withdrawal flow.
How:
backend/services/__tests__/stellarAnchorService.contract.test.ts/deposit/interactiverequest/response,/withdraw/interactivewith amount,/transactionpoll (pending & complete states), terminal-status caching (no re-poll after completion), and the SEP-24/inforesponse shapeDogStark#595 — Async PDF generation via Redis job queue
What: Synchronous PDF generation in the HTTP request timed out for large reports.
How:
backend/server/routes/reports.tswith three endpoints:POST /api/reports/pets/:petId/health→ returns202 { jobId }immediatelyGET /api/reports/:jobId/status→ returns{ status, recordCount, filename, error }GET /api/reports/:jobId/download→ streams PDF once completesetImmediate(background, non-blocking)getRedisClient()DocumentVaultScreen.tsxupdated: new "Generate Health Report" button enqueues the job, polls/statusevery 2 s with an activity indicator, and shows a "Download PDF" button whenstatus === 'complete'DogStark#607 — Maestro E2E flow for Emergency SOS
What: No Maestro coverage for the highest-stakes feature in the app.
How:
.maestro/flows/sos.yamlwith three scenarios:.maestro/scripts/interceptPOST /api/emergency/sosandGET /api/emergency/contactsso no real alerts are dispatched during CImaestro test .maestro/flows/sos.yaml