xref: /third_party/node/onboarding.md (revision 1cb0ef41)
11cb0ef41Sopenharmony_ci# Onboarding
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciThis document is an outline of the things we tell new collaborators at their
41cb0ef41Sopenharmony_cionboarding session.
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci## One week before the onboarding session
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci* If the new Collaborator is not yet a member of the nodejs GitHub organization,
91cb0ef41Sopenharmony_ci  confirm that they are using [two-factor authentication][]. It will not be
101cb0ef41Sopenharmony_ci  possible to add them to the organization if they are not using two-factor
111cb0ef41Sopenharmony_ci  authentication. If they cannot receive SMS messages from GitHub, try
121cb0ef41Sopenharmony_ci  [using a TOTP mobile app][].
131cb0ef41Sopenharmony_ci* Suggest the new Collaborator install [`node-core-utils`][] and
141cb0ef41Sopenharmony_ci  [set up the credentials][] for it.
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci## Fifteen minutes before the onboarding session
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci* Prior to the onboarding session, add the new Collaborator to
191cb0ef41Sopenharmony_ci  [the collaborators team](https://github.com/orgs/nodejs/teams/collaborators).
201cb0ef41Sopenharmony_ci* Ask them if they want to join any [subsystem teams](https://github.com/orgs/nodejs/teams/core/teams)
211cb0ef41Sopenharmony_ci  and add them accordingly. See [Who to CC in the issue tracker][who-to-cc].
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci## Onboarding session
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci* This session will cover:
261cb0ef41Sopenharmony_ci  * [local setup](#local-setup)
271cb0ef41Sopenharmony_ci  * [project goals and values](#project-goals-and-values)
281cb0ef41Sopenharmony_ci  * [managing the issue tracker](#managing-the-issue-tracker)
291cb0ef41Sopenharmony_ci  * [reviewing pull requests](#reviewing-pull-requests)
301cb0ef41Sopenharmony_ci  * [landing pull requests](#landing-pull-requests)
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci## Local setup
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci* git:
351cb0ef41Sopenharmony_ci  * Make sure you have whitespace=fix: `git config --global --add
361cb0ef41Sopenharmony_ci    apply.whitespace fix`
371cb0ef41Sopenharmony_ci  * Always create a branch in your own GitHub fork for pull requests
381cb0ef41Sopenharmony_ci    * Branches in the `nodejs/node` repository are only for release lines
391cb0ef41Sopenharmony_ci  * Add the canonical nodejs repository as `upstream` remote:
401cb0ef41Sopenharmony_ci    * `git remote add upstream git@github.com:nodejs/node.git`
411cb0ef41Sopenharmony_ci  * To update from `upstream`:
421cb0ef41Sopenharmony_ci    * `git checkout main`
431cb0ef41Sopenharmony_ci    * `git fetch upstream HEAD`
441cb0ef41Sopenharmony_ci    * `git reset --hard FETCH_HEAD`
451cb0ef41Sopenharmony_ci  * Make a new branch for each pull request you submit.
461cb0ef41Sopenharmony_ci  * Membership: Consider making your membership in the Node.js GitHub
471cb0ef41Sopenharmony_ci    organization public. This makes it easier to identify collaborators.
481cb0ef41Sopenharmony_ci    Instructions on how to do that are available at
491cb0ef41Sopenharmony_ci    [Publicizing or hiding organization membership][].
501cb0ef41Sopenharmony_ci
511cb0ef41Sopenharmony_ci* Notifications:
521cb0ef41Sopenharmony_ci  * Use <https://github.com/notifications> or
531cb0ef41Sopenharmony_ci    set up email
541cb0ef41Sopenharmony_ci  * Watching the main repository will flood your inbox (several hundred
551cb0ef41Sopenharmony_ci    notifications on typical weekdays), so be prepared
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ciThe project has a venue for real-time discussion:
581cb0ef41Sopenharmony_ci
591cb0ef41Sopenharmony_ci* [`#nodejs-core`](https://openjs-foundation.slack.com/archives/C019Y2T6STH) on
601cb0ef41Sopenharmony_ci  the [OpenJS Foundation Slack](https://slack-invite.openjsf.org/)
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ci## Project goals and values
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ci* Collaborators are the collective owners of the project
651cb0ef41Sopenharmony_ci  * The project has the goals of its contributors
661cb0ef41Sopenharmony_ci
671cb0ef41Sopenharmony_ci* There are some higher-level goals and values
681cb0ef41Sopenharmony_ci  * Empathy towards users matters (this is in part why we onboard people)
691cb0ef41Sopenharmony_ci  * Generally: try to be nice to people!
701cb0ef41Sopenharmony_ci  * The best outcome is for people who come to our issue tracker to feel like
711cb0ef41Sopenharmony_ci    they can come back again.
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ci* You are expected to follow _and_ hold others accountable to the
741cb0ef41Sopenharmony_ci  [Code of Conduct][].
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_ci## Managing the issue tracker
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ci* You have (mostly) free rein; don't hesitate to close an issue if you are
791cb0ef41Sopenharmony_ci  confident that it should be closed.
801cb0ef41Sopenharmony_ci  * Be nice about closing issues! Let people know why, and that issues and pull
811cb0ef41Sopenharmony_ci    requests can be reopened if necessary.
821cb0ef41Sopenharmony_ci
831cb0ef41Sopenharmony_ci* See [Labels][].
841cb0ef41Sopenharmony_ci  * There is [a bot](https://github.com/nodejs-github-bot/github-bot) that
851cb0ef41Sopenharmony_ci    applies subsystem labels (for example, `doc`, `test`, `assert`, or `buffer`)
861cb0ef41Sopenharmony_ci    so that we know what parts of the code base the pull request modifies. It is
871cb0ef41Sopenharmony_ci    not perfect, of course. Feel free to apply relevant labels and remove
881cb0ef41Sopenharmony_ci    irrelevant labels from pull requests and issues.
891cb0ef41Sopenharmony_ci  * `semver-{minor,major}`:
901cb0ef41Sopenharmony_ci    * If a change has the remote _chance_ of breaking something, use the
911cb0ef41Sopenharmony_ci      `semver-major` label
921cb0ef41Sopenharmony_ci    * When adding a `semver-*` label, add a comment explaining why you're adding
931cb0ef41Sopenharmony_ci      it. Do it right away so you don't forget!
941cb0ef41Sopenharmony_ci  * Please add the [`author-ready`][] label for pull requests, if applicable.
951cb0ef41Sopenharmony_ci
961cb0ef41Sopenharmony_ci* See [Who to CC in the issue tracker][who-to-cc].
971cb0ef41Sopenharmony_ci  * This will come more naturally over time
981cb0ef41Sopenharmony_ci  * For many of the teams listed there, you can ask to be added if you are
991cb0ef41Sopenharmony_ci    interested
1001cb0ef41Sopenharmony_ci    * Some are WGs with some process around adding people, others are only there
1011cb0ef41Sopenharmony_ci      for notifications
1021cb0ef41Sopenharmony_ci
1031cb0ef41Sopenharmony_ci* When a discussion gets heated, you can request that other collaborators keep
1041cb0ef41Sopenharmony_ci  an eye on it by opening an issue at the private
1051cb0ef41Sopenharmony_ci  [nodejs/moderation](https://github.com/nodejs/moderation) repository.
1061cb0ef41Sopenharmony_ci  * This is a repository to which all members of the `nodejs` GitHub
1071cb0ef41Sopenharmony_ci    organization (not just collaborators on Node.js core) have access. Its
1081cb0ef41Sopenharmony_ci    contents should not be shared externally.
1091cb0ef41Sopenharmony_ci  * Node.js has a moderation team which you should contact when unsure
1101cb0ef41Sopenharmony_ci    about taking action in the Node.js org.
1111cb0ef41Sopenharmony_ci  * You can moderate non-collaborator posts yourself. Please
1121cb0ef41Sopenharmony_ci    report the moderation action taken in accordance to the moderation
1131cb0ef41Sopenharmony_ci    policy.
1141cb0ef41Sopenharmony_ci  * You can always refer to the
1151cb0ef41Sopenharmony_ci    [full moderation policy](https://github.com/nodejs/admin/blob/main/Moderation-Policy.md).
1161cb0ef41Sopenharmony_ci  * You can contact someone in the
1171cb0ef41Sopenharmony_ci    [full list of moderation team members](https://github.com/nodejs/moderation#moderation-team-members).
1181cb0ef41Sopenharmony_ci
1191cb0ef41Sopenharmony_ci## Reviewing pull requests
1201cb0ef41Sopenharmony_ci
1211cb0ef41Sopenharmony_ci* The primary goal is for the codebase to improve.
1221cb0ef41Sopenharmony_ci
1231cb0ef41Sopenharmony_ci* Secondary (but not far off) is for the person submitting code to succeed. A
1241cb0ef41Sopenharmony_ci  pull request from a new contributor is an opportunity to grow the community.
1251cb0ef41Sopenharmony_ci
1261cb0ef41Sopenharmony_ci* Review a bit at a time. Do not overwhelm new contributors.
1271cb0ef41Sopenharmony_ci  * It is tempting to micro-optimize. Don't succumb to that temptation. We
1281cb0ef41Sopenharmony_ci    change V8 often. Techniques that provide improved performance today may be
1291cb0ef41Sopenharmony_ci    unnecessary in the future.
1301cb0ef41Sopenharmony_ci
1311cb0ef41Sopenharmony_ci* Be aware: Your opinion carries a lot of weight!
1321cb0ef41Sopenharmony_ci
1331cb0ef41Sopenharmony_ci* Nits (requests for small changes that are not essential) are fine, but try to
1341cb0ef41Sopenharmony_ci  avoid stalling the pull request.
1351cb0ef41Sopenharmony_ci  * Identify them as nits when you comment: `Nit: change foo() to bar().`
1361cb0ef41Sopenharmony_ci  * If they are stalling the pull request, fix them yourself on merge.
1371cb0ef41Sopenharmony_ci
1381cb0ef41Sopenharmony_ci* Insofar as possible, issues should be identified by tools rather than human
1391cb0ef41Sopenharmony_ci  reviewers. If you are leaving comments about issues that could be identified
1401cb0ef41Sopenharmony_ci  by tools but are not, consider implementing the necessary tooling.
1411cb0ef41Sopenharmony_ci
1421cb0ef41Sopenharmony_ci* Minimum wait for comments time
1431cb0ef41Sopenharmony_ci  * There is a minimum waiting time which we try to respect for non-trivial
1441cb0ef41Sopenharmony_ci    changes so that people who may have important input in such a distributed
1451cb0ef41Sopenharmony_ci    project are able to respond.
1461cb0ef41Sopenharmony_ci  * For non-trivial changes, leave the pull request open for at least 48 hours.
1471cb0ef41Sopenharmony_ci  * If a pull request is abandoned, check if they'd mind if you took it over
1481cb0ef41Sopenharmony_ci    (especially if it just has nits left).
1491cb0ef41Sopenharmony_ci
1501cb0ef41Sopenharmony_ci* Approving a change
1511cb0ef41Sopenharmony_ci  * Collaborators indicate that they have reviewed and approve of the changes in
1521cb0ef41Sopenharmony_ci    a pull request using GitHub's approval interface
1531cb0ef41Sopenharmony_ci  * Some people like to comment `LGTM` (“Looks Good To Me”)
1541cb0ef41Sopenharmony_ci  * You have the authority to approve any other collaborator's work.
1551cb0ef41Sopenharmony_ci  * You cannot approve your own pull requests.
1561cb0ef41Sopenharmony_ci  * When explicitly using `Changes requested`, show empathy – comments will
1571cb0ef41Sopenharmony_ci    usually be addressed even if you don't use it.
1581cb0ef41Sopenharmony_ci    * If you do, it is nice if you are available later to check whether your
1591cb0ef41Sopenharmony_ci      comments have been addressed
1601cb0ef41Sopenharmony_ci    * If you see that the requested changes have been made, you can clear
1611cb0ef41Sopenharmony_ci      another collaborator's `Changes requested` review.
1621cb0ef41Sopenharmony_ci    * Use `Changes requested` to indicate that you are considering some of your
1631cb0ef41Sopenharmony_ci      comments to block the pull request from landing.
1641cb0ef41Sopenharmony_ci
1651cb0ef41Sopenharmony_ci* What belongs in Node.js:
1661cb0ef41Sopenharmony_ci  * Opinions vary – it's good to have a broad collaborator base for that reason!
1671cb0ef41Sopenharmony_ci  * If Node.js itself needs it (due to historical reasons), then it belongs in
1681cb0ef41Sopenharmony_ci    Node.js.
1691cb0ef41Sopenharmony_ci    * That is to say, `url` is there because of `http`, `freelist` is there
1701cb0ef41Sopenharmony_ci      because of `http`, etc.
1711cb0ef41Sopenharmony_ci  * Things that cannot be done outside of core, or only with significant pain
1721cb0ef41Sopenharmony_ci    such as `async_hooks`.
1731cb0ef41Sopenharmony_ci
1741cb0ef41Sopenharmony_ci* Continuous Integration (CI) Testing:
1751cb0ef41Sopenharmony_ci  * <https://ci.nodejs.org/>
1761cb0ef41Sopenharmony_ci    * It is not automatically run. You need to start it manually.
1771cb0ef41Sopenharmony_ci  * Log in on CI is integrated with GitHub. Try to log in now!
1781cb0ef41Sopenharmony_ci  * You will be using `node-test-pull-request` most of the time. Go there now!
1791cb0ef41Sopenharmony_ci    * Consider bookmarking it: <https://ci.nodejs.org/job/node-test-pull-request/>
1801cb0ef41Sopenharmony_ci  * To get to the form to start a job, click on `Build with Parameters`. (If you
1811cb0ef41Sopenharmony_ci    don't see it, that probably means you are not logged in!) Click it now!
1821cb0ef41Sopenharmony_ci  * To start CI testing from this screen, you need to fill in two elements on
1831cb0ef41Sopenharmony_ci    the form:
1841cb0ef41Sopenharmony_ci    * The `CERTIFY_SAFE` box should be checked. By checking it, you are
1851cb0ef41Sopenharmony_ci      indicating that you have reviewed the code you are about to test and you
1861cb0ef41Sopenharmony_ci      are confident that it does not contain any malicious code. (We don't want
1871cb0ef41Sopenharmony_ci      people hijacking our CI hosts to attack other hosts on the internet, for
1881cb0ef41Sopenharmony_ci      example!)
1891cb0ef41Sopenharmony_ci    * The `PR_ID` box should be filled in with the number identifying the pull
1901cb0ef41Sopenharmony_ci      request containing the code you wish to test. For example, if the URL for
1911cb0ef41Sopenharmony_ci      the pull request is `https://github.com/nodejs/node/issues/7006`, then put
1921cb0ef41Sopenharmony_ci      `7006` in the `PR_ID`.
1931cb0ef41Sopenharmony_ci    * The remaining elements on the form are typically unchanged.
1941cb0ef41Sopenharmony_ci  * If you need help with something CI-related:
1951cb0ef41Sopenharmony_ci    * Use the [Build WG repository](https://github.com/nodejs/build) to file
1961cb0ef41Sopenharmony_ci      issues for the Build WG members who maintain the CI infrastructure.
1971cb0ef41Sopenharmony_ci
1981cb0ef41Sopenharmony_ci## Landing pull requests
1991cb0ef41Sopenharmony_ci
2001cb0ef41Sopenharmony_ciSee the Collaborator Guide: [Landing pull requests][].
2011cb0ef41Sopenharmony_ci
2021cb0ef41Sopenharmony_ciCommits in one pull request that belong to one logical change should
2031cb0ef41Sopenharmony_cibe squashed. It is rarely the case in onboarding exercises, so this
2041cb0ef41Sopenharmony_cineeds to be pointed out separately during the onboarding.
2051cb0ef41Sopenharmony_ci
2061cb0ef41Sopenharmony_ci<!-- TODO(joyeechueng): provide examples about "one logical change" -->
2071cb0ef41Sopenharmony_ci
2081cb0ef41Sopenharmony_ci## Exercise: Make a pull request adding yourself to the README
2091cb0ef41Sopenharmony_ci
2101cb0ef41Sopenharmony_ci* Example:
2111cb0ef41Sopenharmony_ci  <https://github.com/nodejs/node/commit/6669b3857f0f43ee0296eb7ac45086cd907b9e94>
2121cb0ef41Sopenharmony_ci  * For raw commit message:
2131cb0ef41Sopenharmony_ci    `git show --format=%B 6669b3857f0f43ee0296eb7ac45086cd907b9e94`
2141cb0ef41Sopenharmony_ci* Collaborators are in alphabetical order by GitHub username.
2151cb0ef41Sopenharmony_ci* Optionally, include your personal pronouns.
2161cb0ef41Sopenharmony_ci* Add the `Fixes: <collaborator-nomination-issue-url>` to the commit message
2171cb0ef41Sopenharmony_ci  so that when the commit lands, the nomination issue url will be
2181cb0ef41Sopenharmony_ci  automatically closed.
2191cb0ef41Sopenharmony_ci* Label your pull request with the `doc`, `notable-change`, and `fast-track`
2201cb0ef41Sopenharmony_ci  labels. The `fast-track` label should cause the Node.js GitHub bot to post a
2211cb0ef41Sopenharmony_ci  comment in the pull request asking collaborators to approve the pull request
2221cb0ef41Sopenharmony_ci  by leaving a � reaction on the comment.
2231cb0ef41Sopenharmony_ci* Optional: Run CI on the pull request. Use the `node-test-pull-request` CI
2241cb0ef41Sopenharmony_ci  task. As a convenience, you may apply the `request-ci` label to the pull
2251cb0ef41Sopenharmony_ci  request to have a GitHub Actions workflow start the Jenkins CI task for you.
2261cb0ef41Sopenharmony_ci* After two Collaborator approvals for the change and two Collaborator approvals
2271cb0ef41Sopenharmony_ci  for fast-tracking, land the PR.
2281cb0ef41Sopenharmony_ci* If there are not enough approvals within a reasonable time, consider the
2291cb0ef41Sopenharmony_ci  single approval of the onboarding TSC member sufficient, and land the pull
2301cb0ef41Sopenharmony_ci  request.
2311cb0ef41Sopenharmony_ci  * Be sure to add the `PR-URL: <full-pr-url>` and appropriate `Reviewed-By:`
2321cb0ef41Sopenharmony_ci    metadata.
2331cb0ef41Sopenharmony_ci  * [`node-core-utils`][] automates the generation of metadata and the landing
2341cb0ef41Sopenharmony_ci    process. See the documentation of [`git-node`][].
2351cb0ef41Sopenharmony_ci  * [`core-validate-commit`][] automates the validation of commit messages.
2361cb0ef41Sopenharmony_ci    This will be run during `git node land --final` of the [`git-node`][]
2371cb0ef41Sopenharmony_ci    command.
2381cb0ef41Sopenharmony_ci
2391cb0ef41Sopenharmony_ci## Final notes
2401cb0ef41Sopenharmony_ci
2411cb0ef41Sopenharmony_ci* Don't worry about making mistakes: everybody makes them, there's a lot to
2421cb0ef41Sopenharmony_ci  internalize and that takes time (and we recognize that!)
2431cb0ef41Sopenharmony_ci* Almost any mistake you could make can be fixed or reverted.
2441cb0ef41Sopenharmony_ci* The existing collaborators trust you and are grateful for your help!
2451cb0ef41Sopenharmony_ci* Other repositories:
2461cb0ef41Sopenharmony_ci  * <https://github.com/nodejs/TSC>
2471cb0ef41Sopenharmony_ci  * <https://github.com/nodejs/build>
2481cb0ef41Sopenharmony_ci  * <https://github.com/nodejs/nodejs.org>
2491cb0ef41Sopenharmony_ci  * <https://github.com/nodejs/Release>
2501cb0ef41Sopenharmony_ci  * <https://github.com/nodejs/citgm>
2511cb0ef41Sopenharmony_ci* The OpenJS Foundation hosts regular summits for active contributors to the
2521cb0ef41Sopenharmony_ci  Node.js project, where we have face-to-face discussions about our work on the
2531cb0ef41Sopenharmony_ci  project. The Foundation has travel funds to cover participants' expenses
2541cb0ef41Sopenharmony_ci  including accommodations, transportation, visa fees, etc. if needed. Check out
2551cb0ef41Sopenharmony_ci  the [summit](https://github.com/nodejs/summit) repository for details.
2561cb0ef41Sopenharmony_ci* If you are interested in helping to fix coverity reports consider requesting
2571cb0ef41Sopenharmony_ci  access to the projects coverity project as outlined in [static-analysis][].
2581cb0ef41Sopenharmony_ci
2591cb0ef41Sopenharmony_ci[Code of Conduct]: https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md
2601cb0ef41Sopenharmony_ci[Labels]: doc/contributing/collaborator-guide.md#labels
2611cb0ef41Sopenharmony_ci[Landing pull requests]: doc/contributing/collaborator-guide.md#landing-pull-requests
2621cb0ef41Sopenharmony_ci[Publicizing or hiding organization membership]: https://help.github.com/articles/publicizing-or-hiding-organization-membership/
2631cb0ef41Sopenharmony_ci[`author-ready`]: doc/contributing/collaborator-guide.md#author-ready-pull-requests
2641cb0ef41Sopenharmony_ci[`core-validate-commit`]: https://github.com/nodejs/core-validate-commit
2651cb0ef41Sopenharmony_ci[`git-node`]: https://github.com/nodejs/node-core-utils/blob/HEAD/docs/git-node.md
2661cb0ef41Sopenharmony_ci[`node-core-utils`]: https://github.com/nodejs/node-core-utils
2671cb0ef41Sopenharmony_ci[set up the credentials]: https://github.com/nodejs/node-core-utils#setting-up-github-credentials
2681cb0ef41Sopenharmony_ci[static-analysis]: doc/contributing/static-analysis.md
2691cb0ef41Sopenharmony_ci[two-factor authentication]: https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/
2701cb0ef41Sopenharmony_ci[using a TOTP mobile app]: https://help.github.com/articles/configuring-two-factor-authentication-via-a-totp-mobile-app/
2711cb0ef41Sopenharmony_ci[who-to-cc]: doc/contributing/collaborator-guide.md#who-to-cc-in-the-issue-tracker
272