8000 NIP-34: add PR and PR update events by DanConwayDev · Pull Request #1966 · nostr-protocol/nips · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

NIP-34: add PR and PR update events #1966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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 +124
["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?

["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?

9E88
@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.

@TheAwiteb
Copy link
Contributor

For me, I prefer the patches, and I hope developers don't use PRs as a replaceable for the patches, because patches are more decentralized than PRs.

PRs for the large changes, and don't make large changes frequently, you should maintain your change size and focus on one topic instead of multiple.

I mean if you reach 60 KB for one single patch you are not doing well.

@DanConwayDev
Copy link
Contributor Author

this last updated improves the wording around populating the clone tag and the git servers push requirements, including how to identify grasp servers from the announcement event.

@DanConwayDev
Copy link
Contributor Author

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

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.
@DanConwayDev
Copy link
Contributor Author

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

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.

5 participants
0