diff --git a/CHANGELOG.md b/CHANGELOG.md index 62aad7188..6ba3030c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Use the private Harmony Lumi chat from the owner's Android debug build. - Backspace and text corrections work again; recover unfinished practices and backups, add photos reliably and reset break timers after time away. -- Switch practices smoothly, pick an astral exercise and claim daily coins; account sync is now called Mesh. Keep an active practice visible in picture-in-picture. +- Switch practices smoothly, pick an astral exercise and claim daily coins; account sync is now called Mesh. Keep an active practice visible in picture-in-picture. Practice downloads show clear progress. - Read Tao Te Ching art on its own page; find Photos and Radio in Apps, with clearer feedback and appearance controls. ## [2.1.63] - 2026-11-05 diff --git a/apps/practice/CHANGELOG.md b/apps/practice/CHANGELOG.md index 617d82e9d..ab8bf0fe7 100644 --- a/apps/practice/CHANGELOG.md +++ b/apps/practice/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Download practices with clear progress and more reliable content delivery. - Practice figures move more naturally: feet step and pivot instead of sliding, toes stay above the floor, knees and elbows straighten smoothly, hands turn without flipping, and the side plank rolls over to the second side. - Recover unfinished practices after an unexpected close; restore a last good data copy from Settings. - Changing practices keeps the page steady and fades from the previous practice. diff --git a/apps/practice/practice_home_view.zi b/apps/practice/practice_home_view.zi index 3961449da..3bbb3c4bf 100644 --- a/apps/practice/practice_home_view.zi +++ b/apps/practice/practice_home_view.zi @@ -314,12 +314,13 @@ ActionsShareRow :: (width: s32) -> bool { // The button in place of Start for a practice that is not ready. Offer :: (bounds: Rectangle) { - cancel := home.offer == PRACTICE_OFFER_CANCEL + downloading := home.offer == PRACTICE_OFFER_DOWNLOADING + label := ifx downloading then Locale("practice_download_busy") else home.offer_label if Button.Draw(home.session, Button.Props.{.id = HOME_OFFER_ID + home.practice * 2, - .bounds = bounds, .pill = true, .label = home.offer_label, - .disabled = home.offer_disabled, - .tone = cast(ButtonTone)(ifx cancel then ButtonToneNeutral else ButtonToneAccent), - .emphasis = cast(ButtonEmphasis)(ifx cancel then ButtonEmphasisSoft else ButtonEmphasisFilled), + .bounds = bounds, .pill = true, .label = label, + .disabled = home.offer_disabled || downloading, + .tone = cast(ButtonTone)(ifx downloading then ButtonToneNeutral else ButtonToneAccent), + .emphasis = cast(ButtonEmphasis)(ifx downloading then ButtonEmphasisSoft else ButtonEmphasisFilled), .size = cast(ControlSize)ControlSizeLarge}) != 0 { home.action = PRACTICE_HOME_OFFER } diff --git a/locales/changelog/cs.md b/locales/changelog/cs.md index 1f8ca3042..574bac30a 100644 --- a/locales/changelog/cs.md +++ b/locales/changelog/cs.md @@ -3,7 +3,7 @@ ## [Unreleased] - Fotky z Aplikací; Lumi jednou ukáže úplný návrh ohlasu ze seznamu; Seznamy: delší úkoly a dokončení přejetím. -- Karty Cvičení už neposouvají obrazovku. Před startem vyber ze šesti astrálních cvičení. Rozhraní má deset jazyků. Probíhající cvičení může zůstat viditelné v režimu obrazu v obraze. +- Karty Cvičení už neposouvají obrazovku. Před startem vyber ze šesti astrálních cvičení. Rozhraní má deset jazyků. Probíhající cvičení může zůstat viditelné v režimu obrazu v obraze. Průběh stahování cvičení je jasně viditelný. - Hlasové balíčky cvičení jsou asi o třetinu menší. V obchodě Návyků si každý den vyzvedněte mince. ## [2.1.63] - 2026-11-05 diff --git a/locales/changelog/de.md b/locales/changelog/de.md index ca5f9d090..e5e46e500 100644 --- a/locales/changelog/de.md +++ b/locales/changelog/de.md @@ -3,7 +3,7 @@ ## [Unreleased] - Fotos aus Apps; Lumi zeigt Listenfeedback einmal komplett; Listen: längere Aufgaben, Erledigen per Wischen. -- Übungstabs verschieben den Bildschirm nicht mehr. Vor Start aus sechs Astralübungen wählen. Oberfläche in zehn Sprachen. Laufende Übungen bleiben im Bild-in-Bild-Modus sichtbar. +- Übungstabs verschieben den Bildschirm nicht mehr. Vor Start aus sechs Astralübungen wählen. Oberfläche in zehn Sprachen. Laufende Übungen bleiben im Bild-in-Bild-Modus sichtbar. Der Downloadfortschritt der Übungen ist klar erkennbar. - Sprachpakete für Übungen sind etwa ein Drittel kleiner. Im Gewohnheiten-Shop täglich Münzen abholen. ## [2.1.63] - 2026-11-05 diff --git a/locales/changelog/es.md b/locales/changelog/es.md index d1df8c932..40623fcd3 100644 --- a/locales/changelog/es.md +++ b/locales/changelog/es.md @@ -3,7 +3,7 @@ ## [Unreleased] - Fotos en Aplicaciones; Lumi: vista única de comentarios completos de listas; Listas: tareas largas, acabar deslizando. -- Las pestañas de Práctica ya no desplazan la pantalla. Elige entre seis ejercicios astrales al empezar. Diez idiomas. Mantén visible la práctica en curso en el modo de imagen en imagen. +- Las pestañas de Práctica ya no desplazan la pantalla. Elige entre seis ejercicios astrales al empezar. Diez idiomas. Mantén visible la práctica en curso en el modo de imagen en imagen. El progreso de las descargas de prácticas se muestra con claridad. - Los paquetes de voz de las prácticas pesan un tercio menos. Reclama monedas cada día en la tienda de Hábitos. ## [2.1.63] - 2026-11-05 diff --git a/locales/changelog/fr.md b/locales/changelog/fr.md index 56c5f897f..4424bee3b 100644 --- a/locales/changelog/fr.md +++ b/locales/changelog/fr.md @@ -3,7 +3,7 @@ ## [Unreleased] - Photos via Applications ; Lumi : retours de liste complets en un aperçu ; Listes : tâches longues, cochées par balayage. -- Les onglets Pratique ne décalent plus l’écran. Choisis parmi six exercices astraux avant de commencer. Dix langues. Garde la pratique en cours à l’écran en mode image dans l’image. +- Les onglets Pratique ne décalent plus l’écran. Choisis parmi six exercices astraux avant de commencer. Dix langues. Garde la pratique en cours à l’écran en mode image dans l’image. La progression du téléchargement des pratiques est clairement affichée. - Packs de voix un tiers plus légers. Récupérez des pièces chaque jour dans la boutique Habitudes. ## [2.1.63] - 2026-11-05 diff --git a/locales/changelog/ja.md b/locales/changelog/ja.md index d60c1f74e..77d43fc89 100644 --- a/locales/changelog/ja.md +++ b/locales/changelog/ja.md @@ -3,7 +3,7 @@ ## [Unreleased] - 写真はアプリからダウンロードできます。Lumi はリストのフィードバック全文を一度だけ確認用に表示し、リストでは長いタスクとスワイプでの完了に対応しました。 -- サイドナビで練習のタブを切り替えても、画面がずれなくなりました。 開始前に6種類のアストラル練習から選べます。 インターフェースは10言語に対応しています。練習中はピクチャーインピクチャーで表示し続けられます。 +- サイドナビで練習のタブを切り替えても、画面がずれなくなりました。 開始前に6種類のアストラル練習から選べます。 インターフェースは10言語に対応しています。練習中はピクチャーインピクチャーで表示し続けられます。 練習のダウンロード状況をわかりやすく表示します。 - 練習の音声パックが約3分の1小さくなりました。習慣のショップで毎日コインを受け取れます。 ## [2.1.63] - 2026-11-05 diff --git a/locales/changelog/ko.md b/locales/changelog/ko.md index 9ccaeb4f4..6fb88bf48 100644 --- a/locales/changelog/ko.md +++ b/locales/changelog/ko.md @@ -3,7 +3,7 @@ ## [Unreleased] - 사진은 앱에서 다운로드합니다. Lumi는 목록의 전체 피드백 제안을 한 번만 표시하며, 목록은 더 긴 할 일과 밀어서 완료하기를 지원합니다. -- 사이드 내비게이션으로 연습 탭을 바꿔도 화면이 더 이상 밀리지 않습니다. 시작하기 전에 여섯 가지 유체 이탈 수련 중 하나를 선택하세요. 인터페이스는 10개 언어를 지원합니다. 진행 중인 연습을 화면 속 화면 모드로 계속 볼 수 있습니다. +- 사이드 내비게이션으로 연습 탭을 바꿔도 화면이 더 이상 밀리지 않습니다. 시작하기 전에 여섯 가지 유체 이탈 수련 중 하나를 선택하세요. 인터페이스는 10개 언어를 지원합니다. 진행 중인 연습을 화면 속 화면 모드로 계속 볼 수 있습니다. 연습 다운로드 진행 상황을 명확하게 표시합니다. - 연습 음성 팩의 크기가 약 3분의 1 줄었습니다. 습관 상점에서 매일 코인을 받을 수 있어요. ## [2.1.63] - 2026-11-05 diff --git a/locales/changelog/pt.md b/locales/changelog/pt.md index 03d067050..1a03cc479 100644 --- a/locales/changelog/pt.md +++ b/locales/changelog/pt.md @@ -3,7 +3,7 @@ ## [Unreleased] - Fotos via Aplicações; Lumi: prévia única do retorno completo da lista; Listas: tarefas longas e conclusão ao deslizar. -- Abas de Prática não deslocam a tela. Escolha entre seis exercícios astrais antes de começar. Interface em dez idiomas. Mantenha a prática em andamento visível no modo picture-in-picture. +- Abas de Prática não deslocam a tela. Escolha entre seis exercícios astrais antes de começar. Interface em dez idiomas. Mantenha a prática em andamento visível no modo picture-in-picture. O progresso dos downloads das práticas é exibido com clareza. - Pacotes de voz das práticas um terço menores. Resgate moedas todos os dias na loja de Hábitos. ## [2.1.63] - 2026-11-05 diff --git a/locales/changelog/ru.md b/locales/changelog/ru.md index c495bcbd9..5a1b0a407 100644 --- a/locales/changelog/ru.md +++ b/locales/changelog/ru.md @@ -3,7 +3,7 @@ ## [Unreleased] - Фото из Приложений; Lumi: один полный предпросмотр отзыва по списку; Списки: длинные задачи и завершение смахиванием. -- Вкладки Практики не сдвигают экран. До старта выберите из шести астральных упражнений. Интерфейс на десяти языках. Текущее упражнение остаётся на экране в режиме «картинка в картинке». +- Вкладки Практики не сдвигают экран. До старта выберите из шести астральных упражнений. Интерфейс на десяти языках. Текущее упражнение остаётся на экране в режиме «картинка в картинке». Ход загрузки практик отображается наглядно. - Голосовые пакеты практик стали на треть меньше. Забирайте монеты в магазине привычек каждый день. ## [2.1.63] - 2026-11-05 diff --git a/locales/changelog/zh.md b/locales/changelog/zh.md index 4f66fa1cf..00f7af867 100644 --- a/locales/changelog/zh.md +++ b/locales/changelog/zh.md @@ -3,7 +3,7 @@ ## [Unreleased] - 照片可从应用中下载;Lumi 会一次性展示基于列表的完整反馈内容,列表支持更长的待办事项和滑动完成。 -- 用侧边导航切换练习标签时,屏幕不再移位。 开始前可选择六种星体练习之一。 界面支持十种语言。进行中的练习可在画中画模式下继续显示。 +- 用侧边导航切换练习标签时,屏幕不再移位。 开始前可选择六种星体练习之一。 界面支持十种语言。进行中的练习可在画中画模式下继续显示。 清楚显示练习的下载进度。 - 练习语音包缩小了约三分之一。每天都能在习惯商店领取金币。 ## [2.1.63] - 2026-11-05 diff --git a/mk/android.mk b/mk/android.mk index 56181936a..74370842f 100644 --- a/mk/android.mk +++ b/mk/android.mk @@ -184,10 +184,12 @@ android-install: android-copy-assets android-local-properties $(MAKE) android-copy-debug-apks # The app downloads practices by the exact hashes this build lists, and a # toolchain change gives every pack a new hash. With the publisher key here, -# the missing packs go to the node before the phone asks for them. - @if [ -f backup/package-publisher/2026-10/publisher.pem ]; then \ - python3 scripts/upload-practice-packs.py || \ - echo "WARNING: this build's practice packs are not all on the node; downloads fail until scripts/upload-practice-packs.py succeeds" >&2; \ +# deliver missing packs first. Without it, verify availability and stop before +# replacing the phone's app if this build would have broken downloads. + @set -e; if [ -f backup/package-publisher/2026-10/publisher.pem ]; then \ + python3 scripts/upload-practice-packs.py; \ + else \ + python3 scripts/upload-practice-packs.py --check; \ fi ADB='$(ADB)' sh scripts/android-install-apk.sh \ "$(ANDROID_DEBUG_APP_ID)" "$(ANDROID_ACTIVITY)" \ diff --git a/scripts/upload-practice-packs.py b/scripts/upload-practice-packs.py index e80a05417..6379767a5 100755 --- a/scripts/upload-practice-packs.py +++ b/scripts/upload-practice-packs.py @@ -161,14 +161,34 @@ def main(): except ValueError as error: parser.error(str(error)) sun_content = any(pack['practice'] == 'sunsalutation' and not pack['language'] for pack in listed) - with tempfile.TemporaryDirectory(prefix="inbe-practice-packs-") as scratch: + with tempfile.TemporaryDirectory(prefix="inbe-practice-packs-", dir=ROOT / "build") as scratch: store = Path(scratch) - if args.pack is not None: - stage_selected_packs(store, listed) - else: - # Legacy callers stage the complete build locally. App releases - # and latest metadata never enter this uploader's transport. - package_release.stage(store, KEY, KEY_ID) + # Availability checks need only the catalog, not a signing key or any + # unrelated app bundle. Installation must also work on build hosts + # that do not hold the private publisher key. + if args.check: + missing = [] + for pack in listed: + status = served(pack['sha256']) + expected = 403 if pack.get('product') else 200 + if status == 404: + missing.append(pack) + elif status != expected: + raise SystemExit(f"node answered {status} for practice pack {pack_identifier(pack)}") + print(f"{len(listed)} packs built, {len(missing)} missing on the node") + if missing: + for pack in missing: + print(f"missing: {pack_identifier(pack)}", file=sys.stderr) + return 1 + if args.pack is not None: + for pack in listed: + if not pack.get('product') and not matches(pack['sha256'], pack['size']): + raise SystemExit(f"pack {pack['sha256']} is not served exactly") + return 0 if not sun_content or sun_salutation_downloads(listed) else 1 + # Only content is being delivered. Requiring a complete, matching + # root and every unrelated app here made local content repair fail + # before it could upload the practice the installed build requests. + stage_selected_packs(store, listed) directory = store / "inbe.practices" # Only selected catalog content can reach the transport. catalog = {pack["sha256"] for pack in listed} @@ -183,10 +203,8 @@ def main(): elif status != (403 if gated else 200): raise SystemExit(f"node answered {status} for {'paid' if gated else 'free'} pack {digest}") print(f"{len(packs)} packs built, {len(missing)} missing on the node") - if args.check or not missing: - if missing and args.check: - return 1 - if args.pack is not None and not args.check: + if not missing: + if args.pack is not None: for path in packs: if not (directory / (path.stem + '.zx.product')).exists() and not matches(path.stem, path.stat().st_size): raise SystemExit(f'pack {path.stem} is not served exactly') @@ -207,8 +225,7 @@ def main(): members.append(info.name) # Extract only into the practices folder, never over a file that is # already there: packs are immutable once served. - permissions = (' '.join(shlex.quote(name) for name in members) - if args.pack is not None else 'inbe.practices/*.zx*') + permissions = ' '.join(shlex.quote(name) for name in members) command = ("set -e; cd " + STORE + " && tar -x --keep-old-files --no-same-permissions " "--wildcards 'inbe.practices/*' -f - && chmod 600 " + permissions) subprocess.run(["ssh", "-o", "BatchMode=yes", TARGET, command], diff --git a/src/apps/practice_types.zi b/src/apps/practice_types.zi index 07749fdab..2ef547307 100644 --- a/src/apps/practice_types.zi +++ b/src/apps/practice_types.zi @@ -41,11 +41,11 @@ PRACTICE_HOME_STEP :: 5 PRACTICE_HOME_PICK :: 6 PRACTICE_HOME_TAB :: 7 // What a practice that is not ready offers in place of Start: nothing once -// it is ready, Install, Unlock for a paid one, or Cancel while it downloads. +// it is ready, Install, Unlock for a paid one, or disabled download progress. PRACTICE_OFFER_NONE :: 0 PRACTICE_OFFER_INSTALL :: 1 PRACTICE_OFFER_BUY :: 2 -PRACTICE_OFFER_CANCEL :: 3 +PRACTICE_OFFER_DOWNLOADING :: 3 // Draws a practice's manual (apps/practice/manual_view.zi). PRACTICE_MANUAL_VIEW :: 7 diff --git a/src/practices/practice_offer.zi b/src/practices/practice_offer.zi index fbed748fa..792ba490b 100644 --- a/src/practices/practice_offer.zi +++ b/src/practices/practice_offer.zi @@ -1,6 +1,6 @@ // What a practice's card on Practice offers when the practice is not ready: // Install with its size, Unlock with its price for a paid practice, or -// Cancel while it downloads; practices that come with the app are always +// Downloading while it downloads; practices that come with the app are always // ready. Practice's home draws the card (apps/practice/practice_home_view.zi) // from what these say, and the host does what its button asks. #import "entity/dew_model" @@ -87,7 +87,7 @@ PracticeDownloadReady :: (practice: s32) -> bool { } // What the card offers in place of Start: Unlock for a paid practice not -// unlocked yet, Cancel while it downloads, Install otherwise, and nothing +// unlocked yet, Downloading while it downloads, Install otherwise, and nothing // once it is ready. PracticeDownloadAction :: (practice: s32) -> s32 { if PracticePreviewReady(practice) { @@ -100,7 +100,7 @@ PracticeDownloadAction :: (practice: s32) -> s32 { return PRACTICE_OFFER_NONE } if PracticeContentStatus(practice) == 1 { - return PRACTICE_OFFER_CANCEL + return PRACTICE_OFFER_DOWNLOADING } return PRACTICE_OFFER_INSTALL } @@ -129,12 +129,8 @@ PracticeDownloadActionLabel :: (app: *InnerBreeze, practice: s32, action: s32) - if action == PRACTICE_OFFER_BUY { return PracticeDownloadPriceText(app, "practice_unlock_button") } - if action == PRACTICE_OFFER_CANCEL { - label: [256]u8 - unused AppCopyText(LocaleText("practice_download_busy"), label[:]) - unused AppAppendText(" · ", label[:]) - unused AppAppendText(LocaleText("cancel_button"), label[:]) - return FrameTextHold(*app.ui.frame_text, TextUntilNul(label[:])) + if action == PRACTICE_OFFER_DOWNLOADING { + return LocaleText("practice_download_busy") } // The size rides on the button, so the row's text stays short. size: [32]u8 @@ -151,8 +147,6 @@ PracticeDownloadActionLabel :: (app: *InnerBreeze, practice: s32, action: s32) - PracticeDownloadAct :: (app: *InnerBreeze, practice: s32, action: s32) { if action == PRACTICE_OFFER_BUY { UnlockStart() - } else if action == PRACTICE_OFFER_CANCEL { - PracticeContentCancel(practice) } else if action == PRACTICE_OFFER_INSTALL { if DataTemporary() { app.exercise_type = practice @@ -185,7 +179,9 @@ PracticeOfferFill :: (app: *InnerBreeze, practice: s32, frame: *PracticeHomeFram frame.note = PracticeDownloadNote(practice) if offer != PRACTICE_OFFER_NONE { disabled := app.modal.active != 0 || practice_active(app) != null - if offer == PRACTICE_OFFER_BUY { + if offer == PRACTICE_OFFER_DOWNLOADING { + disabled = true + } else if offer == PRACTICE_OFFER_BUY { disabled = disabled || !DewReady() || UnlockBuying() } else if offer == PRACTICE_OFFER_INSTALL { disabled = disabled || !PracticePackReviewed(practice, "") diff --git a/tests/package_upload_test.py b/tests/package_upload_test.py index 7eb9e7f1c..8f482ee04 100644 --- a/tests/package_upload_test.py +++ b/tests/package_upload_test.py @@ -254,9 +254,9 @@ class ExactPracticeUploadTest(unittest.TestCase): patch.object(uploader.package_release, 'catalog_from_bundle', return_value=self.catalog), patch.object(uploader, 'stage_selected_packs', side_effect=stage_selected) as exact_stage, patch.object(uploader.package_release, 'stage', - side_effect=lambda store, *args: original_selected(store, self.catalog)) as legacy_stage, + side_effect=AssertionError('content delivery must not stage unrelated app releases')) as legacy_stage, patch.object(uploader.tempfile, 'TemporaryDirectory', - side_effect=lambda **kwargs: temporary_directory(dir=self.root, **kwargs)), + side_effect=temporary_directory), patch.object(uploader.urllib.request, 'urlopen', side_effect=open_url), patch.object(uploader.subprocess, 'run', side_effect=transport), patch.object(sys, 'argv', ['upload-practice-packs.py', *arguments]), @@ -301,17 +301,35 @@ class ExactPracticeUploadTest(unittest.TestCase): self.assertEqual(self.transports, []) def test_check_is_scoped_and_never_uploads_missing_pack(self): + self.key_file.unlink() self.assertEqual(self.run_upload(['--check', '--pack', 'guide.pt'], {'guide.pt'}), 1) + self.assertEqual((self.exact_stages, self.legacy_stages), (0, 0)) self.assertEqual(self.transports, []) self.assertEqual([method for method, _ in self.requests], ['HEAD']) + def test_check_existing_content_needs_no_key_or_unrelated_app_bundles(self): + self.key_file.unlink() + self.assertEqual(self.run_upload(['--check'], + {uploader.pack_identifier(row) for row in self.catalog}, existing=True), 0) + self.assertEqual((self.exact_stages, self.legacy_stages), (0, 0)) + self.assertEqual(self.transports, []) + self.assertEqual([method for method, _ in self.requests].count('GET'), 1) + + def test_keyless_check_rejects_corrupted_existing_exact_content(self): + self.key_file.unlink() + with self.assertRaisesRegex(SystemExit, 'not served exactly'): + self.run_upload(['--check', '--pack', 'guide.pt'], + {'guide.pt'}, existing=True, corrupt=True) + self.assertEqual((self.exact_stages, self.legacy_stages), (0, 0)) + self.assertEqual(self.transports, []) + def test_content_flag_still_selects_only_base(self): self.assertEqual(self.run_upload(['--content', 'astral_projection'], {'astral_projection'}), 0) - self.assertEqual((self.exact_stages, self.legacy_stages), (0, 1)) + self.assertEqual((self.exact_stages, self.legacy_stages), (1, 0)) def test_default_still_uses_all_catalog_packs(self): self.assertEqual(self.run_upload([], {uploader.pack_identifier(row) for row in self.catalog}), 0) - self.assertEqual((self.exact_stages, self.legacy_stages), (0, 1)) + self.assertEqual((self.exact_stages, self.legacy_stages), (1, 0)) def test_invalid_empty_or_mixed_selection_has_no_signing_or_remote_actions(self): for args in (['--pack', 'unknown.pt'], ['--pack', ''], @@ -348,5 +366,54 @@ class ExactPracticeUploadTest(unittest.TestCase): self.assertEqual(uploader.matches(sha256(data).hexdigest(), len(data)), expected) +class AndroidPracticeDeliveryTest(unittest.TestCase): + """Run the actual install recipe against disposable tools, never a phone.""" + + def setUp(self): + OUTPUT.mkdir(parents=True, exist_ok=True) + self.temporary = tempfile.TemporaryDirectory(dir=OUTPUT) + self.addCleanup(self.temporary.cleanup) + self.root = Path(self.temporary.name) + (self.root / 'scripts').mkdir() + (self.root / 'scripts/upload-practice-packs.py').write_text( + "from pathlib import Path\nimport os, sys\n" + "Path('delivery-arguments').write_text(' '.join(sys.argv[1:]))\n" + "sys.exit(int(os.environ['DELIVERY_STATUS']))\n") + (self.root / 'scripts/android-install-apk.sh').write_text( + "#!/bin/sh\nset -eu\ntouch installed\n") + self.adb = self.root / 'adb' + self.adb.write_text('#!/bin/sh\necho arm64-v8a\n') + self.adb.chmod(0o700) + + def install(self, *, publisher=False, status=0): + if publisher: + key = self.root / 'backup/package-publisher/2026-10/publisher.pem' + key.parent.mkdir(parents=True) + key.touch() + return subprocess.run(['make', '--no-print-directory', '-f', str(ROOT / 'mk/android.mk'), + '-o', 'android-copy-assets', '-o', 'android-local-properties', 'android-install', + 'MAKE=true', 'GRADLE=true', 'ADB=' + str(self.adb), + 'ANDROID_DEBUG_APP_ID=fixture', 'ANDROID_ACTIVITY=Fixture'], cwd=self.root, + env=os.environ | {'DELIVERY_STATUS': str(status)}, capture_output=True, text=True) + + def test_missing_remote_content_stops_install_without_a_signing_key(self): + result = self.install(status=1) + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual((self.root / 'delivery-arguments').read_text(), '--check') + self.assertFalse((self.root / 'installed').exists()) + + def test_failed_content_upload_stops_install(self): + result = self.install(publisher=True, status=1) + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual((self.root / 'delivery-arguments').read_text(), '') + self.assertFalse((self.root / 'installed').exists()) + + def test_available_content_allows_install_without_a_signing_key(self): + result = self.install() + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual((self.root / 'delivery-arguments').read_text(), '--check') + self.assertTrue((self.root / 'installed').exists()) + + if __name__ == "__main__": unittest.main() diff --git a/tests/practice_home_apps_behavior.zi b/tests/practice_home_apps_behavior.zi index 60dc3d006..e66aa1c48 100644 --- a/tests/practice_home_apps_behavior.zi +++ b/tests/practice_home_apps_behavior.zi @@ -25,6 +25,7 @@ home_test_tab_codec: WidgetPracticeHomeTabCodec; home_test_reads: s32; home_test_writes: s32; home_test_tabs: s32; +home_test_downloading: bool; HomeTestAssets :: (path: string) -> bool { return path.count == 0 || AppsAsset(path).found || AssetRead(path).found @@ -55,7 +56,7 @@ HomeTestCall :: (context: *void, module: *u8, function: *u8, return 1 } if name == "PracticeLocaleHost" && count == 1 { - text := "Start" + text := ifx HostValueText(arguments[0]) == "practice_download_busy" then "Downloading…" else "Start" result.* = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(text), .length = cast(usize)text.count} return 1 @@ -78,6 +79,14 @@ HomeTestDraw :: (frame: PracticeHomeFrame, frame_id: u64) -> s32 { WidgetHostEnd() painted := PendingPaintCount(session) unused EndFrame(session) + home_test_downloading = false + for index: cast(s32)0..TreeCount(session) - 1 { + node := TreeNodeAt(session, index) + if node.focus_id == 17410 + frame.practice * 2 && + node.semantic_label == "Downloading…" && node.disabled { + home_test_downloading = true + } + } unused SessionClose(session) if !drawn.succeeded { return 1 } if home_test_reads != 1 || home_test_writes != 1 { return 2 } @@ -132,9 +141,18 @@ CheckPracticeHome :: () -> s32 { // A practice that is not ready has only its offer, no manual or settings. if !HomeTestInside(home_test_frame.start, page) || home_test_frame.manual.width != 0.0 || home_test_frame.config.width != 0.0 { return 11 } + // The package also repairs an older host's Cancel label: it presents + // progress and disables the offer even if that host left it enabled. + frame.offer = PRACTICE_OFFER_DOWNLOADING + frame.offer_label = "Downloading… · Cancel" + frame.offer_disabled = false + if HomeTestDraw(frame, cast(u64)6) != 0 || !home_test_downloading || + home_test_frame.action != PRACTICE_HOME_NONE { + return 14 + } // An unfinished practice blocks another Start until Save or Discard. frame.draft_pending = true - if HomeTestDraw(frame, cast(u64)6) != 0 { + if HomeTestDraw(frame, cast(u64)7) != 0 { return 12 } if home_test_tabs != 0 || home_test_frame.start.width != 0.0 ||