fix(wake): digest hard-locator gate covers top-level .claim entries
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful

The W3 fail-loud hard-locator validator (digest.sh) treated an entry as
actionable via class=="actionable" OR .locators.claim, but the RENDER
tier also honors a top-level .claim (it renders via
`jq -r '.claim // .locators.claim'`). A hand-crafted entry like
{"class":"reaction","claim":"mergeable=true","locators":{}} fed via
--stdin/--from-file rendered as a CLAIM@seq with an EMPTY locator,
escaping the exit-4 hard-locator fail-loud gate.

store.sh never emits a top-level .claim (non-canonical shape), but a
non-canonical caller could bypass the gate. Align the validator to also
treat a top-level .claim as actionable, matching the render tier's
precedence, so any entry that WILL render as a claim must pass the hard
-locator gate or FAIL LOUD (exit 4, nothing emitted).

Closes #905
Part of #892
This commit is contained in:
mosaic-coder
2026-07-25 19:44:56 -05:00
parent 10d957d095
commit 67f7cb6df4
2 changed files with 33 additions and 1 deletions

View File

@@ -229,7 +229,9 @@ cmd_render() {
# --- FAIL-LOUD PASS FIRST (§2.1): validate every actionable claim carries a
# hard locator BEFORE emitting a single byte. A malformed digest must never be
# partially sent. Actionable-tier = class "actionable" OR any entry whose
# locators carry a `claim` (a consequential fact). ------------------------
# locators carry a `claim` OR a top-level `claim` (a consequential fact) —
# matching the render tier's `.claim // .locators.claim` precedence, so no
# entry can render as a CLAIM@seq without passing this gate. -------------
local line class loc is_actionable
while IFS= read -r line; do
[ -n "$line" ] || continue
@@ -241,6 +243,9 @@ cmd_render() {
if jq -e 'has("claim") and ((.claim // "") != "")' >/dev/null 2>&1 <<<"$loc"; then
is_actionable=1
fi
if jq -e 'has("claim") and ((.claim // "") != "")' >/dev/null 2>&1 <<<"$line"; then
is_actionable=1
fi
if [ "$is_actionable" = "1" ] && ! _has_hard_locator "$loc"; then
local seq
seq="$(jq -r '.observed_seq // "?"' <<<"$line")"