fix(cli): epic add-child sends structured target (was 404) (#329 G)
`anvil epic add-child` POSTed {"kind":"parent_of","target": child} to the
issue-links endpoint, but IssueLinkController reads target_number (+
optional target_org/target_repo) and never `target` — so coerce_number(nil)
failed and every add-child 404'd. (issue link already sends the structured
shape; epic add-child diverged.)
Extract add_child_payload/1 that normalizes the child ref (bare "5",
same-repo "#5", or cross-repo "org/repo#5") via issue::parse_target_ref and
emits target_number [+ target_org/target_repo], matching create_link. Make
parse_target_ref/TargetRef pub(crate) to share the one parser.
Unit tests cover all three ref forms, garbage rejection, and a regression
guard that the raw `target` key is never sent.
Part of epic #329 (Workstream G).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SHA:
2ba69e2e42e9d2cce629b73381189a65a9e69c5d
Author:
CI <ci@anvil.test>
Date:
2026-07-07 00:46
Parents:
1bd4dc5
2 files changed
+68
-6
| Type | ||
|---|---|---|
|
|
src/commands/epic.rs | +63 −1 |
|
||
|
|
src/commands/issue.rs | +5 −5 |
|
||