@tomflow/proflow-task-migration-runner 0.1.3 → 0.1.5
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/CHANGELOG.md +7 -0
- package/DOCS.md +27 -0
- package/SETUP.md +19 -0
- package/dist/deployment/adapter.d.ts +95 -275
- package/dist/deployment/adapter.js +108 -125
- package/dist/deployment/descriptor.d.ts +6 -26
- package/dist/deployment/descriptor.js +6 -40
- package/package.json +5 -4
- package/proflow.module.json +6 -40
- package/CONFIGURATION.md +0 -23
package/CHANGELOG.md
ADDED
package/DOCS.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @tomflow/proflow-task-migration-runner — Module Docs
|
|
2
|
+
|
|
3
|
+
Module ref: `task-migration-runner`
|
|
4
|
+
Domain: `task-orchestration`
|
|
5
|
+
Kind: `cli`
|
|
6
|
+
|
|
7
|
+
Deterministically discovers, applies and verifies Task Store SQLite schema migrations.
|
|
8
|
+
|
|
9
|
+
## Standard management surface
|
|
10
|
+
|
|
11
|
+
`install / uninstall / status / setup / docs / start / stop`
|
|
12
|
+
|
|
13
|
+
## Provides
|
|
14
|
+
|
|
15
|
+
- None.
|
|
16
|
+
|
|
17
|
+
## Requires
|
|
18
|
+
|
|
19
|
+
- None.
|
|
20
|
+
|
|
21
|
+
## Public setup inputs
|
|
22
|
+
|
|
23
|
+
- None. Deterministic/private values and cross-Module shared facts are not public configuration.
|
|
24
|
+
|
|
25
|
+
## Ownership boundary
|
|
26
|
+
|
|
27
|
+
Module business APIs and any module-specific extra commands remain package-owned. Platform does not proxy or interpret them. Current human/external preparation is documented in `SETUP.md`.
|
package/SETUP.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @tomflow/proflow-task-migration-runner — Module Setup
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Reach `setupStatus=READY` without user configuration.
|
|
6
|
+
|
|
7
|
+
## Step 1 — Complete machine-owned preparation
|
|
8
|
+
|
|
9
|
+
**Type:** automatic
|
|
10
|
+
**Executable:** `platform install`
|
|
11
|
+
**What happens:** No user input is required. Required schema migrations are machine-owned and must run automatically.
|
|
12
|
+
|
|
13
|
+
## Step 2 — Re-observe dependency and setup state
|
|
14
|
+
|
|
15
|
+
**Type:** automatic verification
|
|
16
|
+
**Verify:** `platform status`
|
|
17
|
+
**Success condition:** `task-migration-runner.setupStatus=READY`.
|
|
18
|
+
|
|
19
|
+
There is no human setup action. A missing machine-owned artifact or producer-owned dependency is a `FAILED` condition to fix in the owning package/dependency; it must never be converted into a request for path/token/endpoint input.
|
|
@@ -1,343 +1,163 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
contract: "deployment.result.v1";
|
|
5
|
-
moduleRef: "task-migration-runner";
|
|
6
|
-
moduleVersion: "0.1.3";
|
|
7
|
-
ok: boolean;
|
|
8
|
-
status: "SUCCEEDED";
|
|
9
|
-
data?: {} | null;
|
|
10
|
-
checks?: unknown[];
|
|
11
|
-
};
|
|
12
|
-
observedEffects: never[];
|
|
13
|
-
};
|
|
14
|
-
preflight: () => {
|
|
15
|
-
result: {
|
|
16
|
-
contract: "deployment.result.v1";
|
|
17
|
-
moduleRef: "task-migration-runner";
|
|
18
|
-
moduleVersion: "0.1.3";
|
|
19
|
-
ok: boolean;
|
|
20
|
-
status: "SUCCEEDED";
|
|
21
|
-
data?: {} | null;
|
|
22
|
-
checks?: unknown[];
|
|
23
|
-
} | {
|
|
24
|
-
contract: "deployment.result.v1";
|
|
25
|
-
moduleRef: "task-migration-runner";
|
|
26
|
-
moduleVersion: "0.1.3";
|
|
27
|
-
ok: boolean;
|
|
28
|
-
status: "ACTION_REQUIRED";
|
|
29
|
-
actionRequired: {
|
|
30
|
-
action: string;
|
|
31
|
-
description: string;
|
|
32
|
-
};
|
|
33
|
-
data?: {} | null;
|
|
34
|
-
checks?: unknown[];
|
|
35
|
-
};
|
|
36
|
-
observedEffects: never[];
|
|
37
|
-
};
|
|
38
|
-
status: () => {
|
|
39
|
-
result: {
|
|
40
|
-
contract: "deployment.result.v1";
|
|
41
|
-
moduleRef: "task-migration-runner";
|
|
42
|
-
moduleVersion: "0.1.3";
|
|
43
|
-
ok: boolean;
|
|
44
|
-
status: "SUCCEEDED";
|
|
45
|
-
data?: {} | null;
|
|
46
|
-
checks?: unknown[];
|
|
47
|
-
};
|
|
48
|
-
observedEffects: never[];
|
|
49
|
-
};
|
|
50
|
-
verify: () => {
|
|
51
|
-
result: {
|
|
52
|
-
contract: "deployment.result.v1";
|
|
53
|
-
moduleRef: "task-migration-runner";
|
|
54
|
-
moduleVersion: "0.1.3";
|
|
55
|
-
ok: boolean;
|
|
56
|
-
status: "ACTION_REQUIRED";
|
|
57
|
-
actionRequired: {
|
|
58
|
-
action: string;
|
|
59
|
-
description: string;
|
|
60
|
-
};
|
|
61
|
-
data?: {} | null;
|
|
62
|
-
checks?: unknown[];
|
|
63
|
-
};
|
|
64
|
-
observedEffects: never[];
|
|
65
|
-
} | {
|
|
1
|
+
import type { ModuleCommandContext } from "@tomflow/proflow-module-contract";
|
|
2
|
+
export declare const behaviorAdapter: {
|
|
3
|
+
readonly install: (context: ModuleCommandContext) => Promise<{
|
|
66
4
|
result: {
|
|
67
5
|
contract: "deployment.result.v1";
|
|
68
6
|
moduleRef: "task-migration-runner";
|
|
69
|
-
moduleVersion: "0.1.
|
|
70
|
-
ok:
|
|
71
|
-
status: "SUCCEEDED";
|
|
72
|
-
data?: {} | null;
|
|
73
|
-
checks?: unknown[];
|
|
74
|
-
} | {
|
|
75
|
-
contract: "deployment.result.v1";
|
|
76
|
-
moduleRef: "task-migration-runner";
|
|
77
|
-
moduleVersion: "0.1.3";
|
|
78
|
-
ok: boolean;
|
|
7
|
+
moduleVersion: "0.1.5";
|
|
8
|
+
ok: false;
|
|
79
9
|
status: "FAILED";
|
|
80
10
|
error: {
|
|
81
|
-
code: "APPLY_FAILED"
|
|
11
|
+
code: "APPLY_FAILED";
|
|
82
12
|
message: string;
|
|
83
13
|
retryable: boolean;
|
|
84
14
|
};
|
|
85
|
-
data?: {} | null;
|
|
86
|
-
checks?: unknown[];
|
|
87
|
-
};
|
|
88
|
-
observedEffects: never[];
|
|
89
|
-
};
|
|
90
|
-
doctor: () => {
|
|
91
|
-
result: {
|
|
92
|
-
contract: "deployment.result.v1";
|
|
93
|
-
moduleRef: "task-migration-runner";
|
|
94
|
-
moduleVersion: "0.1.3";
|
|
95
|
-
ok: boolean;
|
|
96
|
-
status: "ACTION_REQUIRED";
|
|
97
|
-
actionRequired: {
|
|
98
|
-
action: string;
|
|
99
|
-
description: string;
|
|
100
|
-
};
|
|
101
|
-
data?: {} | null;
|
|
102
|
-
checks?: unknown[];
|
|
103
15
|
};
|
|
104
16
|
observedEffects: never[];
|
|
105
17
|
} | {
|
|
106
18
|
result: {
|
|
107
19
|
contract: "deployment.result.v1";
|
|
108
|
-
|
|
109
|
-
moduleVersion: "0.1.3";
|
|
110
|
-
ok: boolean;
|
|
20
|
+
ok: true;
|
|
111
21
|
status: "SUCCEEDED";
|
|
112
|
-
data?: {} | null;
|
|
113
|
-
checks?: unknown[];
|
|
114
|
-
} | {
|
|
115
|
-
contract: "deployment.result.v1";
|
|
116
22
|
moduleRef: "task-migration-runner";
|
|
117
|
-
moduleVersion: "0.1.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
code: "VERIFY_FAILED";
|
|
122
|
-
message: string;
|
|
123
|
-
retryable: boolean;
|
|
23
|
+
moduleVersion: "0.1.5";
|
|
24
|
+
data: {
|
|
25
|
+
applied: number[];
|
|
26
|
+
pending: number[];
|
|
124
27
|
};
|
|
125
|
-
|
|
28
|
+
};
|
|
29
|
+
observedEffects: string[];
|
|
30
|
+
}>;
|
|
31
|
+
readonly uninstall: (_context: ModuleCommandContext) => Promise<{
|
|
32
|
+
result: {
|
|
33
|
+
readonly contract: "deployment.result.v1";
|
|
34
|
+
readonly ok: true;
|
|
35
|
+
readonly status: "SUCCEEDED";
|
|
36
|
+
readonly moduleRef: "task-migration-runner";
|
|
37
|
+
readonly moduleVersion: "0.1.5";
|
|
126
38
|
};
|
|
127
39
|
observedEffects: never[];
|
|
128
|
-
}
|
|
129
|
-
|
|
40
|
+
}>;
|
|
41
|
+
readonly status: (context: ModuleCommandContext) => Promise<{
|
|
130
42
|
result: {
|
|
131
43
|
contract: "deployment.result.v1";
|
|
44
|
+
ok: true;
|
|
45
|
+
status: "SUCCEEDED";
|
|
132
46
|
moduleRef: "task-migration-runner";
|
|
133
|
-
moduleVersion: "0.1.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
action: string;
|
|
138
|
-
description: string;
|
|
47
|
+
moduleVersion: "0.1.5";
|
|
48
|
+
data: {
|
|
49
|
+
setupStatus: "FAILED" | "READY";
|
|
50
|
+
runtimeStatus: "NOT_APPLICABLE";
|
|
139
51
|
};
|
|
140
|
-
data?: {} | null;
|
|
141
|
-
checks?: unknown[];
|
|
142
52
|
};
|
|
143
53
|
observedEffects: never[];
|
|
144
|
-
}
|
|
54
|
+
}>;
|
|
55
|
+
readonly setup: (context: ModuleCommandContext) => Promise<{
|
|
145
56
|
result: {
|
|
146
|
-
contract: "deployment.result.v1";
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
data?: {} | null;
|
|
152
|
-
checks?: unknown[];
|
|
57
|
+
readonly contract: "deployment.result.v1";
|
|
58
|
+
readonly ok: true;
|
|
59
|
+
readonly status: "SUCCEEDED";
|
|
60
|
+
readonly moduleRef: "task-migration-runner";
|
|
61
|
+
readonly moduleVersion: "0.1.5";
|
|
153
62
|
} | {
|
|
154
63
|
contract: "deployment.result.v1";
|
|
155
64
|
moduleRef: "task-migration-runner";
|
|
156
|
-
moduleVersion: "0.1.
|
|
157
|
-
ok:
|
|
65
|
+
moduleVersion: "0.1.5";
|
|
66
|
+
ok: false;
|
|
158
67
|
status: "FAILED";
|
|
159
68
|
error: {
|
|
160
|
-
code: "
|
|
69
|
+
code: "SETUP_FAILED";
|
|
161
70
|
message: string;
|
|
162
71
|
retryable: boolean;
|
|
163
72
|
};
|
|
164
|
-
data?: {} | null;
|
|
165
|
-
checks?: unknown[];
|
|
166
|
-
};
|
|
167
|
-
observedEffects: string[];
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
export declare const behaviorAdapter: {
|
|
171
|
-
describe: () => {
|
|
172
|
-
result: {
|
|
173
|
-
contract: "deployment.result.v1";
|
|
174
|
-
moduleRef: "task-migration-runner";
|
|
175
|
-
moduleVersion: "0.1.3";
|
|
176
|
-
ok: boolean;
|
|
177
|
-
status: "SUCCEEDED";
|
|
178
|
-
data?: {} | null;
|
|
179
|
-
checks?: unknown[];
|
|
180
73
|
};
|
|
181
74
|
observedEffects: never[];
|
|
182
|
-
}
|
|
183
|
-
|
|
75
|
+
}>;
|
|
76
|
+
readonly docs: (_context: ModuleCommandContext) => Promise<{
|
|
184
77
|
result: {
|
|
185
78
|
contract: "deployment.result.v1";
|
|
186
|
-
|
|
187
|
-
moduleVersion: "0.1.3";
|
|
188
|
-
ok: boolean;
|
|
79
|
+
ok: true;
|
|
189
80
|
status: "SUCCEEDED";
|
|
190
|
-
data?: {} | null;
|
|
191
|
-
checks?: unknown[];
|
|
192
|
-
} | {
|
|
193
|
-
contract: "deployment.result.v1";
|
|
194
81
|
moduleRef: "task-migration-runner";
|
|
195
|
-
moduleVersion: "0.1.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
action: string;
|
|
200
|
-
description: string;
|
|
82
|
+
moduleVersion: "0.1.5";
|
|
83
|
+
data: {
|
|
84
|
+
docs: string;
|
|
85
|
+
setup: string;
|
|
201
86
|
};
|
|
202
|
-
data?: {} | null;
|
|
203
|
-
checks?: unknown[];
|
|
204
87
|
};
|
|
205
88
|
observedEffects: never[];
|
|
206
|
-
}
|
|
207
|
-
|
|
89
|
+
}>;
|
|
90
|
+
readonly start: (_context: ModuleCommandContext) => Promise<{
|
|
208
91
|
result: {
|
|
209
|
-
contract: "deployment.result.v1";
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
data?: {} | null;
|
|
215
|
-
checks?: unknown[];
|
|
92
|
+
readonly contract: "deployment.result.v1";
|
|
93
|
+
readonly ok: true;
|
|
94
|
+
readonly status: "SUCCEEDED";
|
|
95
|
+
readonly moduleRef: "task-migration-runner";
|
|
96
|
+
readonly moduleVersion: "0.1.5";
|
|
216
97
|
};
|
|
217
98
|
observedEffects: never[];
|
|
218
|
-
}
|
|
219
|
-
|
|
99
|
+
}>;
|
|
100
|
+
readonly stop: (_context: ModuleCommandContext) => Promise<{
|
|
220
101
|
result: {
|
|
221
|
-
contract: "deployment.result.v1";
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
actionRequired: {
|
|
227
|
-
action: string;
|
|
228
|
-
description: string;
|
|
229
|
-
};
|
|
230
|
-
data?: {} | null;
|
|
231
|
-
checks?: unknown[];
|
|
102
|
+
readonly contract: "deployment.result.v1";
|
|
103
|
+
readonly ok: true;
|
|
104
|
+
readonly status: "SUCCEEDED";
|
|
105
|
+
readonly moduleRef: "task-migration-runner";
|
|
106
|
+
readonly moduleVersion: "0.1.5";
|
|
232
107
|
};
|
|
233
108
|
observedEffects: never[];
|
|
234
|
-
}
|
|
109
|
+
}>;
|
|
110
|
+
readonly migrate: (context: ModuleCommandContext) => Promise<{
|
|
235
111
|
result: {
|
|
236
112
|
contract: "deployment.result.v1";
|
|
237
|
-
|
|
238
|
-
moduleVersion: "0.1.3";
|
|
239
|
-
ok: boolean;
|
|
113
|
+
ok: true;
|
|
240
114
|
status: "SUCCEEDED";
|
|
241
|
-
data?: {} | null;
|
|
242
|
-
checks?: unknown[];
|
|
243
|
-
} | {
|
|
244
|
-
contract: "deployment.result.v1";
|
|
245
|
-
moduleRef: "task-migration-runner";
|
|
246
|
-
moduleVersion: "0.1.3";
|
|
247
|
-
ok: boolean;
|
|
248
|
-
status: "FAILED";
|
|
249
|
-
error: {
|
|
250
|
-
code: "APPLY_FAILED" | "VERIFY_FAILED";
|
|
251
|
-
message: string;
|
|
252
|
-
retryable: boolean;
|
|
253
|
-
};
|
|
254
|
-
data?: {} | null;
|
|
255
|
-
checks?: unknown[];
|
|
256
|
-
};
|
|
257
|
-
observedEffects: never[];
|
|
258
|
-
};
|
|
259
|
-
doctor: () => {
|
|
260
|
-
result: {
|
|
261
|
-
contract: "deployment.result.v1";
|
|
262
115
|
moduleRef: "task-migration-runner";
|
|
263
|
-
moduleVersion: "0.1.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
action: string;
|
|
268
|
-
description: string;
|
|
116
|
+
moduleVersion: "0.1.5";
|
|
117
|
+
data: {
|
|
118
|
+
applied: number[];
|
|
119
|
+
pending: number[];
|
|
269
120
|
};
|
|
270
|
-
data?: {} | null;
|
|
271
|
-
checks?: unknown[];
|
|
272
|
-
};
|
|
273
|
-
observedEffects: never[];
|
|
274
|
-
} | {
|
|
275
|
-
result: {
|
|
276
|
-
contract: "deployment.result.v1";
|
|
277
|
-
moduleRef: "task-migration-runner";
|
|
278
|
-
moduleVersion: "0.1.3";
|
|
279
|
-
ok: boolean;
|
|
280
|
-
status: "SUCCEEDED";
|
|
281
|
-
data?: {} | null;
|
|
282
|
-
checks?: unknown[];
|
|
283
121
|
} | {
|
|
284
122
|
contract: "deployment.result.v1";
|
|
285
123
|
moduleRef: "task-migration-runner";
|
|
286
|
-
moduleVersion: "0.1.
|
|
287
|
-
ok:
|
|
288
|
-
status: "
|
|
124
|
+
moduleVersion: "0.1.5";
|
|
125
|
+
ok: false;
|
|
126
|
+
status: "FAILED";
|
|
289
127
|
error: {
|
|
290
|
-
code: "
|
|
128
|
+
code: "APPLY_FAILED";
|
|
291
129
|
message: string;
|
|
292
130
|
retryable: boolean;
|
|
293
131
|
};
|
|
294
|
-
data?: {} | null;
|
|
295
|
-
};
|
|
296
|
-
observedEffects: never[];
|
|
297
|
-
};
|
|
298
|
-
migrate: () => {
|
|
299
|
-
result: {
|
|
300
|
-
contract: "deployment.result.v1";
|
|
301
|
-
moduleRef: "task-migration-runner";
|
|
302
|
-
moduleVersion: "0.1.3";
|
|
303
|
-
ok: boolean;
|
|
304
|
-
status: "ACTION_REQUIRED";
|
|
305
|
-
actionRequired: {
|
|
306
|
-
action: string;
|
|
307
|
-
description: string;
|
|
308
|
-
};
|
|
309
|
-
data?: {} | null;
|
|
310
|
-
checks?: unknown[];
|
|
311
132
|
};
|
|
312
|
-
observedEffects:
|
|
313
|
-
}
|
|
133
|
+
observedEffects: string[];
|
|
134
|
+
}>;
|
|
135
|
+
readonly migrationStatus: (context: ModuleCommandContext) => Promise<{
|
|
314
136
|
result: {
|
|
315
137
|
contract: "deployment.result.v1";
|
|
316
|
-
|
|
317
|
-
moduleVersion: "0.1.3";
|
|
318
|
-
ok: boolean;
|
|
138
|
+
ok: true;
|
|
319
139
|
status: "SUCCEEDED";
|
|
320
|
-
data?: {} | null;
|
|
321
|
-
checks?: unknown[];
|
|
322
|
-
} | {
|
|
323
|
-
contract: "deployment.result.v1";
|
|
324
140
|
moduleRef: "task-migration-runner";
|
|
325
|
-
moduleVersion: "0.1.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
141
|
+
moduleVersion: "0.1.5";
|
|
142
|
+
data: {
|
|
143
|
+
migrated: boolean;
|
|
144
|
+
appliedVersions: number[];
|
|
145
|
+
pendingVersions: number[];
|
|
146
|
+
metadataDrift: {
|
|
147
|
+
version: number;
|
|
148
|
+
expectedName: string;
|
|
149
|
+
actualName: string;
|
|
150
|
+
}[];
|
|
151
|
+
checksumDrift: {
|
|
152
|
+
version: number;
|
|
153
|
+
expectedChecksum: string;
|
|
154
|
+
actualChecksum: string;
|
|
155
|
+
}[];
|
|
156
|
+
legacyMetadataVersions: number[];
|
|
157
|
+
missingTables: string[];
|
|
158
|
+
schemaDrift: string[];
|
|
332
159
|
};
|
|
333
|
-
data?: {} | null;
|
|
334
|
-
checks?: unknown[];
|
|
335
160
|
};
|
|
336
|
-
observedEffects:
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
export declare function createProductionBinding(input: {
|
|
340
|
-
config: Record<string, string>;
|
|
341
|
-
}): {
|
|
342
|
-
behaviorAdapter: Record<string, unknown>;
|
|
161
|
+
observedEffects: never[];
|
|
162
|
+
}>;
|
|
343
163
|
};
|
|
@@ -1,54 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join, resolve } from "node:path";
|
|
2
2
|
import { taskMigrations } from "@tomflow/proflow-task-store-sqlite/migrations";
|
|
3
3
|
import { applyMigrations, getMigrationStatus, verifyMigrations, } from "../src/index.js";
|
|
4
4
|
import { descriptor } from "./descriptor.js";
|
|
5
5
|
const base = {
|
|
6
6
|
contract: "deployment.result.v1",
|
|
7
|
+
ok: true,
|
|
8
|
+
status: "SUCCEEDED",
|
|
7
9
|
moduleRef: descriptor.moduleRef,
|
|
8
10
|
moduleVersion: descriptor.moduleVersion,
|
|
9
11
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
status: "SUCCEEDED",
|
|
14
|
-
...(data === undefined ? {} : { data }),
|
|
15
|
-
...(checks === undefined ? {} : { checks }),
|
|
16
|
-
});
|
|
17
|
-
const actionRequired = (description, data, checks) => ({
|
|
18
|
-
...base,
|
|
19
|
-
ok: false,
|
|
20
|
-
status: "ACTION_REQUIRED",
|
|
21
|
-
actionRequired: { action: "configure-task-migrations", description },
|
|
22
|
-
...(data === undefined ? {} : { data }),
|
|
23
|
-
...(checks === undefined ? {} : { checks }),
|
|
24
|
-
});
|
|
25
|
-
const failed = (message, data, checks, code = "APPLY_FAILED") => ({
|
|
26
|
-
...base,
|
|
27
|
-
ok: false,
|
|
28
|
-
status: "FAILED",
|
|
29
|
-
error: { code, message, retryable: false },
|
|
30
|
-
...(data === undefined ? {} : { data }),
|
|
31
|
-
...(checks === undefined ? {} : { checks }),
|
|
12
|
+
const input = (context) => ({
|
|
13
|
+
databasePath: join(resolve(context.workspaceRoot), ".proflow", "state", "task.sqlite"),
|
|
14
|
+
migrations: taskMigrations,
|
|
32
15
|
});
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
error: { code: "VERIFY_FAILED", message, retryable: true },
|
|
38
|
-
...(data === undefined ? {} : { data }),
|
|
39
|
-
});
|
|
40
|
-
function migrationInput(config) {
|
|
41
|
-
const databasePath = config.databasePath;
|
|
42
|
-
if (!databasePath)
|
|
43
|
-
return undefined;
|
|
44
|
-
return { databasePath, migrations: taskMigrations };
|
|
45
|
-
}
|
|
46
|
-
function statusData(config) {
|
|
47
|
-
const input = migrationInput(config);
|
|
48
|
-
if (input === undefined)
|
|
49
|
-
return undefined;
|
|
50
|
-
const status = getMigrationStatus(input);
|
|
51
|
-
const verification = verifyMigrations(input);
|
|
16
|
+
const data = (context) => {
|
|
17
|
+
const i = input(context);
|
|
18
|
+
const status = getMigrationStatus(i);
|
|
19
|
+
const verification = verifyMigrations(i);
|
|
52
20
|
return {
|
|
53
21
|
migrated: verification.ok,
|
|
54
22
|
appliedVersions: status.appliedVersions,
|
|
@@ -59,89 +27,104 @@ function statusData(config) {
|
|
|
59
27
|
missingTables: status.missingTables,
|
|
60
28
|
schemaDrift: status.schemaDrift,
|
|
61
29
|
};
|
|
62
|
-
}
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
result: migrationInput(config) === undefined
|
|
68
|
-
? actionRequired("databasePath is required for Task migrations")
|
|
69
|
-
: success(),
|
|
70
|
-
observedEffects: [],
|
|
71
|
-
}),
|
|
72
|
-
status: () => ({
|
|
73
|
-
result: success(observeDeclaredModuleStatus(descriptor, config, "STOPPED")),
|
|
74
|
-
observedEffects: [],
|
|
75
|
-
}),
|
|
76
|
-
verify: () => {
|
|
77
|
-
const input = migrationInput(config);
|
|
78
|
-
if (input === undefined) {
|
|
79
|
-
const check = {
|
|
80
|
-
id: "migration-state-pass",
|
|
81
|
-
status: "FAIL",
|
|
82
|
-
message: "databasePath is required for Task migration verification",
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
result: actionRequired(check.message, undefined, [check]),
|
|
86
|
-
observedEffects: [],
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
const verification = verifyMigrations(input);
|
|
90
|
-
const data = statusData(config);
|
|
91
|
-
const check = {
|
|
92
|
-
id: "migration-state-pass",
|
|
93
|
-
status: verification.ok ? "PASS" : "FAIL",
|
|
94
|
-
message: verification.ok
|
|
95
|
-
? "Task migration state and SQLite integrity match the current schema"
|
|
96
|
-
: (verification.error?.message ??
|
|
97
|
-
"Task migration verification failed"),
|
|
98
|
-
};
|
|
99
|
-
return {
|
|
100
|
-
result: verification.ok
|
|
101
|
-
? success(data, [check])
|
|
102
|
-
: failed(check.message, data, [check], "VERIFY_FAILED"),
|
|
103
|
-
observedEffects: [],
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
doctor: () => {
|
|
107
|
-
const data = statusData(config);
|
|
108
|
-
if (data === undefined) {
|
|
109
|
-
return {
|
|
110
|
-
result: actionRequired("databasePath is required for Task migration diagnostics"),
|
|
111
|
-
observedEffects: [],
|
|
112
|
-
};
|
|
113
|
-
}
|
|
30
|
+
};
|
|
31
|
+
export const behaviorAdapter = {
|
|
32
|
+
install: async (context) => {
|
|
33
|
+
const migration = applyMigrations(input(context));
|
|
34
|
+
if (!migration.ok)
|
|
114
35
|
return {
|
|
115
|
-
result:
|
|
116
|
-
|
|
117
|
-
:
|
|
36
|
+
result: {
|
|
37
|
+
...base,
|
|
38
|
+
ok: false,
|
|
39
|
+
status: "FAILED",
|
|
40
|
+
error: {
|
|
41
|
+
code: "APPLY_FAILED",
|
|
42
|
+
message: migration.error?.message ?? "Task migration failed",
|
|
43
|
+
retryable: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
118
46
|
observedEffects: [],
|
|
119
47
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
?
|
|
139
|
-
:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
48
|
+
return {
|
|
49
|
+
result: {
|
|
50
|
+
...base,
|
|
51
|
+
data: { applied: migration.applied, pending: migration.pending },
|
|
52
|
+
},
|
|
53
|
+
observedEffects: ["Applies Task Store migration SQL to SQLite"],
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
uninstall: async (_context) => ({
|
|
57
|
+
result: base,
|
|
58
|
+
observedEffects: [],
|
|
59
|
+
}),
|
|
60
|
+
status: async (context) => {
|
|
61
|
+
const v = verifyMigrations(input(context));
|
|
62
|
+
return {
|
|
63
|
+
result: {
|
|
64
|
+
...base,
|
|
65
|
+
data: {
|
|
66
|
+
setupStatus: v.ok ? "READY" : "FAILED",
|
|
67
|
+
runtimeStatus: "NOT_APPLICABLE",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
observedEffects: [],
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
setup: async (context) => {
|
|
74
|
+
const v = verifyMigrations(input(context));
|
|
75
|
+
return {
|
|
76
|
+
result: v.ok
|
|
77
|
+
? base
|
|
78
|
+
: {
|
|
79
|
+
...base,
|
|
80
|
+
ok: false,
|
|
81
|
+
status: "FAILED",
|
|
82
|
+
error: {
|
|
83
|
+
code: "SETUP_FAILED",
|
|
84
|
+
message: v.error?.message ?? "Task migration state is not ready",
|
|
85
|
+
retryable: true,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
observedEffects: [],
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
docs: async (_context) => ({
|
|
92
|
+
result: { ...base, data: { docs: "DOCS.md", setup: "SETUP.md" } },
|
|
93
|
+
observedEffects: [],
|
|
94
|
+
}),
|
|
95
|
+
start: async (_context) => ({
|
|
96
|
+
result: base,
|
|
97
|
+
observedEffects: [],
|
|
98
|
+
}),
|
|
99
|
+
stop: async (_context) => ({
|
|
100
|
+
result: base,
|
|
101
|
+
observedEffects: [],
|
|
102
|
+
}),
|
|
103
|
+
migrate: async (context) => {
|
|
104
|
+
const migration = applyMigrations(input(context));
|
|
105
|
+
return {
|
|
106
|
+
result: migration.ok
|
|
107
|
+
? {
|
|
108
|
+
...base,
|
|
109
|
+
data: { applied: migration.applied, pending: migration.pending },
|
|
110
|
+
}
|
|
111
|
+
: {
|
|
112
|
+
...base,
|
|
113
|
+
ok: false,
|
|
114
|
+
status: "FAILED",
|
|
115
|
+
error: {
|
|
116
|
+
code: "APPLY_FAILED",
|
|
117
|
+
message: migration.error?.message ?? "Task migration failed",
|
|
118
|
+
retryable: false,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
observedEffects: migration.ok
|
|
122
|
+
? ["Applies Task Store migration SQL to SQLite"]
|
|
123
|
+
: [],
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
migrationStatus: async (context) => ({
|
|
127
|
+
result: { ...base, data: data(context) },
|
|
128
|
+
observedEffects: [],
|
|
129
|
+
}),
|
|
130
|
+
};
|
|
@@ -3,7 +3,7 @@ export declare const descriptor: {
|
|
|
3
3
|
readonly contractVersion: "1.0.0";
|
|
4
4
|
readonly moduleRef: "task-migration-runner";
|
|
5
5
|
readonly packageName: "@tomflow/proflow-task-migration-runner";
|
|
6
|
-
readonly moduleVersion: "0.1.
|
|
6
|
+
readonly moduleVersion: "0.1.5";
|
|
7
7
|
readonly kind: "cli";
|
|
8
8
|
readonly templateVersion: "1.0.0";
|
|
9
9
|
readonly platformCompatibility: ">=1.0.0 <2.0.0";
|
|
@@ -18,34 +18,14 @@ export declare const descriptor: {
|
|
|
18
18
|
readonly runtime: "node";
|
|
19
19
|
readonly versionRange: ">=24.19.0";
|
|
20
20
|
}];
|
|
21
|
-
readonly configSlots: readonly [
|
|
22
|
-
readonly key: "databasePath";
|
|
23
|
-
readonly type: "path";
|
|
24
|
-
readonly required: true;
|
|
25
|
-
readonly description: "Task SQLite database path";
|
|
26
|
-
}];
|
|
27
|
-
readonly lifecycle: {
|
|
28
|
-
readonly supported: readonly ["describe", "preflight", "status", "verify", "doctor", "migrate"];
|
|
29
|
-
};
|
|
30
|
-
readonly verification: {
|
|
31
|
-
readonly checks: readonly [{
|
|
32
|
-
readonly id: "migration-state-pass";
|
|
33
|
-
readonly description: "Migration state matches the Task schema";
|
|
34
|
-
readonly lifecycle: "verify";
|
|
35
|
-
}];
|
|
36
|
-
};
|
|
21
|
+
readonly configSlots: readonly [];
|
|
37
22
|
readonly effects: readonly [{
|
|
38
23
|
readonly kind: "filesystem";
|
|
39
24
|
readonly description: "Applies Task Store migration SQL to SQLite";
|
|
40
25
|
readonly retention: "preserve";
|
|
41
26
|
}];
|
|
42
|
-
readonly documentation:
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
|
|
46
|
-
}, {
|
|
47
|
-
readonly id: "configuration";
|
|
48
|
-
readonly path: "./CONFIGURATION.md";
|
|
49
|
-
readonly description: "Module configuration fields, sources and materialization instructions";
|
|
50
|
-
}];
|
|
27
|
+
readonly documentation: {
|
|
28
|
+
readonly docs: "DOCS.md";
|
|
29
|
+
readonly setup: "SETUP.md";
|
|
30
|
+
};
|
|
51
31
|
};
|
|
@@ -3,7 +3,7 @@ export const descriptor = {
|
|
|
3
3
|
contractVersion: "1.0.0",
|
|
4
4
|
moduleRef: "task-migration-runner",
|
|
5
5
|
packageName: "@tomflow/proflow-task-migration-runner",
|
|
6
|
-
moduleVersion: "0.1.
|
|
6
|
+
moduleVersion: "0.1.5",
|
|
7
7
|
kind: "cli",
|
|
8
8
|
templateVersion: "1.0.0",
|
|
9
9
|
platformCompatibility: ">=1.0.0 <2.0.0",
|
|
@@ -20,33 +20,7 @@ export const descriptor = {
|
|
|
20
20
|
versionRange: ">=24.19.0",
|
|
21
21
|
},
|
|
22
22
|
],
|
|
23
|
-
configSlots: [
|
|
24
|
-
{
|
|
25
|
-
key: "databasePath",
|
|
26
|
-
type: "path",
|
|
27
|
-
required: true,
|
|
28
|
-
description: "Task SQLite database path",
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
lifecycle: {
|
|
32
|
-
supported: [
|
|
33
|
-
"describe",
|
|
34
|
-
"preflight",
|
|
35
|
-
"status",
|
|
36
|
-
"verify",
|
|
37
|
-
"doctor",
|
|
38
|
-
"migrate",
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
verification: {
|
|
42
|
-
checks: [
|
|
43
|
-
{
|
|
44
|
-
id: "migration-state-pass",
|
|
45
|
-
description: "Migration state matches the Task schema",
|
|
46
|
-
lifecycle: "verify",
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
},
|
|
23
|
+
configSlots: [],
|
|
50
24
|
effects: [
|
|
51
25
|
{
|
|
52
26
|
kind: "filesystem",
|
|
@@ -54,16 +28,8 @@ export const descriptor = {
|
|
|
54
28
|
retention: "preserve",
|
|
55
29
|
},
|
|
56
30
|
],
|
|
57
|
-
documentation:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
description: "Package-owned module overview",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: "configuration",
|
|
65
|
-
path: "./CONFIGURATION.md",
|
|
66
|
-
description: "Module configuration fields, sources and materialization instructions",
|
|
67
|
-
},
|
|
68
|
-
],
|
|
31
|
+
documentation: {
|
|
32
|
+
docs: "DOCS.md",
|
|
33
|
+
setup: "SETUP.md",
|
|
34
|
+
},
|
|
69
35
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomflow/proflow-task-migration-runner",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
"proflow.module.json",
|
|
20
20
|
"conformance.json",
|
|
21
21
|
"README.md",
|
|
22
|
-
"
|
|
22
|
+
"DOCS.md",
|
|
23
|
+
"SETUP.md"
|
|
23
24
|
],
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@tomflow/proflow-
|
|
26
|
-
"@tomflow/proflow-
|
|
26
|
+
"@tomflow/proflow-module-contract": "^0.1.5",
|
|
27
|
+
"@tomflow/proflow-task-store-sqlite": "^0.1.5"
|
|
27
28
|
},
|
|
28
29
|
"description": "Deterministically discovers, applies and verifies Task Store SQLite schema migrations.",
|
|
29
30
|
"keywords": [
|
package/proflow.module.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"contractVersion": "1.0.0",
|
|
4
4
|
"moduleRef": "task-migration-runner",
|
|
5
5
|
"packageName": "@tomflow/proflow-task-migration-runner",
|
|
6
|
-
"moduleVersion": "0.1.
|
|
6
|
+
"moduleVersion": "0.1.5",
|
|
7
7
|
"kind": "cli",
|
|
8
8
|
"templateVersion": "1.0.0",
|
|
9
9
|
"platformCompatibility": ">=1.0.0 <2.0.0",
|
|
@@ -20,33 +20,7 @@
|
|
|
20
20
|
"versionRange": ">=24.19.0"
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
|
-
"configSlots": [
|
|
24
|
-
{
|
|
25
|
-
"key": "databasePath",
|
|
26
|
-
"type": "path",
|
|
27
|
-
"required": true,
|
|
28
|
-
"description": "Task SQLite database path"
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"lifecycle": {
|
|
32
|
-
"supported": [
|
|
33
|
-
"describe",
|
|
34
|
-
"preflight",
|
|
35
|
-
"status",
|
|
36
|
-
"verify",
|
|
37
|
-
"doctor",
|
|
38
|
-
"migrate"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
"verification": {
|
|
42
|
-
"checks": [
|
|
43
|
-
{
|
|
44
|
-
"id": "migration-state-pass",
|
|
45
|
-
"description": "Migration state matches the Task schema",
|
|
46
|
-
"lifecycle": "verify"
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
},
|
|
23
|
+
"configSlots": [],
|
|
50
24
|
"effects": [
|
|
51
25
|
{
|
|
52
26
|
"kind": "filesystem",
|
|
@@ -54,16 +28,8 @@
|
|
|
54
28
|
"retention": "preserve"
|
|
55
29
|
}
|
|
56
30
|
],
|
|
57
|
-
"documentation":
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"description": "Package-owned module overview"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"id": "configuration",
|
|
65
|
-
"path": "./CONFIGURATION.md",
|
|
66
|
-
"description": "Module configuration fields, sources and materialization instructions"
|
|
67
|
-
}
|
|
68
|
-
]
|
|
31
|
+
"documentation": {
|
|
32
|
+
"docs": "DOCS.md",
|
|
33
|
+
"setup": "SETUP.md"
|
|
34
|
+
}
|
|
69
35
|
}
|
package/CONFIGURATION.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# task-migration-runner configuration
|
|
2
|
-
|
|
3
|
-
Canonical public config: `.proflow/config/task-migration-runner.json`
|
|
4
|
-
|
|
5
|
-
This file is Workspace-owned data. `platform uninstall` does not delete it. Values are JSON strings. Raw secrets must not be stored here; `secretRef` fields contain opaque references only.
|
|
6
|
-
|
|
7
|
-
## Fields
|
|
8
|
-
|
|
9
|
-
| Key | Type | Required | Sensitive | Source | Meaning |
|
|
10
|
-
|---|---|---:|---:|---|---|
|
|
11
|
-
| `databasePath` | `path` | yes | no | User or owning Module supplies an absolute/local path that exists on this Workspace. | Task SQLite database path |
|
|
12
|
-
|
|
13
|
-
## Materialize
|
|
14
|
-
|
|
15
|
-
Create or update the canonical JSON object at:
|
|
16
|
-
|
|
17
|
-
`.proflow/config/task-migration-runner.json`
|
|
18
|
-
|
|
19
|
-
Use only declared keys and string values. Do not create a second Platform configuration database.
|
|
20
|
-
|
|
21
|
-
## Base completion check
|
|
22
|
-
|
|
23
|
-
Run `platform modules`. This Module should no longer report required keys in `missingConfig`. `platform start` performs the authoritative Module-owned validation before starting anything.
|