@try-works/dsh-memory 0.1.12 → 0.1.13
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/package.json +1 -1
- package/src/tasks.js +9 -3
package/package.json
CHANGED
package/src/tasks.js
CHANGED
|
@@ -151,7 +151,7 @@ const STATE_MEANING = {
|
|
|
151
151
|
[TASK_STATES.STOPPED]: 'was armed, and its owning session stopped, so the host deleted it',
|
|
152
152
|
[TASK_STATES.FAILED]: 'was due and has still not delivered; the host records no failure of its own',
|
|
153
153
|
[TASK_STATES.ORPHANED]: 'armed, but the session that owns it cannot be resolved, so it can never fire',
|
|
154
|
-
[TASK_STATES.SKIPPED]: '
|
|
154
|
+
[TASK_STATES.SKIPPED]: 'captured, but its kind is not one we can re-arm; a restore refuses it rather than guessing',
|
|
155
155
|
[TASK_STATES.DONE]: 'delivered, or its recurrence is exhausted',
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -397,8 +397,8 @@ export function readScheduleStore(path) {
|
|
|
397
397
|
* deleted on purpose must stay visible as gone rather than vanish from the record of what this
|
|
398
398
|
* machine used to run.
|
|
399
399
|
*
|
|
400
|
-
* A task whose kind we do not recognise is
|
|
401
|
-
*
|
|
400
|
+
* A task whose kind we do not recognise is stored and flagged SKIPPED: dropping it would mean losing
|
|
401
|
+
* a task from a backup, and flagging it means a restore refuses it rather than guessing.
|
|
402
402
|
*/
|
|
403
403
|
export function backupTasks(root, { schedulePath, now = Date.now(), nowIso, sessions } = {}) {
|
|
404
404
|
const at = nowIso ?? new Date(now).toISOString()
|
|
@@ -424,7 +424,13 @@ export function backupTasks(root, { schedulePath, now = Date.now(), nowIso, sess
|
|
|
424
424
|
const record = task.record
|
|
425
425
|
if (!record || typeof record !== 'object') { skipped.push({ id: task.id, reason: 'no record' }); continue }
|
|
426
426
|
if (!KNOWN_KINDS.includes(String(record.kind))) {
|
|
427
|
+
// CAPTURED, not dropped. An earlier version skipped these entirely, which meant a task whose
|
|
428
|
+
// kind we did not recognise silently vanished from a BACKUP - the one job this layer has. It
|
|
429
|
+
// is written and flagged 'skipped' instead, and planRestore refuses that state, so it can
|
|
430
|
+
// never be blindly re-armed. Preserved, visible, and unrestorable: all three on purpose.
|
|
427
431
|
skipped.push({ id: task.id, reason: 'unrecognised kind: ' + String(record.kind) })
|
|
432
|
+
writeTask(root, record, TASK_STATES.SKIPPED, byKey.get(contentKey(record))?.backedUpAt ?? at)
|
|
433
|
+
seen.add(contentKey(record))
|
|
428
434
|
continue
|
|
429
435
|
}
|
|
430
436
|
const key = contentKey(record)
|