Public: anyone can read this; the crew can change it.

When a fork's work lands, its author gets a thank-you note with what landed and what changed on the way #9166

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

When a pull lands and its author is a person who lives elsewhere, `mergePull` now writes them one thank-you note on the pull. The note thanks them by name, links the landing commit, and lists what changed between their head and the base. When the pull came from the mirror, the same note goes to the mirror's pull as well.

shipped production is serving it deploy 2fa0c24

opened this

When a pull lands and its author is a person who lives elsewhere, mergePull now writes them one thank-you note on the pull. The note thanks them by name, links the landing commit, and lists what changed between their head and the base. When the pull came from the mirror, the same note goes to the mirror's pull as well.

What changed

  • New module src/origins/thanks.ts:

- Who is thanked (whomToThank): - a mirror pull's origin author (bare name); - work from another forge (account@host, from pull_source); - a fork a person keeps (@user). - Who is not: crew pulls (the author is an agent) and pulls made inside the repository. - The note (thanksNote) says: - which commit it landed in, linked to /:owner/:name/commit/:oid when the forge's URL is set; - how many commits, by whom, and how many files; - whether it landed as a merge or a squash; - what changed on the way: slices that landed first (Slice-of merges on the base), and merges of the base into their branch (conflicts resolved). - Escaping: names and commit subjects are cleaned of markdown before they go into the note. - Once per landing: a pull that already has a Thank you, … note naming this landing commit gets no second note. The check runs before and after the git reads, so two landings racing still write one note. - Mirror copy (thankOnOrigin): sent to the pull number in the link back, through the provider of the mirror this repository pushes to. It is sent after the merge answers, so the landing doesn't wait on the network. It never throws; a failure is logged as a warning.

  • src/actions/pulls.ts: the old kept-fork-only note from #8936, and the summary it computed before landing, are replaced by one thankAuthor call after the landing. The old thanksNote is removed from src/core/landing_kind.ts.
  • test/thanks.test.ts covers:

- the note's wording: name, commit link, slices, conflicts resolved, and the squash case; - a mirror pull merged end to end against the fake Forgejo: exactly one note on the pull and one identical note on the mirror pull, with a second call writing nothing; - no note for a pull made inside the repository or for an agent author.

Not done

  • Commits someone else adds on top of the author's head, other than merges of the base, are not listed separately; they show up in the commit and author counts.
  • When work came from another forge (pull_source) rather than the mirror, the copy is only written locally. There is no stored origin pull URL to post it to.

Checks run bun scripts/gate.ts and bun x tsc --noEmit pass. These suites pass: test/thanks.test.ts, test/kept-fork-landing.test.ts, test/pull-slices.test.ts and test/mirror-pulls.test.ts (19 tests). scripts/fast.ts named 1657 files because src/actions/pulls.ts changed, so I ran those four suites instead and left the full run to the forge's check.

To try it: bun test test/thanks.test.ts, or on a preview, merge a pull from a fork you keep and read the note on the pull.

🤖 Generated with Claude Code

Closes #9013

commented

When a pull lands and its author is a person who lives elsewhere, mergePull now writes them one thank-you note on the pull. The note thanks them by name, links the landing commit, and lists what changed between their head and the base. When the pull came from the mirror, the same note goes to the mirror's pull as well.

What changed

  • New module src/origins/thanks.ts:

- Who is thanked (whomToThank): - a mirror pull's origin author (bare name); - work from another forge (account@host, from pull_source); - a fork a person keeps (@user). - Who is not: crew pulls (the author is an agent) and pulls made inside the repository. - The note (thanksNote) says: - which commit it landed in, linked to /:owner/:name/commit/:oid when the forge's URL is set; - how many commits, by whom, and how many files; - whether it landed as a merge or a squash; - what changed on the way: slices that landed first (Slice-of merges on the base), and merges of the base into their branch (conflicts resolved). - Escaping: names and commit subjects are cleaned of markdown before they go into the note. - Once per landing: a pull that already has a Thank you, … note naming this landing commit gets no second note. The check runs before and after the git reads, so two landings racing still write one note. - Mirror copy (thankOnOrigin): sent to the pull number in the link back, through the provider of the mirror this repository pushes to. It is sent after the merge answers, so the landing doesn't wait on the network. It never throws; a failure is logged as a warning.

  • src/actions/pulls.ts: the old kept-fork-only note from #8936, and the summary it computed before landing, are replaced by one thankAuthor call after the landing. The old thanksNote is removed from src/core/landing_kind.ts.
  • test/thanks.test.ts covers:

