@mstar-harness/engine 3.10.1 → 3.10.2

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/dist/engine.js CHANGED
@@ -1812,6 +1812,15 @@ async function recordWorkflowDelivery(workflowId, dir, opts) {
1812
1812
  if (stableJson(snapshot.delivery ?? null) === stableJson(merged)) {
1813
1813
  return { snapshot, written: false };
1814
1814
  }
1815
+ const tailMembers = members.filter((member) => member === "compound" || member === "pr" || member === "merge");
1816
+ if (tailMembers.length > 0) {
1817
+ const notDone = snapshot.plans.filter((row) => row.status !== "Done");
1818
+ if (notDone.length > 0) {
1819
+ const rowDetail = notDone.map((row) => `${row.id} (${JSON.stringify(row.status)})`).join(", ");
1820
+ const detail = violation3("high", "PHASE6_PLAN_ROW_NOT_DONE", `owned plan row(s) ${rowDetail} are not Done - every plan row must be Done before the delivery tail (${tailMembers.join(", ")}) is recorded (mstar-artifacts/references/plan-workflow-lifecycle-contract.md section 3: row Done -> compound disposition -> PR identity -> verified-merge record)`, `Bring every owned plan row to Done, then record delivery evidence with 'mstar workflow evidence --workflow ${workflowId} --file <payload.json>'`);
1821
+ throw new Error(`refusing to record delivery evidence: ${detail.code}: ${detail.message}${detail.fix !== undefined ? ` (fix: ${detail.fix})` : ""}`);
1822
+ }
1823
+ }
1815
1824
  const next = { ...snapshot, delivery: merged, updated_at: at };
1816
1825
  await validateAndPutWorkflowSnapshot(store, next, snapshotPath);
1817
1826
  return { snapshot: next, written: true };
@@ -375,7 +375,15 @@ export type RecordWorkflowDeliveryResult = {
375
375
  * `development` workflow) — the declared kind is authoritative;
376
376
  * - a rewrite of the recorded PR identity (§4d records it once at submission:
377
377
  * an identical re-record is idempotent, a different pair is refused);
378
- * - an empty patch or a malformed member: nothing is silently dropped.
378
+ * - an empty patch or a malformed member: nothing is silently dropped;
379
+ * - compound / PR identity / verified-merge record while any owned plan row
380
+ * is not `Done` (`PHASE6_PLAN_ROW_NOT_DONE` — contract §3: the delivery
381
+ * tail runs after every row is Done; write-time only, see below).
382
+ *
383
+ * Grandfathering: the row-Done gate is write-time only. Snapshots that
384
+ * already carry delivery evidence while rows are not `Done` are never
385
+ * retro-invalidated; idempotent re-records return without consulting row
386
+ * state; `closeWorkflow` / `evaluatePostMergeClose` are unchanged.
379
387
  *
380
388
  * Idempotent and re-entrant: re-recording the exact stored evidence performs
381
389
  * NO write and returns the snapshot as read (the timestamp is untouched), so
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstar-harness/engine",
3
- "version": "3.10.1",
3
+ "version": "3.10.2",
4
4
  "description": "Morning Star Harness Workflow Engine — deterministic workflow enforcement library (path, status, lease, dispatch, sdd, iteration, lint gates).",
5
5
  "license": "MIT",
6
6
  "repository": {