|
1 | | -# Developing sdk-java |
| 1 | +# Contributing to Temporal SDKs |
2 | 2 |
|
3 | | -This doc is intended for contributors to `sdk-java` (hopefully that's you!) |
| 3 | +Thanks for your interest in contributing to Temporal SDKs. |
4 | 4 |
|
5 | | -**Note:** All contributors also need to fill out the |
6 | | -[Temporal Contributor License Agreement](https://gist.github.com/samarabbas/7dcd41eb1d847e12263cc961ccfdb197) |
7 | | -before we can merge in any of your changes |
| 5 | +This guide describes expectations that apply across Temporal SDK repositories. Each |
| 6 | +repository may have additional local conventions, but the guidance below should help |
| 7 | +you open issues and pull requests that maintainers can evaluate efficiently. |
8 | 8 |
|
9 | | -## Development Environment |
| 9 | +## Before You Open an Issue |
10 | 10 |
|
11 | | -- **Java 21+** is required to run Gradle, compile the project, and run all tests locally. |
12 | | -- Some optional tests also require the [Temporal CLI](https://docs.temporal.io/cli#installation). |
| 11 | +Search the existing issues first. If you find an issue that describes the same bug, |
| 12 | +feature request, or design topic, add any relevant details there instead of opening a |
| 13 | +duplicate. Use an upvote on the issue to show that it affects you too. |
13 | 14 |
|
14 | | -If you're using Apple Silicon, see the [note on Rosetta](#note-on-rosetta). |
| 15 | +Issues are assigned to people when they are actively working on them. Before taking |
| 16 | +on an issue, check whether it is already assigned so you do not duplicate someone |
| 17 | +else's work. |
15 | 18 |
|
| 19 | +Use GitHub issues for actionable bugs and feature work. For usage questions, help |
| 20 | +debugging an application, or general discussion, join the relevant |
| 21 | +language-specific channel in the |
| 22 | +[Temporal community Slack](https://temporal.io/slack) or use the support channel |
| 23 | +available to you. |
16 | 24 |
|
17 | | -## Build |
| 25 | +## Bug Reports |
18 | 26 |
|
19 | | -``` |
20 | | -./gradlew clean build |
21 | | -``` |
| 27 | +When reporting a bug, include enough detail for someone else to reproduce or |
| 28 | +understand the problem: |
22 | 29 |
|
23 | | -## Code Formatting |
| 30 | +* A short summary of the problem. |
| 31 | +* A minimal reproduction, preferably as code that can be copied into a small |
| 32 | + project or test. |
| 33 | +* What you expected to happen and what actually happened. |
| 34 | +* The SDK version. |
| 35 | +* The language runtime version. |
| 36 | +* The operating system and architecture. |
| 37 | +* Temporal Server or Temporal Cloud details, if the issue depends on service |
| 38 | + behavior. |
| 39 | +* Logs, stack traces, workflow histories, or other diagnostics that show the |
| 40 | + failure. |
| 41 | +* Whether the behavior is a regression, and the last version where it worked if |
| 42 | + known. |
24 | 43 |
|
25 | | -Code autoformatting is applied automatically during a full gradle build. Build the project before submitting a PR. |
26 | | -Code is formatted using `spotless` plugin with `google-java-format` tool. |
| 44 | +## Feature Requests and Design Changes |
27 | 45 |
|
28 | | -## Commit Messages |
| 46 | +Open or join a GitHub issue before starting substantial feature work, behavior |
| 47 | +changes, or API design changes. This gives maintainers and other SDK users a chance |
| 48 | +to discuss the approach before you invest in a larger implementation. |
29 | 49 |
|
30 | | -Overcommit adds some requirements to your commit messages. We follow the |
31 | | -[Chris Beams](http://chris.beams.io/posts/git-commit/) guide to writing git |
32 | | -commit messages. Read it, follow it, learn it, love it. |
| 50 | +The relevant language-specific channel in Temporal community Slack is also a good |
| 51 | +place for early discussion, but important decisions should still be captured in a |
| 52 | +GitHub issue so they are visible and searchable. |
33 | 53 |
|
34 | | -## Running features tests in CI |
| 54 | +Small bug fixes, documentation fixes, and narrowly scoped maintenance changes can go |
| 55 | +straight to a pull request. |
35 | 56 |
|
36 | | -For each PR we run the java tests from the [features repo](https://github.com/temporalio/features/). This requires |
37 | | -your branch to have tags. Without tags, the features tests in CI will fail with a message like |
| 57 | +## Pull Requests |
38 | 58 |
|
39 | | -``` |
40 | | -> Configure project :sdk-java |
41 | | -fatal: No names found, cannot describe anything. |
42 | | -``` |
| 59 | +Good pull requests are focused and easy to review: |
43 | 60 |
|
44 | | -This can be done resolved by running `git fetch --tags` on your branch. Note, make sure your fork has tags copied from |
45 | | -the main repo. |
| 61 | +* Keep each pull request scoped to one logical change. |
| 62 | +* Include tests for behavior changes. |
| 63 | +* Update public API documentation or doc comments when public behavior changes. |
| 64 | +* Add a high-level changelog entry for user-facing changes according to the |
| 65 | + repository's local changelog convention. |
| 66 | +* Describe what changed, why it changed, and what validation you ran. |
46 | 67 |
|
47 | | -## Testing |
| 68 | +Run the relevant local checks when practical. CI must pass before a pull request can |
| 69 | +be merged. |
48 | 70 |
|
49 | | -Run tests: |
| 71 | +## Things to Avoid |
50 | 72 |
|
51 | | -```bash |
52 | | -./gradlew test |
53 | | -``` |
| 73 | +Avoid changes that make review harder without improving the contribution: |
54 | 74 |
|
55 | | -Run a single test or group of tests: |
| 75 | +* Unrelated refactors mixed into a behavior change. |
| 76 | +* Style-only churn. |
| 77 | +* Large feature pull requests that were not discussed first. |
| 78 | +* License, copyright, or other legal changes without maintainer discussion. |
56 | 79 |
|
57 | | -```bash |
58 | | -./gradlew :temporal-sdk:test --offline --tests "io.temporal.activity.ActivityPauseTest" |
59 | | -./gradlew :temporal-sdk:test --offline --tests "io.temporal.workflow.*" |
60 | | -``` |
| 80 | +## AI-Generated Contributions |
61 | 81 |
|
62 | | -By default, integration tests run against the built-in time-skipping test server. Some tests require features that the built-in server doesn't support; those tests will be skipped. To run the skipped tests: |
| 82 | +Using AI tools while contributing is acceptable. You are responsible for the |
| 83 | +correctness, quality, and maintainability of everything you submit. |
63 | 84 |
|
64 | | -1. Install the [temporal CLI](https://docs.temporal.io/cli#installation), which comes with a built-in dev server. |
65 | | -2. Find the flags that the dev server will need to run the tests by grepping for `temporal server` in [./github/workflows/ci.yml](./github/workflows/ci.yml). |
66 | | -3. Start the server: |
67 | | -```bash |
68 | | -temporal server start-dev --YOUR-FLAGS-HERE |
69 | | -``` |
70 | | -4. Set the `USE_EXTERNAL_SERVICE` environment variable and run the tests: |
71 | | -```bash |
72 | | -USE_EXTERNAL_SERVICE=true ./gradlew test |
73 | | -``` |
| 85 | +Thoroughly self-review AI-generated code and documentation before opening a pull |
| 86 | +request. Make sure it is correct, tested where appropriate, and consistent with the |
| 87 | +style and patterns of the codebase. |
74 | 88 |
|
75 | | -## Note on Rosetta |
| 89 | +Keep AI-assisted changes concise and scoped. Avoid verbose generated prose, |
| 90 | +unnecessary comments, or broad rewrites that make the change harder to review. |
76 | 91 |
|
77 | | -Newer Apple Silicon macs do not ship with Rosetta by default, and the version of `protoc-gen-rpc-java` we use (1.34.1) does not ship Apple Silicon binaries. |
| 92 | +## Contributor License Agreement |
78 | 93 |
|
79 | | -So Gradle is set to hardcode the download of the x86_64 binaries on MacOS, but this depends on Rosetta to function. Make sure Rosetta is installed with |
| 94 | +All contributors must complete the Temporal Contributor License Agreement (CLA) |
| 95 | +before changes can be merged. A link to the CLA will be posted in the pull request. |
80 | 96 |
|
81 | | -```bash |
82 | | -/usr/bin/pgrep oahd |
83 | | -``` |
| 97 | +## Security Issues |
84 | 98 |
|
85 | | -which should return a PID of the Rosetta process. If it doesn't, you'll need to run |
| 99 | +Do not open public GitHub issues for suspected security vulnerabilities. Report them |
| 100 | +to security@temporal.io instead. |
86 | 101 |
|
87 | | -```bash |
88 | | -softwareupdate --install-rosetta |
89 | | -``` |
| 102 | +## Review and CI |
90 | 103 |
|
91 | | -for builds to complete successfully. |
| 104 | +Maintainers review pull requests for correctness, compatibility, test coverage, |
| 105 | +documentation, and long-term maintainability. Review may require changes before a |
| 106 | +pull request can be merged, and it may take maintainers some time to review a |
| 107 | +contribution. |
| 108 | + |
| 109 | +CI is the final validation gate. If CI fails, update the pull request or ask for help |
| 110 | +if the failure appears unrelated to your change. Some CI gates may wait for a |
| 111 | +maintainer to approve or run them. |
| 112 | + |
| 113 | +## Inactive Pull Requests |
| 114 | + |
| 115 | +Maintainers may close inactive pull requests after follow-up if they are no longer |
| 116 | +moving forward. If that happens, you are welcome to reopen the pull request or open a |
| 117 | +new one when you are ready to continue. |
| 118 | + |
| 119 | +## Community Conduct |
| 120 | + |
| 121 | +Keep discussions respectful, constructive, and focused on the work. Clear context, |
| 122 | +specific examples, and patience with review feedback help everyone move faster. |
0 commit comments