Skip to content

[W-22393691] code-analyzer-core | implement curl for the apex guru call#470

Open
nikhil-mittal-165 wants to merge 6 commits into
feature/W-22393691-apexguru-insights-integrationfrom
feature/W-22393691-apexguru-curl-impl
Open

[W-22393691] code-analyzer-core | implement curl for the apex guru call#470
nikhil-mittal-165 wants to merge 6 commits into
feature/W-22393691-apexguru-insights-integrationfrom
feature/W-22393691-apexguru-curl-impl

Conversation

@nikhil-mittal-165

Copy link
Copy Markdown
Contributor

Summary

Implements curl-based HTTP client for ApexGuru API calls to replace Connection.request dependency.

Ticket Subject

code-analyzer-core | implement curl for the apex guru call

Base Branch

feature/W-22393691-apexguru-insights-integration

Commits

  • f67638f test: add curlRequest method tests to ApexGuruAuthService
  • 8cfedc5 test: update validate tests to use curlRequest instead of Connection.request
  • 64ed196 test: update submitAnalysis and pollForResults tests to use curlRequest
  • ffbdd8c refactor: remove unused Connection import from ApexGuruService
  • af722ac test: add integration tests for end-to-end curl flow

Design Rationale

This implementation provides a curl-based HTTP client for ApexGuru API interactions, enabling direct HTTP requests without reliance on the Connection class. The approach includes:

  • New curlRequest method in ApexGuruAuthService for curl-based HTTP calls
  • Updated test suites to validate curl-based flow
  • Integration tests for end-to-end curl workflow
  • Removal of unused Connection imports

Test Evidence

  • Test Suites: 15 passed, 15 total
  • Tests: 437 passed, 437 total
  • Coverage: 96.33% statements, 90.18% branches, 93.46% functions

Dependencies

Depends on: #468

Add comprehensive test coverage for new curlRequest method:
- GET request with correct headers and URL construction
- POST request with body serialization
- Error handling for non-200 HTTP responses
- Network error handling with descriptive messages

Tests verify Authorization Bearer pattern and Content-Type headers.
…request

Update ApexGuruService.test.ts validate tests:
- Mock authService.curlRequest instead of connection.request
- Verify curlRequest called with correct method and path
- Maintain test coverage for success, failure, and timeout scenarios
- Add curlRequest mock to authService setup

Make curlRequest public for testability.
Update all remaining ApexGuruService tests to use mockAuthService.curlRequest:
- analyzeApexClass tests for submit and poll operations
- Progress callback test
- Report parsing test
- Timeout handling test
- scanMetadata extraction test

All 20 tests now passing with curlRequest pattern.
Remove Connection import that's no longer used after replacing
connection.request calls with authService.curlRequest.

Connection is still used in ApexGuruAuthService for getConnection()
method, but not in ApexGuruService anymore.

All 62 apexguru-engine tests passing.
Add comprehensive integration tests verifying:
- curlRequest used for all ApexGuru API calls (validate, submit, poll)
- Correct HTTP methods (GET, POST) and URLs for each endpoint
- Base64 encoding of Apex class content in POST body
- Full flow from validate through analyzeApexClass with polling

All 64 apexguru-engine tests passing.
@git2gus

git2gus Bot commented Jun 12, 2026

Copy link
Copy Markdown

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

@nikhil-mittal-165 nikhil-mittal-165 marked this pull request as ready for review June 12, 2026 10:43
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.

1 participant