fix(dep): tolerate unresolved IDs in batch dep list#3620
Merged
harry-miller-trimble merged 1 commit intoMay 5, 2026
Merged
Conversation
When `bd dep list` is invoked with multiple IDs (batch mode), a single unresolvable ID currently aborts the entire call with exit 1. This makes the command unusable as a transport primitive for callers that want to fetch deps for a snapshot of IDs from another store, since their snapshot may transiently include IDs that the resolver cannot find. Concrete consumer: gascity's CachingStore reconcile loop calls `bd dep list <all-bead-ids> --json` every 30-60s. Ephemeral `*-wisp-*` patrol-molecule beads are visible to `bd list` but not resolvable by `bd show` / `bd dep list` (separate consistency bug to track), so the supervisor's batch fails wholesale on every cycle. See gastownhall/gascity#1560. Behavior change - Single-arg mode (len(args) == 1): UNCHANGED. Fatal exit on resolution failure, matching `bd show` semantics. - Batch mode (len(args) > 1): unresolvable IDs are skipped with a stderr warning ("warning: resolving X: ... (skipped)"); the command continues with the remaining resolvable IDs and still produces a valid JSON array on stdout. If NO IDs resolve, an empty `[]` is emitted under --json (exit 0) so callers parse cleanly. This keeps `bd` ZFC-compliant for its caller: the transport mechanically degrades on bad input instead of forcing the caller to pre-validate every ID.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
harry-miller-trimble
approved these changes
May 5, 2026
harry-miller-trimble
left a comment
Collaborator
There was a problem hiding this comment.
LGTM — graceful degradation in batch mode without breaking single-ID callers. Clean implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
bd dep listis invoked with multiple IDs (batch mode), a single unresolvable ID currently aborts the entire call with exit 1. This makesbd dep listunusable as a transport primitive for callers that fetch deps for a snapshot of IDs from another store, since their snapshot may transiently include IDs the resolver cannot find.Concrete consumer
gastownhall/gascity#1560 — gascity's
CachingStorereconcile loop callsbd dep list <all-bead-ids> --jsonevery 30–60 s. Ephemeral*-wisp-*patrol-molecule beads are visible tobd listbut not resolvable bybd show/bd dep list, so the supervisor's batch fails wholesale on every cycle, cascading into stale-cache session-lifecycle bugs.Behavior change
bd dep list X)bd showsemantics)bd dep list X Y Z)warning: resolving X: ... (skipped)); resolvable IDs continue--json[]if none resolveWhy batch tolerance
bd dep listin batch mode is a transport primitive — callers want "deps for the IDs I have right now". They cannot pre-validate every ID without a round-trip per ID, defeating the purpose of batch. ZFC: the transport mechanically degrades on bad input instead of forcing the caller to reason about which IDs might fail.Single-arg behavior is intentionally preserved as a backward-compat decision: existing scripts that rely on
bd dep list Xfailing loudly when X is missing keep working.Test plan
go build ./cmd/bd— builds cleango test ./cmd/bd -run Dep— passes (1.811 s)Adjacent issue (not addressed here)
Beads also has a separate consistency bug:
*-wisp-*molecule beads appear inbd listbut are unresolvable bybd show,bd dep list, ANDbd list --allexcludes them entirely. That root cause is worth fixing too (consistency of list/show/--all/dep), but this PR is the smaller, surgical change that unblocks the gascity reconcile loop today regardless of how the wisp inconsistency is resolved.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.