Skip to content

Commit 7c5fe91

Browse files
committed
docs: Replace contributor boilerplate
CONTRIBUTING.md was inherited from Bitcoin Core and named paths and workflows this project doesn't have. Keep Core's structure and review philosophy, and adapt the parts that differ: the editable `.[dev]` install (quoted so it works in POSIX shells, PowerShell and cmd), the CI checks, security reporting, the AI policy, licensing and third-party attribution, and the maintainer-authorized review-size budgets. Refs #38 Claude-Session: https://claude.ai/code/session_01Q1TNm1YeYW8K9W2eBvxmCD
1 parent 6dd7828 commit 7c5fe91

1 file changed

Lines changed: 100 additions & 64 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 100 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,50 @@ Getting Started
1111
New contributors are very welcome and needed.
1212

1313
If you use AI tools while contributing, please read and follow the [AI
14-
policy](/doc/AI_POLICY.md).
14+
policy](docs/developer/AI_POLICY.md).
1515

1616
In-depth reviewing and testing are the bottleneck of the project, and are the
1717
most effective way anyone can start to contribute. It will teach you much more
1818
about the code and process than opening pull requests, and may help you uncover
1919
related issues and follow-ups to contribute code for. Please refer to the [peer
2020
review](#peer-review) section below.
2121

22-
Before you start contributing, familiarize yourself with the build system and
23-
tests. Refer to the documentation in the repository on how to build the project
24-
and how to run the unit tests, functional tests, and fuzz tests.
22+
Before you start contributing, familiarize yourself with the [developer API
23+
guide](docs/developer/api.md), [security model](docs/security/model.md), and
24+
[user guide](docs/user/guide.md).
25+
26+
The supported development setup uses Python 3.10 through 3.15. From the
27+
repository root:
28+
29+
python -m venv .venv
30+
source .venv/bin/activate
31+
python -m pip install --upgrade pip
32+
python -m pip install -e ".[dev]"
33+
python -m pip check
34+
python -m pytest -q
35+
36+
On Windows, activate with `.\.venv\Scripts\Activate.ps1` in PowerShell or
37+
`.venv\Scripts\activate.bat` in Command Prompt. The `.[dev]` extra installs the
38+
test and development tools. If the suite cannot collect after these steps,
39+
include the Python version and full error in the report.
40+
41+
CI also runs these checks on selected jobs:
42+
43+
python -O -m pytest -q
44+
python tools/verify_correction_constants.py
45+
python -m mypy src/codex32
46+
python -m ruff check .
47+
python -m ruff format --check .
48+
python tools/differential_correction.py --verify
49+
50+
For packaging or release changes, also build and check the distributions:
51+
52+
python -m build
53+
python -m twine check dist/*
54+
55+
For changes to Bitcoin Core wallet behavior, run the focused Core fixture
56+
workflow as well; see `.github/workflows/bitcoin-core-fixtures.yml` for the
57+
pinned binary and invocation. Do not use funded wallets for testing.
2558

2659
Communication Channels
2760
----------------------
@@ -49,10 +82,17 @@ To contribute a patch, the workflow is as follows:
4982
1. Create topic branch
5083
1. Commit patches
5184

52-
The master branch for all monotree repositories is identical.
85+
The supported API and review boundaries in the [developer API
86+
guide](docs/developer/api.md) must be followed. Security-sensitive changes must
87+
also follow [SECURITY.md](SECURITY.md), including its private-reporting and
88+
synthetic-test-material requirements, and the [security
89+
invariants](docs/security/invariants.md).
5390

54-
The project coding conventions in the [developer notes](doc/developer-notes.md)
55-
must be followed.
91+
For v1, the installed library must remain below 5,200 logical review lines. GUI
92+
work uses a separate 2,250-line budget once it is part of the candidate.
93+
Changing either budget requires explicit maintainer review and authorization,
94+
together with matching documentation and enforcement. Do not take unrelated
95+
refactors solely to create line-count headroom.
5696

5797
### Committing Patches
5898

@@ -62,13 +102,11 @@ fixes or code moves with actual code changes.
62102

63103
Make sure each individual commit is hygienic: that it builds successfully on its
64104
own without warnings, errors, regressions, or test failures.
65-
See the [developer notes](doc/developer-notes.md#commit-structure-for-tests)
66-
for guidance on where test coverage belongs in a commit stack.
67105

68106
Commit messages should be verbose by default consisting of a short subject line
69107
(50 chars max), a blank line and detailed explanatory text as separate
70-
paragraph(s), unless the title alone is self-explanatory (like "Correct typo
71-
in init.cpp") in which case a single title line is sufficient. Commit messages should be
108+
paragraph(s), unless the title alone is self-explanatory (like "Correct typo")
109+
in which case a single title line is sufficient. Commit messages should be
72110
helpful to people reading your code in the future, so explain the reasoning for
73111
your decisions. Further explanation [here](https://cbea.ms/git-commit/).
74112

@@ -100,11 +138,16 @@ any users mentioned in the description will be annoyingly notified each time a
100138
fork copies the merge. Instead, make any username mentions in a subsequent
101139
comment to the PR.
102140

141+
State which automated checks and manual tests you ran. Where a bug is fixed,
142+
include a regression test when practical. Update the affected user or developer
143+
documentation when a contract changes.
144+
103145
### Work in Progress Changes and Requests for Comments
104146

105147
If a pull request is not to be considered for merging (yet), please
106148
prefix the title with [WIP] or use [Tasks Lists](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#task-lists)
107-
in the body of the pull request to indicate tasks are pending.
149+
in the body of the pull request to indicate tasks are pending. A draft pull
150+
request is also appropriate for changes that are not ready for review.
108151

109152
### Address Feedback
110153

@@ -117,6 +160,10 @@ merged. You may update the code or reject the feedback if you do not agree with
117160
it, but you should express so in a reply. If there is outstanding feedback and
118161
you are not actively working on it, your pull request may be closed.
119162

163+
If you change a reviewed commit, say what changed and rerun the relevant checks.
164+
Do not repeatedly request automated reviews when a quota limit or a non-blocking
165+
stylistic disagreement is the only remaining issue.
166+
120167
Please refer to the [peer review](#peer-review) section below for more details.
121168

122169
### Squashing Commits
@@ -131,7 +178,8 @@ before it will be reviewed. The basic squashing workflow is shown below.
131178
# Set commits (except the one in the first line) from 'pick' to 'squash', save and quit.
132179
# On the next screen, edit/refine commit messages.
133180
# Save and quit.
134-
git push -f # (force push to GitHub)
181+
git push --force-with-lease # (force push to GitHub, refusing to clobber
182+
# commits you have not fetched)
135183

136184
Please update the resulting commit message, if needed. It should read as a
137185
coherent message. In most cases, this means not just listing the interim
@@ -153,18 +201,24 @@ pull request to pull request.
153201

154202
When a pull request conflicts with the target branch, you may be asked to rebase it on top of the current target branch.
155203

156-
git fetch # Fetch the latest upstream commit
157-
git rebase FETCH_HEAD # Rebuild commits on top of the new base
204+
If you cloned your fork normally, configure the project repository once:
205+
206+
git remote add upstream https://github.com/BenWestgate/python-codex32.git
158207

159-
This project aims to have a clean git history, where code changes are only made in non-merge commits. This simplifies
160-
auditability because merge commits can be assumed to not contain arbitrary code changes. Merge commits should be signed,
161-
and the resulting git tree hash must be deterministic and reproducible. The script in
162-
[/contrib/verify-commits](/contrib/verify-commits) checks that.
208+
Then fetch and rebase onto the current target branch:
163209

164-
After a rebase, reviewers are encouraged to sign off on the force push. This should be relatively straightforward with
165-
the `git range-diff` tool explained in the [productivity
166-
notes](/doc/productivity.md#diff-the-diffs-with-git-range-diff). To avoid needless review churn, maintainers will
167-
generally merge pull requests that received the most review attention first.
210+
git fetch upstream <target-branch>
211+
git rebase FETCH_HEAD
212+
git push --force-with-lease
213+
214+
This project aims to have a clean git history, where code changes are only made
215+
in non-merge commits. This simplifies auditability because merge commits can be
216+
assumed not to contain arbitrary code changes.
217+
218+
After a rebase, reviewers are encouraged to sign off on the force push. This
219+
should be relatively straightforward with `git range-diff`. To avoid needless
220+
review churn, maintainers will generally merge pull requests that received the
221+
most review attention first.
168222

169223
Pull Request Philosophy
170224
-----------------------
@@ -174,7 +228,6 @@ feature, fix a bug, or refactor code; but not a mixture. Please also avoid super
174228
pull requests which attempt to do too much, are overly large, or overly complex
175229
as this makes review difficult.
176230

177-
178231
### Features
179232

180233
When adding a new feature, thought must be given to the long term technical debt
@@ -183,7 +236,6 @@ feature that will require maintenance, please consider if you are willing to
183236
maintain it (including bug fixing). If features get orphaned with no maintainer
184237
in the future, they may be removed by the Repository Maintainer.
185238

186-
187239
### Refactoring
188240

189241
Refactoring is a necessary part of any software project's evolution. The
@@ -206,12 +258,10 @@ Trivial pull requests or pull requests that refactor the code with no clear
206258
benefits may be immediately closed by the maintainers to reduce unnecessary
207259
workload on reviewing.
208260

209-
210261
"Decision Making" Process
211262
-------------------------
212263

213-
The following applies to code changes to the project (and related
214-
projects).
264+
The following applies to code changes to the project (and related projects).
215265

216266
Whether a pull request is merged rests with the project merge maintainers.
217267

@@ -224,11 +274,11 @@ In general, all pull requests must:
224274
- Have a clear use case, fix a demonstrable bug or serve the greater good of
225275
the project (for example refactoring for modularisation);
226276
- Be well peer-reviewed;
227-
- Have unit tests, functional tests, and fuzz tests, where appropriate;
228-
- Follow code style guidelines (doc/developer-notes.md, [functional tests](test/functional/README.md));
277+
- Have tests appropriate to the affected surface;
278+
- Follow the project style and supported API/security guidance;
229279
- Not break the existing test suite;
230-
- Where bugs are fixed, where possible, there should be unit tests
231-
demonstrating the bug and also proving the fix. This helps prevent regression.
280+
- Where bugs are fixed, where possible, have tests demonstrating the bug and
281+
proving the fix. This helps prevent regression;
232282
- Change relevant comments and documentation when behaviour of code changes.
233283

234284
### Peer Review
@@ -271,8 +321,8 @@ branch, followed by a description of how the reviewer did the review. The
271321
following language is used within pull request comments:
272322

273323
- "I have tested the code", involving change-specific manual testing in
274-
addition to running the unit, functional, or fuzz tests, and in case it is
275-
not obvious how the manual testing was done, it should be described;
324+
addition to running the relevant automated tests, and in case it is not
325+
obvious how the manual testing was done, it should be described;
276326
- "I have not tested the code, but I have reviewed it and it looks
277327
OK, I agree it can be merged";
278328
- A "nit" refers to a trivial, often non-blocking issue.
@@ -299,39 +349,25 @@ about:
299349
contribution, thundering silence is a good sign of widespread (mild) dislike of a given change
300350
(because people don't assume *others* won't actually like the proposal). Don't take
301351
that personally, though! Instead, take another critical look at what you are suggesting
302-
and see if it: changes too much, is too broad, doesn't adhere to the
303-
[developer notes](doc/developer-notes.md), is dangerous or insecure, is messily written, etc.
304-
Identify and address any of the issues you find. Then ask if someone could give
305-
their opinion on the concept itself.
352+
and see if it: changes too much, is too broad, doesn't adhere to the surrounding style,
353+
is dangerous or insecure, is messily written, etc. Identify and address any of the
354+
issues you find. Then ask if someone could give their opinion on the concept itself.
306355
- Remember that the best thing you can do while waiting is give review to others!
307356

308-
309-
Backporting
310-
-----------
311-
312-
Security and bug fixes can be backported from `master` to release
313-
branches.
314-
Maintainers will do backports in batches and
315-
use the proper `Needs backport (...)` labels
316-
when needed (the original author does not need to worry about it).
317-
318-
A backport should contain the following metadata in the commit body:
319-
320-
```
321-
Github-Pull: #<PR number>
322-
Rebased-From: <commit hash of the original commit>
323-
```
324-
325-
Have a look at [an example backport PR](
326-
https://github.com/bitcoin/bitcoin/pull/16189).
327-
328-
Also see the [backport.py script](
329-
https://github.com/bitcoin-core/bitcoin-maintainer-tools#backport).
330-
331357
Copyright
332358
---------
333359

334360
By contributing to this repository, you agree to license your work under the
335-
MIT license unless specified otherwise in `contrib/debian/copyright` or at
336-
the top of the file itself. Any work contributed where you are not the original
337-
author must contain its license header with the original author(s) and source.
361+
MIT license unless specified otherwise at the top of the file itself. Any work
362+
contributed where you are not the original author must contain its license
363+
header with the original author(s) and source.
364+
365+
Third-party notices shipped with this project are in [LICENSES](LICENSES/).
366+
367+
Attribution
368+
-----------
369+
370+
This document is adapted from [Bitcoin Core's CONTRIBUTING.md](
371+
https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md), Copyright (c)
372+
2009-present The Bitcoin Core developers, distributed under the MIT software
373+
license. See [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)