Remove skipped tests and unreachable RPC methods (bd-212, bd-213)

bd-212: Delete 3 permanently skipped test functions (~150 LOC)
- TestImportDependencyUpdates (import_collision_test.go)
- TestImportChainDependencies (import_collision_test.go)
- TestUpdateDependencyReferences (collision_test.go)

bd-213: Remove 4 unreachable RPC methods (~80 LOC)
- Server.GetLastImportTime
- Server.SetLastImportTime
- Server.findJSONLPath
- Client.Import

All tests pass. Phase 1 dead code cleanup continues.
This commit is contained in:
Steve Yegge
2025-10-27 20:52:51 -07:00
parent d795dbe3d7
commit d47378cfbc
5 changed files with 2 additions and 421 deletions

View File

@@ -219,149 +219,6 @@ func TestImportMultipleCollisions(t *testing.T) {
}
}
// TestImportDependencyUpdates tests that dependencies are updated during remapping
// SKIPPED: This test expects the OLD buggy behavior where existing issue dependencies pointing
// to a collided ID get retargeted to the remapped ID. Per GH issue #120, this is incorrect.
// Existing dependencies should remain unchanged. Only dependencies from imported issues should
// be remapped. This test needs to be rewritten to test the correct import semantics.
func TestImportDependencyUpdates(t *testing.T) {
t.Skip("Test expects old buggy behavior - needs rewrite for GH#120 fix")
tmpDir, err := os.MkdirTemp("", "bd-collision-test-*")
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
defer func() {
if err := os.RemoveAll(tmpDir); err != nil {
t.Logf("Warning: cleanup failed: %v", err)
}
}()
dbPath := filepath.Join(tmpDir, "test.db")
testStore := newTestStoreWithPrefix(t, dbPath, "bd")
ctx := context.Background()
// Create existing issues with dependencies
issue1 := &types.Issue{
ID: "bd-10",
Title: "Issue 1",
Status: types.StatusOpen,
Priority: 1,
IssueType: types.TypeTask,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}
issue2 := &types.Issue{
ID: "bd-11",
Title: "Issue 2",
Status: types.StatusOpen,
Priority: 1,
IssueType: types.TypeTask,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}
issue3 := &types.Issue{
ID: "bd-12",
Title: "Issue 3",
Status: types.StatusOpen,
Priority: 1,
IssueType: types.TypeTask,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}
if err := testStore.CreateIssue(ctx, issue1, "test"); err != nil {
t.Fatalf("Failed to create issue 1: %v", err)
}
if err := testStore.CreateIssue(ctx, issue2, "test"); err != nil {
t.Fatalf("Failed to create issue 2: %v", err)
}
if err := testStore.CreateIssue(ctx, issue3, "test"); err != nil {
t.Fatalf("Failed to create issue 3: %v", err)
}
// Add dependencies: bd-1 → bd-2, bd-3 → bd-2
dep1 := &types.Dependency{
IssueID: "bd-10",
DependsOnID: "bd-11",
Type: types.DepBlocks,
}
dep2 := &types.Dependency{
IssueID: "bd-12",
DependsOnID: "bd-11",
Type: types.DepBlocks,
}
if err := testStore.AddDependency(ctx, dep1, "test"); err != nil {
t.Fatalf("Failed to add dep1: %v", err)
}
if err := testStore.AddDependency(ctx, dep2, "test"); err != nil {
t.Fatalf("Failed to add dep2: %v", err)
}
// Import colliding bd-2
incomingIssues := []*types.Issue{
{
ID: "bd-11",
Title: "Modified Issue 2",
Description: "Changed",
Status: types.StatusOpen,
Priority: 2,
IssueType: types.TypeBug,
},
}
result, err := sqlite.DetectCollisions(ctx, testStore, incomingIssues)
if err != nil {
t.Fatalf("DetectCollisions failed: %v", err)
}
if len(result.Collisions) != 1 {
t.Fatalf("Expected 1 collision, got %d", len(result.Collisions))
}
// Resolve collision
allExisting, _ := testStore.SearchIssues(ctx, "", types.IssueFilter{})
if err := sqlite.ScoreCollisions(ctx, testStore, result.Collisions, allExisting); err != nil {
t.Fatalf("ScoreCollisions failed: %v", err)
}
idMapping, err := sqlite.RemapCollisions(ctx, testStore, result.Collisions, allExisting)
if err != nil {
t.Fatalf("RemapCollisions failed: %v", err)
}
newID := idMapping["bd-11"]
if newID == "" {
t.Fatal("bd-2 not remapped")
}
// Verify dependencies were updated
// bd-1 should now depend on newID
deps1, err := testStore.GetDependencyRecords(ctx, "bd-10")
if err != nil {
t.Fatalf("Failed to get deps for bd-1: %v", err)
}
if len(deps1) != 1 {
t.Fatalf("Expected 1 dependency for bd-1, got %d", len(deps1))
}
if deps1[0].DependsOnID != newID {
t.Errorf("bd-1 dependency not updated: %s, want %s", deps1[0].DependsOnID, newID)
}
// bd-3 should now depend on newID
deps3, err := testStore.GetDependencyRecords(ctx, "bd-12")
if err != nil {
t.Fatalf("Failed to get deps for bd-3: %v", err)
}
if len(deps3) != 1 {
t.Fatalf("Expected 1 dependency for bd-3, got %d", len(deps3))
}
if deps3[0].DependsOnID != newID {
t.Errorf("bd-3 dependency not updated: %s, want %s", deps3[0].DependsOnID, newID)
}
}
// TestImportTextReferenceUpdates tests that text references are updated during remapping
func TestImportTextReferenceUpdates(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "bd-collision-test-*")
@@ -498,103 +355,6 @@ func TestImportTextReferenceUpdates(t *testing.T) {
}
}
// TestImportChainDependencies tests remapping with chained dependencies
// SKIPPED: This test expects the OLD buggy behavior where existing issue dependencies pointing
// to a collided ID get retargeted to the remapped ID. Per GH issue #120, this is incorrect.
func TestImportChainDependencies(t *testing.T) {
t.Skip("Test expects old buggy behavior - needs rewrite for GH#120 fix")
tmpDir, err := os.MkdirTemp("", "bd-collision-test-*")
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
defer func() {
if err := os.RemoveAll(tmpDir); err != nil {
t.Logf("Warning: cleanup failed: %v", err)
}
}()
dbPath := filepath.Join(tmpDir, "test.db")
testStore := newTestStoreWithPrefix(t, dbPath, "bd")
ctx := context.Background()
// Create chain: bd-100 → bd-101 → bd-102 → bd-103
for i := 100; i <= 103; i++ {
issue := &types.Issue{
ID: fmt.Sprintf("bd-%d", i),
Title: fmt.Sprintf("Issue %d", i),
Status: types.StatusOpen,
Priority: 1,
IssueType: types.TypeTask,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}
if err := testStore.CreateIssue(ctx, issue, "test"); err != nil {
t.Fatalf("Failed to create issue %d: %v", i, err)
}
}
// Add chain dependencies
for i := 100; i <= 102; i++ {
dep := &types.Dependency{
IssueID: fmt.Sprintf("bd-%d", i),
DependsOnID: fmt.Sprintf("bd-%d", i+1),
Type: types.DepBlocks,
}
if err := testStore.AddDependency(ctx, dep, "test"); err != nil {
t.Fatalf("Failed to add dependency %d: %v", i, err)
}
}
// Import colliding bd-101
incomingIssues := []*types.Issue{
{
ID: "bd-101",
Title: "Modified Issue 101",
Status: types.StatusInProgress,
Priority: 2,
IssueType: types.TypeBug,
},
}
result, err := sqlite.DetectCollisions(ctx, testStore, incomingIssues)
if err != nil {
t.Fatalf("DetectCollisions failed: %v", err)
}
// Resolve collision
allExisting, _ := testStore.SearchIssues(ctx, "", types.IssueFilter{})
if err := sqlite.ScoreCollisions(ctx, testStore, result.Collisions, allExisting); err != nil {
t.Fatalf("ScoreCollisions failed: %v", err)
}
idMapping, err := sqlite.RemapCollisions(ctx, testStore, result.Collisions, allExisting)
if err != nil {
t.Fatalf("RemapCollisions failed: %v", err)
}
newID := idMapping["bd-101"]
// Verify chain is maintained
// bd-100 → newID (was bd-101)
deps1, _ := testStore.GetDependencyRecords(ctx, "bd-100")
if len(deps1) != 1 || deps1[0].DependsOnID != newID {
t.Errorf("bd-100 dependency broken: %v", deps1)
}
// newID → bd-102
depsNew, _ := testStore.GetDependencyRecords(ctx, newID)
if len(depsNew) != 1 || depsNew[0].DependsOnID != "bd-102" {
t.Errorf("newID dependency broken: %v", depsNew)
}
// bd-102 → bd-103 (unchanged)
deps3, _ := testStore.GetDependencyRecords(ctx, "bd-102")
if len(deps3) != 1 || deps3[0].DependsOnID != "bd-103" {
t.Errorf("bd-102 dependency broken: %v", deps3)
}
}
// TestImportPartialIDMatch tests word boundary matching (bd-10 vs bd-100)
func TestImportPartialIDMatch(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "bd-collision-test-*")