Skip to content

Commit 66bcbb6

Browse files
authored
debug: add temporary logging for missing feature dependencies (#2134)
1 parent 358ff0b commit 66bcbb6

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

pkg/feature/domain/feature.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,11 @@ func ValidateVariationUsage(
13481348

13491349
// This logic is based on https://en.wikipedia.org/wiki/Topological_sorting.
13501350
// Note: This algorithm is not an exact topological sort because the order is reversed (=from upstream to downstream).
1351+
// TODO: DEBUG - Remove after investigation
1352+
var depDebugCount = 0
1353+
1354+
const maxDepDebugLogs = 5
1355+
13511356
func TopologicalSort(features []*feature.Feature) ([]*feature.Feature, error) {
13521357
marks := map[string]Mark{}
13531358
mapFeatures := map[string]*feature.Feature{}
@@ -1369,6 +1374,13 @@ func TopologicalSort(features []*feature.Feature) ([]*feature.Feature, error) {
13691374
for _, fid := range df.FeatureIDsDependsOn() {
13701375
pf, ok := mapFeatures[fid]
13711376
if !ok {
1377+
// TODO: DEBUG - Remove this debug block after investigation
1378+
if depDebugCount < maxDepDebugLogs {
1379+
depDebugCount++
1380+
fmt.Printf("[DEBUG-TOPO-%d/%d] feature not found: featureID=%s, missingDependencyID=%s\n",
1381+
depDebugCount, maxDepDebugLogs, f.Id, fid)
1382+
}
1383+
// TODO: DEBUG - End of debug block
13721384
return ErrFeatureNotFound
13731385
}
13741386
if err := sort(pf); err != nil {

0 commit comments

Comments
 (0)