Skip to content

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

Merged
lydakis merged 4 commits into
mainfrom
claude/project-thread-wdmsae
Oct 26, 2026
Merged

lydakis merged 4 commits into
mainfrom
claude/project-thread-wdmsae

Conversation

@lydakis

@lydakis lydakis commented Oct 26, 2026

Copy link
Copy Markdown
Owner

This fixes issues 2 to 5 from the outside review of 7fad8fb. Issue 1, the merge-file exit code, was fixed separately in #7. The PR also settles the state model the review asked for first.

State model

A copy now records three things, and each one answers a single question:

  • base: what its files start from. gft sync moves it. For a repository it is a commit. For a plain folder it is N@SECONDS: N comes from a counter kept per project and is the only part used to tell bases apart; the time is just for display.
  • stacked: the fork point. When a copy is made --from another copy that had landed, this is that copy's landing (branch, commit, and the base it was made on), as it was at that moment.
  • landed: the last landing. It holds the branch, the commit, the base it was made on, and the file fingerprints.

A fourth field, pending, is short-lived. It holds a landing whose commit exists but whose branch may not have moved yet. Pr now holds only the number and the URL.

Fixes

  • land no longer undoes remote branch changes. If the branch on GitHub isn't at the commit this copy last landed, land refuses and explains why. The same goes for a branch of that name the copy never landed, even when its files match. --force lands anyway.
  • land no longer undoes the parent's later landings. A child's first commit follows the parent's landing as it was when the child was made, not the parent branch's newest commit. Its PR is based on that branch.
  • Landing can be retried. The record is saved after the commit is made and before the branch moves. On retry, Graft handles each case:
    • The branch is at the pending commit: the landing went through.
    • The branch never moved: the landing is made again.
    • The PR creation answer was lost: the open PR is found rather than a second one opened.
    • More than one PR is open for the branch: land refuses.
  • A full revert lands. A copy with a landing whose changes have all been put back still lands; the commit's tree is the base tree. The rm guard now also checks every file the landing carried against the copy as it is now. A file put back to its old content counts as unlanded. A file the base has caught up with does not, as after a merge and sync.
  • Folder base identity no longer collides. It comes from the counter, not the clock. This was the cause of folder_bases_taken_in_one_second_differ failing on macOS CI. The replacement unit test is deterministic.

This carries over the core idea of Sonny's #8, which is to save the record before publishing, and applies it to every landing.

Tests

A new end-to-end test, landings_cut_short_are_finished_and_never_undo_others_work. The fake GitHub can now cut a call short in four ways: fail a ref update, lose a ref update's answer, fail a PR creation, or lose a PR creation's answer. The test covers:

  • the branch moved but the answer was lost;
  • the commit was made but the branch never moved;
  • PR creation lost or refused after the branch was published;
  • a pre-existing branch with the same name;
  • the remote branch advancing between landings, refused and then forced;
  • the parent advancing after a child forked, with the child landing on its parent;
  • a sync, after which the base becomes the second parent;
  • a full revert, the rm refusal, the landing of the revert, then rm.

cargo test passes on Linux with FUSE, and clippy is clean.


Generated by Claude Code

…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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T05:06:11.896763Z 066d20d New commits
🔒 Security Review ✅ Completed 2026-10-26T05:10:20.606390Z 066d20d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82b2f4994a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/state.rs Resolved
Comment thread src/land.rs Resolved
…raft

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca4b92e81f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Resolved
Comment thread src/land.rs Resolved
…ding

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33948fe678

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Resolved
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
@lydakis
lydakis merged commit 31c77f2 into main Oct 26, 2026
8 checks passed
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.

2 participants