Skip to content

Commit 68dc5f5

Browse files
cliffhallclaude
andcommitted
docs(skills): gate the recovery steps on a complete dump (#2452 review)
A deleted dump still let the redirect create an empty lost-ids.json, so the re-apply loop ran zero times and exited 0. lost-ids.json is now written only inside the completeness check, and step 3 refuses to run without it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 4964bb6 commit 68dc5f5

1 file changed

Lines changed: 24 additions & 15 deletions

File tree

‎.claude/skills/board-ops/SKILL.md‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -323,28 +323,37 @@ and pass the Priority field id `PVTSSF_lADOCt2Azc4BJVxtzg5iJE4`.
323323
# 0. Same temp dir the snapshot went to — keep every dump out of the worktree.
324324
BOARD_TMP=${BOARD_TMP:-$(mktemp -d)}
325325

326-
# 1. Which cards lost their value, and what did they hold?
326+
# 1. Which cards lost their value, and what did they hold? lost-ids.json is
327+
# written ONLY from a complete dump — step 3 refuses to run without it, so an
328+
# incomplete dump cannot become a re-apply loop that silently does nothing.
329+
rm -f "$BOARD_TMP/lost-ids.json"
327330
gh project item-list 28 --owner modelcontextprotocol --format json --limit 2000 \
328331
> "$BOARD_TMP/board-broken.json"
329-
jq -e '(.items | length) == .totalCount' "$BOARD_TMP/board-broken.json" >/dev/null \
330-
|| { echo "board-broken.json INCOMPLETE — raise --limit and re-run" >&2
331-
rm -f "$BOARD_TMP/board-broken.json"; false; } # so the steps below fail, not undercount
332-
jq -r '[.items[]|select(.status==null)|.id]' "$BOARD_TMP/board-broken.json" \
333-
> "$BOARD_TMP/lost-ids.json"
334-
jq -r --slurpfile L "$BOARD_TMP/lost-ids.json" '($L[0]) as $lost
335-
| [.items[] | select(.id as $i | $lost|index($i)) | .status // "(none)"]
336-
| group_by(.) | map({s:.[0],c:length}) | .[] | "was \(.s): \(.c)"' \
337-
"$BOARD_TMP/board-snapshot.json"
332+
if jq -e '(.items | length) == .totalCount' "$BOARD_TMP/board-broken.json" >/dev/null; then
333+
jq -r '[.items[]|select(.status==null)|.id]' "$BOARD_TMP/board-broken.json" \
334+
> "$BOARD_TMP/lost-ids.json" || rm -f "$BOARD_TMP/lost-ids.json"
335+
jq -r --slurpfile L "$BOARD_TMP/lost-ids.json" '($L[0]) as $lost
336+
| [.items[] | select(.id as $i | $lost|index($i)) | .status // "(none)"]
337+
| group_by(.) | map({s:.[0],c:length}) | .[] | "was \(.s): \(.c)"' \
338+
"$BOARD_TMP/board-snapshot.json"
339+
else
340+
echo "board-broken.json INCOMPLETE — raise --limit and re-run step 1" >&2
341+
rm -f "$BOARD_TMP/board-broken.json"
342+
fi
338343

339344
# 2. Recreate the option, echoing every surviving option's id (see above).
340345
# NOTE: the recreated option gets a NEW id — the deleted one never comes back.
341346

342347
# 3. Re-apply it to the orphaned cards.
343-
for id in $(jq -r '.[]' "$BOARD_TMP/lost-ids.json"); do
344-
gh project item-edit --project-id PVT_kwDOCt2Azc4BJVxt --id "$id" \
345-
--field-id PVTSSF_lADOCt2Azc4BJVxtzg5iI8c --single-select-option-id <NEW_OPTION_ID>
346-
sleep 0.4
347-
done
348+
if [ -s "$BOARD_TMP/lost-ids.json" ]; then
349+
for id in $(jq -r '.[]' "$BOARD_TMP/lost-ids.json"); do
350+
gh project item-edit --project-id PVT_kwDOCt2Azc4BJVxt --id "$id" \
351+
--field-id PVTSSF_lADOCt2Azc4BJVxtzg5iI8c --single-select-option-id <NEW_OPTION_ID>
352+
sleep 0.4
353+
done
354+
else
355+
echo "no lost-ids.json — step 1 did not complete; nothing re-applied" >&2
356+
fi
348357
```
349358

350359
Step 1's grouping is the safety check: confirm the orphaned set is exactly the

0 commit comments

Comments
 (0)