Skip to content

fix: rebrand note, Redis outage runbook, PII audit, mobile Pact tests (#126, #127, #129, #130) - #357

Merged
EmeditWeb merged 4 commits into
Elite-Work:mainfrom
xsthar:fix/126-127-129-130-rebrand-runbooks-pact-pii
Oct 19, 2026
Merged

EmeditWeb merged 4 commits into
Elite-Work:mainfrom
xsthar:fix/126-127-129-130-rebrand-runbooks-pact-pii

Conversation

@xsthar

@xsthar xsthar commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Four issue-scoped changes bundled into one branch: the rebrand migration note (#126), mobile Pact contract tests (#127), the Redis outage settlement runbook (#129), and the PII encryption coverage audit (#130). Docs changes are additive; the only runtime code changes are the mobile API client/auth wiring and mobile dispute category needed to satisfy the verified backend contract.

#126 — Rebrand: EziAgric → EliteWork

  • Added docs/releases/2026-10-19-rebrand-eziagric-to-elitework.md recording the rename, a naming map of intentionally retained legacy identifiers (amana-escrow, AmanaFrontend/AmanaBackend pact names, amana-mobile), and a table of residual references with actionable follow-ups (README, i18n, infra docs, external EziAgric/EziAgric issue links, shared schemas, contract overview doc).
  • Updated docs/releases/release-note-template.md so new notes use the EliteWork name.

#127 — Mobile Pact consumer contract tests

  • Added mobile/tests/pact/trades.pact.test.ts (consumer AmanaMobile, provider AmanaBackend) covering:
    • POST /api/v1/trades
    • POST /api/v1/trades/:id/deposit
    • POST /api/v1/trades/:id/confirm
    • POST /api/v1/trades/:id/release
    • POST /api/v1/trades/:id/dispute
    • GET /api/v1/trades/:id
    • GET /api/v1/trades?page=1&limit=10
  • Wired bearer-token injection into mobile/src/api/client.ts (setAuthToken) and kept it in sync from authStore so authenticated requests actually carry the JWT the backend requires.
  • The dispute interaction exposed a real mismatch: the backend schema requires a category, the mobile client was sending only reason. tradeApi.initiateDispute now sends category: 'OTHER' by default (the seeded fallback category).
  • Extended backend/src/__tests__/trades.pact.verify.test.ts to verify both frontend and mobile pact files, mount the versioned /api/v1/trades router, set provider-state trade statuses, and stub buildConfirmDeliveryTx/buildReleaseFundsTx.
  • Added backend/src/__tests__/stubs/httpsProxyAgent.ts + Jest moduleNameMapper because @pact-foundation/pact@16 requires ESM-only https-proxy-agent@9 at module load, which Jest's CJS runtime cannot parse.
  • Committed the generated mobile/tests/pact/pacts/AmanaMobile-AmanaBackend.json since the repo has no Pact broker/CI consumer-then-provider pipeline; the backend verifier now runs against it in CI.
  • Removed an unused React import in mobile/src/screens/AdminStreamScreen.test.tsx that was failing pnpm type-check.

#129 — Redis outage during active settlement

  • Added docs/runbooks/redis-outage-active-settlement.md: outage confirmation/scope, impact matrix per Redis consumer, containment and decision points, recovery ordering, settlement/payout-integrity SQL (PayoutIntent, Stream.lockedAt, StreamClawbackEvent, Trade), communication templates, rollback, and closeout/tabletop checklists.
  • Corrected docs/runbooks/redis-maintenance.md, which claimed only payout-critical paths return 503; auth revocation/token-version checks fail closed, so authenticated trade/settlement routes can 503 during an outage.
  • Updated docs/redis-resilience.md auth row (token version), added the admin session registry row, and linked both runbooks.
  • Repointed the redis_connection_failure alert runbook URL in backend/src/config/alertRegistry.ts from the generic incident-response doc to the new runbook.

#130 — PII encryption coverage audit

  • Updated docs/pii-encryption.md against the current Prisma schema: added TradeNote.content as encrypted, added User.displayName, NotificationPreference.phoneNumber, Dispute.reason, and TradeEvidence.filename as plaintext gaps, and added an operational free-text review (InAppNotification, WebhookDeliveryAttempt, AdminActionAudit, Stream, ContractPauseLog, JobHeartbeat, EscrowAudit).
  • Added findings F1–F8 with priorities and follow-ups; F1 (NotificationPreference.phoneNumber stored/returned in plaintext) and F2 (User.displayName) are flagged High. F6 notes TradeNotesService.listNotes decrypts without logPiiAccess().
  • Extended backend/scripts/verify-pii-encryption.ts with the TradeNote.content spec so the verifier enforces the newly documented inventory.

Testing

Run locally on this branch:

  • mobile: pnpm exec jest tests/pact/trades.pact.test.ts --runInBand → 7/7 passed.
  • mobile: pnpm exec jest --silent → 172/173 passed; the single failure (AdminStreamsOverviewScreen 5s timeout) is an existing parallel-run flake and passes in isolation (--runInBand, 16/16).
  • mobile: pnpm run type-check → passed.
  • mobile: pnpm run lint → 0 errors (2 pre-existing warnings).
  • backend: pnpm exec jest --config jest.config.js src/__tests__/trades.pact.verify.test.ts --runInBand --forceExit --coverage=false → passed; all 7 mobile interactions verified against the provider (previously the test skipped when no pact files existed).
  • backend: pnpm exec eslint on the changed files → 0 errors (1 pre-existing no-explicit-any warning in the verifier script).

Notes for reviewers

  • The generated pact JSON is committed intentionally; if the team prefers a broker, the next step is a CI step that runs mobile consumers then backend provider verification from the artifact instead.
  • backend/scripts/verify-pii-encryption.ts was not executed here because it needs a populated database; the change is inventory-only.
  • backend tsc --noEmit still reports pre-existing errors in src/__tests__/factories/mockFactories.ts and src/routes/stellar.ledger.ts that are unrelated to this branch and were left untouched.
  • The docs PII follow-ups (F1–F8) are documented, not implemented; they should be filed as dedicated security issues unless a reviewer wants them in this PR.

Close #126
Close #127
Close #129
Close #130

- Add AmanaMobile-AmanaBackend consumer tests covering create, deposit,
  confirm, release, dispute, detail, and list interactions on the
  versioned /api/v1 trade routes.
- Wire bearer-token injection into the mobile API client and sync it from
  authStore so authenticated requests match the backend contract.
- Send the required dispute category (default OTHER) from the mobile API.
- Extend backend Pact provider verification to load the mobile pact file
  and mount the versioned trade router; stub the ESM-only
  https-proxy-agent for Jest and stabilise provider state statuses.
- Remove a stale React import that broke mobile type-check.
@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@xsthar 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! 🚀

Learn more about application limits

@xsthar
xsthar requested a review from FrankHood1 as a code owner October 19, 2026 15:03
@EmeditWeb
EmeditWeb merged commit 0cce7a6 into Elite-Work:main Oct 19, 2026
9 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants