MCPcopy Create free account
hub / github.com/github/gh-aw / validateNoDuplicateCacheIDs

Function validateNoDuplicateCacheIDs

pkg/workflow/cache_validation.go:52–68  ·  view source on GitHub ↗

validateNoDuplicateCacheIDs checks for duplicate cache IDs and returns an error if found. Uses the generic validateNoDuplicateIDs helper for consistent duplicate detection.

(caches []CacheMemoryEntry)

Source from the content-addressed store, hash-verified

50// validateNoDuplicateCacheIDs checks for duplicate cache IDs and returns an error if found.
51// Uses the generic validateNoDuplicateIDs helper for consistent duplicate detection.
52func validateNoDuplicateCacheIDs(caches []CacheMemoryEntry) error {
53 cacheLog.Printf("Validating cache IDs: checking %d caches for duplicates", len(caches))
54 err := validateNoDuplicateIDs(caches, func(c CacheMemoryEntry) string { return c.ID }, func(id string) error {
55 cacheLog.Printf("Duplicate cache ID found: %s", id)
56 return NewValidationError(
57 "sandbox.cache-memory",
58 id,
59 "duplicate cache-memory ID found - each cache must have a unique ID",
60 "Change the cache ID to a unique value. Example:\n\nsandbox:\n cache-memory:\n - id: cache-1\n size: 100MB\n - id: cache-2 # Use unique IDs\n size: 50MB",
61 )
62 })
63 if err != nil {
64 return err
65 }
66 cacheLog.Print("Cache ID validation passed: no duplicates found")
67 return nil
68}

Callers 1

parseCacheMemoryEntriesFunction · 0.85

Calls 4

validateNoDuplicateIDsFunction · 0.85
PrintMethod · 0.80
NewValidationErrorFunction · 0.70
PrintfMethod · 0.45

Tested by

no test coverage detected