Skip to content

NEW @W-22393691@ - ApexGuru Engine: Define Insights data model for SFAP scan metadata#468

Open
nikhil-mittal-165 wants to merge 5 commits into
devfrom
feature/W-22393691-apexguru-insights-integration
Open

NEW @W-22393691@ - ApexGuru Engine: Define Insights data model for SFAP scan metadata#468
nikhil-mittal-165 wants to merge 5 commits into
devfrom
feature/W-22393691-apexguru-insights-integration

Conversation

@nikhil-mittal-165

Copy link
Copy Markdown
Contributor

Summary

Implements the Insights data model for ApexGuru SFAP scan-level metadata as specified in GUS ticket W-22393691.

Changes

  • code-analyzer-engine-api: Added optional insights field to EngineRunResults type, allowing engines to return scan-level metadata alongside violations.
  • code-analyzer-apexguru-engine:
    • Defined ApexGuruScanMetadata type matching SFAP API contract (analysis_mode, files_scanned, violation_breakdown, violation_count, report_generated_ms).
    • Extended ApexGuruQueryResponse to include scanMetadata field.
    • Updated ApexGuruService.parseReport() and analyzeApexClass() to extract and return scan metadata from SFAP API responses.
    • Updated ApexGuruEngine.runRules() to populate insights in EngineRunResults.
  • code-analyzer-core:
    • Added getInsights() to EngineRunResults interface and getEngineInsights(engineName) to RunResults interface.
    • Extended JSON output to include insights object with per-engine metadata.
    • Extended SARIF output to include insights in run.properties.

Acceptance Criteria

  • Define Insights data model (scan-level metadata, not violation-level)
  • Extend JSON/SARIF output schema for insights
  • getInsights() / getEngineInsights() API exposed from Core results interfaces
  • All 98 new/modified tests pass

Test plan

  • Run npx jest "packages/code-analyzer-engine-api/test/results|packages/code-analyzer-apexguru-engine/test|packages/code-analyzer-core/test/results|packages/code-analyzer-core/test/output-format" — all 98 tests should pass
  • Verify JSON output format: RunResults.toJsonResults() includes insights.apexguru with SFAP scanMetadata fields
  • Verify SARIF output format: runs[].properties.insights contains engine insights
  • Confirm EngineRunResults.insights is optional — existing engines unaffected

- Add insights?: Record<string,unknown> field to EngineRunResults type
- Add test verifying insights field is optional and accepts metadata
- Supports engines providing analysis metadata beyond violations
- Bump all affected package versions with -SNAPSHOT suffix
- Fix interdependency versions
… API contract

- Add ApexGuruScanMetadata type with analysis_mode, files_scanned, violation_breakdown, violation_count, report_generated_ms fields
- Add test validating type structure matches SFAP contract
- Supports both 'full' and 'static' analysis modes
…n scanMetadata

- Extend ApexGuruQueryResponse type to include scanMetadata field
- Update ApexGuruService.analyzeApexClass return type to {violations, scanMetadata}
- Update pollForResults to extract scanMetadata from API response
- Update ApexGuruEngine.runRules to collect and return scanMetadata as insights
- Update all test mocks to match new return type
- Add test verifying scanMetadata extraction from API response
…interfaces

- Add getInsights() method to EngineRunResults interface
- Implement getInsights() in EngineRunResultsImpl, AbstractErroneousEngineRunResults, and FilteredEngineRunResults
- Add getEngineInsights(engineName) method to RunResults interface
- Implement getEngineInsights() in RunResultsImpl
- Add comprehensive tests for both methods
- Enables formatters to access engine-provided insights metadata
- Add optional insights field to JsonResultsOutput type keyed by engine name
- Update toJsonResultsOutput to include insights when engines provide them
- Update toSarifRun to include insights in run.properties when present
- Add integration tests verifying insights flow through JSON and SARIF output
@git2gus

git2gus Bot commented Jun 11, 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.

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