@@ -125,10 +125,12 @@ STATUS_OPT=$(opt Status "Todo") # an issue you filed through the create fl
125125PRIORITY_OPT=$( opt Priority " Medium" )
126126
127127if [ -n " $ITEM_ID " ] && [ -n " $STATUS_OPT " ] && [ -n " $PRIORITY_OPT " ]; then
128+ # Chained: a failed Status edit stops before Priority, and the failure shows.
128129 gh project item-edit --project-id PVT_kwDOCt2Azc4BcZgq --id " $ITEM_ID " \
129- --field-id PVTSSF_lADOCt2Azc4BcZgqzhXCpm0 --single-select-option-id " $STATUS_OPT "
130- gh project item-edit --project-id PVT_kwDOCt2Azc4BcZgq --id " $ITEM_ID " \
131- --field-id PVTSSF_lADOCt2Azc4BcZgqzhjiM9M --single-select-option-id " $PRIORITY_OPT "
130+ --field-id PVTSSF_lADOCt2Azc4BcZgqzhXCpm0 --single-select-option-id " $STATUS_OPT " \
131+ && gh project item-edit --project-id PVT_kwDOCt2Azc4BcZgq --id " $ITEM_ID " \
132+ --field-id PVTSSF_lADOCt2Azc4BcZgqzhjiM9M --single-select-option-id " $PRIORITY_OPT " \
133+ || echo " item-edit FAILED — card $ITEM_ID may be half set; read it back" >&2
132134else
133135 echo " missing item or option id — nothing edited" >&2
134136fi
@@ -240,7 +242,10 @@ duplicate-of link).
240242
241243This section and its two subsections are copied verbatim from the MCP
242244Inspector's ` board-ops ` . Only the board number, the IDs, one cross-repo issue
243- reference and one link to a skill this repo does not have were changed. The
245+ reference and one link to a skill this repo does not have were changed, plus
246+ two fixes to the recovery recipe from this repo's review: step 1 restores only
247+ cards that held the deleted option, and step 3 stops on a failed edit. The
248+ closing paragraph also no longer quotes the Inspector's option ids. The
244249incidents they describe happened on the Inspector's board; the mechanism is
245250GitHub's and applies to #43 unchanged. The option-id tables they mention are
246251the Inspector's; here, option ids are resolved by name (see [ IDs] ( #ids ) ), so
@@ -317,25 +322,36 @@ and pass the Priority field id `PVTSSF_lADOCt2Azc4BcZgqzhjiM9M`.
317322# 0. Same temp dir the snapshot went to — keep every dump out of the worktree.
318323BOARD_TMP=${BOARD_TMP:- $(mktemp -d)}
319324
320- # 1. Which cards lost their value, and what did they hold? lost-ids.json is
321- # kept ONLY when the dump is complete AND the snapshot reports what those cards
322- # held — step 3 refuses to run without it, so neither a truncated dump nor a
323- # missing snapshot can turn into a silent no-op or an unconfirmed re-apply.
325+ # 1. Which cards lost their value? lost-ids.json holds ONLY the cards that are
326+ # blank now AND held the deleted option in the snapshot, and it is written
327+ # only when both dumps are complete. A card that was already blank, or that
328+ # someone cleared by hand, is listed and left alone. Step 3 refuses to run
329+ # without the file, so neither a truncated dump nor a missing snapshot can
330+ # turn into a silent no-op or an unconfirmed re-apply.
331+ DELETED=" <name of the deleted option>" # e.g. Done
324332rm -f " $BOARD_TMP /lost-ids.json"
325333gh project item-list 43 --owner modelcontextprotocol --format json --limit 2000 \
326334 > " $BOARD_TMP /board-broken.json"
327- if jq -e ' (.items | length) == .totalCount' " $BOARD_TMP /board-broken.json" > /dev/null; then
328- jq -r ' [.items[]|select(.status==null)|.id]' " $BOARD_TMP /board-broken.json" \
329- > " $BOARD_TMP /lost-ids.json" || rm -f " $BOARD_TMP /lost-ids.json"
330- jq -r --slurpfile L " $BOARD_TMP /lost-ids.json" ' ($L[0]) as $lost
331- | [.items[] | select(.id as $i | $lost|index($i)) | .status // "(none)"]
332- | group_by(.) | map({s:.[0],c:length}) | .[] | "was \(.s): \(.c)"' \
333- " $BOARD_TMP /board-snapshot.json" \
334- || { echo " no usable snapshot — cannot confirm what these cards held; not re-applying" >&2
335- rm -f " $BOARD_TMP /lost-ids.json" ; }
336- else
335+ if ! jq -e ' (.items | length) == .totalCount' " $BOARD_TMP /board-broken.json" > /dev/null; then
337336 echo " board-broken.json INCOMPLETE — raise --limit and re-run step 1" >&2
338337 rm -f " $BOARD_TMP /board-broken.json"
338+ elif ! jq -e ' (.items | length) == .totalCount' " $BOARD_TMP /board-snapshot.json" > /dev/null; then
339+ echo " no usable snapshot — cannot confirm what these cards held; not re-applying" >&2
340+ else
341+ jq -n --slurpfile B " $BOARD_TMP /board-broken.json" \
342+ --slurpfile S " $BOARD_TMP /board-snapshot.json" --arg d " $DELETED " '
343+ ($S[0].items | map({key: .id, value: .status}) | from_entries) as $was
344+ | [$B[0].items[] | select(.status == null) | .id] as $blank
345+ | {lost: [$blank[] | select($was[.] == $d)],
346+ other: [$blank[] | select($was[.] != $d) | {id: ., was: ($was[.] // "(none)")}]}' \
347+ > " $BOARD_TMP /blank.json" || rm -f " $BOARD_TMP /blank.json"
348+ if [ -s " $BOARD_TMP /blank.json" ]; then
349+ jq -r --arg d " $DELETED " ' "to restore to \($d): \(.lost | length)",
350+ "blank but NOT restored: \(.other | length)", (.other[] | " \(.id) was \(.was)")' \
351+ " $BOARD_TMP /blank.json"
352+ jq ' .lost' " $BOARD_TMP /blank.json" > " $BOARD_TMP /lost-ids.json" \
353+ || rm -f " $BOARD_TMP /lost-ids.json"
354+ fi
339355fi
340356
341357# 2. Recreate the option, echoing every surviving option's id (see above).
345361if [ -s " $BOARD_TMP /lost-ids.json" ]; then
346362 for id in $( jq -r ' .[]' " $BOARD_TMP /lost-ids.json" ) ; do
347363 gh project item-edit --project-id PVT_kwDOCt2Azc4BcZgq --id " $id " \
348- --field-id PVTSSF_lADOCt2Azc4BcZgqzhXCpm0 --single-select-option-id < NEW_OPTION_ID>
364+ --field-id PVTSSF_lADOCt2Azc4BcZgqzhXCpm0 --single-select-option-id < NEW_OPTION_ID> \
365+ || { echo " item-edit failed on $id — stopping; re-run step 1 to see what is left" >&2 ; break ; }
349366 sleep 0.4
350367 done
351368else
352369 echo " no lost-ids.json — step 1 did not complete; nothing re-applied" >&2
353370fi
354371```
355372
356- Step 1's grouping is the safety check: confirm the orphaned set is exactly the
357- cards that held the deleted option, so you don't overwrite a card someone
358- legitimately moved in the meantime.
373+ Step 1's join is the safety check: only a card that held the deleted option in
374+ the snapshot is re-applied, so you don't overwrite a card that was already blank
375+ or that someone legitimately cleared in the meantime. Read its "NOT restored"
376+ list before running step 3.
359377
360- Because the recreated option carries a ** new id** , the tables above and every
361- reference to it must be updated in the same change — ` grep ` the old id across
362- the repo. The ` Done ` id has been ` 248a3910 ` and is now ` 259d6aab ` for exactly
363- this reason .
378+ Because the recreated option carries a ** new id** , every reference to the old
379+ id must be updated in the same change — ` grep ` the old id across the repo. This
380+ skill resolves option ids by name and so holds none, but a script, issue or PR
381+ that pasted one does .
364382
365383## ⚠️ Two different "Priority" fields
366384
0 commit comments