Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# CODEOWNERS for yaad (memory & knowledge-graph engine)
* @GrayCodeAI/maintainers

# Engine core
/engine/ @GrayCodeAI/core-team
/embeddings/ @GrayCodeAI/core-team
/graph/ @GrayCodeAI/core-team
/compact/ @GrayCodeAI/core-team
/dedup/ @GrayCodeAI/core-team
/conflict/ @GrayCodeAI/core-team
/browse/ @GrayCodeAI/core-team
/config/ @GrayCodeAI/core-team
/hooks/ @GrayCodeAI/core-team

# API surface
/api/ @GrayCodeAI/core-team

# CI / release / build tooling
/.github/ @GrayCodeAI/devops-team
/Makefile @GrayCodeAI/devops-team
/lefthook.yml @GrayCodeAI/devops-team
/scripts/ @GrayCodeAI/devops-team

# Documentation
*.md @GrayCodeAI/docs-team
/docs/ @GrayCodeAI/docs-team
9 changes: 9 additions & 0 deletions browse/browse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func sampleMemories() []MemoryItem {
}

func TestBuildFromMemories(t *testing.T) {
t.Parallel()
fs := NewMemoryFS()
fs.BuildFromMemories(sampleMemories())

Expand All @@ -30,6 +31,7 @@ func TestBuildFromMemories(t *testing.T) {
}

func TestList(t *testing.T) {
t.Parallel()
fs := NewMemoryFS()
fs.BuildFromMemories(sampleMemories())

Expand Down Expand Up @@ -58,6 +60,7 @@ func TestList(t *testing.T) {
}

func TestGet(t *testing.T) {
t.Parallel()
fs := NewMemoryFS()
fs.BuildFromMemories(sampleMemories())

Expand All @@ -83,6 +86,7 @@ func TestGet(t *testing.T) {
}

func TestTree(t *testing.T) {
t.Parallel()
fs := NewMemoryFS()
fs.BuildFromMemories(sampleMemories())

Expand All @@ -106,6 +110,7 @@ func TestTree(t *testing.T) {
}

func TestSearch(t *testing.T) {
t.Parallel()
fs := NewMemoryFS()
fs.BuildFromMemories(sampleMemories())

Expand All @@ -125,6 +130,7 @@ func TestSearch(t *testing.T) {
}

func TestAdd(t *testing.T) {
t.Parallel()
fs := NewMemoryFS()
fs.BuildFromMemories(sampleMemories())

Expand Down Expand Up @@ -167,6 +173,7 @@ func TestAdd(t *testing.T) {
}

func TestRemove(t *testing.T) {
t.Parallel()
fs := NewMemoryFS()
fs.BuildFromMemories(sampleMemories())

Expand Down Expand Up @@ -194,6 +201,7 @@ func TestRemove(t *testing.T) {
}

func TestBuildFromMemoriesWithTypes(t *testing.T) {
t.Parallel()
now := time.Now()
memories := []MemoryItem{
{ID: "item1", Content: "content1", Category: "cat", Type: "subtype", CreatedAt: now},
Expand All @@ -211,6 +219,7 @@ func TestBuildFromMemoriesWithTypes(t *testing.T) {
}

func TestEmptyFS(t *testing.T) {
t.Parallel()
fs := NewMemoryFS()

root := fs.List("/")
Expand Down
10 changes: 10 additions & 0 deletions compact/compact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func setupStore(t *testing.T) storage.Storage {
}

func TestNeedsCompaction_EmptyProject(t *testing.T) {
t.Parallel()
store := setupStore(t)
c := New(store, 100)
ctx := context.Background()
Expand All @@ -35,6 +36,7 @@ func TestNeedsCompaction_EmptyProject(t *testing.T) {
}

func TestNeedsCompaction_OverBudget(t *testing.T) {
t.Parallel()
store := setupStore(t)
ctx := context.Background()

Expand Down Expand Up @@ -68,6 +70,7 @@ func TestNeedsCompaction_OverBudget(t *testing.T) {
}

func TestCompact_NoNodesNoError(t *testing.T) {
t.Parallel()
store := setupStore(t)
c := New(store, 100)
ctx := context.Background()
Expand All @@ -82,6 +85,7 @@ func TestCompact_NoNodesNoError(t *testing.T) {
}

func TestCompact_SkipsHighConfidenceNodes(t *testing.T) {
t.Parallel()
store := setupStore(t)
ctx := context.Background()

Expand Down Expand Up @@ -111,6 +115,7 @@ func TestCompact_SkipsHighConfidenceNodes(t *testing.T) {
}

func TestCompact_CompactsLowConfidenceNodes(t *testing.T) {
t.Parallel()
store := setupStore(t)
ctx := context.Background()

Expand Down Expand Up @@ -151,6 +156,7 @@ func TestCompact_CompactsLowConfidenceNodes(t *testing.T) {
}

func TestCompact_SkipsAnchorTypes(t *testing.T) {
t.Parallel()
store := setupStore(t)
ctx := context.Background()

Expand Down Expand Up @@ -180,6 +186,7 @@ func TestCompact_SkipsAnchorTypes(t *testing.T) {
}

func TestCompact_CancelledContext(t *testing.T) {
t.Parallel()
store := setupStore(t)
c := New(store, 100)
ctx, cancel := context.WithCancel(context.Background())
Expand All @@ -192,6 +199,7 @@ func TestCompact_CancelledContext(t *testing.T) {
}

func TestDefaultSummarizer(t *testing.T) {
t.Parallel()
s := DefaultSummarizer{}
ctx := context.Background()

Expand All @@ -209,6 +217,7 @@ func TestDefaultSummarizer(t *testing.T) {
}

func TestNew_DefaultMaxTokens(t *testing.T) {
t.Parallel()
store := setupStore(t)
c := New(store, 0)
if c.maxTokens != 50000 {
Expand All @@ -217,6 +226,7 @@ func TestNew_DefaultMaxTokens(t *testing.T) {
}

func TestNew_NegativeMaxTokens(t *testing.T) {
t.Parallel()
store := setupStore(t)
c := New(store, -10)
if c.maxTokens != 50000 {
Expand Down
4 changes: 4 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestDefault(t *testing.T) {
t.Parallel()
cfg := Default()

if cfg.Server.Port != 3456 {
Expand All @@ -30,6 +31,7 @@ func TestDefault(t *testing.T) {
}

func TestLoad_NoConfigFile(t *testing.T) {
t.Parallel()
cfg, err := Load("/nonexistent/path")
if err != nil {
t.Fatalf("loading from nonexistent path should not error: %v", err)
Expand All @@ -40,6 +42,7 @@ func TestLoad_NoConfigFile(t *testing.T) {
}

func TestLoad_ProjectConfig(t *testing.T) {
t.Parallel()
dir := t.TempDir()
yaadDir := filepath.Join(dir, ".yaad")
os.MkdirAll(yaadDir, 0o755)
Expand Down Expand Up @@ -75,6 +78,7 @@ half_life_days = 60
}

func TestLoad_InvalidTOML(t *testing.T) {
t.Parallel()
dir := t.TempDir()
yaadDir := filepath.Join(dir, ".yaad")
os.MkdirAll(yaadDir, 0o755)
Expand Down
10 changes: 10 additions & 0 deletions config/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
)

func TestValidateConfig_DefaultIsValid(t *testing.T) {
t.Parallel()
cfg := Default()
errs := ValidateConfig(cfg)
if len(errs) != 0 {
Expand All @@ -14,6 +15,7 @@ func TestValidateConfig_DefaultIsValid(t *testing.T) {
}

func TestValidateConfig_TableDriven(t *testing.T) {
t.Parallel()
tests := []struct {
name string
mutate func(*Config)
Expand Down Expand Up @@ -196,7 +198,9 @@ func TestValidateConfig_TableDriven(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
cfg := Default()
tt.mutate(cfg)
errs := ValidateConfig(cfg)
Expand Down Expand Up @@ -229,6 +233,7 @@ func TestValidateConfig_TableDriven(t *testing.T) {
}

func TestConfigError_String(t *testing.T) {
t.Parallel()
e := ConfigError{
Field: "server.port",
Message: "port must be between 1 and 65535",
Expand All @@ -255,6 +260,7 @@ func TestConfigError_String(t *testing.T) {
}

func TestValidationErrorType_String(t *testing.T) {
t.Parallel()
cases := map[ValidationErrorType]string{
MissingRequired: "missing required",
InvalidValue: "invalid value",
Expand All @@ -271,6 +277,7 @@ func TestValidationErrorType_String(t *testing.T) {
}

func TestFormatErrors_Empty(t *testing.T) {
t.Parallel()
if s := FormatErrors(nil); s != "" {
t.Errorf("expected empty string for nil errors, got %q", s)
}
Expand All @@ -280,6 +287,7 @@ func TestFormatErrors_Empty(t *testing.T) {
}

func TestFormatErrors_Multiple(t *testing.T) {
t.Parallel()
errs := []ConfigError{
{Field: "server.port", Message: "out of range", ErrType: OutOfRange},
{Field: "server.host", Message: "required", ErrType: MissingRequired},
Expand All @@ -294,6 +302,7 @@ func TestFormatErrors_Multiple(t *testing.T) {
}

func TestValidateConfig_BoundaryValues(t *testing.T) {
t.Parallel()
cfg := Default()
// Valid boundary values should pass.
cfg.Server.Port = 1
Expand All @@ -314,6 +323,7 @@ func TestValidateConfig_BoundaryValues(t *testing.T) {
}

func TestValidateConfig_EmbeddingsEnabledWithProvider(t *testing.T) {
t.Parallel()
cfg := Default()
cfg.Embeddings.Enabled = true
cfg.Embeddings.Provider = "openai"
Expand Down
13 changes: 13 additions & 0 deletions conflict/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

func TestIsContradiction_ExplicitSignal(t *testing.T) {
t.Parallel()
newNode := &storage.Node{
Content: "Use jose library instead of jsonwebtoken for JWT validation",
Type: "convention",
Expand All @@ -24,6 +25,7 @@ func TestIsContradiction_ExplicitSignal(t *testing.T) {
}

func TestIsContradiction_NoOverlap(t *testing.T) {
t.Parallel()
newNode := &storage.Node{
Content: "Deploy using Docker containers",
Type: "decision",
Expand All @@ -40,6 +42,7 @@ func TestIsContradiction_NoOverlap(t *testing.T) {
}

func TestIsContradiction_SameDecisionUpdated(t *testing.T) {
t.Parallel()
newNode := &storage.Node{
Content: "Authentication uses RS256 algorithm with rotating keys for token signing",
Type: "decision",
Expand All @@ -56,6 +59,7 @@ func TestIsContradiction_SameDecisionUpdated(t *testing.T) {
}

func TestIsContradiction_LowOverlap(t *testing.T) {
t.Parallel()
newNode := &storage.Node{
Content: "The server runs on port 8080",
Type: "spec",
Expand All @@ -72,6 +76,7 @@ func TestIsContradiction_LowOverlap(t *testing.T) {
}

func TestExtractKeyTerms(t *testing.T) {
t.Parallel()
terms := extractKeyTerms("Use the jose library for JWT validation")
if !terms["jose"] {
t.Error("expected 'jose' in key terms")
Expand All @@ -88,6 +93,7 @@ func TestExtractKeyTerms(t *testing.T) {
}

func TestIsStopWord(t *testing.T) {
t.Parallel()
if !isStopWord("the") {
t.Error("'the' should be a stop word")
}
Expand All @@ -97,6 +103,7 @@ func TestIsStopWord(t *testing.T) {
}

func TestIsContradiction_ContradictoryAdjectives(t *testing.T) {
t.Parallel()
newNode := &storage.Node{
Content: "The authentication service is fast and stable",
Type: "decision",
Expand All @@ -113,6 +120,7 @@ func TestIsContradiction_ContradictoryAdjectives(t *testing.T) {
}

func TestIsContradiction_VerbPatterns(t *testing.T) {
t.Parallel()
newNode := &storage.Node{
Content: "Use React for the frontend components, prefer this framework",
Type: "decision",
Expand All @@ -129,6 +137,7 @@ func TestIsContradiction_VerbPatterns(t *testing.T) {
}

func TestDetectContradictionSignals(t *testing.T) {
t.Parallel()
signals := detectContradictionSignals(
"Use jose instead of jsonwebtoken",
"Use jsonwebtoken for JWT validation",
Expand All @@ -149,6 +158,7 @@ func TestDetectContradictionSignals(t *testing.T) {
}

func TestDetectContradictionSignals_Adjectives(t *testing.T) {
t.Parallel()
signals := detectContradictionSignals(
"The API response is fast and correct",
"The API response is slow and incorrect",
Expand All @@ -159,6 +169,7 @@ func TestDetectContradictionSignals_Adjectives(t *testing.T) {
}

func TestDetectContradictionSignals_NoSignals(t *testing.T) {
t.Parallel()
signals := detectContradictionSignals(
"Use Docker for deployment",
"Use PostgreSQL for the database",
Expand All @@ -169,6 +180,7 @@ func TestDetectContradictionSignals_NoSignals(t *testing.T) {
}

func TestHasNegationPattern(t *testing.T) {
t.Parallel()
if !hasNegationPattern("prefer TypeScript", "avoid TypeScript") {
t.Error("expected negation pattern: prefer vs avoid")
}
Expand All @@ -181,6 +193,7 @@ func TestHasNegationPattern(t *testing.T) {
}

func TestAnalyzeContradiction(t *testing.T) {
t.Parallel()
newNode := &storage.Node{
ID: "new-1",
Content: "Use jose library instead of jsonwebtoken for JWT validation",
Expand Down
1 change: 1 addition & 0 deletions conflict/validity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
// temporal validity window closed (invalid_at set), while the new "supersedes"
// edge remains valid.
func TestCheckAndResolve_InvalidatesSupersededEdges(t *testing.T) {
t.Parallel()
store := storage.NewMockStorage()
ctx := context.Background()
r := New(store)
Expand Down
Loading
Loading