@warpgogol/forge 9.4.0 → 9.5.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.
Files changed (167) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +4 -2
  3. package/README.uk.md +10 -8
  4. package/bin/cli.ts +152 -11
  5. package/dist/bin/cli.js +125 -5
  6. package/dist/bin/cli.js.map +1 -1
  7. package/dist/os/flow/dirty-classify.d.ts +11 -1
  8. package/dist/os/flow/dirty-classify.d.ts.map +1 -1
  9. package/dist/os/flow/dirty-classify.js +13 -0
  10. package/dist/os/flow/dirty-classify.js.map +1 -1
  11. package/dist/os/flow/flow.module.d.ts.map +1 -1
  12. package/dist/os/flow/flow.module.js +29 -3
  13. package/dist/os/flow/flow.module.js.map +1 -1
  14. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
  15. package/dist/os/flow/handlers/flow-check.js +9 -9
  16. package/dist/os/flow/handlers/flow-check.js.map +1 -1
  17. package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
  18. package/dist/os/flow/handlers/flow-cut.js +22 -8
  19. package/dist/os/flow/handlers/flow-cut.js.map +1 -1
  20. package/dist/os/flow/handlers/flow-integrate.d.ts +6 -0
  21. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
  22. package/dist/os/flow/handlers/flow-integrate.js +155 -44
  23. package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
  24. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
  25. package/dist/os/flow/handlers/flow-open.js +14 -19
  26. package/dist/os/flow/handlers/flow-open.js.map +1 -1
  27. package/dist/os/flow/handlers/flow-peers.d.ts +24 -0
  28. package/dist/os/flow/handlers/flow-peers.d.ts.map +1 -0
  29. package/dist/os/flow/handlers/flow-peers.js +99 -0
  30. package/dist/os/flow/handlers/flow-peers.js.map +1 -0
  31. package/dist/os/flow/index.d.ts +3 -0
  32. package/dist/os/flow/index.d.ts.map +1 -1
  33. package/dist/os/flow/index.js +9 -4
  34. package/dist/os/flow/index.js.map +1 -1
  35. package/dist/os/flow/ops-registry.d.ts +33 -0
  36. package/dist/os/flow/ops-registry.d.ts.map +1 -0
  37. package/dist/os/flow/ops-registry.js +177 -0
  38. package/dist/os/flow/ops-registry.js.map +1 -0
  39. package/dist/os/flow/preflight.d.ts +70 -3
  40. package/dist/os/flow/preflight.d.ts.map +1 -1
  41. package/dist/os/flow/preflight.js +545 -49
  42. package/dist/os/flow/preflight.js.map +1 -1
  43. package/dist/os/flow/registry.d.ts +2 -2
  44. package/dist/os/flow/standalone-invoke.d.ts +11 -0
  45. package/dist/os/flow/standalone-invoke.d.ts.map +1 -0
  46. package/dist/os/flow/standalone-invoke.js +75 -0
  47. package/dist/os/flow/standalone-invoke.js.map +1 -0
  48. package/dist/os/gate-run/detach.d.ts +27 -0
  49. package/dist/os/gate-run/detach.d.ts.map +1 -0
  50. package/dist/os/gate-run/detach.js +85 -0
  51. package/dist/os/gate-run/detach.js.map +1 -0
  52. package/dist/os/gate-run/gate-run.module.d.ts +3 -0
  53. package/dist/os/gate-run/gate-run.module.d.ts.map +1 -0
  54. package/dist/os/gate-run/gate-run.module.js +23 -0
  55. package/dist/os/gate-run/gate-run.module.js.map +1 -0
  56. package/dist/os/gate-run/index.d.ts +7 -0
  57. package/dist/os/gate-run/index.d.ts.map +1 -0
  58. package/dist/os/gate-run/index.js +5 -0
  59. package/dist/os/gate-run/index.js.map +1 -0
  60. package/dist/os/gate-run/record.d.ts +47 -0
  61. package/dist/os/gate-run/record.d.ts.map +1 -0
  62. package/dist/os/gate-run/record.js +157 -0
  63. package/dist/os/gate-run/record.js.map +1 -0
  64. package/dist/os/gate-run/status.d.ts +41 -0
  65. package/dist/os/gate-run/status.d.ts.map +1 -0
  66. package/dist/os/gate-run/status.js +142 -0
  67. package/dist/os/gate-run/status.js.map +1 -0
  68. package/dist/os/gate-run/types.d.ts +47 -0
  69. package/dist/os/gate-run/types.d.ts.map +1 -0
  70. package/dist/os/gate-run/types.js +24 -0
  71. package/dist/os/gate-run/types.js.map +1 -0
  72. package/dist/os/mission/handlers/archive.d.ts.map +1 -1
  73. package/dist/os/mission/handlers/archive.js +12 -8
  74. package/dist/os/mission/handlers/archive.js.map +1 -1
  75. package/dist/os/mission/importer-block.d.ts +19 -0
  76. package/dist/os/mission/importer-block.d.ts.map +1 -0
  77. package/dist/os/mission/importer-block.js +124 -0
  78. package/dist/os/mission/importer-block.js.map +1 -0
  79. package/dist/os/mission/lockfile.d.ts +17 -0
  80. package/dist/os/mission/lockfile.d.ts.map +1 -1
  81. package/dist/os/mission/lockfile.js +38 -0
  82. package/dist/os/mission/lockfile.js.map +1 -1
  83. package/dist/os/rfc/evidence-annotation.d.ts +26 -0
  84. package/dist/os/rfc/evidence-annotation.d.ts.map +1 -0
  85. package/dist/os/rfc/evidence-annotation.js +52 -0
  86. package/dist/os/rfc/evidence-annotation.js.map +1 -0
  87. package/dist/os/rfc/handlers/fixed-inputs.d.ts.map +1 -1
  88. package/dist/os/rfc/handlers/fixed-inputs.js +7 -1
  89. package/dist/os/rfc/handlers/fixed-inputs.js.map +1 -1
  90. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  91. package/dist/os/rfc/handlers/implement-stamp.js +21 -28
  92. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  93. package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
  94. package/dist/os/rfc/handlers/list-create.js +25 -3
  95. package/dist/os/rfc/handlers/list-create.js.map +1 -1
  96. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  97. package/dist/os/rfc/handlers/validate-rules.js +127 -7
  98. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  99. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  100. package/dist/os/rfc/rfc.module.js +3 -2
  101. package/dist/os/rfc/rfc.module.js.map +1 -1
  102. package/dist/os/rfc/types.d.ts +9 -2
  103. package/dist/os/rfc/types.d.ts.map +1 -1
  104. package/dist/os/rfc/types.js +2 -2
  105. package/dist/os/rfc/types.js.map +1 -1
  106. package/dist/os/system/handlers/system-task-collect.d.ts.map +1 -1
  107. package/dist/os/system/handlers/system-task-collect.js +11 -5
  108. package/dist/os/system/handlers/system-task-collect.js.map +1 -1
  109. package/dist/src/cli-flags.d.ts.map +1 -1
  110. package/dist/src/cli-flags.js +6 -0
  111. package/dist/src/cli-flags.js.map +1 -1
  112. package/dist/src/onboarding/prettierignore.d.ts.map +1 -1
  113. package/dist/src/onboarding/prettierignore.js +2 -0
  114. package/dist/src/onboarding/prettierignore.js.map +1 -1
  115. package/dist/src/types.d.ts +7 -0
  116. package/dist/src/types.d.ts.map +1 -1
  117. package/dist/src/types.js +2 -8
  118. package/dist/src/types.js.map +1 -1
  119. package/os/flow/dirty-classify.ts +21 -0
  120. package/os/flow/flow.module.ts +31 -3
  121. package/os/flow/handlers/flow-check.ts +17 -18
  122. package/os/flow/handlers/flow-cut.ts +28 -11
  123. package/os/flow/handlers/flow-integrate.ts +229 -62
  124. package/os/flow/handlers/flow-open.ts +24 -31
  125. package/os/flow/handlers/flow-peers.ts +142 -0
  126. package/os/flow/index.ts +10 -8
  127. package/os/flow/ops-registry.ts +194 -0
  128. package/os/flow/preflight.ts +608 -55
  129. package/os/flow/standalone-invoke.ts +85 -0
  130. package/os/flow/tests/dirty-classify.test.ts +139 -4
  131. package/os/flow/tests/flow-cut.test.ts +21 -0
  132. package/os/flow/tests/flow-integrate.preflight.test.ts +34 -9
  133. package/os/flow/tests/flow-integrate.test.ts +433 -17
  134. package/os/flow/tests/lockfile-induced.test.ts +328 -0
  135. package/os/flow/tests/ops-registry.test.ts +136 -0
  136. package/os/gate-run/detach.ts +106 -0
  137. package/os/gate-run/gate-run.module.ts +25 -0
  138. package/os/gate-run/index.ts +16 -0
  139. package/os/gate-run/record.ts +194 -0
  140. package/os/gate-run/status.ts +168 -0
  141. package/os/gate-run/tests/gate-run-detach.test.ts +144 -0
  142. package/os/gate-run/tests/gate-run-record.test.ts +200 -0
  143. package/os/gate-run/types.ts +73 -0
  144. package/os/mission/handlers/archive.ts +22 -14
  145. package/os/mission/importer-block.ts +119 -0
  146. package/os/mission/lockfile.ts +41 -0
  147. package/os/rfc/evidence-annotation.ts +61 -0
  148. package/os/rfc/handlers/fixed-inputs.test.ts +70 -0
  149. package/os/rfc/handlers/fixed-inputs.ts +11 -1
  150. package/os/rfc/handlers/implement-stamp.ts +25 -28
  151. package/os/rfc/handlers/list-create.test.ts +58 -5
  152. package/os/rfc/handlers/list-create.ts +30 -3
  153. package/os/rfc/handlers/validate-evidence-shape.test.ts +218 -0
  154. package/os/rfc/handlers/validate-probe-meta.test.ts +71 -0
  155. package/os/rfc/handlers/validate-rules.ts +169 -17
  156. package/os/rfc/handlers/validate-transient-probes.test.ts +222 -0
  157. package/os/rfc/rfc-0000-template.md +10 -10
  158. package/os/rfc/rfc.module.ts +3 -2
  159. package/os/rfc/types.ts +5 -2
  160. package/os/system/handlers/system-task-collect.ts +11 -5
  161. package/os/system/tests/system-task-collect.test.ts +16 -0
  162. package/package.json +17 -1
  163. package/skills/fo/fo-session-retro/SKILL.md +12 -4
  164. package/src/cli-flags.ts +7 -0
  165. package/src/onboarding/prettierignore.ts +2 -0
  166. package/src/tests/prettierignore-manage.test.ts +11 -0
  167. package/src/types.ts +9 -8
