feat: TAK v2 protocol integration with zstd compression and full CoT type support#5434
Conversation
Bump the protobufs submodule to the takv2_geometry commit that adds
CasevacReport, EmergencyAlert, TaskRequest, and GeoChat receipt
fields. Rebuild meshtastic-tak-0.1.0.jar from the updated
TAKPacket-SDK kotlin artifact and extend TakV2Compressor.kt with the
corresponding wireToSdkData / sdkDataToWire branches so the JVM
takserver round-trip preserves every structured field the SDK parser
now extracts.
- .gitmodules: pin core/proto/src/main/proto to takv2_geometry
- core/proto/src/main/proto: fast-forward to the new protobufs tip
- core/takserver/libs/meshtastic-tak-0.1.0.jar: rebuilt artifact
with the typed CasevacReport / EmergencyAlert / TaskRequest
payload variants and the extended GeoChat receipt fields
- core/takserver/src/jvmAndroidMain/.../TakV2Compressor.kt:
* extend wireToSdkData with casevac / emergency / task / chat
receipt branches, mapping enum .value ints through the SDK
TakPacketV2Data sealed-class payloads
* extend sdkDataToWire with the same three variants plus the
chat receipt_for_uid / receipt_type fields
* import WireCasevacReport / WireEmergencyAlert / WireTaskRequest
from the regenerated Wire proto classes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…TAKClientConnection
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
Pull request overview
Introduces TAK v2 support end-to-end by replacing the previous Ktor-based TCP listener with a JSSE TLS (mTLS) TAK server, adding TAKPacketV2 conversion + detail stripping for mesh MTU constraints, and surfacing new TAK Server settings UI + debug test harness.
Changes:
- Add JSSE-based loopback-only TLS/mTLS TAK server + per-connection state machine (JVM/Android), and refactor
TAKServerinto a platform interface withexpect/actualfactory. - Implement TAK v2 mesh bridge: TAKPacketV2 conversion (including
raw_detailfallback) + CoT<detail>stripping, update defaults (port 8089, keepalive interval), and add extensive tests + fixtures. - Add a new “TAK Server” screen in Settings → Advanced (enable/disable, data package export, debug mesh fixture runner), and adjust module filtering logic.
Reviewed changes
Copilot reviewed 91 out of 93 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/RadioConfig.kt | Adds Advanced settings entry for new TAK Server screen. |
| feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/TAKConfigItemList.kt | Splits module TAK config UI from app-local TAK Server controls; adds debug mesh test UI. |
| feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/navigation/SettingsNavigation.kt | Wires SettingsRoutes.TakServer to TakServerScreen. |
| feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/ModuleConfigurationScreen.kt | Updates module filtering to use device role from radioConfig.device. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/waypoint.xml | Adds TAK v2 SDK fixture for waypoint event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/task_engage.xml | Adds TAK v2 SDK fixture for task/engage event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/route_itak_3wp.xml | Adds TAK v2 SDK fixture for iTAK route event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/route_3wp.xml | Adds TAK v2 SDK fixture for route event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/ranging_line.xml | Adds TAK v2 SDK fixture for ranging line event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/ranging_circle.xml | Adds TAK v2 SDK fixture for ranging circle event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/ranging_bullseye.xml | Adds TAK v2 SDK fixture for ranging bullseye event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/pli_webtak.xml | Adds TAK v2 SDK fixture for WebTAK PLI event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/pli_takaware.xml | Adds TAK v2 SDK fixture for TAKAware PLI event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/pli_stationary.xml | Adds TAK v2 SDK fixture for stationary PLI event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/pli_itak.xml | Adds TAK v2 SDK fixture for iTAK PLI event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/pli_full.xml | Adds TAK v2 SDK fixture for full PLI event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/pli_basic.xml | Adds TAK v2 SDK fixture for basic PLI event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/marker_tank.xml | Adds TAK v2 SDK fixture for marker/tank event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/marker_spot.xml | Adds TAK v2 SDK fixture for marker/spot event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/marker_icon_set.xml | Adds TAK v2 SDK fixture for iconset marker event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/marker_goto.xml | Adds TAK v2 SDK fixture for goto marker event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/marker_goto_itak.xml | Adds TAK v2 SDK fixture for iTAK goto marker event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/marker_2525.xml | Adds TAK v2 SDK fixture for 2525 marker event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/geochat_simple.xml | Adds TAK v2 SDK fixture for GeoChat event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/geochat_dm.xml | Adds TAK v2 SDK fixture for GeoChat DM event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/geochat_broadcast.xml | Adds TAK v2 SDK fixture for GeoChat broadcast event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/emergency_cancel.xml | Adds TAK v2 SDK fixture for emergency cancel event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/emergency_911.xml | Adds TAK v2 SDK fixture for emergency 911 event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/drawing_telestration.xml | Adds TAK v2 SDK fixture for telestration drawing event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/drawing_rectangle.xml | Adds TAK v2 SDK fixture for rectangle drawing event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/drawing_rectangle_itak.xml | Adds TAK v2 SDK fixture for iTAK rectangle drawing event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/drawing_polygon.xml | Adds TAK v2 SDK fixture for polygon drawing event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/drawing_freeform.xml | Adds TAK v2 SDK fixture for freeform drawing event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/drawing_ellipse.xml | Adds TAK v2 SDK fixture for ellipse drawing event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/drawing_circle.xml | Adds TAK v2 SDK fixture for circle drawing event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/drawing_circle_large.xml | Adds TAK v2 SDK fixture for large circle drawing event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/delete_event.xml | Adds TAK v2 SDK fixture for delete event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/chat_receipt_read.xml | Adds TAK v2 SDK fixture for chat read receipt event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/chat_receipt_delivered.xml | Adds TAK v2 SDK fixture for chat delivered receipt event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/casevac.xml | Adds TAK v2 SDK fixture for CASEVAC event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/casevac_medline.xml | Adds TAK v2 SDK fixture for CASEVAC medline event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/alert_tic.xml | Adds TAK v2 SDK fixture for alert/TIC event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/aircraft_hostile.xml | Adds TAK v2 SDK fixture for hostile aircraft event. |
| core/takserver/src/jvmAndroidMain/resources/tak_test_fixtures/aircraft_adsb.xml | Adds TAK v2 SDK fixture for ADS-B aircraft event. |
| core/takserver/src/jvmAndroidMain/resources/tak_certs/ca.pem | Adds bundled CA certificate for mTLS trust. |
| core/takserver/src/jvmAndroidMain/kotlin/org/meshtastic/core/takserver/TAKServerJvm.kt | Adds JSSE TLS/mTLS TAK server implementation + wires cert bytes provider. |
| core/takserver/src/jvmAndroidMain/kotlin/org/meshtastic/core/takserver/TAKClientConnection.kt | Adds per-client connection state machine for blocking socket I/O + keepalive. |
| core/takserver/src/jvmAndroidMain/kotlin/org/meshtastic/core/takserver/TakCertLoader.kt | Adds loader for bundled PKCS12 + CA PEM and builds SSLContext. |
| core/takserver/src/jvmAndroidMain/kotlin/org/meshtastic/core/takserver/fountain/CodecActual.kt | Removes old fountain codec JVM implementation. |
| core/takserver/src/jvmAndroidMain/kotlin/org/meshtastic/core/takserver/AtakFileWriter.kt | Adds JVM/Android implementation for writing route data packages to ATAK import dir. |
| core/takserver/src/iosMain/kotlin/org/meshtastic/core/takserver/TakV2Compressor.kt | Adds iOS stub actual for TakV2Compressor. |
| core/takserver/src/iosMain/kotlin/org/meshtastic/core/takserver/TAKServerIos.kt | Adds iOS no-op TAKServer implementation (stub). |
| core/takserver/src/iosMain/kotlin/org/meshtastic/core/takserver/fountain/CodecActual.kt | Removes old fountain codec iOS implementation. |
| core/takserver/src/iosMain/kotlin/org/meshtastic/core/takserver/AtakFileWriter.kt | Adds iOS no-op actual for AtakFileWriter. |
| core/takserver/src/commonTest/kotlin/org/meshtastic/core/takserver/TAKPacketV2RawDetailTest.kt | Adds tests for raw_detail fallback round-trip for unmapped CoT types. |
| core/takserver/src/commonTest/kotlin/org/meshtastic/core/takserver/fountain/FountainCodecTest.kt | Removes fountain codec tests. |
| core/takserver/src/commonTest/kotlin/org/meshtastic/core/takserver/CoTXmlTest.kt | Updates CoT XML serialization test to ensure no XML declaration is emitted. |
| core/takserver/src/commonTest/kotlin/org/meshtastic/core/takserver/CoTXmlParserTest.kt | Adds tests for parsedDetailXml + verbatim source XML capture behavior. |
| core/takserver/src/commonTest/kotlin/org/meshtastic/core/takserver/CoTDetailStripperTest.kt | Adds coverage for detail stripping contract. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TakV2TypeMapper.kt | Adds mapping between CoT type/how strings and TAKPacketV2 enums. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TakV2Compressor.kt | Adds expect API for v2 compressor/decompressor. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKServerManager.kt | Adds inbound client info propagation + offline queue + raw XML broadcast support. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKServer.kt | Refactors TAK server into a platform interface + expect factory. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKPacketV2Conversion.kt | Adds CoTMessage ↔ TAKPacketV2 conversions including raw_detail fallback. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKPacketConversion.kt | Documents/cleans up legacy v1 conversion and shares helpers. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKModels.kt | Extends CoTMessage with parsedDetailXml/sourceEventXml; includes clientInfo in events. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TakMeshTestRunner.kt | Adds debug runner to push bundled fixtures through the mesh pipeline. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKDefaults.kt | Updates defaults (port 8089, keepalive interval, payload caps/log limits). |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKDataPackageGenerator.kt | Adds TLS-capable data package generation with truststore/client cert entries. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TakConversionHelpers.kt | Adds shared helpers for team/role mapping and smuggled callsign parsing. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKClientConnection.kt | Removes old commonMain Ktor-based TAKClientConnection. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/RouteDataPackageGenerator.kt | Adds route CoT → KML data package generator for ATAK import. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/fountain/GenericCoTHandler.kt | Removes old generic CoT fountain-forwarder handler. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/fountain/FountainCodec.kt | Removes fountain codec implementation. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/di/CoreTakServerModule.kt | Updates DI wiring to use createTAKServer + revised TAKMeshIntegration ctor. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/CoTXmlParser.kt | Captures stripped <detail> inner XML and verbatim source event XML. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/CoTXml.kt | Removes XML declaration; stabilizes timestamp formatting for CoT stream protocol. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/CoTDetailStripper.kt | Adds string/regex based stripper to shrink detail payloads for mesh MTU. |
| core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/AtakFileWriter.kt | Adds expect API for writing ATAK importable data packages. |
| core/takserver/build.gradle.kts | Adds TAKPacket-SDK JVM dependency and zstd-jni wiring for Android/JVM. |
| core/service/src/commonTest/kotlin/org/meshtastic/core/service/MeshServiceOrchestratorTest.kt | Updates orchestrator test stubs for TAK integration changes. |
| core/service/src/androidMain/kotlin/org/meshtastic/core/service/MeshService.kt | Adds partial wakelock management to improve reliability under power optimizations. |
| core/navigation/src/commonMain/kotlin/org/meshtastic/core/navigation/Routes.kt | Adds SettingsRoutes.TakServer. |
| core/navigation/src/commonMain/kotlin/org/meshtastic/core/navigation/NavigationConfig.kt | Registers TakServer route for saved state serialization. |
| core/model/src/commonMain/kotlin/org/meshtastic/core/model/Capabilities.kt | Adds supportsTakV2 (>= 2.8.0) capability. |
| core/data/src/commonMain/kotlin/org/meshtastic/core/data/manager/MeshDataHandlerImpl.kt | Updates portnum broadcast switch to include ATAK_PLUGIN_V2. |
| app/src/main/AndroidManifest.xml | Adds MANAGE_EXTERNAL_STORAGE permission; includes WAKE_LOCK and local network permission. |
| .gitmodules | Sets proto submodule branch to takv2_geometry. |
Comments suppressed due to low confidence (1)
feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/TAKConfigItemList.kt:193
- More hardcoded user-facing strings are introduced here (e.g. card title "Server", "Export Data Package", and the description). For consistency/localization, please add these to
core:resourcesand usestringResource(Res.string.*)instead of raw string literals.
- NavigationConfig.kt: use subclassesOfSealed<> approach from main - Routes.kt: keep TakServer as SettingsRoute, DebugPanel stays SettingsRoute - MeshService.kt: keep wake lock and START_STICKY logic for TAK server - MeshServiceOrchestratorTest.kt: keep both PacketHandler and NodeRepository imports - build.gradle.kts: keep TAKPacket-SDK and zstd-jni dependencies - CoTXml.kt: keep no-XML-declaration approach (correct for CoT stream) - TAKDefaults.kt: keep 10s keepalive (prevents ATAK timeout at 15s stale) - TAKServer.kt: keep interface with hasConnections() and onClientConnected - TAKServerManager.kt: keep SharedFlow<InboundCoTMessage> with client info - Delete commonMain/TAKClientConnection.kt (moved to jvmAndroidMain) - Delete commonMain/fountain/FountainCodec.kt (TAK v2 uses SDK instead) - Delete fountain/ZlibCodec.kt from iosMain and jvmAndroidMain (not in HEAD) - SettingsNavigation.kt: fix SettingsRoutes.* to SettingsRoute.* - TAKConfigItemList.kt: keep full Scaffold with debug test harness Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Resolved all merge conflicts in commit
|
|
@copilot rebase onto main please |
|
@copilot apply changes based on the comments in this thread |
…gate manifest permission Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Android/sessions/a285141f-c190-480f-86f6-3e9957f7bcac Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Applied all review feedback in commit
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 93 out of 95 changed files in this pull request and generated 7 comments.
Comments suppressed due to low confidence (1)
feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/TAKConfigItemList.kt:296
- The results summary text is built with hardcoded formatting/symbols (
"${result.compressedBytes}B ✓"/"✗") instead of string resources. This makes the UI non-localizable and mixes presentation details into code. Prefer string resources with placeholders (including the units and status text) so formatting can be localized consistently.
| actual fun writeToImportDir(fileName: String, zipBytes: ByteArray): Boolean { | ||
| // Use hardcoded paths — on Android /sdcard/ maps to external storage. | ||
| // On JVM desktop these paths don't exist and the fallback returns false. | ||
| val targets = listOf( | ||
| File("/sdcard/atak/tools/datapackage"), | ||
| File("/sdcard/Download"), | ||
| ) |
|
@copilot apply changes based on the comments in this thread |
… improvements Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Android/sessions/3266df61-4b07-47ad-a68f-df9b569f96f2 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
- Issue 5: Add invariant comment for V1/V2 speed/course scaling in TAKPacketV2Conversion.kt documenting why V1 and V2 paths must never cross-feed. - Issue 6: Move TAKServerManagerImpl.scope assignment to after the _isRunning guard so a second concurrent start() can never overwrite the active scope without restarting the server. - Issue 7: Flip _isRunning=false and scope=null BEFORE takServer.stop() in TAKServerManagerImpl.stop(); add early-return guards to broadcast(), broadcastRawXml(), and drainOfflineQueue() so they silently skip if the server is stopped, preventing coroutines from being launched on a discarded scope. - Issue 8: Add @volatile to TAKServerJvm.running so the accept loop reads a consistent value across threads. - Issue 9: Change TAKMeshIntegration.jobs from a mutable list to a @volatile var List<Job> for cross-thread visibility; add @volatile to currentTeam and currentRole which are written from a launched coroutine. - Issue 10: Replace TOCTOU check-then-set in TakMeshTestRunner.runAll() with Mutex.tryLock() so concurrent invocations are rejected atomically; wrap body in try/finally to guarantee unlock + _isRunning=false even if a fixture throws. - Issue 11: Reduce CoTXmlFrameBuffer.DEFAULT_MAX_TAK_MESSAGE_SIZE from 8MB to 256KB (25× larger than any realistic CoT event) to prevent memory exhaustion via N connections × 8MB on mobile devices. - Issue 12: Replace runCatching{} with try/catch in TAKClientConnection and TAKServerJvm socket.close() calls to avoid silently swallowing CancellationException. - Issue 13: Remove duplicate private xmlEscaped() from RouteDataPackageGenerator (it was also missing '); callers now use the canonical version from XmlUtils.kt. - Issue 14: Add @synchronized to TakCertLoader.getServerP12Bytes(), getClientP12Bytes(), and getCaPemBytes() to match the existing @synchronized on getServerSslContext() and prevent double-loading under concurrent access. Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Android/sessions/56e05084-d1a0-43f1-8515-bf1b8ae7ad7c Co-authored-by: jamesarich <2199651+jamesarich@users.noreply.github.com>
…ntegration Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Android/sessions/56e05084-d1a0-43f1-8515-bf1b8ae7ad7c Co-authored-by: jamesarich <2199651+jamesarich@users.noreply.github.com>
Fixed all 14 issues in commits Issues 1–4 were already addressed in Issues 5–14 (this batch):
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot protobufs should be pegged to master. Fix this |
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Android/sessions/9a06fbaa-f151-4d5b-b9fe-2095f1f6fdb2 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Fixed in commit |
Add complete spec artifacts for feature 005-tak-v2-protocol: - spec.md: Feature specification - plan.md: Implementation plan - tasks.md: Task breakdown - data-model.md: Data model design - contracts/wire-protocol.md: Wire protocol contract - checklists/protocol.md: Protocol checklist - checklists/requirements.md: Requirements checklist - quickstart.md: Quick start guide - research.md: Research notes
- T059: MeshService.onStartCommand() → MeshServiceOrchestrator (commonMain) - plan.md: 38 → 40 XML fixture files (actual count) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…l visibility - Create TAKMeshIntegrationTest.kt with 10 tests covering lifecycle, inbound mesh forwarding, firmware gating, and GeoChat enrichment - Add 2 broadcastRawXml tests to TAKServerManagerTest (forward + no-op) - Make TAKServerManagerImpl internal (consumers use interface via Koin) - Fix backing property lint in TAKServerManagerTest - Update tasks.md with T078-T080, update test counts (89+ tests) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… skill Document that runTest(UnconfinedTestDispatcher()) is required when testing SharedFlow collectors launched in backgroundScope. The default StandardTestDispatcher silently drops emissions, causing tests to hang or assertions to fail without error. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extract stateless composables (TakConfigCard, TakServerSection, TakMeshTestCardContent) from TAKConfigItemList.kt for previewability. Create TAKConfigPreviews.kt with 6 @PreviewLightDark previews: - TakConfigCard (team/role dropdowns) - TakServerSection (disabled + enabled states) - TakMeshTestCardContent (idle, running, results with mixed pass/fail) Add 7 @previewTest screenshot test wrappers to SettingsScreenshotTests.kt for light/dark theme regression detection via CST plugin. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Make TAK preview functions public (required for cross-module screenshot tests) - Generate 12 reference images (6 previews × light/dark): TakConfigCard, TakServerSection (disabled/enabled), TakTestCard (idle/running/results) - Fix MeshService.kt duplicate return block from bad merge Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Security: - Sanitize untrusted mesh uid in AtakFileWriter (path traversal) Concurrency: - Replace catch(Throwable) with catch(Exception) in TAKMeshIntegration (7 locations) — prevents swallowing CancellationException/OOM/LinkageError - Use AtomicBoolean.compareAndSet for start()/stop() race guard - Add wake lock timeout (30 min) to prevent indefinite battery drain Observability: - Log XML parse failures in TAKClientConnection (was silently dropped) - Escalate SDK compression fallback from debug to warn level - Log unparseable CoT dates before falling back to now() Lint: - Fix all spotless (ktlint) and detekt violations across core:takserver - Fix broken TAKDefaultsTest (removed references to deleted constants) - Fix test function naming (ktlint camelCase) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Extract TakSdkCompressor expect/actual to move TAK SDK references out of commonMain (fixes compileKotlinIosSimulatorArm64) - Fix license header year format in TAKConfigItemList.kt (2025-2026 → 2026) - Add file-level detekt suppressions: - TAKConfigItemList.kt: LongMethod, ModifierMissing, ParameterNaming - TAKConfigPreviews.kt: PreviewPublic (public for screenshot tests) - MeshService.kt: TooGenericExceptionCaught (wake lock error handling) - Replace catch(Throwable) with catch(Exception) in TakMeshTestRunner - Run spotlessApply across affected modules Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
- Upgrade from v0.1.3 (fat-jar with bundled protos) to v0.2.1 which strips proto classes from the JVM JAR — fixes R8 'Type defined multiple times' errors in minifyFdroidReleaseWithR8. - Exclude xpp3 from jvmAndroidMain (Android provides XmlPullParser as a platform class; R8 fails when both library and program classpaths define the same type). - Re-add xpp3 in jvmMain for Desktop JVM which still needs it. - Replace java.net.BindException with IllegalStateException in TAKServerManagerTest to fix iOS test compilation. Closes meshtastic/TAKPacket-SDK#5 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TakPermissionHandler invoked the permission launcher directly inside the
composition body when isTakServerEnabled was true, which crashed with:
java.lang.IllegalStateException: Launcher has not been initialized
at androidx.activity.compose.ActivityResultLauncherHolder.launch(...)
The launcher's underlying ActivityResultLauncherHolder isn't bound to the
activity until composition completes, so calling launch() mid-composition
hits the not-yet-initialized holder. The iOS and JVM actuals already use
LaunchedEffect — Android was the outlier.
Also gate the request on isLocalNetworkPermissionGranted() so we don't
re-prompt every time the user opens the TAK Server screen with the
server already enabled (it's still requested up-front from the
Connections screen, so the usual path doesn't trigger here at all).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The permission ACCESS_LOCAL_NETWORK is an Android 17 / API 37 runtime permission. Both rememberRequestLocalNetworkPermission and isLocalNetworkPermissionGranted were guarding on Build.VERSION_CODES.S (API 31, Android 12), so on API 31-36 — including the user's Android 16 test device — the code tried to request a permission the system doesn't recognize. The launcher's RequestPermission contract returns immediate denial for unknown permission strings, which triggered the TakServerScreen's onPermissionResult(false) path and auto-disabled the TAK Server toggle ~90 ms after enabling it. Bumped the cutoff to API 37 using an integer literal because the SDK we compile against (android-37.0) does not yet expose a named constant past VANILLA_ICE_CREAM (API 35) — no BAKLAVA, no API-37 codename. Below API 37 we now report the permission as implicitly granted and skip the request, matching the actual platform behavior where localhost binding and LAN access work under the INTERNET permission alone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The existing v1/v2 send + receive split in TAKMeshIntegration was already gated on Capabilities.supportsTakV2 (firmware >= 2.8.0) — sendCoTToMesh dispatches to sendCoTToMeshV2 / sendCoTToMeshV1, and handleMeshPacket switches on PortNum.ATAK_PLUGIN vs ATAK_PLUGIN_V2. But handleV1Packet was commented "Backward compat for legacy V1 devices. Will be removed." which signaled future deletion at odds with our intent to keep 2.7.x firmware on the v1 stack indefinitely. Replaced the comment with a doc block describing the v1 receive path's purpose and stable position. No behavioral change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Upgrades TAK (Team Awareness Kit) integration from the legacy v1 protocol (port 72, PLI + GeoChat only) to the new TAK v2 protocol (port 78,
ATAK_PLUGIN_V2) with zstd dictionary compression and support for all CoT payload types. Enables rich tactical data—markers, routes, drawn shapes, emergencies, tasks, and ranging—over LoRa mesh between ATAK/iTAK clients.Spec:
specs/005-tak-v2-protocol/(spec, plan, tasks, research, data model, wire protocol, quickstart)What Changed
TAK v2 Protocol (
core:takserverKMP module)TakV2TypeMapperTakV2Compressor) with separate dictionaries for aircraft vs non-aircraft typesTAKMeshIntegration) between local TAK server and mesh networkTAK Server Lifecycle
TAKServerJvm)MeshServiceto prevent CPU throttling during TAK operationsTAK Configuration UI (
feature:settings)TAKConfigItemList) for server enable/disable, team/role selection, data package export, and diagnostic test runnerACCESS_LOCAL_NETWORKpermission handling for Android 17+ (API 37)Testing (89+ tests across 12 test classes)
TAKMeshIntegrationTest— 10 tests: lifecycle, inbound mesh forwarding, firmware gating, GeoChat enrichmentTAKServerManagerTest— 9 tests: broadcast routing, offline queue, broadcastRawXmlTAKPacketConversionTest— round-trip v1 encoding/decodingTAKPacketV2RawDetailTest— v2 raw detail preservationCoTXmlParserTest— streaming XML parsingCoTDetailStripperTest— bloat element removalXmlUtilsTest— XML escapingTakV2CompressorBoundaryTest— decompression size limitsTAKConfigPermissionDeniedTest— permission denial handlingGovernance
SharedFlow+backgroundScope+UnconfinedTestDispatcherguidanceScreenshots
TAK configuration UI — 6 preview composables x light/dark = 12 reference images (CST screenshot tests).
Dark mode screenshots
Constitution Check (v1.2.0)
commonMain; zerojava.*/android.*imports. Platform code inandroidMain/jvmAndroidMain/jvmMain/iosMainonly.spotlessApply+detektpass on all new/modified files. 3 pre-existing lint warnings in branch (not introduced by this PR).MeshtasticNavDisplay../gradlew spotlessApply detekt assembleDebug :core:takserver:jvmTest :feature:settings:allTestsverified locally before each push.Source-Set Impact
commonMainandroidMainjvmAndroidMainjvmMainiosMainStats
core:takserver)