beads/cmd
Vishnu J a66dc623b8
fix(create): hard-fail multi-type same-target --deps (#4626) (#4833)
* fix(create): hard-fail multi-type same-target --deps (#4626)

Expand comma-separated deps, reject collisions that uk_dep_issue_target
cannot store, and fail create when AddDependency errors instead of warning.

* fix(create): validate --deps before CreateIssue (#4626)

parseDepSpecs uniqueness checks ran after CreateIssue, so multi-type
same-target rejections left an orphan issue with a non-zero exit.
Validate first; reuse parsed specs for discovered-from source_repo inherit.

* fix(create): address review — dedupe identical --deps, fix double comma-split, reuse parsed specs, drop internal index name from error

Addresses maphew's CHANGES_REQUESTED review on #4626/#4833:

- checkDepSpecsUniqueTargets -> dedupeDepSpecs: a repeated IDENTICAL
  normalized edge (e.g. blocked-by:X and depends-on:X, both aliasing to
  the same type/target) is now deduped instead of hard-failing. Storage
  already treats a same-pair/same-type add as idempotent; only a
  genuine type conflict on the same target is still rejected.
- Removed expandDepFlagValues's manual comma re-split. Cobra's
  StringSlice flag already CSV-decodes --deps, so the extra split was
  double-decoding and would mangle a CSV-quoted target containing a
  literal comma. parseDepSpecs now trims/skips-empty per already-split
  element only.
- Added discoveredFromParentSpec(specs), reusing the already-parsed
  dependency specs for the discovered-from source_repo lookup instead
  of re-deriving type:target parsing from the raw --deps strings a
  second time. A prior commit on this branch (7a78668) had this wiring;
  the origin/main merge (b956262d) silently dropped it. Wired into both
  call sites the review named: cmd/bd/create.go (direct) and
  cmd/bd/create_proxied_server.go (proxied). create_form.go's own
  raw-string parsing is untouched (separate lenient path, no
  parseDepSpecs involved).
- Reworded the same-target-conflict error to drop the internal
  uk_dep_issue_target index name; message stays domain-oriented.
- Added real-bd-binary regression coverage in
  create_deps_atomic_test.go: multi-type same-target is rejected with
  no orphan issue, and an identical-duplicate edge is deduped rather
  than rejected. Updated create_deps_test.go's comma cases to reflect
  the production representation (cobra hands parseDepSpecs an
  already-split slice, not one comma-joined string).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 13:52:24 -07:00
..
bd fix(create): hard-fail multi-type same-target --deps (#4626) (#4833) 2026-07-28 13:52:24 -07:00