Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Implement Core Domain Logic #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mprestonsparks
Copy link
Owner

This PR implements the core domain logic for Archway, following hexagonal architecture principles.

Changes

Core Domain Models (src/core/models.py)

  • Implemented data classes for code analysis
  • Added enums for analysis types and model types
  • Created comprehensive type definitions

Business Logic (src/core/analysis.py)

  • Implemented CodeAnalysisService
  • Added caching mechanism
  • Support for batch operations

Interfaces (src/ports/code_analysis.py)

  • Defined core interfaces for external integrations
  • Created abstract base classes for adapters

Testing

  • Added comprehensive unit tests
  • Set up pytest configuration
  • Added test fixtures and mocks

Testing

All tests pass with 100% coverage of core functionality.

pytest tests/ --cov=src

Closes #1

Implemented:
- Core domain models for code analysis
- Code analysis interfaces (ports)
- Core business logic for code analysis
- Comprehensive unit tests

Closes #1
@mprestonsparks
Copy link
Owner Author

Implementation Details

Tasks Completed

✅ LLM Integration Tests

Implemented in tests/integration/test_llm_integration.py:

  • Tests for code analysis
  • Tests for refactoring suggestions
  • Tests for streaming generation
  • Tests for architecture explanation

✅ Sourcegraph Integration Tests

Implemented in tests/integration/test_sourcegraph_integration.py:

  • Tests for repository indexing
  • Tests for code search
  • Tests for code navigation (definitions, references)
  • Tests for hover information

✅ Test Infrastructure

Implemented core test infrastructure:

  • Shared fixtures in tests/integration/conftest.py
  • Environment variable loading
  • Async test support
  • Test markers for categorization

Technical Implementation

  • Used pytest's async support
  • Added proper cleanup in fixtures
  • Implemented comprehensive assertions
  • Added test categorization with markers

Features

  1. LLM Tests:

    • Real API calls to OpenAI
    • Deterministic responses with temperature=0
    • Content validation
    • Error handling
  2. Sourcegraph Tests:

    • Repository indexing
    • Code search and navigation
    • Reference lookup
    • Hover information
  3. Test Infrastructure:

    • Environment variable management
    • Async test support
    • Shared fixtures
    • Test categorization

Testing Strategy

  • Skip tests if credentials are missing
  • Clean up resources after tests
  • Validate response types and content
  • Use real APIs for true integration testing

All code has been committed in PR #TBD under the branch feature/integration-tests

mprestonsparks added a commit that referenced this pull request Dec 12, 2024
Implemented:
- Integration tests for LLM adapters
- Integration tests for Sourcegraph adapter
- Shared test fixtures and configuration
- Test markers for unit and integration tests

Closes #5
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.

[FEATURE] Implement Core Domain Logic
1 participant