Skip to content

Commit feb94aa

Browse files
fix: schedule index / API / RBAC (#486)
1 parent 58940a7 commit feb94aa

28 files changed

Lines changed: 1484 additions & 103 deletions

‎.changeset/schedule-list-runs.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@truefoundry/trueforge": patch
3+
---
4+
5+
Add GET /api/v1/schedules/{schedule_id}/runs to list a schedule's runs (newest `scheduled_for` first), with the same creator-or-admin access as other schedule routes.

‎.github/fern/openapi/openapi.json‎

Lines changed: 164 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,20 @@
15511551
],
15521552
"type": "object"
15531553
},
1554+
"ListScheduleRunsResponse": {
1555+
"properties": {
1556+
"data": {
1557+
"items": {
1558+
"$ref": "#/components/schemas/ScheduleRun"
1559+
},
1560+
"type": "array"
1561+
}
1562+
},
1563+
"required": [
1564+
"data"
1565+
],
1566+
"type": "object"
1567+
},
15541568
"ListSchedulesResponse": {
15551569
"properties": {
15561570
"data": {
@@ -2914,6 +2928,65 @@
29142928
],
29152929
"type": "object"
29162930
},
2931+
"ScheduleRun": {
2932+
"additionalProperties": false,
2933+
"properties": {
2934+
"created_at": {
2935+
"format": "date-time",
2936+
"type": "string"
2937+
},
2938+
"id": {
2939+
"type": "string"
2940+
},
2941+
"name": {
2942+
"type": "string"
2943+
},
2944+
"schedule_id": {
2945+
"type": "string"
2946+
},
2947+
"scheduled_for": {
2948+
"format": "date-time",
2949+
"type": "string"
2950+
},
2951+
"status": {
2952+
"$ref": "#/components/schemas/ScheduleRunStatus"
2953+
},
2954+
"triggered_at": {
2955+
"format": "date-time",
2956+
"type": [
2957+
"string",
2958+
"null"
2959+
]
2960+
},
2961+
"triggered_by": {
2962+
"type": "string"
2963+
},
2964+
"updated_at": {
2965+
"format": "date-time",
2966+
"type": "string"
2967+
}
2968+
},
2969+
"required": [
2970+
"id",
2971+
"schedule_id",
2972+
"name",
2973+
"scheduled_for",
2974+
"status",
2975+
"triggered_by",
2976+
"triggered_at",
2977+
"created_at",
2978+
"updated_at"
2979+
],
2980+
"type": "object"
2981+
},
2982+
"ScheduleRunStatus": {
2983+
"enum": [
2984+
"scheduled",
2985+
"triggered",
2986+
"failed"
2987+
],
2988+
"type": "string"
2989+
},
29172990
"ScheduleStatus": {
29182991
"default": "active",
29192992
"enum": [
@@ -5481,7 +5554,7 @@
54815554
}
54825555
}
54835556
},
5484-
"description": "The schedule was modified concurrently (usually the controller advancing it). Retry."
5557+
"description": "The name is already taken for this agent, or the schedule was modified concurrently (retry)."
54855558
}
54865559
},
54875560
"summary": "Create a schedule",
@@ -5531,6 +5604,16 @@
55315604
}
55325605
},
55335606
"description": "Unauthenticated."
5607+
},
5608+
"403": {
5609+
"content": {
5610+
"application/json": {
5611+
"schema": {
5612+
"$ref": "#/components/schemas/RequestErrorResponse"
5613+
}
5614+
}
5615+
},
5616+
"description": "The caller is not the schedule creator."
55345617
}
55355618
},
55365619
"summary": "Delete a schedule",
@@ -5569,6 +5652,16 @@
55695652
},
55705653
"description": "The schedule."
55715654
},
5655+
"403": {
5656+
"content": {
5657+
"application/json": {
5658+
"schema": {
5659+
"$ref": "#/components/schemas/RequestErrorResponse"
5660+
}
5661+
}
5662+
},
5663+
"description": "The caller is not the schedule creator."
5664+
},
55725665
"404": {
55735666
"content": {
55745667
"application/json": {
@@ -5636,6 +5729,16 @@
56365729
},
56375730
"description": "Invalid cron."
56385731
},
5732+
"403": {
5733+
"content": {
5734+
"application/json": {
5735+
"schema": {
5736+
"$ref": "#/components/schemas/RequestErrorResponse"
5737+
}
5738+
}
5739+
},
5740+
"description": "The caller is not the schedule creator."
5741+
},
56395742
"404": {
56405743
"content": {
56415744
"application/json": {
@@ -5654,7 +5757,7 @@
56545757
}
56555758
}
56565759
},
5657-
"description": "The schedule was modified concurrently (usually the controller advancing it). Retry."
5760+
"description": "The name is already taken for this agent, or the schedule was modified concurrently (retry)."
56585761
}
56595762
},
56605763
"summary": "Update a schedule",
@@ -5667,6 +5770,65 @@
56675770
"x-fern-sdk-method-name": "update"
56685771
}
56695772
},
5773+
"/api/v1/schedules/{schedule_id}/runs": {
5774+
"get": {
5775+
"description": "List runs of a schedule, newest `scheduled_for` first. Only the schedule creator (or an admin) may list its runs.",
5776+
"parameters": [
5777+
{
5778+
"description": "Immutable schedule identifier.",
5779+
"in": "path",
5780+
"name": "schedule_id",
5781+
"required": true,
5782+
"schema": {
5783+
"description": "Immutable schedule identifier.",
5784+
"maxLength": 64,
5785+
"minLength": 1,
5786+
"type": "string"
5787+
}
5788+
}
5789+
],
5790+
"responses": {
5791+
"200": {
5792+
"content": {
5793+
"application/json": {
5794+
"schema": {
5795+
"$ref": "#/components/schemas/ListScheduleRunsResponse"
5796+
}
5797+
}
5798+
},
5799+
"description": "Runs of the schedule."
5800+
},
5801+
"403": {
5802+
"content": {
5803+
"application/json": {
5804+
"schema": {
5805+
"$ref": "#/components/schemas/RequestErrorResponse"
5806+
}
5807+
}
5808+
},
5809+
"description": "The caller is not the schedule creator."
5810+
},
5811+
"404": {
5812+
"content": {
5813+
"application/json": {
5814+
"schema": {
5815+
"$ref": "#/components/schemas/RequestErrorResponse"
5816+
}
5817+
}
5818+
},
5819+
"description": "Not found."
5820+
}
5821+
},
5822+
"summary": "List runs of a schedule",
5823+
"tags": [
5824+
"Schedules"
5825+
],
5826+
"x-fern-sdk-group-name": [
5827+
"schedules"
5828+
],
5829+
"x-fern-sdk-method-name": "list_runs"
5830+
}
5831+
},
56705832
"/api/v1/sessions": {
56715833
"get": {
56725834
"description": "List the caller's sessions (newest first by default), token-paginated. Results are scoped to the authenticated identity via the session store's `created_by` filter (not a client query param). Optional `agent_id` filters to sessions bound to that named agent. Pass `page_token` to fetch the next page, keeping the other query params constant.",

0 commit comments

Comments
 (0)