[v14.0/forgejo] chore: add more diagnostic output to dbfs Stat error (#11528)

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/11525

@viceice is having problems with runner `UpdateLog` errors like this:

```
2026-03-05T23:50:33.764718938+01:00 time="2026-03-05T22:50:33Z" level=warning msg="ReportLog error: internal: write logs: dbfs Stat \"actions_log/org/infra/99/14233.log.zst\": invalid argument" task_id=14233
2026-03-05T23:50:33.765473314+01:00 time="2026-03-05T22:50:33Z" level=warning msg="ReportLog error: internal: write logs: dbfs Stat \"actions_log/org/infra/98/14232.log.zst\": invalid argument" task_id=14232
```

This seems to be occurring with a bit of a contradiction:
- invalid argument should only occur if the file was absent in the dbfs table
- the file should be created if the offset to be written to is `0`
- the offset should be zero if the actions task has `log_size = 0`
- `log_size != 0` would indicate that the file exists

This PR adds additional details to the dbfs error, primarily to give insight into what the `offset` value is when the error occurs.

Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11528
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
forgejo-backport-action 2026-03-06 07:50:38 +01:00 committed by Michael Kriese
parent d4bb6cde65
commit ea4f733de8

View file

@ -61,7 +61,7 @@ func WriteLogs(ctx context.Context, filename string, offset int64, rows []*runne
stat, err := f.Stat()
if err != nil {
return nil, fmt.Errorf("dbfs Stat %q: %w", name, err)
return nil, fmt.Errorf("WriteLogs(name=%q, offset=%d, len(rows)=%d): dbfs Stat: %w", name, offset, len(rows), err)
}
if stat.Size() < offset {
// If the size is less than offset, refuse to write, or it could result in content holes.