gitgram/aitimemachine/beads/cmd/bd/mol_embedded_test.go
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
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>
2026-06-23 14:14:09 +03:00

74 lines
2.0 KiB
Go

//go:build cgo
package main
import (
"os"
"testing"
"github.com/steveyegge/beads/internal/formula"
"github.com/steveyegge/beads/internal/storage/embeddeddolt"
"github.com/steveyegge/beads/internal/types"
)
// TestSpawnMolecule_PreservesStepLabels verifies that a cooked formula with
// per-step labels results in spawned issues whose labels are persisted to the
// database. Regression for labels being silently dropped by cloneSubgraph in
// the same shape as the metadata bug fixed by gastownhall/beads#3341.
func TestSpawnMolecule_PreservesStepLabels(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
ctx := t.Context()
s, err := embeddeddolt.Open(ctx, t.TempDir(), "beads", "main")
if err != nil {
t.Fatalf("embeddeddolt.Open failed: %v", err)
}
defer s.Close()
if err := s.SetConfig(ctx, "issue_prefix", "test"); err != nil {
t.Fatalf("SetConfig failed: %v", err)
}
f := &formula.Formula{
Formula: "label-test",
Version: 1,
Type: formula.TypeWorkflow,
Steps: []*formula.Step{
{
ID: "work",
Title: "Do the work",
Labels: []string{"worker", "phase:build"},
},
},
}
subgraph, err := cookFormulaToSubgraph(f, "label-test")
if err != nil {
t.Fatalf("cookFormulaToSubgraph failed: %v", err)
}
result, err := spawnMolecule(ctx, s, subgraph, nil, "", "test", false, types.IDPrefixMol)
if err != nil {
t.Fatalf("spawnMolecule failed: %v", err)
}
newWorkID, ok := result.IDMapping["label-test.work"]
if !ok {
t.Fatalf("result.IDMapping missing entry for label-test.work; got %v", result.IDMapping)
}
labels, err := s.GetLabels(ctx, newWorkID)
if err != nil {
t.Fatalf("GetLabels(%s) failed: %v", newWorkID, err)
}
got := make(map[string]bool, len(labels))
for _, l := range labels {
got[l] = true
}
for _, want := range []string{"worker", "phase:build"} {
if !got[want] {
t.Errorf("spawned issue %s missing label %q; got %v", newWorkID, want, labels)
}
}
}