Skip to content

Commit f8ce404

Browse files
committed
docs: add coding agent guidelines
1 parent 3483316 commit f8ce404

3 files changed

Lines changed: 172 additions & 1 deletion

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Please specify the module before the PR name: feat: ... or fix: ... -->
1+
<!-- PR titles must follow Conventional Commits: <type>(<optional-scope>): <description> -->
22

33
### Purpose
44

AGENTS.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<!---
2+
Copyright 2026-present Alibaba Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
# AGENTS.md
18+
19+
This file provides repository-specific instructions for coding agents working on Paimon C++.
20+
For contributor-facing setup and the complete coding conventions, also read
21+
[`CONTRIBUTING.md`](CONTRIBUTING.md) and [`docs/code-style.md`](docs/code-style.md).
22+
23+
## Scope
24+
25+
These instructions apply to the entire repository. More deeply nested `AGENTS.md` files, if
26+
added later, may provide additional or more specific instructions for their directory trees.
27+
28+
Keep the requested scope exact. Do not include unrelated refactors, formatting changes, API
29+
redesigns, dependency updates, or generated files in a focused change.
30+
31+
## Repository Layout
32+
33+
- `include/paimon/`: public C++ API headers.
34+
- `src/paimon/`: core implementation and most unit tests.
35+
- `test/inte/`: end-to-end integration tests.
36+
- `benchmark/`: benchmarks and benchmark-specific tests.
37+
- `examples/`: example programs.
38+
- `docs/` and `apidoc/`: user documentation and API documentation.
39+
- `cmake_modules/` and `build_support/`: CMake helpers and build infrastructure.
40+
- `ci/`: scripts used by continuous integration.
41+
- `test/test_data/`: checked-in test fixtures.
42+
- `third_party/`: third-party sources and patches.
43+
- `build/`, `build-release/`, and `output/`: generated or local build output.
44+
45+
Do not edit `third_party/`, checked-in fixtures, generated output, or Git LFS objects unless the
46+
task explicitly requires it. Never add files from local build directories to a change.
47+
48+
## Working Rules
49+
50+
1. Inspect the current implementation, nearby tests, and relevant CMake target before editing.
51+
2. Search for an existing helper or established pattern before adding a new abstraction.
52+
3. Preserve user changes and untracked local files. Do not discard, overwrite, or reformat
53+
unrelated work.
54+
4. Prefer the smallest change that fully implements or fixes the requested behavior.
55+
5. Add or update a focused regression test for behavior changes when practical.
56+
6. Do not claim a build or test passed unless the corresponding command completed successfully.
57+
7. Do not commit, push, amend commits, or create a pull request unless explicitly requested.
58+
59+
When changing a public API, check the declaration under `include/paimon/`, its implementation,
60+
symbol visibility, documentation, callers, and tests together.
61+
62+
## C++ Requirements
63+
64+
The full rules are in [`docs/code-style.md`](docs/code-style.md). In particular:
65+
66+
- Use C++17; do not introduce C++20 or later features.
67+
- Use `Status` and `Result<T>` for fallible operations. Do not use exceptions for production
68+
error propagation.
69+
- Propagate errors with the project macros, including `PAIMON_RETURN_NOT_OK` and
70+
`PAIMON_ASSIGN_OR_RAISE`.
71+
- Use an explicit type, not `auto`, as the declaration in `PAIMON_ASSIGN_OR_RAISE` and
72+
`PAIMON_ASSIGN_OR_RAISE_FROM_ARROW`.
73+
- Prefer `std::unique_ptr` for sole ownership and use `std::shared_ptr` only for genuine shared
74+
ownership.
75+
- Use `static Create()` plus a private constructor when object initialization can fail.
76+
- Mark new public API symbols with `PAIMON_EXPORT`.
77+
- Reuse helpers under `src/paimon/common/utils/` instead of duplicating utility code.
78+
- Follow `.clang-format`; do not manually restyle unrelated code.
79+
- Add the repository's Apache 2.0 license header to every new source or documentation file.
80+
81+
## Build and Test
82+
83+
Use an existing configured build directory when it is compatible with the change. To configure a
84+
new debug build with tests:
85+
86+
```bash
87+
cmake -S . -B build \
88+
-DCMAKE_BUILD_TYPE=Debug \
89+
-DPAIMON_BUILD_TESTS=ON
90+
```
91+
92+
Start with the narrowest relevant validation:
93+
94+
```bash
95+
cmake --build build --target <test-target> -j "$(nproc)"
96+
./build/debug/<test-binary> --gtest_filter='<Suite.Test>'
97+
```
98+
99+
Then broaden validation in proportion to the change:
100+
101+
```bash
102+
# All unit tests
103+
cmake --build build --target unittest -j "$(nproc)"
104+
105+
# Formatting, lint, and repository checks for changed files
106+
pre-commit run --files <changed-files>
107+
git diff --check
108+
```
109+
110+
For changes to build configuration, public APIs, shared infrastructure, or cross-module behavior,
111+
run the relevant wider test suite. The CI-equivalent build entry point is
112+
`ci/scripts/build_paimon.sh`; it may rebuild all dependencies and take substantially longer than a
113+
focused local target.
114+
115+
If a required check cannot be run because of missing dependencies, unsupported hardware, or time
116+
constraints, report exactly what was and was not run.
117+
118+
## Testing Conventions
119+
120+
- Use GoogleTest and name test files `*_test.cpp`.
121+
- Place unit tests next to the corresponding implementation unless an existing target establishes
122+
another location.
123+
- Extend an existing test target when appropriate instead of creating a new executable for one
124+
small test.
125+
- Test externally observable behavior and failure cases; avoid coupling tests to incidental
126+
implementation details.
127+
- Use existing test utilities and temporary-directory helpers. Do not write tests that depend on
128+
developer-specific absolute paths.
129+
- Keep fixtures deterministic and small. Do not rewrite existing fixture data unless the task
130+
explicitly calls for it.
131+
- Use `ASSERT_*` when later assertions depend on the condition succeeding.
132+
133+
## Delivery
134+
135+
Before handing off a change:
136+
137+
1. Review `git diff` for accidental or unrelated edits.
138+
2. Run `git diff --check`.
139+
3. Run the narrowest relevant build and test, plus any wider checks justified by the risk.
140+
4. Summarize the changed behavior and list the exact validation commands that ran.
141+
5. Call out skipped validation, remaining risks, or follow-up work explicitly.
142+
6. When explicitly asked to commit, follow the Conventional Commits requirements in
143+
[`CONTRIBUTING.md`](CONTRIBUTING.md#commit-messages-and-pull-request-titles).
144+
7. When explicitly asked to open a pull request, follow
145+
[`CONTRIBUTING.md`](CONTRIBUTING.md#commit-messages-and-pull-request-titles), use a
146+
Conventional Commits title, and complete every applicable section of
147+
[`.github/PULL_REQUEST_TEMPLATE.md`](.github/PULL_REQUEST_TEMPLATE.md).

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,30 @@ If you find a bug or want to request a feature, please open an [issue](https://g
2626

2727
---
2828

29+
## Commit Messages and Pull Request Titles
30+
31+
Use the [Conventional Commits](https://www.conventionalcommits.org/) format for commit messages
32+
and pull request titles:
33+
34+
```text
35+
<type>(<optional-scope>): <description>
36+
```
37+
38+
Examples:
39+
40+
```text
41+
feat(parquet): support page-level bitmap filtering
42+
fix: handle non-contiguous row ranges
43+
test(executor): add shutdown coverage
44+
docs: update the build instructions
45+
```
46+
47+
Choose a type and optional scope that accurately describe the change. Keep the description concise
48+
and write it in the imperative mood. A pull request title should summarize the complete change and
49+
use the same format.
50+
51+
---
52+
2953
## Submitting Pull Requests
3054

3155
1. **Fork** the repository and create a feature branch from `main`.

0 commit comments

Comments
 (0)