perf: tell workflow-as-code tasks apart by their status's nullness

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-10-26 13:53:12 -07:00
co-authored by Claude Opus 5.5
parent c991816a51
commit f91edbf4da
2 changed files with 8 additions and 7 deletions
+6 -5
View File
@@ -190,9 +190,10 @@ fn own_category(prefix: &str) -> String {
/// Whether the run `s`, whose parent `p` has the same path, is listed through that parent: a
/// single-step-flow wrapper's inner run, or a task of a workflow-as-code run or editor preview
/// of the script. An inline task re-runs the script with a checkpoint key its parent seeds; a
/// call the script makes to itself through the SDK has none and is listed. A flow or an agent
/// may share the path and is another runnable.
/// of the script. An inline task re-runs the script with the checkpoint its parent seeds as its
/// workflow-as-code status; a call a plain script makes to itself through the SDK has no status
/// and is listed. Only the column's nullness is read: the checkpoint holds every earlier step's
/// result. A flow or an agent may share the path and is another runnable.
fn listed_through_parent(runnable_type: &RunnableType) -> &'static str {
match runnable_type {
RunnableType::FlowPath => "p.kind = 'singlestepflow'",
@@ -200,9 +201,9 @@ fn listed_through_parent(runnable_type: &RunnableType) -> &'static str {
"CASE WHEN p.kind = 'singlestepflow' THEN true \
WHEN p.kind IN ('script', 'preview') THEN \
EXISTS (SELECT 1 FROM v2_job_status w WHERE w.id = s.id \
AND w.workflow_as_code_status->'_checkpoint' ? '_executing_key') \
AND w.workflow_as_code_status IS NOT NULL) \
OR EXISTS (SELECT 1 FROM v2_job_completed w WHERE w.id = s.id \
AND w.workflow_as_code_status->'_checkpoint' ? '_executing_key') \
AND w.workflow_as_code_status IS NOT NULL) \
ELSE false END"
}
}
@@ -194,8 +194,8 @@ async fn test_input_history_started_by(db: Pool<Postgres>) -> anyhow::Result<()>
.bind(retry)
.execute(&db)
.await?;
// Under a run of the same script: a workflow-as-code task, which its checkpoint key marks,
// is hidden; a call the script makes to itself through the SDK is a script call.
// Under a run of the same script: a workflow-as-code task, which its seeded checkpoint
// marks, is hidden; a call the script makes to itself through the SDK is a script call.
let wac_task = insert_run(
&db,
Run { path: STEP, parent_job: Some(manual), at: 4, ..Run::default() },