Deep Charter's engineering conventions - code layout per feature, the M2 rules (attachments, versioning, PodEvents, mixins), test and evidence-scenario rules, the toolchain commands, and the merge gate. Load before writing, reviewing or simplifying code, tests, evidence scenarios or tools in this repo, and before merging a PR.
Resources
4Install
npx skillscat add pkeppeler/deepcharter/deepcharter-conventions Install via the SkillsCat registry.
Deep Charter conventions
Code lives under io.github.pkeppeler.deepcharter. Detail beyond this file:
- tests.md: GameTest and client GameTest rules, stubs, helpers.
- m2-rules.md: the M2 rules (attachments, versioning,
PodEvents, mixins). - merging.md:
tools/merge-queue.shbehaviour, cleanup and lock. - evidence.md: PR evidence scenarios, recording, before and after stills,
diff-stillsblind spots.
Agent Toolchain
- Build, with the server GameTest and all gates:
./gradlew build just check(./gradlew check, a subset of./gradlew build);just audit(osv-scanner; needs it on PATH).audit.ymlruns it weekly and on PRs touching dependency files; a lapsedignoreUntilor a new advisory fails the weekly run.- Formatting: palantir-java-format via Spotless owns all Java formatting (4-space indent, 120 columns);
spotlessCheckis part ofcheck. Runjust fmt(./gradlew spotlessApply) before handing work back. Spotless wraps a//comment past 120 columns mid-sentence and leaves the last word alone on a line;checkOrphanCommentGate(part ofcheck, #1052) fails on it and names the line: reflow the comment to 120 columns. The Kotlin DSL files stay tab-indented and unformatted. - Fast test command (server GameTests):
./gradlew runGameTest - A change to
gradle/*.kts,build.gradle.ktsorsettings.gradle.ktsruns./gradlew check -x runGameTesttwice with the configuration cache on (no--no-configuration-cache: the first run stores the entry, the second reuses it), because CI uses it and a task action that captures a script-levelvalfails only there. The pre-push hook's compile step already runs with it on. - One server GameTest, or a prefix:
tools/gametest.sh '<test_id or prefix*>' - Server suite in reverse name order (leak check):
./gradlew runGameTest -PgametestOrder=reverse - One server shard as CI runs it:
./gradlew runGameTest -PgametestShard=<i>/<BUILD_SHARDS>(weights ingradle/server-test-weights.txt; tests.md). It composes with-PgametestOrder=reverse. - One client test class:
tools/gametest.sh --client <filter>or./gradlew runClientGameTest -PclientTests=<filter> - Whole client suite (opens a window; the Mac runs at most two clients):
./gradlew runClientGameTest - Client tests and evidence scenarios in a cloud container (no display; the Mac rules above still apply): once per container
apt-get install -y libegl1 libegl-mesa0, thenSDL_VIDEO_DRIVER=offscreen LIBGL_ALWAYS_SOFTWARE=1 ALSOFT_DRIVERS=null ./gradlew runClientGameTest -x deleteGameTestRunDir -PclientTests=<Class>.-x deleteGameTestRunDirkeeps the run dir and logs. For an evidence scenario, put the same three variables beforetools/record-evidence.sh <scenario>(it setsDEEPCHARTER_EVIDENCE, without which a scenario does nothing, and builds the GIF with ffmpeg). Noxvfb. Frame times mean nothing on the software renderer: assert behaviour, not speed. One client at a time, never alongside a server GameTest run (#1225). - Record PR evidence:
tools/record-evidence.sh <scenario> - Compare stills:
tools/diff-stills <before> <after> --out <dir>(--design-tourfor the tour) - Python: run every tool, test and one-off script through
tools/py <args>, never a barepython3: on this Mac that can be the system 3.9, and the tools need 3.10+..python-versionpins the version for the hook, CI and agents;tools/pyneedsuvonPATHand never downloads an interpreter (UV_PYTHON_DOWNLOADS=never), and its failure message says what to install (#710). A shell test stubsuv, notpython3. A tool's#!/usr/bin/env python3line stays: run the tool throughtools/py, not as./tool. - Every push goes through
.githooks/pre-push(the SessionStart hook enables it); never--no-verifyexcept in the cases pre-push-hook.md lists. What it runs, its budget and its failure messages are there. - Gates:
tools/shellcheck.sh,tools/py -m unittest discover -s tools/tests -p 'test_*.py'(it includestest_docs.py: nodocs/**/*.mdfile repeats a heading of the same level under the same parent headings, which catches a section pasted twice, and that no relative markdown link inREADME.md,docs/**or.claude/**points at a missing file, which catches a rename that left a link behind (skipped: URLs, which cover thepr-medialinks; pure anchors; and the never-committedoriginal_flash_game/andprivate/), and that the versionsREADME.mdanddocs/PLAYING.mdquote match the build (the failure says how to mark an intended other version); andtest_unused_check.py, which fails the tree on an unused import, module-level name, function parameter, default no caller overrides, or parameter every caller passes the same literal intools/**/*.pyandtools/diff-stills), andtools/py tools/tests/gate_checks.py(the gate fixture checks; its name does not matchtest_*.py, so discover skips it)..githooks/pre-pushruns them on push, except that a push whose range changes no Gradle input skipsgate_checks.pyand the Gradle checks (pre-push-hook.md); CI runs everything. In CI (Python and uv from.github/actions/setup-python-uv, the version from.python-version), thetool-tests-part <i>jobs run the unit tests, the shell tests, shellcheck andgate_checks.pyin parallel (tools/ci-tool-tests.sh,tools/ci_tool_parts.pysplits bytools/tests/ci-tool-test-weights.txt) andtool-testsis their aggregate; thebuild-checksjob runs the rest of./gradlew build,build-shard <i>jobs run the server GameTests from thecompilejob's output, and thebuildcheck is the aggregate of all three (merging.md). A change to any shell tool also runs every shell test, as CI'stool-testsjob does:for t in tools/tests/*.test.sh; do bash "$t" || echo "FAILED $t"; done(it includes the repo-wide lints such asno-pipe-grep-q). - Dependency bump (a version in
gradle/libs.versions.toml, a new Fabric API module): regenerate the locks andgradle/verification-metadata.xmlwith./gradlew --write-locks --write-verification-metadata sha256 --warning-mode=summary --refresh-dependencies build, and commitgradle.lockfile,buildscript-gradle.lockfile,settings-gradle.lockfileand the metadata.--refresh-dependenciesis needed so CI's empty Gradle home passes verification. A Renovate PR (renovate[bot], machine data) cannot regenerate the metadata, and the merge gate refuses itsrenovate/*branch: carry its commits to a replacement PR, run this command there, then the full pipeline (#757 did this for #728). Never hand-edit a checksum. Regenerating adds entries but never prunes old ones; leave stale entries (Gradle verifies only what it resolves), except one whose version the audit flags (it scans this file): prune that, and prove with a cold-cache build (emptyGRADLE_USER_HOME) that nothing still resolves it. After regenerating,git diff gradle/verification-metadata.xmlmust remove nonatives-linuxorepollentry; if one vanishes, restore it or regenerate in a Linux container (docker run --platform linux/amd64 eclipse-temurin:25-jdk, empty Gradle home). Keep thetrusted-artifactsblock (Loom'snet.minecraft:minecraft-{merged,common,clientOnly}-*jars differ per machine). If CI on Linux fails with "not part of the dependency lock state" for a module, add it todependencyLocking { ignoredDependencies }inbuild.gradle.kts(Minecraft's OS-specific libraries). A new Fabric API module also needs adding to the first[[PackageOverrides]]entry inosv-scanner.toml, or the license audit fails; a GeckoLib bump is a new audit (geckolib-audit.md) and updatesgeckolibSha512. Audit command:osv-scanner scan source --config=osv-scanner.toml --lockfile=gradle.lockfile --lockfile=buildscript-gradle.lockfile --lockfile=gradle/verification-metadata.xml --licenses=MIT,Apache-2.0,BSD-2-Clause,BSD-3-Clause,ISC,0BSD,BlueOak-1.0.0,CC0-1.0,Unlicense,EPL-1.0,EPL-2.0. - A workflow or action that uses
setup-gradlemakes its first Gradle call, the dependency-resolving one, throughtools/ci-gradle-resolve.sh;tools/tests/ci-gradle-resolve-gate.test.shfails a file that never names it or calls./gradlewbefore it. The script retries a broken restored cache once (#830) and a repository that fails to answer (a plugin or module "not found", an HTTP 429 or 5xx, a timeout) with backoff (#1358); any other failure fails at once. The later Gradle calls in the job find the dependency classpaths resolved; Loom's natives, and whatever onlyrunClientGameTestpulls, are not covered; Minecraft's asset objects have their own cache entry, which.github/actions/loom-assetsrestores and onlycache-seed.ymlsaves, and a caller that namesdownloadAssetsgets the same retries (#1703). On GitHub Actions only, the script first installsgradle/ci-central-mirror.init.gradle.ktsinto the runner's Gradle home, so every Gradle call in the job resolves Maven Central from Google's mirror of it (ADR 0101); local builds are untouched, and verification and the locks stay as they are. - Conflict markers (#490):
tools/tests/conflict_markers.pyfails on a<<<<<<<,|||||||or>>>>>>>line at line start in any tracked text file, and on a bare=======between such markers. The pre-push hook runs it first, andtest_conflict_markers.pyruns it in CItool-tests. Its tests build markers from repeated characters, so there is no exclusion list; a fixture needing a marker does the same. - Comment length (#1222):
tools/comment_length_gate.pyfails a comment line (Javadoc, block,//, trailing too) that a branch adds tosrc/**/*.javaover 120 columns; palantir never reflows comments. It readsgit diff -U0from the merge base withorigin/main: untouched lines, code lines and a one-token comment (a URL, an@seeor{@link}target) pass. CI runs it intool-testsaftermerge-main, the pre-push hook with--fetch; a missingorigin/mainor merge base fails loudly. Temporary: #1223 rewraps the existing lines and makes it a whole-tree rule, which deletes the diff logic. - A tool that deletes or writes from external data (an index, lock or log) resolves each path and checks it lies under its root before any unlink or write, and a test plants the escape in the stored copy, not only in the new input.
- Loot tables:
tools/tests/test_loot_table_format.py(run by unittest discover) fails on a pre-26.3conditionsorfunctionskey in anyloot_table/**/*.json, because 26.3 ignores them silently; writecondition(one object withtype) andmodifier.LootTableDropsTestrolls every shipped table. - Sound credits (
CREDITS.md,tools/sounds/*.json): a source's credit and manifestlicensestate only what the file's tag or its page says; an unstated licence isnone stated. - After
gradle wrapperregeneratesgradlew(a Renovate wrapper update too), runtools/gradlew-registry-block.shto re-add its #1120 block (the per-checkout daemon registry);tools/tests/gradle-worktree-isolation.test.shgoes red without it. - Keep Error Prone's
--add-exports/--add-opensflags inorg.gradle.jvmargs(gradle.properties): they make javac run in the daemon instead of a forked worker per worktree (#632). - Enum switches (#1217): name every constant, so a new enum member fails the build at each switch that forgot it. Error Prone's
MissingCasesInEnumSwitch(no default) andUnnecessaryDefaultInEnumSwitch(every constant named, then a dead default) are ERROR, andcheckEnumSwitchGate, part ofcheck, fails a statement or expression switch over an enum whosedefaulthides a constant, unless it carries// enum-default: <reason>.-PenumSwitchListlists every enum switch with a default; the limits are intools/EnumSwitchGate.java. - Keybinds (#1556):
checkKeybindGate, part ofcheck, fails anew KeyMapping(insrc/mainorsrc/clientwhose id has no line ingradle/keybind-allowlist.txt(key.deepcharter.<id> <why no vanilla key or click fits>), akey.deepcharter.*lang key with no line, and a line no key uses. The reason is three words or more and not judged: read it, and reject one that does not say why a vanilla key or a click fails. The limits are ingradle/keybind-gate.gradle.kts; designing-mechanics says to prefer vanilla keys and clicks first. Two of the mod's keys never share a default key:HandbookControlsClientTestfails a clash unless the pair is in itsSHARED_DEFAULTSwith why the two never act in the same place (#1712); check everyInputConstants.KEY_default undersrc/clientbefore you pick one. - Action bar (#1769): the vanilla action bar draws one centred, unwrapped line, so every line the mod sends there fits 316 GUI pixels (the 320-wide narrowest GUI less the backdrop) with its widest real arguments, cause and fix both kept.
ActionBarFitClientTestmeasures each line insrc/gametest/resources/action-bar-lines.txtwith the game's font and lists every one over;tools/tests/test_action_bar_lines.pykeeps that list equal to the sends insrc/mainandsrc/client(the overlay forms:sendOverlayMessage,::sendOverlayMessage,setOverlayMessage,displayClientMessage(..., true),sendSystemMessage(..., true)): a literaltranslatable("<key>"counts, and a send whose line arrives through a variable, an enum or a built key carries// action-bar: <key or prefix.*>...naming every key that can reach it (not judged: check it). Shorten a line first; one that cannot keep its cause and fix in the bar goes to chat instead (sendSystemMessage(line), or(line, false)), asmessage.deepcharter.pod.not_crewdoes: a 32-letter charter name never fits. - Suppressions: before suppressing a deprecation or disabling an Error Prone check, look for a non-deprecated replacement, and give a reason that can be checked against the 26.3 jar.
// colour-ok: <reason>(colour gate),// input-literal: <reason>(input literal gate:.button()or.key()compared with a number or char literal, ornew MouseButtonInfo(ornew KeyEvent(with a number or char literal first, insrc/client/javaandsrc/gametest/java; SDL numbers mouse buttons from 1, so useInputConstants.MOUSE_BUTTON_*andKEY_*; a line scan, so aswitchor a number passed through a variable is not seen),// vanilla-ok: <reason>(vanilla sound gate, #1557: a reference insrc/mainorsrc/clientJava to a sound ongradle/banned-vanilla-sounds.txt, such asSoundEvents.GENERIC_EXPLODE,Musics.*or a.explode(call, or aminecraft:music.*,minecraft:ambient.*or explosion sound id in a JSON file undersrc/main/resources(sounds.json, a dimension type, a biome), breaks the tone (#1293, #1296); use aDeepSoundor make one intools/sounds. Mark only a Java line that must keep the vanilla sound; a JSON id that must stay is listed with a reason ingradle/vanilla-sound-allowlist.txt(<path> <id> <reason>). Ban another sound by adding a line to the list; the limits are ingradle/vanilla-sound-gate.gradle.kts),// tick-wait: <reason>(tick-wait gate),// one-shot-ok: <reason>(one-shot gate: a throw after a poll's flag set that only forces one more poll, never a check that should fail the test; tests.md),// sync-load: <reason>(sync-load gate: agetChunk(orgetChunkAt(in asrc/gametestserver test or its support, outsidetest/evidence, loads on the server thread and stalls every test in the batch; wait withFarChunks.whenBlocksLoadedorawaitEntityTicking, or mark a load that must happen in one tick or of a chunk that is already loaded;getChunk(..., false)does not load and needs none; tests.md),// force-ok: <reason>(force-chunk gate: a chunk forced or released outsideFarChunksis missing from its count; only for a case with noGameTestHelper, such as a client test or an evidence scenario),// light-wait-ok: <reason>(light-wait gate: a block-light read in a server GameTest waits underFarChunks.Deadline, never insidethenWaitUntilorsucceedWhenor in a method with no deadline; the marker is for a read that is not a wait, such as an assertion after a deadline-based wait),// arrived-ok: <reason>(arrived gate: a player's teleport and a lateraddFreshEntityorstartRidinggo in two server blocks of a client test, evidence class or test helper, withClientWait.arrivedbetween them; only for a teleport that leaves no chunk cold; tests.md),// await-ok: <reason>(await-then-expect gate: only for an assertion afterDeadline.awaitthat is meant to run, such as athrowthat forces another poll after an await on a constantfalse),// await-ok: <reason>(await-then-expect gate: only for an assertion afterDeadline.awaitthat is meant to run, such as athrowthat forces another poll after an await on a constantfalse),// world-clock: <reason>(world-clock gate),// hud-toggle: <reason>(HUD-toggle gate),// keep-clear-ok: <reason>(keep-clear gate: asrc/client/javafile that adds, attaches or replaces a HUD element withHudElementRegistryregisters what it draws withHudKeepClear.register, one rect function shared by its draw and itskeepClear, or marks why there is nothing to keep clear of; the step popup places itself by that list),// entity-query: <reason>(entity-query gate),// class-ok: <reason>(record-holder gate: a private or package-private static nested class that only holds final values set from its constructor must be a record; the marker goes on the class line or the contiguous//lines above it, for a class that relies on identity or must stay one),// light-settled-ok: <reason>(light-settled gate: a pod seat or move after a RoomCarver carve in one client method, where the carve cannot affect the rider; tests.md),// test-seam: <reason>(test-only gate: only for a deliberate, permanent seam),// const-param: <reason>(constant-parameter gate,checkConstantParams: a parameter everysrc/mainandsrc/clientcaller passes the same literal or enum constant,src/gametestcallers not counted; inline it and drop the parameter, or mark a deliberate seam with a reason of two or more words that is not a stock phrase; before dropping a parameter, read the method body: a parameter that shadowed a field or a constant changes the body's meaning once it is gone),// enum-default: <reason>(enum-switch gate: adefaultin a switch over an enum that leaves constants unnamed; only where the other constants really share one outcome or the default is the loud refusal of a member that cannot reach it, and the reason names why, not "the rest"),// fixed-pos: <reason>(fixed-position gate: a literal world Y in an evidence scenario, only where the place cannot come from an anchor, a carved room, the layer's geometry or the decay tuning),// level-height: <reason>(fixed-position gate: a raw level-height read insrc/gametestthat is about the level, not a layer; tests.md),// seats-pod: <reason>(light-settled gate: a helper in another class that seats or moves a pod; the gate countsClass.helper(...)as a seat and fails an unmarked one; tests.md),# unused-ok: <reason>(Python unused-code gate; a_-prefixed parameter is exempt), and aNOISE_FAMILIESentry intools/diff-stills(blind spots in evidence.md). A marker may sit anywhere in a wrapped statement or the contiguous//lines above it (markedNearingradle/literals.gradle.kts,markerForintools/TestOnlyGate.java). The gates do not judge the reason, exceptunused-ok, which rejects a one-word or stock reason: a speed bump, not a judge, so read every reason. Reject an empty or generic reason, and any newNOISE_FAMILIESprefix without measured noise behind it. A temporary gate exemption needs an open issue that deletes it; a code comment alone is not tracking. - A worldgen feature that places a vanilla block not named in its config exposes it to ObtainableItemsTest's derivation; the test fails on a deepcharter feature type it neither encodes nor knows.
- Craftability (#1603): ObtainableItemsTest's walk also fails an item of ours with no source (a drop, a terminal sale or hand-out in
codeSources(), or a recipe from what the world yields) unlessUNOBTAINABLEnames it with why, and fails an ingredient of a recipe of ours, a handbook step's target or the restore catalyst that the walk never reaches. A new item gets a source, a recipe or an entry in the same PR. - Feature map (#510): the game's graph lives in
docs/feature-map/map.json; a gameplay PR updates it in the same PR (tools/py tools/feature_map.pyvalidates it; the outputs are generated, never committed, ADR 0054) or saysNo map change: <reason>in its body, whichtools/merge-pr.shchecks. Reviewers check the map was updated and its statuses are true. Rules, schema and publishing: the feature-map skill. - Merge: in batches (the rule is in
.claude/CLAUDE.md);tools/merge-pr.sh --solo <reason> <n>(a batch of one: a PR push runs only the GameTest classes its change can affect, and landing needs the full suites a batch PR runs, ADR 0116); two or more PRs:tools/merge-batch.sh <n>...; one at a time:tools/merge-queue.sh <n>.... Read-only verdict, for reviewers:tools/merge-pr.sh --check <n>(notgh pr checks). Nevergh pr mergeor a rawPUT .../merge. The merge, handoff and SessionStart tools use REST (gh api repos/...) only, nevergh pr,gh issueor GraphQL (the cloud proxy blocks it;tools/tests/no-gh-graphql.test.shenforces it). A PR that changes gate code runstools/gate-sweep.sh <pr>before cycle 2 and carries aGate sweep (<sha>):body line the merge gate checks. A PR that changes a worldgen path (tools/cost-paths.txt) runstools/cost-pair.shat its last head and carries theCost pair (<sha>):body line it prints, which the merge gate checks too (tests.md, ADR 0124). Detail in merging.md. - Integration branch:
main. Squash merge. - Machine (16 GB, 8 cores): at most 5 Gradle-heavy agents (pre-push hooks were SIGKILLed at 5-6 of them). Never
./gradlew --stop(it kills every agent's daemon),pkill javabroadly or startcaffeinate(the user runs it); signal only processes you started, by PID; never touch~/.cache/deepcharter/. Never force-push. - Agents running Gradle use
$(git rev-parse --git-common-dir)/gradle-slot.lock(orDEEPCHARTER_GRADLE_LOCK) instead of any per-session lock path, so they share one slot with the pre-push hook:flock -o "${DEEPCHARTER_GRADLE_LOCK:-$(git rev-parse --git-common-dir)/gradle-slot.lock}" ./gradlew ...(skipflockwhere it is missing). Never push while holding the Gradle lock; the pre-push hook takes the same lock. - Blame:
git config blame.ignoreRevsFile .git-blame-ignore-revs(once per clone; worktrees share it). - A rule stated in
.claude/CLAUDE.mdis not repeated here; point to it. - A migration's reason lives in one place, the lib header or the test that guards it, not in a comment in each caller.
- Audit pages (
docs/tooling/*-audit.md): state the method once and each condition once (the two #641 pages repeated them). - Vendored tools under
tooling/: their dependencies change only with a new audit, sorenovate.jsonignores them; itsignorePathsreplaces Renovate's:ignoreModulesAndTestslist (it does not merge), so that list is restated besidetooling/**. - Git, for agents that edit (implementer, simplifier): work only in the worktree the brief names, never the main checkout. No agent, reviewers included, runs
git checkout,switchorresetin the main checkout. Commit as you go (a WIP commit is fine). Push the branch (git push -u origin <branch>) after the first commit and again before you report; on the first push, open a draft PR whose body saysCloses #<issue>. Never pushmain, merge, or runtools/mark-review-passed.sh: those are the orchestrator's. Why: nothing in flight may live only on this Mac, and a restart once left 26 uncommitted files on #482. - If Bash refuses a heredoc, loop, long chain or path containing
gitas unverifiable, run it from a script file in your own scratch subdirectory. - A brief that repeats runs until a target is met sets an iteration cap (for example 3 run pairs); at the cap, stop and report what is left.
- Client slots: on macOS at most two game clients run at a time (
DEEPCHARTER_CLIENT_SLOTS, default 2); a run that finds both taken waits. Details, and what to do after a Ctrl-C, in tests.md. - On macOS, client GameTests,
tools/record-evidence.shandtools/play.shrender with Vulkan (MoltenVK), so they run with the screen locked.DEEPCHARTER_GL=1uses OpenGL instead (for example for Iris shaders). - Client tests are slow and open a window: run them only for the class you changed, plus every class that reads shared visuals you touched (tests.md). CI runs the full set when a PR changes game code (CLAUDE.md).
Code layout
Code is grouped by feature under io.github.pkeppeler.deepcharter. The features are layer pod scanner and the M2 set charter terminal colony ore handbook transmission wreck fuel market upgrade repair hangar sound surface creature suit continuity. The client mirrors each one under client/<feature>/ (colony has only a client mixin and its refusal screen, client/colony/). A feature has:
XInit.init(), called once fromDeepCharter(XClientInit.init()fromDeepCharterClient). It calls theinit()of each part, so adding a part edits the feature, never the entrypoints.XRegistry.register(): its entities, blocks, items and other registrations.XTuning, when the feature has tunables: one record of them, read asXTuning.DEFAULT.thing(). A bound a formula needs on a tuning value (PodGlideTuning.catchUp > 1) is checked in the record's compact constructor.Client art (colours, sizes, spacing, visual timings) is not a constant in Java. It is resource-pack data in
assets/deepcharter/theme/<area>.json, read asCrtTuning.current().thing()and the like, and a pack restyles it on F3+T (skins.md, ADR 0032)../gradlew checkColourGate, part ofcheck, fails the build on a colour literal insrc/client/javaoutsideclient/theme/; a line that must keep one ends with// colour-ok: <reason>.Lang keys: one fragment per feature,
src/lang/en_us/<feature>.json(outside the resources source set, so it stays out of the jar), merged and sorted intoassets/deepcharter/lang/en_us.jsonat build time. That file is generated: never edit it. A key lives in exactly one fragment; a duplicate fails the build. An empty fragment is{}.Commands, always added with
FeatureCommands.register("<feature>", ...), which puts them under/deepcharter <feature>.charterandhandbookhave aXCommandsstub; add one to any other feature that needs it.Null safety: NullAway checks only
@NullMarkedpackages (OnlyNullMarked, JSpecify mode, ERROR on every source set). Every package with Java sources needs apackage-info.javawith@NullMarked:checkNullMarkedGate(part ofcheck;tools/tests/null_marked_gate_check.pytests it) fails the build on one without, naming the package. A new package gets the file in the PR that adds it. To bring a feature under it, add one to every package in its footprint, acrosssrc/main,src/clientandsrc/gametest(gametest packages do not mirror<feature>), all in one PR:@NullMarked package io.github.pkeppeler.deepcharter.<feature>; import org.jspecify.annotations.NullMarked;Fix the findings with
org.jspecify.annotations.Nullable, the one the dependency and options are wired for.@Shadowfields are excluded from NullAway (build.gradle.ktsNullAway:ExcludedFieldAnnotations), andtest.mixinnow has some.@Uniquefields are the open case: the first PR that adds one checks whether it needs an exclusion. ACrtScreenwidget field thatlayout()assigns is@Nullableand read throughObjects.requireNonNull(field, "<built by layout() in init()>"); prefer a local when nothing reads the widget later. ArequireNonNullon a per-tick, per-frame or per-cell path takes theSuppliermessage overload, so the message is built only when it fails.
Javadoc on a nullability annotation needs a non-obvious why. Pass a checked value as a parameter instead of re-reading a global and asserting. Make the null state unrepresentable instead of writing an accessor that only asserts.
Marking package B makes B's signatures non-null for every marked caller, so a PR can pass its own CI and breakmainonce another merges: before queueing a batch of NullAway PRs, run the integration compile on the merged tree. NullAway stops at the first source set with errors (main, then client, then gametest), so rebuild until the whole build is clean, and probe a zero-finding package with a temporaryString s = null;.
A server-thread wait (Future.get) in a tick path takes one deadline for the whole operation, not one per item, and a timeout falls back to the safe path, not an exception that strands state. The light engine's futures are completed by the server thread itself, so never wait on one from it.
Do not spell out counts of enum members or registry entries in prose ("the seven ores"): they drift. Name them, or point at the code.
A value that only some enum constants have (a title, a colour, a sprite) goes on its own closed enum, not a @Nullable field with throwing switches for the rest (CockpitHud.Meter beside CockpitHud.Part, #1436).
A per-tick hook must not throw on a missing level: look it up with server.getLevel(...) and handle null.
A new part that needs its own init() and has no feature of its own gets a stub in its feature, wired into that feature's XInit already: pod/PodComponents (#65), pod/PodTowing (#76) and layer/LayerStructures (#79).
M2 rules
m2-rules.md applies to any change under src/main or src/client: attachments and versioning, PodEvents, Unreadable handling, mixins, sealing.