Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DanConwayDev
Copy link
Contributor

With the advent of Grasp, we can now do PRs without relying on a single contributor-selected Git server, which they would have to provision and could be rugged at any time.

Note how the commit ID is included in the event and any updates, be it force pushes or additional commits, are added by supplementary PR update events. This ensures history is maintained and Nostr events remain the authority, rather than Git servers.

Grasp servers with proactive sync enabled will copy the commits to ensure that they are available if the contributor-selected Git server is unreliable or removed.

This also provides an alternative for large patches, which are too large to be included within a signle nostr event.

It is also more supported by Git tools which don't always have patch support. For example, isomorphic-git, which enables Git in the browser.

@fiatjaf
Copy link
Member

fiatjaf commented Jul 1, 2025

Looks good to me.

@DanConwayDev DanConwayDev force-pushed the nip34-add-pr branch 2 times, most recently from fd6bc27 to e9073a5 Compare July 2, 2025 08:25
@TheAwiteb
Copy link
Contributor

LGTM, I like the idea that I can create a PR with and without GRASP server. Make it more flexible.

@DanConwayDev
Copy link
Contributor Author

this last update makes the clone tag required and clarifies what should be listed.

@DanConwayDev
Copy link
Contributor Author

last update adds line:
"Patches SHOULD be used if each event is under 60kb, otherwise PRs SHOULD be used."

Stirfry max event size default is 65kb and nostr-rs-relay is 128kb.

@DanConwayDev
Copy link
Contributor Author

last update handles what SHOULD happen when an additional patch would exceed the 60kb limit. It enables a PR as a patch-revision.

@DanConwayDev
Copy link
Contributor Author

Perhaps we should think about applying nip-22 style threading to Status and Patches as propsed in #1799 ?
At the time I drafted it, I wasn't in favour of merging it as its a breaking change. But here we are already material updates and additions to how changes can be proposed and applied.

@DanConwayDev
Copy link
Contributor Author

@dluvian @Silberengel do you have any thoughts about all this?

Copy link
Contributor

@dluvian dluvian left a comment

Choose a reason for hiding this comment

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

Having two types increases complexity. If patches only work for <60kB changes and PRs work for any size then I will completely ignore patches and only work with PRs to avoid the complexity of maintaining two types.

Comment on lines +123 to +127
["p", "<repository-owner>"],
["p", "<other-user>"], // optionally send the PR to another user to bring it to their attention
Copy link
Contributor

Choose a reason for hiding this comment

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

Uppercase P for repo-owner and lowecase p for people directly mentioned in the PR. Repo owner could be in P and p if he was mentioned directly in it. Gives client devs the option to improve notification/inbox filtering

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes a lot of sense and provides more flexibility. However, an uppercase P is used only for the author of the "root scope event" in NIP-22. Its use for other purposes isn't prohibited in NIP-22, but I haven't seen it used anywhere else. Will we break non-git-specialist clients by doing this? For example, clients may:

  • Assume there is only one P tag.
  • Assume it can't be the thread root but get confused as there is no corresponding E tag.
  • Carry these P tags through to replies.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't a repo the root space of a PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't a repo the root space of a PR?

In the context of a PR, Patch or Issue, its important that repo announcement isn't mistaken for the root of the thread. Otherwise a single filter can't be used to find all comments related to that thread.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the context of a PR, Patch or Issue, its important that repo announcement isn't mistaken for the root of the thread.

Makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Your suggestion is a really good idea but we need a bit more thought around the above question before adding it to the spec:

Will we break non-git-specialist clients by doing this?

Comment on lines +151 to +155
["p", "<repository-owner>"],
["p", "<other-user>"], // optionally send the PR to another user to bring it to their attention
Copy link
Contributor

Choose a reason for hiding this comment

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

Same p and P here

@Silberengel
Copy link
Contributor

We never wanted patches.

@DanConwayDev DanConwayDev force-pushed the nip34-add-pr branch 2 times, most recently from d28f8c3 to 5599fc4 Compare July 3, 2025 09:33
@TheAwiteb
Copy link
Contributor

TheAwiteb commented Jul 3, 2025

@Silberengel wrote in this comment

We never wanted patches.

So why do we use GitViaNostr if it's not for decentralized patches and issues?

@TheAwiteb
Copy link
Contributor

@dluvian wrote in this comment

Having two types increases complexity. If patches only work for <60kB changes and PRs work for any size then I will completely ignore patches and only work with PRs to avoid the complexity of maintaining two types.

Is this because of the PR revision of patches? Then what do you think about closing the patch and open a PR if the revision > 60KB?

@Silberengel
Copy link
Contributor

So why do we use GitViaNostr if it's not for decentralized patches and issues?

You aren't even using it. You're using GitHub.
Because PRs work.

We tried to use ngit patches, as a team, and the repo quickly turned into 🍝. So, nope.

@TheAwiteb
Copy link
Contributor

TheAwiteb commented Jul 3, 2025

So why do we use GitViaNostr if it's not for decentralized patches and issues?