@@ -0,0 +1,85 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>Standalone invoke adapter for flow handlers (RFC-1545) — when no
4
+ kernel invoke port is present, generated-owner regeneration commands still
5
+ run by spawning `pnpm exec werkstatt run <command>` inside the session
6
+ worktree, allowlisted to the declared generated-path owners only.</purpose>
7
+ <non-goals>
8
+ <item>No in-process dispatch — forge's standalone registry builder lives in bin/cli.ts and is not an os/ seam; the spawn contract keeps the adapter kernel-free (FORGE-AUTONOMY-01).</item>
9
+ <item>No free-form command execution — only owner commands recovered from generated-path declarations/markers may run, and flow.integrate is excluded (no re-entrant recursion).</item>
10
+ </non-goals>
11
+ </MODULE_CONTRACT>
12
+ <KEY_DECISIONS>
13
+ <item>Spawn over in-process dispatch: the kernel invoke port delegates through its own executor, but the standalone CLI has no registry surface reachable from os/ — `pnpm exec werkstatt run` resolves the worktree's own engine build, matching how an operator would run the owner command by hand.</item>
14
+ <item>The allowlist is caller-derived (verdict.owners), not a static table — classifyRebaseConflicts only ever names commands recovered from generated markers or GENERATED_BASENAME_OWNERS, so the spawn surface stays bounded by the declaration layer.</item>
15
+ </KEY_DECISIONS>
16
+ <CHANGE_SUMMARY>
17
+ <item>RFC-1545: standalone invoke adapter for declared-generated rebase conflict regeneration under the forge CLI</item>
18
+ <item>RFC-1545: standalone generated-conflict regeneration in flow.integrate</item>
19
+ </CHANGE_SUMMARY>
20
+ */
21
+
22
+ import type {
23
+ ExecResult,
24
+ ForgeFlagValue,
25
+ ForgeInvokeCommand,
26
+ WorkspaceIO,
27
+ } from "../../src/types.ts";
28
+
29
+ /** Serialize the flag record to argv — `true` → `--key`, `false` → `--no-key`, strings/arrays → `--key value`. */
30
+ function flagArgs(flags?: Record<string, ForgeFlagValue>): string[] {
31
+ const args: string[] = [];
32
+ for (const [key, value] of Object.entries(flags ?? {})) {
33
+ if (value === true) args.push(`--${key}`);
34
+ else if (value === false) args.push(`--no-${key}`);
35
+ else if (Array.isArray(value)) for (const v of value) args.push(`--${key}`, v);
36
+ else args.push(`--${key}`, String(value));
37
+ }
38
+ return args;
39
+ }
40
+
41
+ /**
42
+ * RFC-1545 AC-2: `ForgeInvokeCommand` for the standalone `forge` CLI —
43
+ * resolves each allowlisted owner command through `pnpm exec werkstatt run`
44
+ * spawned in the session worktree (the worktree's own dependency graph
45
+ * decides which werkstatt build answers). Non-allowlisted commands fail
46
+ * closed; a spawn failure or non-zero exit surfaces as a ForgeInvokeResult
47
+ * the caller escalates to FLOW-INT-02.
48
+ */
49
+ export function standaloneInvoke(
50
+ io: WorkspaceIO,
51
+ worktreePath: string,
52
+ allowedCommands: readonly string[],
53
+ ): ForgeInvokeCommand {
54
+ const allowlist = new Set(allowedCommands);
55
+ return async (commandName, flags) => {
56
+ if (commandName === "flow.integrate" || !allowlist.has(commandName)) {
57
+ return {
58
+ exitCode: 1,
59
+ ok: false,
60
+ summary: `${commandName} is not in the generated-owner allowlist — refusing standalone invocation`,
61
+ };
62
+ }
63
+ let result: ExecResult;
64
+ try {
65
+ result = await io.exec(
66
+ "pnpm",
67
+ ["exec", "werkstatt", "run", commandName, ...flagArgs(flags)],
68
+ { cwd: worktreePath },
69
+ );
70
+ } catch (error) {
71
+ return {
72
+ exitCode: 1,
73
+ ok: false,
74
+ summary: `standalone invoke of ${commandName} failed to spawn: ${error instanceof Error ? error.message : String(error)}`,
75
+ };
76
+ }
77
+ const exitCode = result.exitCode ?? 1;
78
+ const tail = (result.stderr.trim() || result.stdout.trim()).split("\n").pop() ?? "";
79
+ return {
80
+ exitCode,
81
+ ok: exitCode === 0,
82
+ summary: tail || `exit ${exitCode}`,
83
+ };
84
+ };
85
+ }
@@ -11,10 +11,24 @@ and the sweep subject stays the fixed literal the RFC pins.</purpose>
11
11
  <CHANGE_SUMMARY>
