Skip to content

#28390 API design (schedule script)#30443

Merged
rachaelshaw merged 31 commits intomainfrom
28390-api-design
Sep 8, 2025
Merged

#28390 API design (schedule script)#30443
rachaelshaw merged 31 commits intomainfrom
28390-api-design

Conversation

@rachaelshaw
Copy link
Copy Markdown
Member

For #28390

fleet-release
fleet-release previously approved these changes Jun 30, 2025
fleet-release
fleet-release previously approved these changes Jul 1, 2025
fleet-release
fleet-release previously approved these changes Jul 23, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 23, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 28390-api-design

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

fleet-release
fleet-release previously approved these changes Jul 24, 2025
fleet-release
fleet-release previously approved these changes Jul 24, 2025
Comment thread docs/REST API/rest-api.md Outdated
"team_id": 123,
"starts_at": "2025-07-01T15:00:00Z",
"completed_at": "2025-07-06T15:00:00Z",
"status": "completed",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dev note

Status can be completed, started, or scheduled.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update 8/7 - completed -> finished

Comment thread docs/REST API/rest-api.md Outdated
fleet-release
fleet-release previously approved these changes Aug 7, 2025
Comment thread docs/REST API/rest-api.md Outdated
"team_id": 123,
"not_before": "2025-07-01T15:00:00Z",
"completed_at": "2025-07-06T15:00:00Z",
"status": "completed",
Copy link
Copy Markdown
Contributor

@jacobshandling jacobshandling Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a batch has "status": "started", can "not_before" be null in the case that the batch was run immediately? Seems like this should be the case, so seems like we also need a "started_at" field to be able to say when a non-scheduled batch run began, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, the status field is maybe redundant - that data can be derived from not_before, started_at, and completed_at:

!!completed_at -> completed, else !!started_at -> started, else !!not_before -> scheduled, else this batch summary shouldn't exist

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do keep status, seems canceled should be an option and not its own field, though better to remove status and update to canceled_at.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of all of these comments - proposal:

  • Remove "status" field
  • Update "canceled" boolean field to "canceled_at" datetime string field
  • Add "started_at" datetime string field

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: status you're not wrong that it can be derived, but I'd prefer to keep status as a property rather than have the front-end contain business logic to determine it. Kinda like how we have has_previous_results and has_next_results for pagination even though it can technically be figured out with a combination of page, page size and total count. +1 on adding started_at and canceled -> canceled_at.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I like canceled_at is so that completed_at isn't ambiguous. Another possibly better option is:

  1. rename completed_at to finished_at and set it when a batch completes or is canceled
  2. add "canceled" as a valid value for status
  3. remove the canceled property (and don't add canceled_at).

This way we have one field (finished_at) indicating when the job stopped running, and one field (state) indicating why.

Copy link
Copy Markdown
Contributor

@jacobshandling jacobshandling Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The canceled_at / completed_at approach dovetails with the "status" of a summary being completely defined by (not_before, started_at, completed_at, canceled_at) and not having a "status" field.

This suggestion to change to finished_at + add a "canceled" status dovetails with the current, "status"-field based approach. Both make sense to me, so given we want to keep status this proposal makes a lot of sense

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decision:
completed_at –> finished_at
status.completed -> status.finished
canceled flag remains

Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md
Comment thread docs/REST API/rest-api.md
Comment thread docs/REST API/rest-api.md
Comment on lines +9130 to +9131
"script_executed_at": "2024-09-11T20:30:24Z",
"script_output_preview": "hello world"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming these 2 fields null for pending/cancelled/incompatible ?

@noahtalerman noahtalerman marked this pull request as ready for review September 6, 2025 00:29
fleet-release
fleet-release previously approved these changes Sep 6, 2025
@rachaelshaw rachaelshaw merged commit bf23533 into main Sep 8, 2025
6 checks passed
@rachaelshaw rachaelshaw deleted the 28390-api-design branch September 8, 2025 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants