Skip to content

Recover interrupted first landings without duplicate PRs - #8

Closed
lydakis wants to merge 1 commit into
mainfrom
graft/land-retry-recovery
Closed

lydakis wants to merge 1 commit into
mainfrom
graft/land-retry-recovery

Conversation

@lydakis

@lydakis lydakis commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Summary

Persist the exact first-landing attempt before publishing its branch. Retrying can publish that saved commit if needed, find its existing open PR, or create the missing PR, without a duplicate commit or PR. Recovery preserves working files and existing descriptions unless an explicit replacement body is given. Refuse branches and PRs that do not match the saved attempt.

Regression coverage

Add fake-API coverage for PR creation failure, lost response and local record, preserving later edits and descriptions, missing refs, moved branches, unrelated or closed PRs, and canonical repository casing. Extend the mounted workflow to exercise a failed first landing and retry. Document recovery behavior and the limitation for interruptions from older versions without saved records.

Validation

Opening this as a draft for review now. Implementation-task validation and independent review are still in progress; results and follow-up changes will be posted here. This checkpoint has been inspected but is not yet claimed fully validated.

Landed with gft land from the copy land-retry-recovery.

lydakis commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

Closing as superseded. The idea here is right: save the landing record before the branch becomes visible, so a retry never guesses who owns a branch, finds the open PR instead of making a second one, and refuses an unknown graft/<name> branch. It is being folded into the state-model rework of Copy and the land flow (starting source / fork point / last landing) that is in progress now, which applies the same record to every landing, not only the first, and would conflict with nearly every line of this diff. The recovery tests from this branch will be brought over where they still fit, and that PR will credit this one. The branch is left in place for that.


Generated by Claude Code

@lydakis lydakis closed this Oct 26, 2026
lydakis pushed a commit that referenced this pull request Oct 26, 2026
…ings

A copy now records three things, each answering one question: its base (what
its files start from), the landing it was stacked on when made from another
copy (the fork point), and its last landing (branch, commit, base it was made
on, files). Landing builds on all three:

- A landing's record is saved before the branch moves, so landing again after
  one cut short tells its own commit from someone else's, and finds an open
  pull request instead of opening a second one.
- A branch with commits the copy didn't land is left alone (it would undo
  them); --force lands anyway.
- A copy made from a landed copy follows that landing, not the branch's
  newest commit, so it never undoes what its parent landed later.
- A copy put back as its base has it still lands, and `rm` counts the files
  it put back as unlanded.
- Folder copies tell their bases apart by a counter instead of the clock,
  which collided on macOS CI.

Carries over the idea of Sonny's #8 (save the record before publishing).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq
lydakis added a commit that referenced this pull request Oct 26, 2026
…ings (#9)

* Land dependably: record where each copy stands, finish cut-short landings

A copy now records three things, each answering one question: its base (what
its files start from), the landing it was stacked on when made from another
copy (the fork point), and its last landing (branch, commit, base it was made
on, files). Landing builds on all three:

- A landing's record is saved before the branch moves, so landing again after
  one cut short tells its own commit from someone else's, and finds an open
  pull request instead of opening a second one.
- A branch with commits the copy didn't land is left alone (it would undo
  them); --force lands anyway.
- A copy made from a landed copy follows that landing, not the branch's
  newest commit, so it never undoes what its parent landed later.
- A copy put back as its base has it still lands, and `rm` counts the files
  it put back as unlanded.
- Folder copies tell their bases apart by a counter instead of the clock,
  which collided on macOS CI.

Carries over the idea of Sonny's #8 (save the record before publishing).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq

* A path below a file or link is deleted; move landings kept by older Graft

fingerprint() reads a path whose folder was replaced by a file or link as
deleted, as land and rm need, instead of failing. Projects saved before keep
their last landing with the pull request; reading them moves it to the copy,
and the first land after takes the branch's commit as its own.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq

* Force-land a copy put back as its base; don't stack on a migrated landing

A copy with no changes lands whenever it landed before and its branch is
there, with --force over others' commits too. A copy made from one whose
landing came from older Graft, without its commit, isn't stacked on it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq

* rm guard: a landed file a newer base has otherwise isn't lost

A file the last landing carried that is no longer a change counts as lost
only when it is back as it was in the commit the landing was made on: put
back by hand. One a newer base changed again after merging it is not.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant