rehearsal: the reporter's dependency POST 404s against live Forgejo — the blocked-invariant silently fails, hot-loop risk (#373 follow-up) #381

Closed
opened 2026-08-10 00:48:25 +00:00 by ben · 1 comment
Owner

Found by live probe while wiring #380's dependency by hand (2026-08-09). The reporter landed by #373 wires each red's issue as a blocker of the drive issue with:

# .sandcastle/rehearsal-report.sh:143-145
api -X POST -H 'Content-Type: application/json' \
  "$FORGEJO_API/issues/$REHEARSAL_DRIVE_ISSUE/dependencies" \
  -d "{\"index\": $num}" >/dev/null 2>&1 || true

Against the live Forgejo that body shape is a 404:

$ curl -X POST .../issues/380/dependencies -d '{"index": 379}'
404 {"message":"IsErrRepoNotExist","errors":["repository does not exist [id: 0, uid: 0, owner_name: , name: ]"]}

The working shape names the target issue's repo in the IssueMeta body (proven — it wired #380 blocked-by #379):

$ curl -X POST .../issues/380/dependencies -d '{"index": 379, "owner": "Matou", "repo": "ourcloud"}'
→ 2xx, dependency created (GET .../issues/380/dependencies now lists #379)

Why this is a hot-loop bug, not a cosmetic one

#378's lifecycle (Ben's ruling): after a red, every filed/matched issue must be wired as a native dependency of the drive issue — "this issue must never sit ready and undepended after a red." With the 404 swallowed by || true, issues get filed but NO blocker lands, so #378 stays ready-for-agent and unblocked → the next executor pick re-drives immediately → hot loop, burning droplets against the same red. The ready-for-human swap doesn't save it: that path only fires when nothing could be filed, and filing succeeds.

Why the test didn't catch it

.sandcastle/tests/rehearsal-report-test.sh shims curl, so any body shape passes. Test 5 asserts the POST happens, not its shape.

What to do

  1. Add owner/repo to the dependency POST body (derive from FORGEJO_API or hardcode alongside it in .env).
  2. Stop swallowing the failure blind: on a non-2xx, fall through to the reporter's existing ready-for-human swap (the invariant's designed escape hatch) instead of || true.
  3. Teach the curl shim's fixture to assert the dependency body carries owner+repo, so the shape is pinned.

Evidence: #380 now shows #379 as a live-wired dependency created with the working shape.

Found by live probe while wiring #380's dependency by hand (2026-08-09). The reporter landed by #373 wires each red's issue as a blocker of the drive issue with: # .sandcastle/rehearsal-report.sh:143-145 api -X POST -H 'Content-Type: application/json' \ "$FORGEJO_API/issues/$REHEARSAL_DRIVE_ISSUE/dependencies" \ -d "{\"index\": $num}" >/dev/null 2>&1 || true Against the live Forgejo that body shape is a **404**: $ curl -X POST .../issues/380/dependencies -d '{"index": 379}' 404 {"message":"IsErrRepoNotExist","errors":["repository does not exist [id: 0, uid: 0, owner_name: , name: ]"]} The working shape names the target issue's repo in the IssueMeta body (proven — it wired #380 blocked-by #379): $ curl -X POST .../issues/380/dependencies -d '{"index": 379, "owner": "Matou", "repo": "ourcloud"}' → 2xx, dependency created (GET .../issues/380/dependencies now lists #379) ## Why this is a hot-loop bug, not a cosmetic one #378's lifecycle (Ben's ruling): after a red, every filed/matched issue must be wired as a native dependency of the drive issue — "this issue must never sit ready and undepended after a red." With the 404 swallowed by `|| true`, issues get filed but NO blocker lands, so #378 stays `ready-for-agent` and unblocked → the next executor pick re-drives immediately → hot loop, burning droplets against the same red. The `ready-for-human` swap doesn't save it: that path only fires when nothing could be filed, and filing succeeds. ## Why the test didn't catch it `.sandcastle/tests/rehearsal-report-test.sh` shims curl, so any body shape passes. Test 5 asserts the POST *happens*, not its shape. ## What to do 1. Add `owner`/`repo` to the dependency POST body (derive from `FORGEJO_API` or hardcode alongside it in `.env`). 2. Stop swallowing the failure blind: on a non-2xx, fall through to the reporter's existing `ready-for-human` swap (the invariant's designed escape hatch) instead of `|| true`. 3. Teach the curl shim's fixture to assert the dependency body carries owner+repo, so the shape is pinned. Evidence: #380 now shows #379 as a live-wired dependency created with the working shape.
Author
Owner

Fixed in 74889fa (on origin/main).

The bug: the #373 reporter wired each red as a native blocker of the drive issue with a bare {"index": n} body, which live Forgejo 404s (IsErrRepoNotExist). With the 404 swallowed by || true, no blocker landed → #378 stayed ready-for-agent and undepended → hot loop.

The fix (.sandcastle/rehearsal-report.sh):

  1. The dependency POST body now carries owner/repo, derived from FORGEJO_API's .../repos/<owner>/<repo> tail — the working IssueMeta shape.
  2. The POST's HTTP code is captured (api()'s -f would swallow it): 2xx=created, 409=already a blocker (tolerated, the blocker IS landed), anything else = the blocker did NOT land → fall to the reporter's ready-for-human swap (the invariant's escape hatch) instead of || true. Shared flip_drive_to_human() now backs both the nothing-filed and wiring-failed paths.
  3. .sandcastle/tests/rehearsal-report-test.sh: the curl shim emulates -w '%{http_code}' (with a DEP_CODE override) and asserts the dependency body names owner+repo. New cases pin the wire shape (7), the wiring-failure→ready-for-human invariant (8), and 409-tolerated-stays-blocked (9). 9 cases, all green (was 6).
Fixed in `74889fa` (on origin/main). **The bug:** the #373 reporter wired each red as a native blocker of the drive issue with a bare `{"index": n}` body, which live Forgejo 404s (`IsErrRepoNotExist`). With the 404 swallowed by `|| true`, no blocker landed → #378 stayed `ready-for-agent` and undepended → hot loop. **The fix (`.sandcastle/rehearsal-report.sh`):** 1. The dependency POST body now carries `owner`/`repo`, derived from `FORGEJO_API`'s `.../repos/<owner>/<repo>` tail — the working IssueMeta shape. 2. The POST's HTTP code is captured (`api()`'s `-f` would swallow it): `2xx`=created, `409`=already a blocker (tolerated, the blocker IS landed), anything else = the blocker did NOT land → fall to the reporter's `ready-for-human` swap (the invariant's escape hatch) instead of `|| true`. Shared `flip_drive_to_human()` now backs both the nothing-filed and wiring-failed paths. 3. `.sandcastle/tests/rehearsal-report-test.sh`: the curl shim emulates `-w '%{http_code}'` (with a `DEP_CODE` override) and asserts the dependency body names owner+repo. New cases pin the wire shape (7), the wiring-failure→ready-for-human invariant (8), and 409-tolerated-stays-blocked (9). **9 cases, all green (was 6).**
ben closed this issue 2026-08-10 00:59:42 +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.

Reference
Matou/idss#381
No description provided.