Skip to content

Latest commit

 

History

History
106 lines (85 loc) · 4.27 KB

File metadata and controls

106 lines (85 loc) · 4.27 KB

Subunit 5.2: Mock Analysis Implementation

Objective: Implement a mock analysis solution to enable end-to-end pipeline testing while real Strands integration is developed separately.

Implementation Decisions

1. Processing Performance

  • No artificial delay - Process immediately for fast testing
  • Immediate response - No simulation of analysis time
  • Efficient pipeline - Focus on throughput over realistic timing

2. Event Details for analysis_ready

  • S3 location - Path to analysis results in Drawer bucket
  • Repository name - For Deliverer identification and processing
  • Commit SHA - Not required in event payload (available in S3 path structure)

3. Error Handling Strategy

  • Corrupted workingcopy.zip - Record error in EventBridge for Hermes logging
  • Extraction failures - Use CloudWatch for full observability and debugging
  • Partial success principle - If something can be delivered, mark as success
  • Failure definition - Only fail when nothing can be delivered at all
  • Graceful degradation - Deliver whatever analysis results are possible

4. S3 Storage Structure

  • Direct storage - README.md stored at repos/{owner}/{repo}/{commit_sha}/analysis/README.md
  • Simple structure - No subdirectories for mock implementation
  • Clean paths - Consistent with existing Drawer bucket organization

5. Mock Analysis Content

  • Single file output - README.md only
  • Template content - "This is a mock analysis for repository {repo-owner}/{repo-name}"
  • Repository context - Include actual repository information in mock content

Technical Implementation Scope

Repository Processing

  • Download workingcopy.zip from S3 Drawer bucket
  • Extract ZIP contents to ephemeral storage
  • Simulate basic repository inspection (file count, size - optional metadata)
  • Generate mock README.md with repository-specific content

Analysis Results Generation

  • Create README.md with mock analysis content
  • Include repository owner and name in content
  • Store directly in analysis directory without subdirectories
  • Maintain simple, testable output format

Event Publishing

  • Publish analysis_ready event to EventBridge for Deliverer
  • Include S3 location and repository name in event payload
  • Follow Component Task Logging Standard for all processing states
  • Use EventBridge for error recording (Hermes integration)

Error Handling Implementation

IF workingcopy.zip corrupted OR extraction fails:
  - Record error in EventBridge (Hermes logging)
  - Log full details in CloudWatch
  - Attempt to generate basic README.md if possible
  - IF any content can be created: SUCCESS
  - IF no content possible: FAILURE with task_failed event

Success Criteria

  1. ✅ Download and extract workingcopy.zip from S3 successfully
  2. ✅ Generate mock README.md with repository-specific content
  3. ✅ Store analysis results in S3 analysis directory
  4. ✅ Publish analysis_ready event with S3 location and repository name
  5. ✅ Handle corrupted files gracefully with EventBridge error recording
  6. ✅ Use CloudWatch for comprehensive observability
  7. ✅ Follow partial success principle - deliver what's possible

Event Flow

1. Receive repo_ready event from EventBridge
2. Publish task_started event
3. Download workingcopy.zip from S3 Drawer
4. Extract ZIP contents (handle corruption gracefully)
5. Generate mock README.md with repository information
6. Upload README.md to S3 analysis directory
7. Publish analysis_ready event (S3 location + repository name)
8. Publish task_completed event

Error Scenarios

Scenario 1: Corrupted workingcopy.zip

  • Record error in EventBridge for Hermes
  • Log details in CloudWatch
  • Generate basic README.md if repository info available
  • SUCCESS if README.md created, FAILURE if not

Scenario 2: S3 upload failure

  • Retry upload operation
  • Log failure in CloudWatch
  • Publish task_failed event if no content delivered
  • FAILURE - nothing delivered to analysis directory

Scenario 3: Partial extraction success

  • Extract what's possible from workingcopy.zip
  • Generate README.md with available information
  • SUCCESS - partial content delivered

This mock implementation enables complete pipeline testing while maintaining realistic error handling and observability patterns for production readiness.