Remove plans/ directory (P0/P1/P2 work complete)

This commit is contained in:
2026-05-27 02:12:21 -05:00
parent 0c1840d223
commit 0dbb2e02ed
33 changed files with 1906 additions and 990 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
package predictive
// Package predictive: experimental / not yet active after P1-04 prune.
// Retained for potential P2 integration. Not used at runtime (pruned from steamcache).
// Package predictive: experimental access predictor and prefetch manager.
// Not active at runtime (pruned from the main request path in earlier hardening work).
import (
"context"
@@ -220,7 +220,7 @@ func (ap *AccessPredictor) RecordSequence(previousKey, currentKey string) {
// Update next keys list (keep top 5)
nextKeys := make([]string, 0, 5)
for key, _ := range seq.Frequency {
for key := range seq.Frequency {
nextKeys = append(nextKeys, key)
if len(nextKeys) >= 5 {
break
+41
View File
@@ -0,0 +1,41 @@
package predictive
import (
"testing"
)
func TestAccessPredictor_Basic(t *testing.T) {
t.Parallel()
p := NewAccessPredictor()
p.RecordSequence("a/b/c1", "a/b/c2")
next := p.PredictNext("a/b/c1")
if len(next) == 0 {
t.Log("no predictions (cold start ok)")
}
_ = p.IsPredictedAccess("a/b/c2")
}
func TestCacheWarmer_Basic(t *testing.T) {
t.Parallel()
cw := NewCacheWarmer()
cw.RecordAccess("k1", 100)
cw.RecordAccess("k1", 100)
pop := cw.GetPopularContent(5)
_ = len(pop)
_ = NewWarmingStats()
_ = NewActiveWarmer("k", 1, "test")
}
// TestPredictiveCacheManager_ConstructAndStop exercises New + RecordAccess under load + worker + Stop (no leak/panic; issue11).
func TestPredictiveCacheManager_ConstructAndStop(t *testing.T) {
t.Parallel()
pm := NewPredictiveCacheManager()
for i := 0; i < 20; i++ {
k := "k" + string(rune('0'+i%5))
pm.RecordAccess(k, "", 100) // use actual API (RecordAccess); exercises warmer+predictor paths
}
// Stop exercises wg + cancel for workers
pm.Stop()
// double stop safe
pm.Stop()
}