Copilot commented on code in PR #12509:
URL: https://github.com/apache/gravitino/pull/12509#discussion_r3811360741


##########
core/src/main/java/org/apache/gravitino/listener/api/info/JobInfo.java:
##########
@@ -106,6 +111,26 @@ public Audit auditInfo() {
     return audit;
   }
 
+  /**
+   * Returns the time when the job was queued for execution. This is the same 
as the job's creation
+   * time.
+   *
+   * @return the queued time of the job
+   */

Review Comment:
   `queuedAt()` is declared to return a non-null `Instant` but can return 
`null` when `audit == null`, which can lead to unexpected NPEs for callers. 
Either (mandatory) annotate it as `@Nullable` and update the Javadoc to reflect 
that it may be null, or (preferred if `audit` is guaranteed non-null) remove 
the null branch and enforce non-null audit at construction.



##########
docs/open-api/jobs.yaml:
##########
@@ -514,6 +514,16 @@ components:
             - "canceled"
         audit:
           $ref: "./openapi.yaml#/components/schemas/Audit"
+        queuedAt:
+          type: string
+          format: date-time
+          nullable: true
+          description: The time when the job was queued for execution, same as 
the job's creation time, or null if unavailable
+        startedAt:
+          type: string
+          format: date-time
+          nullable: true
+          description: The time when the job started execution, or null if the 
job has not started execution yet

Review Comment:
   `queuedAt` is described (and tested elsewhere) as always present because it 
is derived from the job's creation time, but the OpenAPI marks it `nullable: 
true` and mentions it can be null. To avoid clients treating it as 
optional/nullable, make `queuedAt` non-nullable and, if the API guarantees it, 
include it in the schema's `required` list; keep `startedAt` nullable.



-- 
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]

Reply via email to