ADFA-2436: Add Maps (offline OSM) plugin#22
Conversation
…ile writes (+ unit tests)
…t tests) Hand-rolls what go-pmtiles' `pmtiles extract` does (bbox → minimal v3 archive), over HTTP range requests against the IIAB-hosted global archive, because we can't ship/shell-out to a per-arch Go binary on-device. The code is dense (Hilbert-curve tile-id ranges, directory walking, run-length entries) but isolated behind a small surface and heavily unit-tested — trust the tests. If it proves hard to maintain, it's swappable for the `pmtiles` Go CLI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…s), installer, stores (+ unit tests)
…pp (Kotlin + Java) (+ unit tests)
From the license-audit + code-review DoD pass (both 0-blocker): - THIRD_PARTY_LICENSES.txt: add com.github.davidmoten:hilbert-curve:0.2.3 and its transitives (guava-mini, listenablefuture) — Apache-2.0 runtime deps bundled in the .cgp that were the one un-attributed entry. - SourcePickerFragment.persistLanHost: use applicationContext (matching the off-main read) so the write shares the one process-wide SharedPreferencesImpl — a future reorder can't reintroduce a first-access disk read on Main. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jatezzz
left a comment
There was a problem hiding this comment.
Some of these files are quite long. Please consider splitting them into smaller, more focused files to improve readability and adhere to the Single Responsibility Principle (SRP).
| @@ -0,0 +1,93 @@ | |||
| package org.appdevforall.maps.data | |||
There was a problem hiding this comment.
Please ensure file operations runs on Dispatchers.IO.
There was a problem hiding this comment.
Thanks...no need to identify more of these examples. I'll go through and review all file operations.
| @@ -0,0 +1,95 @@ | |||
| package org.appdevforall.maps.data | |||
There was a problem hiding this comment.
Please ensure file operations runs on Dispatchers.IO.
| @@ -0,0 +1,280 @@ | |||
| package org.appdevforall.maps.data | |||
There was a problem hiding this comment.
Please ensure file operations runs on Dispatchers.IO.
@jatezzz thanks for reviewing. I already worked with Claude to do a couple of cohesion and coupling passes. Broke up many things and made them more testable. Looks like I missed one file...BboxFragmentPicker needs help. And I'll try to break up the RegionManagerFragment too...that popped up as a borderline judgement call last time. There's probably a better way to organize the wizard steps. Anything else you spotted? Also is there a guideline for how this team applies SRP? It's one of the more vague rules and I'm curious how you and the team apply it. The more specific we can be, the more likely it is that agents can plan for and build the right thing on the first try. |
|
@fryanpan Thanks for the open response and for doing those passes with Claude! Regarding the files: You make a fantastic point about SRP being vague, and I completely agree that being specific helps both humans and AI agents. Here is how we generally look at SRP pragmatically on this team:
I love your point about agents planning better with specific rules. We should probably document these exact heuristics in a guide file so the AI tools can pick them up automatically as context. Let me know how the refactoring goes with those two fragments! |
ADFA-2436: Add Maps (offline OSM) plugin
Ticket
ADFA-2436
Description
Adds a Maps plugin that helps developers make a working offline mapping app in a few minutes.
Lets the developer download an OpenStreetMap (OSM) map region from an Internet in A Box (IIAB) server and build a read-only mapping app (annotation left for a future ticket)
Workflow
You need internet for steps 1 and 3, but the developer can start working offline after that. And the generated app also works offline.
Details by Commit
I asked Claude to reorganize the work into commits, to try and make a big PR easier to review. Each file is in exactly one commit. Some commits could benefit from more review than others.
In the "Files Changed" tab above, you can review by commit to get a more organized view:
5049a687981fa8min_ide_versionpin with no max),MapsPlugin. Mostly boilerplate.c044a6a44ce879c30e5cab3b53f29c5acb487d274636c9985THIRD_PARTY_LICENSES. Check attribution + licensing is reasonable, not code.Testing
Automated checks below in the table, plus I've manually tested the flow + reviewed the code.
assemblePlugin+test)P.S. The automated checks are a bit messy and defined in the wrapper repo. I'll make a future ticket to look into cleaning them up and adding them into the plugin repo. Let me know if there are parts of this you think are especially important (or not important!)
Unit Tests
Didn't spend too much effort trying to get to 100% coverage. Did try to get over 90% on most non-UI code....but it was a bit hard to test some of the areas that required Android integration or mocking out CodeOnTheGo integration. So I left it to the E2E tests to cover these areas.
./gradlew jacocoTestReportCoverage by folder (full breakdown + the 8-check quality assessment in
coverage-quality-assessment-2026-06-04.md):domain/slicer/util/data/templates/maps/(MapsPlugin)ui/On-Device Automated E2E QA Walk
Was using this method regularly during development to have Claude do end-to-end testing using mobile-mcp.
Link to the test cases here which cover the whole flow from installing the plugin, using the project template, downloading and managing map regions, building the templated app offline, running the templated app, and testing the offline map in the templated map. The tests also went through both Kotlin and Java project templates.
Device recordings from running the tests:
StrictMode
Was getting a few warnings about this a few days ago (e.g. warnings/errors during project creation)...did a cleanup pass. The plugin should be StrictMode clean now -- no main-thread I/O. Sockets are traffic-stats-tagged.
But creating a project still triggers StrictMode warnings that are coming from the CodeOnTheGo side. Added a comment to ADFA-4121.
Notes & Questions for Reviewers
Ease of Testing + CoverageCouple of followup items would help in the future. I'll add some followup tickets:
Decisions to Note
Future Improvements — Two nice-to-haves tracked but not blocking v1