You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 74f1379
Browse filesBrowse the repository at this point in the historyBrowse files
authored and
rsi-pr-agent
committed
fix(fork-sync): a file's second hooked commit re-applies; hooks must stay pure insertions (#1780)
## Problem
Fork sync stops by hand on almost every seam.
Across 10 recent sync reports, 450 conflict rows were manual and 11 were hook re-applies.
- **263 rows:** not a marked insertion
- **154 of those:** earlier hooks in the base
- **Bug:** base hooks were never stripped
- **So:** a second hooked commit always refused
- **Docs:** allowed substitutions re-apply refuses
## Change
- **Driver:** strip earlier hooks left unchanged
- **Safety:** an edited earlier hook still refuses
- **Hook rule:** no removed or modified line
- **Fold rule:** owning intent or cancellation
- **Second block:** reshape owner in a `fixup!`
- **Runbook:** `-preview.` tags skipped on purpose
- **Skill:** links tables, stops copying them
Replaying the 263 refused rows through the new check: 20 pass.
Most of the rest delete unmarked lines; the new hook rule stops new ones.
## Scope and approval
Maintainer-requested follow-up to a fork-sync audit.
## Verification
- `fork-sync.test.ts -t hook` → 5 passed
- New second-hook test fails without the fix
- Edited-hook test fails with an unconditional strip
- `vp run fork:ci` → exit 0
Claude Opus 5.5 in Claude Code, with GPT Sol and Claude Opus peer thinkers.
## Fork trailers
Fork-Domain: fork-meta
Fork-Tier: bugfix
Fork-Upstreamable: no
Co-authored-by: donjor <[email protected]>
`decision.tip` names a kept tip: a red candidate or a green dry run.
49
41
50
42
Never edit a report; a rerun supersedes it.
51
43
@@ -106,21 +98,24 @@ In the rebase, resolve minimally: upstream's text stands, and a marked fork hook
106
98
Upstream deleted and the fork edit is net-zero: the deletion stands.
107
99
A [regenerable file](../../../docs/fork/operations/fork-sync.md#regenerable-files) regenerates; when one is pending, skip `git rebase --continue` and rerun.
108
100
Never adapt inside a replayed commit: the hook guard refuses it.
109
-
Adaptation lands at the tip, one commit per owner:
101
+
Adaptation lands at the tip, one commit per owner, per [Reshape](../../../docs/fork/operations/fork-sync.md#unblocking-by-hand).
Copy file name to clipboardExpand all lines: docs/fork/internals/fork-delta.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,10 @@ Decided per commit by the levers retire, reshape, automate, or accept; no gate c
83
83
| Multi-line JSX | the pair `{/* fork-hook: <domain>/<name> */}` and `{/* fork-hook-end */}`|
84
84
85
85
**A hook is exactly one construct:** one import, one call, one `const` from a single fork call, one JSX element, one fork-named property or spread, or one re-export.
86
-
**A hook never removes or modifies an upstream line**, except that a marked JSX region may re-indent what it wraps, and an in-place substitution removes the line its marked replacement supplies.
86
+
**A hook never removes or modifies an upstream line**, not even to re-indent or substitute one.
87
+
Hook re-apply (`reapplyHooks` in `scripts/fork-sync.ts`) accepts only a pure insertion: the fork side minus its marked spans equals the base minus the earlier hooks this commit leaves unchanged.
88
+
Any other shape stops every sync that touches the file, and the hook guard misses it because it checks only added lines.
89
+
Move the logic into a `*.fork.ts` sibling and leave one marked call; precedent `222ac20a66` for `DesktopClerk.ts`.
87
90
88
91
**A trailing marker covers the whole statement it closes.**`statementStartLine` in `scripts/lib/fork-hooks.ts` walks back from the marker line.
A generic fix in no product domain is `upstream-fixes`.
105
-
New commits land on top and move down at the next rebase.
105
+
New commits land on top and stay there; sync moves only a `fixup!`, beneath its owner.
106
106
Reorder only on a clean stack; publish with a lease.
107
107
A squash lists its members under `Squashes:`, one `- <sha> <subject>` line each plus every PR reference the member carried, so the rebase scan reads every member as a replay counterpart.
108
108
A refold keeps every link an earlier fold gathered, bare `(#N)` markers included, and `prove` refuses a fold that drops one.
@@ -164,9 +164,11 @@ Fork-only paths need no granularity curation.
164
164
165
165
### Fold to stay tight
166
166
167
-
Fold the ahead commits to one PR-sized intent each: a feature absorbs its fixes and resolutions, so a rebase conflict is solved once.
167
+
Fold the ahead commits to one PR-sized intent each: a feature absorbs its fixes and resolutions, so a seam conflicts once per replay, not once per commit.
168
168
The [`fork-fold`](../../../.agents/skills/fork-fold/SKILL.md) skill runs it.
169
169
Replay sees each commit, not the net, so an upstream line one commit deletes and a later one restores conflicts on every rebase; [`fork:stale-delete`](../../../scripts/lib/fork-stale-delete.ts) refuses that pair in `fork:ci`.
170
+
Fold commits that share one owning intent or cancel each other's upstream hunks, never only because they share a domain.
171
+
A cancelling pair across domains cannot share a plan line: drop both hunks by hand at the fold, and `prove` checks the tree.
170
172
A `fixup!` that only applies at the branch tip lands green and blocks the next sync; [`fork:fixup-fold`](../../../scripts/fork-fixup-fold.ts) proves each fixup folds at its owner in `fork:ci`.
171
173
A fold is tree-equal but rewrites commit boundaries: the release delta revision changes, and a nightly may republish the same tree.
Copy file name to clipboardExpand all lines: docs/fork/operations/fork-sync.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,8 @@ Discipline lives in [Fork development](../internals/fork-development.md); the pr
9
9
10
10
`hyprws` is the single fork trunk.
11
11
The sync driver runs one upstream release tag end to end: one run, one exit code, one report.
12
-
It never merges upstream in, nor drops or reorders a commit.
12
+
It never merges upstream in, nor drops a commit; only a `fixup!` moves, beneath its owner.
13
+
Without a named tag it targets the newest stable or nightly tag; `-preview.` tags are skipped on purpose.
13
14
It folds each `fixup! <subject>` landing into the one fork commit it names, a squash landing's trailing ` (#N)` included, and refuses a fixup naming none or several.
14
15
It rewords only an owner that absorbs a squash-landed fixup: the fixup's PR link joins its `Squashes:` list, rendered the way fork:fold renders one.
15
16
The rebase refuses a rebased tip that dropped any PR link.
it("refuses a commit that edits an earlier hook, even beside a new one",()=>{
748
+
withFixture(
749
+
{
750
+
baseContent: 'import { a } from "a";\n',
751
+
forkContent:
752
+
'import { a } from "a";\nimport { forkOne } from "fork"; // fork-hook: fork-meta/one\n',
753
+
upstreamContent: 'import { a } from "a";\nimport { b } from "b";\n',
754
+
},
755
+
(f)=>{
756
+
NodeFS.writeFileSync(
757
+
NodePath.join(f.root,"shared.txt"),
758
+
'import { a } from "a";\nimport { forkOne, more } from "fork"; // fork-hook: fork-meta/one\nimport { forkTwo } from "fork"; // fork-hook: fork-meta/two\n',
759
+
);
760
+
f.git(["commit","--quiet","-am","fork edits the hook"],f.root);
0 commit comments