Pulse/internal/ai/finding/finding.go
rcourtman b0aaca863d refactor(ai): extract shared Finding type to eliminate duplicate structs
Move the Finding type that was duplicated between patrol and investigation
packages into a new internal/ai/finding package. Both packages now use
type aliases for backwards compatibility.

Changes:
- Add internal/ai/finding/finding.go as the canonical Finding definition
- Update investigation.Finding to be a type alias for finding.Finding
- Update InvestigationFinding in patrol.go to be a type alias
- Add ToCoreFinding() method to ai.Finding for type conversion
- Simplify investigation_adapter.go (no more field-by-field copies)
- Add e2e integration test for patrol investigation flow
2026-02-01 23:26:20 +00:00

28 lines
1.4 KiB
Go

// Package finding defines the shared Finding type used across the ai and
// investigation packages. Keeping it in a leaf package avoids circular
// imports while giving both packages a single canonical struct.
package finding
import "time"
// Finding represents a patrol finding with investigation metadata.
// This is the canonical type shared between the patrol system (internal/ai)
// and the investigation orchestrator (internal/ai/investigation).
type Finding struct {
ID string `json:"id"`
Key string `json:"key,omitempty"`
Severity string `json:"severity"`
Category string `json:"category"`
ResourceID string `json:"resource_id"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Title string `json:"title"`
Description string `json:"description"`
Recommendation string `json:"recommendation,omitempty"`
Evidence string `json:"evidence,omitempty"`
InvestigationSessionID string `json:"investigation_session_id,omitempty"`
InvestigationStatus string `json:"investigation_status,omitempty"`
InvestigationOutcome string `json:"investigation_outcome,omitempty"`
LastInvestigatedAt *time.Time `json:"last_investigated_at,omitempty"`
InvestigationAttempts int `json:"investigation_attempts"`
}