@bongos/core 1.19.398 → 1.19.400

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.
@@ -30,6 +30,9 @@ import http from 'node:http';
30
30
  const require = createRequire(import.meta.url);
31
31
  const provisioning = require('../modules/provisioning/provisioning.js');
32
32
 
33
+ // The actions a teardown supersedes, mirroring enqueueTeardown's SQL.
34
+ const SUPERSEDABLE = new Set(['provision', 'settings-apply', 'restart']);
35
+
33
36
  let passed = 0, failed = 0;
34
37
  function t(name, fn) {
35
38
  try { fn(); passed++; console.log(` PASS ${name}`); }
@@ -65,12 +68,13 @@ function fakeIntentDb(seed = []) {
65
68
  }
66
69
  if (/UPDATE provisioning_intents/.test(sql) && /state = 'error'/.test(sql)) {
67
70
  // The supersede's guard must live in the SQL itself: pending-only (a running
68
- // intent is the runner's mid-flight work) and provision-or-settings-push only
69
- // (task 1003140 widened it: a queued push into a project about to be torn
70
- // down is dead work; an open teardown is left alone for the idempotent path).
71
- assert.match(sql, /action IN \('provision', 'settings-apply'\) AND state = 'pending'/);
71
+ // intent is the runner's mid-flight work) and only the actions that become
72
+ // dead work in front of a teardown (task 1003140 widened it to the settings
73
+ // push, task 1003238 to the restart; an open teardown is left alone for the
74
+ // idempotent path).
75
+ assert.match(sql, /action IN \('provision', 'settings-apply', 'restart'\) AND state = 'pending'/);
72
76
  const hit = rows.filter((r) =>
73
- String(r.instance_id) === String(params[0]) && (r.action === 'provision' || r.action === 'settings-apply') && r.state === 'pending');
77
+ String(r.instance_id) === String(params[0]) && SUPERSEDABLE.has(r.action) && r.state === 'pending');
74
78
  for (const r of hit) { r.state = 'error'; r.last_error = 'superseded: teardown requested'; }
75
79
  return { rows: hit.map((r) => ({ id: r.id })) };
76
80
  }