Skip to content

Commit ca5bf0c

Browse files
donjor-agent[bot]donjor
authored andcommitted
fix(fork-sync): the check battery runs knip and the desktop build before a trunk push (#1439)
## What Changed - **Battery:** `fork:sync` now also runs `knip:check` and `build:desktop` before it pushes. - **Drift test:** fails when the CI Check job gains a single-command step the battery lacks. - **Docs:** the sync guide and skill name the battery by source, not by list. ## Why A sync pushes straight to `hyprws`, so no pull-request CI gates it. Its battery claimed to mirror the Check job but skipped knip and the desktop build. The v0.0.44 sync pushed `d7b044ba493` green locally; trunk CI then failed `knip:check` (fixed in #1438). The product test jobs stay CI-only: too heavy for every sync, and they still gate the pushed trunk. ## Verification - `vp test run scripts/fork-sync.test.ts` → 45 passed - scripts typecheck → exit 0 - `vp run build:desktop` → exit 0, 26s locally - `vp run fork:ci` → exit 0 ## Checklist - [x] This PR is small and focused - [x] I explained what changed and why 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 aa584b2 commit ca5bf0c

4 files changed

Lines changed: 41 additions & 11 deletions

File tree

‎.agents/skills/fork-sync/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Post-push recovery reads this file, never a comment.
3232
| `lease` | The `origin/hyprws` sha the push is leased against |
3333
| `trunk` | Trunk before and after the run |
3434
| `conflicts[]` | Path, fork commit, upstream commit, resolution route |
35-
| `checks[]` | `fork:delta --check`, `fork:scan`, typecheck, and results |
35+
| `checks[]` | Each battery command and its result |
3636
| `decision` | A stopped run's worktree, paths, and exact resume commands |
3737
| `decision.tip` | A red check's rebased tip, kept in the worktree |
3838

‎docs/fork/operations/fork-sync.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ It folds each `fixup! <subject>` landing into the one fork commit it names, and
1717
| target | the named tag, or the newest release tag on `upstream` | the target is not a release tag |
1818
| fetch | `git fetch --tags upstream`, `git fetch origin hyprws` | fetch error |
1919
| rebase | detached worktree, `git rebase -i --autosquash --rerere-autoupdate <tag>` | a conflict rerere and hook re-apply cannot resolve |
20-
| check | `fork:delta --check`, `fork:ci`, `vpr typecheck`, in the worktree | any red |
20+
| check | `fork:delta --check`, then the CI Check job's steps, in the worktree | any red |
2121
| push | `--force-with-lease=hyprws:<fetched sha>` | lease refused |
2222
| blocked | one standing block issue, rewritten per run, through `gh` | `gh` refuses the write |
2323
| report | `.t3/fork-sync/<tag>.json`, typed, written before any post | |

‎scripts/fork-sync.test.ts‎

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { assert, it } from "@effect/vitest";
88

99
import {
1010
blockedIssueBody,
11+
checkCommands,
1112
blockingShaMarker,
1213
checkFailureDetail,
1314
closeBlocks,
@@ -249,7 +250,7 @@ it("stops at a conflict rerere and hooks cannot resolve, then applies after a ha
249250
assert.notStrictEqual(report.trunk.after, report.trunk.before);
250251
assert.strictEqual(report.push.pushed, false);
251252
assert.strictEqual(report.conflicts.length, 0);
252-
assert.strictEqual(report.checks.length, 3);
253+
assert.strictEqual(report.checks.length, checkCommands().length);
253254
for (const check of report.checks) assert.strictEqual(check.status, "passed");
254255
},
255256
);
@@ -430,7 +431,7 @@ it("pushes the rebased tip after a green battery", () => {
430431
const report = readReport(f.root, "v1.0.0");
431432
assert.strictEqual(report.outcome, "applied");
432433
assert.strictEqual(report.push.pushed, true);
433-
assert.strictEqual(report.checks.length, 3);
434+
assert.strictEqual(report.checks.length, checkCommands().length);
434435
for (const check of report.checks) assert.strictEqual(check.status, "passed");
435436
const push = recording.calls.find(
436437
({ command, args }) => command === "git" && args[0] === "push",
@@ -538,7 +539,7 @@ it("accepts an upstream delete whose fork edit is net-zero and continues the reb
538539
f.git(["ls-tree", "--name-only", report.trunk.after!, "--", "shared.txt"], f.root),
539540
"",
540541
);
541-
assert.strictEqual(report.checks.length, 3);
542+
assert.strictEqual(report.checks.length, checkCommands().length);
542543
for (const check of report.checks) assert.strictEqual(check.status, "passed");
543544
},
544545
);
@@ -1697,3 +1698,29 @@ it("links the trunk's install when the target left the dependency set alone", ()
16971698
NodeFS.rmSync(repo.root, { recursive: true, force: true });
16981699
}
16991700
});
1701+
1702+
it("runs every single-command step of the CI Check job before a direct trunk push", () => {
1703+
// Setup steps, and steps `fork:ci` already runs in CI's shape.
1704+
const coveredElsewhere = new Set([
1705+
"vp run --filter @t3tools/desktop ensure:electron",
1706+
"vp run fork:stale-delete",
1707+
"vp check",
1708+
]);
1709+
const workflow = NodeFS.readFileSync(
1710+
NodePath.join(import.meta.dirname, "..", ".github", "workflows", "hyprws-ci.yml"),
1711+
"utf8",
1712+
);
1713+
const job = workflow.slice(
1714+
workflow.indexOf("\n check:\n"),
1715+
workflow.indexOf("\n merge-tree:\n"),
1716+
);
1717+
const steps = [...job.matchAll(/^\s+run: (vpr? .+)$/gm)].map((match) => match[1]!.trim());
1718+
const battery = new Set(checkCommands().map((args) => args.join(" ")));
1719+
const uncovered = steps.filter((step) => {
1720+
const command = step.split(" --base ")[0]!;
1721+
if (coveredElsewhere.has(command)) return false;
1722+
return !battery.has(command.replace(/^vpr /, "run ").replace(/^vp /, ""));
1723+
});
1724+
assert.isAbove(steps.length, 3);
1725+
assert.deepStrictEqual(uncovered, []);
1726+
});

