mirror of
https://github.com/lukaszraczylo/claude-mnemonic.git
synced 2026-06-24 04:01:08 +00:00
style: apply gofmt
This commit is contained in:
@@ -331,8 +331,8 @@ func holdMutex(m *bgeModel) (ready <-chan struct{}, release func()) {
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
m.mu.Lock()
|
||||
close(ch) // signal: lock acquired
|
||||
<-done // wait for release signal
|
||||
close(ch) // signal: lock acquired
|
||||
<-done // wait for release signal
|
||||
m.mu.Unlock()
|
||||
}()
|
||||
return ch, func() { close(done) }
|
||||
|
||||
@@ -363,24 +363,24 @@ func TestRunNow_RetentionDays_DeletesExpiredObservations(t *testing.T) {
|
||||
|
||||
// Insert an observation and back-date it to 2 days ago.
|
||||
obs := &gormdb.Observation{
|
||||
SDKSessionID: "old-session",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: "2000-01-01T00:00:00Z",
|
||||
CreatedAtEpoch: time.Now().AddDate(0, 0, -2).Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
SDKSessionID: "old-session",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: "2000-01-01T00:00:00Z",
|
||||
CreatedAtEpoch: time.Now().AddDate(0, 0, -2).Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
ImportanceScore: 1.0,
|
||||
}
|
||||
require.NoError(t, store.GetDB().WithContext(ctx).Create(obs).Error)
|
||||
|
||||
// Insert a recent observation (should survive).
|
||||
recentObs := &gormdb.Observation{
|
||||
SDKSessionID: "new-session",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: time.Now().Format(time.RFC3339),
|
||||
CreatedAtEpoch: time.Now().Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
SDKSessionID: "new-session",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: time.Now().Format(time.RFC3339),
|
||||
CreatedAtEpoch: time.Now().Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
ImportanceScore: 1.0,
|
||||
}
|
||||
require.NoError(t, store.GetDB().WithContext(ctx).Create(recentObs).Error)
|
||||
@@ -434,12 +434,12 @@ func TestRunNow_RetentionDays_VectorCleanupCalled(t *testing.T) {
|
||||
|
||||
// Insert an expired observation directly.
|
||||
obs := &gormdb.Observation{
|
||||
SDKSessionID: "session-x",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: "2000-01-01T00:00:00Z",
|
||||
CreatedAtEpoch: time.Now().AddDate(0, 0, -2).Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
SDKSessionID: "session-x",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: "2000-01-01T00:00:00Z",
|
||||
CreatedAtEpoch: time.Now().AddDate(0, 0, -2).Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
ImportanceScore: 1.0,
|
||||
}
|
||||
require.NoError(t, store.GetDB().WithContext(ctx).Create(obs).Error)
|
||||
@@ -670,12 +670,12 @@ func TestRunNow_RetentionDays_BatchDeletion_MoreThan100Rows(t *testing.T) {
|
||||
// Insert 150 expired observations (forces 2 batches of 100).
|
||||
for i := 0; i < 150; i++ {
|
||||
obs := &gormdb.Observation{
|
||||
SDKSessionID: "session-old",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: "2000-01-01T00:00:00Z",
|
||||
CreatedAtEpoch: time.Now().AddDate(0, 0, -2).Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
SDKSessionID: "session-old",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: "2000-01-01T00:00:00Z",
|
||||
CreatedAtEpoch: time.Now().AddDate(0, 0, -2).Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
ImportanceScore: 1.0,
|
||||
}
|
||||
require.NoError(t, store.GetDB().WithContext(ctx).Create(obs).Error)
|
||||
@@ -706,14 +706,14 @@ func TestRunNow_CleanupStale_BatchDeletion_MoreThan100Rows(t *testing.T) {
|
||||
// Insert 120 superseded observations.
|
||||
for i := 0; i < 120; i++ {
|
||||
obs := &gormdb.Observation{
|
||||
SDKSessionID: "session-stale",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: time.Now().Format(time.RFC3339),
|
||||
CreatedAtEpoch: time.Now().Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
SDKSessionID: "session-stale",
|
||||
Project: "proj",
|
||||
Type: models.ObsTypeDiscovery,
|
||||
CreatedAt: time.Now().Format(time.RFC3339),
|
||||
CreatedAtEpoch: time.Now().Unix(),
|
||||
Scope: models.ScopeProject,
|
||||
ImportanceScore: 1.0,
|
||||
IsSuperseded: 1,
|
||||
IsSuperseded: 1,
|
||||
}
|
||||
require.NoError(t, store.GetDB().WithContext(ctx).Create(obs).Error)
|
||||
}
|
||||
|
||||
@@ -182,9 +182,9 @@ func TestGetManualUpdateCommand(t *testing.T) {
|
||||
wantNotContains []string
|
||||
}{
|
||||
{
|
||||
name: "empty_version_returns_latest",
|
||||
version: "",
|
||||
wantContains: []string{"curl -sSL", InstallScriptURL, "| bash"},
|
||||
name: "empty_version_returns_latest",
|
||||
version: "",
|
||||
wantContains: []string{"curl -sSL", InstallScriptURL, "| bash"},
|
||||
wantNotContains: []string{"bash -s --"},
|
||||
},
|
||||
{
|
||||
@@ -312,9 +312,9 @@ func makeTarGzFile(t *testing.T, dir, content string) (path string, checksum str
|
||||
|
||||
body := []byte(content)
|
||||
hdr := &tar.Header{
|
||||
Name: "worker",
|
||||
Mode: 0755,
|
||||
Size: int64(len(body)),
|
||||
Name: "worker",
|
||||
Mode: 0755,
|
||||
Size: int64(len(body)),
|
||||
Typeflag: tar.TypeReg,
|
||||
}
|
||||
require.NoError(t, tw.WriteHeader(hdr))
|
||||
@@ -455,9 +455,9 @@ func makeTarGzArchive(t *testing.T, files map[string]string) []byte {
|
||||
for name, content := range files {
|
||||
body := []byte(content)
|
||||
hdr := &tar.Header{
|
||||
Name: name,
|
||||
Mode: 0755,
|
||||
Size: int64(len(body)),
|
||||
Name: name,
|
||||
Mode: 0755,
|
||||
Size: int64(len(body)),
|
||||
Typeflag: tar.TypeReg,
|
||||
}
|
||||
require.NoError(t, tw.WriteHeader(hdr))
|
||||
|
||||
@@ -258,7 +258,6 @@ func (s *Service) handleObservation(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// Find session
|
||||
sess, err := s.sessionStore.FindAnySDKSession(r.Context(), req.ClaudeSessionID)
|
||||
if err != nil {
|
||||
|
||||
@@ -23,8 +23,8 @@ func TestStripSystemXML(t *testing.T) {
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
name: "task-notification block",
|
||||
input: "Before\n<task-notification>\n<task-id>abc123</task-id>\n<status>completed</status>\n<summary>Agent completed</summary>\n<result>Some result text</result>\n</task-notification>\nAfter",
|
||||
name: "task-notification block",
|
||||
input: "Before\n<task-notification>\n<task-id>abc123</task-id>\n<status>completed</status>\n<summary>Agent completed</summary>\n<result>Some result text</result>\n</task-notification>\nAfter",
|
||||
expected: "Before\n\nAfter",
|
||||
},
|
||||
{
|
||||
@@ -78,8 +78,8 @@ func TestStripSystemXML(t *testing.T) {
|
||||
expected: "Before\n\nAfter",
|
||||
},
|
||||
{
|
||||
name: "real-world task notification",
|
||||
input: "Here is the analysis:\n<task-notification>\n<task-id>a077fd04aed547ce1</task-id>\n<tool-use-id>toolu_01Kw2GwsArQQR1F9aV3VfzhP</tool-use-id>\n<status>completed</status>\n<summary>Agent \"Analyze agency-agents repo structure\" completed</summary>\n<result>Now I have all the information I need. Let me compile a comprehensive report.\n\n## Agency-Agents Directory Exploration Report\n\n### 1. Agent File Count and Organization\n\n**Total Agent Files (excluding strategy docs):** 61 agents across 9 categories</result>\n</task-notification>\nThe repo has 61 agents.",
|
||||
name: "real-world task notification",
|
||||
input: "Here is the analysis:\n<task-notification>\n<task-id>a077fd04aed547ce1</task-id>\n<tool-use-id>toolu_01Kw2GwsArQQR1F9aV3VfzhP</tool-use-id>\n<status>completed</status>\n<summary>Agent \"Analyze agency-agents repo structure\" completed</summary>\n<result>Now I have all the information I need. Let me compile a comprehensive report.\n\n## Agency-Agents Directory Exploration Report\n\n### 1. Agent File Count and Organization\n\n**Total Agent Files (excluding strategy docs):** 61 agents across 9 categories</result>\n</task-notification>\nThe repo has 61 agents.",
|
||||
expected: "Here is the analysis:\n\nThe repo has 61 agents.",
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user