12
12
  <item>RFC-1531: closed dirty-path classifier + remediation flags on flow.integrate</item>
13
13
  <item>RFC-1531: add flow.integrate remediation flags on the shared dirty classifier</item>
14
+ <item>RFC-1543: attribute shared-checkout dirt to live ops and expose peers (RFC-1543)</item>
15
+ <item>RFC-1544: attribute mission lockfile churn to owning checkout and auto-resolve foreign importer diffs (RFC-1544)</item>
14
16
  </CHANGE_SUMMARY>
15
17
  */
16
18
 
17
- import { describe, expect, it } from "vitest";
19
+ import { describe, expect, it, afterEach } from "vitest";
20
+ import { mkdtemp, rm } from "node:fs/promises";
21
+ import { tmpdir } from "node:os";
22
+ import { join } from "node:path";
23
+
24
+ import { ambientIo } from "../../../src/utils/io.ts";
25
+
26
+ const dirs: string[] = [];
27
+ afterEach(async () => {
28
+ for (const dir of dirs.splice(0)) {
29
+ await rm(dir, { recursive: true, force: true });
30
+ }
31
+ });
18
32
 
19
33
  import {
20
34
  AUTO_CLEAN_PASS_CLASSES,
@@ -90,9 +104,7 @@ describe("classifyDirtyTree / summarizeClasses", () => {
90
104
  });
91
105
 
92
106
  it("a trailing-slash untracked dir still classifies on its name", () => {
93
- expect(classifyDirtyTree(["?? tmp-e2e/"])).toEqual([
94
- { path: "tmp-e2e/", class: "disposable" },
95
- ]);
107
+ expect(classifyDirtyTree(["?? tmp-e2e/"])).toEqual([{ path: "tmp-e2e/", class: "disposable" }]);
96
108
  });
97
109
  });
