fix(#3412): swarm-controller answers errors as RFC 9457 problem+json

Its three error paths returned a bare string with a status code, which forces
a caller to treat the whole body as prose. hive-c0re converted some time ago,
so swarm-controller was the last backend on the old shape -- and it is the one
behind the hive status page's 503, where the body is frequently the entire
diagnosis rather than a summary.

Adds the commitment to docs/conventions.md, since it was implied by the code
in one daemon and written down nowhere: an endpoint of ours answering with a
bare string is a bug to file, not something callers work around.

The test asserts the rendered response -- media type plus an addressable
detail -- rather than the problem_details value, because a handler that built
the value correctly and then returned it as a string would satisfy a test
written against the type alone.
This commit is contained in:
atlas 2026-08-17 21:06:56 +02:00 committed by mara
commit 58588a6866
4 changed files with 90 additions and 8 deletions

1
Cargo.lock generated
View file

@ -4591,6 +4591,7 @@ dependencies = [
"hive-jobq",
"hive-jobq-wire",
"hive-types",
"problem_details",
"reqwest 0.13.1",
"serde",
"serde_json",