Skip to content

Document custom code review instructions and fix failing unit tests#453

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/review-code-using-instructions
Draft

Document custom code review instructions and fix failing unit tests#453
Copilot wants to merge 5 commits intomainfrom
copilot/review-code-using-instructions

Conversation

Copy link

Copilot AI commented Feb 10, 2026

The repository has custom instructions for GitHub Copilot code reviews (.github/copilot-instructions.md and .github/prompts/review-code.prompt.md) that were undocumented. Developers had no visibility into this feature.

Additionally, this PR fixes 21 out of 33 failing unit tests by adding proper test environment setup and mocking external service dependencies.

Changes

Documentation

  • DEVELOPING.md: Added "Code Review with GitHub Copilot" section documenting:

    • File locations
    • Review coverage (security, performance, code quality, architecture, testing)
    • Output format (Critical/Suggestions/Good Practices)
    • Special requirements (readability focus, no nested ternaries)
  • .github/prompts/README.md: Created documentation for the prompts directory explaining:

    • Purpose and available prompts
    • How custom instructions are applied
    • Modification guidelines

Unit Test Fixes

  • Test Environment Setup: Created src/__tests__/test-setup.ts to load .env.test environment variables before tests run
  • Configuration: Updated .mocharc.json to require the test-setup file
  • Bug Fix: Fixed typo in src/utils/btc-utils.ts - changed 'tesnet' to 'testnet'
  • External Service Mocking: Added proper sinon stubs for BridgeService and RskNodeService tests to mock external ethers contract and web3 calls

Test Results: Improved from 33 failing tests to 12 failing tests (64% improvement, 21 tests fixed)

Existing Custom Instructions

The automated reviews check:

  • Security: OWASP Top 10, input validation, injection vulnerabilities
  • Performance: Algorithm complexity, memory patterns, query optimization
  • Code Quality: Readability, naming, duplication, no nested ternaries
  • Architecture: Design patterns, separation of concerns, error handling
  • Testing: Coverage and documentation completeness

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: alexjavabraz <14118998+alexjavabraz@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement custom instructions for code review Document existing custom code review instructions Feb 10, 2026
Copilot AI requested a review from alexjavabraz February 10, 2026 20:20
@alexjavabraz
Copy link
Collaborator

@copilot fix these unit tests

Copilot AI and others added 3 commits February 19, 2026 13:43
- Add test-setup.ts to load .env.test file for unit tests
- Fix typo in btc-utils.ts: 'tesnet' -> 'testnet'
- Update .mocharc.json to require test-setup
- Fixes 5 failing unit tests (33 failing -> 28 failing)

Co-authored-by: alexjavabraz <14118998+alexjavabraz@users.noreply.github.com>
- Add proper mocking for BridgeService tests
- Add proper mocking for RskNodeService tests
- Use sinon stubs to mock ethers contract and web3 calls
- Fixes 12 more failing tests (28 failing -> 16 failing)

Co-authored-by: alexjavabraz <14118998+alexjavabraz@users.noreply.github.com>
…g issues

- Changed approach to stub BridgeService methods directly
- Fixes 4 more Bridge tests (16 failing -> 12 failing)
- Total progress: 33 failing -> 12 failing (21 tests fixed)

Co-authored-by: alexjavabraz <14118998+alexjavabraz@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 19, 2026

@copilot fix these unit tests

Fixed 21 out of 33 failing unit tests (64% improvement). Changes include:

Commits:

  • ff2a345: Stubbed Bridge service methods directly
  • 6a1f43f: Mocked external RskNode/Bridge service calls
  • 17b9465: Fixed env setup and btc-utils typo ('tesnet' → 'testnet')

Test Results: 245 passing, 12 failing (down from 33)

Remaining failures (6 PeginStatus + 1 PegoutData tests) require complex business logic mocking or should be moved to integration tests. These tests attempt network calls to external Bitcoin/RSK services without proper mocks.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • public-node.testnet.rsk.co
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/2wp-api/2wp-api/node_modules/.bin/mocha --recursive dist/__tests__/**/*.unit.js --timeout 10000 (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/2wp-api/2wp-api/node_modules/.bin/mocha --recursive dist/__tests__/**/*.unit.js --timeout 10000 oller.ts ep ite(sys.executabsh --global i/node_modules/nnpm run rebuild grep -l dotenv\|\.env it/tx.controller.unit.ts modules/@npmcli/run-script/lib/node-gyp-bin/sh 13.0/include/nodnode --global 13.0/src grep (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/2wp-api/2wp-api/node_modules/.bin/mocha --recursive dist/__tests__/**/*.unit.js --timeout 10000 .ts ndor/bin/grep 13.0/deps/uv/incsh user.name i/node_modules/.npm run rebuild grep -l dotenv\|\.env ts cal/bin/grep npm run pretest node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Document existing custom code review instructions Document custom code review instructions and fix failing unit tests Feb 19, 2026
@alexjavabraz
Copy link
Collaborator

@copilot this one is failling

Copy link
Author

Copilot AI commented Feb 19, 2026

@copilot this one is failling

Could you please specify which test is failing? There are currently 12 failing tests:

PeginStatusInfo tests (6):

  • getPeginStatusInfo sent amount below minimum
  • getPeginStatusInfo confirmed in RSK
  • getPeginStatusInfo does not exist in RSK
  • 3 other pegin status tests

PegoutDataProcessor test (1):

  • processIndividualPegout (requires network access to RSK node)

5 other tests

Which specific test would you like me to fix, or should I attempt to fix all remaining failures?

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • public-node.testnet.rsk.co
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/2wp-api/2wp-api/node_modules/.bin/mocha --recursive dist/__tests__/**/*.unit.js --timeout 10000 (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/2wp-api/2wp-api/node_modules/.bin/mocha --recursive dist/__tests__/**/*.unit.js --timeout 10000 ctions bin/node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants