fix(forgejo): read per-entry commit status from status field #404

Merged
mph merged 1 commit from fix/forgejo-commit-status-field into main 2026-07-11 07:05:03 +00:00
Owner

Problem

./iw phase-merge crashes with Failed to parse Forgejo commit status response: key not found: state on every Forgejo PR that has CI checks.

Root cause

ForgejoClient.parseCommitStatusResponse (core/adapters/ForgejoClient.scala) read each per-entry status via s("state"), but Forgejo's per-entry objects (CommitStatus) name that field status — only the top-level combined object (CombinedStatus) uses state. Every real per-entry object therefore crashes with key not found: state.

Fix

  • Read the per-entry field as s("status").
  • Handle "statuses": null (Forgejo returns this for an unknown SHA) as Right(Nil), alongside the existing empty-array case.
  • Updated the doc comment to describe the real field and null behavior.

Tests

The prior unit-test fixtures passed only because they encoded the same wrong shape (state per entry) and were never checked against a real Forgejo response. Corrected all fixtures to the real Forgejo shape (per-entry status) — which reproduced the exact production error — and added a null-statuses test. Full core.test suite green; -Werror compile clean.

🤖 Generated with Claude Code

## Problem `./iw phase-merge` crashes with `Failed to parse Forgejo commit status response: key not found: state` on **every** Forgejo PR that has CI checks. ## Root cause `ForgejoClient.parseCommitStatusResponse` (`core/adapters/ForgejoClient.scala`) read each per-entry status via `s("state")`, but Forgejo's per-entry objects (`CommitStatus`) name that field **`status`** — only the top-level combined object (`CombinedStatus`) uses `state`. Every real per-entry object therefore crashes with `key not found: state`. ## Fix - Read the per-entry field as `s("status")`. - Handle `"statuses": null` (Forgejo returns this for an unknown SHA) as `Right(Nil)`, alongside the existing empty-array case. - Updated the doc comment to describe the real field and null behavior. ## Tests The prior unit-test fixtures passed only because they encoded the same wrong shape (`state` per entry) and were never checked against a real Forgejo response. Corrected all fixtures to the real Forgejo shape (per-entry `status`) — which reproduced the exact production error — and added a null-statuses test. Full `core.test` suite green; `-Werror` compile clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(forgejo): read per-entry commit status from status field
All checks were successful
CI / format (pull_request) Successful in 6s
CI / lint (pull_request) Successful in 5s
CI / contract (pull_request) Has been skipped
CI / compile (pull_request) Successful in 1m12s
CI / dashboard-build (pull_request) Successful in 56s
CI / test (pull_request) Successful in 9m8s
ef206acdef
`parseCommitStatusResponse` read each per-entry status via `s("state")`,
but Forgejo's per-entry objects (CommitStatus) name that field `status` —
only the top-level combined object (CombinedStatus) uses `state`. Every
real per-entry object crashed with `key not found: state`, breaking
`phase-merge` on any Forgejo PR with CI checks.

Also handle `"statuses": null` (returned for an unknown SHA) as
Right(Nil) alongside the existing empty-array case.

The prior unit-test fixtures passed only because they encoded the same
wrong shape (`state` per entry); corrected them to the real Forgejo
response and added a null-statuses test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mph merged commit fca2691c37 into main 2026-07-11 07:05:03 +00:00
Sign in to join this conversation.
No description provided.