gitgram/aitimemachine/beads/cmd/bd/reopen_defer_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

73 lines
1.9 KiB
Go

// reopen_defer_test.go - Test that reopen clears defer_until.
//go:build cgo && integration
package main
import (
"encoding/json"
"os"
"os/exec"
"testing"
)
// TestCLI_ReopenClearsDeferUntil tests that reopening a deferred+closed issue
// clears defer_until so the issue appears in bd ready immediately.
//
// This documents the decision: reopen means "I want to work on this NOW",
// so defer_until is cleared.
func TestCLI_ReopenClearsDeferUntil(t *testing.T) {
if testDoltServerPort == 0 {
t.Skip("skipping: Dolt test container not available")
}
tmpDir := initExecTestDB(t)
id := createExecTestIssue(t, tmpDir, "Deferred then reopened")
// Defer the issue to far future
cmd := exec.Command(testBD, "update", id, "--defer", "+8760h") // 1 year
cmd.Dir = tmpDir
cmd.Env = os.Environ()
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("defer failed: %v\n%s", err, out)
}
// Close it
cmd = exec.Command(testBD, "close", id)
cmd.Dir = tmpDir
cmd.Env = os.Environ()
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("close failed: %v\n%s", err, out)
}
// Reopen it
cmd = exec.Command(testBD, "reopen", id)
cmd.Dir = tmpDir
cmd.Env = os.Environ()
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("reopen failed: %v\n%s", err, out)
}
// Verify defer_until is cleared
cmd = exec.Command(testBD, "show", id, "--json")
cmd.Dir = tmpDir
cmd.Env = os.Environ()
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("show failed: %v\n%s", err, out)
}
var issues []map[string]interface{}
json.Unmarshal(out, &issues)
if len(issues) == 0 {
t.Fatalf("show returned no issues")
}
issue := issues[0]
if issue["status"] != "open" {
t.Errorf("expected status=open after reopen, got: %v", issue["status"])
}
if deferUntil, ok := issue["defer_until"]; ok && deferUntil != nil && deferUntil != "" {
t.Errorf("expected defer_until to be cleared after reopen, got: %v", deferUntil)
}
}