blob: 69d9891c4a87204f8d5f2cc1d054fc7eb16c06df [file] [log] [blame] [view]
Jens Geyer59fc4112026-03-27 08:52:36 +00001# Apache Thrift — AI Contribution Guidelines
2
3This file governs AI-assisted work on the Apache Thrift codebase.
4It supplements but does **not** replace [`CONTRIBUTING.md`](CONTRIBUTING.md).
5
6---
7
8## 1. ASF Legal Compliance (Third-Party Code)
9
10Apache Thrift is an [Apache Software Foundation (ASF)](https://www.apache.org/) project released under the **Apache License 2.0**.
11The AI **must** actively enforce and monitor ASF licensing policy:
12
13- **Proactively flag conflicts**: Before introducing any dependency, snippet, or code derived from an external source, verify its license is compatible with Apache 2.0.
14 Incompatible licenses include (non-exhaustive): GPL, AGPL, SSPL, BUSL, CC-BY-NC.
15 Compatible examples: MIT, BSD-2/3, Apache 2.0, ISC, MPL 2.0 (with caveats).
16- **Category X / Category A**: Follow the [ASF Third-Party Licensing Policy](https://www.apache.org/legal/resolved.html).
17 Category A licenses may be included; Category X licenses must **never** be introduced.
18- **Update `LICENSE` and `NOTICE`**: When adding third-party code or binaries that require attribution, add the appropriate notices to `LICENSE` and/or `NOTICE` following the [ASF guide on licenses and notices](https://www.apache.org/dev/licensing-howto.html).
19 If in doubt whether an entry is required, **add it and flag it in the PR description** for committer review.
20- **Generative AI output**: The [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) applies. Be aware that AI-generated code may unintentionally reproduce copyrighted material. Flag any non-trivial generated blocks in commit messages or PR descriptions.
21
22---
23
24## 2. Issue Tracking
25
26| Type | Tracker | Notes |
27|---|---|---|
28| Significant changes | [Apache JIRA THRIFT project](https://issues.apache.org/jira/browse/THRIFT) | Required for all non-trivial PRs |
29| Minor / quick fixes | GitHub Issues | Typos, trivial compiler warnings, etc. |
30
31**JIRA integration with GitHub**: Including a JIRA ticket identifier at the start of a PR title automatically creates a link from JIRA to the PR.
32
33- PR title format: `THRIFT-9999: Short description of the change`
34- Commit message format (required for code changes):
35 ```
36 THRIFT-9999: Short description of the change
37 Client: cpp,py,java (comma-separated list of affected languages)
38 ```
39
40Example: [THRIFT-5929](https://issues.apache.org/jira/projects/THRIFT/issues/THRIFT-5929) → [PR #3350](https://github.com/apache/thrift/pull/3350).
41
42---
43
44## 3. Pull Request Requirements
45
46Follow [`CONTRIBUTING.md`](CONTRIBUTING.md) in full. Key points:
47
48- One commit per issue (squash before submitting).
49- All significant changes need a JIRA ticket.
50- Provide tests for every submitted change.
51- Verify coding standards: `make style`.
52- Branch name convention: use the JIRA ticket ID, e.g. `THRIFT-9999`.
53- PRs go from your fork branch `apache:master`.
54
55---
56
57## 4. AI-Generated Contributions
58
59Per [`CONTRIBUTING.md § AI generated content`](CONTRIBUTING.md#ai-generated-content) and the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html):
60
61- **Always** label AI-assisted commits and PRs. Use one or both of:
62 ```
63 Co-Authored-By: <AI tool name and version>
64 Generated-by: <AI tool name and version>
65 ```
66 Example:
67 ```
68 THRIFT-9999: Fix connection timeout handling in Go client
69 Client: go
70
71 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 ```
73- Apply this label even when AI only generated a portion of the change.
74- The human author remains responsible for reviewing, testing, and standing behind all submitted code.
75
76---
77
78## 5. Language-Specific Rules (`/lib`, `/test`, `/tutorial`)
79
80- This file remains valid in all cases and must be used in addition to any additional language-specific rules.
81- If a target-language directory under `/lib/<lang>/` contains its own `CLAUDE.md` or `AGENTS.md`, those rules apply to all work in that language directory.
82- Those language-specific rules extend **by implication** to the corresponding language code under `/test/` and `/tutorial/`.
83- If `/test/` or `/tutorial/` themselves contain a `CLAUDE.md`/`AGENTS.md` for a given language, **combine** the rules: the file **closer to the code** (i.e., in the same directory) takes precedence on any conflict.
84
85---
86
87## 6. Quick Reference Checklist (before opening a PR)
88
89- [ ] License of any new dependency checked against [ASF Category A/X list](https://www.apache.org/legal/resolved.html)
90- [ ] `LICENSE` and/or `NOTICE` updated if third-party attribution is required
91- [ ] JIRA ticket exists (unless truly trivial)
92- [ ] PR title starts with `THRIFT-NNNN:` (if ticket exists)
93- [ ] Commit message includes affected `Client:` languages
94- [ ] Single squashed commit
95- [ ] Tests added or updated
96- [ ] `make style` passes
97- [ ] AI authorship labelled with `Co-Authored-By:` / `Generated-by:` where applicable