98
110
 
@@ -114,3 +126,126 @@ describe("constants the RFC pins", () => {
114
126
  expect(AUTO_CLEAN_PASS_CLASSES).not.toContain("work");
115
127
  });
116
128
  });
129
+
130
+ // RFC-1543 AC-3/AC-5: classifyDirt's claims step — unattributed paths covered
131
+ // by a live op-claim reclassify in-flight-foreign; everything else stays
132
+ // work. The classifier consumes the claim LIST the caller resolved —
133
+ // liveness itself is ops-registry's job.
134
+ describe("classifyDirt — op-claim attribution (RFC-1543)", () => {
135
+ const liveClaim: import("../ops-registry.ts").OpClaim = {
136
+ schema: "forge/op-claim@1",
137
+ opId: "op-live",
138
+ command: "leitstand.ship",
139
+ pid: process.pid,
140
+ host: "h",
141
+ startedAt: new Date().toISOString(),
142
+ heartbeatAt: new Date().toISOString(),
143
+ workspaceRoot: "/repo",
144
+ paths: ["docs/", "pnpm-lock.yaml"],
145
+ };
146
+
147
+ it("an unattributed path under a live claim classifies in-flight-foreign", async () => {
148
+ const { classifyDirt } = await import("../preflight.ts");
149
+ const repo = await mkdtemp(join(tmpdir(), "dirt-"));
150
+ dirs.push(repo);
151
+ const verdict = await classifyDirt(
152
+ repo,
153
+ ambientIo,
154
+ [" M src/work.ts", " M docs/rfcs/rfc-1.md"],
155
+ { runGit: async () => ({ exitCode: 1, stdout: "", stderr: "" }) },
156
+ [liveClaim],
157
+ );
158
+ expect(verdict.foreignInFlight).toEqual([{ path: "docs/rfcs/rfc-1.md", holder: liveClaim }]);
159
+ expect(verdict.unattributed).toEqual([" M src/work.ts"]);
160
+ });
161
+
162
+ it("no claims → identical unattributed output (AC-5: claims only add tolerance)", async () => {
163
+ const { classifyDirt } = await import("../preflight.ts");
164
+ const repo = await mkdtemp(join(tmpdir(), "dirt-"));
165
+ dirs.push(repo);
166
+ const entries = [" M docs/rfcs/rfc-1.md", " M src/work.ts"];
167
+ const withClaims = await classifyDirt(repo, ambientIo, entries, {
168
+ runGit: async () => ({ exitCode: 1, stdout: "", stderr: "" }),
169
+ });
170
+ expect(withClaims.unattributed).toEqual(entries);
171
+ expect(withClaims.foreignInFlight).toEqual([]);
172
+ });
173
+ });
174
+
175
+ // RFC-1544 AC-1/AC-3: the importer-prune class splits by referent — a live
176
+ // foreign open mission yields foreign-open-mission; residue in no checkout
177
+ // and no open mission yields importer-prune-stale; no resolver keeps the
178
+ // legacy importer-prune class.
179
+ const PRUNE_DIFF_1544 = [
180
+ "diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml",
181
+ "index abc..def 100644",
182
+ "--- a/pnpm-lock.yaml",
183
+ "+++ b/pnpm-lock.yaml",
184
+ "@@ -10,7 +10,6 @@ importers:",
185
+ "- missions/m000214/workpiece:",
186
+ "- dependencies:",
187
+ "- vite: 5.0.0",
188
+ " packages:",
189
+ ].join("\n");
190
+
191
+ describe("classifyDirt — importer-prune referents (RFC-1544)", () => {
192
+ const runGit = async () => ({ exitCode: 0, stdout: PRUNE_DIFF_1544, stderr: "" });
193
+ const entries = [" M pnpm-lock.yaml"];
194
+
195
+ it("AC-1: a foreign checkout's open mission classifies foreign-open-mission", async () => {
196
+ const { classifyDirt } = await import("../preflight.ts");
197
+ const repo = await mkdtemp(join(tmpdir(), "dirt-"));
198
+ dirs.push(repo);
199
+ const verdict = await classifyDirt(repo, ambientIo, entries, { runGit }, [], async (ids) =>
200
+ ids.map((missionId) => ({
201
+ missionId,
202
+ existsHere: false,
203
+ existsInCheckout: ["/repo@auto/foreign"],
204
+ missionOpen: true,
205
+ })),
206
+ );
207
+ expect(verdict.tolerated).toEqual([
208
+ {
209
+ path: "pnpm-lock.yaml",
210
+ class: "foreign-open-mission",
211
+ missionIds: ["m000214"],
212
+ },
213
+ ]);
214
+ expect(verdict.unattributed).toEqual([]);
215
+ });
216
+
217
+ it("AC-3: residue in no checkout and no open mission classifies importer-prune-stale", async () => {
218
+ const { classifyDirt } = await import("../preflight.ts");
219
+ const repo = await mkdtemp(join(tmpdir(), "dirt-"));
220
+ dirs.push(repo);
221
+ const verdict = await classifyDirt(repo, ambientIo, entries, { runGit }, [], async (ids) =>
222
+ ids.map((missionId) => ({
223
+ missionId,
224
+ existsHere: false,
225
+ existsInCheckout: [],
226
+ missionOpen: false,
227
+ })),
228
+ );
229
+ expect(verdict.tolerated).toEqual([
230
+ {
231
+ path: "pnpm-lock.yaml",
232
+ class: "importer-prune-stale",
233
+ missionIds: ["m000214"],
234
+ },
235
+ ]);
236
+ });
237
+
238
+ it("no resolver keeps the legacy importer-prune class", async () => {
239
+ const { classifyDirt } = await import("../preflight.ts");
240
+ const repo = await mkdtemp(join(tmpdir(), "dirt-"));
241
+ dirs.push(repo);
242
+ const verdict = await classifyDirt(repo, ambientIo, entries, { runGit });
243
+ expect(verdict.tolerated).toEqual([
244
+ {
245
+ path: "pnpm-lock.yaml",
246
+ class: "importer-prune",
247
+ missionIds: ["m000214"],
248
+ },
249
+ ]);
250
+ });
251
+ });
@@ -21,6 +21,7 @@ resume path (AC-5: subject-named tags missing → tail re-runs).</purpose>
21
21
  <item>RFC-1490: step 4 — ordinary flow.cut (release branch, verified versions, gate, main swap, tags, resume)</item>
