@warpgogol/forge 9.2.3 → 9.3.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.
- package/CHANGELOG.md +25 -0
- package/bin/cli.ts +3 -2
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +23 -15
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-journal.js +9 -1
- package/dist/os/checks/handlers/counters-journal.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +27 -36
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/lock-holder.d.ts +32 -0
- package/dist/os/core/lock-holder.d.ts.map +1 -0
- package/dist/os/core/lock-holder.js +81 -0
- package/dist/os/core/lock-holder.js.map +1 -0
- package/dist/os/core/stamp-lock.d.ts +30 -0
- package/dist/os/core/stamp-lock.d.ts.map +1 -0
- package/dist/os/core/stamp-lock.js +112 -0
- package/dist/os/core/stamp-lock.js.map +1 -0
- package/dist/os/flow/digest.d.ts +19 -0
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +33 -4
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +61 -6
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/handlers/flow-cut.d.ts +8 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-cut.js +91 -5
- package/dist/os/flow/handlers/flow-cut.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +6 -0
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-discard.js +17 -13
- package/dist/os/flow/handlers/flow-discard.js.map +1 -1
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-fix.js +99 -10
- package/dist/os/flow/handlers/flow-fix.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +32 -15
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.d.ts +17 -0
- package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-publication-retire.js +132 -0
- package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -0
- package/dist/os/flow/handlers/flow-push.d.ts +7 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +106 -15
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/locks.d.ts +6 -1
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +53 -23
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/flow/publication-order.d.ts +25 -0
- package/dist/os/flow/publication-order.d.ts.map +1 -0
- package/dist/os/flow/publication-order.js +75 -0
- package/dist/os/flow/publication-order.js.map +1 -0
- package/dist/os/flow/publish.d.ts +18 -0
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +58 -2
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +1 -1
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +2 -1
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/flow/release-tags.d.ts +1 -0
- package/dist/os/flow/release-tags.d.ts.map +1 -1
- package/dist/os/flow/release-tags.js +5 -4
- package/dist/os/flow/release-tags.js.map +1 -1
- package/dist/os/flow/scripts.d.ts +1 -1
- package/dist/os/flow/scripts.d.ts.map +1 -1
- package/dist/os/flow/scripts.js +1 -0
- package/dist/os/flow/scripts.js.map +1 -1
- package/dist/os/flow/task-files.d.ts +11 -0
- package/dist/os/flow/task-files.d.ts.map +1 -0
- package/dist/os/flow/task-files.js +51 -0
- package/dist/os/flow/task-files.js.map +1 -0
- package/dist/os/flow/tests/helpers.d.ts +4 -1
- package/dist/os/flow/tests/helpers.d.ts.map +1 -1
- package/dist/os/flow/tests/helpers.js +9 -5
- package/dist/os/flow/tests/helpers.js.map +1 -1
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +30 -74
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/lockfile.d.ts +21 -0
- package/dist/os/mission/lockfile.d.ts.map +1 -0
- package/dist/os/mission/lockfile.js +76 -0
- package/dist/os/mission/lockfile.js.map +1 -0
- package/dist/os/mission/mission.module.d.ts.map +1 -1
- package/dist/os/mission/mission.module.js +2 -1
- package/dist/os/mission/mission.module.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +24 -19
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/system/handlers/outbox-validate.d.ts +8 -0
- package/dist/os/system/handlers/outbox-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/outbox-validate.js +102 -0
- package/dist/os/system/handlers/outbox-validate.js.map +1 -0
- package/dist/os/system/handlers/system-map-validate.d.ts +13 -0
- package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/system-map-validate.js +78 -0
- package/dist/os/system/handlers/system-map-validate.js.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts +10 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.js +195 -0
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -0
- package/dist/os/system/handlers/system-task-collect.d.ts +13 -0
- package/dist/os/system/handlers/system-task-collect.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-collect.js +238 -0
- package/dist/os/system/handlers/system-task-collect.js.map +1 -0
- package/dist/os/system/handlers/system-task-create.d.ts +32 -0
- package/dist/os/system/handlers/system-task-create.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-create.js +216 -0
- package/dist/os/system/handlers/system-task-create.js.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts +14 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.js +290 -0
- package/dist/os/system/handlers/system-task-dispatch.js.map +1 -0
- package/dist/os/system/handlers/system-task-move.d.ts +12 -0
- package/dist/os/system/handlers/system-task-move.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-move.js +217 -0
- package/dist/os/system/handlers/system-task-move.js.map +1 -0
- package/dist/os/system/handlers/system-task-status.d.ts +20 -0
- package/dist/os/system/handlers/system-task-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-status.js +139 -0
- package/dist/os/system/handlers/system-task-status.js.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts +12 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.js +332 -0
- package/dist/os/system/handlers/system-versionset-record.js.map +1 -0
- package/dist/os/system/index.d.ts +6 -0
- package/dist/os/system/index.d.ts.map +1 -0
- package/dist/os/system/index.js +18 -0
- package/dist/os/system/index.js.map +1 -0
- package/dist/os/system/outbox-schema.d.ts +30 -0
- package/dist/os/system/outbox-schema.d.ts.map +1 -0
- package/dist/os/system/outbox-schema.js +29 -0
- package/dist/os/system/outbox-schema.js.map +1 -0
- package/dist/os/system/repo.d.ts +64 -0
- package/dist/os/system/repo.d.ts.map +1 -0
- package/dist/os/system/repo.js +364 -0
- package/dist/os/system/repo.js.map +1 -0
- package/dist/os/system/scenario-schemas.d.ts +26 -0
- package/dist/os/system/scenario-schemas.d.ts.map +1 -0
- package/dist/os/system/scenario-schemas.js +53 -0
- package/dist/os/system/scenario-schemas.js.map +1 -0
- package/dist/os/system/schemas.d.ts +63 -0
- package/dist/os/system/schemas.d.ts.map +1 -0
- package/dist/os/system/schemas.js +83 -0
- package/dist/os/system/schemas.js.map +1 -0
- package/dist/os/system/system.module.d.ts +3 -0
- package/dist/os/system/system.module.d.ts.map +1 -0
- package/dist/os/system/system.module.js +429 -0
- package/dist/os/system/system.module.js.map +1 -0
- package/dist/os/system/task-schemas.d.ts +108 -0
- package/dist/os/system/task-schemas.d.ts.map +1 -0
- package/dist/os/system/task-schemas.js +152 -0
- package/dist/os/system/task-schemas.js.map +1 -0
- package/dist/os/system/task-store.d.ts +41 -0
- package/dist/os/system/task-store.d.ts.map +1 -0
- package/dist/os/system/task-store.js +142 -0
- package/dist/os/system/task-store.js.map +1 -0
- package/dist/os/system/tests/helpers.d.ts +30 -0
- package/dist/os/system/tests/helpers.d.ts.map +1 -0
- package/dist/os/system/tests/helpers.js +178 -0
- package/dist/os/system/tests/helpers.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -4
- package/dist/src/index.js.map +1 -1
- package/os/adr/handlers/implement-stamp-lock.test.ts +90 -0
- package/os/adr/handlers/implement-stamp.ts +29 -20
- package/os/checks/handlers/counters-journal.test.ts +10 -0
- package/os/checks/handlers/counters-journal.ts +8 -1
- package/os/core/core.module.ts +32 -36
- package/os/core/lock-holder.ts +88 -0
- package/os/core/stamp-lock.ts +142 -0
- package/os/flow/digest.ts +46 -4
- package/os/flow/flow.module.ts +62 -6
- package/os/flow/handlers/flow-cut.ts +118 -5
- package/os/flow/handlers/flow-digest.ts +6 -0
- package/os/flow/handlers/flow-discard.ts +22 -13
- package/os/flow/handlers/flow-fix.ts +116 -10
- package/os/flow/handlers/flow-integrate.ts +31 -15
- package/os/flow/handlers/flow-publication-retire.ts +156 -0
- package/os/flow/handlers/flow-push.ts +128 -13
- package/os/flow/locks.ts +75 -25
- package/os/flow/publication-order.ts +99 -0
- package/os/flow/publish.ts +73 -2
- package/os/flow/registry.ts +5 -2
- package/os/flow/release-tags.ts +5 -4
- package/os/flow/scripts.ts +2 -0
- package/os/flow/task-files.ts +59 -0
- package/os/flow/tests/flow-cut-prepare.test.ts +298 -0
- package/os/flow/tests/flow-cut.test.ts +5 -1
- package/os/flow/tests/flow-publication-retire.test.ts +191 -0
- package/os/flow/tests/flow-push-supersede.test.ts +221 -0
- package/os/flow/tests/flow-task-files.test.ts +59 -0
- package/os/flow/tests/helpers.ts +9 -5
- package/os/flow/tests/locks.test.ts +219 -0
- package/os/flow/tests/publication-order.test.ts +102 -0
- package/os/mission/handlers/archive.test.ts +97 -52
- package/os/mission/handlers/archive.ts +31 -76
- package/os/mission/lockfile.ts +84 -0
- package/os/mission/mission.module.ts +2 -1
- package/os/rfc/handlers/implement-stamp-lock.test.ts +133 -0
- package/os/rfc/handlers/implement-stamp.ts +30 -24
- package/os/system/handlers/outbox-validate.ts +120 -0
- package/os/system/handlers/system-map-validate.ts +107 -0
- package/os/system/handlers/system-outbox-scan.ts +320 -0
- package/os/system/handlers/system-task-collect.ts +305 -0
- package/os/system/handlers/system-task-create.ts +271 -0
- package/os/system/handlers/system-task-dispatch.ts +387 -0
- package/os/system/handlers/system-task-move.ts +353 -0
- package/os/system/handlers/system-task-status.ts +176 -0
- package/os/system/handlers/system-versionset-record.ts +476 -0
- package/os/system/index.ts +47 -0
- package/os/system/outbox-schema.ts +47 -0
- package/os/system/repo.ts +451 -0
- package/os/system/scenario-schemas.ts +62 -0
- package/os/system/schemas.ts +102 -0
- package/os/system/system.module.ts +449 -0
- package/os/system/task-schemas.ts +190 -0
- package/os/system/task-store.ts +184 -0
- package/os/system/tests/helpers.ts +189 -0
- package/os/system/tests/outbox-validate.test.ts +92 -0
- package/os/system/tests/system-map-validate.test.ts +321 -0
- package/os/system/tests/system-outbox-scan.test.ts +273 -0
- package/os/system/tests/system-profile.test.ts +90 -0
- package/os/system/tests/system-task-collect.test.ts +293 -0
- package/os/system/tests/system-task-dispatch.test.ts +279 -0
- package/os/system/tests/system-task-status.test.ts +153 -0
- package/os/system/tests/system-task.test.ts +330 -0
- package/os/system/tests/system-versionset.test.ts +314 -0
- package/package.json +33 -1
- package/profiles/system.yaml +650 -0
- package/skills/fo/fo-outbox/SKILL.md +71 -0
- package/skills/fo/fo-system-dispatch/SKILL.md +65 -0
- package/skills/fo/fo-task-run/SKILL.md +75 -0
- package/src/index.ts +11 -4
- package/src/tests/fixtures/agents-generate-business-before.txt +6 -0
- package/src/tests/profile-schema.test.ts +2 -1
|
@@ -17,7 +17,6 @@ a manual push path.</purpose>
|
|
|
17
17
|
<item>Publication failures are FLOW-PUSH-05 per tag; the command continues with the next tag and exits non-zero at the end.</item>
|
|
18
18
|
</KEY_DECISIONS>
|
|
19
19
|
<CHANGE_SUMMARY>
|
|
20
|
-
<item>RFC-1491: step 5 — flow.push (preflight, atomic push, publications, journals)</item>
|
|
21
20
|
<item>RFC-1491: step 5 — flow.push atomic outbound path + extract publication</item>
|
|
22
21
|
<item>RFC-1491: independent-review pass — shared lock constants, publishable pending filter, declared rules, hold ordering, sha-pinned refspecs</item>
|
|
23
22
|
<item>RFC-1501: one argv-shaped read-only git allowlist for the recording and read-only adapters (RFC-1501)
|
|
@@ -27,6 +26,9 @@ first-argument allowlist; the read-only adapter and the static scan use the same
|
|
|
27
26
|
table. The kernel forwards --dry-run into commands that declare a dry-run flag,
|
|
28
27
|
and flow.push / flow.hold dry-runs no longer fetch. The switch-over runbook goes
|
|
29
28
|
back to werkstatt run flow.install --dry-run.</item>
|
|
29
|
+
<item>RFC-1503: steps 1-5 — highest-per-line pending selection, publish-superseded/publish-retired journal events, flow.publication.retire</item>
|
|
30
|
+
<item>RFC-1503: review r1 — FLOW-07 on retire journal failure, journal re-read before publish, publication-order unit tests, stale catalog/inventory regen</item>
|
|
31
|
+
<history>RFC-1491</history>
|
|
30
32
|
</CHANGE_SUMMARY>
|
|
31
33
|
*/
|
|
32
34
|
|
|
@@ -40,7 +42,7 @@ import type {
|
|
|
40
42
|
WorkspaceIO,
|
|
41
43
|
} from "../../../src/types.ts";
|
|
42
44
|
import { resolveIo } from "../../../src/utils/io.ts";
|
|
43
|
-
import { collectDigest, lineForTag } from "../digest.ts";
|
|
45
|
+
import { collectDigest, lineForTag, versionOfTag } from "../digest.ts";
|
|
44
46
|
import {
|
|
45
47
|
git,
|
|
46
48
|
requireGit,
|
|
@@ -48,10 +50,12 @@ import {
|
|
|
48
50
|
} from "../git.ts";
|
|
49
51
|
import { markerIsValid } from "../markers.ts";
|
|
50
52
|
import { publishTag, tagAnnotationLevel, type PublicationRow } from "../publish.ts";
|
|
53
|
+
import { planPublications, type PublicationPlanEntry } from "../publication-order.ts";
|
|
51
54
|
import {
|
|
52
55
|
appendJournal,
|
|
53
56
|
commonGitDir,
|
|
54
57
|
FlowRegistrySchemaError,
|
|
58
|
+
readJournal,
|
|
55
59
|
} from "../registry.ts";
|
|
56
60
|
import { discoverReleaseLines, type ReleaseLine } from "../release-lines.ts";
|
|
57
61
|
import { primaryWorktree } from "../worktree-path.ts";
|
|
@@ -61,6 +65,10 @@ export interface FlowPushData {
|
|
|
61
65
|
pushed: boolean;
|
|
62
66
|
refs: string[];
|
|
63
67
|
publications: PublicationRow[];
|
|
68
|
+
/** RFC-1503: pending tags superseded this run — `{ tag, by }`. */
|
|
69
|
+
superseded: Array<{ tag: string; by: string }>;
|
|
70
|
+
/** RFC-1503: tags with a publish-retired journal record (informational). */
|
|
71
|
+
retired: string[];
|
|
64
72
|
diagnostics: Diagnostic[];
|
|
65
73
|
/** RFC-1501: whether the preflight digest fetched origin; absent on early refusals. */
|
|
66
74
|
fetched?: boolean;
|
|
@@ -72,6 +80,8 @@ function refuse(ruleId: string, message: string, fixHint?: string): FlowPushData
|
|
|
72
80
|
pushed: false,
|
|
73
81
|
refs: [],
|
|
74
82
|
publications: [],
|
|
83
|
+
superseded: [],
|
|
84
|
+
retired: [],
|
|
75
85
|
diagnostics: [{ ruleId, severity: "error", message, fixHint }],
|
|
76
86
|
};
|
|
77
87
|
}
|
|
@@ -129,19 +139,29 @@ export async function pushFlow(
|
|
|
129
139
|
|
|
130
140
|
const { lines } = await discoverReleaseLines(repoRoot, io);
|
|
131
141
|
|
|
132
|
-
// Publications: package-line tags pushed now +
|
|
133
|
-
// minus baseline annotations
|
|
142
|
+
// Publications (RFC-1503): candidates = package-line tags pushed now +
|
|
143
|
+
// journal-scoped pending, minus baseline annotations; per line only the
|
|
144
|
+
// highest version is attempted — lower ones supersede, retired tags drop.
|
|
145
|
+
const journalEvents = await readJournal(io, common);
|
|
146
|
+
const publishedTags = new Set(
|
|
147
|
+
journalEvents.filter((e) => e.event === "publish").map((e) => e.branch),
|
|
148
|
+
);
|
|
149
|
+
const retiredTags = new Set(
|
|
150
|
+
journalEvents.filter((e) => e.event === "publish-retired").map((e) => e.branch),
|
|
151
|
+
);
|
|
152
|
+
|
|
134
153
|
const publicationTags = new Map<string, ReleaseLine>();
|
|
135
|
-
|
|
136
|
-
const line =
|
|
154
|
+
const addCandidate = (tag: string, lineId: string | null): void => {
|
|
155
|
+
const line =
|
|
156
|
+
(lineId === null ? null : lines.find((l) => l.id === lineId)) ?? lineForTag(lines, tag);
|
|
137
157
|
if (line !== null && line.id !== "repo") publicationTags.set(tag, line);
|
|
138
|
-
}
|
|
139
|
-
for (const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const publishable: Array<{ tag: string; line: ReleaseLine }> = [];
|
|
158
|
+
};
|
|
159
|
+
for (const tag of digest.tags) addCandidate(tag, null);
|
|
160
|
+
for (const pending of digest.pendingPublications) addCandidate(pending.tag, pending.line);
|
|
161
|
+
for (const sup of digest.supersededPublications) addCandidate(sup.tag, sup.line);
|
|
162
|
+
|
|
144
163
|
const baselineSkipped: PublicationRow[] = [];
|
|
164
|
+
const planCandidates: PublicationPlanEntry[] = [];
|
|
145
165
|
for (const [tag, line] of [...publicationTags.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
146
166
|
const level = await tagAnnotationLevel(repoRoot, io, tag);
|
|
147
167
|
if (level === "baseline") {
|
|
@@ -155,9 +175,16 @@ export async function pushFlow(
|
|
|
155
175
|
destHead: null,
|
|
156
176
|
});
|
|
157
177
|
} else {
|
|
158
|
-
|
|
178
|
+
planCandidates.push({ tag, line: line.id });
|
|
159
179
|
}
|
|
160
180
|
}
|
|
181
|
+
let plan = planPublications(planCandidates, publishedTags, retiredTags, (tag, lineId) =>
|
|
182
|
+
versionOfTag(lines, tag, lineId),
|
|
183
|
+
);
|
|
184
|
+
let publishable: Array<{ tag: string; line: ReleaseLine }> = plan.attempt.map((p) => ({
|
|
185
|
+
tag: p.tag,
|
|
186
|
+
line: lines.find((l) => l.id === p.line)!,
|
|
187
|
+
}));
|
|
161
188
|
|
|
162
189
|
for (const { line } of publishable) {
|
|
163
190
|
const dir = line.paths[0]!;
|
|
@@ -207,6 +234,11 @@ export async function pushFlow(
|
|
|
207
234
|
}),
|
|
208
235
|
),
|
|
209
236
|
],
|
|
237
|
+
superseded: plan.superseded.map((s) => ({
|
|
238
|
+
tag: s.tag,
|
|
239
|
+
by: s.by ?? plan.attempt.find((a) => a.line === s.line)?.tag ?? "",
|
|
240
|
+
})),
|
|
241
|
+
retired: [...retiredTags].sort((a, b) => a.localeCompare(b)),
|
|
210
242
|
diagnostics: [],
|
|
211
243
|
};
|
|
212
244
|
}
|
|
@@ -226,6 +258,8 @@ export async function pushFlow(
|
|
|
226
258
|
pushed: false,
|
|
227
259
|
refs: refspecs,
|
|
228
260
|
publications: [],
|
|
261
|
+
superseded: [],
|
|
262
|
+
retired: [...retiredTags].sort((a, b) => a.localeCompare(b)),
|
|
229
263
|
diagnostics: [
|
|
230
264
|
{
|
|
231
265
|
ruleId: "FLOW-PUSH-04",
|
|
@@ -253,7 +287,45 @@ export async function pushFlow(
|
|
|
253
287
|
}
|
|
254
288
|
|
|
255
289
|
// --- publications ------------------------------------------------------------
|
|
290
|
+
// RFC-1503 review r1 F-5: re-read the journal after the push — a retire or
|
|
291
|
+
// supersede record appended meanwhile must drop the tag from this run's
|
|
292
|
+
// attempts. The window can only be narrowed, not closed: appendJournal
|
|
293
|
+
// takes no push-spanning lock.
|
|
294
|
+
const freshJournal = await readJournal(io, common);
|
|
295
|
+
const freshPublished = new Set(
|
|
296
|
+
freshJournal.filter((e) => e.event === "publish").map((e) => e.branch),
|
|
297
|
+
);
|
|
298
|
+
const freshRetired = new Set(
|
|
299
|
+
freshJournal.filter((e) => e.event === "publish-retired").map((e) => e.branch),
|
|
300
|
+
);
|
|
301
|
+
const freshSuperseded = new Set(
|
|
302
|
+
freshJournal.filter((e) => e.event === "publish-superseded").map((e) => e.branch),
|
|
303
|
+
);
|
|
304
|
+
if (
|
|
305
|
+
freshPublished.size !== publishedTags.size ||
|
|
306
|
+
freshRetired.size !== retiredTags.size
|
|
307
|
+
) {
|
|
308
|
+
for (const tag of freshPublished) publishedTags.add(tag);
|
|
309
|
+
for (const tag of freshRetired) retiredTags.add(tag);
|
|
310
|
+
plan = planPublications(
|
|
311
|
+
planCandidates.filter((c) => !freshSuperseded.has(c.tag)),
|
|
312
|
+
publishedTags,
|
|
313
|
+
retiredTags,
|
|
314
|
+
(tag, lineId) => versionOfTag(lines, tag, lineId),
|
|
315
|
+
);
|
|
316
|
+
publishable = plan.attempt.map((p) => ({
|
|
317
|
+
tag: p.tag,
|
|
318
|
+
line: lines.find((l) => l.id === p.line)!,
|
|
319
|
+
}));
|
|
320
|
+
} else {
|
|
321
|
+
plan = {
|
|
322
|
+
attempt: plan.attempt,
|
|
323
|
+
superseded: plan.superseded.filter((s) => !freshSuperseded.has(s.tag)),
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
256
327
|
const publications: PublicationRow[] = [...baselineSkipped];
|
|
328
|
+
const supersededOut: Array<{ tag: string; by: string }> = [];
|
|
257
329
|
const diagnostics: Diagnostic[] = journalWarnings.map(
|
|
258
330
|
(message): Diagnostic => ({
|
|
259
331
|
ruleId: "FLOW-07",
|
|
@@ -261,6 +333,41 @@ export async function pushFlow(
|
|
|
261
333
|
message,
|
|
262
334
|
}),
|
|
263
335
|
);
|
|
336
|
+
|
|
337
|
+
const recordSuperseded = async (tag: string, by: string): Promise<void> => {
|
|
338
|
+
try {
|
|
339
|
+
await appendJournal(io, common, {
|
|
340
|
+
event: "publish-superseded",
|
|
341
|
+
branch: tag,
|
|
342
|
+
sha: "",
|
|
343
|
+
detail: by,
|
|
344
|
+
});
|
|
345
|
+
supersededOut.push({ tag, by });
|
|
346
|
+
} catch (error) {
|
|
347
|
+
diagnostics.push({
|
|
348
|
+
ruleId: "FLOW-07",
|
|
349
|
+
severity: "warning",
|
|
350
|
+
message: `publish-superseded record for ${tag} could not be appended — the tag stays pending and will be re-evaluated on the next push: ${String(error)}`,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
// Superseded on sight — a pending tag at or below the line's newest
|
|
356
|
+
// published version is never extracted (RFC-1503 AC-3).
|
|
357
|
+
for (const sup of plan.superseded) {
|
|
358
|
+
if (sup.by !== null) await recordSuperseded(sup.tag, sup.by);
|
|
359
|
+
}
|
|
360
|
+
// Shadowed candidates — superseded only once their line's highest tag
|
|
361
|
+
// actually publishes (RFC-1503 AC-2).
|
|
362
|
+
const shadowed = new Map<string, string[]>();
|
|
363
|
+
for (const sup of plan.superseded) {
|
|
364
|
+
if (sup.by === null) {
|
|
365
|
+
const list = shadowed.get(sup.line) ?? [];
|
|
366
|
+
list.push(sup.tag);
|
|
367
|
+
shadowed.set(sup.line, list);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
264
371
|
for (const { tag, line } of publishable) {
|
|
265
372
|
const row = await publishTag(primary, io, { line, tag });
|
|
266
373
|
publications.push(row);
|
|
@@ -288,6 +395,9 @@ export async function pushFlow(
|
|
|
288
395
|
message: `publish journal record for ${tag} could not be appended — the tag will be retried as pending: ${String(error)}`,
|
|
289
396
|
});
|
|
290
397
|
}
|
|
398
|
+
for (const low of shadowed.get(line.id) ?? []) {
|
|
399
|
+
await recordSuperseded(low, tag);
|
|
400
|
+
}
|
|
291
401
|
}
|
|
292
402
|
}
|
|
293
403
|
|
|
@@ -297,6 +407,8 @@ export async function pushFlow(
|
|
|
297
407
|
pushed,
|
|
298
408
|
refs: refspecs,
|
|
299
409
|
publications,
|
|
410
|
+
superseded: supersededOut,
|
|
411
|
+
retired: [...freshRetired].sort((a, b) => a.localeCompare(b)),
|
|
300
412
|
diagnostics,
|
|
301
413
|
};
|
|
302
414
|
}
|
|
@@ -359,6 +471,9 @@ export async function runFlowPush(
|
|
|
359
471
|
logger.info(` would publish ${pub.tag} (dry-run)`);
|
|
360
472
|
}
|
|
361
473
|
}
|
|
474
|
+
for (const sup of data.superseded) {
|
|
475
|
+
logger.info(` superseded ${sup.tag} by ${sup.by}`);
|
|
476
|
+
}
|
|
362
477
|
}
|
|
363
478
|
|
|
364
479
|
return {
|
package/os/flow/locks.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
2
|
<MODULE_CONTRACT>
|
|
3
3
|
<purpose>Exclusive file locks for flow commands (RFC-1487): O_EXCL lock files
|
|
4
|
-
carrying { pid, host, at }, wait-with-progress while a live holder
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
carrying { pid, host, at, bootId? }, wait-with-progress while a live holder
|
|
5
|
+
exists, dead holders (dead pid on this host, or a foreign boot id) and stale
|
|
6
|
+
locks broken, always released in finally. Used for the short registry lock
|
|
7
|
+
(10 s) and the long integration lock (30 min).</purpose>
|
|
7
8
|
<non-goals>
|
|
8
9
|
<item>No registry semantics — callers choose paths, budgets and diagnostics.</item>
|
|
9
10
|
</non-goals>
|
|
@@ -25,12 +26,16 @@ unlinking. Registry/journal failures map to FLOW-07 in every handler.
|
|
|
25
26
|
The final branch-name collision reports FLOW-OPEN-04, flow.discard
|
|
26
27
|
propagates its teardown result and predicts FLOW-DIS-03 on --dry-run,
|
|
27
28
|
and integrate exposes teardown as its own field.</item>
|
|
29
|
+
<item>RFC-1504: steps 2-3 — holderIsDead, boot-id payload, dead-holder break in withFlowLock</item>
|
|
30
|
+
<item>RFC-1504: review fixes — single io.readFile parse per iteration, real ageMs on dead-holder onStale, atomic break claim</item>
|
|
28
31
|
</CHANGE_SUMMARY>
|
|
29
32
|
*/
|
|
30
33
|
|
|
31
34
|
import { hostname } from "node:os";
|
|
32
35
|
import { open, rm } from "node:fs/promises";
|
|
33
36
|
|
|
37
|
+
import { claimLockBreak, currentBootId, holderIsDead } from "../core/lock-holder.ts";
|
|
38
|
+
|
|
34
39
|
export interface FlowLockOptions {
|
|
35
40
|
/** Maximum time to wait for a live lock before throwing LockTimeoutError. */
|
|
36
41
|
waitMs: number;
|
|
@@ -39,8 +44,17 @@ export interface FlowLockOptions {
|
|
|
39
44
|
/** Emit onProgress at this interval while waiting (0/undefined = silent). */
|
|
40
45
|
progressEveryMs?: number;
|
|
41
46
|
onProgress?: (message: string) => void;
|
|
42
|
-
/** Called when a stale lock is broken — the caller logs the warning.
|
|
43
|
-
|
|
47
|
+
/** Called when a stale lock is broken — the caller logs the warning.
|
|
48
|
+
* `reason` is "dead-holder" for an immediate dead-pid/boot-id break and
|
|
49
|
+
* "stale-age" for the classic age break. */
|
|
50
|
+
onStale?: (lock: {
|
|
51
|
+
path: string;
|
|
52
|
+
at: string;
|
|
53
|
+
ageMs: number;
|
|
54
|
+
reason: "dead-holder" | "stale-age";
|
|
55
|
+
pid?: number;
|
|
56
|
+
host?: string;
|
|
57
|
+
}) => void;
|
|
44
58
|
/** Injectable clock for tests. */
|
|
45
59
|
now?: () => number;
|
|
46
60
|
/** Injectable sleep for tests. */
|
|
@@ -61,6 +75,8 @@ interface LockFileContent {
|
|
|
61
75
|
pid: number;
|
|
62
76
|
host: string;
|
|
63
77
|
at: string;
|
|
78
|
+
/** RFC-1504: machine boot id when the platform has one — written only when defined. */
|
|
79
|
+
bootId?: string;
|
|
64
80
|
}
|
|
65
81
|
|
|
66
82
|
const defaultSleep = (ms: number): Promise<void> =>
|
|
@@ -81,24 +97,33 @@ async function tryAcquire(lockPath: string, content: LockFileContent): Promise<b
|
|
|
81
97
|
}
|
|
82
98
|
}
|
|
83
99
|
|
|
84
|
-
/**
|
|
85
|
-
|
|
100
|
+
/** Holder fields as written in a lock file; `at` is always present in files
|
|
101
|
+
* this module parses ("" when the payload lacks it). */
|
|
102
|
+
interface HeldLock {
|
|
103
|
+
pid: number;
|
|
104
|
+
host?: string;
|
|
105
|
+
at: string;
|
|
106
|
+
bootId?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Holder fields of the current lock file read through the injected io —
|
|
111
|
+
* one parse per wait iteration feeds both the dead-holder and the age
|
|
112
|
+
* checks; null when the file vanished or is unreadable.
|
|
113
|
+
*/
|
|
114
|
+
async function readHolder(
|
|
86
115
|
lockPath: string,
|
|
87
116
|
readFile: (path: string) => Promise<string>,
|
|
88
|
-
|
|
89
|
-
): Promise<number | null> {
|
|
90
|
-
let raw: string;
|
|
117
|
+
): Promise<HeldLock | null> {
|
|
91
118
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (Number.isNaN(at)) return null;
|
|
101
|
-
return nowMs - at;
|
|
119
|
+
const parsed = JSON.parse(await readFile(lockPath)) as Record<string, unknown>;
|
|
120
|
+
if (typeof parsed["pid"] !== "number") return null;
|
|
121
|
+
return {
|
|
122
|
+
pid: parsed["pid"],
|
|
123
|
+
host: typeof parsed["host"] === "string" ? parsed["host"] : undefined,
|
|
124
|
+
at: typeof parsed["at"] === "string" ? parsed["at"] : "",
|
|
125
|
+
bootId: typeof parsed["bootId"] === "string" ? parsed["bootId"] : undefined,
|
|
126
|
+
};
|
|
102
127
|
} catch {
|
|
103
128
|
return null;
|
|
104
129
|
}
|
|
@@ -121,27 +146,52 @@ export async function withFlowLock<T>(
|
|
|
121
146
|
const deadline = now() + opts.waitMs;
|
|
122
147
|
let nextProgress = now() + (opts.progressEveryMs ?? Number.POSITIVE_INFINITY);
|
|
123
148
|
|
|
149
|
+
const ownBootId = currentBootId();
|
|
124
150
|
let heldPayload: { pid: number; at: string } | null = null;
|
|
125
151
|
for (;;) {
|
|
126
152
|
const at = new Date(now()).toISOString();
|
|
127
|
-
const
|
|
153
|
+
const content: LockFileContent = {
|
|
128
154
|
pid: process.pid,
|
|
129
155
|
host: hostname(),
|
|
130
156
|
at,
|
|
131
|
-
}
|
|
157
|
+
};
|
|
158
|
+
if (ownBootId !== undefined) content.bootId = ownBootId;
|
|
159
|
+
const acquired = await tryAcquire(lockPath, content);
|
|
132
160
|
if (acquired) {
|
|
133
161
|
heldPayload = { pid: process.pid, at };
|
|
134
162
|
break;
|
|
135
163
|
}
|
|
136
164
|
|
|
137
|
-
|
|
165
|
+
// RFC-1504: a dead holder's lock is claimed and retried at once —
|
|
166
|
+
// before the age rule, so a crashed process never makes anyone wait.
|
|
167
|
+
const holder = await readHolder(lockPath, io.readFile);
|
|
168
|
+
const heldAtMs = holder !== null && holder.at.length > 0 ? Date.parse(holder.at) : NaN;
|
|
169
|
+
const age = Number.isNaN(heldAtMs) ? null : now() - heldAtMs;
|
|
170
|
+
if (holder !== null && holderIsDead(holder, ownBootId)) {
|
|
171
|
+
opts.onStale?.({
|
|
172
|
+
path: lockPath,
|
|
173
|
+
at: holder.at,
|
|
174
|
+
ageMs: age ?? 0,
|
|
175
|
+
reason: "dead-holder",
|
|
176
|
+
pid: holder.pid,
|
|
177
|
+
host: holder.host,
|
|
178
|
+
});
|
|
179
|
+
const tomb = await claimLockBreak(lockPath, holder);
|
|
180
|
+
if (tomb !== null) await rm(tomb, { force: true });
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
|
|
138
184
|
if (age !== null && age > opts.staleMs) {
|
|
139
185
|
opts.onStale?.({
|
|
140
186
|
path: lockPath,
|
|
141
|
-
at: new Date(now() - age).toISOString(),
|
|
187
|
+
at: holder?.at ?? new Date(now() - age).toISOString(),
|
|
142
188
|
ageMs: age,
|
|
189
|
+
reason: "stale-age",
|
|
190
|
+
pid: holder?.pid,
|
|
191
|
+
host: holder?.host,
|
|
143
192
|
});
|
|
144
|
-
await
|
|
193
|
+
const tomb = await claimLockBreak(lockPath, holder);
|
|
194
|
+
if (tomb !== null) await rm(tomb, { force: true });
|
|
145
195
|
continue;
|
|
146
196
|
}
|
|
147
197
|
if (now() >= deadline) {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Pure pending-publication selection for flow.digest and flow.push
|
|
4
|
+
(RFC-1503): per package line, group the candidate tags, drop retired tags,
|
|
5
|
+
supersede candidates at or below the newest published version on sight
|
|
6
|
+
(by = that tag), and of the remainder attempt only the highest version
|
|
7
|
+
(lower ones are superseded-by-null until the highest publishes). Ordering
|
|
8
|
+
is semver-strict — 9.10.0 outranks 9.9.0.</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>No git or journal access — callers pass parsed tags and the
|
|
11
|
+
published/retired tag sets.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-1503: step 2 — planPublications pure selection</item>
|
|
16
|
+
<item>RFC-1503: steps 1-5 — highest-per-line pending selection, publish-superseded/publish-retired journal events, flow.publication.retire</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { compareVersions, type SemVer } from "./semver.ts";
|
|
21
|
+
|
|
22
|
+
export interface PublicationPlanEntry {
|
|
23
|
+
tag: string;
|
|
24
|
+
line: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface SupersededEntry extends PublicationPlanEntry {
|
|
28
|
+
/** Superseding tag — null when the tag is shadowed by a higher candidate
|
|
29
|
+
* that has not published yet. */
|
|
30
|
+
by: string | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PublicationPlan {
|
|
34
|
+
attempt: PublicationPlanEntry[];
|
|
35
|
+
superseded: SupersededEntry[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Partition `candidates` into the tags the next push attempts and the ones it
|
|
40
|
+
* supersedes. `published` carries every tag with a `publish` journal event;
|
|
41
|
+
* `retired` every tag with a `publish-retired` event. `versionOf` parses a
|
|
42
|
+
* tag's version for a line (null when the tag does not match the line's
|
|
43
|
+
* prefix or its suffix is not strict semver) — such tags stay out of both
|
|
44
|
+
* lists, so callers surface them through the baseline/pending paths they
|
|
45
|
+
* already own.
|
|
46
|
+
*/
|
|
47
|
+
export function planPublications(
|
|
48
|
+
candidates: PublicationPlanEntry[],
|
|
49
|
+
published: ReadonlySet<string>,
|
|
50
|
+
retired: ReadonlySet<string>,
|
|
51
|
+
versionOf: (tag: string, line: string) => SemVer | null,
|
|
52
|
+
): PublicationPlan {
|
|
53
|
+
const attempt: PublicationPlanEntry[] = [];
|
|
54
|
+
const superseded: SupersededEntry[] = [];
|
|
55
|
+
|
|
56
|
+
const byLine = new Map<string, PublicationPlanEntry[]>();
|
|
57
|
+
for (const c of candidates) {
|
|
58
|
+
if (published.has(c.tag) || retired.has(c.tag)) continue;
|
|
59
|
+
const list = byLine.get(c.line) ?? [];
|
|
60
|
+
list.push(c);
|
|
61
|
+
byLine.set(c.line, list);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (const [line, list] of byLine) {
|
|
65
|
+
// Newest published version of this line — the "superseded on sight" bar.
|
|
66
|
+
let bar: SemVer | null = null;
|
|
67
|
+
let barTag: string | null = null;
|
|
68
|
+
for (const tag of published) {
|
|
69
|
+
const v = versionOf(tag, line);
|
|
70
|
+
if (v !== null && (bar === null || compareVersions(v, bar) > 0)) {
|
|
71
|
+
bar = v;
|
|
72
|
+
barTag = tag;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const parsed: Array<{ entry: PublicationPlanEntry; version: SemVer }> = [];
|
|
77
|
+
for (const entry of list) {
|
|
78
|
+
const v = versionOf(entry.tag, line);
|
|
79
|
+
if (v === null) continue;
|
|
80
|
+
if (bar !== null && compareVersions(v, bar) <= 0) {
|
|
81
|
+
superseded.push({ ...entry, by: barTag });
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
parsed.push({ entry, version: v });
|
|
85
|
+
}
|
|
86
|
+
if (parsed.length === 0) continue;
|
|
87
|
+
parsed.sort((a, b) => compareVersions(b.version, a.version));
|
|
88
|
+
attempt.push(parsed[0]!.entry);
|
|
89
|
+
for (const lower of parsed.slice(1)) {
|
|
90
|
+
superseded.push({ ...lower.entry, by: null });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const entrySort = (a: PublicationPlanEntry, b: PublicationPlanEntry) =>
|
|
95
|
+
a.line === b.line ? a.tag.localeCompare(b.tag) : a.line.localeCompare(b.line);
|
|
96
|
+
attempt.sort(entrySort);
|
|
97
|
+
superseded.sort(entrySort);
|
|
98
|
+
return { attempt, superseded };
|
|
99
|
+
}
|
package/os/flow/publish.ts
CHANGED
|
@@ -13,15 +13,20 @@ and return the RFC publications[] row for the journal.</purpose>
|
|
|
13
13
|
<KEY_DECISIONS>
|
|
14
14
|
<item>Destination resolution mirrors the retired publish-forge.mjs (RFC-1499) resolveDest(): destBase/destName parsed from extract.config.yaml, anchored at dirname(primary), destBase default "packages".</item>
|
|
15
15
|
<item>Reconcile only on non-fast-forward (the same regex as the retired publish-forge.mjs, RFC-1499) — auth, hook and transient failures never trigger an ours-merge.</item>
|
|
16
|
+
<item>verifyLineAtRef (RFC-1502) extracts into an mkdtemp scratch via `--dest` — the configured destination is never touched — and a spawn failure of the repo-extract binary reports as a verification failure, not a crash.</item>
|
|
16
17
|
</KEY_DECISIONS>
|
|
17
18
|
<CHANGE_SUMMARY>
|
|
18
|
-
<item>RFC-1491: step 5 — publishTag (extract, verify, dest push, single ours-merge reconcile)</item>
|
|
19
|
-
<item>RFC-1491: step 5 — flow.push atomic outbound path + extract publication</item>
|
|
20
19
|
<item>RFC-1491: independent-review pass — shared lock constants, publishable pending filter, declared rules, hold ordering, sha-pinned refspecs</item>
|
|
21
20
|
<item>RFC-1499: step 2 — retire publish-forge/bump-forge scripts, add extract-verify hook</item>
|
|
21
|
+
<item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
|
|
22
|
+
<item>RFC-1502: step 7 — remediation entries, docs, deviations, generated indexes</item>
|
|
23
|
+
<item>RFC-1502: review r1 — fix-cut rollback on FLOW-CUT-12/13, populated steps[], hook validation, GIT_* env scrub</item>
|
|
24
|
+
<history>RFC-1491</history>
|
|
22
25
|
</CHANGE_SUMMARY>
|
|
23
26
|
*/
|
|
24
27
|
|
|
28
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
29
|
+
import { tmpdir } from "node:os";
|
|
25
30
|
import { dirname, join, resolve } from "node:path";
|
|
26
31
|
|
|
27
32
|
import type { WorkspaceIO } from "../../src/types.ts";
|
|
@@ -199,3 +204,69 @@ export async function publishTag(
|
|
|
199
204
|
row.destHead = (await git(dest, io, ["rev-parse", "HEAD"])).stdout.trim();
|
|
200
205
|
return row;
|
|
201
206
|
}
|
|
207
|
+
|
|
208
|
+
export interface LineVerifyResult {
|
|
209
|
+
ok: boolean;
|
|
210
|
+
/** True when the line carries no extract.config.yaml — nothing to verify. */
|
|
211
|
+
skipped: boolean;
|
|
212
|
+
/** FLOW-CUT-13 detail when ok === false. */
|
|
213
|
+
detail: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Pre-tag extract verification (RFC-1502): extract the line at `ref` into a
|
|
218
|
+
* scratch directory under os.tmpdir() — `--dest` redirects the output, the
|
|
219
|
+
* configured destination is never written — then run the extract-verify
|
|
220
|
+
* hook against the scratch. The scratch is always removed. A line without
|
|
221
|
+
* an extract.config.yaml is skipped (nothing publishable to verify).
|
|
222
|
+
*/
|
|
223
|
+
export async function verifyLineAtRef(
|
|
224
|
+
primary: string,
|
|
225
|
+
io: WorkspaceIO,
|
|
226
|
+
opts: { line: ReleaseLine; ref: string },
|
|
227
|
+
): Promise<LineVerifyResult> {
|
|
228
|
+
const { line, ref } = opts;
|
|
229
|
+
const dir = line.paths[0];
|
|
230
|
+
if (dir === undefined || !(await io.exists(join(primary, dir, "extract.config.yaml")))) {
|
|
231
|
+
return { ok: true, skipped: true, detail: "" };
|
|
232
|
+
}
|
|
233
|
+
const scratch = await mkdtemp(join(tmpdir(), "flow-extract-"));
|
|
234
|
+
try {
|
|
235
|
+
const extractBin = join(primary, "node_modules", ".bin", "repo-extract");
|
|
236
|
+
let extract;
|
|
237
|
+
try {
|
|
238
|
+
extract = await io.exec(
|
|
239
|
+
extractBin,
|
|
240
|
+
["--config", `${dir}/extract.config.yaml`, "--ref", ref, "--dest", scratch, "--no-push"],
|
|
241
|
+
{ cwd: primary },
|
|
242
|
+
);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
return {
|
|
245
|
+
ok: false,
|
|
246
|
+
skipped: false,
|
|
247
|
+
detail: `repo-extract could not run at ${extractBin}: ${error instanceof Error ? error.message : String(error)}`,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
if (extract.exitCode !== 0) {
|
|
251
|
+
const last = extract.stderr.trim().split("\n").filter((l) => l.length > 0).slice(-1)[0] ?? "";
|
|
252
|
+
return { ok: false, skipped: false, detail: `repo-extract failed (exit ${extract.exitCode}): ${last}` };
|
|
253
|
+
}
|
|
254
|
+
const verify = await runFlowScript(io, "extract-verify", {
|
|
255
|
+
primary,
|
|
256
|
+
cwd: primary,
|
|
257
|
+
env: {
|
|
258
|
+
FORGE_FLOW_EXTRACT_DEST: scratch,
|
|
259
|
+
FORGE_FLOW_REF: ref,
|
|
260
|
+
FORGE_FLOW_LINE: line.id,
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
if (verify.status === "failed") {
|
|
264
|
+
return { ok: false, skipped: false, detail: `extract-verify failed (exit ${verify.exitCode}): ${verify.stderrTail}` };
|
|
265
|
+
}
|
|
266
|
+
return { ok: true, skipped: false, detail: "" };
|
|
267
|
+
} finally {
|
|
268
|
+
// Scratch removal is best-effort — a removal failure must not mask a
|
|
269
|
+
// computed verification result (nor crash the cut after ok was decided).
|
|
270
|
+
await rm(scratch, { recursive: true, force: true }).catch(() => {});
|
|
271
|
+
}
|
|
272
|
+
}
|
package/os/flow/registry.ts
CHANGED
|
@@ -17,11 +17,12 @@ forge/journal.jsonl.</purpose>
|
|
|
17
17
|
<item>`held` is typed null now — the wave-2 outbound RFC widens it to { heldAt, riskCategory, reason }.</item>
|
|
18
18
|
</KEY_DECISIONS>
|
|
19
19
|
<CHANGE_SUMMARY>
|
|
20
|
-
<item>RFC-1487: step 1 — registry, journal, common-gitdir resolution</item>
|
|
21
20
|
<item>RFC-1487: step 1 — worktree path contracts, O_EXCL locks, branch registry and journal</item>
|
|
22
21
|
<item>RFC-1490: step 2 — registry fix/port widening, FORGE_FLOW_COMMIT gitCommit helper, verified version-files writes</item>
|
|
23
22
|
<item>RFC-1491: step 1 — journal base/rewrites + held registry widening, W1-1 discard tip, FLOW-INT-11</item>
|
|
24
23
|
<item>RFC-1491: step 3 — flow.digest risk digest with journal-attributed items, categories, digestId</item>
|
|
24
|
+
<item>RFC-1503: steps 1-5 — highest-per-line pending selection, publish-superseded/publish-retired journal events, flow.publication.retire</item>
|
|
25
|
+
<history>RFC-1487</history>
|
|
25
26
|
</CHANGE_SUMMARY>
|
|
26
27
|
*/
|
|
27
28
|
|
|
@@ -130,7 +131,9 @@ export interface FlowJournalEvent {
|
|
|
130
131
|
| "hold"
|
|
131
132
|
| "unhold"
|
|
132
133
|
| "push"
|
|
133
|
-
| "publish"
|
|
134
|
+
| "publish"
|
|
135
|
+
| "publish-superseded"
|
|
136
|
+
| "publish-retired";
|
|
134
137
|
branch: string;
|
|
135
138
|
sha: string;
|
|
136
139
|
detail: string;
|
package/os/flow/release-tags.ts
CHANGED
|
@@ -15,16 +15,17 @@ Lightweight tags are invisible to release lines by design.</purpose>
|
|
|
15
15
|
<item>`%(objecttype)` + `%(*objectname)` distinguishes annotated (`tag`) from lightweight (`commit`) — only annotated tags carry a line.</item>
|
|
16
16
|
<item>Highest reachable wins over nearest: the historical `forge@0.15.0` predates real `forge@9.x` tags and must not lower the reported version.</item>
|
|
17
17
|
<item>listLegacyTags (RFC-1498) is reporting-only: one for-each-ref pass with NUL-delimited records (contents is multi-line) classifies prefix+semver-matching tags the reader does not honour — never rewrites them.</item>
|
|
18
|
+
<item>RELEASE_TAG_SCHEMA_LINE is exported (RFC-1511): the annotation contract stays in one place — os/system consumers import it rather than duplicating the regex.</item>
|
|
18
19
|
</KEY_DECISIONS>
|
|
19
20
|
<CHANGE_SUMMARY>
|
|
20
|
-
<item>RFC-1488: review r1 — parse guard, door/rules metadata, id-exact RFC binding, refname precision, FLOW-09 top-level anchor, test cleanup</item>
|
|
21
|
-
<item>RFC-1490: step 1 — explicit ref param on tag/level helpers + W1-2 +0.<hash>.dirty shape (AC-12)</item>
|
|
22
21
|
<item>RFC-1490: step 4 — ordinary flow.cut (release branch, verified versions, gate, main swap, tags, resume)</item>
|
|
23
22
|
<item>RFC-1490: independent-review pass — lock-held planning, fix-branch verification, spec-shaped data, coverage</item>
|
|
24
23
|
<item>RFC-1498: step 3 — legacy-tags report in flow.install
|
|
25
24
|
|
|
26
25
|
listLegacyTags scans refs/tags in a single for-each-ref pass carrying objecttype and NUL-delimited contents: a tag whose name matches a line grammar (tagPrefix + strict semver) is pre-program when it is lightweight, or annotated but its body lacks the schema forge/release-tag@1 line. flow.install gains an informational legacy-tags plan step listing every such tag as name (kind) — never a refusal, nothing is deleted or rewritten; execution simply marks the step done. Tests AC-5 (a lightweight v1.2.2 and a schema-less annotated lib at 0.1.0 appear with their kinds) and AC-6 (installation proceeds and both tags remain). Compass metadata updated.</item>
|
|
27
|
-
<
|
|
26
|
+
<item>RFC-1511: accept recorded products map in verified gate, guard folders lookup and exec edges (RFC-1511 review r1)</item>
|
|
27
|
+
<item>RFC-1511: record KEY_DECISIONS for exported tag-schema regex and exec edge handling (RFC-1511 review r1)</item>
|
|
28
|
+
<history>RFC-1488, RFC-1490</history>
|
|
28
29
|
</CHANGE_SUMMARY>
|
|
29
30
|
*/
|
|
30
31
|
|
|
@@ -128,7 +129,7 @@ export interface LegacyTag {
|
|
|
128
129
|
kind: "lightweight" | "annotated-without-schema";
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
const RELEASE_TAG_SCHEMA_LINE = /^schema:\s*forge\/release-tag@1\s*$/m;
|
|
132
|
+
export const RELEASE_TAG_SCHEMA_LINE = /^schema:\s*forge\/release-tag@1\s*$/m;
|
|
132
133
|
|
|
133
134
|
/**
|
|
134
135
|
* Pre-program tags (RFC-1498): every tag whose name matches a discovered
|