Copilot commented on code in PR #3144:
URL: https://github.com/apache/hugegraph/pull/3144#discussion_r3861070221


##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/job/TaskAPI.java:
##########
@@ -150,6 +177,193 @@ public Map<String, Object> get(@Context GraphManager 
manager,
                         .asMap(true, withResult);
     }
 
+    @GET
+    @Timed
+    @Compress
+    @Path("{id}/result")
+    @Produces(APPLICATION_JSON_WITH_CHARSET)
+    public Response getResult(@Context GraphManager manager,
+                              @Context HugeConfig config,
+                              @Context Request request,
+                              @Parameter(description = "The graphspace name")
+                              @PathParam("graphspace") String graphSpace,
+                              @Parameter(description = "The graph name")
+                              @PathParam("graph") String graph,
+                              @Parameter(description = "The task id")
+                              @PathParam("id") long id,
+                              @Parameter(description = "The result page limit")
+                              @QueryParam("limit") Integer limit,
+                              @Parameter(description = "The result page token")
+                              @QueryParam("page") String page) {
+        TaskResultStreamMetrics.Mode mode =
+                limit != null || page != null ?
+                TaskResultStreamMetrics.Mode.PAGE :
+                TaskResultStreamMetrics.Mode.COMPLETE;
+        TaskResultStreamMetrics.RequestTrace trace =
+                TaskResultStreamMetrics.request(graphSpace, graph, id, mode);
+        long requestDeadlineNanos = deadline(config.get(
+                ServerOptions.REQUEST_TIMEOUT));
+        try {
+            return this.buildResultResponse(manager, config, request,
+                                            graphSpace, graph, id,
+                                            limit, page, trace,
+                                            requestDeadlineNanos);
+        } catch (RuntimeException | Error e) {
+            trace.preCommitFailure(e);
+            throw e;
+        }
+    }
+
+    @HEAD
+    @Timed
+    @Compress
+    @Path("{id}/result")
+    @Produces(APPLICATION_JSON_WITH_CHARSET)
+    public Response headResult(
+            @Context GraphManager manager,
+            @Parameter(description = "The graphspace name")
+            @PathParam("graphspace") String graphSpace,
+            @Parameter(description = "The graph name")
+            @PathParam("graph") String graph,
+            @Parameter(description = "The task id")
+            @PathParam("id") long id) {
+        TaskScheduler scheduler = graph(manager, graphSpace, graph)
+                .taskScheduler();
+        TaskResultMetadata metadata = scheduler.taskResultMetadata(
+                IdGenerator.of(id));
+        ensureReadable(metadata);

Review Comment:
   `headResult()` calls `TaskScheduler.taskResultMetadata()` directly. For 
custom schedulers that don’t override the new default SPI method, the default 
implementation throws `UnsupportedOperationException`, which currently bubbles 
up as HTTP 500 via the generic exception mapper. This breaks the intended 
“source/binary compatible + reports unsupported streaming” contract; consider 
translating this into a stable HTTP status (e.g., 501 Not Implemented) with the 
standard error envelope.
   
   This issue also appears on line 304 of the same file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to