22
22
  <item>RFC-1490: independent-review pass — lock-held planning, fix-branch verification, spec-shaped data, coverage</item>
23
23
  <item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
24
+ <item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
24
25
  </CHANGE_SUMMARY>
25
26
  */
26
27
 
@@ -321,3 +322,23 @@ describe("flow.cut — ordinary path", () => {
321
322
  expect(result.data?.diagnostics[0]?.ruleId).toBe("FLOW-INT-06");
322
323
  }, 30_000);
323
324
  });
325
+
326
+ describe("flow.cut — resume requires matching --lines (RFC-1546 AC-3)", () => {
327
+ it("a chore(release): tip with mismatched --lines cuts fresh, not a resume", async () => {
328
+ const repo = await adoptedRepo({ packageLine: true });
329
+ // Leave a partial repo-line release as the develop tip (hook fails).
330
+ const hookPath = join(repo, "hooks/release-fingerprints.sh");
331
+ await writeFile(hookPath, "#!/bin/sh\nexit 1\n");
332
+ const refused = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
333
+ expect(refused.diagnostics[0]?.ruleId).toBe("FLOW-CUT-08");
334
+ const subject = (await gitExec(repo, ["log", "-1", "--format=%s", "develop"])).stdout.trim();
335
+ expect(subject).toBe("chore(release): v0.1.1");
336
+ await rm(hookPath);
337
+ // Requested set (repo+lib) differs from the tip subject's (repo only) —
338
+ // the tip must not be adopted as a resumable tail.
339
+ const data = await runOrdinaryCut(repo, ambientIo, { lines: ["lib"], dryRun: false });
340
+ expect(data.resumed).toBe(false);
341
+ expect(data.released).toBe(true);
342
+ expect(data.tags).toContain("lib@2.0.1");
343
+ }, 60_000);
344
+ });
@@ -9,12 +9,12 @@ git/status/invoke seams.</purpose>
9
9
  </non-goals>
