Reference
Build, test and CI
Covers all three parts. Run the Android line before every commit —
those are the CI gates plus Android Lint, and the project's rule is that main stays
green.
./gradlew ktlintCheck detekt lintDebug testDebugUnitTest assembleDebug # Android, both modules
cd jetson && python3 -m unittest discover -s tests -t . # edge box
Toolchain
| Version | Notes | |
|---|---|---|
| Kotlin | 2.0.21 | With the Compose compiler plugin |
| JDK | 17 | Source, target and jvmTarget |
| Android Gradle Plugin | 8.7.3 | |
| Gradle | 8.10.2 | Pinned by the wrapper — always use ./gradlew |
| Compose BOM | 2024.11.00 | |
| detekt | 1.23.7 | Config at config/detekt/detekt.yml |
| ktlint plugin | 12.1.2 | Android mode, ignoreFailures = false |
| Python | ≥ 3.8 | zvision core is standard-library only |
If ./gradlew cannot find them, set them inline per command:
JAVA_HOME=/path/to/jdk-17 ANDROID_HOME=/path/to/android-sdk ./gradlew ...
adb lives at $ANDROID_HOME/platform-tools/adb.
local.properties
Gitignored, and optional. The build reads three keys from it:
BM_API_KEY=<burning man api key>
zodiac.home.lat=<home camp latitude>
zodiac.home.lon=<home camp longitude>
The two zodiac.home.* keys set HOME — the “return to camp” target
— for both :app and :beacon (the beacon's GPS test-mode
HOME preset), via the root build.gradle.kts. Set both or neither: absent,
HOME is a neutral default (7:30 & E on the 2026 grid); half-set, non-numeric, or outside the
Black Rock Desert, the build fails rather than ship a fleet pointed at the wrong place.
Absent — as on CI — the API key compiles to "" and the Burning Man discovery
fetch fails its HTTP call. That is not fatal: DiscoveryRepository keeps serving whatever
is in its on-disk cache and logs the failure. Art and camp markers simply never appear.
Modules
settings.gradle.kts includes two Android modules; jetson/ is
not a Gradle project.
| Module | Package | minSdk | target / compile | Version |
|---|---|---|---|---|
:app | org.pureagave.zodiac.control | 28 (Android 9 / Fire OS 7) | 35 | 1 / 0.1.0 |
:beacon | org.pureagave.zodiac.beacon | 29 (the XCover Pro is Android 10) | 35 | 1 / 0.1.0 |
:app is screenOrientation="fullUser" — each concept reflows for
landscape or portrait, so it runs on a portrait-mounted small tablet too.
minSdk 28 exists so the Fire HD 10 9th gen and Fire HD 8 10th gen can serve as passenger displays.
Nothing in the app needs 30; every API gate in the code is ≥ 31. Older 8″ Fires are
Fire OS 6/5 (API 25/22) and would need a further drop — check any candidate with
adb shell getprop ro.build.version.sdk.
Android commands
./gradlew assembleDebug # build both debug APKs
./gradlew testDebugUnitTest # unit tests, both modules
./gradlew detekt # static analysis
./gradlew ktlintCheck # style check
./gradlew ktlintFormat # auto-fix style
./gradlew lintDebug # Android Lint (manifest / permission / API)
./gradlew assembleRelease # R8 minify + resource shrink
Prefix a task with a module to scope it: ./gradlew :beacon:testDebugUnitTest.
Test counts
Measured 2026-10-22, all green.
| Suite | Tests |
|---|---|
:app | 1,210 |
:beacon | 180 |
jetson | 542 |
Android tests are JUnit 4 with kotlinx-coroutines-test (runTest,
advanceUntilIdle) and a MainDispatcherRule TestWatcher for
dispatcher setup. Ten :beacon suites use Robolectric; because
TelemetryBroadcaster is a process singleton, the ones that start it stop it and clear the
injected GPS handle in @After.
Both ThreatProtocolGoldenTest (Kotlin) and
test_threat_protocol_golden.py (Python) resolve
protocol/threat-protocol-golden.json at the repository root and
fail loudly if it is missing — with the paths they tried, rather than a bare
FileNotFoundException. Run from a full checkout, not a copy of
jetson/ alone.
tests/test_service_config.py parses the actual shipped
systemd/zvision.service and scripts/install.sh and pins their contents
— the EnvironmentFile not being --prefixed,
StartLimitIntervalSec=0 living in [Unit], Restart=always, the
working directory, and that install.sh writes its config before restarting the
service.
Lint and static analysis
- ktlint — Android mode, strict. Fails the build on any violation.
- detekt — built on the default config.
MagicNumber,MaxLineLengthandLongMethodare off;ReturnCountis relaxed to 3 for guard-clause validation;LongParameterListandTooManyFunctionsare raised with a written rationale for each. Broadcatch (Exception)at hardware and IO boundaries is@Suppressed locally with a reason rather than disabled as a rule. - Android Lint —
abortOnError = truein both modules. Warnings still only report; only errors abort.
A standing rule. TooManyFunctions had been bumped 24 → 25 for one
method; it was reverted to 22 and the ViewModel split into delegates
instead. That instinct has caught real organisation problems four times.
Release builds
:app release runs R8 shrink plus resource shrinking
(~36 MB → ~2.4 MB). proguard-rules.pro keeps the
usb-serial-for-android driver classes that the prober resolves reflectively at
runtime.
Signing is opt-in: set ZODIAC_KEYSTORE_FILE, ZODIAC_KEYSTORE_PASSWORD,
ZODIAC_KEY_ALIAS and ZODIAC_KEY_PASSWORD (environment variables, or the
matching zodiac.* Gradle properties). Without them the release builds
unsigned — R8 still runs, so CI and local builds can verify shrinking with no
keystore.
Validate the R8-shrunk APK on a real tablet before fleet distribution. This has not been done.
:beacon release does not minify and has no ProGuard rules.
jetson — zvision and zdeck
cd jetson
python3 -m unittest discover -s tests -t .
Pure unittest, no pytest. The suite runs with no numpy,
opencv, StreamDeck or PIL installed —
zvision/normalize.py exists precisely so the array-free arithmetic is testable without
them.
Running without hardware
python3 -m zvision --source fake -v # synthetic contacts on the real bus
python3 -m zvision --check --camera thermal:/dev/video0:az=0:fov=160
--source fake needs nothing installed and is how the bus and the DRIVER HUD are
proved before any camera exists. --check validates the whole configuration, prints the
resolved rig and its blind arcs, and exits without opening a camera or touching the
network — run it before writing anything into /etc/default/zvision,
because the service is Restart=always and an unvalidated typo is a crash loop.
Dependencies
| Component | Needs |
|---|---|
zvision core | None. Standard library only |
Optional camera extra | numpy≥1.24, opencv-python≥4.8, imported lazily |
zdeck | streamdeck + pillow, in a separate venv on the box |
| DMX output | The apt package ola (olad); no Python OLA binding is used |
pip install opencv-python
If a CUDA-enabled build is already present, pip shadows it.
The deploy runbook records the measured state of a fresh
JetPack image and what actually needs installing — follow that over the comment in
requirements.txt.
CI
Four GitHub Actions workflows. android-ci and jetson-ci gate push and
pull request to main; secrets-scan runs gitleaks over the full history on
every push and PR; pages publishes docs/site to GitHub Pages
from the public repo only.
android-ci.yml
Ubuntu, JDK 17 (Temurin), Android SDK, the project's Gradle wrapper. setup-android
is passed packages: platform-tools, because its default list includes the retired
tools package, which current runner images no longer resolve (AGP fetches the platform
and build tools it needs). Five steps, in order, and
unscoped so both modules are covered:
./gradlew ktlintCheck./gradlew detekt./gradlew lintDebug./gradlew testDebugUnitTest./gradlew assembleDebug
:app:-scoped until 2026-08-10
Which meant :beacon was built and tested by nobody but the author — on the one
module that must survive a reboot unattended for a week. Run them unscoped locally
too: an :app:-prefixed task silently skips the beacon, which is exactly how
the gap survived.
jetson-ci.yml
Path-filtered to jetson/**, protocol/** and the
workflow file itself. Python 3.11, no install step:
python -m unittest discover -s tests -t . -vpython -m zvision --once -v— a byte-check that the runner emits a frame
The protocol/** filter is deliberate: a change to the ZTHREAT golden
corpus must re-run the Python half of the contract, not just the Kotlin half.
Why →
secrets-scan.yml
On every push to main and every PR: a full-history checkout
(fetch-depth: 0) and gitleaks 8.30.1 (gitleaks git --redact --exit-code 1).
The public repo is an export with a scrubbed history, and this keeps it that way.
pages.yml
Publishes docs/site as this site through the GitHub Pages actions, on a
push to main that touches docs/site/** or the workflow, or by
hand (workflow_dispatch). The job runs only when github.repository is
pureagave/zodiac-ecliptic; the private development repo has no Pages site.
Deploying to a tablet
adb install -r app/build/outputs/apk/debug/app-debug.apk
adb shell am start -W -n org.pureagave.zodiac.control/.MainActivity
Or ./gradlew installDebug. Grant runtime permissions up front to skip the
first-launch dialogs:
adb shell pm grant org.pureagave.zodiac.control android.permission.ACCESS_FINE_LOCATION
adb shell pm grant org.pureagave.zodiac.control android.permission.ACCESS_COARSE_LOCATION
adb shell pm grant org.pureagave.zodiac.control android.permission.BLUETOOTH_CONNECT
adb shell pm grant org.pureagave.zodiac.control android.permission.BLUETOOTH_SCAN
The Bluetooth pair exists only from API 31, so on the Fires (API 28 and 30) those two lines fail with “Unknown permission”; they are for the Samsungs.
Screenshot the app framebuffer with adb exec-out screencap -p > out.png. After
am start the first capture can race the launch transition and catch the home screen
— confirm focus with adb shell dumpsys window | grep mCurrentFocus, then
re-capture.
Per-device quirks — DeX windowing on the S9+, wireless-debugging-only pairing on the A54, OLED brightness discipline during testing — are in Devices and roles.
Repository conventions
SYNC.md and tasks/ live only in the private development repo; this public
tree is a filtered export of it, so they are absent here by design.
SYNC.mdis append-only. Anything significant that is decided, learned or built gets a dated entry, newest on top. Never rewrite a past entry — supersede it with a new one.README.mdis the current-state snapshot, not a changelog. Update it when a major feature ships or the architecture changes.- Commit in small runnable increments and keep
maingreen. Phased features get phased commits — data, then render, then integrate — each leaving the app runnable. - Push after each phase commit. CI runs the same gates upstream, so anything green locally should stay green.
- Pause and confirm before any destructive remote operation (force-push, branch delete, history rewrite).
- Where a doc and the code disagree, the code wins — fix the doc and say so
in
SYNC.md.
Converted fromdocs/BUILD.md · CLAUDE.md · docs/README.md