Modern Apps git

← Modern-Apps.git

various fixes

Commit
8a2c241a2843001fe1d57de6ff5580fc26e247b4
Author
vayun-mathur <[email protected]>
When
2026-10-29 00:42 UTC (1 month ago)
Parents
4bd7049

Diff

AGENTS.md
diff --git a/AGENTS.md b/AGENTS.mdindex c26ec62a2b..aa36538aca 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -52,6 +52,15 @@ Slash == colon for Gradle (`games/voxels` == `games:voxels`). ### Never scan `target/`, `scripts/`, `build/`, `.gradle/`, `.kotlin/`, `*/build/`, `*/schemas/` (single file ok), `metadata_data/photos/`, `third_party/`, `firmware/`, `*.onnx`, `*.log`, `personal/`. +### Backend server (outside this repo)+The backend (relay server for findfamily/everysync/office/voxels) lives outside this repo:++- Server checkout: `../location_share_server` (sibling of this repo root). On this dev machine: `C:\Users\Vayun\Documents\code\location_share_server`.+- Live server SSH: `ssh [email protected]`+- Server env template: `../location_share_server/.env.example` (copy to `../location_share_server/.env`, never commit secrets).+- The server is the `findfamily.cc` host; clients have been migrated to `api.maproj.org` (same Cloudflare FIRST_PARTY pins). `findfamily.cc` remains valid for backward compatibility during the transition.+- Cloudflare R2: see `../location_share_server/src/handlers/os_admin.rs` for `R2::from_env()`; required vars `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, plus `R2_ENDPOINT` or `R2_ACCOUNT_ID`.+ ## 2. Conventions (check every time) - `Toast` banned (fatal lint). Use `rememberMessenger().show()` in composable, `AppMessages.show()` elsewhere. - Never `Icon()`/`painterResource()`/`androidx.compose.material.icons.*` in app. Add `IconXxx()` to `library/ui/.../Icons.kt`.
CROSS_PLATFORM_STATUS.md
diff --git a/CROSS_PLATFORM_STATUS.md b/CROSS_PLATFORM_STATUS.mdindex 1825521d51..2e9c5812d6 100644--- a/CROSS_PLATFORM_STATUS.md+++ b/CROSS_PLATFORM_STATUS.md@@ -17,7 +17,7 @@ target re-derives them.  ## Relay contract -- Base `https://findfamily.cc/personal`, WS `wss://…/ws`.+- Base `https://api.maproj.org/personal` (migrated from `https://findfamily.cc/personal`; findfamily.cc remains valid for backward compatibility), WS `wss://api.maproj.org/personal/ws`. - Endpoints: `POST /register | /getkey | /append | /pull`. - Channels: `<type>:<vaultId>` records, `members:`, `keys:`, `owner:`, `title:`, `inbox:<device>`, `notes-blobs:<vaultId>`. - The relay is an untrusted append-only log: records are never rewritten, only appended; authority is client-side (owner-signed roster/epochs/transfers); vault keys never user-visible.@@ -46,7 +46,7 @@ target re-derives them.  - Slices: `:library:everysync-core:compileKotlinJvm`, `:library:everysync-core:lint` (no Gradle run in this change per scope). - Tests (existing, must stay green): `RelayConformanceTest`, `SharedTransportTest`, `SyncDigestTest`, `TodoKindTest` (commonTest, 25 tests) + `JvmPqcVectorConformanceTest` (jvmTest, 6 tests).-- Live-relay checklist: register → getkey → append → pull round-trip against `https://findfamily.cc/personal`; null-pull abort; tombstone propagation per type; re-enable repopulation after purge.+- Live-relay checklist: register → getkey → append → pull round-trip against `https://api.maproj.org/personal` (migrated from findfamily.cc; findfamily.cc remains valid for backward compatibility); null-pull abort; tombstone propagation per type; re-enable repopulation after purge.  ## Next steps 
Cargo.lock
diff --git a/Cargo.lock b/Cargo.lockindex f0c2db5f65..97f553ec0d 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3904,7 +3904,10 @@ dependencies = [  "memmap2",  "miniz_oxide 0.8.9",  "rayon",+ "serde",+ "serde_json",  "tilecodec",+ "ureq", ]  [[package]]
FINDFAMILY_UWB_TRACKER_DESIGN.md
diff --git a/FINDFAMILY_UWB_TRACKER_DESIGN.md b/FINDFAMILY_UWB_TRACKER_DESIGN.mdindex d811ab07a8..103e401ce7 100644--- a/FINDFAMILY_UWB_TRACKER_DESIGN.md+++ b/FINDFAMILY_UWB_TRACKER_DESIGN.md@@ -176,7 +176,7 @@ one EC scalar-mult per epoch. - The finder never learns whose tracker it is.  ### 5.3 Server (new work — the critical piece outside this repo)-Two endpoints on `findfamily.cc`:+Two endpoints on `api.maproj.org` (migrated from `findfamily.cc`; findfamily.cc remains valid for backward compatibility): - `report-upload { hash, ciphertext }` - `report-fetch-by-hash [hashes] -> [ciphertext]` with a retention window (e.g. 7 days) + abuse/rate-limit policy. The server
apple/E2E_CHECKLIST.md
diff --git a/apple/E2E_CHECKLIST.md b/apple/E2E_CHECKLIST.mdindex fba4e3eb7d..d7b44a04ea 100644--- a/apple/E2E_CHECKLIST.md+++ b/apple/E2E_CHECKLIST.md@@ -33,7 +33,7 @@ explicit tombstones delete.  ## 2. Relay conformance (simulator <-> Android/desktop, both directions) -Against staging `https://findfamily.cc/personal` (see plan Phase 1F):+Against staging `https://api.maproj.org/personal` (migrated from `https://findfamily.cc/personal`; findfamily.cc remains valid for backward compatibility) (see plan Phase 1F):  - [ ] `register` / `getkey` round-trip from the simulator (device id stable       across restarts — `personalDeviceId` in Keychain).
everysync/AGENTS.md
diff --git a/everysync/AGENTS.md b/everysync/AGENTS.mdindex 8340bb5224..3971e06ae3 100644--- a/everysync/AGENTS.md+++ b/everysync/AGENTS.md@@ -11,6 +11,9 @@ _Install: ./install everysync (dev by default)._ - Metadata: metadata_data/everysync.md (present but stale — omits vaults/E2EE relay) - Rust: no / screenshotTest: yes +### Relay server (backend, outside this repo)+Host migrated from `findfamily.cc` to `api.maproj.org` (same Cloudflare FIRST_PARTY pins; `findfamily.cc` remains valid for backward compatibility). Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Live SSH: `ssh [email protected]`. Env template: `../location_share_server/.env.example` (copy to `.env`, never commit secrets). Full details: root `AGENTS.md` → "Backend server (outside this repo)".+ ## Overview **Purpose:** Universal sync hub — multi-provider account sync (contacts/calendars/health) plus E2EE vault relay syncing notes/passwords/todos between a user's own devices and shared vaults. **Key features:**
everysync/src/main/java/com/vayunmathur/everysync/network/remote/RelaySync.kt
diff --git a/everysync/src/main/java/com/vayunmathur/everysync/network/remote/RelaySync.kt b/everysync/src/main/java/com/vayunmathur/everysync/network/remote/RelaySync.ktindex 80644be40e..428493e835 100644--- a/everysync/src/main/java/com/vayunmathur/everysync/network/remote/RelaySync.kt+++ b/everysync/src/main/java/com/vayunmathur/everysync/network/remote/RelaySync.kt@@ -34,7 +34,8 @@ import kotlin.io.encoding.Base64  * (a dumb append-only log keyed by string channels over `/register|/getkey|/append|/pull`  * plus a WebSocket), same PQC identity + AES-256-GCM content encryption. All  * confidentiality, authenticity and authorization are enforced client-side; the relay- * only ever sees ciphertext.+ * only ever sees ciphertext. Host migrated from findfamily.cc to api.maproj.org;+ * findfamily.cc remains valid for backward compatibility during the transition.  *  * Channels per vault:  *  - `contacts:<vaultId>`, `calendar:<vaultId>`, `passwords:<id>`, `notes:<id>`@@ -64,8 +65,8 @@ import kotlin.io.encoding.Base64 // Transport surface: one function per endpoint/operation by design. @Suppress("TooManyFunctions") object RelaySync {-    private const val URL = "https://findfamily.cc/personal"-    private const val WS_URL = "wss://findfamily.cc/personal/ws"+    private const val URL = "https://api.maproj.org/personal"+    private const val WS_URL = "wss://api.maproj.org/personal/ws"     private const val HTTP_OK = 200     private const val RECONNECT_INITIAL_MS = 1000L     private const val RECONNECT_MAX_MS = 15_000
findfamily/AGENTS.md
diff --git a/findfamily/AGENTS.md b/findfamily/AGENTS.mdindex eb599cdcd0..1b580e4308 100644--- a/findfamily/AGENTS.md+++ b/findfamily/AGENTS.md@@ -11,6 +11,9 @@ _Install: ./install findfamily (dev by default)._ - Metadata: metadata_data/findfamily.md (present) - Rust: no / screenshotTest: yes +### Relay server (backend, outside this repo)+WebSocket relay host migrated from `wss://findfamily.cc/api/ws` to `wss://api.maproj.org/api/ws` (same Cloudflare FIRST_PARTY pins; `findfamily.cc` remains valid for backward compatibility). Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Live SSH: `ssh [email protected]`. Full details: root `AGENTS.md` → "Backend server (outside this repo)".+ ## Overview **Purpose:** End-to-end encrypted location sharing for family and friends — no emails, phone numbers, or personal info required. Requires internet. **Key features:**
findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.ktindex 837456497c..9e5902e473 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/MainActivity.kt@@ -73,7 +73,8 @@ class MainActivity : MaActivity() {      override fun onCreateBeforeContent() {         deepLinkAddInvite.value = parseAddDeepLink(intent)-        // FIRST_PARTY: api.maproj.org + data.maproj.org + findfamily.cc (Cloudflare ISRG+GTS)+        // FIRST_PARTY: api.maproj.org + data.maproj.org (Cloudflare ISRG+GTS);+        // findfamily.cc relay migrated to api.maproj.org — same pins cover both.         NetworkClient.init(this, TrustBundle.FIRST_PARTY)     } 
findfamily/src/main/java/com/vayunmathur/findfamily/util/Networking.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/util/Networking.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/util/Networking.ktindex 2ee1458ec6..542c21c5fc 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/util/Networking.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/util/Networking.kt@@ -52,7 +52,9 @@ object Networking {     /**      * Base for recipient share links (`$SHARE_BASE/<base26-id>#s=<seed>`).      * Served by the same `/view/:id` route that `findfamily.cc` serves, so-     * links minted on either host resolve identically.+     * links minted on either host resolve identically. Host migrated from+     * findfamily.cc to api.maproj.org; findfamily.cc remains valid for+     * backward compatibility during the transition.      */     internal const val SHARE_BASE = "https://api.maproj.org/view" @@ -212,7 +214,7 @@ object Networking {     // flags: bit0 = kind (0 location, 1 uwb). KEYRESP status: 0 none, 1 classic, 2 pqc.     // ---------------------------------------------------------------- -    private const val WS_URL = "wss://findfamily.cc/api/ws"+    private const val WS_URL = "wss://api.maproj.org/api/ws"      internal const val WS_OP_SUB: Byte = 0x01     private const val WS_OP_PUB: Byte = 0x02
games/voxels/AGENTS.md
diff --git a/games/voxels/AGENTS.md b/games/voxels/AGENTS.mdindex 335bc8191c..0020f942c3 100644--- a/games/voxels/AGENTS.md+++ b/games/voxels/AGENTS.md@@ -11,6 +11,9 @@ _Install: ./install games/voxels (dev by default)._ - Metadata: metadata_data/games-voxels.md (present) - Rust: yes / screenshotTest: hand-committed +### Relay server (backend, outside this repo)+Host migrated from `findfamily.cc` to `api.maproj.org` (same Cloudflare FIRST_PARTY pins; `findfamily.cc` remains valid for backward compatibility). Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Live SSH: `ssh [email protected]`. Env template: `../location_share_server/.env.example` (copy to `.env`, never commit secrets). Full details: root `AGENTS.md` → "Backend server (outside this repo)".+ ## Overview **Purpose:** Voxel sandbox on a hand-written Rust + Vulkan engine — infinite procedural worlds (25 biomes, villages), crafting/fishing/trading, saves, optional E2EE multiplayer through an untrusted relay. 19 languages. **NOT a standard MA game:** `ui/` is thin Compose chrome (menus, inventory, hotbar, joystick) over `VoxelSurfaceView`; the world, physics and rendering live in Rust behind `platform/VoxelsNative`. Multiplayer sync (`network/VoxelsSync`) reuses the everysync E2EE-relay pattern.
games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.ktindex 80befeb72f..1d92002100 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/network/VoxelsSync.kt@@ -33,7 +33,9 @@ import kotlin.io.encoding.Base64  * This is the voxels twin of [com.vayunmathur.office.util.OfficeSync]: same untrusted-relay model  * (a dumb append-only log keyed by string channels over `/register|/getkey|/append|/pull` plus a  * WebSocket), same PQC identity + AES-256-GCM content encryption. All confidentiality, authenticity- * and authorization are enforced client-side; the relay only ever sees ciphertext.+ * and authorization are enforced client-side; the relay only ever sees ciphertext. Host migrated+ * from findfamily.cc to api.maproj.org; findfamily.cc remains valid for backward compatibility+ * during the transition.  *  * Channels used per world:  *  - `world:<id>`     — the authoritative op/snapshot log (host writes snapshots, clients write intents)@@ -45,8 +47,8 @@ import kotlin.io.encoding.Base64 // Sync protocol surface: one function per endpoint/operation by design. @Suppress("TooManyFunctions") object VoxelsSync {-    private const val URL = "https://findfamily.cc/voxels"-    private const val WS_URL = "wss://findfamily.cc/voxels/ws"+    private const val URL = "https://api.maproj.org/voxels"+    private const val WS_URL = "wss://api.maproj.org/voxels/ws"     private const val HTTP_OK = 200     private const val RECONNECT_INITIAL_MS = 1000L     private const val RECONNECT_MAX_MS = 15_000
library/everysync-core/AGENTS.md
diff --git a/library/everysync-core/AGENTS.md b/library/everysync-core/AGENTS.mdindex 4286e9ae4a..4590da7b8e 100644--- a/library/everysync-core/AGENTS.md+++ b/library/everysync-core/AGENTS.md@@ -12,9 +12,12 @@  ## Overview **Purpose:** Shared KMP sync brain for the EverySync E2EE relay protocol — merge, vault policy, DTOs, formats. No Android API in commonMain; platform coupling behind expect/actual (`RelayTransport`, `SecureStore`, `SyncScheduler`, `SyncSink`, `AesGcm`, `SyncDigest`).-**Invariants (verbatim from the Android impl):** a failed pull returns null = abort, never empty; only explicit tombstones delete; vault keys never user-visible. Relay contract: `https://findfamily.cc/personal` + `wss://…/ws`, `POST /register|/getkey|/append|/pull`.+**Invariants (verbatim from the Android impl):** a failed pull returns null = abort, never empty; only explicit tombstones delete; vault keys never user-visible. Relay contract: `https://api.maproj.org/personal` + `wss://api.maproj.org/personal/ws`, `POST /register|/getkey|/append|/pull`. Host migrated from findfamily.cc; findfamily.cc remains valid for backward compatibility during the transition. **Gotchas:** never depend on `:library:log` / `:library:network` / `:library:room` from commonMain (Android-only, no common variant); FIRST_PARTY pinning DERs are copied by `syncCaResources` into `src/commonMain/resources/ca/` (gitignored build output) and loaded at runtime by the OkHttp actuals. +### Relay server (backend, outside this repo)+Relay contract host migrated from `https://findfamily.cc/personal` to `https://api.maproj.org/personal` (same Cloudflare FIRST_PARTY pins; `findfamily.cc` remains valid for backward compatibility). Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Live SSH: `ssh [email protected]`. Full details: root `AGENTS.md` → "Backend server (outside this repo)".+ ## Verify (this module only) ``` ./gradlew :library:everysync-core:compileKotlinJvm
library/everysync-core/LIVE_RELAY_CONFORMANCE.md
diff --git a/library/everysync-core/LIVE_RELAY_CONFORMANCE.md b/library/everysync-core/LIVE_RELAY_CONFORMANCE.mdindex b825092d34..fc4104be6e 100644--- a/library/everysync-core/LIVE_RELAY_CONFORMANCE.md+++ b/library/everysync-core/LIVE_RELAY_CONFORMANCE.md@@ -84,7 +84,7 @@ Channel names (`RelayContract.kt`): records `passwords:<vault>` /  | Step | Date | Relay build | Pass? | Notes | | ---- | ---- | ----------- | ----- | ----- |-| 1 register/getkey | 2026-10-18 | staging `https://findfamily.cc/personal` → HTTP 404 `Not Found` on all `/personal/*` routes (host serves static 200 at `/`) | BLOCKED | `POST /register` → 404 body=`Not Found` (also via pwsh `Invoke-WebRequest`, GET `/personal` → 404, trailing-slash + plain-HTTP variants → 404). `JvmRelayTransport.init()` false on both A+B. Runner: `LiveRelayConformanceTest` step 1 BLOCKED. |+| 1 register/getkey | 2026-10-18 | staging `https://api.maproj.org/personal` → HTTP 404 `Not Found` on all `/personal/*` routes (host serves static 200 at `/`) | BLOCKED | `POST /register` → 404 body=`Not Found` (also via pwsh `Invoke-WebRequest`, GET `/personal` → 404, trailing-slash + plain-HTTP variants → 404). `JvmRelayTransport.init()` false on both A+B. Runner: `LiveRelayConformanceTest` step 1 BLOCKED. | | 2 append/pull | 2026-10-18 | same 404 staging | BLOCKED | No channel reachable; step never executed. Runner step 2 BLOCKED with the same 404 evidence. | | 3 B64 AES shape | 2026-10-18 | same 404 staging (relay half) | partial — local half PASS | Local half genuinely executed+asserted with JVM `AesGcm`: IV-prepended `[12B iv][ct\|\|tag]` (pt+28B), random IV (two encryptions differ, both decrypt), B64 envelope round-trip (runner step 3-local PASS). Relay half BLOCKED (no `pullRaw` possible). | | 4 roster/epoch | 2026-10-18 | same 404 staging | BLOCKED | Never executed against staging; runner step 4 BLOCKED. Scripted: roster editor + garbage-skip, `rotateKey` → epoch 1 K2, epoch isolation (runner `phaseRosterEpoch`). |
library/everysync-core/src/androidMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.kt
diff --git a/library/everysync-core/src/androidMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.kt b/library/everysync-core/src/androidMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.ktindex 1226f4791b..6cb12eb3fe 100644--- a/library/everysync-core/src/androidMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.kt+++ b/library/everysync-core/src/androidMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.kt@@ -21,7 +21,9 @@ import javax.net.ssl.X509TrustManager  /**  * `RelayHttpClient` over OkHttp3 with FIRST_PARTY pinning (ISRG X1/X2 +- * GTS R1-R4 for `findfamily.cc`).+ * GTS R1-R4 for `api.maproj.org`). Relay hosts migrated from findfamily.cc+ * to api.maproj.org; same Cloudflare pins cover both — findfamily.cc remains+ * valid for backward compatibility during the transition.  *  * TWIN: `jvmMain/.../OkHttpRelayClient.kt` is the same file for desktop JVM  * (classloader resources + OkHttp are identical on both). Keep them in sync;@@ -90,8 +92,11 @@ class OkHttpRelayClient private constructor( }  /**- * FIRST_PARTY pinning roots (ISRG X1/X2 + GTS R1-R4) for `findfamily.cc`,- * copied by `syncCaResources` into `src/commonMain/resources/ca/`.+ * FIRST_PARTY pinning roots (ISRG X1/X2 + GTS R1-R4) for `api.maproj.org`.+ * Relay hosts migrated from findfamily.cc to api.maproj.org; same Cloudflare+ * pins cover both — findfamily.cc remains valid for backward compatibility+ * during the transition. Copied by `syncCaResources` into+ * `src/commonMain/resources/ca/`.  */ object FirstPartyPins {     val fileNames = listOf(
library/everysync-core/src/commonMain/kotlin/com/vayunmathur/everysync/core/network/RelayContract.kt
diff --git a/library/everysync-core/src/commonMain/kotlin/com/vayunmathur/everysync/core/network/RelayContract.kt b/library/everysync-core/src/commonMain/kotlin/com/vayunmathur/everysync/core/network/RelayContract.ktindex 1ed07280fb..c6c0916788 100644--- a/library/everysync-core/src/commonMain/kotlin/com/vayunmathur/everysync/core/network/RelayContract.kt+++ b/library/everysync-core/src/commonMain/kotlin/com/vayunmathur/everysync/core/network/RelayContract.kt@@ -1,8 +1,11 @@ package com.vayunmathur.everysync.core.network -/** Relay service endpoints. Contract reference: the Android `RelaySync` transport. */-const val RELAY_BASE_URL = "https://findfamily.cc/personal"-const val RELAY_WS_URL = "wss://findfamily.cc/personal/ws"+/** Relay service endpoints. Contract reference: the Android `RelaySync` transport.+ *  Host migrated from findfamily.cc to api.maproj.org (same Cloudflare FIRST_PARTY pins);+ *  old findfamily.cc hostnames remain valid for backward compatibility during the transition.+ */+const val RELAY_BASE_URL = "https://api.maproj.org/personal"+const val RELAY_WS_URL = "wss://api.maproj.org/personal/ws"  /** Channel name for a vault's record log, e.g. `passwords:<vaultId>`. */ fun recordChannel(dataType: String, vaultId: String): String = "$dataType:$vaultId"
library/everysync-core/src/commonTest/kotlin/com/vayunmathur/everysync/core/network/RelayConformanceTest.kt
diff --git a/library/everysync-core/src/commonTest/kotlin/com/vayunmathur/everysync/core/network/RelayConformanceTest.kt b/library/everysync-core/src/commonTest/kotlin/com/vayunmathur/everysync/core/network/RelayConformanceTest.ktindex aad9639684..185292435f 100644--- a/library/everysync-core/src/commonTest/kotlin/com/vayunmathur/everysync/core/network/RelayConformanceTest.kt+++ b/library/everysync-core/src/commonTest/kotlin/com/vayunmathur/everysync/core/network/RelayConformanceTest.kt@@ -21,8 +21,9 @@ import kotlin.io.encoding.Base64  * the three invariants (null-on-failed-pull abort, tombstone-only delete  * lives in RelayMerge tests, keys never appear in share links).  *- * Live-relay conformance (against staging `findfamily.cc/personal`) reuses- * these same assertions with a Ktor `RelayTransport` actual — see Phase 1F.+ * Live-relay conformance (against staging `api.maproj.org/personal`, migrated+ * from findfamily.cc — findfamily.cc remains valid for backward compatibility)+ * reuses these same assertions with a Ktor `RelayTransport` actual — see Phase 1F.  */ class RelayConformanceTest { 
library/everysync-core/src/jvmMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.kt
diff --git a/library/everysync-core/src/jvmMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.kt b/library/everysync-core/src/jvmMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.ktindex 5dd62ea096..f16324fb8c 100644--- a/library/everysync-core/src/jvmMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.kt+++ b/library/everysync-core/src/jvmMain/kotlin/com/vayunmathur/everysync/core/network/OkHttpRelayClient.kt@@ -21,7 +21,9 @@ import javax.net.ssl.X509TrustManager  /**  * `RelayHttpClient` over OkHttp3 with FIRST_PARTY pinning (ISRG X1/X2 +- * GTS R1-R4 for `findfamily.cc`).+ * GTS R1-R4 for `api.maproj.org`). Relay hosts migrated from findfamily.cc+ * to api.maproj.org; same Cloudflare pins cover both — findfamily.cc remains+ * valid for backward compatibility during the transition.  *  * TWIN: `androidMain/.../OkHttpRelayClient.kt` is the same file for Android  * (classloader resources + OkHttp are identical on both). Keep them in sync;@@ -90,8 +92,11 @@ class OkHttpRelayClient private constructor( }  /**- * FIRST_PARTY pinning roots (ISRG X1/X2 + GTS R1-R4) for `findfamily.cc`,- * copied by `syncCaResources` into `src/commonMain/resources/ca/`.+ * FIRST_PARTY pinning roots (ISRG X1/X2 + GTS R1-R4) for `api.maproj.org`.+ * Relay hosts migrated from findfamily.cc to api.maproj.org; same Cloudflare+ * pins cover both — findfamily.cc remains valid for backward compatibility+ * during the transition. Copied by `syncCaResources` into+ * `src/commonMain/resources/ca/`.  */ object FirstPartyPins {     val fileNames = listOf(
library/everysync-core/src/jvmTest/kotlin/com/vayunmathur/everysync/core/network/LiveRelayConformanceTest.kt
diff --git a/library/everysync-core/src/jvmTest/kotlin/com/vayunmathur/everysync/core/network/LiveRelayConformanceTest.kt b/library/everysync-core/src/jvmTest/kotlin/com/vayunmathur/everysync/core/network/LiveRelayConformanceTest.ktindex ceb12a96c0..bfc61a6345 100644--- a/library/everysync-core/src/jvmTest/kotlin/com/vayunmathur/everysync/core/network/LiveRelayConformanceTest.kt+++ b/library/everysync-core/src/jvmTest/kotlin/com/vayunmathur/everysync/core/network/LiveRelayConformanceTest.kt@@ -32,7 +32,8 @@ import kotlin.test.assertTrue  * Runs the checklist with the JVM actuals ([JvmRelayTransport] + [JvmPqcCrypto]  * + file-backed [JvmFileSecureStore] identity stores under fresh temp dirs) as  * a two-device pair (A = owner, B = joiner) in-process against staging- * `https://findfamily.cc/personal`. Re-run with:+ * `https://api.maproj.org/personal` (migrated from findfamily.cc;+ * findfamily.cc remains valid for backward compatibility). Re-run with:  *  * `./gradlew :library:everysync-core:jvmTest --tests  * "com.vayunmathur.everysync.core.network.LiveRelayConformanceTest"`@@ -484,7 +485,7 @@ class LiveRelayConformanceTest {             "BLOCKED=${verdicts.count { it.status == "BLOCKED" }} " +             "INFO=${verdicts.count { it.status == "INFO" }})")         println("remaining manual steps for a human with two devices:")-        println("1. if any step is BLOCKED on relay 404: redeploy the relay at /personal/*, then re-run this test")+        println("1. if any step is BLOCKED on relay 404: redeploy the relay at /personal/* on api.maproj.org (or findfamily.cc for backward compatibility), then re-run this test")         println("2. physical pair: install on A+B, init (record both device ids), A creates vault, A invites B via inbox, B pulls invite")         println("3. on B: verify records decrypt, share link shows ids only, kill-network pull aborts the cycle")         println("4. delete a note on A, sync, pull on B: confirm deleted=true tombstone arrives (never a silent drop)")
library/network/AGENTS.md
diff --git a/library/network/AGENTS.md b/library/network/AGENTS.mdindex 01a6e72b0d..935687ec35 100644--- a/library/network/AGENTS.md+++ b/library/network/AGENTS.md@@ -10,6 +10,9 @@ - Metadata: metadata_data/library-network.md (absent — libraries have none by design) - Rust: no / screenshotTest: no +### Relay server (backend, outside this repo)+Relay hosts migrated from `findfamily.cc` to `api.maproj.org` (same Cloudflare FIRST_PARTY pins; `findfamily.cc` remains valid for backward compatibility). `FIRST_PARTY` bundle pins cover both hosts. Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Live SSH: `ssh [email protected]`. Full details: root `AGENTS.md` → "Backend server (outside this repo)".+ ## Overview **Purpose:** The ONLY network path in the repo — pinned-TLS HTTP engines + WebSocket + connectivity monitoring. Apps call `NetworkClient.init(context, TrustBundle.*)` first, then go through the engines; never raw OkHttp, never `TrustAll` (that lives in apps' dev-only code, never here). **How to use:** `NetworkClient.init()` in `MainActivity.onCreateBeforeContent` with the narrowest bundle (`FIRST_PARTY` own relay / `STANDARD` public APIs / `EXTENDED` + `ESIM` special hosts / `SYSTEM` user-entered hosts like web browser). Requests via `HttpUrlEngine`/`PooledHttpEngine` (Rust `NativeHttpBridge`); pins in `BundledTrust` + `assets/ca/`; offline UI via `util/ConnectivityMonitor` (+ `ConnectivityCompose` banner in `:library:ui`).
library/network/src/main/java/com/vayunmathur/library/network/TrustBundle.kt
diff --git a/library/network/src/main/java/com/vayunmathur/library/network/TrustBundle.kt b/library/network/src/main/java/com/vayunmathur/library/network/TrustBundle.ktindex b4a3a9e5a6..8ac46acf0b 100644--- a/library/network/src/main/java/com/vayunmathur/library/network/TrustBundle.kt+++ b/library/network/src/main/java/com/vayunmathur/library/network/TrustBundle.kt@@ -5,8 +5,9 @@ package com.vayunmathur.library.network  * `assets/ca/`.  SYSTEM means "use platform default" (null factory) — needed for  * user-supplied hosts (vpn, custom email servers, browser).  *- * - FIRST_PARTY: ~6 roots for api.maproj.org, data.maproj.org, findfamily.cc- *   Cloudflare Universal SSL: ISRG X1/X2 + GTS R1-R4 (SSL.com optional, add if observed).+ * - FIRST_PARTY: ~6 roots for api.maproj.org, data.maproj.org+ *   (findfamily.cc relay hosts migrated to api.maproj.org; same Cloudflare+ *   Universal SSL: ISRG X1/X2 + GTS R1-R4). SSL.com optional, add if observed.  * - STANDARD: FIRST_PARTY + DigiCert G2/G3, Baltimore CyberTrust, Amazon Root CA 1-4,  *   Sectigo AAA, USERTrust RSA, GoDaddy Root G2 — covers F-Droid (ISRG), GitHub  *   (DigiCert), Play/Aurora (Google GTS), DuckDuckGo (DigiCert), open-meteo (ISRG),
maps/src/main/java/com/vayunmathur/maps/data/SpecificFeature.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/data/SpecificFeature.kt b/maps/src/main/java/com/vayunmathur/maps/data/SpecificFeature.ktindex 217d9becae..711c671fed 100644--- a/maps/src/main/java/com/vayunmathur/maps/data/SpecificFeature.kt+++ b/maps/src/main/java/com/vayunmathur/maps/data/SpecificFeature.kt@@ -80,6 +80,10 @@ sealed interface SpecificFeature {         val poiType: Int? = null,         /** Street address from the OSM `addr:*` tags, when we have them. */         val address: String? = null,+        /** Offline rating, review count and review summary from the archive, when baked in. */+        val rating: Double? = null,+        val reviewCount: Int? = null,+        val reviewSummary: String? = null,     ) : RoutableFeature     @Serializable     data class Route(val waypoints: List<RoutableFeature?>) : SpecificFeature@@ -120,6 +124,9 @@ suspend fun osmPlace(         position = position,         poiType = poiType,         address = attrs?.address,+        rating = attrs?.rating,+        reviewCount = attrs?.reviewCount,+        reviewSummary = attrs?.reviewSummary,     ) } 
maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.kt b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.ktindex 6e4da6abcf..83119422f8 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.kt@@ -117,6 +117,7 @@ fun PlaceSheet(         menu = null,         openingHours = feature.openingHours,         address = feature.address,+        reviewSummary = feature.reviewSummary,         onDepartures = onDepartures,     ) }@@ -160,6 +161,7 @@ fun PlaceSheet(     menu = null,     openingHours = feature.openingHours,     address = feature.address,+    reviewSummary = feature.reviewSummary,     onDepartures = onDepartures, ) @@ -171,6 +173,7 @@ private fun PlaceSheetContent(     menu: String?,     openingHours: OpeningHours?,     address: String? = null,+    reviewSummary: String? = null,     onDepartures: (() -> Unit)? = null, ) {     val context = LocalContext.current@@ -203,6 +206,7 @@ private fun PlaceSheetContent(         }         address?.let { AddressRow(it) }         openingHours?.let { OsmHours(it, todayOverride) }+        reviewSummary?.let { ReviewSummaryRow(it) }     } } @@ -287,6 +291,25 @@ private fun AddressRow(address: String) {     } } +/** The archive's short AI summary of the place's reviews, available offline. */+@Composable+private fun ReviewSummaryRow(summary: String) {+    Card {+        ListItem({+            Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {+                Text(+                    stringResource(R.string.review_summary_label),+                    style = MaterialTheme.typography.labelMedium,+                    color = MaterialTheme.colorScheme.onSurfaceVariant,+                )+                Text(summary, style = MaterialTheme.typography.bodyMedium)+            }+        }, leadingContent = {+            IconStar(tint = MaterialTheme.colorScheme.tertiary)+        }, colors = ListItemDefaults.colors(Color.Transparent))+    }+}+ /**  * Five stars, filled up to [rating].  *
maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.kt b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.ktindex 83d8fb7471..28ced75f81 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.kt@@ -186,7 +186,7 @@ private fun PlaceSheetHeaderContent(     val orderDeepLink by rememberOrderDeepLink(context, feature, poi?.category)      Column(modifier, verticalArrangement = Arrangement.spacedBy(12.dp)) {-        PlaceHeader(feature.name, poi)+        PlaceHeader(feature.name, poi, feature as? SpecificFeature.GenericPlace)         PlaceActionRow(             feature = feature,             // OSM first, Google as the fallback. These used to be handed the OSM@@ -255,7 +255,12 @@ internal fun resolvePoiSection(selected: PoiSection, poi: GooglePoiInfo?): PoiSe     if (selected in poiTabs(poi)) selected else PoiSection.DETAILS  @Composable-private fun PlaceHeader(name: String, poi: GooglePoiInfo?, modifier: Modifier = Modifier) {+private fun PlaceHeader(+    name: String,+    poi: GooglePoiInfo?,+    offline: SpecificFeature.GenericPlace?,+    modifier: Modifier = Modifier,+) {     Column(modifier, verticalArrangement = Arrangement.spacedBy(4.dp)) {         Text(name, style = MaterialTheme.typography.titleLarge) @@ -265,11 +270,15 @@ private fun PlaceHeader(name: String, poi: GooglePoiInfo?, modifier: Modifier =             Text(subtitle, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)         } -        poi?.rating?.let { rating ->+        // The archive's rating first, so it shows offline and with Google turned off.+        // Rating and count come from the same source, never one from each.+        val (rating, reviewCount) = offline?.rating?.let { it to offline.reviewCount }+            ?: (poi?.rating to poi?.reviewCount)+        rating?.let {             Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {-                RatingStars(rating)+                RatingStars(it)                 Text(-                    stringResource(R.string.reviews_summary, rating, poi.reviewCount ?: 0),+                    stringResource(R.string.reviews_summary, it, reviewCount ?: 0),                     style = MaterialTheme.typography.bodyMedium,                     color = MaterialTheme.colorScheme.onSurfaceVariant,                 )
maps/src/main/java/com/vayunmathur/maps/util/PoiIndex.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/util/PoiIndex.kt b/maps/src/main/java/com/vayunmathur/maps/util/PoiIndex.ktindex 875859a9e8..c9a8294e65 100644--- a/maps/src/main/java/com/vayunmathur/maps/util/PoiIndex.kt+++ b/maps/src/main/java/com/vayunmathur/maps/util/PoiIndex.kt@@ -149,6 +149,11 @@ object PoiIndex {         val postcode: String? = null,         val cuisine: String? = null,         val wheelchair: String? = null,+        /** Place rating merged in at build time from the external review table, 1.0–5.0. */+        val rating: Double? = null,+        val reviewCount: Int? = null,+        /** A short AI summary of the place's reviews. */+        val reviewSummary: String? = null,     ) {         /**          * The `addr:*` tags as one display line, or null when there are none.@@ -169,7 +174,8 @@ object PoiIndex {          val isEmpty: Boolean             get() = openingHours == null && phone == null && website == null &&-                address == null && cuisine == null && wheelchair == null+                address == null && cuisine == null && wheelchair == null &&+                rating == null && reviewCount == null && reviewSummary == null     }      /**
maps/src/main/java/com/vayunmathur/maps/util/PoiIndexAttrs.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/util/PoiIndexAttrs.kt b/maps/src/main/java/com/vayunmathur/maps/util/PoiIndexAttrs.ktindex e7e67d1732..0b94b8694d 100644--- a/maps/src/main/java/com/vayunmathur/maps/util/PoiIndexAttrs.kt+++ b/maps/src/main/java/com/vayunmathur/maps/util/PoiIndexAttrs.kt@@ -19,6 +19,12 @@ internal const val KEY_CITY = 6 internal const val KEY_POSTCODE = 7 internal const val KEY_CUISINE = 8 internal const val KEY_WHEELCHAIR = 9+internal const val KEY_RATING = 10+internal const val KEY_REVIEW_COUNT = 11+internal const val KEY_REVIEW_SUMMARY = 12++/** The range a place rating can take; anything outside it is a bad value, not a rating. */+private val RATING_RANGE = 1.0..5.0  /** Mask for one unsigned byte read out of the file. */ private const val ATTR_BYTE_MASK = 0xFF@@ -56,7 +62,8 @@ internal fun decodeAttrRecord(buf: MappedByteBuffer, from: Int, to: Int): PoiInd /** Known record keys (unknown ones are stepped over, not decoded). */ private fun isKnownKey(key: Int): Boolean = when (key) {     KEY_OPENING_HOURS, KEY_PHONE, KEY_WEBSITE, KEY_HOUSENUMBER, KEY_STREET,-    KEY_CITY, KEY_POSTCODE, KEY_CUISINE, KEY_WHEELCHAIR -> true+    KEY_CITY, KEY_POSTCODE, KEY_CUISINE, KEY_WHEELCHAIR,+    KEY_RATING, KEY_REVIEW_COUNT, KEY_REVIEW_SUMMARY -> true     else -> false } @@ -71,6 +78,9 @@ private class AttrFields {     var postcode: String? = null     var cuisine: String? = null     var wheelchair: String? = null+    var rating: String? = null+    var reviewCount: String? = null+    var reviewSummary: String? = null      fun set(key: Int, value: String?) {         when (key) {@@ -83,12 +93,18 @@ private class AttrFields {             KEY_POSTCODE -> postcode = value             KEY_CUISINE -> cuisine = value             KEY_WHEELCHAIR -> wheelchair = value+            KEY_RATING -> rating = value+            KEY_REVIEW_COUNT -> reviewCount = value+            KEY_REVIEW_SUMMARY -> reviewSummary = value         }     }      fun build(): PoiIndex.PoiAttributes? {         val decoded = PoiIndex.PoiAttributes(             openingHours, phone, website, houseNumber, street, city, postcode, cuisine, wheelchair,+            rating = rating?.toDoubleOrNull()?.takeIf { it in RATING_RANGE },+            reviewCount = reviewCount?.toIntOrNull()?.takeIf { it > 0 },+            reviewSummary = reviewSummary?.trim()?.ifEmpty { null },         )         return decoded.takeUnless { it.isEmpty }     }
maps/src/main/res/values/strings.xml
diff --git a/maps/src/main/res/values/strings.xml b/maps/src/main/res/values/strings.xmlindex b2a6d8b2d4..99c9fe2d35 100644--- a/maps/src/main/res/values/strings.xml+++ b/maps/src/main/res/values/strings.xml@@ -52,6 +52,9 @@     <!-- Place detail: Rating summary. %1$s=stars e.g. "4.5", %2$s=review count e.g. "128" -->     <string name="reviews_summary"><xliff:g id="rating" example="4.5">%1$s</xliff:g> stars | <xliff:g id="review_count" example="128">%2$s</xliff:g> reviews</string> +    <!-- Place detail: Label above a short summary of what reviewers say about the place. Noun phrase. -->+    <string name="review_summary_label">Review summary</string>+     <!-- Place detail: Fuel price section header, shown for gas stations only. Noun phrase. -->     <string name="poi_fuel_price_header">Fuel price</string>     <!-- Place detail: Label of the first tab under the action buttons, holding the
maps/src/test/java/com/vayunmathur/maps/util/PoiIndexTest.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/util/PoiIndexTest.kt b/maps/src/test/java/com/vayunmathur/maps/util/PoiIndexTest.ktindex e77cd6bf6a..a182b4a300 100644--- a/maps/src/test/java/com/vayunmathur/maps/util/PoiIndexTest.kt+++ b/maps/src/test/java/com/vayunmathur/maps/util/PoiIndexTest.kt@@ -49,6 +49,8 @@ class PoiIndexTest {     private fun load(         pois: List<Poi>,         attrs: Map<Int, String> = emptyMap(),+        /** Extra `(key, value)` fields per ordinal, written after the phone. */+        attrFields: Map<Int, List<Pair<Int, String>>> = emptyMap(),         attrSlots: Int? = null,         /** Whether to write `poi_spatial.bin` / `poi_name_index.bin` at all. */         sideFiles: Boolean = true,@@ -90,9 +92,9 @@ class PoiIndexTest {         }         File(dir, PoiIndex.INDEX_FILE).writeBytes(index.array()) -        if (attrs.isNotEmpty() || attrSlots != null) {+        if (attrs.isNotEmpty() || attrFields.isNotEmpty() || attrSlots != null) {             File(dir, PoiIndex.ATTRS_FILE)-                .writeBytes(attrsFile(attrSlots ?: sorted.size, attrs))+                .writeBytes(attrsFile(attrSlots ?: sorted.size, attrs, attrFields))         }         if (sideFiles) {             val grid = spatialFile(sorted, spatialRecords ?: sorted.size)@@ -196,17 +198,24 @@ class PoiIndexTest {      * disagrees with the index — the mismatch the reader has to refuse, since the join is      * positional and a stale sidecar would hand every place someone else's phone number.      */-    private fun attrsFile(slots: Int, phones: Map<Int, String>): ByteArray {+    private fun attrsFile(+        slots: Int,+        phones: Map<Int, String>,+        extra: Map<Int, List<Pair<Int, String>>> = emptyMap(),+    ): ByteArray {         val blob = java.io.ByteArrayOutputStream()         val offsets = IntArray(slots) { -1 }         for (ordinal in 0 until slots) {-            val phone = phones[ordinal] ?: continue+            val fields = listOfNotNull(phones[ordinal]?.let { 2 to it }) + extra[ordinal].orEmpty() // 2 = KEY_PHONE+            if (fields.isEmpty()) continue             offsets[ordinal] = blob.size()-            val value = phone.toByteArray(Charsets.UTF_8)-            val body = ByteBuffer.allocate(3 + value.size).order(ByteOrder.LITTLE_ENDIAN)-            body.put(2)                        // KEY_PHONE-            body.putShort(value.size.toShort())-            body.put(value)+            val encoded = fields.map { (key, v) -> key to v.toByteArray(Charsets.UTF_8) }+            val body = ByteBuffer.allocate(encoded.sumOf { 3 + it.second.size }).order(ByteOrder.LITTLE_ENDIAN)+            for ((key, value) in encoded) {+                body.put(key.toByte())+                body.putShort(value.size.toShort())+                body.put(value)+            }             blob.write(ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN)                 .putShort(body.capacity().toShort()).array())             blob.write(body.array())@@ -457,6 +466,40 @@ class PoiIndexTest {         )     } +    @Test+    fun `review fields decode beside the OSM tags and on their own`() {+        val recs = load(+            listOf(+                Poi(377_749_000, -1_224_194_000, 1, "Diner"),+                Poi(377_759_000, -1_224_194_000, 1, "Bakery"),+            ),+            attrs = emptyMap(),+        )+        val diner = recs.indexOfFirst { it.name == "Diner" }+        val bakery = recs.indexOfFirst { it.name == "Bakery" }+        load(+            recs,+            attrs = mapOf(diner to "+1-555-DINER"),+            attrFields = mapOf(+                diner to listOf(KEY_RATING to "4.3", KEY_REVIEW_COUNT to "1234", KEY_REVIEW_SUMMARY to "Huge portions."),+                // Out-of-range values are dropped, not shown; the summary still stands alone.+                bakery to listOf(KEY_RATING to "9.9", KEY_REVIEW_COUNT to "-4", KEY_REVIEW_SUMMARY to "Fresh croissants."),+            ),+        )++        val d = PoiIndex.attributesNear(37.7749, -122.4194, "Diner")+        assertEquals("+1-555-DINER", d?.phone)+        assertEquals(4.3, d?.rating)+        assertEquals(1234, d?.reviewCount)+        assertEquals("Huge portions.", d?.reviewSummary)++        val b = PoiIndex.attributesNear(37.7759, -122.4194, "Bakery")+        assertNull(b?.rating)+        assertNull(b?.reviewCount)+        assertEquals("Fresh croissants.", b?.reviewSummary)+        assertFalse(b?.isEmpty ?: true, "a summary alone is a record")+    }+     @Test     fun `attributesNear returns null when nothing nearby carries attributes`() {         load(
office/AGENTS.md
diff --git a/office/AGENTS.md b/office/AGENTS.mdindex 5aa78dbca4..a812e934c2 100644--- a/office/AGENTS.md+++ b/office/AGENTS.md@@ -11,6 +11,9 @@ _Install: ./install office (dev by default)._ - Metadata: metadata_data/office.md (present) - Rust: yes / screenshotTest: yes +### Relay server (backend, outside this repo)+Host migrated from `findfamily.cc` to `api.maproj.org` (same Cloudflare FIRST_PARTY pins; `findfamily.cc` remains valid for backward compatibility). Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Live SSH: `ssh [email protected]`. Env template: `../location_share_server/.env.example` (copy to `.env`, never commit secrets). Full details: root `AGENTS.md` → "Backend server (outside this repo)".+ ## Overview **Purpose:** Document viewer/editor for ODF (odt/ods/odp) and Microsoft (docx/xlsx/pptx) files, with E2EE collaboration over a dumb relay. Internet only for collaboration. **Key features:**
office/src/main/java/com/vayunmathur/office/util/OfficeSync.kt
diff --git a/office/src/main/java/com/vayunmathur/office/util/OfficeSync.kt b/office/src/main/java/com/vayunmathur/office/util/OfficeSync.ktindex 11ae5f7e70..833ab41007 100644--- a/office/src/main/java/com/vayunmathur/office/util/OfficeSync.kt+++ b/office/src/main/java/com/vayunmathur/office/util/OfficeSync.kt@@ -28,7 +28,9 @@ import kotlinx.serialization.json.Json import kotlin.io.encoding.Base64  object OfficeSync {-    private const val URL = "https://findfamily.cc/office"+    // Host migrated from findfamily.cc to api.maproj.org; findfamily.cc remains valid+    // for backward compatibility during the transition. Same Cloudflare FIRST_PARTY pins.+    private const val URL = "https://api.maproj.org/office"     private const val TAG = "OfficeSync"     private const val HTTP_OK = 200     private val HTTP_SUCCESS = 200..299@@ -153,7 +155,7 @@ object OfficeSync {      // --- Live sync + presence over WebSocket (Android-only WebSocketClient) --- -    private const val WS_URL = "wss://findfamily.cc/office/ws"+    private const val WS_URL = "wss://api.maproj.org/office/ws"     @Volatile private var wsSession: WsSession? = null     private var liveJob: Job? = null     private var liveChannel: String? = null
scripts/maps/build_graph.ps1
diff --git a/scripts/maps/build_graph.ps1 b/scripts/maps/build_graph.ps1index 346022a0de..23daddcd78 100644--- a/scripts/maps/build_graph.ps1+++ b/scripts/maps/build_graph.ps1@@ -57,6 +57,9 @@ #   inputs/world.transit is required #   unless -NoTransit is passed, which skips GTFS entirely (empty routes + #   no --transit sidecar, as if 0 feeds).+#   inputs/reviews_archive.tsv is required: its per-place rating, review count+#   and summary are always merged into the POI attribute sidecar by OSM element+#   (see analysis/osm_reviews/summarize_reviews.py). # # Requires: cargo (https://rustup.rs). A state-sized extract needs roughly # 10 GB of RAM; any build wants ~6x the .pbf in free disk (checked up front),@@ -205,6 +208,7 @@ $BuildRegion = if ($Region -eq "caonly" -or $Region -eq "naonly") { "world" } el $Coastline    = Join-Path $PSScriptRoot "inputs/coastline.shp" $WorldTransit = Join-Path $PSScriptRoot "inputs/world.transit" $Dem          = Join-Path $PSScriptRoot "inputs/world.mdem"+$Reviews      = Join-Path $PSScriptRoot "inputs/reviews_archive.tsv" function Find-Built([string] $crate, [string] $name) {     # The tool crates are root-workspace members (no [workspace] table), so     # `cargo build` links into the WORKSPACE target dir (repo root@@ -243,7 +247,7 @@ function Size([double] $b) {  # --- inputs ------------------------------------------------------------- # -NoTransit drops the GTFS inputs entirely (no world.transit, no manifest).-$pairs = @(@($Pbf, "pbf"), @($Coastline, "coastline"), @($Dem, "dem"))+$pairs = @(@($Pbf, "pbf"), @($Coastline, "coastline"), @($Dem, "dem"), @($Reviews, "reviews")) if (-not $NoTransit) { $pairs += ,@($WorldTransit, "world.transit") } foreach ($pair in $pairs) {     if (-not (Test-Path $pair[0])) { throw "$($pair[1]) not found: $($pair[0])" }@@ -252,6 +256,7 @@ $Pbf        = (Resolve-Path $Pbf).Path $Coastline  = (Resolve-Path $Coastline).Path $Dem        = (Resolve-Path $Dem).Path $Out        = [System.IO.Path]::GetFullPath($Out)+$Reviews    = (Resolve-Path $Reviews).Path if (-not $NoTransit) {     $WorldTransit = (Resolve-Path $WorldTransit).Path } else {@@ -441,11 +446,16 @@ if ($exit -ne 0) { Write-Host "[5/7] Extracting POI sidecars ($Region) -> $poiDir" New-Item -ItemType Directory -Force -Path $poiDir | Out-Null $poiLog = Join-Path $tmp "poi.log"-& $poiExtract $Pbf `-    --geojson (Join-Path $poiDir "poi.geojsonseq") `-    --names (Join-Path $poiDir "poi_names.bin") `-    --index (Join-Path $poiDir "poi_index.bin") `-    --region $BuildRegion | Tee-Object -FilePath $poiLog+$poiArgs = @(+    $Pbf,+    "--geojson", (Join-Path $poiDir "poi.geojsonseq"),+    "--names", (Join-Path $poiDir "poi_names.bin"),+    "--index", (Join-Path $poiDir "poi_index.bin"),+    "--region", $BuildRegion,+    "--reviews", $Reviews+)+Write-Host "      merging review data from $Reviews"+& $poiExtract @poiArgs | Tee-Object -FilePath $poiLog if ($LASTEXITCODE -ne 0) { throw "poi_extract failed with exit code $LASTEXITCODE" }  # --- [6/7] pack the sidecars onto the tiles archive -> FINAL $Out ----------
scripts/maps/osm_ingest/src/bin/poi_extract.rs
diff --git a/scripts/maps/osm_ingest/src/bin/poi_extract.rs b/scripts/maps/osm_ingest/src/bin/poi_extract.rsindex e37fd8841d..cadccf1971 100644--- a/scripts/maps/osm_ingest/src/bin/poi_extract.rs+++ b/scripts/maps/osm_ingest/src/bin/poi_extract.rs@@ -1,4 +1,4 @@-//! `poi_extract IN.osm.pbf --geojson FILE --names FILE --index FILE [--attrs FILE]`+//! `poi_extract IN.osm.pbf --geojson FILE --names FILE --index FILE [--attrs FILE] [--reviews FILE]` //! //! Replaces `scripts/maps/poi_extract.cpp`. See `osm_ingest::poi_build` for the //! POI type map and the on-disk record layout.@@ -6,7 +6,7 @@ use std::process::ExitCode;  const USAGE: &str = "Usage: poi_extract IN.osm.pbf --geojson FILE --names FILE \-                     --index FILE [--attrs FILE] [--region california|world] [--threads N]";+                     --index FILE [--attrs FILE] [--reviews FILE] [--region california|world] [--threads N]";  fn main() -> ExitCode {     let argv: Vec<String> = std::env::args().skip(1).collect();@@ -22,7 +22,19 @@ fn main() -> ExitCode {         osm_ingest::par::set_threads(n);     } -    match osm_ingest::poi_build::build_with(+    let reviews = match args.reviews.as_deref().map(osm_ingest::poi_reviews::ReviewTable::load) {+        Some(Ok(table)) => {+            println!("Loaded {} review row(s)", table.len());+            Some(table)+        }+        Some(Err(e)) => {+            eprintln!("ERROR: {e}");+            return ExitCode::FAILURE;+        }+        None => None,+    };++    match osm_ingest::poi_build::build_with_reviews(         &args.input,         &args.geojson,         &args.names,@@ -31,6 +43,7 @@ fn main() -> ExitCode {         &args.spatial,         &args.name_index,         args.bbox,+        reviews.as_ref(),     ) {         Ok(stats) => {             println!(@@ -47,6 +60,9 @@ fn main() -> ExitCode {                 "{} POI(s) with attributes, {} unique record(s), {} sidecar byte(s)",                 stats.with_attrs, stats.unique_attrs, stats.attr_bytes             );+            if reviews.is_some() {+                println!("{} POI(s) with review data", stats.with_reviews);+            }             println!(                 "{} populated grid cell(s), {} name index entr(ies)",                 stats.spatial_cells, stats.name_entries
scripts/maps/osm_ingest/src/lib.rs
diff --git a/scripts/maps/osm_ingest/src/lib.rs b/scripts/maps/osm_ingest/src/lib.rsindex cb696f11ff..2369204e66 100644--- a/scripts/maps/osm_ingest/src/lib.rs+++ b/scripts/maps/osm_ingest/src/lib.rs@@ -38,6 +38,7 @@ pub mod pbf_extra; pub mod poi_attrs; pub mod timing; pub mod poi_build;+pub mod poi_reviews; pub mod poi_side; pub mod proto; pub mod region;
scripts/maps/osm_ingest/src/poi_attrs.rs
diff --git a/scripts/maps/osm_ingest/src/poi_attrs.rs b/scripts/maps/osm_ingest/src/poi_attrs.rsindex 0ecf0882ba..4384d8f39e 100644--- a/scripts/maps/osm_ingest/src/poi_attrs.rs+++ b/scripts/maps/osm_ingest/src/poi_attrs.rs@@ -58,6 +58,12 @@ pub const KEY_CITY: u8 = 6; pub const KEY_POSTCODE: u8 = 7; pub const KEY_CUISINE: u8 = 8; pub const KEY_WHEELCHAIR: u8 = 9;+/// Review data merged in from an external table at build time (see+/// [`crate::poi_reviews`]), never from OSM tags. ASCII decimal (`"4.3"`), ASCII+/// integer, and UTF-8 text.+pub const KEY_RATING: u8 = 10;+pub const KEY_REVIEW_COUNT: u8 = 11;+pub const KEY_REVIEW_SUMMARY: u8 = 12;  /// Which OSM tags each key is read from, in the order they are encoded. ///@@ -114,6 +120,28 @@ pub fn encode<'a>(get: impl Fn(&str) -> Option<&'a [u8]>) -> Vec<u8> {     out } +/// Append `(key, value)` fields after an [`encode`]d body.+///+/// `extra` must be ascending by key and every key must sort after the tag keys, so+/// the record stays ascending. Empty values are skipped, and a value that would+/// pass the body ceiling is dropped whole, under the same rules as [`encode`].+pub fn append(mut body: Vec<u8>, extra: &[(u8, &[u8])]) -> Vec<u8> {+    for &(key, value) in extra {+        debug_assert!(key > KEY_WHEELCHAIR, "extra keys must sort after the tag keys");+        if value.is_empty() {+            continue;+        }+        let Ok(len) = u16::try_from(value.len()) else { continue };+        if body.len() + 3 + value.len() > MAX_BODY_BYTES {+            continue;+        }+        body.push(key);+        body.extend_from_slice(&len.to_le_bytes());+        body.extend_from_slice(value);+    }+    body+}+ /// Deduplicating collector for the sidecar. /// /// Holds the blob in memory, which is affordable only because `poi_build` already@@ -375,4 +403,40 @@ mod tests {         let body = encode(tags(&[("phone", ""), ("contact:phone", "+1-555-0100")]));         assert_eq!(fields(&body), vec![(KEY_PHONE, "+1-555-0100".into())]);     }++    #[test]+    fn review_fields_are_appended_after_the_tag_fields() {+        let body = append(+            encode(tags(&[("opening_hours", "24/7"), ("cuisine", "pizza")])),+            &[(KEY_RATING, b"4.3"), (KEY_REVIEW_COUNT, b"1234"), (KEY_REVIEW_SUMMARY, "Crisp crust, quick service.".as_bytes())],+        );+        assert_eq!(+            fields(&body),+            vec![+                (KEY_OPENING_HOURS, "24/7".into()),+                (KEY_CUISINE, "pizza".into()),+                (KEY_RATING, "4.3".into()),+                (KEY_REVIEW_COUNT, "1234".into()),+                (KEY_REVIEW_SUMMARY, "Crisp crust, quick service.".into()),+            ]+        );+    }++    #[test]+    fn review_fields_alone_make_a_record_and_empty_ones_are_skipped() {+        let body = append(Vec::new(), &[(KEY_RATING, b"4.0"), (KEY_REVIEW_COUNT, b""), (KEY_REVIEW_SUMMARY, b"")]);+        assert_eq!(fields(&body), vec![(KEY_RATING, "4.0".into())]);+        assert!(append(Vec::new(), &[(KEY_REVIEW_SUMMARY, b"")]).is_empty());+    }++    #[test]+    fn an_appended_value_past_the_ceiling_is_dropped_whole() {+        let big = "x".repeat(65_000);+        let body = append(+            encode(tags(&[("opening_hours", big.as_str())])),+            &[(KEY_RATING, b"4.5"), (KEY_REVIEW_SUMMARY, "y".repeat(1_000).as_bytes())],+        );+        assert!(body.len() <= MAX_BODY_BYTES);+        assert_eq!(fields(&body).last().unwrap(), &(KEY_RATING, "4.5".into()));+    } }
scripts/maps/osm_ingest/src/poi_build.rs
diff --git a/scripts/maps/osm_ingest/src/poi_build.rs b/scripts/maps/osm_ingest/src/poi_build.rsindex 33d84a9d0b..9ff71b7914 100644--- a/scripts/maps/osm_ingest/src/poi_build.rs+++ b/scripts/maps/osm_ingest/src/poi_build.rs@@ -46,6 +46,7 @@ use crate::names::NamePool; use crate::osm::{self, visit_block, Element, MEMBER_WAY}; use crate::pbf::{self, KIND_NODES, KIND_RELATIONS, KIND_WAYS}; use crate::poi_attrs::AttrPool;+use crate::poi_reviews::{ReviewTable, ELEMENT_NODE, ELEMENT_RELATION, ELEMENT_WAY}; use crate::poi_side; use crate::proto::{Error, Result}; use crate::spatial::spatial_from_e7;@@ -72,6 +73,8 @@ pub struct Stats {     pub spatial_cells: usize,     /// `(record, word)` entries in `poi_name_index.bin`.     pub name_entries: usize,+    /// POIs that matched a row of the `--reviews` table.+    pub with_reviews: usize, }  struct Poi {@@ -149,6 +152,23 @@ pub fn build_with(     spatial: &Path,     name_index: &Path,     bbox: Option<crate::bbox::BBox>,+) -> Result<Stats> {+    build_with_reviews(input, geojson, names, index, attrs, spatial, name_index, bbox, None)+}++/// [`build_with`] plus an external review table whose rows are appended to the+/// matching POIs' attribute records (see [`crate::poi_reviews`]).+#[allow(clippy::too_many_arguments)]+pub fn build_with_reviews(+    input: &Path,+    geojson: &Path,+    names: &Path,+    index: &Path,+    attrs: &Path,+    spatial: &Path,+    name_index: &Path,+    bbox: Option<crate::bbox::BBox>,+    reviews: Option<&ReviewTable>, ) -> Result<Stats> {     // Fail before the three passes rather than after them if an output path is     // unwritable.@@ -297,6 +317,17 @@ pub fn build_with(         pois.len()     ); +    // Before the sort: `pois` is still nodes, then ways, then relations, which is+    // the only place the OSM element type is known.+    let with_reviews = match reviews {+        Some(table) => {+            let n = apply_reviews(&mut pois, from_nodes, from_ways, table);+            println!("{n} POI(s) with review data ({} review row(s) loaded)", table.len());+            n+        }+        None => 0,+    };+     // Morton order, ties broken by osm_id, so both poi_index.bin and the geojson     // are stable across runs.     timer.switch("sort");@@ -317,9 +348,31 @@ pub fn build_with(         attr_bytes: written.attr_bytes,         spatial_cells: written.spatial_cells,         name_entries: written.name_entries,+        with_reviews,     }) } +/// Append each matching review row to its POI's attribute body; returns the match+/// count. `pois[..from_nodes]` are nodes, the next `from_ways` closed ways, the+/// rest relations (whose `osm_id` is stored negated).+fn apply_reviews(pois: &mut [Poi], from_nodes: usize, from_ways: usize, table: &ReviewTable) -> usize {+    let mut matched = 0;+    for (i, p) in pois.iter_mut().enumerate() {+        let (element, id) = if i < from_nodes {+            (ELEMENT_NODE, p.osm_id)+        } else if i < from_nodes + from_ways {+            (ELEMENT_WAY, p.osm_id)+        } else {+            (ELEMENT_RELATION, -p.osm_id)+        };+        if let Some(review) = table.get(element, id) {+            p.attrs = crate::poi_attrs::append(std::mem::take(&mut p.attrs), &review.fields());+            matched += 1;+        }+    }+    matched+}+ fn poi_tags<'a>(t: &osm::Tags<'_, 'a>) -> PoiTags<'a> {     PoiTags {         railway: t.get_str("railway"),
scripts/maps/osm_ingest/src/poi_build_part1.rs
diff --git a/scripts/maps/osm_ingest/src/poi_build_part1.rs b/scripts/maps/osm_ingest/src/poi_build_part1.rsindex 45f908bbf2..0ca5f7b997 100644--- a/scripts/maps/osm_ingest/src/poi_build_part1.rs+++ b/scripts/maps/osm_ingest/src/poi_build_part1.rs@@ -139,10 +139,12 @@ pub struct Args {     pub bbox: Option<crate::bbox::BBox>,     /// `None` leaves the pool at whatever `par::threads()` decides.     pub threads: Option<usize>,+    /// Review table merged into the attribute sidecar (`--reviews FILE`).+    pub reviews: Option<PathBuf>, }  /// `poi_extract IN.osm.pbf --geojson FILE --names FILE --index FILE [--attrs FILE]`-/// `[--spatial FILE] [--name-index FILE] [--region california|na|world] [--threads N]`+/// `[--spatial FILE] [--name-index FILE] [--reviews FILE] [--region california|na|world] [--threads N]` /// /// The optional outputs default to their conventional names beside `--index`, so a /// caller that predates any of them keeps working and still emits them. Making them@@ -157,6 +159,7 @@ pub fn parse_args(args: &[String]) -> std::result::Result<Args, String> {     let mut name_index: Option<PathBuf> = None;     let mut region: Option<crate::region::Region> = None;     let mut threads: Option<usize> = None;+    let mut reviews: Option<PathBuf> = None;     let mut i = 0;     while i < args.len() {         match args[i].as_str() {@@ -175,7 +178,7 @@ pub fn parse_args(args: &[String]) -> std::result::Result<Args, String> {                 region = Some(crate::region::Region::parse(value).map_err(|e| e.0)?);             }             flag @ ("--geojson" | "--names" | "--index" | "--attrs" | "--spatial"-            | "--name-index") => {+            | "--name-index" | "--reviews") => {                 let flag = flag.to_string();                 i += 1;                 let value = args@@ -188,6 +191,7 @@ pub fn parse_args(args: &[String]) -> std::result::Result<Args, String> {                     "--attrs" => attrs = Some(value),                     "--spatial" => spatial = Some(value),                     "--name-index" => name_index = Some(value),+                    "--reviews" => reviews = Some(value),                     _ => index = Some(value),                 }             }@@ -220,5 +224,6 @@ pub fn parse_args(args: &[String]) -> std::result::Result<Args, String> {         name_index,         bbox: region.and_then(|r| r.bbox()),         threads,+        reviews,     }) }
scripts/maps/osm_ingest/src/poi_build_part2.rs
diff --git a/scripts/maps/osm_ingest/src/poi_build_part2.rs b/scripts/maps/osm_ingest/src/poi_build_part2.rsindex 501cb1312e..9cf455ae8c 100644--- a/scripts/maps/osm_ingest/src/poi_build_part2.rs+++ b/scripts/maps/osm_ingest/src/poi_build_part2.rs@@ -258,6 +258,62 @@ mod tests {         assert_eq!(index.len(), stats.records * 14);     } +    /// Review rows join on (element, OSM id) before the Morton sort, and land on the+    /// right ordinal after it. The relation row uses the plain id even though the+    /// POI stores it negated.+    #[test]+    fn review_rows_join_by_element_and_osm_id() {+        use crate::poi_attrs::{KEY_RATING, KEY_REVIEW_COUNT, KEY_REVIEW_SUMMARY, KEY_CUISINE};+        let (pbf_path, dir) = testpbf::write_sample("poi_reviews_join");+        let table = crate::poi_reviews::ReviewTable::parse(&format!(+            "node\t{}\t4.3\t120\tGreat coffee, slow at lunch.\n\+             way\t{}\t3.8\t15\t\n\+             relation\t{}\t\t40\tShady lawns.\n\+             way\t{}\t1.0\t1\tWrong element, must not match.\n",+            testpbf::CAFE_NODE_ID,+            testpbf::AREA_WAY_ID,+            testpbf::RELATION_ID,+            testpbf::CAFE_NODE_ID,+        ))+        .unwrap();+        let stats = build_with_reviews(+            &pbf_path,+            &dir.join("pois.geojsonseq"),+            &dir.join("poi_names.bin"),+            &dir.join("poi_index.bin"),+            &dir.join("poi_attrs.bin"),+            &dir.join("poi_spatial.bin"),+            &dir.join("poi_name_index.bin"),+            None,+            Some(&table),+        )+        .unwrap();+        assert_eq!(stats.with_reviews, 3);++        let (records, _) = read_records(&dir);+        let attrs = read_attrs(&dir);+        let of = |n: &str| &attrs[records.iter().position(|r| r.name == n).unwrap()];++        let cafe = of("Corner Cafe");+        assert_eq!(cafe[cafe.len() - 4], (KEY_CUISINE, "coffee_shop".to_string()), "tag fields first");+        assert_eq!(+            cafe[cafe.len() - 3..],+            [+                (KEY_RATING, "4.3".to_string()),+                (KEY_REVIEW_COUNT, "120".to_string()),+                (KEY_REVIEW_SUMMARY, "Great coffee, slow at lunch.".to_string()),+            ]+        );+        assert_eq!(+            of("Plaza"),+            &vec![(KEY_RATING, "3.8".to_string()), (KEY_REVIEW_COUNT, "15".to_string())]+        );+        assert_eq!(+            of("Riverside Park"),+            &vec![(KEY_REVIEW_COUNT, "40".to_string()), (KEY_REVIEW_SUMMARY, "Shady lawns.".to_string())]+        );+    }+     #[test]     fn args_require_all_three_outputs() {         let ok = parse_args(&[
scripts/maps/osm_ingest/src/poi_reviews.rs
diff --git a/scripts/maps/osm_ingest/src/poi_reviews.rs b/scripts/maps/osm_ingest/src/poi_reviews.rsnew file mode 100644index 0000000000..105f4ec6b2--- /dev/null+++ b/scripts/maps/osm_ingest/src/poi_reviews.rs@@ -0,0 +1,174 @@+//! External review data merged into `poi_attrs.bin` at build time.+//!+//! `summarize_reviews.py` writes a UTF-8, tab-separated table, one place per line:+//!+//! ```text+//! element<TAB>id<TAB>rating<TAB>review_count<TAB>summary+//! node    148855851    3.9    3480    Classic diner fare ...+//! ```+//!+//! `element` is `node`, `way` or `relation` and `id` is the plain OSM id (relations+//! are NOT negated here; the negation in `poi_build` is internal). Empty columns+//! mean "unknown". Blank lines and lines starting with `#` are ignored.+//!+//! The join key has to be the OSM element because `poi_index.bin` and+//! `poi_attrs.bin` carry no OSM id, so this is the last point where one exists.++use std::collections::HashMap;+use std::path::Path;++use crate::poi_attrs::{KEY_RATING, KEY_REVIEW_COUNT, KEY_REVIEW_SUMMARY};+use crate::proto::{Error, Result};++pub const ELEMENT_NODE: u8 = 1;+pub const ELEMENT_WAY: u8 = 2;+pub const ELEMENT_RELATION: u8 = 3;++/// Longest summary kept, in bytes. The writer targets 280 characters; this leaves+/// room for multi-byte scripts while keeping one bad row from bloating the sidecar.+const MAX_SUMMARY_BYTES: usize = 1024;++#[derive(Debug, Clone, PartialEq, Eq)]+pub struct Review {+    rating: Option<String>,+    review_count: Option<String>,+    summary: Option<String>,+}++impl Review {+    /// The record fields to append, ascending by key.+    pub fn fields(&self) -> Vec<(u8, &[u8])> {+        let mut out = Vec::with_capacity(3);+        if let Some(r) = &self.rating {+            out.push((KEY_RATING, r.as_bytes()));+        }+        if let Some(c) = &self.review_count {+            out.push((KEY_REVIEW_COUNT, c.as_bytes()));+        }+        if let Some(s) = &self.summary {+            out.push((KEY_REVIEW_SUMMARY, s.as_bytes()));+        }+        out+    }+}++#[derive(Debug, Default)]+pub struct ReviewTable {+    map: HashMap<(u8, i64), Review>,+}++impl ReviewTable {+    pub fn load(path: &Path) -> Result<Self> {+        let text = std::fs::read_to_string(path)+            .map_err(|e| Error(format!("cannot read reviews {}: {e}", path.display())))?;+        Self::parse(&text).map_err(|e| Error(format!("{}: {}", path.display(), e.0)))+    }++    pub fn parse(text: &str) -> Result<Self> {+        let mut map = HashMap::new();+        for (n, line) in text.lines().enumerate() {+            let line = line.trim_end_matches('\r');+            if line.trim().is_empty() || line.starts_with('#') {+                continue;+            }+            let bad = |why: &str| Error(format!("line {}: {why}", n + 1));+            let cols: Vec<&str> = line.split('\t').collect();+            if cols.len() != 5 {+                return Err(bad(&format!("expected 5 tab-separated columns, found {}", cols.len())));+            }+            let element = match cols[0] {+                "node" => ELEMENT_NODE,+                "way" => ELEMENT_WAY,+                "relation" => ELEMENT_RELATION,+                other => return Err(bad(&format!("unknown element `{other}`"))),+            };+            let id: i64 = cols[1].parse().map_err(|_| bad("id is not an integer"))?;+            if id <= 0 {+                return Err(bad("id must be positive"));+            }+            let rating = match cols[2].trim() {+                "" => None,+                r => {+                    let v: f32 = r.parse().map_err(|_| bad("rating is not a number"))?;+                    if !(1.0..=5.0).contains(&v) {+                        return Err(bad("rating must be between 1 and 5"));+                    }+                    Some(format!("{v:.1}"))+                }+            };+            let review_count = match cols[3].trim() {+                "" => None,+                c => {+                    let v: u32 = c.parse().map_err(|_| bad("review_count is not a positive integer"))?;+                    (v > 0).then(|| v.to_string())+                }+            };+            let summary = Some(cols[4].trim())+                .filter(|s| !s.is_empty() && s.len() <= MAX_SUMMARY_BYTES)+                .map(str::to_string);+            map.insert((element, id), Review { rating, review_count, summary });+        }+        Ok(Self { map })+    }++    pub fn get(&self, element: u8, id: i64) -> Option<&Review> {+        self.map.get(&(element, id))+    }++    pub fn len(&self) -> usize {+        self.map.len()+    }++    pub fn is_empty(&self) -> bool {+        self.map.is_empty()+    }+}++#[cfg(test)]+mod tests {+    use super::*;++    #[test]+    fn parses_rows_and_skips_comments_and_blanks() {+        let t = ReviewTable::parse(+            "# element\tid\trating\treview_count\tsummary\n\+             node\t148855851\t3.9\t3480\tClassic diner fare.\n\+             \n\+             way\t30636913\t4.25\t\t\n\+             relation\t7\t\t12\tBig park.\r\n",+        )+        .unwrap();+        assert_eq!(t.len(), 3);+        let node = t.get(ELEMENT_NODE, 148855851).unwrap();+        assert_eq!(+            node.fields(),+            vec![(KEY_RATING, &b"3.9"[..]), (KEY_REVIEW_COUNT, &b"3480"[..]), (KEY_REVIEW_SUMMARY, &b"Classic diner fare."[..])]+        );+        assert_eq!(t.get(ELEMENT_WAY, 30636913).unwrap().fields(), vec![(KEY_RATING, &b"4.2"[..])]);+        assert_eq!(+            t.get(ELEMENT_RELATION, 7).unwrap().fields(),+            vec![(KEY_REVIEW_COUNT, &b"12"[..]), (KEY_REVIEW_SUMMARY, &b"Big park."[..])]+        );+        assert!(t.get(ELEMENT_WAY, 148855851).is_none(), "element is part of the key");+    }++    #[test]+    fn malformed_rows_name_their_line() {+        for (row, why) in [+            ("node\t1\t4.0\t10", "expected 5"),+            ("area\t1\t4.0\t10\tx", "unknown element"),+            ("node\tabc\t4.0\t10\tx", "id is not"),+            ("node\t1\t6.0\t10\tx", "between 1 and 5"),+            ("node\t1\t4.0\t-3\tx", "review_count"),+        ] {+            let err = ReviewTable::parse(&format!("# header\n{row}\n")).unwrap_err().0;+            assert!(err.starts_with("line 2:") && err.contains(why), "{row:?} -> {err}");+        }+    }++    #[test]+    fn an_over_long_summary_is_dropped_not_truncated() {+        let t = ReviewTable::parse(&format!("node\t1\t4.0\t10\t{}\n", "x".repeat(MAX_SUMMARY_BYTES + 1))).unwrap();+        assert_eq!(t.get(ELEMENT_NODE, 1).unwrap().fields().len(), 2);+    }+}
scripts/maps/tile_build/src/bin/mamaps_pack.rs
diff --git a/scripts/maps/tile_build/src/bin/mamaps_pack.rs b/scripts/maps/tile_build/src/bin/mamaps_pack.rsindex 0a05a638c0..0c014d8a7a 100644--- a/scripts/maps/tile_build/src/bin/mamaps_pack.rs+++ b/scripts/maps/tile_build/src/bin/mamaps_pack.rs@@ -124,6 +124,10 @@ struct Validated {     transit_prefix: Vec<u8>,     /// The tile header's own build-id bytes (`tile_bytes[16..24]`), for `derive_build_id`.     osm_id: [u8; 8],+    /// FNV-1a of `poi_attrs.bin`, for `derive_build_id`. Empty without the file. The+    /// attributes can change with no tile change (merged review data), and phones cache+    /// byte ranges by build id, so the id has to move with them.+    poi_attrs_digest: Vec<u8>, }  /// Untimed entry point, kept for the unit tests below: identical staging and@@ -171,6 +175,10 @@ fn load_sidecars_impl(     push(ARCHIVE_KIND_POI_ATTRS, poi.join("poi_attrs.bin"), false)?;     push(ARCHIVE_KIND_POI_SPATIAL, poi.join("poi_spatial.bin"), false)?;     push(ARCHIVE_KIND_POI_WORDS, poi.join("poi_name_index.bin"), false)?;+    let poi_attrs_digest = match std::fs::metadata(poi.join("poi_attrs.bin")) {+        Ok(m) if m.len() > 0 => fnv64_file(&poi.join("poi_attrs.bin"))?.to_vec(),+        _ => Vec::new(),+    };     // Transit is optional like the other sidecars: omitted when no pack is     // staged (a tiles+graph+POI archive still exercises every loader's     // degrade path on device). Callers that need it pass --transit.@@ -209,7 +217,24 @@ fn load_sidecars_impl(     validate_sidecars(graph, poi, &staged, timer)?;     // The tile header's own build-id bytes are read by the caller (it holds the tiles prefix);     // placeholder filled in `main` after the tiles prefix is parsed.-    Ok(Validated { staged, transit_prefix, osm_id: [0u8; 8] })+    Ok(Validated { staged, transit_prefix, osm_id: [0u8; 8], poi_attrs_digest })+}++/// FNV-1a 64 over a whole file, streamed.+fn fnv64_file(path: &Path) -> Result<[u8; 8], String> {+    let mut f = std::fs::File::open(path).map_err(|e| format!("cannot read {}: {e}", path.display()))?;+    let mut buf = vec![0u8; 1 << 20];+    let mut h = 0xcbf2_9ce4_8422_2325u64;+    loop {+        let n = f.read(&mut buf).map_err(|e| format!("cannot read {}: {e}", path.display()))?;+        if n == 0 {+            return Ok(h.to_le_bytes());+        }+        for &b in &buf[..n] {+            h ^= b as u64;+            h = h.wrapping_mul(0x100_0000_01b3);+        }+    } }  /// Validate each staged sidecar the way its loader checks it, without holding payloads.@@ -655,10 +680,12 @@ fn verify_packed(tmp: &Path, entry_count: usize) -> Result<(), String> {     Ok(()) } -/// Always-derived unified build id: hash the tile header's own id plus the-/// transit pack prefix, so any input change moves the id.-fn derive_build_id(osm_id: &[u8; 8], transit_prefix: &[u8]) -> u64 {-    unified_build_id(b"graph-dir", osm_id, transit_prefix, b"", b"mamaps-pack-v1")+/// Always-derived unified build id: hash the tile header's own id, the POI+/// attribute digest and the transit pack prefix, so any input change moves the id.+/// The attribute digest rides in the OSM slot: both describe per-place content.+fn derive_build_id(osm_id: &[u8; 8], poi_attrs_digest: &[u8], transit_prefix: &[u8]) -> u64 {+    let place_digest = [&osm_id[..], poi_attrs_digest].concat();+    unified_build_id(b"graph-dir", &place_digest, transit_prefix, b"", b"mamaps-pack-v1") }  fn value(args: &[String], i: usize, name: &str) -> PathBuf {@@ -732,7 +759,7 @@ fn main() -> ExitCode {         return ExitCode::from(1);     }     validated.osm_id.copy_from_slice(&tile_bytes_prefix[16..24]);-    let id = derive_build_id(&validated.osm_id, &validated.transit_prefix);+    let id = derive_build_id(&validated.osm_id, &validated.poi_attrs_digest, &validated.transit_prefix);     // Build-id derivation is a 1 KiB hash (microseconds); it books here with the     // streaming copy, directory/footer, header rewrite, re-verify and rename.     timer.switch("write-output");@@ -903,7 +930,7 @@ mod tests {         assert_eq!(validated.staged.len(), 7, "meta+nodes+edges+intermediate+poi-index+poi-names+transit");         let mut osm_id = [0u8; 8];         osm_id.copy_from_slice(&v7_tiles()[16..24]);-        let id = derive_build_id(&osm_id, &validated.transit_prefix);+        let id = derive_build_id(&osm_id, &validated.poi_attrs_digest, &validated.transit_prefix);         let out = dir.join("packed.mamaps");         let final_len =             pack_streaming(&tiles_path, &validated, 0xBEEF, &out).expect("pack");@@ -1033,11 +1060,40 @@ mod tests {         let tiles = v7_tiles();         let mut osm_id = [0u8; 8];         osm_id.copy_from_slice(&tiles[16..24]);-        let base = derive_build_id(&osm_id, &[]);-        let with_transit = derive_build_id(&osm_id, &transit_pack()[..1024.min(transit_pack().len())]);+        let base = derive_build_id(&osm_id, &[], &[]);+        let with_transit = derive_build_id(&osm_id, &[], &transit_pack()[..1024.min(transit_pack().len())]);         assert_ne!(             base, with_transit,             "adding a transit pack moves the derived id"         );     }++    #[test]+    fn derive_build_id_moves_with_poi_attributes() {+        let tiles = v7_tiles();+        let mut osm_id = [0u8; 8];+        osm_id.copy_from_slice(&tiles[16..24]);+        let without = derive_build_id(&osm_id, &[], &[]);+        let a = derive_build_id(&osm_id, &1u64.to_le_bytes(), &[]);+        let b = derive_build_id(&osm_id, &2u64.to_le_bytes(), &[]);+        assert_ne!(without, a, "gaining an attrs sidecar moves the id");+        assert_ne!(a, b, "changed attributes (e.g. new review data) move the id");+        assert_eq!(a, derive_build_id(&osm_id, &1u64.to_le_bytes(), &[]), "stable");+    }++    #[test]+    fn the_attrs_digest_is_read_from_the_staged_file() {+        let (dir, poi) = overlay_fixture("attrs_digest");+        assert!(load_sidecars(&dir, &poi, None).expect("no attrs").poi_attrs_digest.is_empty());+        let mut attrs = Vec::new();+        attrs.extend_from_slice(b"MAPA");+        attrs.extend_from_slice(&[1, 0, 0, 0]);+        attrs.extend_from_slice(&1u32.to_le_bytes());+        attrs.extend_from_slice(&u32::MAX.to_le_bytes());+        std::fs::write(poi.join("poi_attrs.bin"), &attrs).expect("fixture attrs");+        let digest = load_sidecars(&dir, &poi, None).expect("with attrs").poi_attrs_digest;+        assert_eq!(digest, fnv64_file(&poi.join("poi_attrs.bin")).unwrap().to_vec());+        assert_eq!(digest.len(), 8);+        let _ = std::fs::remove_dir_all(&dir);+    } }
travel/AGENTS.md
diff --git a/travel/AGENTS.md b/travel/AGENTS.mdindex d4863b9473..dbbe524406 100644--- a/travel/AGENTS.md+++ b/travel/AGENTS.md@@ -11,6 +11,9 @@ _Install: ./install travel (dev by default)._ - Metadata: metadata_data/travel.md (present) - Rust: no / screenshotTest: yes +### Relay server note (backend, outside this repo)+`travel` does not use the relay directly, but `NetworkClient.init(FIRST_PARTY)` covers `api.maproj.org` (relay hosts migrated from `findfamily.cc`; `findfamily.cc` remains valid for backward compatibility). Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Full details: root `AGENTS.md` → "Backend server (outside this repo)".+ ## Overview **Purpose:** Flight + hotel booking — search/comparison, seat maps, ancillaries/offers, trip management with hosted checkout; trips persist on-device so plans stay readable offline. **Key features:**
travel/src/main/java/com/vayunmathur/travel/MainActivity.kt
diff --git a/travel/src/main/java/com/vayunmathur/travel/MainActivity.kt b/travel/src/main/java/com/vayunmathur/travel/MainActivity.ktindex 4b8eb68904..0bed62be93 100644--- a/travel/src/main/java/com/vayunmathur/travel/MainActivity.kt+++ b/travel/src/main/java/com/vayunmathur/travel/MainActivity.kt@@ -59,8 +59,9 @@ class MainActivity : MaActivity() {     private var ready by mutableStateOf(false)      override fun onCreateBeforeContent() {-        // Hardened trust: api.maproj.org + data.maproj.org + findfamily.cc are Cloudflare+        // Hardened trust: api.maproj.org + data.maproj.org are Cloudflare         // fronted, covered by ISRG X1/X2 + GTS R1-R4 in FIRST_PARTY bundle.+        // (findfamily.cc relay migrated to api.maproj.org — same pins.)         NetworkClient.init(this, TrustBundle.FIRST_PARTY)          lifecycleScope.launch(Dispatchers.IO) {