10
10
  </MODULE_CONTRACT>
11
11
  <CHANGE_SUMMARY>
12
- <item>RFC-1528: initial — classifier shapes, refusal ordering, resolvability skips, FLOW-INT-12/13/14.</item>
13
- <item>RFC-1528: flow.integrate bounded preflight before rebase and gate
14
-
15
- Classified lockfile diffs on FLOW-INT-01/03, early primary check, and resolvable validators (ecosystem.manifest.validate, scoped rfc.validate, friction.validate) refusing as FLOW-INT-12/13/14.</item>
16
12
  <item>RFC-1528: close review findings — manifest-union command inventory for regen/preflight</item>
17
13
  <item>RFC-1537: classify regenerable worktree dirt and journal integrate refusals cheapest-first</item>
14
+ <item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
15
+ <item>RFC-1544: attribute mission lockfile churn to owning checkout and auto-resolve foreign importer diffs (RFC-1544)</item>
16
+ <item>ADR-0129: F-0186/F-0187 — FLOW-INT-03 names paths + three-way remedy, FLOW-OPEN-01 same hint, forge CLI kernel-command hint</item>
17
+ <history>RFC-1528</history>
18
18
  </CHANGE_SUMMARY>
19
19
  */
20
20
 
@@ -181,7 +181,9 @@ describe("runIntegratePreflight (RFC-1528 AC-2/AC-4)", () => {
181
181
  stubDeps({ lockfileDiff: PRUNE_DIFF }),
182
182
  );
183
183
  expect(result.ok).toBe(true);
184
- expect(result.tolerated).toEqual([{ path: "pnpm-lock.yaml", class: "importer-prune" }]);
184
+ expect(result.tolerated).toEqual([
185
+ { path: "pnpm-lock.yaml", class: "importer-prune", missionIds: ["m000214"] },
186
+ ]);
185
187
  });