You aren't even using it. You're using GitHub. Because PRs work.

We tried to use ngit patches, as a team, and the repo quickly turned into 🍝. So, nope.

You didn't answer my question, anyway, I'm using patches in Nostr and it's good, you just make the patches and send them or fetch them and apply them, I don't know why your repo turned into a spaghetti

@Silberengel
Copy link
Contributor

Because the commits were too large.

@dluvian
Copy link
Contributor

dluvian commented Jul 3, 2025

@dluvian wrote in this comment

Having two types increases complexity. If patches only work for <60kB changes and PRs work for any size then I will completely ignore patches and only work with PRs to avoid the complexity of maintaining two types.

Is this because of the PR revision of patches? Then what do you think about closing the patch and open a PR if the revision > 60KB?

That's still more work than simply ignoring patches and only implementing PRs. I do prefer patches and their simplicity but if their size restriction is a practical issue I would ignore them and only work with PRs

@dluvian
Copy link
Contributor

dluvian commented Jul 3, 2025

@cypherhoodlum are you still working on a git stuff client? Any thoughts on this?

@fiatjaf
Copy link
Member

fiatjaf commented Jul 3, 2025

@dluvian wrote in this comment

Having two types increases complexity. If patches only work for <60kB changes and PRs work for any size then I will completely ignore patches and only work with PRs to avoid the complexity of maintaining two types.

Is this because of the PR revision of patches? Then what do you think about closing the patch and open a PR if the revision > 60KB?

That's still more work than simply ignoring patches and only implementing PRs. I do prefer patches and their simplicity but if their size restriction is a practical issue I would ignore them and only work with PRs

Does it make sense to write in the repo announcement that you only accept patches or only PRs or both? Then whatever client/relay the repository owner is choosing can keep that field updated?

Patches are great because they don't require a server, and we cannot guarantee that everybody will have access to a server, even if it's commoditized with GRASP. Servers may still require a setup or registration process in the long run, and for some small things just issuing a "send patch" command from the command line is probably better.

@DanConwayDev what do you think about vastly simplifying the patch flow to make it only use one event, throwaway, very simple and dumb -- and leave any slightly more complicated flow to PRs?

@DanConwayDev
Copy link
Contributor Author

Does it make sense to write in the repo announcement that you only accept patches or only PRs or both? Then whatever client/relay the repository owner is choosing can keep that field updated?

My concern is that repository maintainers won't make a considered or informed choice; instead, a client with an ideological bent for one or the other will choose for them, without the maintainer understanding the implications. imo, this decision shouldn't be made during onboarding, as it assumes too much knowledge and requires too much thought, which would degrade the user experience.

@DanConwayDev what do you think about vastly simplifying the patch flow to make it only use one event, throwaway, very simple and dumb -- and leave any slightly more complicated flow to PRs?

Most of the complexity is optional and degrades gracefully. You would still need status. I think what you are getting at is that support for patch sets isn't really optional. I'm not sure it would be possible to make them optional. Removing them would significantly degrade the usefulness of patches. Most patches sent via email today are part of a patch set.

@TheAwiteb
Copy link
Contributor

I think what you are getting at is that support for patch sets isn't really optional. I'm not sure it would be possible to make them optional. Removing them would significantly degrade the usefulness of patches. Most patches sent via email today are part of a patch set.

Also make a set of patches in one single event will make the patches useless, because they will not be accepted by most of the relays because their events are large.

I think the current approach are good, use patches if each commit is less than 60KB otherwise use PRs.

@DanConwayDev
Copy link
Contributor Author

this last update adds tags to README.md as requested in #1966 (comment)

@DanConwayDev
Copy link
Contributor Author

this last update simplies the Patch ~> PR path. I expect this very much to be an edge case.

@DanConwayDev
Copy link
Contributor Author

