GeezerVison is showing github.com — fix(fork-sync): workflow copies pin their upstream file; a sync flags… · RSI-Software/t3code-hyprws@358c650
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .agents/skills/fork-sync/SKILL.md +4Lines changed: 4 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -126,6 +126,9 @@ Adaptation the candidate needs (build or test fixes, ports) commits at the tip o | 126 | 126 | - One commit may carry many trailers | 127 | 127 | - **Merge-tree:** path conflicts with upstream | 128 | 128 | - Move the hook lines off its changed lines | | 129 | +- **Mirror:** upstream changed a workflow copy's file | | 130 | + - Adapt it, or note why not: [copies][copies] | | 131 | + - That commit moves its pin to the target | 129 | 132 | - **Local checks:** each rerun runs `fork:ci` | 130 | 133 | - It names every red step | 131 | 134 | - Recheck: `vp run fork:ci --only <steps>` | @@ -136,6 +139,7 @@ Run `vp test run` inside the package. | 136 | 139 | Fix every red step, recheck them, then rerun once so the marker covers the tip work. | 137 | 140 |
| 138 | 141 | [reshape]: ../../../docs/fork/operations/fork-sync.md#reshape | | 142 | +[copies]: ../../../docs/fork/operations/fork-sync.md#workflow-copies | 139 | 143 |
| 140 | 144 | ## Replay fresh | 141 | 145 |
| |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/hyprws-agent-context-budget.yml +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,6 +4,8 @@ name: hyprws Agent Context Budget | 4 | 4 | # the fork's upstream mirror. This one compares against the PR's base branch, so | 5 | 5 | # a stack layer is judged against the layer below it. Fails when a PR raises a | 6 | 6 | # value in agentContextBudget.json; the agent-context-increase label accepts it. | | 7 | +# The pin names the upstream commit this copy last matched; fork:scan flags a sync past it. | | 8 | +# fork-mirror: .github/workflows/agent-context-budget.yml@ae521d1d796c4e21abb49e44d27c23332d1898b9 | 7 | 9 | on: | 8 | 10 | pull_request: | 9 | 11 | types: [opened, synchronize, reopened, labeled, unlabeled] | | 53 | 55 | echo "Accepted by the agent-context-increase label." | 54 | 56 | exit 0 | 55 | 57 | fi | 56 | | - echo "::error file=$BUDGET::Agent context grew compared to $BASE_REF. Cut the added text, or ask a maintainer to add the agent-context-increase label." | | 58 | + echo "::error file=$BUDGET::Agent context grew compared to $BASE_REF. Cut the added text and rerun the evals that cover it (evals/README.md), or ask a maintainer to add the agent-context-increase label." | 57 | 59 | exit 1 |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/hyprws-ci.yml +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,8 +3,9 @@ name: hyprws CI | 3 | 3 | # Fork-only CI for RSI-Software/t3code-hyprws. Upstream's ci.yml targets | 4 | 4 | # Blacksmith runners the fork does not have, so it stays disabled on the fork | 5 | 5 | # (docs/fork/operations/fork-sync.md). Jobs run on GitHub-hosted runners, which are | 6 | | -# free for a public repository. Mirror upstream ci.yml step changes here on | 7 | | -# every rebase (docs/fork/internals/fork-delta.md, distribution). | | 6 | +# free for a public repository. The pin names the upstream ci.yml commit these steps | | 7 | +# last matched; fork:scan flags a sync past it (docs/fork/operations/fork-sync.md). | | 8 | +# fork-mirror: .github/workflows/ci.yml@5d14c0e9686d8bedf47dd93dd3811fd639255c7e | 8 | 9 |
| 9 | 10 | on: | 10 | 11 | # No `ready_for_review`: GitHub already runs `pull_request` on a draft, so the | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/hyprws-release.yml +16-2Lines changed: 16 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,9 +7,11 @@ name: hyprws Release | 7 | 7 | # finds a completed run instead of racing it). Scheduled fallbacks and | 8 | 8 | # nightly manual dispatches publish v<next>-hyprws-nightly.<date>.<run> from | 9 | 9 | # hyprws. | 10 | | -# Upstream release.yml stays disabled on the fork; mirror its build shape, setup, | 11 | | -# and action versions here on every rebase (docs/fork/internals/fork-delta.md). | | 10 | +# Upstream release.yml stays disabled on the fork; this copy keeps its build shape, | | 11 | +# setup, and action versions. The pin names the upstream commit it last matched; | | 12 | +# fork:scan flags a sync past it (docs/fork/operations/fork-sync.md). | 12 | 13 | # Its release test jobs stay out: the gate requires a green hyprws CI instead. | | 14 | +# fork-mirror: .github/workflows/release.yml@ae521d1d796c4e21abb49e44d27c23332d1898b9 | 13 | 15 |
| 14 | 16 | on: | 15 | 17 | workflow_run: | @@ -451,6 +453,7 @@ jobs: | 451 | 453 | generate_release_notes: true | 452 | 454 | previous_tag: ${{ needs.preflight.outputs.previous_tag }} | 453 | 455 | prerelease: ${{ needs.preflight.outputs.is_prerelease }} | | 456 | + draft: ${{ needs.preflight.outputs.is_prerelease }} | 454 | 457 | make_latest: ${{ needs.preflight.outputs.make_latest }} | 455 | 458 | files: | | 456 | 459 | release-assets/*.AppImage | @@ -460,6 +463,17 @@ jobs: | 460 | 463 | fail_on_unmatched_files: true | 461 | 464 | token: ${{ github.token }} | 462 | 465 |
| | 466 | + # The action keeps a stable release a draft until its assets finish uploading, but publishes a | | 467 | + # prerelease first. Desktop clients update connected servers from the CLI archives as soon as | | 468 | + # they see the release, so a prerelease also goes public only once every asset is attached. | | 469 | + - name: Publish prerelease | | 470 | + if: needs.preflight.outputs.is_prerelease == 'true' | | 471 | + env: | | 472 | + GH_TOKEN: ${{ github.token }} | | 473 | + GH_REPO: ${{ github.repository }} | | 474 | + RELEASE_TAG: ${{ needs.preflight.outputs.tag }} | | 475 | + run: gh release edit "$RELEASE_TAG" --draft=false | | 476 | + | 463 | 477 | - name: Prune old nightlies | 464 | 478 | if: needs.preflight.outputs.release_channel == 'nightly' | 465 | 479 | continue-on-error: false | |
Collapse file Copy file name to clipboardExpand all lines: docs/fork/operations/fork-sync.md +6Lines changed: 6 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -59,6 +59,12 @@ A candidate replays every fork commit, so stale-delete has nothing new to judge. | 59 | 59 |
| 60 | 60 | A `fork-fold` fold lands through the same marker and gate, so the land run stays the only trunk writer. | 61 | 61 |
| | 62 | +### Workflow copies | | 63 | + | | 64 | +Each `hyprws-*.yml` copy of an upstream workflow pins the upstream file and commit it last matched: `# fork-mirror: <path>@<full sha>`. | | 65 | +On a candidate, `fork:scan --mirror-pins` fails a copy whose upstream file changed since its pin, and names those commits; a copy with no pin fails too. | | 66 | +Review each commit at the tip: **adapt** the copy, or **record a one-line no-change reason** in the commit that **moves the pin** to the target's commit. | | 67 | + | 62 | 68 | ## Local trunk | 63 | 69 |
| 64 | 70 | The land run force-pushes `origin/hyprws` under a lease, so `git pull --ff-only` cannot follow it. | |
Collapse file Copy file name to clipboardExpand all lines: scripts/fork-ci.test.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -192,6 +192,7 @@ it("skips stale-delete on a sync candidate and scans from its base", () => { | 192 | 192 | "--replay-of", | 193 | 193 | "origin/hyprws", | 194 | 194 | "--no-typecheck", | | 195 | + "--mirror-pins", | 195 | 196 | ], | 196 | 197 | ]); | 197 | 198 | } finally { | |
Collapse file Copy file name to clipboardExpand all lines: scripts/fork-scan.test.ts +36Lines changed: 36 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | findForkOwnedTypecheckGaps, | 7 | 7 | LEDGER_PATH, | 8 | 8 | matchesScanPattern, | | 9 | + MIRROR_COPIES, | | 10 | + readMirrorDrift, | 9 | 11 | parseArgs, | 10 | 12 | parseRebaseScans, | 11 | 13 | renderScanReport, | @@ -286,6 +288,7 @@ it("defaults the target to upstream/main and the base to the merge base", () => | 286 | 288 | typecheck: true, | 287 | 289 | since: null, | 288 | 290 | replayOf: null, | | 291 | + mirrorPins: false, | 289 | 292 | }); | 290 | 293 | assert.deepStrictEqual( | 291 | 294 | parseArgs([ | @@ -298,6 +301,7 @@ it("defaults the target to upstream/main and the base to the merge base", () => | 298 | 301 | "--replay-of", | 299 | 302 | "origin/hyprws", | 300 | 303 | "--no-typecheck", | | 304 | + "--mirror-pins", | 301 | 305 | ]), | 302 | 306 | { | 303 | 307 | base: null, | @@ -306,6 +310,7 @@ it("defaults the target to upstream/main and the base to the merge base", () => | 306 | 310 | typecheck: false, | 307 | 311 | since: "origin/hyprws", | 308 | 312 | replayOf: "origin/hyprws", | | 313 | + mirrorPins: true, | 309 | 314 | }, | 310 | 315 | ); | 311 | 316 | assert.throws(() => parseArgs(["--nope"]), UsageError); | @@ -314,3 +319,34 @@ it("defaults the target to upstream/main and the base to the merge base", () => | 314 | 319 | assert.throws(() => parseArgs(["--no-typecheck", "--no-typecheck"]), UsageError); | 315 | 320 | assert.throws(() => parseArgs(["--since"]), UsageError); | 316 | 321 | }); | | 322 | + | | 323 | +it("fails a workflow copy whose upstream file moved past its pin, or that has no pin", () => { | | 324 | + const [ci, release, budget] = MIRROR_COPIES; | | 325 | + const pinned = (path: string, sha: string) => `name: copy\n# fork-mirror: ${path}@${sha}\n`; | | 326 | + const current = "c".repeat(40); | | 327 | + const stale = "5".repeat(40); | | 328 | + const target = "7".repeat(40); | | 329 | + const copies = new Map<string, string>([ | | 330 | + [ci, pinned(".github/workflows/ci.yml", current)], | | 331 | + [release, pinned(".github/workflows/release.yml", stale)], | | 332 | + [budget, "name: copy\n# Mirror upstream agent-context-budget.yml on every rebase.\n"], | | 333 | + ]); | | 334 | + const git = { | | 335 | + run: (args: ReadonlyArray<string>) => { | | 336 | + if (args[0] === "rev-parse") return `${target}\n`; | | 337 | + if (args[0] === "show") return copies.get(String(args[1]).replace("HEAD:", "")) ?? ""; | | 338 | + if (args[0] === "log" && args[2] === `${stale}..${target}`) | | 339 | + return "e6ca170 fix(release): publish prereleases after assets\n0a1b2c3 ci: bump action\n"; | | 340 | + if (args[0] === "log") return ""; | | 341 | + throw new Error(`unexpected git call: ${args.join(" ")}`); | | 342 | + }, | | 343 | + }; | | 344 | + const mirrors = readMirrorDrift(git, "HEAD", "v0.1.7"); | | 345 | + assert.deepStrictEqual( | | 346 | + scanFailures(buildScanResult(scanInput({ upstreamChanged: new Set(), mirrors }))), | | 347 | + [ | | 348 | + `mirror: ${release}: upstream .github/workflows/release.yml changed in 2 commit(s) since pin ${stale.slice(0, 12)}; adapt the copy or record no change, then pin ${target}\n e6ca170 fix(release): publish prereleases after assets\n 0a1b2c3 ci: bump action`, | | 349 | + `mirror: ${budget}: no \`# fork-mirror: <upstream path>@<full sha>\` header pin`, | | 350 | + ], | | 351 | + ); | | 352 | +}); |
Collapse file Copy file name to clipboardExpand all lines: scripts/fork-scan.ts +51-2Lines changed: 51 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -58,6 +58,8 @@ export interface ScanOptions { | 58 | 58 | // regardless of either. | 59 | 59 | readonly since: string | null; | 60 | 60 | readonly replayOf: string | null; | | 61 | + // Set for a sync tip only: a stale pin is the sync's to adapt, never an unrelated PR's. | | 62 | + readonly mirrorPins?: boolean; | 61 | 63 | } | 62 | 64 |
| 63 | 65 | export interface ScanRange { | @@ -107,6 +109,7 @@ export interface ScanResult { | 107 | 109 | // reads as superseded rather than contradictory; the additive gate consumes that reading. | 108 | 110 | readonly supersedes: ReadonlyArray<string>; | 109 | 111 | readonly retireCandidates: ReadonlyArray<SituatedDeclaration>; | | 112 | + readonly mirrors: ReadonlyArray<string>; | 110 | 113 | } | 111 | 114 |
| 112 | 115 | export { UsageError } from "./lib/fork-cli.ts"; | @@ -123,6 +126,7 @@ Options: | 123 | 126 | --replay-of <ref> | 124 | 127 | Guard only commits whose added lines differ from the same-subject commit on this ref. | 125 | 128 | --no-typecheck Skip the rehearsed-head typechecks | | 129 | + --mirror-pins Fail a workflow copy whose upstream file changed between its pin and the target | 126 | 130 | -h, --help Show help | 127 | 131 |
| 128 | 132 | Output is read-only; exit 0 passes, 1 fails, 2 is usage. | @@ -142,6 +146,7 @@ const defaultOptions = (): ScanOptions => ({ | 142 | 146 | typecheck: true, | 143 | 147 | since: null, | 144 | 148 | replayOf: null, | | 149 | + mirrorPins: false, | 145 | 150 | }); | 146 | 151 |
| 147 | 152 | export const parseScanArgs = (argv: ReadonlyArray<string>): ScanOptions => { | @@ -152,10 +157,11 @@ export const parseScanArgs = (argv: ReadonlyArray<string>): ScanOptions => { | 152 | 157 | for (let index = 0; index < argv.length; index += 1) { | 153 | 158 | const argument = argv[index] ?? ""; | 154 | 159 | if (argument === "-h" || argument === "--help") continue; | 155 | | - if (argument === "--no-typecheck") { | | 160 | + if (argument === "--no-typecheck" || argument === "--mirror-pins") { | 156 | 161 | if (seen.has(argument)) throw new UsageError(`duplicate option: ${argument}`); | 157 | 162 | seen.add(argument); | 158 | | - options.typecheck = false; | | 163 | + if (argument === "--mirror-pins") options.mirrorPins = true; | | 164 | + else options.typecheck = false; | 159 | 165 | continue; | 160 | 166 | } | 161 | 167 | if (!valueFlags.has(argument)) throw new UsageError(`unknown option: ${argument}`); | @@ -263,6 +269,7 @@ export interface ScanInput extends ScanRange { | 263 | 269 | // declaration refusals plus undeclared-contradiction findings. | 264 | 270 | readonly supersedes?: ReadonlyArray<string>; | 265 | 271 | readonly retireCandidates?: ReadonlyArray<SituatedDeclaration>; | | 272 | + readonly mirrors?: ReadonlyArray<string>; | 266 | 273 | } | 267 | 274 |
| 268 | 275 | export const buildScanResult = (input: ScanInput): ScanResult => { | @@ -318,6 +325,7 @@ export const buildScanResult = (input: ScanInput): ScanResult => { | 318 | 325 | additive: input.additive ?? [], | 319 | 326 | supersedes: input.supersedes ?? [], | 320 | 327 | retireCandidates: input.retireCandidates ?? [], | | 328 | + mirrors: input.mirrors ?? [], | 321 | 329 | hookDetails: | 322 | 330 | input.guard === undefined | 323 | 331 | ? [] | @@ -351,6 +359,7 @@ export const scanFailures = (result: ScanResult): ReadonlyArray<string> => [ | 351 | 359 | (finding) => `additive:${finding.check}: ${finding.path}: ${finding.detail}`, | 352 | 360 | ), | 353 | 361 | ...result.supersedes.map((refusal) => `supersedes: ${refusal}`), | | 362 | + ...result.mirrors.map((finding) => `mirror: ${finding}`), | 354 | 363 | ...result.warnings.map( | 355 | 364 | (warning) => `${warning.rule}: ${warning.commit} ${warning.domain}: ${warning.detail}`, | 356 | 365 | ), | @@ -417,6 +426,10 @@ export const renderScanReport = (result: ScanResult): string => { | 417 | 426 | lines.push("", `Supersedes, ${result.supersedes.length} finding(s):`); | 418 | 427 | for (const refusal of result.supersedes) lines.push(` SUPERSEDES ${refusal}`); | 419 | 428 | } | | 429 | + if (result.mirrors.length > 0) { | | 430 | + lines.push("", `Workflow mirrors, ${result.mirrors.length} finding(s):`); | | 431 | + for (const finding of result.mirrors) lines.push(` MIRROR ${finding}`); | | 432 | + } | 420 | 433 | if (result.retireCandidates.length > 0) { | 421 | 434 | lines.push("", `Retire candidates, ${result.retireCandidates.length}:`); | 422 | 435 | for (const candidate of result.retireCandidates) | @@ -508,6 +521,41 @@ export const findForkOwnedTypecheckGaps = ( | 508 | 521 | return [...gaps.values()].toSorted((left, right) => left.path.localeCompare(right.path)); | 509 | 522 | }; | 510 | 523 |
| | 524 | +// Fork copies of disabled upstream workflows. Each header pins the upstream file and the commit it | | 525 | +// last matched, so a sync sees every upstream change since. | | 526 | +export const MIRROR_COPIES = [ | | 527 | + ".github/workflows/hyprws-ci.yml", | | 528 | + ".github/workflows/hyprws-release.yml", | | 529 | + ".github/workflows/hyprws-agent-context-budget.yml", | | 530 | +] as const; | | 531 | + | | 532 | +const MIRROR_PIN = /^# fork-mirror: (?<path>\S+)@(?<sha>[0-9a-f]{40})$/m; | | 533 | + | | 534 | +export const readMirrorDrift = ( | | 535 | + git: Pick<GitReader, "run">, | | 536 | + head: string, | | 537 | + target: string, | | 538 | +): ReadonlyArray<string> => { | | 539 | + const targetSha = git.run(["rev-parse", `${target}^{commit}`]).trim(); | | 540 | + return MIRROR_COPIES.flatMap((copy) => { | | 541 | + const pin = MIRROR_PIN.exec(git.run(["show", `${head}:${copy}`]))?.groups; | | 542 | + if (pin?.path === undefined || pin.sha === undefined) { | | 543 | + return [`${copy}: no \`# fork-mirror: <upstream path>@<full sha>\` header pin`]; | | 544 | + } | | 545 | + const commits = git | | 546 | + .run(["log", "--format=%h %s", `${pin.sha}..${targetSha}`, "--", pin.path]) | | 547 | + .split("\n") | | 548 | + .filter((line) => line.length > 0); | | 549 | + if (commits.length === 0) return []; | | 550 | + return [ | | 551 | + [ | | 552 | + `${copy}: upstream ${pin.path} changed in ${commits.length} commit(s) since pin ${pin.sha.slice(0, 12)}; adapt the copy or record no change, then pin ${targetSha}`, | | 553 | + ...commits.map((line) => ` ${line}`), | | 554 | + ].join("\n"), | | 555 | + ]; | | 556 | + }); | | 557 | +}; | | 558 | + | 511 | 559 | export const readScan = ( | 512 | 560 | git: GitReader, | 513 | 561 | options: ScanOptions, | @@ -545,6 +593,7 @@ export const readScan = ( | 545 | 593 | { head: range.head, backports }, | 546 | 594 | ), | 547 | 595 | ...readSupersedesAssessment(git, range), | | 596 | + mirrors: options.mirrorPins ? readMirrorDrift(git, range.head, range.target) : [], | 548 | 597 | }); | 549 | 598 | }; | 550 | 599 |
| |
Collapse file Copy file name to clipboardExpand all lines: scripts/lib/fork-ci-flags.test.ts +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -88,6 +88,11 @@ it("passes the whole CI shape to fork:scan, replay-of included only when it reso | 88 | 88 | `${HEAD}^`, | 89 | 89 | "--no-typecheck", | 90 | 90 | ]); | | 91 | + assert.include( | | 92 | + forkScanArguments(deriveForkCiFlags(fakeGit({ trunkBelowBase: true }), HEAD)), | | 93 | + "--mirror-pins", | | 94 | + ); | | 95 | + assert.notInclude(forkScanArguments(flags), "--mirror-pins"); | 91 | 96 | }); | 92 | 97 |
| 93 | 98 | it("renders the base and since outputs the workflow consumes", () => { | |
Collapse file Copy file name to clipboardExpand all lines: scripts/lib/fork-ci-flags.ts +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -78,6 +78,8 @@ export const forkScanArguments = (flags: ForkCiFlags): ReadonlyArray<string> => | 78 | 78 | flags.since, | 79 | 79 | ...(flags.replayOf === null ? [] : ["--replay-of", flags.replayOf]), | 80 | 80 | "--no-typecheck", | | 81 | + // Only a sync candidate moves the upstream base, so only it owes the workflow copies a review. | | 82 | + ...(flags.rebased ? ["--mirror-pins"] : []), | 81 | 83 | ]; | 82 | 84 |
| 83 | 85 | /** The GitHub Actions `base=`, `since=`, and `rebased=` lines the stale-delete and fixup fold steps read, for `>> "$GITHUB_OUTPUT"`. */ | |
|