feat: Surface Flow task report on Task API#2288
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🌿 Preview your docs: https://nvidia-preview-pull-request-2288.docs.buildwithfern.com/infra-controller |
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-06-07 18:46:44 UTC | Commit: fe67fc1 |
Task.report bodies can be several KB. Always returning them on ListTasks would persist the blob in every caller-side Temporal activity / workflow payload along the call path, even when the caller never reads it. Opt callers in via with_report, defaulting to off for list endpoints; single-task RPCs always return it. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Pulls in the new ListTasksRequest.with_report field along with prior upstream drift (Task.report, override_assignment_check on the rack power / firmware / bring-up requests, and refreshed doc comments) that earlier PRs landed without running flow-proto + flow-protogen. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Surfaces the structured execution report Flow already produces on Task. Single-task GET and Cancel always include it; the rack/tray list endpoints accept withReport=true and forward the flag down to Flow's ListTasksRequest so the multi-KB payload is not paid for on the default list path. The report is exposed as an opaque JSON document with a typed version anchor; clients must branch on version before reading anything else, so Flow's internal schema can evolve without breaking REST consumers. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
Covers 82626a9 (the task report + withReport spec change). Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
fe67fc1 to
3aa6e8b
Compare
Both list-task handlers built the same APIRackTaskOption slice from APIGetTasksRequest. Move the translation into model.BuildAPIRackTaskOptions so new opt-in fields wire up in one place. Addresses review feedback on PR NVIDIA#2288. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
| type: string | ||
| format: date-time | ||
| description: Timestamp when the task was last updated. | ||
| report: |
There was a problem hiding this comment.
We need to establish some kind of contract with the user. If this schema is tied to version 1 of the report then we should provide a version 1 schema for the user.
The same model serves tray-scoped task endpoints in addition to rack ones; "RackTask" was misleading. Rename in lockstep with the OpenAPI schema Task. Handler / route / telemetry-label names keep "Rack" where they describe a specific endpoint scope rather than the response model. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Aligns the public query param with the REST naming convention. The Flow proto field stays with_report to match the existing with_rack / with_components flags on adjacent RPCs. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Replace the opaque report blob with a typed APITaskReportV1 schema that mirrors flow/internal/task/report. Clients get a stable v1 contract (status enum, stage / step nesting, RFC3339 timestamps); malformed or non-v1 payloads decode to nil so the response never carries an off-contract shape. Wire keys are camelCase (componentType, startedAt, ...) to match the rest of the REST API surface; conversion from Flow's snake_case emission happens inside parseTaskReportV1. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
thossain-nv
left a comment
There was a problem hiding this comment.
Thanks for the changes @kunzhao-nv, left a few more notes.
| // APITaskReportV1. Without this option, Report is left nil and is | ||
| // omitted from the JSON response. A malformed or non-v1 payload also | ||
| // yields nil so the response never carries an off-contract shape. | ||
| func WithReport() APITaskOption { |
There was a problem hiding this comment.
This package is model so WithReport needs to be more specific e.g. APITaskOptionWithReport
There was a problem hiding this comment.
Prefer to keep WithReport here:
-
Call-site already disambiguates:
model.NewAPITask(t, model.WithReport())— the second-arg type (APITaskOption) tells which "Report" this is. -
Go convention is bare
pkg.WithX():grpc.WithInsecure(),aws.WithRegion(),redis.WithMaxRetries(). The type comes from the constructor that consumes the option, not from the option name. -
Repo precedent matches:
HTTPMiddlewareOption→WithTelemetry/WithRequestMetrics/WithHandlerTimeoutSharedInformerOption→WithNamespace/WithCustomResyncConfig/WithTweakListOptionscert-manager/pkg/core/context.go(multi-concern, likemodel) →WithLogger/WithAppName/WithSignalHandler/WithClock
There was a problem hiding this comment.
The difference here is that model is a large general package. The example you provided all have specific package scope e.g. Core.
By defining WithReport we're claiming WithReport function name for all models. Another model Instance won't be able to define func WithReport() APIInstanceOption because Go doesn't allow function overloading.
If you want to keep WithX convention, then I'd use WithTaskReport
| // (snake_case JSON keys). Used solely as an unmarshal target so the | ||
| // REST-facing APITaskReportV1 can keep camelCase keys per the rest of | ||
| // the API surface. Kept private; clients consume APITaskReportV1. | ||
| type flowTaskReportV1 struct { |
There was a problem hiding this comment.
Do we not have proto objects for report?
There was a problem hiding this comment.
No it is string type in flow proto.
Three follow-ups from thossain-nv on PR NVIDIA#2288: - Inline BuildAPITaskOptions as APIGetTasksRequest.TaskOptions, since the function only ever consumed a single request and was already conceptually a getter on it. - Move parseTaskReportV1 into APITaskReportV1.UnmarshalJSON so the custom Flow snake_case decoder is reachable via the standard encoding/json entry point. The marshal path stays camelCase via struct tags; the doc comment flags the resulting asymmetry. - Rename WithReport to WithTaskReport so future model option constructors for other API types (machine, rack, ...) can coexist in this shared package without colliding on a generic "Report" name. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Three follow-ups from PR NVIDIA#2288 review: - Inline BuildAPITaskOptions as APIGetTasksRequest.TaskOptions, since the function only ever consumed a single request and was already conceptually a getter on it. - Move parseTaskReportV1 into APITaskReportV1.UnmarshalJSON so the custom Flow snake_case decoder is reachable via the standard encoding/json entry point. The marshal path stays camelCase via struct tags; the doc comment flags the resulting asymmetry. - Rename WithReport to WithTaskReport so future model option constructors for other API types (machine, rack, ...) can coexist in this shared package without colliding on a generic "Report" name. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
8bfe293 to
b02af2e
Compare
Two follow-ups from PR NVIDIA#2288 review: - Inline BuildAPITaskOptions as APIGetTasksRequest.TaskOptions, since the function only ever consumed a single request and was already conceptually a getter on it. - Move parseTaskReportV1 into APITaskReportV1.UnmarshalJSON so the custom Flow snake_case decoder is reachable via the standard encoding/json entry point. The marshal path stays camelCase via struct tags; the doc comment flags the resulting asymmetry. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
b02af2e to
5988d28
Compare
thossain-nv
left a comment
There was a problem hiding this comment.
Adding +1, consider the suggestion on option chaining.
Three follow-ups from PR NVIDIA#2288 review: - Inline BuildAPITaskOptions as APIGetTasksRequest.TaskOptions, since the function only ever consumed a single request and was already conceptually a getter on it. - Move parseTaskReportV1 into APITaskReportV1.UnmarshalJSON so the custom Flow snake_case decoder is reachable via the standard encoding/json entry point. The marshal path stays camelCase via struct tags; the doc comment flags the resulting asymmetry. - Rename WithReport to WithTaskReport so the bare "WithReport" name stays available for option constructors on other model types. Go has no function overloading, so claiming WithReport in this shared package would permanently preclude e.g. an APIInstance WithReport() down the line. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
5988d28 to
c4223e7
Compare
- Inline BuildAPITaskOptions as APIGetTasksRequest.TaskOptions; it only ever consumed a single request. - Move parseTaskReportV1 into APITaskReportV1.UnmarshalJSON so the Flow snake_case decoder is reachable via encoding/json. Marshal stays camelCase via struct tags. - Rename WithReport to WithTaskReport so the shared model package keeps the bare WithReport name available for option constructors on other types. Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
c4223e7 to
7e2d079
Compare
Resolve task conflicts with NVIDIA#2288 (Task report API): - APITask gains both RuleID (ours) and Report (theirs) plus the APITaskOption / WithTaskReport plumbing - spec.yaml interleaves Task example (ruleId + report) and keeps both schema sets (OperationRule chain + TaskReportV1 chain) - regenerate docs/index.html and sdk/standard/ Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Description
report(already produced by Flow) to the rack Task endpoints.GET /rack/task/{id}andPOST /rack/task/{id}/cancelalways include the report. The two list endpoints (/rack/{id}/task,/tray/{id}/task) take a newwithReport=trueopt-in.IncludeReportis plumbed all the way down toflow.ListTasksRequest, so Flow drops the multi-KB blob server-side when the caller hasn't asked for it; the savings cover the full Temporal workflow / activity payload chain, not just the wire response.Type of Change
Related Issues (Optional)
Breaking Changes
Testing
Additional Notes