Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
73 lines
1.5 KiB
Go
73 lines
1.5 KiB
Go
//go:build cgo
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/steveyegge/beads/internal/storage"
|
|
"github.com/steveyegge/beads/internal/types"
|
|
)
|
|
|
|
func TestIssueContentSize(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
issue *types.Issue
|
|
want int
|
|
}{
|
|
{
|
|
name: "empty issue",
|
|
issue: &types.Issue{},
|
|
want: 0,
|
|
},
|
|
{
|
|
name: "issue with content",
|
|
issue: &types.Issue{
|
|
Description: "hello",
|
|
Design: "world",
|
|
AcceptanceCriteria: "foo",
|
|
Notes: "bar",
|
|
},
|
|
want: 5 + 5 + 3 + 3,
|
|
},
|
|
{
|
|
name: "only description",
|
|
issue: &types.Issue{
|
|
Description: "some long description text",
|
|
},
|
|
want: 26,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := issueContentSize(tt.issue)
|
|
if got != tt.want {
|
|
t.Errorf("issueContentSize() = %d, want %d", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
// TestRestoreWithInvalidIssueID verifies that restore handles non-existent issues
|
|
// gracefully without panicking.
|
|
func TestRestoreWithInvalidIssueID(t *testing.T) {
|
|
tmpDir := t.TempDir()
|
|
dbPath := filepath.Join(tmpDir, ".beads", "beads.db")
|
|
testStore := newTestStore(t, dbPath)
|
|
defer testStore.Close()
|
|
|
|
ctx := context.Background()
|
|
issue, err := testStore.GetIssue(ctx, "nonexistent-issue-12345")
|
|
|
|
if !errors.Is(err, storage.ErrNotFound) {
|
|
t.Fatalf("GetIssue expected ErrNotFound, got: %v", err)
|
|
}
|
|
if issue != nil {
|
|
t.Fatalf("GetIssue returned issue for non-existent ID: %v", issue)
|
|
}
|
|
}
|