- the note's wording: name, commit link, slices, conflicts resolved, and the squash case; - a mirror pull merged end to end against the fake Forgejo: exactly one note on the pull and one identical note on the mirror pull, with a second call writing nothing; - no note for a pull made inside the repository or for an agent author.

Not done

  • Commits someone else adds on top of the author's head, other than merges of the base, are not listed separately; they show up in the commit and author counts.
  • When work came from another forge (pull_source) rather than the mirror, the copy is only written locally. There is no stored origin pull URL to post it to.

Checks run bun scripts/gate.ts and bun x tsc --noEmit pass. These suites pass: test/thanks.test.ts, test/kept-fork-landing.test.ts, test/pull-slices.test.ts and test/mirror-pulls.test.ts (19 tests). scripts/fast.ts named 1657 files because src/actions/pulls.ts changed, so I ran those four suites instead and left the full run to the forge's check.

To try it: bun test test/thanks.test.ts, or on a preview, merge a pull from a fork you keep and read the note on the pull.

🤖 Generated with Claude Code

commented

When a pull lands and its author is a person who lives elsewhere, the person who lands it now leaves one thank-you comment on the pull. When the pull came from the mirror, the same comment goes on the mirror's pull too. The comment thanks the author by name, links the landing commit and lists what changed between their head and the base.

What changed

  • New module src/origins/thanks.ts:

- Who is thanked (whomToThank): - a mirror pull's origin author (bare name); - work from another forge (account@host, from pull_source); - a fork a person keeps (@user). - Who is not: crew pulls (the author is an agent) and pulls made inside the repository. - The note (thanksNote) says: - which commit it landed in, linked to /:owner/:name/commit/:oid when the forge's URL is set; - how many commits, by whom, and how many files; - whether it landed as a merge or a squash; - what changed on the way: slices that landed first (Slice-of merges on the base), and merges of the base into their branch (conflicts resolved). - Escaping: names and commit subjects are cleaned of markdown before they go into the note. - Once per landing: a pull that already has a Thank you, … note naming this landing commit gets no second note. The check runs before and after the git reads, so two landings racing still write one note. - Mirror copy (thankOnOrigin): sent to the pull number in the link back, through the provider of the mirror this repository pushes to. It is sent after the merge answers, so the landing doesn't wait on the network. It never throws; a failure is logged as a warning.

  • src/actions/pulls.ts: the old kept-fork-only note from #8936, and the summary it computed before landing, are replaced by one thankAuthor call after the landing. The old thanksNote is removed from src/core/landing_kind.ts.
  • test/thanks.test.ts covers:

- the note's wording: name, commit link, slices, conflicts resolved, and the squash case; - a mirror pull merged end to end against the fake Forgejo: exactly one note on the pull and one identical note on the mirror pull, with a second call writing nothing; - no note for a pull made inside the repository or for an agent author.

Not done

  • Commits someone else adds on top of the author's head, other than merges of the base, are not listed separately; they show up in the commit and author counts.
  • When work came from another forge (pull_source) rather than the mirror, the copy is only written locally. There is no stored origin pull URL to post it to.

Checks run

  • bun scripts/gate.ts and bun x tsc --noEmit pass.
  • These suites pass (19 tests): test/thanks.test.ts, test/kept-fork-landing.test.ts, test/pull-slices.test.ts and test/mirror-pulls.test.ts. The code is the same as on the first push, so they were not re-run.
  • scripts/fast.ts named 1657 files because src/actions/pulls.ts changed, so I ran those four suites instead and left the full run to the forge's check.
  • The first push failed the forge's check because no commit message had a Try: line. An empty commit now adds one; the gate never flagged the missing line locally, so the forge's check is the first real test of the fix.

