perf(list): optimize bd list --json to fetch only needed dependencies (#1316)

Add GetDependencyRecordsForIssues method to storage interface that
fetches dependencies only for specified issue IDs instead of all
dependencies in the database.

This optimizes bd list --json which previously called
GetAllDependencyRecords() even when displaying only a few issues
(e.g., bd list --limit 10).

- Add GetDependencyRecordsForIssues to Storage interface
- Implement in SQLite, Dolt, and Memory backends
- Update list.go JSON output to use targeted method
- Update mock storage in tests

Origin: Mayor's review of PR #1296

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
aleiby
2026-01-25 17:59:53 -08:00
committed by GitHub
parent f8a4fcd036
commit 9e85b9f5d7
6 changed files with 116 additions and 1 deletions

View File

@@ -1194,7 +1194,7 @@ var listCmd = &cobra.Command{
}
labelsMap, _ := store.GetLabelsForIssues(ctx, issueIDs)
depCounts, _ := store.GetDependencyCounts(ctx, issueIDs)
allDeps, _ := store.GetAllDependencyRecords(ctx)
allDeps, _ := store.GetDependencyRecordsForIssues(ctx, issueIDs)
// Populate labels and dependencies for JSON output
for _, issue := range issues {