@synap-core/workspace-templates 0.47.0 → 0.48.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.
@@ -63,13 +63,18 @@ describe("decision 1 — Business Developer folds into CRM", () => {
63
63
  // It owns researching and qualified; the other leadStage values belong to a
64
64
  // person or another flow — derived by the pod, never listed (One model
65
65
  // decision 4, 7 Nov 2026; conflict C2 on `outreach` closed).
66
- const owned = (pb?.stages ?? []).map((s) => s.subjectStatus).filter(Boolean);
66
+ const owned = (pb?.stages ?? []).flatMap((s) => [s.subjectStatus, s.onApproved]).filter(Boolean);
67
67
  expect(owned).toEqual(["researching", "qualified"]);
68
68
  for (const s of owned) expect(propOf(tpl("foundation"), "lead", "leadStage")?.enumValues).toContain(s);
69
- // Only the last stage, reached when the person chose pursue, moves the lead
70
- // to qualified. It opens no deal (CRM build plan A4, 2026-10-22): a deal is
71
- // opened when a person records a booked meeting, which converts the lead.
72
- expect(pb?.stages?.at(-1)).toMatchObject({ key: "pursue", subjectStatus: "qualified" });
69
+ // The last stage, reached when the person chose pursue, DECLARES
70
+ // qualified (the follow and flow.of read it) but nothing approves it
71
+ // (ungated, no output), so the pod never writes it: its goal tells the
72
+ // run to move the lead through the role's status door (decision D2). It
73
+ // opens no deal (CRM build plan A4, 2026-10-22): a deal is opened when a
74
+ // person records a booked meeting.
75
+ expect(pb?.stages?.at(-1)).toMatchObject({ key: "pursue", onApproved: "qualified" });
76
+ expect(pb?.stages?.at(-1)?.subjectStatus).toBeUndefined();
77
+ expect(pb?.stages?.at(-1)?.goal).toMatch(/set the lead qualified yourself \(update_facet on the lead role, leadStage qualified/);
73
78
  expect(pb?.stages?.flatMap((s) => s.expectedOutputs ?? [])).toEqual([]);
74
79
  expect(pb?.expectedOutputs).toBeUndefined();
75
80
  });
@@ -82,6 +87,69 @@ describe("decision 1 — Business Developer folds into CRM", () => {
82
87
  expect(errorsOf(tpl("crm", c), c)).toContain('stage-subject-status-unknown playbooks."Qualify a lead".stages.research.subjectStatus');
83
88
  });
84
89
 
90
+ it("an onApproved outside the lifecycle is refused (D2)", () => {
91
+ const c = structuredClone(corpus);
92
+ const pb = playbookOf(tpl("crm", c), "Qualify a lead")!;
93
+ pb.stages![0]!.onApproved = "won";
94
+ expect(errorsOf(tpl("crm", c), c)).toContain('stage-on-approved-unknown playbooks."Qualify a lead".stages.research.onApproved');
95
+ });
96
+
97
+ it("an onApproved nothing approves is KEPT when the stage's goal names the move, refused when it does not (D2)", () => {
98
+ // The shipped catalog: every no-signal onApproved names its move.
99
+ const noSignal = corpus.flatMap((t) => errorsOf(t).filter((e) => e.startsWith("stage-on-approved-no-signal ")));
100
+ expect(noSignal).toEqual([]);
101
+ // NEGATIVE: the same last stage, its goal silent on the move.
102
+ const c = structuredClone(corpus);
103
+ const pursue = playbookOf(tpl("crm", c), "Qualify a lead")!.stages!.at(-1)!;
104
+ expect(pursue.onApproved).toBe("qualified");
105
+ pursue.goal = "Only after the person chose pursue, set the next action to book a meeting.";
106
+ expect(errorsOf(tpl("crm", c), c)).toContain('stage-on-approved-no-signal playbooks."Qualify a lead".stages.pursue.onApproved');
107
+ });
108
+
109
+ it("no-signal is the pod's: a required output or the NEXT stage's gate approves; the stage's own gate and an optional output do not (D2)", () => {
110
+ const rule = (c: WorkspaceYaml[]) =>
111
+ errorsOf(tpl("crm", c), c).filter((e) => e.startsWith("stage-on-approved-no-signal ") && e.includes('"Win a deal"'));
112
+ const send = 'stage-on-approved-no-signal playbooks."Win a deal".stages.send.onApproved';
113
+ const silent = () => {
114
+ const c = structuredClone(corpus);
115
+ const s = playbookOf(tpl("crm", c), "Win a deal")!.stages!.find((x) => x.key === "send")!;
116
+ // send carries its own human gate; the next stage (await-answer) has none.
117
+ expect(s.gate).toEqual({ kind: "human" });
118
+ // The shipped stage owes its Sent proposal (signal 1): strip it to judge
119
+ // the gates alone.
120
+ expect(s.expectedOutputs).toEqual([{ kind: "document", label: "Sent proposal", relationToSubject: "none" }]);
121
+ s.expectedOutputs = undefined;
122
+ s.goal = "A person approves the proposal; then send it to the decision maker.";
123
+ return { c, s, pb: playbookOf(tpl("crm", c), "Win a deal")! };
124
+ };
125
+ // Its own gate does not approve it: the goal must name the move.
126
+ expect(rule(silent().c)).toEqual([send]);
127
+ // An optional output does not either.
128
+ {
129
+ const { c, s } = silent();
130
+ s.expectedOutputs = [{ kind: "document", label: "Sent proposal", optional: true }];
131
+ expect(rule(c)).toEqual([send]);
132
+ }
133
+ // A required output does.
134
+ {
135
+ const { c, s } = silent();
136
+ s.expectedOutputs = [{ kind: "document", label: "Sent proposal" }];
137
+ expect(rule(c)).toEqual([]);
138
+ }
139
+ // So does a gate on the NEXT stage.
140
+ {
141
+ const { c, pb } = silent();
142
+ pb.stages!.find((x) => x.key === "await-answer")!.gate = { kind: "human" };
143
+ expect(rule(c)).toEqual([]);
144
+ }
145
+ // The option's LABEL names the move as well as its key ("Proposal sent").
146
+ {
147
+ const { c, s } = silent();
148
+ s.goal = "A person approves the proposal; send it, then move the deal to Proposal sent.";
149
+ expect(rule(c)).toEqual([]);
150
+ }
151
+ });
152
+
85
153
  it("'Advance a commercial proposal' is gone everywhere; CRM's 'Win a deal' remains", () => {
86
154
  const names = corpus.flatMap((t) => (t.playbooks ?? []).map((p) => p.name));
87
155
  expect(names).not.toContain("Advance a commercial proposal");
@@ -186,3 +254,29 @@ describe("settled item — a new brand voice guide is a draft", () => {
186
254
  expect(propOf(tpl("brand-library"), "brand-voice-guide", "voice-status")?.constraints).toEqual({ defaultValue: "draft" });
187
255
  });
188
256
  });
257
+
258
+ describe("decision D2 — where a real artifact exists, the work itself reaches the status", () => {
259
+ const stageOf = (slug: string, playbook: string, key: string) =>
260
+ playbookOf(tpl(slug), playbook)!.stages!.find((s) => s.key === key)!;
261
+ it("Fix a finding's merged stage owes the merged pull request; the merge moves the finding to fixed", () => {
262
+ const merged = stageOf("builder-workspace", "Fix a finding", "merged");
263
+ expect(merged.onApproved).toBe("fixed");
264
+ expect(merged.expectedOutputs).toEqual([{ kind: "pull_request", label: "Merged fix", relationToSubject: "none" }]);
265
+ expect(merged.goal).toMatch(/with its url as the ref, and leave it open/);
266
+ expect(merged.goal).toMatch(/Never move the finding yourself/);
267
+ // Never the child's "Fix PR" label: the hand-off's draft PR must not close it.
268
+ expect(merged.expectedOutputs!.map((o) => o.label)).not.toContain("Fix PR");
269
+ });
270
+ it("Win a deal's send and Bill a client's send owe what was sent, and never move the subject themselves", () => {
271
+ for (const [slug, pb, label, output] of [
272
+ ["crm", "Win a deal", "Sent proposal", { kind: "document", label: "Sent proposal", relationToSubject: "none" }],
273
+ ["finance", "Bill a client", "Invoice sent to the client", { kind: "document", label: "Invoice sent to the client" }],
274
+ ] as const) {
275
+ const send = stageOf(slug, pb, "send");
276
+ expect(send.expectedOutputs, pb).toEqual([output]);
277
+ expect(send.goal, pb).toContain(`${label} output done with the sent message as its ref (update_run)`);
278
+ expect(send.goal, pb).toMatch(/Never move the (deal|invoice) yourself/);
279
+ expect(send.goal, pb).not.toMatch(/update_entity/);
280
+ }
281
+ });
282
+ });
package/src/finance.yaml CHANGED
@@ -577,7 +577,7 @@ playbooks:
577
577
  - name: Bill a client
578
578
  description: Take an invoice from draft to paid — prepare it, send it with a person's approval, chase it when late, and confirm the payment.
579
579
  goalTemplate: >-
580
- Bill this invoice ({invoice}); each stage moves its status. PREPARE: set
580
+ Bill this invoice ({invoice}); each stage moves its status when its work is approved. PREPARE: set
581
581
  the invoice number, customer, amount, currency, issue date and due date
582
582
  from the engagement or deal it bills, and check the amount against what
583
583
  was agreed. SEND: a person approves the invoice before it goes to the
@@ -616,8 +616,13 @@ playbooks:
616
616
  - key: send
617
617
  name: Send
618
618
  category: started
619
- subjectStatus: sent
620
- goal: A person approves the invoice before it goes to the client.
619
+ onApproved: sent
620
+ goal: A person approves the invoice before it goes to the client; then send it to the client with send_message. Once it has gone, mark the Invoice sent to the client output done with the sent message as its ref (update_run); that moves the invoice to sent. Never move the invoice yourself.
621
+ # REQUIRED (decision D2): the playbook's own deliverable, declared on
622
+ # the stage that produces it (the same label: entering the stage owes
623
+ # it once), approves this stage.
624
+ expectedOutputs:
625
+ - { kind: document, label: Invoice sent to the client }
621
626
  gate: { kind: human }
622
627
  onFail: { toStage: prepare }
623
628
  - key: due
@@ -687,7 +692,7 @@ playbooks:
687
692
  - name: Approve an expense
688
693
  description: Review an expense against its budget, get a person's approval, and record the payment.
689
694
  goalTemplate: >-
690
- Handle this expense ({expense}); each stage moves its status. REVIEW:
695
+ Handle this expense ({expense}); each stage moves its status when its work is approved. REVIEW:
691
696
  check the vendor, amount, date, category and receipt, link the budget it
692
697
  counts against and say how much of that budget is left after it. APPROVE:
693
698
  a person approves or rejects the spend. PAY: a person confirms it was
@@ -706,6 +711,7 @@ playbooks:
706
711
  name: Review
707
712
  category: planned
708
713
  subjectStatus: pending
714
+ onApproved: approved
709
715
  goal: Check the expense's facts and receipt and link the budget it counts against.
710
716
  criteria:
711
717
  - key: expense-facts
@@ -717,14 +723,13 @@ playbooks:
717
723
  - key: approve
718
724
  name: Approve
719
725
  category: started
720
- subjectStatus: approved
726
+ onApproved: paid
721
727
  goal: A person approves the spend.
722
728
  gate: { kind: human }
723
729
  onFail: { toStage: review }
724
730
  - key: pay
725
731
  name: Pay
726
732
  category: completed
727
- subjectStatus: paid
728
733
  goal: A person confirms the expense was paid; link the account it was paid from.
729
734
  gate: { kind: human }
730
735
  onFail: { toStage: approve }
@@ -42,9 +42,12 @@ const crm = tpl("crm");
42
42
  describe("Win a deal — one door to a client", () => {
43
43
  const win = playbookOf(crm, "Win a deal");
44
44
  const won = win.stages!.find((s) => s.key === "won")!;
45
+ const negotiate = win.stages!.find((s) => s.key === "negotiate")!;
45
46
 
46
47
  it("the Won stage proposes the lead's move to converted, behind a person's gate", () => {
47
- expect(won.subjectStatus).toBe("won");
48
+ // D2: the deal reaches won when the person approves at Won's gate (Negotiate's onApproved), never on entering Won.
49
+ expect(won.subjectStatus).toBeUndefined();
50
+ expect(negotiate.onApproved).toBe("won");
48
51
  expect(won.gate).toEqual({ kind: "human" });
49
52
  expect(won.goal).toMatch(/propose moving the deal's lead to converted/);
50
53
  expect(win.goalTemplate).toMatch(/propose moving the\s+deal's lead \(the company's lead, else the person's\) to converted/);
@@ -226,7 +226,7 @@ function playbookBindings({ withSystem = false } = {}) {
226
226
  .filter(
227
227
  (pb) =>
228
228
  pb.subjectProfile?.profileSlug &&
229
- ((pb.stages ?? []).some((st) => st.subjectStatus) || (pb.activators ?? []).some((a) => a.status)) &&
229
+ ((pb.stages ?? []).some((st) => st.subjectStatus || st.onApproved) || (pb.activators ?? []).some((a) => a.status)) &&
230
230
  (withSystem ||
231
231
  !SYSTEM_PROFILES.has(pb.subjectProfile.profileSlug) ||
232
232
  TEMPLATE_OWNED_SYSTEM_LIFECYCLES.has(pb.subjectProfile.profileSlug))
@@ -389,7 +389,7 @@ playbooks:
389
389
  - name: Run a campaign
390
390
  description: Take a campaign from brief to results — goal, audience, plan, content, launch with a person's approval, and a report on the leads it brought.
391
391
  goalTemplate: >-
392
- Run this campaign ({campaign}); each stage moves its status. BRIEF: write
392
+ Run this campaign ({campaign}); each stage moves its status when its work is approved. BRIEF: write
393
393
  the campaign's goal as a number, its target audience, channel, budget,
394
394
  start and end dates, from the brand kit and the agency's offers. PLAN:
395
395
  list the pieces to make and the outreach to send, each with a date. MAKE:
@@ -458,8 +458,8 @@ playbooks:
458
458
  - key: report
459
459
  name: Report
460
460
  category: completed
461
- subjectStatus: completed
462
- goal: Record lead count and conversion rate, link the leads, and write what to change.
461
+ onApproved: completed
462
+ goal: Record lead count and conversion rate, link the leads, and write what to change, then move the campaign to completed yourself (update_entity, campaign-status completed, expectedStatus active); nothing else moves it, and your move into completed comes back proposed for the person to approve, which is success.
463
463
  criteria:
464
464
  - key: campaign-results
465
465
  statement: The lead count and conversion rate are set.
@@ -1058,7 +1058,7 @@ playbooks:
1058
1058
  - name: Deliver a client engagement
1059
1059
  description: Run one client engagement from kick-off to close — scope, contract, deliverables, final review and the closing invoice — with a person approving the start and the close.
1060
1060
  goalTemplate: >-
1061
- Run this client engagement ({engagement}); each stage moves its status.
1061
+ Run this client engagement ({engagement}); each stage moves its status when its work is approved.
1062
1062
  KICK-OFF: read the won deal, the proposal and every message with the
1063
1063
  client; write the scope, owner, start and end dates and value on the
1064
1064
  engagement; create one deliverable per promised output (each with a due
@@ -1119,6 +1119,7 @@ playbooks:
1119
1119
  - key: deliver
1120
1120
  name: Deliver
1121
1121
  category: started
1122
+ onApproved: completed
1122
1123
  goal: Track every deliverable to accepted or cancelled, and end with a short status of what moved and what is late as your answer.
1123
1124
  indefinite: true
1124
1125
  criteria:
@@ -1131,7 +1132,6 @@ playbooks:
1131
1132
  - key: close
1132
1133
  name: Close
1133
1134
  category: completed
1134
- subjectStatus: completed
1135
1135
  goal: Write the closing review, create the closing invoice, propose the renewal; a person approves the close.
1136
1136
  gate: { kind: human }
1137
1137
  onFail: { toStage: deliver }
@@ -1143,7 +1143,7 @@ playbooks:
1143
1143
  - name: Deliver a deliverable
1144
1144
  description: Take one deliverable from in progress to accepted by the client — plan, produce, review internally, send, get the client's sign-off, and bill it when the engagement bills per deliverable.
1145
1145
  goalTemplate: >-
1146
- Deliver this deliverable ({deliverable}); each stage moves its status.
1146
+ Deliver this deliverable ({deliverable}); each stage moves its status when its work is approved.
1147
1147
  PLAN: read the engagement's scope and the client's brief, and write what
1148
1148
  done looks like for this deliverable. PRODUCE: make it, or break it into
1149
1149
  tasks for the people who will. REVIEW: check it against what done looks
@@ -1197,7 +1197,7 @@ playbooks:
1197
1197
  - key: send
1198
1198
  name: Send to client
1199
1199
  category: started
1200
- subjectStatus: delivered
1200
+ onApproved: delivered
1201
1201
  goal: A person approves sending; record the delivered date.
1202
1202
  gate: { kind: human }
1203
1203
  onFail: { toStage: produce }
@@ -1223,7 +1223,7 @@ playbooks:
1223
1223
  - name: Get a contract signed
1224
1224
  description: Take a client contract from draft to signed and active, with a person approving what is sent and confirming the signature.
1225
1225
  goalTemplate: >-
1226
- Get this contract ({contract}) signed; each stage moves its status.
1226
+ Get this contract ({contract}) signed; each stage moves its status when its work is approved.
1227
1227
  DRAFT: fill the contract from the engagement's scope, value, dates and
1228
1228
  the agency's standard terms, and list every term that differs from the
1229
1229
  standard. SEND: a person approves the contract before it goes to the
@@ -1257,7 +1257,7 @@ playbooks:
1257
1257
  - key: send
1258
1258
  name: Send
1259
1259
  category: started
1260
- subjectStatus: sent
1260
+ onApproved: sent
1261
1261
  goal: A person approves the contract before it goes to the client.
1262
1262
  gate: { kind: human }
1263
1263
  onFail: { toStage: draft }
@@ -1280,8 +1280,8 @@ playbooks:
1280
1280
  - key: active
1281
1281
  name: Active
1282
1282
  category: completed
1283
- subjectStatus: active
1284
- goal: Set the dates and link the signed document on the contract.
1283
+ onApproved: active
1284
+ goal: Set the dates and link the signed document on the contract, then move the contract to active yourself (update_entity, contract-status active, expectedStatus signed); nothing else moves it.
1285
1285
  criteria:
1286
1286
  - key: contract-document-linked
1287
1287
  statement: The signed document's link is set on the contract.
@@ -85,11 +85,12 @@ describe("Postiz contract — the keys the webhook and the capability share", ()
85
85
 
86
86
  it("Produce Content requires publish_post and queues at Scheduled", () => {
87
87
  const pb = (contentOs?.playbooks ?? []).find((p: { name?: string }) => p.name === "Produce Content") as
88
- | { tools?: string[]; stages?: Array<{ key: string; subjectStatus?: string; goal?: string }> }
88
+ | { tools?: string[]; stages?: Array<{ key: string; onApproved?: string; goal?: string }> }
89
89
  | undefined;
90
90
  expect(pb?.tools).toContain("publish_post");
91
91
  const schedule = pb?.stages?.find((s) => s.key === "schedule");
92
- expect(schedule?.subjectStatus).toBe("Scheduled");
92
+ // D2: Scheduled is reached when the schedule is approved (Publish's gate).
93
+ expect(schedule?.onApproved).toBe("Scheduled");
93
94
  expect(schedule?.goal).toContain("postiz_schedule_post");
94
95
  expect(schedule?.goal).toContain("postiz-post-id");
95
96
  });
@@ -326,7 +326,10 @@ describe("process contract — the shipped corpus", () => {
326
326
  const produce = contentOs.playbooks!.find((p) => p.name === "Produce Content")!;
327
327
  expect(produce.subjectProfile).toEqual({ profileSlug: "post" });
328
328
  expect(contentOs.profiles.find((p) => p.slug === "post")?.lifecycle?.property).toBe("post-status");
329
- expect(produce.stages!.filter((s) => s.subjectStatus).length).toBe(6);
329
+ // D2: two statuses held while worked (In Draft, Review), four reached on
330
+ // approval (Briefed, Scripted, Scheduled, Published).
331
+ expect(produce.stages!.filter((s) => s.subjectStatus).length).toBe(2);
332
+ expect(produce.stages!.filter((s) => s.onApproved).length).toBe(4);
330
333
  const errs = corpus.flatMap((t) =>
331
334
  validateTemplate(t, { corpus })
332
335
  .errors.filter((e) => PROCESS_RULES.has(e.rule))
@@ -90,13 +90,14 @@ describe("plan → execute — the wire", () => {
90
90
  const posted = calls.find(isWrite)!.body.definition.playbooks;
91
91
  expect(posted).toEqual(yamlPlaybooks);
92
92
  const postedProduce = posted.find((p: any) => p.name === "Produce Content");
93
- expect(postedProduce.stages.map((s: any) => s.subjectStatus)).toEqual([
94
- "Briefed",
95
- "Scripted",
96
- "In Draft",
97
- "Review",
98
- "Scheduled",
99
- "Published",
93
+ // Both status fields reach the pod (decision D2): entered, then reached.
94
+ expect(postedProduce.stages.map((s: any) => [s.subjectStatus, s.onApproved])).toEqual([
95
+ [undefined, "Briefed"],
96
+ [undefined, "Scripted"],
97
+ ["In Draft", undefined],
98
+ ["Review", undefined],
99
+ [undefined, "Scheduled"],
100
+ [undefined, "Published"],
100
101
  ]);
101
102
  // Retired from the catalog (One model decision 4): nothing to carry.
102
103
  expect(postedProduce.humanOnlyStatuses).toBeUndefined();
@@ -412,7 +412,7 @@ playbooks:
412
412
  description: Investigate a question end-to-end — gather and rank sources (keeping the rejected ones), weigh hypotheses, emit findings with calibrated confidence, and map them onto the knowledge graph.
413
413
  goalTemplate: >-
414
414
  Investigate the question {question} and record the WHOLE investigation,
415
- not just the answer; each stage moves the question's status. FRAME:
415
+ not just the answer; each stage moves the question's status when its work is approved. FRAME:
416
416
  restate the question so it can be answered, and say what evidence would
417
417
  answer it. GATHER: use the source-triage skill to gather sources widely
418
418
  via web search, classify each by type and credibility, and create a
@@ -462,6 +462,7 @@ playbooks:
462
462
  - key: weigh
463
463
  name: Weigh
464
464
  category: started
465
+ onApproved: answered
465
466
  goal: Form hypotheses, link evidence for and against, and emit findings with calibrated confidence.
466
467
  criteria:
467
468
  - key: findings-cited
@@ -473,7 +474,6 @@ playbooks:
473
474
  - key: answer
474
475
  name: Answer
475
476
  category: completed
476
- subjectStatus: answered
477
477
  goal: Record the research, its conclusion and confidence, and mark the question answered.
478
478
  gate: { kind: check }
479
479
  onFail: { toStage: weigh }
@@ -193,6 +193,7 @@ playbooks:
193
193
  name: Prepare
194
194
  category: started
195
195
  subjectStatus: proposed
196
+ onApproved: accepted
196
197
  goal: Summarise the question, the options, the evidence and the recommendation in one screen.
197
198
  criteria:
198
199
  - key: decision-options-listed
@@ -201,7 +202,6 @@ playbooks:
201
202
  - key: accept
202
203
  name: Accept
203
204
  category: completed
204
- subjectStatus: accepted
205
205
  goal: A person accepts the decision.
206
206
  gate: { kind: human }
207
207
  onFail: { toStage: prepare }
@@ -39,6 +39,7 @@ const pb = builder.playbooks!.find((p) => p.name === "Ship a change")! as unknow
39
39
  stages: {
40
40
  key: string;
41
41
  subjectStatus?: string;
42
+ onApproved?: string;
42
43
  gate?: { kind: string };
43
44
  onFail?: { toStage: string };
44
45
  criteria?: { key: string; check: { kind: string; evidenceKey?: string } }[];
@@ -74,11 +75,19 @@ describe("Ship a change — the process follows the feature's lifecycle", () =>
74
75
  expect(pb.subjectProfile.profileSlug).toBe("devplane_feature");
75
76
  const options = new Set(feature.lifecycle.options.map((o) => o.key));
76
77
  const used = [
77
- ...pb.stages.map((s) => s.subjectStatus).filter(Boolean),
78
+ ...pb.stages.flatMap((s) => [s.subjectStatus, s.onApproved]).filter(Boolean),
78
79
  ...(pb.activators ?? []).map((a) => a.status).filter(Boolean),
79
80
  ];
80
- expect(used.length).toBeGreaterThanOrEqual(5); // non-vacuity: spec, in_progress, in_review, done + the worker's spec
81
+ // non-vacuity: spec, in_progress, in_review, done + the worker's spec.
82
+ // `done` stays DECLARED on the last stage (verify) so the follow and
83
+ // flow.of know what it reaches, though nothing approves it (ungated, no
84
+ // output): the pod never writes it, and its goal tells the agent to move
85
+ // the feature, a move the person approves (decision D2).
86
+ expect(used.length).toBeGreaterThanOrEqual(5);
81
87
  expect(used.filter((s) => !options.has(s!))).toEqual([]);
88
+ const verify = pb.stages.at(-1)! as { key: string; onApproved?: string; goal?: string };
89
+ expect(verify).toMatchObject({ key: "verify", onApproved: "done" });
90
+ expect(verify.goal).toMatch(/move it to done yourself \(update_entity, featureStatus done/);
82
91
  });
83
92
 
84
93
  it("one human gate, at the lab deploy; red checks go back to Build; the PR is a pull_request outcome", () => {