-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
docs: Add conventional commit specification guildelines #11356
Conversation
This pull request was exported from Phabricator. Differential Revision: D65005411 |
✅ Deploy Preview for meta-velox canceled.
|
…bator#11356) Summary: Add guildelines to the CONTRIBUTING doc about PR titles and description, with the purpose of improving our ability to classify commits and navigate project history. Fixes: facebookincubator#11039 Differential Revision: D65005411
73d84b3
to
f4e324a
Compare
This pull request was exported from Phabricator. Differential Revision: D65005411 |
…bator#11356) Summary: Add guildelines to the CONTRIBUTING doc about PR titles and description, with the purpose of improving our ability to classify commits and navigate project history. Fixes: facebookincubator#11039 Differential Revision: D65005411
f4e324a
to
15c75eb
Compare
This pull request was exported from Phabricator. Differential Revision: D65005411 |
…bator#11356) Summary: Add guildelines to the CONTRIBUTING doc about PR titles and description, with the purpose of improving our ability to classify commits and navigate project history. Fixes: facebookincubator#11039 Differential Revision: D65005411
15c75eb
to
7eef00b
Compare
This pull request was exported from Phabricator. Differential Revision: D65005411 |
The **PR body** must contain a summary of the change, focusing on the *what* | ||
and *why*. Keep columns at 80 characters. | ||
|
||
**Breaking API Changes.** A "BREAKING CHANGE:" footer must be added to PRs |
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.
Should we impose this now? We do not have a fixed public API yet, so users/reviewers will find it hard to determine this.
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.
I'm planning to publish that External API docs we discussed a few weeks ago soon so we start socializing this more broadly. I feel like at least across the maintainers and reviewers group we should know what the main external API are (although the codebase organization does not yet reflect that).
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.
A "BREAKING CHANGE:" footer must be added to PRs
Why footer? Should this not be the very first line in the PR description?
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.
That's from the original conventional commit spec. An alternative is an exclamation mark after the type feat(type)!: ....
.
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.
Why footer? Should this not be the very first line in the PR description?
The conventional commit spec's guidance is to add as a footer, presumably to make it easier to parse automatically when generating changelogs?
Like @assignUser mentioned, adding the "!" to the title may also be something we want to do, to make it super explicit that this commit has backwards breaking changes. Let me add this to the guidance here as well
* **docs** for enhancements to documentation (only). | ||
* **refactor** for refactoring (no logic changes). | ||
|
||
* PR titles also take an *optional scope* field containing the area |
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.
Should we list some of the optional scope fields for usage consistency? Can we copy the github tags?
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.
Good idea. What tags should we add? Here are some initial ideas:
vectors, types, expression-eval, operators, memory, dwio, parquet, dwrf, filesystem
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.
Probably use shorter tags.
vec, type, expr, op, mem, dwio, dwrf, fs, parquet, func
. Initially, we can keep this list flexible.
When a new tag needs to be added, we can update this list and keep it consistent.
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.
Maybe we can have one additional one for (more generic) infrastructure or more specialized one for build or deps/dependencies? E.g. we could have a fix in a build script which would be fix(build)
or fix(infra)
or fix(deps)
? Or something along the lines? I suppose this doesn't quite fall under the build type. Or it is something for the misc
we discussed.
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.
fix
and feat
are specific to changes that would require a bump of the patch or minor component of the version. So there could be rare cases where we have a feat(build):
maybe adding a cmake config file or maybe removing a previously available option but usually cmake changes would be build:
because they don't influence the actual API of the package (which ~= the way velox is consumed [in binary form].). Though 'in binary form' might only be accurate once we have a proper release, because currently everyone uses velox from source?
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.
@pedroerp I'm not a fan of conventional commits, but I don't have a strong opinion. Some minor comments below.
|
||
Commit messages that follow a strict pattern improve maintainability, and allow | ||
tasks such as summarizing changelogs and identifying API breaking changes to be | ||
automated. Despite requiring more rigor from authors and reviewers, consistency |
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.
consistency creates productivity
I believe I understand what you are trying to say here, but wonder if there is a better verb.
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.
Rephrased it, please take another look.
where: | ||
|
||
* *Type* can be any of the following keywords: | ||
* **feat** when new features are being added. |
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.
I feel this one violates 'do-not-abbreviate' guideline that I find useful. Can we drop this altogether and assume that if 'type' is missing then it is a new functionality? Or, change this to 'feature'?
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.
Although I also don't like abbreviations in the code, the "feat" naming is part of the conventional commits spec and reasonably well known by folks engaged with other projects.
I think here, with the tension between abbreviation vs character limit, keeping this as "feat" for consistency may be a fair trade-off, but wonder what others think?
* **feat** when new features are being added. | ||
* **fix** for bug fixes. | ||
* **build** for build or CI-related improvements. | ||
* **docs** for enhancements to documentation (only). |
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.
Can we change this to 'doc' for consistency?
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.
Curious, what should we use for PRs that do not fit any of these categories (say, adding tests) or PRs that have multiple of these?
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.
For those chore
is usually used but in the discussion it was pointed out that the word has negative connotations and was renamed to refactor. While I see that point I would agree that we need another bucket, maybe 'misc' or explicitly list them under refactor
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.
We could also create a "tests" category.
... or PRs that have multiple of these?
I think in that case you would chose the "main" one. Like if you're adding a new feature with tests and docs, probably call out as a feature. But in general, if you have more than one "main" category, maybe you should have submitted them as different PRs in the first place?
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.
Can we make docs
-> doc
?
CONTRIBUTING.md
Outdated
|
||
* A *description* sentence summarizing the PR, written in imperative tone. The | ||
description must be capitalized, not contain a period at the end, and be kept | ||
under a 80 characters limit. |
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.
under a 80 characters limit.
I believe the whole commit title needs to be within that limit, not just the "Description" sentence.
"refactor(expression)" takes up 20 characters, 1/4 of the limit. Is this a concern?
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.
Is this a concern?
I believe that's why conventional commit choose short words (chore
vs refactor
) or abbreviations like feat
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.
Users can leverage the conventional commit words to keep the title succinct.
Add support for IPPREFIX type
vs.
feat(type): Add IPPREFIX
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.
+1. They do add extra characters, but like @majetideepak pointed out, these are usually things you would have in the title anyway. For example:
Refactor expression code to prepare for feature X
could be:
refactor(expr): Prepare for feature X
I think in general abbreviating things that are very intuitive like expression
-> expr
should also be ok.
Btw, @mbasmanova, when you look at these title example individually, the value is not super clear, but if you have a list of hundreds of them already properly formatted (vs the free-form version) it makes a ton of difference.
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.
Plus the benefit of automating the release notes and monthly updates.
CONTRIBUTING.md
Outdated
|
||
Examples of PR titles are: | ||
|
||
* feature(type): Add support for IPPREFIX type |
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.
perhaps, a better example would be
feature(type): Add IPPREFIX type
"support for" is redundant and takes up space
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.
A more succinct title would be to remove type
again at the end.
feature(type): Add IPPREFIX
CONTRIBUTING.md
Outdated
* refactor(vector): Use 'if constexpr' for Buffer::is_pod_like_v\<T\> | ||
|
||
The **PR body** must contain a summary of the change, focusing on the *what* | ||
and *why*. Keep columns at 80 characters. |
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.
Keep columns at 80 characters.
Would folks understand what this means? Usually, we do not write text in "columnar" manner. I used the term "wrap". Not sure if it is better though.
It would be nice to clarify why this is important. The reason I know of is to make the output of git show readable.
The **PR body** must contain a summary of the change, focusing on the *what* | ||
and *why*. Keep columns at 80 characters. | ||
|
||
**Breaking API Changes.** A "BREAKING CHANGE:" footer must be added to PRs |
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.
A "BREAKING CHANGE:" footer must be added to PRs
Why footer? Should this not be the very first line in the PR description?
CONTRIBUTING.md
Outdated
that may break client builds, or semantic changes on the behavior of such APIs. | ||
|
||
If there is a Github Issue or Discussion related to the PR, authors must also add a | ||
"Fixes: <link>" section to the bottom of the PR body. |
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.
There are multiple syntaxes that work. I use Fixes #
I don't have a link, but I'm sure GitHub docs list all supported combinations somewhere. The point of doing this is to allow GitHub auto-close issues when PRs are merged. That said, one needs to be careful to not use this for PRs that partially fix an issue. For these I use "Part of #" to allow GitHub to link PR to issue, but not auto-close the issue.
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.
Found the docs here:
Looks like there are multiple keywords that work (including "fixes"), but "part of" is not listed in any of the docs. I suppose this is because github ends up linking the PR to the Issue since the Issue was mentioned (but does not automatically close the associated Issue).
But +1 on adding guidelines for "Fixes" and "Part of", depending on what authors want the semantic to be; will update the file.
CONTRIBUTING.md
Outdated
If there is a Github Issue or Discussion related to the PR, authors must also add a | ||
"Fixes: <link>" section to the bottom of the PR body. | ||
|
||
To learn more about how to write great commit messages, check out these resources: |
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.
Wondering if there is a point in making a bit stronger request to all contributors to take the time and read these resources.
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.
Changed the phrasing.
* **feat** when new features are being added. | ||
* **fix** for bug fixes. | ||
* **build** for build or CI-related improvements. | ||
* **docs** for enhancements to documentation (only). |
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.
For those chore
is usually used but in the discussion it was pointed out that the word has negative connotations and was renamed to refactor. While I see that point I would agree that we need another bucket, maybe 'misc' or explicitly list them under refactor
CONTRIBUTING.md
Outdated
|
||
* A *description* sentence summarizing the PR, written in imperative tone. The | ||
description must be capitalized, not contain a period at the end, and be kept | ||
under a 80 characters limit. |
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.
Is this a concern?
I believe that's why conventional commit choose short words (chore
vs refactor
) or abbreviations like feat
The **PR body** must contain a summary of the change, focusing on the *what* | ||
and *why*. Keep columns at 80 characters. | ||
|
||
**Breaking API Changes.** A "BREAKING CHANGE:" footer must be added to PRs |
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.
That's from the original conventional commit spec. An alternative is an exclamation mark after the type feat(type)!: ....
.
* fix: Prevent unnecessary flatmap to map conversion | ||
* refactor(vector): Use 'if constexpr' for Buffer::is_pod_like_v\<T\> | ||
|
||
The **PR body** must contain a summary of the change, focusing on the *what* |
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.
I think a bullet point list can work for smaller changes and should be used as an additional, quickly skim-able summary for larger PRs.
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.
You mean we should add some guidance for authors to encourage them to describe the changes in their PRs as bullet point lists?
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.
Yes for short PRs just bullet points and for longer PRs that have multiple paragraphs in the description an additional bullet point summary at the top. Though from seeing PRs that had good descriptions that seems to come naturally so we can add that later as it's 'just' for human readability.
CONTRIBUTING.md
Outdated
|
||
**PR titles** must follow the pattern: | ||
|
||
> \<type\>[optional scope]: \<description\> |
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.
Nit: With the parenthesis around the optional scope - would the pseudo syntax be more
\<type\>[(<scope>)]: \<description\>
with [
and ]
denoting the optional?
…bator#11356) Summary: Add guildelines to the CONTRIBUTING doc about PR titles and description, with the purpose of improving our ability to classify commits and navigate project history. Fixes: facebookincubator#11039 Reviewed By: xiaoxmeng Differential Revision: D65005411
7eef00b
to
25c765a
Compare
This pull request was exported from Phabricator. Differential Revision: D65005411 |
@mbasmanova @assignUser @majetideepak @czentgr addressed review comments. Please take another look when you have a moment. |
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.
🎉
* fix: Prevent unnecessary flatmap to map conversion | ||
* refactor(vector): Use 'if constexpr' for Buffer::is_pod_like_v\<T\> | ||
|
||
The **PR body** must contain a summary of the change, focusing on the *what* |
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.
Yes for short PRs just bullet points and for longer PRs that have multiple paragraphs in the description an additional bullet point summary at the top. Though from seeing PRs that had good descriptions that seems to come naturally so we can add that later as it's 'just' for human readability.
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.
@pedroerp Looks nice! I have one comment.
* **feat** when new features are being added. | ||
* **fix** for bug fixes. | ||
* **build** for build or CI-related improvements. | ||
* **docs** for enhancements to documentation (only). |
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.
Can we make docs
-> doc
?
This pull request has been merged in 11b6de1. |
Conbench analyzed the 1 benchmark run on commit There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Summary: Check the PR title against cc pattern added in #11356. Fails with a pointer to CONTRIBUTING.md. We are running the title change on every commit as it takes under 5 seconds to run and this way we avoid weird states with skipped checks overriding failed results when the title was triggered outside of a commit. We could add a comment to the PR but that would require a workflow with elevated permissions using `pull_request_target` which should be avoided if possible. So I think the marginally lower ux is justified, we still get a marker/reminder for reviewers through this job. Pull Request resolved: #11520 Reviewed By: pedroerp Differential Revision: D65947963 Pulled By: Yuhta fbshipit-source-id: 290b97f784011367d3e481ff49f42b7da65fdf7a
Summary:
Add guildelines to the CONTRIBUTING doc about PR titles and
description, with the purpose of improving our ability to classify commits and
navigate project history.
Fixes: #11039
Differential Revision: D65005411