fix cognitive local model discovery
CI / test (push) Failing after 36s

This commit is contained in:
m
2026-08-30 23:54:18 +03:00
parent f803cb67f0
commit dfbee7568f
5 changed files with 160 additions and 1 deletions
+26
View File
@@ -2,6 +2,7 @@ package main
import (
"context"
"errors"
"testing"
"time"
@@ -38,6 +39,18 @@ type learningSelfStub struct {
ledgers int
}
type failingLearningSelfStub struct{}
func (failingLearningSelfStub) SaveLearningSignal(context.Context, selfcontract.LearningSignal) error {
return errors.New("self repository unavailable")
}
func (failingLearningSelfStub) SaveImprovementNeed(context.Context, selfcontract.ImprovementNeed) error {
return errors.New("self repository unavailable")
}
func (failingLearningSelfStub) SaveLearningLedger(context.Context, selfcontract.LearningLedgerEntry) error {
return errors.New("self repository unavailable")
}
func (s *learningSelfStub) SaveLearningSignal(context.Context, selfcontract.LearningSignal) error {
s.signals++
return nil
@@ -104,3 +117,16 @@ func TestCorrectionWritesBoundedSelfEvidenceWithoutChangingResponsePath(t *testi
t.Fatalf("completed learning path was changed")
}
}
func TestSelfRepositoryFailureDoesNotDiscardUserFacingLearningPath(t *testing.T) {
epistemicsStore := &learningEpistemicsStub{}
recorder := learningRecorder{epistemics: epistemicsStore, self: failingLearningSelfStub{}}
recorder.recordCorrection(context.Background(), correctionLearningInput{
Intent: interaction.OriginalHumanIntent{ID: "intent-failure"},
Utterance: interaction.HumanUtterance{ID: "utterance-failure", PrincipalID: "principal-failure"},
At: time.UnixMilli(3000),
})
if len(epistemicsStore.experiences) != 1 {
t.Fatalf("SELF repository failure must not discard the completed epistemics response path")
}
}