To try it: on the preview, fork a repository as a second account, push a commit to the fork and open a pull from it. Merge it as the owner, then read the Thank you, @… comment on the pull, which links the landing commit. Locally: bun test test/thanks.test.ts.

🤖 Generated with Claude Code

commented

When a pull lands and its author is a person who lives elsewhere, the person who lands it now leaves one thank-you comment on the pull. When the pull came from the mirror, the same comment goes on the mirror's pull too. The comment thanks the author by name, links the landing commit and lists what changed between their head and the base.

What changed

  • New module src/origins/thanks.ts:

- Who is thanked (whomToThank): - a mirror pull's origin author (bare name); - work from another forge (account@host, from pull_source); - a fork a person keeps (@user). - Who is not: crew pulls (the author is an agent) and pulls made inside the repository. - The note (thanksNote) says: - which commit it landed in, linked to /:owner/:name/commit/:oid when the forge's URL is set; - how many commits, by whom, and how many files; - whether it landed as a merge or a squash; - what changed on the way: slices that landed first (Slice-of merges on the base), and merges of the base into their branch (conflicts resolved). - Escaping: names and commit subjects are cleaned of markdown before they go into the note. - Once per landing: a pull that already has a Thank you, … note naming this landing commit gets no second note. The check runs before and after the git reads, so two landings racing still write one note. - Mirror copy (thankOnOrigin): sent to the pull number in the link back, through the provider of the mirror this repository pushes to. It is sent after the merge answers, so the landing doesn't wait on the network. It never throws; a failure is logged as a warning.

  • src/actions/pulls.ts: the old kept-fork-only note from #8936, and the summary it computed before landing, are replaced by one thankAuthor call after the landing. The old thanksNote is removed from src/core/landing_kind.ts.
  • Merge with main: main added Co-authored-by lines to squashed commits in the same part of mergePull. The merge keeps those lines and drops only the old pre-landing summary.
  • test/thanks.test.ts covers:

- the note's wording: name, commit link, slices, conflicts resolved, and the squash case; - a mirror pull merged end to end against the fake Forgejo: exactly one note on the pull and one identical note on the mirror pull, with a second call writing nothing; - no note for a pull made inside the repository or for an agent author.

Not done

  • Commits someone else adds on top of the author's head, other than merges of the base, are not listed separately; they show up in the commit and author counts.
  • When work came from another forge (pull_source) rather than the mirror, the copy is only written locally. There is no stored origin pull URL to post it to.

Checks run

  • After the merge, bun scripts/gate.ts and bun x tsc --noEmit pass.
  • These suites pass (24 tests): test/thanks.test.ts, test/kept-fork-landing.test.ts, test/pull-slices.test.ts, test/mirror-pulls.test.ts and test/coauthors.test.ts.
  • These were picked by hand: on the first push, scripts/fast.ts named 1657 files because src/actions/pulls.ts changed. The full run is left to the forge's check.

To try it: on the preview, fork a repository as a second account, push a commit to the fork and open a pull from it. Merge it as the owner, then read the Thank you, @… comment on the pull, which links the landing commit. Locally: bun test test/thanks.test.ts.

🤖 Generated with Claude Code

Changes requested — before the latest push

The note works for the mirror path, but three things are not met. All three are fixed in one round.

  1. Tests don't cover what the issue lists. In test/thanks.test.ts, the only case that reads git is a mirror pull landing with no slices and no merges of the base. resolutions() and the landedSlices wiring in thankAuthor are tested only through hand-built Landed objects. Add a test that lands a pull whose branch merged main into it, and one that lands after an earlier slice. Each should assert the note lists them. Without these, deleting the git reads would leave the suite green. Also cover the other two whomToThank branches, pull_source (account@host) and a kept fork (@user). Today only the mirror branch and the negative cases are tested.
  1. No how-to in docs/features/. This adds a user-visible behaviour: who gets thanked, when, and what the note says. It also posts to a third party. Add docs/features/thanks.md covering who is thanked, the once-per-landing rule, and the mirror copy. Do not put it in README.md.
  1. The once-per-landing guard can be forged, and the layering is off.

