Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions skills/orch/scripts/reconcile-work-items
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ jq -e 'type == "array" and all(.[];
and (.identifier | type == "string")
and (.state | type == "object")
and (.state.name | type == "string")
and (.state.type | type == "string"))' "$CACHE" >/dev/null 2>&1 \
|| config_error "linear cache at $CACHE is not an array of issue rows with identifier and state.name/state.type"
and (.state.type | type == "string")
and (.state.type != "started" or ((.updatedAt | type == "string") and (.updatedAt | test("\\S")))))' "$CACHE" >/dev/null 2>&1 \
Comment thread
bmethod marked this conversation as resolved.
|| config_error "linear cache at $CACHE is not an array of issue rows with identifier, state.name/state.type, and a nonblank updatedAt on started rows"

findings=0
note() { findings=$((findings + 1)); printf '%s\n' "$1"; }
Expand Down
15 changes: 15 additions & 0 deletions skills/orch/tests/reconcile-work-items.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,21 @@ OUT=""; RC=0
OUT="$(cd "$R" && RECONCILE_GH_CLI="$TMP/gh-stub" "$RW" 2>&1)" || RC=$?
[ "$RC" -eq 2 ] && ok "a row missing state.type is a config error" || bad "missing state.type" "rc=$RC out=$OUT"

# A started row without a usable timestamp must be a config error: GNU date
# parses an empty field as midnight today, which would quietly read as fresh.
Comment thread
bmethod marked this conversation as resolved.
printf '[{"identifier":"T-1","title":"t","state":{"name":"In Progress","type":"started"},"parent":null,"description":"","updatedAt":""}]' >"$R/.cache/linear/issues.json"
OUT=""; RC=0
OUT="$(cd "$R" && RECONCILE_GH_CLI="$TMP/gh-stub" "$RW" 2>&1)" || RC=$?
[ "$RC" -eq 2 ] && ok "a started row with an empty updatedAt is a config error, never fresh" || bad "empty updatedAt" "rc=$RC out=$OUT"
printf '[{"identifier":"T-1","title":"t","state":{"name":"In Progress","type":"started"},"parent":null,"description":"","updatedAt":" "}]' >"$R/.cache/linear/issues.json"
OUT=""; RC=0
OUT="$(cd "$R" && RECONCILE_GH_CLI="$TMP/gh-stub" "$RW" 2>&1)" || RC=$?
[ "$RC" -eq 2 ] && ok "a whitespace-only updatedAt is a config error (GNU date parses it as midnight)" || bad "blank updatedAt" "rc=$RC out=$OUT"
printf '[{"identifier":"T-1","title":"t","state":{"name":"In Progress","type":"started"},"parent":null,"description":""}]' >"$R/.cache/linear/issues.json"
OUT=""; RC=0
OUT="$(cd "$R" && RECONCILE_GH_CLI="$TMP/gh-stub" "$RW" 2>&1)" || RC=$?
[ "$RC" -eq 2 ] && ok "a started row with no updatedAt key at all is a config error" || bad "missing updatedAt key" "rc=$RC out=$OUT"

# Missing cache: loud config error, never a clean pass.
rm "$R/.cache/linear/issues.json"
OUT=""; RC=0
Expand Down
Loading