# Conflicts: # AGENTS.md # AGENTS.md~upstream_unstable # deps/libkv/tests/ut_connect_fallback.c # deps/libvalkey/docs/standalone.md # src/dict.c # src/unit/test_fifo.c # src/unit/test_files.h # src/unit/test_help.h # src/unit/test_kv_strtod.c # src/unit/test_main.c # src/unit/test_mutexqueue.c # src/unit/test_util.c # tests/cluster/cluster.tcl # tests/cluster/run.tcl # tests/cluster/tests/03-failover-loop.tcl # tests/cluster/tests/04-resharding.tcl # tests/cluster/tests/07-replica-migration.tcl # tests/cluster/tests/12-replica-migration-2.tcl # tests/cluster/tests/12.1-replica-migration-3.tcl # tests/cluster/tests/28-cluster-shards.tcl # tests/cluster/tests/includes/init-tests.tcl # tests/cluster/tests/includes/utils.tcl
7.5 KiB
Contributing to KV
Welcome and thank you for wanting to contribute!
Project governance
The KV project is led by a Technical Steering Committee, whose responsibilities are laid out in GOVERNANCE.md.
Get started
- Have a question? Ask it on GitHub Discussions or KV's Discord or KV's Matrix
- Found a bug? Report it here
- KV crashed? Submit a crash report here
- Suggest a new feature? Post your detailed feature request here
- Report a test failure? Report it here
- Want to help with documentation? Move on to kv-doc
- Report a vulnerability? See SECURITY.md
Developer Certificate of Origin
We respect the intellectual property rights of others and we want to make sure
all incoming contributions are correctly attributed and licensed. A Developer
Certificate of Origin (DCO) is a lightweight mechanism to do that. The DCO is
a declaration attached to every commit. In the commit message of the contribution,
the developer simply adds a Signed-off-by statement and thereby agrees to the DCO,
which you can find below or at DeveloperCertificate.org.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the
best of my knowledge, is covered under an appropriate open
source license and I have the right under that license to
submit that work with modifications, whether created in whole
or in part by me, under the same open source license (unless
I am permitted to submit under a different license), as
Indicated in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including
all personal information I submit with it, including my
sign-off) is maintained indefinitely and may be redistributed
consistent with this project or the open source license(s)
involved.
We require that every contribution to KV to be signed with a DCO. We require the usage of known identity (such as a real or preferred name). We do not accept anonymous contributors nor those utilizing pseudonyms. A DCO signed commit will contain a line like:
Signed-off-by: Jane Smith <jane.smith@email.com>
You may type this line on your own when writing your commit messages. However, if your
user.name and user.email are set in your git configs, you can use git commit with -s
or --signoff to add the Signed-off-by line to the end of the commit message. We also
require revert commits to include a DCO.
If you're contributing code to the KV project in any other form, including sending a code fragment or patch via private email or public discussion groups, you need to ensure that the contribution is in accordance with the DCO.
How to provide a patch or a new feature
-
If it is a major feature or a semantical change, please don't start coding straight away: if your feature is not a conceptual fit you'll lose a lot of time writing the code without any reason. Start by creating an issue at Github with the description of, exactly, what you want to accomplish and why. Use cases are important for features to be accepted. Here you can see if there is consensus about your idea.
-
If in step 1 you get an acknowledgment from the project leaders, use the following procedure to submit a patch:
-
Keep in mind that we are very overloaded, so issues and PRs sometimes wait for a very long time. However this is not a lack of interest, as the project gets more and more users, we find ourselves in a constant need to prioritize certain issues/PRs over others. If you think your issue/PR is very important try to popularize it, have other users commenting and sharing their point of view, and so forth. This helps.
-
While developing code, make sure to refer to our DEVELOPMENT_GUIDE.md, which includes documentation about various best practices for writing KV code.
-
For minor fixes, open a pull request on GitHub.
To link a pull request to an existing issue, please write "Fixes #xyz" somewhere in the pull request description, where xyz is the issue number.
Code formatting with clang-format
Valkey enforces code formatting using clang-format-18. A CI check runs on
every pull request and will fail if your code is not formatted correctly.
Install clang-format-18
Option A — pip (any platform):
pip install clang-format==18.1.8
Option B — apt (Debian/Ubuntu):
sudo apt-get install software-properties-common -y
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/llvm-toolchain.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/llvm-toolchain.gpg] http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update -y
sudo apt-get install clang-format-18 -y
Format your changes
Run clang-format on the files you modified:
clang-format-18 -i src/file_you_changed.c src/file_you_changed.h
To format all source files at once:
clang-format-18 -i src/*.c src/*.h
The formatting configuration lives in src/.clang-format. Use version 18
specifically — different versions may produce different output and cause the
CI check to fail.
Running the daily workflow on demand for your branch
Use .github/workflows/daily.yml with
workflow_dispatch to run daily tests manually on any branch in your fork.
- Open your fork on GitHub and go to Actions -> Daily.
- Click Run workflow.
- In the Branch dropdown, select the branch that contains the workflow file you want to use.
- In the input fields, set:
use_repoto your fork (for example,your-user/kv)use_git_refto your branch name (or a specific commit SHA)
- Optionally set
skipjobs,skiptests,test_args, andcluster_test_args. - Click Run workflow.
Notes:
- To run the full matrix, set
skipjobsandskipteststonone. Do not leave them empty, since the workflow input defaults may be applied. - The scheduled part of this workflow is gated to
hanzoai/kv, but manualworkflow_dispatchruns work for forks.
Thanks!