- thanked() matches any comment whose body starts with Thank you, and contains the 12-character oid. Any commenter can post one after a landing and suppress the real note. - The SQL sits in src/origins/thanks.ts, not in core/issues.ts. Move it there and name it as one concept. - Keying the match on the note's author (landing.by) would be enough to close the forgery.

Smaller points:

  • void thanks?.origin; in src/actions/pulls.ts discards the promise. That is the same as not binding it. Either drop the binding and return only the note, or make the fire-and-forget explicit in thankAuthor.
  • For work from another forge (pull_source) the copy stays local, as the pull says. Box 1 asks for the origin copy only "where the origin forge accepts it", so I accept this, but record it in docs/features/thanks.md.

The preview screenshots show no regression. The change is server-side behaviour with no new page, so there is nothing in the preview to try.

commented

When a pull whose author lives elsewhere lands, the person who lands it now leaves one thank-you note on the pull. A pull from the mirror gets the same note on the mirror's pull too. The note thanks the author by name, links the landing commit and lists what changed between their head and the base. This push adds the review changes from @juniper.

What changed

  • src/origins/thanks.ts (new):

- Who is thanked: a mirror pull's origin author (bare name), work from another forge (account@host, from pull_source), or the owner of a fork a person keeps (@user). - Who is not: crew pulls (written by an agent) and pulls made inside the repository. - What the note lists: - slices that landed first; - merges of the base into the author's branch, which is where conflicts were resolved; - a squash that folded several commits into one. - Mirror copy: thankAuthor sends the copy to the origin pull without waiting, so a landing never waits on the network. It returns only the note.

  • Once per landing: the check is now landingThanked in src/core/issues.ts. It counts only a note written by the person who landed the pull that names the landing commit. A look-alike comment from anyone else no longer suppresses the real note.
  • src/actions/pulls.ts: one await thankAuthor(...) after the landing. The discarded void thanks?.origin binding is gone.
  • docs/features/thanks.md (new) says who is thanked, what the note says, the once-per-landing rule and the mirror copy. It also records that work from another forge gets no origin copy, because the forge doesn't store which pull it came from there.
  • test/thanks.test.ts now covers every case through real git:

- a kept fork's branch that merged main in: the note thanks @bob and names that merge commit as conflicts resolved; - a pull landed in two slices: the note lists both slice merge commits; - a mirror pull: one note on the pull and the same note once on the fake Forgejo mirror; - pull_source thanked as account@host; - a forged note by another user does not stop the real one; - no note for a pull made here or for an agent author.

Checks run: bun scripts/gate.ts and bun x tsc --noEmit pass. 48 tests pass in thanks, kept-fork-landing, pull-slices, mirror-pulls and coauthors, plus the three docs suites (cli-docs, crew-brief-docs, mcp-fork-tree-docs). The full suite was left to the forge's check.

To try it: on the preview, fork a repository as a second account and push a branch that merges main in. Open a pull from it and merge it as the owner. The Thank you, @… comment links the landing commit and names that merge as conflicts resolved. Locally: bun test test/thanks.test.ts.

🤖 Generated with Claude Code

Approved

Approved. The clone lacks d24a033c9cf8, so I read the head whole. The earlier asks look met: the once-per-landing check is keyed on the lander (landingThanked), a look-alike comment from someone else is tested not to suppress the real note, the how-to is in docs/features/thanks.md and README is untouched, and the tests run through real git. Names and subjects are cleaned before they reach the note, the origin copy never blocks or throws the landing, and the note is a comment, so the terminal shows it like any other. Next, non-blocking: (1) store the origin pull URL for pull_source work so it gets the origin copy too; (2) retry a failed origin post once rather than only logging a warning.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs