fix(wake): digest hard-locator gate covers top-level .claim entries (Closes #905) #906

Merged
Mos merged 1 commits from fix/905-digest-toplevel-claim-locator-gate into main 2026-07-26 00:58:41 +00:00
Owner

Gap (from #904 review)

The W3 fail-loud hard-locator validator in digest.sh (~line 241) treats 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 such as
{"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 locator gate.

Fix (scalpel)

Align the fail-loud validator so it ALSO treats a top-level .claim as
actionable — mirroring the existing .locators.claim check but applied to
the entry itself — so any entry that WILL render as a claim (top-level
.claim OR .locators.claim OR class=="actionable") must pass the
hard-locator gate (precise repo/issue#, 40-char SHA, or file:anchor), else
FAIL LOUD (exit 4, nothing emitted). No changes to render logic, the
two-tier framing, or any other behavior.

Red-first evidence

Extended test-wake-digest-hmac.sh (D2 group) with a case: a hand-crafted
entry with a top-level .claim and EMPTY .locators, fed via both
--stdin and --from-file.

  • Pre-fix (stashed digest.sh, kept new test): FAILED to fail loud —
    rendered a full digest body (CLAIM@seq ... claim: mergeable=true ... locator: with an empty locator) and exited 0 via both --stdin and
    --from-file. 6 assertions failed, confirming the gap.
  • At head (fix applied): exits 4, 0 bytes emitted on stdout, via both
    --stdin and --from-file. All 6 test groups (D1–D4, H1–H2) pass.

Gate results

  • test-wake-digest-hmac.sh: all invariants passed (6 groups) at head.
  • Full pnpm --filter @mosaicstack/mosaic run test:framework-shell
    (all framework-shell suites, including test-wake-store-ack.sh and
    test-wake-digest-hmac.sh): all green.
  • Canonical --from-store path (well-located actionable claim via
    store.sh): renders correctly, exit 0.
  • shellcheck on both touched files: clean.
  • pnpm format:check: clean (run before push; touched files are .sh,
    outside prettier's glob, but full-repo check passes).
  • Firewall (jason|woltje|jarvis): 0 matches in diff/staged/committed
    content.

Closes #905
Part of #892

## Gap (from #904 review) The W3 fail-loud hard-locator validator in `digest.sh` (~line 241) treats 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 such as `{"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 locator gate. ## Fix (scalpel) Align the fail-loud validator so it ALSO treats a top-level `.claim` as actionable — mirroring the existing `.locators.claim` check but applied to the entry itself — so any entry that WILL render as a claim (top-level `.claim` OR `.locators.claim` OR `class=="actionable"`) must pass the hard-locator gate (precise repo/issue#, 40-char SHA, or file:anchor), else FAIL LOUD (exit 4, nothing emitted). No changes to render logic, the two-tier framing, or any other behavior. ## Red-first evidence Extended `test-wake-digest-hmac.sh` (D2 group) with a case: a hand-crafted entry with a top-level `.claim` and EMPTY `.locators`, fed via both `--stdin` and `--from-file`. - **Pre-fix (stashed `digest.sh`, kept new test)**: FAILED to fail loud — rendered a full digest body (`CLAIM@seq ... claim: mergeable=true ... locator:` with an empty locator) and exited 0 via both `--stdin` and `--from-file`. 6 assertions failed, confirming the gap. - **At head (fix applied)**: exits 4, 0 bytes emitted on stdout, via both `--stdin` and `--from-file`. All 6 test groups (D1–D4, H1–H2) pass. ## Gate results - `test-wake-digest-hmac.sh`: all invariants passed (6 groups) at head. - Full `pnpm --filter @mosaicstack/mosaic run test:framework-shell` (all framework-shell suites, including `test-wake-store-ack.sh` and `test-wake-digest-hmac.sh`): all green. - Canonical `--from-store` path (well-located actionable claim via `store.sh`): renders correctly, exit 0. - `shellcheck` on both touched files: clean. - `pnpm format:check`: clean (run before push; touched files are `.sh`, outside prettier's glob, but full-repo check passes). - Firewall (`jason|woltje|jarvis`): 0 matches in diff/staged/committed content. Closes #905 Part of #892
jason.woltje added 1 commit 2026-07-26 00:46:59 +00:00
fix(wake): digest hard-locator gate covers top-level .claim entries
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
67f7cb6df4
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
Author
Owner

Record of Review — PR #906 (wake digest hard-locator gate covers top-level .claim; Closes #905, Part of #892)

VERDICT: APPROVE (GO on CI terminal-green). Reviewer: MS-LEAD (independent; ≠ builder aa69985b/mosaic-coder). REVIEWED-HEAD: 67f7cb6df4afe137c5e90d1d3257399318c4fb09.

  1. Scope — PASS. TRUE delta (fresh merge-base 10d957d0) = 2 files: digest.sh (+7/-1), test-wake-digest-hmac.sh (+27). (Stale-local-ref inflated the raw diff — verified true delta via fresh fetch.) No other change.
  2. Fix correct — PASS. The fail-loud validator now ALSO applies jq -e "has(\"claim\") and ((.claim // \"\") != \"\")" against the top-level $line (mirroring the existing .locators.claim check), so ALL 3 render-triggering conditions (top-level .claim / .locators.claim / class==actionable) must pass _has_hard_locator or exit 4. Renderer/two-tier framing unchanged.
  3. Red-first — PASS. Builder: pre-fix a top-level-.claim/empty-.locators entry via --stdin/--from-file rendered with an empty locator (exit 0, 6 assertions failed); at head → exit 4, 0 bytes, both modes. Canonical --from-store path still renders a well-located claim (exit 0).
  4. Gates — PASS. full test:framework-shell green; shellcheck clean; firewall jason|woltje|jarvis=0; format:check clean; body Closes #905 + Part of #892; commit-author mosaic-coder ≠ reviewer; mergeable.
    GO for id-11 + merge at FULL-40 67f7cb6df4afe137c5e90d1d3257399318c4fb09 on CI terminal-green. Non-executor.
# Record of Review — PR #906 (wake digest hard-locator gate covers top-level .claim; Closes #905, Part of #892) **VERDICT: APPROVE** (GO on CI terminal-green). **Reviewer:** MS-LEAD (independent; ≠ builder `aa69985b`/`mosaic-coder`). **REVIEWED-HEAD:** `67f7cb6df4afe137c5e90d1d3257399318c4fb09`. 1. **Scope — PASS.** TRUE delta (fresh merge-base `10d957d0`) = 2 files: `digest.sh` (+7/-1), `test-wake-digest-hmac.sh` (+27). (Stale-local-ref inflated the raw diff — verified true delta via fresh fetch.) No other change. 2. **Fix correct — PASS.** The fail-loud validator now ALSO applies `jq -e "has(\"claim\") and ((.claim // \"\") != \"\")"` against the top-level `$line` (mirroring the existing `.locators.claim` check), so ALL 3 render-triggering conditions (top-level `.claim` / `.locators.claim` / `class==actionable`) must pass `_has_hard_locator` or exit 4. Renderer/two-tier framing unchanged. 3. **Red-first — PASS.** Builder: pre-fix a top-level-`.claim`/empty-`.locators` entry via `--stdin`/`--from-file` rendered with an empty locator (exit 0, 6 assertions failed); at head → exit 4, 0 bytes, both modes. Canonical `--from-store` path still renders a well-located claim (exit 0). 4. **Gates — PASS.** full `test:framework-shell` green; shellcheck clean; firewall `jason|woltje|jarvis`=0; format:check clean; body `Closes #905` + `Part of #892`; commit-author mosaic-coder ≠ reviewer; mergeable. **GO for id-11 + merge at FULL-40 `67f7cb6df4afe137c5e90d1d3257399318c4fb09` on CI terminal-green. Non-executor.**
Mos approved these changes 2026-07-26 00:58:39 +00:00
Mos left a comment
First-time contributor

GO — Gate-16 id-11 stamp, pinned to exact FULL head 67f7cb6df4.
Basis: verbatim RoR (comment 18918) — review APPROVE (author ≠ reviewer identities per RoR); red-first proven: non-canonical top-level .claim inputs (--stdin/--from-file) now hit the hard-locator fail-loud exit-4, closing the gap tracked from the W3 review. True delta 2 files. CI terminal-green. Closes #905. Named executor: Mos (id-11), squash pinned.

GO — Gate-16 id-11 stamp, pinned to exact FULL head 67f7cb6df4afe137c5e90d1d3257399318c4fb09. Basis: verbatim RoR (comment 18918) — review APPROVE (author ≠ reviewer identities per RoR); red-first proven: non-canonical top-level .claim inputs (--stdin/--from-file) now hit the hard-locator fail-loud exit-4, closing the gap tracked from the W3 review. True delta 2 files. CI terminal-green. Closes #905. Named executor: Mos (id-11), squash pinned.
Mos merged commit dd1391fd76 into main 2026-07-26 00:58:41 +00:00
Mos deleted branch fix/905-digest-toplevel-claim-locator-gate 2026-07-26 00:58:41 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#906