fix(core): answer /_floci/ui/status with a map the native image can serialize (#8800)

GET /_floci/ui/status answered 500 in the native image: Jackson found
no properties on UiController.StatusResponse, a record whose components
the image carried no reflection metadata for, although the record had
@RegisterForReflection. The UI launcher polls this endpoint, so its
wait view stayed on "Starting Floci UI" after the sidecar was up.

The body is now a map, as the other /_floci endpoints build theirs,
which needs no reflection. Its {ready, url, error} shape is unchanged.

The AWS CLI compatibility suite, which runs against the native image,
calls the endpoint so a body that cannot be serialized there shows up.

Closes #5251
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-17 21:20:07 -04:00
1 parent 6bde4e6bb3
commit c2b9957032
4 files changed
+59 -16

No files matched your search

@@ -3,7 +3,6 @@ package io.floci.aws.lifecycle;
import io.floci.aws.services.floci.ui.FlociUiManager;
import io.floci.aws.services.floci.ui.FlociUiManager.UiStatus;
import io.floci.aws.services.floci.ui.UiPages;
import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam;
@@ -12,6 +11,9 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Browser-facing endpoints that launch and redirect to the floci-ui sidecar.
*
@@ -42,21 +44,31 @@ public class UiController {
return Response.ok(uiPages.landingHtml()).build();
}
@RegisterForReflection
public record StatusResponse(boolean ready, String url, String error) {}
/**
* The sidecar's state. The body is a map, as the other {@code /_floci} endpoints build theirs: a record needs
* reflection metadata for its components that the native image did not have, and Jackson found no properties on
* it there, so the endpoint answered 500 and the wait view never redirected.
*/
@GET
@Path("/status")
@Produces(MediaType.APPLICATION_JSON)
public Response status(@HeaderParam("Host") String host) {
UiStatus s = uiManager.status();
if (s.error() != null) {
return Response.ok(new StatusResponse(false, null, s.error())).build();
return Response.ok(statusBody(false, null, s.error())).build();
}
if (s.ready() && s.hostPort() > 0) {
return Response.ok(new StatusResponse(true, redirectUrl(host, s.hostPort()), null)).build();
return Response.ok(statusBody(true, redirectUrl(host, s.hostPort()), null)).build();
}
return Response.ok(new StatusResponse(false, null, null)).build();
return Response.ok(statusBody(false, null, null)).build();
}
private static Map<String, Object> statusBody(boolean ready, String url, String error) {
Map<String, Object> body = new LinkedHashMap<>();
body.put("ready", ready);
body.put("url", url);
body.put("error", error);
return body;
}
/** Builds the browser-reachable UI URL from the request Host and the published port. */