186
188
 
187
189
  it("primary tracked dirt refuses FLOW-INT-03 before validators", async () => {
@@ -202,7 +204,31 @@ describe("runIntegratePreflight (RFC-1528 AC-2/AC-4)", () => {
202
204
  expect(invokes).toEqual([]);
203
205
  });
204
206
 
205
- it("a stale manifest refuses FLOW-INT-12 before RFC/friction checks", async () => {
207
+ it("FLOW-INT-03 names the unattributed paths and the three-way remedy (ADR-0129 F-0186)", async () => {
208
+ const entries = Array.from(
209
+ { length: 23 },
210
+ (_, i) => ` M docs/file-${String(i).padStart(2, "0")}.md`,
211
+ );
212
+ const result = await runIntegratePreflight(
213
+ baseOpts({
214
+ invoke: async () => ({ ok: true, exitCode: 0 }) as ForgeInvokeResult,
215
+ }),
216
+ stubDeps({
217
+ primaryDirty: { entries, toleratedState: [], vanished: false },
218
+ }),
219
+ );
220
+ expect(result.refuse?.ruleId).toBe("FLOW-INT-03");
221
+ expect(result.refuse?.message).toContain("docs/file-00.md");
222
+ expect(result.refuse?.message).toContain("docs/file-19.md");
223
+ expect(result.refuse?.message).not.toContain("docs/file-20.md");
224
+ expect(result.refuse?.message).toContain("(+3 more)");
225
+ expect(result.refuse?.fixHint).toContain("your own work");
226
+ expect(result.refuse?.fixHint).toContain("git show HEAD:<path> > <path>");
227
+ expect(result.refuse?.fixHint).toContain("another session's work in progress");
228
+ expect(result.refuse?.data?.unattributed).toHaveLength(23);
229
+ });
230
+
231
+ it("a stale manifest without a resolvable generator still refuses FLOW-INT-12 (RFC-1546: after the other checks establish sole-ness)", async () => {
206
232
  const invokes: string[] = [];
207
233
  const result = await runIntegratePreflight(
208
234
  baseOpts({
@@ -216,7 +242,7 @@ describe("runIntegratePreflight (RFC-1528 AC-2/AC-4)", () => {
216
242
  stubDeps({}),
217
243
  );
218
244
  expect(result.refuse?.ruleId).toBe("FLOW-INT-12");
219
- expect(invokes).toEqual(["ecosystem.manifest.validate"]);
245
+ expect(invokes).toEqual(["ecosystem.manifest.validate", "friction.validate"]);
220
246
  });
221
247
 
222
248
  it("rfc.validate is scoped to RFC files changed on develop...branch", async () => {
@@ -376,8 +402,7 @@ const ioWith = (shape: {
376
402
  if (p in (shape.files ?? {})) return shape.files![p];
377
403
  throw new Error(`ENOENT ${p}`);
378
404
  },
379
- exists: async (p: string) =>
380
- p in (shape.files ?? {}) || (shape.dirs ?? []).includes(p),
405
+ exists: async (p: string) => p in (shape.files ?? {}) || (shape.dirs ?? []).includes(p),
381
406
  readFileBytes: async (p: string) => {
382
407
  if (p in (shape.files ?? {})) return new TextEncoder().encode(shape.files![p]);
383
408
  throw new Error(`ENOENT ${p}`);