quick update: I have partially built this into the git remote helper shipped with ngit:

  • git pushon a branch withpr/prefix will use the PR event style instead of publishing large patches, but right now only if a grasp server is listed as aclone urlin therepository announcement event`.
  • merge status is automatically issued.
  • patch ~> PR path is seamlessly handled - patch close status issued; PR created referencing the root patch.
  • additional git push and git push --force for pr/* branches use the PR update event.

Its available on the main branch of ngit.

It still needs to be integrated into ngit send, ngit list and handle the case where the repository doesn't use any grasp servers or when the grasp servers don't accept the refs/nostr/<event-id> branch.

Further protocol updates are needed:

  • a grasp server preferences event like 10063 in NIP-B7 (blossom) to know which servers user want to use and have paid for / permission to use.
  • a repository announcement event flag such as ['t','personal-fork'] to indicate there isn't a "willingness to receive patches, bug reports and comments in general", which publishing an announcement event currently expresses according to the nip. We may want to host a fork as a patched dependancy of another project or use so we can push our own PR data to refs/nostr/<event-id>.

@DanConwayDev
Copy link
Contributor Author

rebased on to master incorporatating NIP-34 tweaks #1998 and #1964

@DanConwayDev
Copy link
Contributor Author

Further protocol updates are needed:

  • a grasp server preferences event like 10063 in NIP-B7 (blossom) to know which servers user want to use and have paid for / permission to use.
  • a repository announcement event flag such as ['t','personal-fork'] to indicate there isn't a "willingness to receive patches, bug reports and comments in general", which publishing an announcement event currently expresses according to the nip. We may want to host a fork as a patched dependancy of another project or use so we can push our own PR data to refs/nostr/<event-id>.

I've pushed 1e2fc88 along those lines.

I'm still working through the ngit / git-remote-nostr implementation. There are more failure opportunties when the change is not bundled with the change announcement as with patches.

34.md Outdated
["clone", "<clone-url>", ...] // at least one git clone url where commit can be downloaded
["branch-name", "<branch-name>"] // optional recommended branch name

["e", "<root-patch-event-id>"] // optionally indicate PR is a revision of an existing patch, which should be closed
Copy link
Contributor

@TheAwiteb TheAwiteb Aug 12, 2025

Choose a reason for hiding this comment

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

So, when I want to fetch a patch, do I have to check if it's mentioned in a PR to fetch the PR's status? Isn't that complicated? I mean, there's no need to do all of this; we can just close the patch and open a PR. There's no need to check if the PR exists and fetch its status in every patch, right?

Also if there is more than one PR mentioning the same patch, which PR should I fetch its status? It's really complicated.

Knowing that opening a patch and replacing it with a PR later is rare, because I'll know the changes I made before submitting the patch. I don't think there are reviewers who would request changes so numerous that they would require moving the patch to a PR.

I know I've annoyed you with this point, but it really annoys me. Sorry.

Suggested change
["e", "<root-patch-event-id>"] // optionally indicate PR is a revision of an existing patch, which should be closed

@DanConwayDev
Copy link
Contributor Author

DanConwayDev commented Aug 12, 2025 via email

## Replies

Replies to either a `kind:1621` (_issue_) or a `kind:1617` (_patch_) event should follow [NIP-22 comment](22.md).

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add PR here?

@TheAwiteb
Copy link
Contributor

https://n34.dev supports Pull Requests now. 🚀

TheAwiteb added a commit to TheAwiteb/n34 that referenced this pull request Sep 24, 2025
Support for pull requests, it's not standard in NIPs yet[1] but there must be
two clients that support it to be included in NIPs, n34 is one of them.

This support:
- Create a new PR `n34 pr new`
- Update PR tip `n34 pr update`
- View a PR `n34 pr view`
- List PRs `n34 pr list`
- Add `PR` and `PR-update` kinds as roots in `NostrClient::find_root`
- Support issuing statuses for PRs
- Support GRASP PR and PR-update
- Update the docs

[1] nostr-protocol/nips#1966
@alexgleason
Copy link
Member

Oops, I meant to comment on this PR, not the other. Should this be merged? Looks like we have support from ngit, n34.dev. I am working on implementing into Shakespeare. Anything left to do?

@DanConwayDev DanConwayDev force-pushed the nip34-add-pr branch 2 times, most recently from db714cd to b7a9084 Compare October 16, 2025 08:25
@DanConwayDev
Copy link
Contributor Author

I've now added support in gitworkshop.dev. Based on this experience I'm suggesting two minor tweaks:

  1. Clients SHOULD push to refs/nostr/<[PR|PR-Update]-event-id> for all servers and not just grasp servers. Rationale: a) Clients need to push to some ref so we might as well be consistant. b) Not all git tools (eg isomoprhic git) support fetching by commit-id.
  2. add merge-base tag. Rationale: a) Detect PR Update as a rebase just from the events, no git tooling needed. b) Identify commits in the PR after the fact if merged via a fast-forward merge.

I pushed an update to this NIP branch (commit bf5c2bd) with these tweaks and a few formatting fixes.

ngit has support in the master branch, when this PR is merged I'll issue a release.

ngit-relay (currently the only grasp implementation) support this PR, meaning it will receive commit sent to refs/nostr/<valid-event-id>.

I think we are ready to merge this.

With the advent of Grasp, we can now do PRs without relying on a
single contributor-selected Git server, which they would have to
provision and could be rugged at any time.

Note how the commit ID is included in the event and any updates,
be it force pushes or additional commits, are added by supplementary
PR update events. This ensures history is maintained and Nostr events
remain the authority, rather than Git servers.

Grasp servers with proactive sync enabled will copy the commits to
ensure that they are available if the contributor-selected Git server
is unreliable or removed.

This also provides an alternative for large patches, which are too
large to be included within a signle nostr event.

It is also more supported by Git tools which don't always have patch
support. For example, isomorphic-git, which enables Git in the
browser.
reasons for a 'personal-fork' respository include storing PR refs and
maintaining a patched version of a dependency.

the user grasp list is generally useful by also enables
auto-selecting grasp servers for pushing PR refs.
@alexgleason alexgleason merged commit 6e6b987 into nostr-protocol:master Oct 16, 2025
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.

6 participants