Skip to content

Replace console.* with pino logger in backend services and enable no-console ESLint rule - #1322

Merged
Ehonrie merged 5 commits into
Netwalls:mainfrom
dami-005:drips/1252-1253-1254-1255
Sep 28, 2026
Merged

Ehonrie merged 5 commits into
Netwalls:mainfrom
dami-005:drips/1252-1253-1254-1255

Conversation

@dami-005

Copy link
Copy Markdown
Contributor

Summary

Replace console.* with pino logger in backend services and enable no-console ESLint rule

What was solved

#1252 — B-74: Log with pino instead of console in jobs

Replace console.log/console.warn calls in backend background jobs and services with the existing pino logger, ensuring structured logs include market id and tx hash fields, and enable the ESLint no-console rule so console.* is disallowed in src/.

Addressed:

  • Changed: backend/src/logger.ts, backend/src/services/indexer.service.ts, backend/.eslintrc.json
  • Remove all console.* usages in backend/src/ (jobs and services in particular) and route them through the existing pino logger in backend/src/logger.ts
  • Enable the ESLint no-console rule in backend/.eslintrc.json so console.* is flagged in src/
  • Ensure structured log entries include market id and tx hash fields where those values are available (e.g., indexer/job processing)

#1253 — B-75: Integration tests for wallet auth challenge flow

Add an end-to-end integration test suite for the wallet auth challenge flow (challenge → sign → authenticated request) under backend/tests, using a Stellar Keypair.random() to sign challenges and covering expired challenge, reused challenge, and wrong signer failure cases, wired to run in CI.

Addressed:

  • Changed: backend/tests/walletAuth.integration.test.ts, backend/tests/walletAuth.integration.test.ts
  • Create integration test(s) under backend/tests covering the full challenge → sign → authenticated request flow
  • Use Keypair.random() to generate a keypair and sign the challenge
  • Cover expired challenge rejection

#1254 — B-76: Integration tests for admin routes

Add HTTP-level Supertest integration tests for the admin routes (admin resolve, dispute-resolve, and oracle CRUD), covering unauthenticated 401, invalid body 400, and success cases, with contract calls mocked at the service boundary.

Addressed:

  • Changed: backend/tests/admin.api.test.ts
  • Add Supertest-based integration tests under backend/tests/ for each admin route: admin resolve, dispute-resolve, and oracle CRUD
  • Cover unauthenticated requests returning 401 for each admin route
  • Cover invalid request bodies returning 400 for each admin route

#1255 — B-77: Jest global setup with isolated test database

Add a Jest globalSetup for the backend that resets an isolated test database via prisma migrate reset --force against DATABASE_URL_TEST, and consolidate the scattered test files under a consistent folder convention with behaviour-describing names (removing issue-number-based names).

Addressed:

  • Changed: backend/jest.config.ts, backend/package.json, backend/.env.example
  • Add globalSetup to backend/jest.config.ts that runs prisma migrate reset --force against DATABASE_URL_TEST
  • Ensure the test run uses DATABASE_URL_TEST (isolated test DB) rather than the dev/prod DATABASE_URL
  • Consolidate tests under a consistent folder convention (e.g. backend/__tests__/ or co-located __tests__ dirs) instead of the current mix of __tests__/, src/api/__tests__, src/services/__tests__, and tests/issues-907-...

Changes

  • backend/src/logger.ts (modify)
  • backend/src/services/indexer.service.ts (modify)
  • backend/.eslintrc.json (modify)
  • backend/__tests__/walletAuth.integration.test.ts (create)
  • backend/__tests__/admin.api.test.ts (create)
  • backend/jest.config.ts (modify)
  • backend/package.json (modify)
  • backend/.env.example (modify)

Approach

  1. B-74: Log with pino instead of console in jobs #1252 — B-74: Log with pino instead of console in jobs (Changed: backend/src/logger.ts, backend/src/services/indexer.service.ts, backend/.eslintrc.json)
  2. B-75: Integration tests for wallet auth challenge flow #1253 — B-75: Integration tests for wallet auth challenge flow (Changed: backend/tests/walletAuth.integration.test.ts, backend/tests/walletAuth.integration.test.ts)
  3. B-76: Integration tests for admin routes #1254 — B-76: Integration tests for admin routes (Changed: backend/tests/admin.api.test.ts)
  4. B-77: Jest global setup with isolated test database #1255 — B-77: Jest global setup with isolated test database (Changed: backend/jest.config.ts, backend/package.json, backend/.env.example)

Issues

Closes #1252
Closes #1253
Closes #1254
Closes #1255

@Ehonrie
Ehonrie merged commit ab87098 into Netwalls:main Sep 28, 2026
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