beads/cmd
Rongjun GENG 11ec3a67bc
fix(list): resolve short/partial parent IDs for --parent (#5440) (#5794)
`bd list --parent <shortid>` (the id without its project prefix, e.g.
"c7v" instead of "tm-c7v") errored "not found: issue c7v" instead of
resolving the same way `bd history <shortid>` already does (GH#4868).
getHierarchicalChildren called store.GetIssue(ctx, parentID) directly
on the raw CLI value with no partial-ID resolution step at all.

Fixed by calling the same utils.ResolvePartialID used by bd history,
right at the top of getHierarchicalChildren, mirroring history.go's
own error handling: a resolved ID replaces parentID; an ambiguous
match is a hard error; a genuine not-found falls through unchanged so
the existing "parent issue '%s' not found" message still fires with
the id the user actually typed.

Scoped to exactly the code path the issue's repro hits (local/embedded
mode's getHierarchicalChildren, used by plain `bd list --parent` and
`--tree --parent`). Did not extend to:
- gatherProxiedHierarchical (list_show_filter_modes.go/
  list_proxied_server.go), the proxied-server equivalent -- history.go
  itself documents that proxied mode has no local store to resolve
  against and intentionally passes the raw ID through for the server's
  own lookup to handle, so this isn't an oversight to fix, it's the
  existing convention.
- `--json --parent <shortid>`, which takes an entirely different code
  path (reader.List's own ListRequest filter, built by
  BuildListFilter/LoadStoreListConfig, never touching
  getHierarchicalChildren at all) and has the same underlying gap but
  fails differently -- silently returns [] instead of erroring.
  Confirmed via manual repro. A real, separate defect, but fixing it
  means resolving in a materially different layer (the filter
  builder, not a single CLI command's helper), which is a broader
  change than this issue asked for.
- The same shape of bug in `bd create --parent`, `bd ready --parent`,
  and `bd label --parent`, which independently call GetIssue on a raw
  --parent value the same way. Noticed while tracing this, not
  reported, not verified beyond a grep -- flagging rather than
  expanding scope on unconfirmed instances.

RED: added TestEmbeddedList/parent_filter_short_id, a real embedded-
Dolt CLI subprocess test (BEADS_TEST_EMBEDDED_DOLT=1) using the plain
(non-JSON) render to match the issue's own repro and the existing
tree_parent test's pattern. First draft used bdListJSON and passed
trivially even pre-fix -- caught by checking which exact code branch
the JSON path takes (jsonOutput's early return in list.go, well before
getHierarchicalChildren) and confirming zero-debug-output during
manual tracing; switched to bdList once that was understood. Confirmed
RED against unfixed code (children missing from output) before writing
the fix.
GREEN: children appear via both the full ID and the short ID after
the fix.

Verified: full TestEmbeddedList suite (51 subtests) green, no
regressions -- ran twice, once after the initial fix and once after
correcting the test to hit the right code path. go vet clean.


Claude-Session: https://claude.ai/code/session_018c3vLFNVgPebSpCJrd8xTD

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.local>
2026-09-30 07:23:35 -07:00
..
bd fix(list): resolve short/partial parent IDs for --parent (#5440) (#5794) 2026-09-30 07:23:35 -07:00