claim-lib hardening batch: comment accuracy, label paging, malformed-claim filter, rearm body assert #470

Closed
opened 2026-08-12 14:44:15 +00:00 by ben · 1 comment
Owner

From the 2026-08-12 final whole-branch review (minors M-1, M-2, M-3, M-5 batched). Protected path (.sandcastle) — human/controller change. All small; one commit + tests, then #250 sync to matou-app.

  1. M-1 (comment fix): claim-lib.sh header claims claim_label_id's "LAST pipeline stage is curl itself" — it's actually curl | jq | head -1; the real safety is the [ -n "$id" ] empty-check. Fix the comment so the next raw-capture audit doesn't skip a function on a false premise.
  2. M-2: claim_label_id fetches labels single-page (limit=50&page=1). Past 50 labels, janitor_sweep returns early — the janitor turns off SILENTLY. Add paging or at least a loud log line when the label resolves empty (ourcloud is at ~30 labels today).
  3. M-3: _claim_comments' jq capture("run=(?<r>[0-9]+)") errors mid-stream on a malformed hand-posted claim body (e.g. run=abc), dropping subsequent lines with rc swallowed by the trailing sort -n — a malformed claim could blind arbitration on that issue. Harden the select to test("^swarm-claim host=\\S+ run=[0-9]+").
  4. M-5: self-rearm-test.sh asserts the dispatch endpoint but not the POST body {ref:"main"} — one-line assertion.

Also fold in two doc lines the review recommended for the claim-lib.sh header: (a) this forge's issue-comments endpoint is unpaginated (probed live 2026-08-12: ?limit=1 returns all comments) and arbitration depends on seeing ALL claim comments; (b) the timing invariant arbitration's safety rests on — a run is API-visible for minutes before its first claim post, while snapshot staleness is seconds — which any D6 revisit (intra-host parallelism / fast-boot) must re-check.

From the 2026-08-12 final whole-branch review (minors M-1, M-2, M-3, M-5 batched). Protected path (.sandcastle) — human/controller change. All small; one commit + tests, then #250 sync to matou-app. 1. **M-1 (comment fix):** claim-lib.sh header claims `claim_label_id`'s "LAST pipeline stage is curl itself" — it's actually `curl | jq | head -1`; the real safety is the `[ -n "$id" ]` empty-check. Fix the comment so the next raw-capture audit doesn't skip a function on a false premise. 2. **M-2:** `claim_label_id` fetches labels single-page (limit=50&page=1). Past 50 labels, `janitor_sweep` returns early — the janitor turns off SILENTLY. Add paging or at least a loud log line when the label resolves empty (ourcloud is at ~30 labels today). 3. **M-3:** `_claim_comments`' jq `capture("run=(?<r>[0-9]+)")` errors mid-stream on a malformed hand-posted claim body (e.g. `run=abc`), dropping subsequent lines with rc swallowed by the trailing `sort -n` — a malformed claim could blind arbitration on that issue. Harden the select to `test("^swarm-claim host=\\S+ run=[0-9]+")`. 4. **M-5:** self-rearm-test.sh asserts the dispatch endpoint but not the POST body `{ref:"main"}` — one-line assertion. Also fold in two doc lines the review recommended for the claim-lib.sh header: (a) this forge's issue-comments endpoint is unpaginated (probed live 2026-08-12: `?limit=1` returns all comments) and arbitration depends on seeing ALL claim comments; (b) the timing invariant arbitration's safety rests on — a run is API-visible for minutes before its first claim post, while snapshot staleness is seconds — which any D6 revisit (intra-host parallelism / fast-boot) must re-check.
Author
Owner

This was generated by AI during triage.

Triage: added the missing category label. This is a batch of defect fixes in claim-lib.sh (stale comment, silent janitor failure past 50 labels, malformed-claim body breaking arbitration, missing assertion) — labelled bug. ready-for-human was already correctly applied (protected .sandcastle path); left as-is.

> *This was generated by AI during triage.* **Triage:** added the missing category label. This is a batch of defect fixes in `claim-lib.sh` (stale comment, silent janitor failure past 50 labels, malformed-claim body breaking arbitration, missing assertion) — labelled `bug`. `ready-for-human` was already correctly applied (protected `.sandcastle` path); left as-is.
ben closed this issue 2026-08-13 03:54:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#470
No description provided.