|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +Guidance for coding agents working in this repository. The design itself (write and read |
| 4 | +paths, buffer ownership, map keys, the parser's accessor contract) is in `docs/DESIGN.md`; |
| 5 | +read it before changing the generator, parser, writer or reader. |
| 6 | + |
| 7 | +## Project |
| 8 | + |
| 9 | +A Jackson 3 dataformat for MessagePack, `org.komamitsu:jackson-dataformat-msgpack`, with its |
| 10 | +own MessagePack encoder and decoder. msgpack-core is a test dependency only, used as the |
| 11 | +reference implementation in tests. |
| 12 | + |
| 13 | +## Commands |
| 14 | + |
| 15 | +```bash |
| 16 | +./gradlew clean build # Compile, checkstyle, all tests (Java 17 toolchain) |
| 17 | +./gradlew build -PtestJavaVersion=21 # Run the tests on another JDK, as CI does for 17, 21 and 24 |
| 18 | +./gradlew soakTest -Psoak.seconds=120 # Memory-growth soak tests, excluded from the normal build |
| 19 | +./gradlew :jmh:jmhJar # Build the benchmark jar |
| 20 | +``` |
| 21 | + |
| 22 | +Tests run with `-Dfile.encoding=windows-1252`, so a conversion that forgets to name a charset |
| 23 | +fails in the tests. |
| 24 | + |
| 25 | +## Rules |
| 26 | + |
| 27 | +- **Round-trip safety comes first.** Whatever this library writes, it must be able to read |
| 28 | + back. A type that cannot round-trip is refused on write rather than written in a form that |
| 29 | + fails on read (see `UnreadableKeyGuard` and DESIGN.md 2.6). |
| 30 | +- **Compatibility with the Jackson 2 module (`msgpack-jackson` in msgpack-java) is not a |
| 31 | + goal.** Do not keep or add behaviour only because that module had it. |
| 32 | +- **Output after a serialization failure is the caller's to discard.** Do not add rollback or |
| 33 | + cleanup machinery for callers that catch the exception and keep using the generator. |
| 34 | +- **Bug fixes come with a test that fails without the fix.** Assert exact values and bytes, |
| 35 | + not only types or non-null. |
| 36 | +- **Benchmark changes to a hot path before pushing.** Build the change and `main` and run them |
| 37 | + back to back: |
| 38 | + `java -jar jmh/build/libs/jmh-jmh.jar <Benchmark> -f 5 -wi 5 -w 1 -i 10 -r 2`, adding |
| 39 | + `--add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED` |
| 40 | + through `-jvmArgs`. Measure with a reused mapper; a benchmark that creates a mapper per |
| 41 | + operation measures nothing users see. Numbers from different days are not comparable on |
| 42 | + this machine, and a short run is not enough to call a change free. |
| 43 | +- **Record meaningful results in `jmh/results/`**, one file per change, with the command, the |
| 44 | + compared commits and the JSON control. |
| 45 | +- **Reviews** go through GitHub Copilot, requested with |
| 46 | + `gh api -X POST repos/komamitsu/jackson-dataformat-msgpack/pulls/<n>/requested_reviewers -f "reviewers[]=copilot-pull-request-reviewer[bot]"`. |
| 47 | + Check each finding against the code, with a test where it makes a claim about behaviour, |
| 48 | + before fixing or declining it. |
0 commit comments