chore: align slurp config and scaffolding

This commit is contained in:
anthonyrawlins
2025-09-27 21:03:12 +10:00
parent acc4361463
commit 4a77862289
47 changed files with 5133 additions and 4274 deletions

View File

@@ -631,7 +631,7 @@ func (s *SLURP) GetTemporalEvolution(ctx context.Context, ucxlAddress string) ([
return nil, fmt.Errorf("invalid UCXL address: %w", err)
}
return s.temporalGraph.GetEvolutionHistory(ctx, *parsed)
return s.temporalGraph.GetEvolutionHistory(ctx, parsed.String())
}
// NavigateDecisionHops navigates through the decision graph by hop distance.
@@ -654,7 +654,7 @@ func (s *SLURP) NavigateDecisionHops(ctx context.Context, ucxlAddress string, ho
}
if navigator, ok := s.temporalGraph.(DecisionNavigator); ok {
return navigator.NavigateDecisionHops(ctx, *parsed, hops, direction)
return navigator.NavigateDecisionHops(ctx, parsed.String(), hops, direction)
}
return nil, fmt.Errorf("decision navigation not supported by temporal graph")
@@ -1348,26 +1348,42 @@ func (s *SLURP) handleEvent(event *SLURPEvent) {
}
}
// validateSLURPConfig validates SLURP configuration for consistency and correctness
func validateSLURPConfig(config *SLURPConfig) error {
if config.ContextResolution.MaxHierarchyDepth < 1 {
return fmt.Errorf("max_hierarchy_depth must be at least 1")
// validateSLURPConfig normalises runtime tunables sourced from configuration.
func validateSLURPConfig(cfg *config.SlurpConfig) error {
if cfg == nil {
return fmt.Errorf("slurp config is nil")
}
if config.ContextResolution.MinConfidenceThreshold < 0 || config.ContextResolution.MinConfidenceThreshold > 1 {
return fmt.Errorf("min_confidence_threshold must be between 0 and 1")
if cfg.Timeout <= 0 {
cfg.Timeout = 15 * time.Second
}
if config.TemporalAnalysis.MaxDecisionHops < 1 {
return fmt.Errorf("max_decision_hops must be at least 1")
if cfg.RetryCount < 0 {
cfg.RetryCount = 0
}
if config.TemporalAnalysis.StalenessThreshold < 0 || config.TemporalAnalysis.StalenessThreshold > 1 {
return fmt.Errorf("staleness_threshold must be between 0 and 1")
if cfg.RetryDelay <= 0 && cfg.RetryCount > 0 {
cfg.RetryDelay = 2 * time.Second
}
if config.Performance.MaxConcurrentResolutions < 1 {
return fmt.Errorf("max_concurrent_resolutions must be at least 1")
if cfg.Performance.MaxConcurrentResolutions <= 0 {
cfg.Performance.MaxConcurrentResolutions = 1
}
if cfg.Performance.MetricsCollectionInterval <= 0 {
cfg.Performance.MetricsCollectionInterval = time.Minute
}
if cfg.TemporalAnalysis.MaxDecisionHops <= 0 {
cfg.TemporalAnalysis.MaxDecisionHops = 1
}
if cfg.TemporalAnalysis.StalenessCheckInterval <= 0 {
cfg.TemporalAnalysis.StalenessCheckInterval = 5 * time.Minute
}
if cfg.TemporalAnalysis.StalenessThreshold < 0 || cfg.TemporalAnalysis.StalenessThreshold > 1 {
cfg.TemporalAnalysis.StalenessThreshold = 0.2
}
return nil