Fix result upload: 422 on PowerShell 5.1 #6

Open
aporter wants to merge 1 commit from fix-pr-upload-422 into main
Owner

Every pending result failed to upload with (422) Unprocessable Entity (seen on PC-003, retrying PC-001/002/003 runs).

Cause. On Windows PowerShell 5.1, Get-Content -Raw returns a string tagged with PSPath etc., and ConvertTo-Json -Depth 4 sends the PR body as an object. Forgejo: json: cannot unmarshal object into Go struct field CreatePullRequestOption.body of type string. The branch push before it worked, so the result branches already exist in the inventory-bot fork.

Fix

  • Read title.txt / summary.md with [IO.File]::ReadAllText(..., UTF8) (they are written with WriteAllText UTF-8).
  • If Forgejo answers pull request already exists ... issue_id: N (409; PC-001_20261104-132244 already has #4), count it as uploaded and return that PR's URL, so it leaves pending\.
  • $InvVersion -> 2026.11.04.4.

Checks

  • PowerShell parser (pwsh 7): 0 errors. Not run on PS 5.1 end to end; the next PC run is the test.
  • 422 reproduced against the server with an object body; the 409 message checked against the server and the regex.
  • workbench validate: fails in workbench's own skill-link self-tests (tests/ensure-test.sh, 22 checks); it does not check this repo's files.

Review-gate: gpt-6.1-sol ship (Gate 1 skipped: small fix). Nits not taken: a fallback that reads the response stream when ErrorDetails is empty (fails safe today: it rethrows and the result stays in pending).

🤖 Generated with Claude Code

Every pending result failed to upload with `(422) Unprocessable Entity` (seen on PC-003, retrying PC-001/002/003 runs). **Cause.** On Windows PowerShell 5.1, `Get-Content -Raw` returns a string tagged with PSPath etc., and `ConvertTo-Json -Depth 4` sends the PR `body` as an object. Forgejo: `json: cannot unmarshal object into Go struct field CreatePullRequestOption.body of type string`. The branch push before it worked, so the result branches already exist in the `inventory-bot` fork. **Fix** - Read `title.txt` / `summary.md` with `[IO.File]::ReadAllText(..., UTF8)` (they are written with `WriteAllText` UTF-8). - If Forgejo answers `pull request already exists ... issue_id: N` (409; PC-001_20261104-132244 already has #4), count it as uploaded and return that PR's URL, so it leaves `pending\`. - `$InvVersion` -> `2026.11.04.4`. **Checks** - PowerShell parser (pwsh 7): 0 errors. Not run on PS 5.1 end to end; the next PC run is the test. - 422 reproduced against the server with an object `body`; the 409 message checked against the server and the regex. - `workbench validate`: fails in workbench's own skill-link self-tests (`tests/ensure-test.sh`, 22 checks); it does not check this repo's files. Review-gate: gpt-6.1-sol ship (Gate 1 skipped: small fix). Nits not taken: a fallback that reads the response stream when ErrorDetails is empty (fails safe today: it rethrows and the result stays in pending). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Get-Content tags strings with PSPath etc. on Windows PowerShell 5.1, so
ConvertTo-Json sent the PR body as an object and Forgejo answered 422.
Read title/summary with ReadAllText. A 409 'already exists' now counts as
uploaded and returns that PR's URL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'fix-pr-upload-422:fix-pr-upload-422'
git switch 'fix-pr-upload-422'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'fix-pr-upload-422'
git switch 'fix-pr-upload-422'
git rebase 'main'
git switch 'main'
git merge --ff-only 'fix-pr-upload-422'
git switch 'fix-pr-upload-422'
git rebase 'main'
git switch 'main'
git merge --no-ff 'fix-pr-upload-422'
git switch 'main'
git merge --squash 'fix-pr-upload-422'
git switch 'main'
git merge --ff-only 'fix-pr-upload-422'
git switch 'main'
git merge 'fix-pr-upload-422'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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
aporter/inventory!6
No description provided.