-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
doc: create ai-guidelines and include to CONTRIBUTING #62105
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
8fa167d
cee1884
483c41b
8944958
9168e27
c9e7c08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ works. | |||||||||||||
| * [Code of Conduct](#code-of-conduct) | ||||||||||||||
| * [Issues](#issues) | ||||||||||||||
| * [Pull Requests](#pull-requests) | ||||||||||||||
| * [AI Use Policy and Guidelines](#ai-use-policy-and-guidelines) | ||||||||||||||
| * [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin-11) | ||||||||||||||
|
|
||||||||||||||
| ## [Code of Conduct](./doc/contributing/code-of-conduct.md) | ||||||||||||||
|
|
@@ -47,6 +48,15 @@ dependencies, and tools contained in the `nodejs/node` repository. | |||||||||||||
| * [Reviewing Pull Requests](./doc/contributing/pull-requests.md#reviewing-pull-requests) | ||||||||||||||
| * [Notes](./doc/contributing/pull-requests.md#notes) | ||||||||||||||
|
|
||||||||||||||
| ## [AI Use Policy and Guidelines](./doc/contributing/ai-guidelines.md) | ||||||||||||||
|
|
||||||||||||||
| Node.js expects contributors to understand and take full responsibility for | ||||||||||||||
| every change they propose. Pull requests consisting of AI-generated code the | ||||||||||||||
| contributor has not personally understood, tested, and verified will be closed | ||||||||||||||
|
RafaelGSS marked this conversation as resolved.
Outdated
|
||||||||||||||
| without review. | ||||||||||||||
|
RafaelGSS marked this conversation as resolved.
Outdated
Comment on lines
+54
to
+56
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| See [details on our AI use policy and guidelines](./doc/contributing/ai-guidelines.md). | ||||||||||||||
|
|
||||||||||||||
| ## Developer's Certificate of Origin 1.1 | ||||||||||||||
|
|
||||||||||||||
| ```text | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||||||||||||||||||
| # AI use policy and guidelines | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * [Core principle](#core-principle) | ||||||||||||||||||||||
| * [Using AI for code contributions](#using-ai-for-code-contributions) | ||||||||||||||||||||||
| * [Using AI for communication](#using-ai-for-communication) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Core principle | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Node.js expects contributors to understand and take full responsibility for | ||||||||||||||||||||||
|
jasnell marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
| every change they propose. The answer to "Why is X an improvement?" should | ||||||||||||||||||||||
|
jasnell marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
| never be "I'm not sure. The AI did it." | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Pull requests that consist of AI-generated code the contributor has not | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| personally understood, tested, and verified waste collaborator time and | ||||||||||||||||||||||
| will be closed without review. | ||||||||||||||||||||||
|
RafaelGSS marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Using AI for code contributions | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| AI tools may assist contributors, but must not replace contributor judgment. | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| When using AI as a coding assistant: | ||||||||||||||||||||||
|
jasnell marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Understand the codebase first.** Do not skip familiarizing yourself with | ||||||||||||||||||||||
| the relevant subsystem. LLMs frequently produce inaccurate descriptions of | ||||||||||||||||||||||
| Node.js internals — always verify against the actual source. | ||||||||||||||||||||||
|
RafaelGSS marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Own every line you submit.** You are responsible for all code in your | ||||||||||||||||||||||
| pull request, regardless of how it was generated. Be prepared to explain | ||||||||||||||||||||||
| any change in detail during review. | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(would need a DCO link added at the bottom of the page also) |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Keep logical commits.** Structure commits coherently even when an LLM | ||||||||||||||||||||||
| generates multiple changes at once. Follow the existing | ||||||||||||||||||||||
| [commit message guidelines][]. | ||||||||||||||||||||||
|
RafaelGSS marked this conversation as resolved.
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Test thoroughly.** AI-generated code must pass the full test suite and | ||||||||||||||||||||||
| any manually written tests relevant to the change. Do not rely on the LLM | ||||||||||||||||||||||
|
RafaelGSS marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
| to assess correctness. | ||||||||||||||||||||||
|
Comment on lines
+57
to
+60
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some hallucination machines may write tests based on the implementation of a feature instead of considering the expected behavior of the feature.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we extract this and also apply to human-written code too? (but keep it here also) I believe we have existing decade-old tests that should be subject to this Mostly "increase coverage" PRs are highly subject to documenting bugs instead of fixing them (not just in Node.js, but overall) |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Edit generated comments critically.** LLM-produced comments are often | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend adding an extra rule to not push "linter" changes that LLM usually does, it's pretty frequent at meteor, and dirty the commits and PR history |
||||||||||||||||||||||
| verbose or inaccurate. Remove comments that simply restate what the code | ||||||||||||||||||||||
| does; add comments only where the logic is non-obvious. | ||||||||||||||||||||||
|
RafaelGSS marked this conversation as resolved.
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Using AI for communication | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Node.js values concise, precise communication that respects collaborator time. | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * **Do not post AI-generated messages** in pull requests, issues, or the | ||||||||||||||||||||||
| project's communication channels. | ||||||||||||||||||||||
|
RafaelGSS marked this conversation as resolved.
Outdated
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm less convinced this one is necessary. It's also difficult to enforce. These should follow the same rules as contributions... whatever is posted, you're responsible for, so use appropriate discretion.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's only difficult to enforce if it's low quality prose, though, in which case this item seems like it'd be needed.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this also disenfranchises people that use an AI to help them write English, as it might not be their first language
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They shouldn't be doing that, though - they should just write in their native language and the reader can use AI and/or translation tools. I'd always much rather read broken English than a mistranslation (which are frequent).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can all have opinions about what others should or should not do and about what we personally prefer to see, but we should let people decide for themselves what tools they want to use and why.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The point of a policy like this is to decide for them what tools they're allowed to use, even if that decision is "all of them". It's perfectly reasonable to tell people not to perform translations themselves, so that their intent is not lost (as it otherwise could be)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Creating incentives to breaking the rules in letter and assuming that those rules in letter would be broken is a bad policy (and means that the rule is formulated incorrectly) It should be rephrased in a way that would allow high-effort/reviewed comments even if primarly generated by LLM, but disallow unreviewed/low-quality ones. |
||||||||||||||||||||||
| * **Verify accuracy** of any LLM-generated content before including it in a | ||||||||||||||||||||||
| PR description or comment. | ||||||||||||||||||||||
| * **Complete pull request templates fully** rather than replacing them with | ||||||||||||||||||||||
| LLM-generated summaries. | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a template? I thought those are for issues, not PRs.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not strictly a template: https://github.com/nodejs/node/blob/main/.github/PULL_REQUEST_TEMPLATE.md?plain=1
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not possible to fulfil the instructions "Complete pull request templates fully" based on the contents of https://github.com/nodejs/node/blob/main/.github/PULL_REQUEST_TEMPLATE.md?plain=1 so it looks like this sentence needs to be removed.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| * **Link to primary sources** — code, documentation, specifications — rather | ||||||||||||||||||||||
| than quoting LLM answers. | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| * Grammar and spell-check tools are acceptable when they improve clarity and | ||||||||||||||||||||||
| conciseness. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| [commit message guidelines]: ./pull-requests.md#commit-message-guidelines | ||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this first sentence seems intentionally to be the same as the full policy document, which now has a suggested change. marking this here to resolve whether or not the language should continue syncing, if it should change