From 25152ddb61a89ea3ea29d3aef5de13343429d32a Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Fri, 9 Oct 2026 18:23:52 +0200 Subject: feat: back up the phone's photos to a group, once a day on Wi-Fi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Android application sends the photos taken on the phone to one folder of one group chosen by the member (docs/MESHBAY_DESIGN.md §9.12). The phone lists MediaStore, keeps a ledger of what was sent and hands each photo's bytes to the page by an opaque token on the packaged origin; the page decides when a run is due and uploads through the existing path, one photo at a time under a slot. - Once a day from the last finished run, on an unmetered network only; "Back up now" asks first on mobile data. Leaving Wi-Fi stops after the file in flight. - Photos already on the phone are sent by default, newest first, under /YYYY/MM; edits are sent beside the original as -edited-. - Additive by construction: nothing is ever deleted, renamed or replaced on the node, and a photo deleted on the node is not sent again. - A confirmation names the group, owner, members, folder and size when the destination or starting point changes; a lasting refusal (disk full, folder read-only or gone, no longer a member) is said once and retried a day later. - No ACCESS_MEDIA_LOCATION, so the platform redacts photo locations. - A dataSync foreground service keeps a run going with the screen off. HEIC/HEIF photos are sent but not shown in Photos yet (§15.2). Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/tests/test_photo_sync_ui.py | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 packages/meshbay-hub/tests/test_photo_sync_ui.py (limited to 'packages/meshbay-hub/tests/test_photo_sync_ui.py') diff --git a/packages/meshbay-hub/tests/test_photo_sync_ui.py b/packages/meshbay-hub/tests/test_photo_sync_ui.py new file mode 100644 index 0000000..bd512c1 --- /dev/null +++ b/packages/meshbay-hub/tests/test_photo_sync_ui.py @@ -0,0 +1,55 @@ +""" +The photo backup section in Settings, measured in Chrome at phone widths +(harness/photo_sync_probe.py). Android's WebView is the only engine that ever +shows it. + +A group, a folder or an album is named by somebody else and often has no space +in it; one such name made a 360px page 634px wide before `.settings-name`, and +a page wider than the screen takes every pinned header with it (CLAUDE.md). +""" + +import json +import shutil +import subprocess +import sys +from pathlib import Path + +import pytest + +PROBE = Path(__file__).parent / "harness" / "photo_sync_probe.py" + + +@pytest.fixture(scope="module") +def probe(): + if shutil.which("google-chrome") is None: + pytest.skip("chrome is not available") + proc = subprocess.run([sys.executable, str(PROBE)], capture_output=True, text=True, + timeout=240) + assert proc.returncode == 0, f"probe failed: {proc.stdout}{proc.stderr}" + return json.loads(proc.stdout) + + +def test_it_renders_without_an_error(probe): + for state, r in probe.items(): + assert r["err"] == "", f"{state}: {r['err']}" + assert r["text"].strip(), f"{state}: nothing was drawn" + + +def test_no_name_widens_the_page_on_a_phone(probe): + for state, r in probe.items(): + assert r["scrollW"] <= r["vw"], ( + f"{state}: {r['scrollW']}px of page in a {r['vw']}px window — {r['wide']}") + + +def test_the_camera_and_the_photos_already_there_are_the_defaults(probe): + for state in ("setup360", "partial360"): + assert probe[state]["checked"] == [ + "Camera", "The photos already on this phone, then new ones"], probe[state]["checked"] + + +def test_a_refusal_is_said_where_the_backup_is(probe): + assert "the node's disk is full" in probe["configured360"]["text"] + + +def test_limited_access_is_said_rather_than_failing_quietly(probe): + assert "Access is limited to the photos you selected" in probe["partial360"]["text"] -- cgit v1.2.3