@shipfox/api-workflows 12.5.0 → 12.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +25 -0
- package/dist/core/entities/workflow-run.d.ts +3 -0
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/schema/jobs.d.ts.map +1 -1
- package/dist/db/schema/jobs.js +3 -0
- package/dist/db/schema/jobs.js.map +1 -1
- package/dist/db/workflow-runs/queries.d.ts +19 -5
- package/dist/db/workflow-runs/queries.d.ts.map +1 -1
- package/dist/db/workflow-runs/queries.js +70 -17
- package/dist/db/workflow-runs/queries.js.map +1 -1
- package/dist/db/workflow-runs.d.ts +1 -1
- package/dist/db/workflow-runs.d.ts.map +1 -1
- package/dist/db/workflow-runs.js.map +1 -1
- package/dist/presentation/dto/workflow-run.d.ts.map +1 -1
- package/dist/presentation/dto/workflow-run.js +13 -3
- package/dist/presentation/dto/workflow-run.js.map +1 -1
- package/dist/presentation/routes/get-run.d.ts.map +1 -1
- package/dist/presentation/routes/get-run.js +2 -1
- package/dist/presentation/routes/get-run.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/core/entities/workflow-run.ts +3 -0
- package/src/db/index.ts +1 -0
- package/src/db/schema/jobs.ts +3 -0
- package/src/db/workflow-runs/queries.test.ts +196 -2
- package/src/db/workflow-runs/queries.ts +116 -15
- package/src/db/workflow-runs.ts +1 -0
- package/src/presentation/dto/workflow-run.ts +12 -2
- package/src/presentation/routes/get-run.test.ts +31 -0
- package/src/presentation/routes/get-run.ts +1 -0
- package/src/presentation/routes/list-runs.test.ts +5 -1
- package/tsconfig.build.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
|
|
2
|
-
Successfully compiled: 124 files with swc (
|
|
3
|
-
2026-08-
|
|
2
|
+
Successfully compiled: 124 files with swc (817.5ms)
|
|
3
|
+
2026-08-10T13:04:49.694Z [INFO] asset workflow-bundle-a5487a6112facdf4dd9d.js 3.32 MiB [emitted] [immutable] (name: main)
|
|
4
4
|
orphan modules 33.5 KiB [orphan] 21 modules
|
|
5
5
|
runtime modules 1.13 KiB 5 modules
|
|
6
6
|
modules by path ../../../node_modules/.pnpm/ 970 KiB 196 modules
|
|
@@ -16,6 +16,6 @@ optional modules 30 bytes [optional]
|
|
|
16
16
|
__temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
17
17
|
__temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
18
18
|
../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
|
|
19
|
-
webpack 5.107.2 compiled successfully in
|
|
20
|
-
2026-08-
|
|
19
|
+
webpack 5.107.2 compiled successfully in 11308 ms
|
|
20
|
+
2026-08-10T13:04:49.735Z [INFO] Workflow bundle created { size: '3.32MB' }
|
|
21
21
|
/home/runner/work/shipfox/shipfox/libs/api/workflows/dist/temporal/workflows/index.js: 3476109 bytes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @shipfox/api-workflows
|
|
2
2
|
|
|
3
|
+
## 12.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4df5e37: Workflow run list items and run detail now carry `has_started_job_execution`, reporting whether any
|
|
8
|
+
job execution of the attempt reached a runner. Run surfaces no longer show a client-derived `Queued`
|
|
9
|
+
state: the run list and run detail present the API attempt status and duration, and read the new
|
|
10
|
+
field to label a finished run's duration as run or elapsed time.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [4df5e37]
|
|
15
|
+
- @shipfox/api-workflows-dto@12.7.0
|
|
16
|
+
|
|
17
|
+
## 12.6.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 53b87f0: Distinguish queued and executing jobs in workflow run list status strips.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [53b87f0]
|
|
26
|
+
- @shipfox/api-workflows-dto@12.6.0
|
|
27
|
+
|
|
3
28
|
## 12.5.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
|
@@ -79,5 +79,8 @@ export interface WorkflowRunDetail extends WorkflowRun {
|
|
|
79
79
|
runAttempt: WorkflowRunAttempt;
|
|
80
80
|
latestAttempt: number;
|
|
81
81
|
jobs: WorkflowJobDetail[];
|
|
82
|
+
/** Whether any job execution of this attempt reached its runner, decided here so the detail
|
|
83
|
+
* and the list cannot answer it differently. */
|
|
84
|
+
hasStartedJobExecution: boolean;
|
|
82
85
|
}
|
|
83
86
|
//# sourceMappingURL=workflow-run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE7F,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,iBAAiB,EACjB,WAAW,GAAG,QAAQ,GAAG,WA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AM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,GAAG;IAC5C,aAAa,EAAE,kBAAkB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,UAAU,EAAE,kBAAkB,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B;oDACgD;IAChD,sBAAsB,EAAE,OAAO,CAAC;CACjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import type {Job} from './job.js';\nimport type {JobExecution} from './job-execution.js';\nimport type {Step, StepAttempt} from './step.js';\nimport type {WorkflowRunAttempt} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\n\nexport type TerminalWorkflowRunStatus = Extract<\n WorkflowRunStatus,\n 'succeeded' | 'failed' | 'cancelled'\n>;\n\nconst TERMINAL_WORKFLOW_RUN_STATUSES = new Set<WorkflowRunStatus>([\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport function isWorkflowRunTerminal(\n status: WorkflowRunStatus,\n): status is TerminalWorkflowRunStatus {\n return TERMINAL_WORKFLOW_RUN_STATUSES.has(status);\n}\n\nexport interface WorkflowRunTriggerReference {\n project: {id: string} | null;\n repository: string | null;\n ref: string | null;\n commit: string | null;\n actor: string | null;\n}\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\nexport type TriggerPayload =\n | {\n source: 'manual';\n provider?: 'manual' | undefined;\n event: 'fire';\n subscriptionId: string;\n userId: string;\n }\n | {\n source: 'cron';\n provider?: 'cron' | undefined;\n event: 'tick';\n scheduleId: string;\n }\n // Integration sources (github, gitlab, sentry, …) flow through opaquely: the\n // run records what fired it and carries the raw event payload, without the\n // triggers module having to know each source's shape.\n | {\n source: string;\n provider?: string | undefined;\n event: string;\n deliveryId: string;\n data: unknown;\n };\n\nexport interface WorkflowRun {\n id: string;\n workspaceId: string;\n projectId: string;\n definitionId: string;\n number: number;\n /** Effective runtime name: the resolved override, or workflowName when absent. */\n name: string;\n /** Static workflow-name snapshot preserved from the definition at creation. */\n workflowName: string;\n /** Nullable resolved override retained for rerun fidelity. */\n nameOverride: string | null;\n status: WorkflowRunStatus;\n currentAttempt: number;\n triggerProvider: string | null;\n triggerSource: string;\n triggerEvent: string;\n triggerPayload: TriggerPayload;\n /** Provider-neutral trigger facts captured at run creation, when available. */\n triggerReference?: WorkflowRunTriggerReference | null | undefined;\n inputs: Record<string, unknown> | null;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n triggerIdempotencyKey: string | null;\n timeoutMs: number;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n startedAt: Date | null;\n finishedAt: Date | null;\n}\n\nexport interface StepDetail extends Step {\n attempts: StepAttempt[];\n}\n\nexport interface JobExecutionDetail extends JobExecution {\n steps: StepDetail[];\n}\n\nexport interface WorkflowJobDetail extends Job {\n jobExecutions: JobExecutionDetail[];\n}\n\nexport interface WorkflowRunDetail extends WorkflowRun {\n runAttempt: WorkflowRunAttempt;\n latestAttempt: number;\n jobs: WorkflowJobDetail[];\n}\n"],"names":["TERMINAL_WORKFLOW_RUN_STATUSES","Set","isWorkflowRunTerminal","status","has"],"mappings":"AAYA,MAAMA,iCAAiC,IAAIC,IAAuB;IAChE;IACA;IACA;CACD;AAED,OAAO,SAASC,sBACdC,MAAyB;IAEzB,OAAOH,+BAA+BI,GAAG,CAACD;AAC5C"}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import type {Job} from './job.js';\nimport type {JobExecution} from './job-execution.js';\nimport type {Step, StepAttempt} from './step.js';\nimport type {WorkflowRunAttempt} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\n\nexport type TerminalWorkflowRunStatus = Extract<\n WorkflowRunStatus,\n 'succeeded' | 'failed' | 'cancelled'\n>;\n\nconst TERMINAL_WORKFLOW_RUN_STATUSES = new Set<WorkflowRunStatus>([\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport function isWorkflowRunTerminal(\n status: WorkflowRunStatus,\n): status is TerminalWorkflowRunStatus {\n return TERMINAL_WORKFLOW_RUN_STATUSES.has(status);\n}\n\nexport interface WorkflowRunTriggerReference {\n project: {id: string} | null;\n repository: string | null;\n ref: string | null;\n commit: string | null;\n actor: string | null;\n}\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\nexport type TriggerPayload =\n | {\n source: 'manual';\n provider?: 'manual' | undefined;\n event: 'fire';\n subscriptionId: string;\n userId: string;\n }\n | {\n source: 'cron';\n provider?: 'cron' | undefined;\n event: 'tick';\n scheduleId: string;\n }\n // Integration sources (github, gitlab, sentry, …) flow through opaquely: the\n // run records what fired it and carries the raw event payload, without the\n // triggers module having to know each source's shape.\n | {\n source: string;\n provider?: string | undefined;\n event: string;\n deliveryId: string;\n data: unknown;\n };\n\nexport interface WorkflowRun {\n id: string;\n workspaceId: string;\n projectId: string;\n definitionId: string;\n number: number;\n /** Effective runtime name: the resolved override, or workflowName when absent. */\n name: string;\n /** Static workflow-name snapshot preserved from the definition at creation. */\n workflowName: string;\n /** Nullable resolved override retained for rerun fidelity. */\n nameOverride: string | null;\n status: WorkflowRunStatus;\n currentAttempt: number;\n triggerProvider: string | null;\n triggerSource: string;\n triggerEvent: string;\n triggerPayload: TriggerPayload;\n /** Provider-neutral trigger facts captured at run creation, when available. */\n triggerReference?: WorkflowRunTriggerReference | null | undefined;\n inputs: Record<string, unknown> | null;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n triggerIdempotencyKey: string | null;\n timeoutMs: number;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n startedAt: Date | null;\n finishedAt: Date | null;\n}\n\nexport interface StepDetail extends Step {\n attempts: StepAttempt[];\n}\n\nexport interface JobExecutionDetail extends JobExecution {\n steps: StepDetail[];\n}\n\nexport interface WorkflowJobDetail extends Job {\n jobExecutions: JobExecutionDetail[];\n}\n\nexport interface WorkflowRunDetail extends WorkflowRun {\n runAttempt: WorkflowRunAttempt;\n latestAttempt: number;\n jobs: WorkflowJobDetail[];\n /** Whether any job execution of this attempt reached its runner, decided here so the detail\n * and the list cannot answer it differently. */\n hasStartedJobExecution: boolean;\n}\n"],"names":["TERMINAL_WORKFLOW_RUN_STATUSES","Set","isWorkflowRunTerminal","status","has"],"mappings":"AAYA,MAAMA,iCAAiC,IAAIC,IAAuB;IAChE;IACA;IACA;CACD;AAED,OAAO,SAASC,sBACdC,MAAyB;IAEzB,OAAOH,+BAA+BI,GAAG,CAACD;AAC5C"}
|
package/dist/db/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { ActivateJobListenerParams, ActivateJobListenerResult, DrainListene
|
|
|
4
4
|
export { activateJobListener, countActiveListeners, drainListenerEventsIntoExecution, peekListenerBuffer, resolveJobListener, settleListenerJobExecution, } from './job-listeners.js';
|
|
5
5
|
export { workflowsOutbox } from './schema/outbox.js';
|
|
6
6
|
export { workflowRunCounters } from './schema/workflow-run-counters.js';
|
|
7
|
-
export type { BulkUpdateStepStatusesParams, CancelWorkflowRunParams, CreateRerunWorkflowRunParams, CreateWorkflowRunParams, EvaluateJobActivationsParams, FailWorkflowRunAsTimedOutParams, JobActivationDecision, ListWorkflowRunsParams, ListWorkflowRunsResult, StepAttemptDetail, UpdateJobExecutionStatusParams, UpdateJobStatusParams, UpdateWorkflowRunStatusParams, WorkflowJobExecutionDepth, WorkflowJobExecutionDepthParams, WorkflowRunAggregates, WorkflowRunFilters, WorkflowRunJobStatusCount, WorkflowRunJobSummary, WorkflowRunJobSummaryTarget, WorkflowRunJobsSummary, } from './workflow-runs.js';
|
|
7
|
+
export type { BulkUpdateStepStatusesParams, CancelWorkflowRunParams, CreateRerunWorkflowRunParams, CreateWorkflowRunParams, EvaluateJobActivationsParams, FailWorkflowRunAsTimedOutParams, JobActivationDecision, ListWorkflowRunsParams, ListWorkflowRunsResult, StepAttemptDetail, UpdateJobExecutionStatusParams, UpdateJobStatusParams, UpdateWorkflowRunStatusParams, WorkflowJobExecutionDepth, WorkflowJobExecutionDepthParams, WorkflowRunAggregates, WorkflowRunFilters, WorkflowRunJobRawStatusCount, WorkflowRunJobStatusCount, WorkflowRunJobSummary, WorkflowRunJobSummaryTarget, WorkflowRunJobsSummary, } from './workflow-runs.js';
|
|
8
8
|
export { bulkUpdateStepStatuses, cancelWorkflowRun, createRerunWorkflowRun, createWorkflowRun, evaluateJobActivations, failJobExecutionAsTimedOut, failWorkflowRunAsTimedOut, getFirstJobExecutionByJobId, getJobById, getJobExecutionById, getJobExecutionDetail, getJobExecutionFailureOrigin, getJobExecutionsByJobId, getJobExecutionsByWorkflowRunAttemptId, getJobScope, getJobsByWorkflowRunAttemptId, getJobsByWorkflowRunId, getLatestAttempt, getLatestJobExecutionByJobId, getStepAttemptDetail, getStepAttempts, getStepAttemptsByJobIds, getStepById, getStepByIdForJobExecution, getStepsByJobExecutionId, getStepsByJobExecutionIdForUpdate, getWorkflowJobExecutionDepth, getWorkflowRunAggregates, getWorkflowRunAttemptById, getWorkflowRunByAttemptId, getWorkflowRunById, getWorkflowRunDetail, listRunAttempts, listWorkflowRunJobSummaries, listWorkflowRuns, listWorkflowRunsByProject, recordJobExecutionQueuedAt, recordJobExecutionStartedAt, resolveJobExecutionAfterLeaseExpiry, resolveJobStatusFromJobExecutions, updateJobExecutionStatus, updateJobStatus, updateWorkflowRunStatus, } from './workflow-runs.js';
|
|
9
9
|
export declare const migrationsPath: string;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/db/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"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2B,EAC3B,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,sCAAsC,EACtC,WAAW,EACX,6BAA6B,EAC7B,sBAAsB,EACtB,gBAAgB,EAChB,4BAA4B,EAC5B,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,0BAA0B,EAC1B,wBAAwB,EACxB,iCAAiC,EACjC,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,2BAA2B,EAC3B,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,mCAAmC,EACnC,iCAAiC,EACjC,wBAAwB,EACxB,eAAe,EACf,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,cAAc,QAAoE,CAAC"}
|
package/dist/db/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/db/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\n\nexport {closeDb, db, schema} from './db.js';\nexport {\n type DeliverEventToListenerParams,\n type DeliverEventToListenerResult,\n deliverEventToListener,\n} from './job-listener-events.js';\nexport type {\n ActivateJobListenerParams,\n ActivateJobListenerResult,\n DrainListenerEventsParams,\n DrainListenerEventsResult,\n ListenerBufferPeek,\n} from './job-listeners.js';\nexport {\n activateJobListener,\n countActiveListeners,\n drainListenerEventsIntoExecution,\n peekListenerBuffer,\n resolveJobListener,\n settleListenerJobExecution,\n} from './job-listeners.js';\nexport {workflowsOutbox} from './schema/outbox.js';\nexport {workflowRunCounters} from './schema/workflow-run-counters.js';\nexport type {\n BulkUpdateStepStatusesParams,\n CancelWorkflowRunParams,\n CreateRerunWorkflowRunParams,\n CreateWorkflowRunParams,\n EvaluateJobActivationsParams,\n FailWorkflowRunAsTimedOutParams,\n JobActivationDecision,\n ListWorkflowRunsParams,\n ListWorkflowRunsResult,\n StepAttemptDetail,\n UpdateJobExecutionStatusParams,\n UpdateJobStatusParams,\n UpdateWorkflowRunStatusParams,\n WorkflowJobExecutionDepth,\n WorkflowJobExecutionDepthParams,\n WorkflowRunAggregates,\n WorkflowRunFilters,\n WorkflowRunJobStatusCount,\n WorkflowRunJobSummary,\n WorkflowRunJobSummaryTarget,\n WorkflowRunJobsSummary,\n} from './workflow-runs.js';\nexport {\n bulkUpdateStepStatuses,\n cancelWorkflowRun,\n createRerunWorkflowRun,\n createWorkflowRun,\n evaluateJobActivations,\n failJobExecutionAsTimedOut,\n failWorkflowRunAsTimedOut,\n getFirstJobExecutionByJobId,\n getJobById,\n getJobExecutionById,\n getJobExecutionDetail,\n getJobExecutionFailureOrigin,\n getJobExecutionsByJobId,\n getJobExecutionsByWorkflowRunAttemptId,\n getJobScope,\n getJobsByWorkflowRunAttemptId,\n getJobsByWorkflowRunId,\n getLatestAttempt,\n getLatestJobExecutionByJobId,\n getStepAttemptDetail,\n getStepAttempts,\n getStepAttemptsByJobIds,\n getStepById,\n getStepByIdForJobExecution,\n getStepsByJobExecutionId,\n getStepsByJobExecutionIdForUpdate,\n getWorkflowJobExecutionDepth,\n getWorkflowRunAggregates,\n getWorkflowRunAttemptById,\n getWorkflowRunByAttemptId,\n getWorkflowRunById,\n getWorkflowRunDetail,\n listRunAttempts,\n listWorkflowRunJobSummaries,\n listWorkflowRuns,\n listWorkflowRunsByProject,\n recordJobExecutionQueuedAt,\n recordJobExecutionStartedAt,\n resolveJobExecutionAfterLeaseExpiry,\n resolveJobStatusFromJobExecutions,\n updateJobExecutionStatus,\n updateJobStatus,\n updateWorkflowRunStatus,\n} from './workflow-runs.js';\n\nexport const migrationsPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../drizzle');\n"],"names":["dirname","resolve","fileURLToPath","closeDb","db","schema","deliverEventToListener","activateJobListener","countActiveListeners","drainListenerEventsIntoExecution","peekListenerBuffer","resolveJobListener","settleListenerJobExecution","workflowsOutbox","workflowRunCounters","bulkUpdateStepStatuses","cancelWorkflowRun","createRerunWorkflowRun","createWorkflowRun","evaluateJobActivations","failJobExecutionAsTimedOut","failWorkflowRunAsTimedOut","getFirstJobExecutionByJobId","getJobById","getJobExecutionById","getJobExecutionDetail","getJobExecutionFailureOrigin","getJobExecutionsByJobId","getJobExecutionsByWorkflowRunAttemptId","getJobScope","getJobsByWorkflowRunAttemptId","getJobsByWorkflowRunId","getLatestAttempt","getLatestJobExecutionByJobId","getStepAttemptDetail","getStepAttempts","getStepAttemptsByJobIds","getStepById","getStepByIdForJobExecution","getStepsByJobExecutionId","getStepsByJobExecutionIdForUpdate","getWorkflowJobExecutionDepth","getWorkflowRunAggregates","getWorkflowRunAttemptById","getWorkflowRunByAttemptId","getWorkflowRunById","getWorkflowRunDetail","listRunAttempts","listWorkflowRunJobSummaries","listWorkflowRuns","listWorkflowRunsByProject","recordJobExecutionQueuedAt","recordJobExecutionStartedAt","resolveJobExecutionAfterLeaseExpiry","resolveJobStatusFromJobExecutions","updateJobExecutionStatus","updateJobStatus","updateWorkflowRunStatus","migrationsPath","url"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAEvC,SAAQC,OAAO,EAAEC,EAAE,EAAEC,MAAM,QAAO,UAAU;AAC5C,SAGEC,sBAAsB,QACjB,2BAA2B;AAQlC,SACEC,mBAAmB,EACnBC,oBAAoB,EACpBC,gCAAgC,EAChCC,kBAAkB,EAClBC,kBAAkB,EAClBC,0BAA0B,QACrB,qBAAqB;AAC5B,SAAQC,eAAe,QAAO,qBAAqB;AACnD,SAAQC,mBAAmB,QAAO,oCAAoC;
|
|
1
|
+
{"version":3,"sources":["../../src/db/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\n\nexport {closeDb, db, schema} from './db.js';\nexport {\n type DeliverEventToListenerParams,\n type DeliverEventToListenerResult,\n deliverEventToListener,\n} from './job-listener-events.js';\nexport type {\n ActivateJobListenerParams,\n ActivateJobListenerResult,\n DrainListenerEventsParams,\n DrainListenerEventsResult,\n ListenerBufferPeek,\n} from './job-listeners.js';\nexport {\n activateJobListener,\n countActiveListeners,\n drainListenerEventsIntoExecution,\n peekListenerBuffer,\n resolveJobListener,\n settleListenerJobExecution,\n} from './job-listeners.js';\nexport {workflowsOutbox} from './schema/outbox.js';\nexport {workflowRunCounters} from './schema/workflow-run-counters.js';\nexport type {\n BulkUpdateStepStatusesParams,\n CancelWorkflowRunParams,\n CreateRerunWorkflowRunParams,\n CreateWorkflowRunParams,\n EvaluateJobActivationsParams,\n FailWorkflowRunAsTimedOutParams,\n JobActivationDecision,\n ListWorkflowRunsParams,\n ListWorkflowRunsResult,\n StepAttemptDetail,\n UpdateJobExecutionStatusParams,\n UpdateJobStatusParams,\n UpdateWorkflowRunStatusParams,\n WorkflowJobExecutionDepth,\n WorkflowJobExecutionDepthParams,\n WorkflowRunAggregates,\n WorkflowRunFilters,\n WorkflowRunJobRawStatusCount,\n WorkflowRunJobStatusCount,\n WorkflowRunJobSummary,\n WorkflowRunJobSummaryTarget,\n WorkflowRunJobsSummary,\n} from './workflow-runs.js';\nexport {\n bulkUpdateStepStatuses,\n cancelWorkflowRun,\n createRerunWorkflowRun,\n createWorkflowRun,\n evaluateJobActivations,\n failJobExecutionAsTimedOut,\n failWorkflowRunAsTimedOut,\n getFirstJobExecutionByJobId,\n getJobById,\n getJobExecutionById,\n getJobExecutionDetail,\n getJobExecutionFailureOrigin,\n getJobExecutionsByJobId,\n getJobExecutionsByWorkflowRunAttemptId,\n getJobScope,\n getJobsByWorkflowRunAttemptId,\n getJobsByWorkflowRunId,\n getLatestAttempt,\n getLatestJobExecutionByJobId,\n getStepAttemptDetail,\n getStepAttempts,\n getStepAttemptsByJobIds,\n getStepById,\n getStepByIdForJobExecution,\n getStepsByJobExecutionId,\n getStepsByJobExecutionIdForUpdate,\n getWorkflowJobExecutionDepth,\n getWorkflowRunAggregates,\n getWorkflowRunAttemptById,\n getWorkflowRunByAttemptId,\n getWorkflowRunById,\n getWorkflowRunDetail,\n listRunAttempts,\n listWorkflowRunJobSummaries,\n listWorkflowRuns,\n listWorkflowRunsByProject,\n recordJobExecutionQueuedAt,\n recordJobExecutionStartedAt,\n resolveJobExecutionAfterLeaseExpiry,\n resolveJobStatusFromJobExecutions,\n updateJobExecutionStatus,\n updateJobStatus,\n updateWorkflowRunStatus,\n} from './workflow-runs.js';\n\nexport const migrationsPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../drizzle');\n"],"names":["dirname","resolve","fileURLToPath","closeDb","db","schema","deliverEventToListener","activateJobListener","countActiveListeners","drainListenerEventsIntoExecution","peekListenerBuffer","resolveJobListener","settleListenerJobExecution","workflowsOutbox","workflowRunCounters","bulkUpdateStepStatuses","cancelWorkflowRun","createRerunWorkflowRun","createWorkflowRun","evaluateJobActivations","failJobExecutionAsTimedOut","failWorkflowRunAsTimedOut","getFirstJobExecutionByJobId","getJobById","getJobExecutionById","getJobExecutionDetail","getJobExecutionFailureOrigin","getJobExecutionsByJobId","getJobExecutionsByWorkflowRunAttemptId","getJobScope","getJobsByWorkflowRunAttemptId","getJobsByWorkflowRunId","getLatestAttempt","getLatestJobExecutionByJobId","getStepAttemptDetail","getStepAttempts","getStepAttemptsByJobIds","getStepById","getStepByIdForJobExecution","getStepsByJobExecutionId","getStepsByJobExecutionIdForUpdate","getWorkflowJobExecutionDepth","getWorkflowRunAggregates","getWorkflowRunAttemptById","getWorkflowRunByAttemptId","getWorkflowRunById","getWorkflowRunDetail","listRunAttempts","listWorkflowRunJobSummaries","listWorkflowRuns","listWorkflowRunsByProject","recordJobExecutionQueuedAt","recordJobExecutionStartedAt","resolveJobExecutionAfterLeaseExpiry","resolveJobStatusFromJobExecutions","updateJobExecutionStatus","updateJobStatus","updateWorkflowRunStatus","migrationsPath","url"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAEvC,SAAQC,OAAO,EAAEC,EAAE,EAAEC,MAAM,QAAO,UAAU;AAC5C,SAGEC,sBAAsB,QACjB,2BAA2B;AAQlC,SACEC,mBAAmB,EACnBC,oBAAoB,EACpBC,gCAAgC,EAChCC,kBAAkB,EAClBC,kBAAkB,EAClBC,0BAA0B,QACrB,qBAAqB;AAC5B,SAAQC,eAAe,QAAO,qBAAqB;AACnD,SAAQC,mBAAmB,QAAO,oCAAoC;AAyBtE,SACEC,sBAAsB,EACtBC,iBAAiB,EACjBC,sBAAsB,EACtBC,iBAAiB,EACjBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,2BAA2B,EAC3BC,UAAU,EACVC,mBAAmB,EACnBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,uBAAuB,EACvBC,sCAAsC,EACtCC,WAAW,EACXC,6BAA6B,EAC7BC,sBAAsB,EACtBC,gBAAgB,EAChBC,4BAA4B,EAC5BC,oBAAoB,EACpBC,eAAe,EACfC,uBAAuB,EACvBC,WAAW,EACXC,0BAA0B,EAC1BC,wBAAwB,EACxBC,iCAAiC,EACjCC,4BAA4B,EAC5BC,wBAAwB,EACxBC,yBAAyB,EACzBC,yBAAyB,EACzBC,kBAAkB,EAClBC,oBAAoB,EACpBC,eAAe,EACfC,2BAA2B,EAC3BC,gBAAgB,EAChBC,yBAAyB,EACzBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mCAAmC,EACnCC,iCAAiC,EACjCC,wBAAwB,EACxBC,eAAe,EACfC,uBAAuB,QAClB,qBAAqB;AAE5B,OAAO,MAAMC,iBAAiBzD,QAAQD,QAAQE,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,CAAC;AAC7C,MAAM,MAAM,WAAW,GAAG,OAAO,IAAI,CAAC,YAAY,CAAC;AAEnD,wBAAgB,KAAK,CAAC,GAAG,EAAE,KAAK,GAAG,GAAG,CAmCrC"}
|
package/dist/db/schema/jobs.js
CHANGED
|
@@ -44,6 +44,9 @@ export const jobs = pgTable('jobs', {
|
|
|
44
44
|
key: text('key').notNull(),
|
|
45
45
|
mode: jobModeEnum('mode').notNull().default('one_shot'),
|
|
46
46
|
name: text('name'),
|
|
47
|
+
// This is the job's execution verdict, not its runtime lifecycle. Active execution state
|
|
48
|
+
// lives on job_executions and must be read there when a surface needs to distinguish
|
|
49
|
+
// waiting from executing.
|
|
47
50
|
status: jobStatusEnum('status').notNull().default('pending'),
|
|
48
51
|
statusReason: jobStatusReasonEnum('status_reason'),
|
|
49
52
|
carriedOver: boolean('carried_over').notNull().default(false),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/db/schema/jobs.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {\n bigint,\n boolean,\n index,\n integer,\n jsonb,\n pgEnum,\n text,\n timestamp,\n uuid,\n} from 'drizzle-orm/pg-core';\nimport {\n JOB_STATUS_REASONS,\n type Job,\n type JobListeningTrigger,\n toJobStatusReason,\n} from '#core/entities/job.js';\nimport type {PersistedEvaluationTraceEntry} from '#core/entities/step.js';\nimport {pgTable} from './common.js';\nimport {workflowRunAttempts} from './workflow-run-attempts.js';\n\nexport const jobStatusEnum = pgEnum('workflows_job_status', [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n]);\n\nexport const jobStatusReasonEnum = pgEnum('workflows_job_status_reason', JOB_STATUS_REASONS);\n\nexport const jobModeEnum = pgEnum('workflows_job_mode', ['one_shot', 'listening']);\n\nexport const jobCheckoutContentsEnum = pgEnum('workflows_checkout_contents', ['read', 'write']);\n\nexport const jobOnResolveEnum = pgEnum('workflows_job_on_resolve', ['finish', 'cancel']);\n\nexport const listenerStatusEnum = pgEnum('workflows_listener_status', [\n 'inactive',\n 'listening',\n 'resolved',\n]);\n\nexport const resolutionReasonEnum = pgEnum('workflows_resolution_reason', [\n 'until',\n 'timeout',\n 'max_executions',\n 'cancelled',\n]);\n\nexport const jobs = pgTable(\n 'jobs',\n {\n id: uuidv7PrimaryKey(),\n workflowRunAttemptId: uuid('workflow_run_attempt_id')\n .notNull()\n .references(() => workflowRunAttempts.id, {onDelete: 'cascade'}),\n key: text('key').notNull(),\n mode: jobModeEnum('mode').notNull().default('one_shot'),\n name: text('name'),\n status: jobStatusEnum('status').notNull().default('pending'),\n statusReason: jobStatusReasonEnum('status_reason'),\n carriedOver: boolean('carried_over').notNull().default(false),\n checkoutPersistCredentials: boolean('checkout_persist_credentials').notNull(),\n checkoutPermissionsContents: jobCheckoutContentsEnum('checkout_permissions_contents').notNull(),\n success: text('success'),\n evaluationTrace: jsonb('evaluation_trace').$type<readonly PersistedEvaluationTraceEntry[]>(),\n executionTimeoutMs: integer('execution_timeout_ms'),\n listeningTimeoutMs: bigint('listening_timeout_ms', {mode: 'number'}),\n maxExecutions: integer('max_executions'),\n onResolve: jobOnResolveEnum('on_resolve'),\n batchDebounceMs: integer('batch_debounce_ms'),\n batchMaxSize: integer('batch_max_size'),\n batchMaxWaitMs: integer('batch_max_wait_ms'),\n listenerStatus: listenerStatusEnum('listener_status').notNull().default('inactive'),\n resolutionReason: resolutionReasonEnum('resolution_reason'),\n listeningOn: jsonb('listening_on').$type<JobListeningTrigger[]>(),\n listeningUntil: jsonb('listening_until').$type<JobListeningTrigger[]>(),\n outputs: jsonb('outputs').$type<Record<string, unknown> | null>(),\n dependencies: jsonb('dependencies').notNull().$type<string[]>(),\n runner: jsonb('runner').$type<string[]>(),\n position: integer('position').notNull(),\n version: integer('version').notNull().default(1),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n index('workflows_jobs_workflow_run_attempt_id_idx').on(table.workflowRunAttemptId),\n index('workflows_jobs_active_listeners_idx')\n .on(table.listenerStatus)\n .where(sql`${table.listenerStatus} = 'listening'`),\n ],\n);\n\nexport type JobDb = typeof jobs.$inferSelect;\nexport type JobCreateDb = typeof jobs.$inferInsert;\n\nexport function toJob(row: JobDb): Job {\n return {\n id: row.id,\n workflowRunAttemptId: row.workflowRunAttemptId,\n key: row.key,\n name: row.name,\n mode: row.mode,\n status: row.status,\n statusReason: toJobStatusReason(row.statusReason),\n carriedOver: row.carriedOver,\n checkout: {\n permissions: {contents: row.checkoutPermissionsContents},\n persistCredentials: row.checkoutPersistCredentials,\n },\n success: row.success,\n evaluationTrace: row.evaluationTrace ?? null,\n executionTimeoutMs: row.executionTimeoutMs,\n listeningTimeoutMs: row.listeningTimeoutMs,\n maxExecutions: row.maxExecutions,\n onResolve: row.onResolve,\n batchDebounceMs: row.batchDebounceMs,\n batchMaxSize: row.batchMaxSize,\n batchMaxWaitMs: row.batchMaxWaitMs,\n listenerStatus: row.listenerStatus,\n resolutionReason: row.resolutionReason,\n listeningOn: row.listeningOn,\n listeningUntil: row.listeningUntil,\n outputs: row.outputs,\n dependencies: row.dependencies as string[],\n runner: row.runner as string[] | null,\n position: row.position,\n version: row.version,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","sql","bigint","boolean","index","integer","jsonb","pgEnum","text","timestamp","uuid","JOB_STATUS_REASONS","toJobStatusReason","pgTable","workflowRunAttempts","jobStatusEnum","jobStatusReasonEnum","jobModeEnum","jobCheckoutContentsEnum","jobOnResolveEnum","listenerStatusEnum","resolutionReasonEnum","jobs","id","workflowRunAttemptId","notNull","references","onDelete","key","mode","default","name","status","statusReason","carriedOver","checkoutPersistCredentials","checkoutPermissionsContents","success","evaluationTrace","$type","executionTimeoutMs","listeningTimeoutMs","maxExecutions","onResolve","batchDebounceMs","batchMaxSize","batchMaxWaitMs","listenerStatus","resolutionReason","listeningOn","listeningUntil","outputs","dependencies","runner","position","version","createdAt","withTimezone","defaultNow","updatedAt","table","on","where","toJob","row","checkout","permissions","contents","persistCredentials"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,GAAG,QAAO,cAAc;AAChC,SACEC,MAAM,EACNC,OAAO,EACPC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,IAAI,QACC,sBAAsB;AAC7B,SACEC,kBAAkB,EAGlBC,iBAAiB,QACZ,wBAAwB;AAE/B,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,mBAAmB,QAAO,6BAA6B;AAE/D,OAAO,MAAMC,gBAAgBR,OAAO,wBAAwB;IAC1D;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH,OAAO,MAAMS,sBAAsBT,OAAO,+BAA+BI,oBAAoB;AAE7F,OAAO,MAAMM,cAAcV,OAAO,sBAAsB;IAAC;IAAY;CAAY,EAAE;AAEnF,OAAO,MAAMW,0BAA0BX,OAAO,+BAA+B;IAAC;IAAQ;CAAQ,EAAE;AAEhG,OAAO,MAAMY,mBAAmBZ,OAAO,4BAA4B;IAAC;IAAU;CAAS,EAAE;AAEzF,OAAO,MAAMa,qBAAqBb,OAAO,6BAA6B;IACpE;IACA;IACA;CACD,EAAE;AAEH,OAAO,MAAMc,uBAAuBd,OAAO,+BAA+B;IACxE;IACA;IACA;IACA;CACD,EAAE;AAEH,OAAO,MAAMe,OAAOT,QAClB,QACA;IACEU,IAAIvB;IACJwB,sBAAsBd,KAAK,2BACxBe,OAAO,GACPC,UAAU,CAAC,IAAMZ,oBAAoBS,EAAE,EAAE;QAACI,UAAU;IAAS;IAChEC,KAAKpB,KAAK,OAAOiB,OAAO;IACxBI,MAAMZ,YAAY,QAAQQ,OAAO,GAAGK,OAAO,CAAC;IAC5CC,MAAMvB,KAAK;
|
|
1
|
+
{"version":3,"sources":["../../../src/db/schema/jobs.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {sql} from 'drizzle-orm';\nimport {\n bigint,\n boolean,\n index,\n integer,\n jsonb,\n pgEnum,\n text,\n timestamp,\n uuid,\n} from 'drizzle-orm/pg-core';\nimport {\n JOB_STATUS_REASONS,\n type Job,\n type JobListeningTrigger,\n toJobStatusReason,\n} from '#core/entities/job.js';\nimport type {PersistedEvaluationTraceEntry} from '#core/entities/step.js';\nimport {pgTable} from './common.js';\nimport {workflowRunAttempts} from './workflow-run-attempts.js';\n\nexport const jobStatusEnum = pgEnum('workflows_job_status', [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n]);\n\nexport const jobStatusReasonEnum = pgEnum('workflows_job_status_reason', JOB_STATUS_REASONS);\n\nexport const jobModeEnum = pgEnum('workflows_job_mode', ['one_shot', 'listening']);\n\nexport const jobCheckoutContentsEnum = pgEnum('workflows_checkout_contents', ['read', 'write']);\n\nexport const jobOnResolveEnum = pgEnum('workflows_job_on_resolve', ['finish', 'cancel']);\n\nexport const listenerStatusEnum = pgEnum('workflows_listener_status', [\n 'inactive',\n 'listening',\n 'resolved',\n]);\n\nexport const resolutionReasonEnum = pgEnum('workflows_resolution_reason', [\n 'until',\n 'timeout',\n 'max_executions',\n 'cancelled',\n]);\n\nexport const jobs = pgTable(\n 'jobs',\n {\n id: uuidv7PrimaryKey(),\n workflowRunAttemptId: uuid('workflow_run_attempt_id')\n .notNull()\n .references(() => workflowRunAttempts.id, {onDelete: 'cascade'}),\n key: text('key').notNull(),\n mode: jobModeEnum('mode').notNull().default('one_shot'),\n name: text('name'),\n // This is the job's execution verdict, not its runtime lifecycle. Active execution state\n // lives on job_executions and must be read there when a surface needs to distinguish\n // waiting from executing.\n status: jobStatusEnum('status').notNull().default('pending'),\n statusReason: jobStatusReasonEnum('status_reason'),\n carriedOver: boolean('carried_over').notNull().default(false),\n checkoutPersistCredentials: boolean('checkout_persist_credentials').notNull(),\n checkoutPermissionsContents: jobCheckoutContentsEnum('checkout_permissions_contents').notNull(),\n success: text('success'),\n evaluationTrace: jsonb('evaluation_trace').$type<readonly PersistedEvaluationTraceEntry[]>(),\n executionTimeoutMs: integer('execution_timeout_ms'),\n listeningTimeoutMs: bigint('listening_timeout_ms', {mode: 'number'}),\n maxExecutions: integer('max_executions'),\n onResolve: jobOnResolveEnum('on_resolve'),\n batchDebounceMs: integer('batch_debounce_ms'),\n batchMaxSize: integer('batch_max_size'),\n batchMaxWaitMs: integer('batch_max_wait_ms'),\n listenerStatus: listenerStatusEnum('listener_status').notNull().default('inactive'),\n resolutionReason: resolutionReasonEnum('resolution_reason'),\n listeningOn: jsonb('listening_on').$type<JobListeningTrigger[]>(),\n listeningUntil: jsonb('listening_until').$type<JobListeningTrigger[]>(),\n outputs: jsonb('outputs').$type<Record<string, unknown> | null>(),\n dependencies: jsonb('dependencies').notNull().$type<string[]>(),\n runner: jsonb('runner').$type<string[]>(),\n position: integer('position').notNull(),\n version: integer('version').notNull().default(1),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n index('workflows_jobs_workflow_run_attempt_id_idx').on(table.workflowRunAttemptId),\n index('workflows_jobs_active_listeners_idx')\n .on(table.listenerStatus)\n .where(sql`${table.listenerStatus} = 'listening'`),\n ],\n);\n\nexport type JobDb = typeof jobs.$inferSelect;\nexport type JobCreateDb = typeof jobs.$inferInsert;\n\nexport function toJob(row: JobDb): Job {\n return {\n id: row.id,\n workflowRunAttemptId: row.workflowRunAttemptId,\n key: row.key,\n name: row.name,\n mode: row.mode,\n status: row.status,\n statusReason: toJobStatusReason(row.statusReason),\n carriedOver: row.carriedOver,\n checkout: {\n permissions: {contents: row.checkoutPermissionsContents},\n persistCredentials: row.checkoutPersistCredentials,\n },\n success: row.success,\n evaluationTrace: row.evaluationTrace ?? null,\n executionTimeoutMs: row.executionTimeoutMs,\n listeningTimeoutMs: row.listeningTimeoutMs,\n maxExecutions: row.maxExecutions,\n onResolve: row.onResolve,\n batchDebounceMs: row.batchDebounceMs,\n batchMaxSize: row.batchMaxSize,\n batchMaxWaitMs: row.batchMaxWaitMs,\n listenerStatus: row.listenerStatus,\n resolutionReason: row.resolutionReason,\n listeningOn: row.listeningOn,\n listeningUntil: row.listeningUntil,\n outputs: row.outputs,\n dependencies: row.dependencies as string[],\n runner: row.runner as string[] | null,\n position: row.position,\n version: row.version,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","sql","bigint","boolean","index","integer","jsonb","pgEnum","text","timestamp","uuid","JOB_STATUS_REASONS","toJobStatusReason","pgTable","workflowRunAttempts","jobStatusEnum","jobStatusReasonEnum","jobModeEnum","jobCheckoutContentsEnum","jobOnResolveEnum","listenerStatusEnum","resolutionReasonEnum","jobs","id","workflowRunAttemptId","notNull","references","onDelete","key","mode","default","name","status","statusReason","carriedOver","checkoutPersistCredentials","checkoutPermissionsContents","success","evaluationTrace","$type","executionTimeoutMs","listeningTimeoutMs","maxExecutions","onResolve","batchDebounceMs","batchMaxSize","batchMaxWaitMs","listenerStatus","resolutionReason","listeningOn","listeningUntil","outputs","dependencies","runner","position","version","createdAt","withTimezone","defaultNow","updatedAt","table","on","where","toJob","row","checkout","permissions","contents","persistCredentials"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,GAAG,QAAO,cAAc;AAChC,SACEC,MAAM,EACNC,OAAO,EACPC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,IAAI,QACC,sBAAsB;AAC7B,SACEC,kBAAkB,EAGlBC,iBAAiB,QACZ,wBAAwB;AAE/B,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,mBAAmB,QAAO,6BAA6B;AAE/D,OAA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B,IAAI3B,OAAO;QACpBC,iBAAiB0B,IAAI1B,eAAe,IAAI;QACxCE,oBAAoBwB,IAAIxB,kBAAkB;QAC1CC,oBAAoBuB,IAAIvB,kBAAkB;QAC1CC,eAAesB,IAAItB,aAAa;QAChCC,WAAWqB,IAAIrB,SAAS;QACxBC,iBAAiBoB,IAAIpB,eAAe;QACpCC,cAAcmB,IAAInB,YAAY;QAC9BC,gBAAgBkB,IAAIlB,cAAc;QAClCC,gBAAgBiB,IAAIjB,cAAc;QAClCC,kBAAkBgB,IAAIhB,gBAAgB;QACtCC,aAAae,IAAIf,WAAW;QAC5BC,gBAAgBc,IAAId,cAAc;QAClCC,SAASa,IAAIb,OAAO;QACpBC,cAAcY,IAAIZ,YAAY;QAC9BC,QAAQW,IAAIX,MAAM;QAClBC,UAAUU,IAAIV,QAAQ;QACtBC,SAASS,IAAIT,OAAO;QACpBC,WAAWQ,IAAIR,SAAS;QACxBG,WAAWK,IAAIL,SAAS;IAC1B;AACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type TimestampIdCursor } from '@shipfox/node-drizzle';
|
|
2
2
|
import { type SQL } from 'drizzle-orm';
|
|
3
|
-
import type { JobStatus } from '#core/entities/job.js';
|
|
3
|
+
import type { JobMode, JobStatus, ListenerStatus } from '#core/entities/job.js';
|
|
4
|
+
import type { JobExecutionStatus } from '#core/entities/job-execution.js';
|
|
4
5
|
import type { JobExecutionDetail, WorkflowRun, WorkflowRunDetail, WorkflowRunStatus } from '#core/entities/workflow-run.js';
|
|
5
6
|
export type WorkflowRunCursor = TimestampIdCursor;
|
|
6
7
|
export interface WorkflowRunFilters {
|
|
@@ -28,6 +29,9 @@ export interface WorkflowRunJobSummary {
|
|
|
28
29
|
key: string;
|
|
29
30
|
name: string | null;
|
|
30
31
|
status: JobStatus;
|
|
32
|
+
mode: JobMode;
|
|
33
|
+
listenerStatus: ListenerStatus;
|
|
34
|
+
executionStatus: JobExecutionStatus | null;
|
|
31
35
|
position: number;
|
|
32
36
|
}
|
|
33
37
|
export interface WorkflowRunAggregates {
|
|
@@ -75,16 +79,26 @@ export interface WorkflowRunJobSummaryTarget {
|
|
|
75
79
|
currentAttempt: number;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
|
-
* A page row's jobs: a bounded slice to draw,
|
|
82
|
+
* A page row's jobs: a bounded slice to draw, totals describing all of them, and whether any
|
|
83
|
+
* execution has reached a runner.
|
|
79
84
|
*
|
|
80
85
|
* The preview is what a row can show; `statusCounts` is what it can say. Keeping the counts
|
|
81
|
-
* server-side is what lets a row report a failure that sits past the preview.
|
|
86
|
+
* server-side is what lets a row report a failure that sits past the preview. Counts use the
|
|
87
|
+
* display status derived from the job verdict, listener state, and selected execution state;
|
|
88
|
+
* the row keeps the verdict and evidence separate so the client can apply the same display
|
|
89
|
+
* rule as run detail.
|
|
82
90
|
*/
|
|
83
91
|
export interface WorkflowRunJobsSummary {
|
|
84
92
|
preview: WorkflowRunJobSummary[];
|
|
85
93
|
statusCounts: WorkflowRunJobStatusCount[];
|
|
94
|
+
rawStatusCounts: WorkflowRunJobRawStatusCount[];
|
|
95
|
+
hasStartedJobExecution: boolean;
|
|
86
96
|
}
|
|
87
97
|
export interface WorkflowRunJobStatusCount {
|
|
98
|
+
status: JobStatus | 'listening';
|
|
99
|
+
count: number;
|
|
100
|
+
}
|
|
101
|
+
export interface WorkflowRunJobRawStatusCount {
|
|
88
102
|
status: JobStatus;
|
|
89
103
|
count: number;
|
|
90
104
|
}
|
|
@@ -104,8 +118,8 @@ export interface WorkflowRunJobStatusCount {
|
|
|
104
118
|
* attempt 1's run metadata with attempt 2's jobs, and the row would report a status its strip
|
|
105
119
|
* contradicts.
|
|
106
120
|
*
|
|
107
|
-
* The
|
|
108
|
-
* instant, and the strip combines them into a single glyph row, so under the default
|
|
121
|
+
* The reads share one repeatable-read snapshot. They describe the same jobs and executions at
|
|
122
|
+
* the same instant, and the strip combines them into a single glyph row, so under the default
|
|
109
123
|
* read-committed isolation a job settling between the statements would draw a pending glyph
|
|
110
124
|
* beside a summary counting it as failed. Sequential inside one transaction is the cost of
|
|
111
125
|
* that; at a four-second poll the extra round trip does not register.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/queries.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsC,KAAK,GAAG,EAAM,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/queries.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsC,KAAK,GAAG,EAAM,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EACV,kBAAkB,EAGlB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,gCAAgC,CAAC;AASxC,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,M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B;IAC3C,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,SAAS,2BAA2B,EAAE,GAC3C,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAqI9C;AA+BD,wBAAsB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAGzF;AAED,wBAAsB,wBAAwB,CAAC,MAAM,EAAE;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CAC1C,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAgDjC;AAED,wBAAsB,4BAA4B,CAChD,MAAM,GAAE,+BAAoC,GAC3C,OAAO,CAAC,yBAAyB,CAAC,CA0BpC;AAED,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAC3B,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CA+CxC;AAED,wBAAsB,qBAAqB,CACzC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAwCzC"}
|
|
@@ -107,8 +107,8 @@ export async function listWorkflowRuns(params) {
|
|
|
107
107
|
* attempt 1's run metadata with attempt 2's jobs, and the row would report a status its strip
|
|
108
108
|
* contradicts.
|
|
109
109
|
*
|
|
110
|
-
* The
|
|
111
|
-
* instant, and the strip combines them into a single glyph row, so under the default
|
|
110
|
+
* The reads share one repeatable-read snapshot. They describe the same jobs and executions at
|
|
111
|
+
* the same instant, and the strip combines them into a single glyph row, so under the default
|
|
112
112
|
* read-committed isolation a job settling between the statements would draw a pending glyph
|
|
113
113
|
* beside a summary counting it as failed. Sequential inside one transaction is the cost of
|
|
114
114
|
* that; at a four-second poll the extra round trip does not register.
|
|
@@ -120,15 +120,47 @@ export async function listWorkflowRuns(params) {
|
|
|
120
120
|
const attemptPairs = sql.join(runs.map((run)=>sql`(${run.id}::uuid, ${run.currentAttempt})`), sql`, `);
|
|
121
121
|
const attemptFilter = sql`(${workflowRunAttempts.workflowRunId}, ${workflowRunAttempts.attempt}) in (${attemptPairs})`;
|
|
122
122
|
const { previewRows, countRows } = await db().transaction(async (tx)=>{
|
|
123
|
-
|
|
123
|
+
// Pick the execution the detail view would display once per job before either list
|
|
124
|
+
// statement touches it. The existing (job_id, sequence) index supports the latest
|
|
125
|
+
// execution ordering, while the status-first expression preserves the rule that an
|
|
126
|
+
// active execution wins over a newer completed retry.
|
|
127
|
+
const selectedExecution = tx.$with('selected_execution').as(tx.selectDistinctOn([
|
|
128
|
+
jobExecutions.jobId
|
|
129
|
+
], {
|
|
130
|
+
jobId: jobExecutions.jobId,
|
|
131
|
+
executionStatus: sql`${jobExecutions.status}`.as('execution_status')
|
|
132
|
+
}).from(jobExecutions).innerJoin(jobs, eq(jobExecutions.jobId, jobs.id)).innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id)).where(attemptFilter).orderBy(asc(jobExecutions.jobId), sql`case when ${jobExecutions.status} = 'running' then 0 else 1 end`, desc(jobExecutions.sequence), desc(jobExecutions.id)));
|
|
133
|
+
const ranked = tx.with(selectedExecution).select({
|
|
124
134
|
workflowRunId: workflowRunAttempts.workflowRunId,
|
|
125
135
|
id: jobs.id,
|
|
126
136
|
key: jobs.key,
|
|
127
137
|
name: jobs.name,
|
|
128
138
|
status: jobs.status,
|
|
139
|
+
mode: jobs.mode,
|
|
140
|
+
listenerStatus: jobs.listenerStatus,
|
|
141
|
+
executionStatus: selectedExecution.executionStatus,
|
|
129
142
|
position: jobs.position,
|
|
130
|
-
|
|
131
|
-
}).from(jobs).innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id)).where(attemptFilter).as('ranked');
|
|
143
|
+
jobRank: sql`row_number() over (partition by ${workflowRunAttempts.workflowRunId} order by ${jobs.position} asc, ${jobs.id} asc)`.as('job_rank')
|
|
144
|
+
}).from(jobs).innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id)).leftJoin(selectedExecution, eq(selectedExecution.jobId, jobs.id)).where(attemptFilter).as('ranked');
|
|
145
|
+
// Correlated per job rather than a grouped scan of `job_executions`: an aggregate over the
|
|
146
|
+
// whole table cannot have the page's filter pushed into it, so it would read every execution
|
|
147
|
+
// ever recorded on each poll and grow with history rather than with the page.
|
|
148
|
+
const hasStartedJobExecution = sql`bool_or(exists (
|
|
149
|
+
select 1
|
|
150
|
+
from ${jobExecutions}
|
|
151
|
+
where ${jobExecutions.jobId} = ${jobs.id} and ${jobExecutions.startedAt} is not null
|
|
152
|
+
))`;
|
|
153
|
+
const executionDisplayStatus = sql`
|
|
154
|
+
${selectedExecution.executionStatus}
|
|
155
|
+
`;
|
|
156
|
+
const displayStatus = sql`
|
|
157
|
+
case
|
|
158
|
+
when ${jobs.status} in ('succeeded', 'failed', 'cancelled', 'skipped') then ${jobs.status}::text
|
|
159
|
+
when ${jobs.mode} = 'listening' and ${jobs.listenerStatus} = 'listening' then 'listening'
|
|
160
|
+
when ${executionDisplayStatus} is not null then ${executionDisplayStatus}::text
|
|
161
|
+
else 'pending'
|
|
162
|
+
end
|
|
163
|
+
`;
|
|
132
164
|
return {
|
|
133
165
|
previewRows: await tx.select({
|
|
134
166
|
workflowRunId: ranked.workflowRunId,
|
|
@@ -136,13 +168,18 @@ export async function listWorkflowRuns(params) {
|
|
|
136
168
|
key: ranked.key,
|
|
137
169
|
name: ranked.name,
|
|
138
170
|
status: ranked.status,
|
|
171
|
+
mode: ranked.mode,
|
|
172
|
+
listenerStatus: ranked.listenerStatus,
|
|
173
|
+
executionStatus: ranked.executionStatus,
|
|
139
174
|
position: ranked.position
|
|
140
|
-
}).from(ranked).where(lte(ranked.
|
|
141
|
-
countRows: await tx.select({
|
|
175
|
+
}).from(ranked).where(lte(ranked.jobRank, WORKFLOW_RUN_JOB_PREVIEW_LIMIT)).orderBy(asc(ranked.workflowRunId), asc(ranked.position), asc(ranked.id)),
|
|
176
|
+
countRows: await tx.with(selectedExecution).select({
|
|
142
177
|
workflowRunId: workflowRunAttempts.workflowRunId,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
178
|
+
rawStatus: jobs.status,
|
|
179
|
+
status: displayStatus,
|
|
180
|
+
count: count(),
|
|
181
|
+
hasStartedJobExecution
|
|
182
|
+
}).from(jobs).innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id)).leftJoin(selectedExecution, eq(selectedExecution.jobId, jobs.id)).where(attemptFilter).groupBy(workflowRunAttempts.workflowRunId, jobs.status, displayStatus)
|
|
146
183
|
};
|
|
147
184
|
}, {
|
|
148
185
|
isolationLevel: 'repeatable read',
|
|
@@ -151,11 +188,12 @@ export async function listWorkflowRuns(params) {
|
|
|
151
188
|
for (const { workflowRunId, ...summary } of previewRows){
|
|
152
189
|
summaryFor(summaries, workflowRunId).preview.push(summary);
|
|
153
190
|
}
|
|
154
|
-
for (const { workflowRunId, status, count: statusCount } of countRows){
|
|
155
|
-
summaryFor(summaries, workflowRunId)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
191
|
+
for (const { workflowRunId, rawStatus, status, count: statusCount, hasStartedJobExecution } of countRows){
|
|
192
|
+
const summary = summaryFor(summaries, workflowRunId);
|
|
193
|
+
appendStatusCount(summary.rawStatusCounts, rawStatus, statusCount);
|
|
194
|
+
appendStatusCount(summary.statusCounts, status, statusCount);
|
|
195
|
+
// One row per (run, verdict, display status), so the run's answer is the OR of its groups.
|
|
196
|
+
summary.hasStartedJobExecution ||= hasStartedJobExecution;
|
|
159
197
|
}
|
|
160
198
|
return summaries;
|
|
161
199
|
}
|
|
@@ -164,11 +202,24 @@ function summaryFor(summaries, workflowRunId) {
|
|
|
164
202
|
if (existing) return existing;
|
|
165
203
|
const created = {
|
|
166
204
|
preview: [],
|
|
167
|
-
statusCounts: []
|
|
205
|
+
statusCounts: [],
|
|
206
|
+
rawStatusCounts: [],
|
|
207
|
+
hasStartedJobExecution: false
|
|
168
208
|
};
|
|
169
209
|
summaries.set(workflowRunId, created);
|
|
170
210
|
return created;
|
|
171
211
|
}
|
|
212
|
+
function appendStatusCount(counts, status, count) {
|
|
213
|
+
const existing = counts.find((entry)=>entry.status === status);
|
|
214
|
+
if (existing) {
|
|
215
|
+
existing.count += count;
|
|
216
|
+
} else {
|
|
217
|
+
counts.push({
|
|
218
|
+
status,
|
|
219
|
+
count
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
172
223
|
export async function listWorkflowRunsByProject(projectId) {
|
|
173
224
|
const result = await listWorkflowRuns({
|
|
174
225
|
projectId,
|
|
@@ -283,7 +334,9 @@ function hydrateWorkflowRunDetail(rows, attempt, latestAttempt) {
|
|
|
283
334
|
...toWorkflowRun(first.run),
|
|
284
335
|
runAttempt: toWorkflowRunAttempt(attempt),
|
|
285
336
|
latestAttempt,
|
|
286
|
-
jobs: []
|
|
337
|
+
jobs: [],
|
|
338
|
+
// Read off the same rows the executions come from, so the flag cannot contradict them.
|
|
339
|
+
hasStartedJobExecution: rows.some((row)=>row.jobExecution?.startedAt != null)
|
|
287
340
|
};
|
|
288
341
|
const jobById = new Map();
|
|
289
342
|
const jobExecutionById = new Map();
|