refactor: extract synthesis types to pkg/types
CI / CI (pull_request) Failing after 2m17s

DRY fix: Shared types (SynthesisInput, ExtractedEntity, ExtractedFact,
ContradictionResult, PersistInput) moved to pkg/types/synthesis.go.

Both workflow and activity packages now import from pkg/types.
Re-exported as type aliases for backward compatibility.

Fixes: Duplicate type definitions between workflow and activity packages.
This commit is contained in:
poimen
2026-09-08 17:05:17 -07:00
parent 9020ccf839
commit 5ccc3711e6
2 changed files with 67 additions and 44 deletions
+8 -44
View File
@@ -6,52 +6,16 @@ import (
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
"github.com/rockliang/poimen/workflows/pkg/types"
)
// SynthesisInput contains the input for the synthesis workflow.
type SynthesisInput struct {
Project string `json:"project"`
Source string `json:"source"`
Text string `json:"text"`
Kind string `json:"kind"` // L1, L2, reference
Tags []string `json:"tags,omitempty"`
}
// SynthesisResult contains the output of the synthesis workflow.
type SynthesisResult struct {
ChunkID string `json:"chunk_id"`
EntitiesExtracted int `json:"entities_extracted"`
FactsExtracted int `json:"facts_extracted"`
Contradictions int `json:"contradictions"`
ReviewQueued int `json:"review_queued"`
Entities []ExtractedEntity `json:"entities"`
Facts []ExtractedFact `json:"facts"`
Duration time.Duration `json:"duration"`
}
// ExtractedEntity represents an entity found during synthesis.
type ExtractedEntity struct {
Name string `json:"name"`
EntityType string `json:"entity_type"`
Confidence float64 `json:"confidence"`
}
// ExtractedFact represents a fact extracted during synthesis.
type ExtractedFact struct {
Subject string `json:"subject"`
Predicate string `json:"predicate"`
Object string `json:"object"`
Confidence float64 `json:"confidence"`
}
// ContradictionResult represents a contradiction detection result.
type ContradictionResult struct {
FactA ExtractedFact `json:"fact_a"`
FactB ExtractedFact `json:"fact_b"`
Severity string `json:"severity"` // low, medium, high
AutoResolved bool `json:"auto_resolved"`
QueuedReview bool `json:"queued_review"`
}
// Re-export shared types from pkg/types for backward compatibility
type SynthesisInput = types.SynthesisInput
type SynthesisResult = types.SynthesisResult
type ExtractedEntity = types.ExtractedEntity
type ExtractedFact = types.ExtractedFact
type ContradictionResult = types.ContradictionResult
type PersistInput = types.PersistInput
var synthesisActivityOptions = workflow.ActivityOptions{
StartToCloseTimeout: 60 * time.Second,