‎scripts/fork-sync.ts‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// | target | the named target is not a release tag on upstream |
1919
// | fetch | the fetch errors |
2020
// | rebase | a conflict neither rerere nor hook re-apply fixes |
21-
// | check | `fork:delta --check`, `fork:ci`, or the typecheck is red |
21+
// | check | the check battery (`checkCommands`) is red |
2222
// | push | the expected-old lease is refused |
2323
// | blocked | `gh` refuses the write |
2424
//
@@ -743,16 +743,19 @@ export const dependencySetChanged = (
743743

744744
/**
745745
* The check battery, in the CI shape: the ledger gate, then everything the
746-
* fork's pull-request CI runs — `vp run fork:ci` derives the pinned scan flags
747-
* from HEAD (scripts/lib/fork-ci-flags.ts) and runs the rebase scan plus the
748-
* whole scripts suite — then the repo-wide typecheck the Check job runs as
749-
* `vpr typecheck`. A direct push to the trunk has no pull request to gate it,
750-
* so the driver runs the battery itself before the push.
746+
* fork's pull-request CI Check job runs — `vp run fork:ci` derives the pinned
747+
* scan flags from HEAD (scripts/lib/fork-ci-flags.ts) and runs the rebase scan,
748+
* `vp check`, and the whole scripts suite — then the Check job's unused-code,
749+
* `vpr typecheck`, and desktop build steps. A direct push to the trunk has no
750+
* pull request to gate it, so the driver runs the battery itself before the
751+
* push. The product test jobs stay CI-only: they gate the pushed trunk after.
751752
*/
752753
export const checkCommands = (): ReadonlyArray<ReadonlyArray<string>> => [
753754
["run", "fork:delta", "--check"],
754755
["run", "fork:ci"],
756+
["run", "knip:check"],
755757
["run", "typecheck"],
758+
["run", "build:desktop"],
756759
];
757760

758761
/** The last lines of combined check output kept in a failure detail. */

0 commit comments

Comments
 (0)