Skip to content

Commit 3831e40

Browse files
donjor-agent[bot]donjor
authored andcommitted
fix(fork): folds list squash-landed fixups as members (#1591)
## Problem `fork:fold apply` refuses any `fixup!` member without a repair line under `Squashes:`, so it cannot fold the 48 `fixup! <owner> (#N)` commits the #1493 pay-down squash-landed on `hyprws`. The sync's own fold places them as `fixup`, which discards each message, so it drops all 48 pull request links; `fork:fold prove` reports `link guard → 48 finding(s)` on that tip. ## Change `memberLine` treats a `fixup!` subject that carries a squash ` (#N)` marker as a landing of its own: it renders as an ordinary member line, so the fold lists its sha and keeps its link. A `fixup!` with neither a repair line nor a squash marker still refuses. ## Scope and approval Part of the authorized #1493 pay-down; keeps the #1491 rule that no fold drops a pull request link. ## Verification | Check | Result | | --- | --- | | `vp test run scripts/fork-fold.test.ts` | 34 passed, including a new squash-landed fixup case | | `fork:fold apply` of a plan joining each fixup to its owner, on `cf2b4926cba` | 200 commits → 152 | | `fork:fold prove origin/hyprws <fold>` | member guard 0, link guard 0, tree-equal, delta and scan exit 0 | | `vp run fork:ci` | exit 0 | Claude Opus 5.5 in Claude Code. ## Fork trailers Fork-Domain: fork-meta Fork-Tier: core Fork-Upstreamable: no Co-authored-by: donjor <[email protected]>
1 parent ca00d62 commit 3831e40

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

‎scripts/fork-fold.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,24 @@ it("renders a fixup member as the repair it carries, once per repair, and refuse
210210
);
211211
});
212212

213+
it("lists a squash-landed fixup as a member, keeping its pull request link", () => {
214+
const owner = commit("aaaa1111", {
215+
subject: "feat: alpha feature (#31)",
216+
message: "feat: alpha feature (#31)\n",
217+
});
218+
const landed = commit("cccc2222", {
219+
subject: "fixup! feat: alpha feature (#31) (#1567)",
220+
message: "fixup! feat: alpha feature (#31) (#1567)\n\nFork-Domain: fold-a\nFork-Tier: core",
221+
});
222+
const folded = foldMessage({ members: [owner, landed] });
223+
assert.include(folded, "- cccc2222 fixup! feat: alpha feature (#31) (#1567)");
224+
assert.deepStrictEqual(squashedMembers(folded), ["aaaa1111", "cccc2222"]);
225+
assert.deepStrictEqual(forkPullRequests(folded), [
226+
"RSI-Software/t3code-hyprws#31",
227+
"RSI-Software/t3code-hyprws#1567",
228+
]);
229+
});
230+
213231
it("carries an earlier fold's links into the next fold", () => {
214232
const earlier = commit("cccc3333", {
215233
subject: "feat(web): folded (#1355)",

‎scripts/fork-fold.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ const squashesLines = (message: string): ReadonlyArray<string> => {
322322
return members;
323323
};
324324

325-
/** A `fixup!` subject marks a split piece of a Fork-Repair commit. */
325+
/**
326+
* A `fixup!` subject marks a split piece of a Fork-Repair commit, or a fixup
327+
* landed by squash pull request, which carries its ` (#N)` marker instead.
328+
*/
326329
const FIXUP_SUBJECT = "fixup! ";
327330

328331
/**
@@ -335,11 +338,12 @@ const firstSquashesLine = (message: string): string | undefined => squashesLines
335338
/**
336339
* One member line: the sha first (squashedMembers reads it), then the subject,
337340
* then every fork pull request the member cites, rendered full so the link
338-
* always stays on the fork. A `fixup!` member is a split piece of a repair, so
339-
* it renders as the repair it carries — never as the throwaway piece.
341+
* always stays on the fork. A split piece of a repair renders as the repair it
342+
* carries — never as the throwaway piece. A squash-landed fixup is a landing of
343+
* its own, so it renders like any member and its pull request link survives.
340344
*/
341345
const memberLine = (member: FoldCommit): string => {
342-
if (member.subject.startsWith(FIXUP_SUBJECT)) {
346+
if (member.subject.startsWith(FIXUP_SUBJECT) && !SQUASH_MARKER.test(member.subject.trim())) {
343347
const repair = firstSquashesLine(member.message);
344348
if (repair === undefined) {
345349
throw new FoldError(

0 commit comments

Comments
 (0)