Verify migrated Practices controls in isolated desktop fixtures

This commit is contained in:
waozi committed 2026-10-25 04:05:43 -03:00
1 parent b3f9df7003
commit 32d87470b3
10 files changed
+238 -25

No files matched your search

+2 -1
View File
@@ -37,7 +37,8 @@
in `apps/<app>/`, not in the host under `src/`. Practices draws its
screen layouts in `apps/practice/`; its native figure painters and
platform effects remain host capabilities (see [docs/apps.md](docs/apps.md)).
Keep the host interface small and generic (storage, network, locale, platform effects), because
Keep the host interface small and generic (storage, network, locale,
platform effects), because
each new host call needs an APK before a package can use it. Apps share
data only through the host interface, never another app's internals.
- Translate changed strings in every affected locale; no English placeholders.
+1 -7
View File
@@ -1,10 +1,4 @@
# Inner Breeze TODO
Remaining work checked against the current source on 22 October 2026. Remove
an item when it is implemented and verified. Release status belongs in the
No remaining app-package migration tasks. Release status belongs in the
release workflow and changelog.
## App packages
- Move the remaining host-drawn Practices screens into `apps/practice/`, so
they can update without a new APK, as Habits' screens already do.
+3 -3
View File
@@ -84,7 +84,7 @@ ExtendControls :: (y: s32) {
finish_width := Scale(96)
if Button(meditation.session, ButtonProps.{
.bounds = Bounds(RowX(meditation.center_x, finish_width),
y + height + Scale(10), finish_width, height),
y + height + Scale(10), finish_width, height),
.label = meditation.finish_label,
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
@@ -107,9 +107,9 @@ PracticeMeditationView :: (message: PracticeMessage) -> PracticeMessage {
Text(meditation.session, TextProps.{
.text = meditation.time_text,
.bounds = Bounds(meditation.center_x - radius,
meditation.center_y - radius, radius * 2, radius * 2),
meditation.center_y - radius, radius * 2, radius * 2),
.font = FitFont(meditation.time_text, radius * 2 - Scale(20),
Scale(Text24), Scale(Text16)),
Scale(Text24), Scale(Text16)),
.class_name = meditation.ink_class,
.wrap = cast(TextWrap)TextWrapNone,
.align = cast(TextAlign)TextAlignCenter,
+5
View File
@@ -594,6 +594,11 @@ its time) in `private.inbe.v1.app-installs`, its private records as
cannot read changes nothing and never stops the sync. Removing the app keeps
its records and its downloaded package.
Host interface 31 keeps records whose names start with `local.` on the
device, for both legacy app records and identity-scoped app trees. They are
never queued for account sync. A package using this storage boundary must
require host interface 31 or newer; older hosts may sync those names.
Records shared with friends use the shared-list service (`/api/v1/lists`)
under ids `<name>-...`, which are never shaped like Lists' UUIDs: Lists shows
neither these records nor their invitations. Invitations, answers, saves
+7 -1
View File
@@ -11,6 +11,12 @@ tai-chi-ui-test: $(TARGET)
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
python3 tests/tai_chi_ui_test.py $(TARGET)
.PHONY: practice-movement-ui-test
practice-movement-ui-test: $(TARGET)
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
-u GDK_DISPLAY -u SESSION_MANAGER YUE_DESKTOP_RECOVERY=0 \
python3 tests/practice_movement_ui_test.py $(abspath $(TARGET))
.PHONY: launcher-ui-test
launcher-ui-test: $(TARGET)
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 \
@@ -81,7 +87,7 @@ native-text-pixels-test: $(TARGET)
# The longest suites come first so the gate does not end waiting on one.
VISUAL_TEST_TARGETS := $(NATIVE_VISUAL_TARGETS) launcher-ui-test lumi-ui-test practice-images-ui-test leaderboard-ui-test native-screenshot-test native-text-pixels-test native-zoom-test settings-sidebar-ui-test startup-quit-ui-test locale-render-ui-test lumi-history-ui-test habits-table-ui-test habits-count-ui-test habit-day-ui-test habit-schedule-tool-test habit-tracking-tool-test lists-ui-test sync-review-ui-test data-back-ui-test lumi-selection-ui-test lumi-harness-ui-test lumi-guide-ui-test lumi-emphasis-ui-test customize-nav-ui-test
VISUAL_TEST_TARGETS += audio-setup-ui-test apps-onboarding-test practice-downloads-ui-test tab-switch-performance-test habit-unsaved-ui-test
VISUAL_TEST_TARGETS += entity-profile-ui-test
VISUAL_TEST_TARGETS += entity-profile-ui-test practice-movement-ui-test
VISUAL_TEST_TARGETS += dew-topup-ui-test
VISUAL_TEST_TARGETS += music-navigation-test
visual-test: $(TARGET) $(INBE_FULL_BUNDLE) $(NODE_APP_BUNDLES)
+19 -2
View File
@@ -115,6 +115,23 @@ ScreenshotOwned :: (product: string) -> bool {
return true
}
screenshot_clock :: #system_library "raylib";
ScreenshotClockNow :: () -> float64 #foreign screenshot_clock "GetTime";
ScreenshotClockWait :: (seconds: float64) #foreign screenshot_clock "WaitTime";
// Cached practice content opens asynchronously. Screenshot fixtures must
// finish that read before they select a course or start a session.
ScreenshotPracticeReady :: (app: *InnerBreeze, practice: s32) {
deadline := ScreenshotClockNow() + 10.0
PracticeDownloadsPump(practice, app.voice_narration_enabled != 0,
app.guide_narration_enabled != 0, true)
while !PracticeContentReady(practice) && ScreenshotClockNow() < deadline {
ScreenshotClockWait(0.01)
PracticeDownloadsPump(practice, app.voice_narration_enabled != 0,
app.guide_narration_enabled != 0, true)
}
}
screenshot_day_index_offset :: (offset_days: s32) -> s32 {
local := LocalNow()
date := BreakDateFromLocal(local)
@@ -508,10 +525,10 @@ setup_screenshot_scene :: (app: *InnerBreeze, request: *ScreenshotRequest) {
practice_owned = ScreenshotOwned
// Their cache holds the default recording; screenshots never download.
app.tai_chi.voice = 0
PracticeDownloadsPump(EXERCISE_TAI_CHI, app.voice_narration_enabled != 0, app.guide_narration_enabled != 0, true)
ScreenshotPracticeReady(app, EXERCISE_TAI_CHI)
}
if scene_text == "astral_projection_session" {
PracticeDownloadsPump(EXERCISE_ASTRAL_PROJECTION, false, false, true)
ScreenshotPracticeReady(app, EXERCISE_ASTRAL_PROJECTION)
}
if scene_text == "lumi_chat" || scene_text == "lumi_customize" ||
scene_text == "lumi_customize_light" || scene_text == "diary" ||
+8
View File
@@ -12,6 +12,8 @@ app_getenv_bytes :: (name: *u8) -> *u8 #foreign c;
#import, file "../screens/elist_types.zi";
#import, file "../screens/lumi_screen.zi";
#import, file "../app/app_frame_transition.zi";
#import, file "../app/app_route_state.zi";
#import, file "../app/app_route_url.zi";
#import, file "../app/application.zi";
#import, file "../app/application_init.zi";
#import, file "../app/application_frame.zi";
@@ -641,7 +643,13 @@ CaptureScreenshot :: (app: *InnerBreeze) -> s32 {
return -1
}
// Fixtures can open dialogs in a bundled app. Finish its background
// open before selecting the scene, then retain that route.
AppsFinishOpening()
before := app_current_route(app)
setup_screenshot_scene(app, request)
app_observe_direct_route_change(app, before)
app_route_transition_cancel(app)
warmup_frames := screenshot_warmup_frames(request)
{
frame: s32 = 0
+1 -1
View File
@@ -136,7 +136,7 @@ whm_preview_share :: (preview: *BreathSession, fraction: float32) -> float32 {
return 0.0
}
share := (BreathDrawRadiusAt(preview.*, fraction) - cast(float32)preview.rmin) /
cast(float32)span
cast(float32)span
if share < 0.0 {
return 0.0
}
+157
View File
@@ -0,0 +1,157 @@
"""Exercise package movement controls and saved settings on a private display."""
import ast
import contextlib
import json
import os
from pathlib import Path
import shutil
import sqlite3
import subprocess
import sys
import tempfile
import time
from ui_driver import UiDriver
ROOT = Path(__file__).resolve().parents[1]
OUTPUT = ROOT / 'build/practice-movement-ui-test'
OUTPUT.mkdir(parents=True, exist_ok=True)
DESKTOP_KEYS = ('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY', 'DBUS_SESSION_BUS_ADDRESS',
'GDK_DISPLAY', 'SESSION_MANAGER')
assert all(not os.environ.get(key) for key in DESKTOP_KEYS), 'Inherited desktop environment'
BINARY = Path(sys.argv[1]).resolve()
BUNDLE = Path(sys.argv[2]).resolve() if len(sys.argv) > 2 else ROOT / 'build/inbe-full.zx'
def stop(process):
if process.poll() is None:
process.terminate()
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
process.kill()
process.wait(timeout=5)
with contextlib.ExitStack() as stack:
env = {key: value for key, value in os.environ.items() if key not in DESKTOP_KEYS}
env.update(YUE_DESKTOP_RECOVERY='0', APP_NO_TRAY='1', SDL_VIDEODRIVER='x11',
SDL_AUDIODRIVER='dummy', LIBGL_ALWAYS_SOFTWARE='1', LP_NUM_THREADS='2', APP_SHOT_WINDOW='1')
display_log = stack.enter_context((OUTPUT / 'display.log').open('w'))
display = subprocess.Popen(['Xvfb', '-noreset', ':953', '-displayfd', '1', '-screen', '0',
'1280x900x24', '-nolisten', 'tcp'], env=env,
stdout=subprocess.PIPE, stderr=display_log)
stack.callback(stop, display)
number = display.stdout.readline().decode().strip()
display.stdout.close()
assert number.isdecimal() and int(number) >= 300 and display.poll() is None
env['DISPLAY'] = ':' + number
@contextlib.contextmanager
def application(scene):
with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as directory:
profile = Path(directory)
cache = profile / 'packages'
cache.mkdir()
for name in ('sunsalutation', 'astral_projection', 'workout'):
shutil.copyfile(ROOT / 'build/practice-content' / (name + '.zx'),
cache / ('practice-' + name + '.zx'))
driver = UiDriver(profile / 'driver')
local_env = env | driver.environment() | {'INBE_SCREENSHOT_DATA_ROOT': str(profile), 'APP_DATA_ROOT': str(profile)}
log_path = OUTPUT / (scene + '.log')
with log_path.open('w') as log:
arguments = [str(BINARY), '--bundle', str(BUNDLE), '--screenshot',
str(OUTPUT / 'unused.png'), '--screenshot-scene', scene,
'--screenshot-width', '411', '--screenshot-height', '900',
'--screenshot-ui-scale', '10', '--screenshot-theme', '0']
bootstrap = subprocess.Popen(arguments, cwd=ROOT, env=local_env,
stdout=log, stderr=subprocess.STDOUT)
try:
deadline = time.monotonic() + 20
while not (profile / 'inbe.db').exists():
assert bootstrap.poll() is None
assert time.monotonic() < deadline
time.sleep(.05)
time.sleep(.5)
finally:
stop(bootstrap)
with sqlite3.connect(profile / 'inbe.db') as db:
user = db.execute("SELECT id FROM users WHERE kind='local' LIMIT 1").fetchone()[0]
for key, value in {'language': 'en', 'language_system': '0', 'language_setup_done': '1',
'apps_setup_done': '1', 'tutorial_seen': '1', 'habits_guide_seen': '1',
'lumi_guides_seen': '127', 'launcher_guide_seen': '1',
'package_updates_allowed': '0', 'voice_narration_enabled': '0',
'guide_narration_enabled': '0'}.items():
db.execute("INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) "
"ON CONFLICT(user_id,key) DO UPDATE SET value=excluded.value", (user, key, value))
driver.reset()
app = subprocess.Popen(arguments, cwd=ROOT, env=local_env, stdout=log, stderr=subprocess.STDOUT)
driver.attach(app, log_path)
try:
deadline = time.monotonic() + 20
window = ''
while time.monotonic() < deadline:
assert app.poll() is None, log_path.read_text()[-4000:]
found = subprocess.run(['xdotool', 'search', '--onlyvisible', '--pid', str(app.pid)],
env=local_env, capture_output=True, text=True, timeout=2)
if found.returncode == 0 and (profile / 'inbe.db').exists():
window = found.stdout.splitlines()[0]
break
time.sleep(.05)
assert window, log_path.read_text()[-4000:]
yield driver, profile, window, local_env
assert app.poll() is None, log_path.read_text()[-4000:]
assert 'frame rejected' not in log_path.read_text()
finally:
stop(app)
def state(window, environment):
output = subprocess.check_output(['xprop', '-id', window, '_HARMONY_APP_STATE'],
env=environment, text=True, timeout=5)
return json.loads(ast.literal_eval(output.split(' = ', 1)[1]))
def saved(profile, key, expected=None):
deadline = time.monotonic() + 5
while True:
with sqlite3.connect(profile / 'inbe.db', timeout=3) as db:
row = db.execute('SELECT value FROM settings WHERE key=?', (key,)).fetchone()
value = row[0] if row else None
if expected is None or value == expected or time.monotonic() >= deadline:
return value
time.sleep(.05)
with application('practice_config_sun_salutation') as (driver, profile, window, local_env):
slider = driver.wait(label='Rounds', role='slider')
x = slider['x'] + slider['width'] * .98
y = slider['y'] + slider['height'] * .7
driver.pointer(x, y)
driver.pointer(x, y, down=True)
driver.pointer(x, y, down=False)
driver.release_pointer()
assert saved(profile, 'sun_salutation_repetitions', '12') == '12'
driver.press(label='Woman with bun', role='dropdown')
driver.press(label='Man with short hair', role='option')
assert saved(profile, 'sun_salutation_character', '1') == '1'
with application('astral_projection_session') as (driver, profile, window, local_env):
driver.wait(label='Resume', role='button')
assert state(window, local_env)['paused']
driver.press(label='Resume', role='button')
driver.wait(label='Pause', role='button')
assert not state(window, local_env)['paused']
driver.press(label='Pause', role='button')
driver.wait(label='Resume', role='button')
assert state(window, local_env)['paused']
with application('workout_home') as (driver, profile, window, local_env):
driver.press(label='Start Practice', role='button')
driver.wait(label='Pause', role='button')
assert state(window, local_env)['practice_running']
driver.press(label='Pause', role='button')
driver.wait(label='Resume', role='button')
assert state(window, local_env)['paused']
driver.press(label='Resume', role='button')
driver.wait(label='Pause', role='button')
assert not state(window, local_env)['paused']
print('Sun Salutation saved settings, Astral pause/resume and Workout start/pause/resume passed')
+35 -10
View File
@@ -15,7 +15,8 @@ from ui_driver import UiDriver
ROOT = Path(__file__).resolve().parents[1]
OUTPUT = ROOT / 'build/tai-chi-ui-test'
OUTPUT.mkdir(parents=True, exist_ok=True)
DESKTOP_KEYS = ('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY', 'DBUS_SESSION_BUS_ADDRESS')
DESKTOP_KEYS = ('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY', 'DBUS_SESSION_BUS_ADDRESS',
'GDK_DISPLAY', 'SESSION_MANAGER')
assert all(not os.environ.get(key) for key in DESKTOP_KEYS), 'Inherited desktop environment'
BINARY = Path(sys.argv[1] if len(sys.argv) > 1 else ROOT / 'build/bin/linux/breeze-linux-x86_64')
BUNDLE = Path(sys.argv[2] if len(sys.argv) > 2 else ROOT / 'build/inbe-full.zx')
@@ -35,6 +36,10 @@ def contains(outer, inner):
with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as profile, contextlib.ExitStack() as stack:
# Raylib uses ALSA directly rather than SDL's dummy audio driver. Keep
# the real preview player on a private null sink, away from desktop audio.
audio_config = Path(profile) / 'alsa.conf'
audio_config.write_text('pcm.!default {\n type null\n}\n')
cache = Path(profile) / 'packages'
cache.mkdir()
for name in ('taichi', 'taichi.en'):
@@ -43,9 +48,10 @@ with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as profile, cont
driver = UiDriver(OUTPUT / 'driver')
env = {key: value for key, value in os.environ.items() if key not in DESKTOP_KEYS}
env.update(driver.environment())
env.update(INBE_SCREENSHOT_DATA_ROOT=profile, YUE_DESKTOP_RECOVERY='0',
env.update(INBE_SCREENSHOT_DATA_ROOT=profile, APP_DATA_ROOT=profile, YUE_DESKTOP_RECOVERY='0',
APP_NO_TRAY='1', SDL_AUDIODRIVER='dummy', SDL_VIDEODRIVER='x11',
LIBGL_ALWAYS_SOFTWARE='1', APP_SHOT_WINDOW='1')
LIBGL_ALWAYS_SOFTWARE='1', LP_NUM_THREADS='2', APP_SHOT_WINDOW='1',
ALSA_CONFIG_PATH=str(audio_config))
display_log = stack.enter_context((OUTPUT / 'display.log').open('w'))
display = subprocess.Popen(['Xvfb', '-noreset', ':951', '-displayfd', '1', '-screen', '0', '1280x900x24',
'-nolisten', 'tcp'], env=env, stdout=subprocess.PIPE, stderr=display_log)
@@ -109,6 +115,8 @@ with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as profile, cont
def application(scene, width=1280, height=900):
log_path = OUTPUT / (scene + '.log')
with log_path.open('w') as log:
# A restarted app must not replay the previous process's input.
driver.reset()
app = subprocess.Popen([str(BINARY), '--bundle', str(BUNDLE),
'--screenshot', str(OUTPUT / 'unused.png'),
'--screenshot-scene', scene, '--screenshot-width', str(width),
@@ -136,6 +144,19 @@ with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as profile, cont
finally:
stop(app)
# Complete setup in this disposable profile before selecting a scene.
# The scene must not race first-run language/audio/app-selection routing.
with application('tai_chi_customize'):
pass
with sqlite3.connect(Path(profile) / 'inbe.db') as db:
user = db.execute("SELECT id FROM users WHERE kind='local' LIMIT 1").fetchone()[0]
for key, value in {'language': 'en', 'language_system': '0', 'language_setup_done': '1',
'apps_setup_done': '1', 'tutorial_seen': '1', 'habits_guide_seen': '1',
'lumi_guides_seen': '127', 'launcher_guide_seen': '1',
'package_updates_allowed': '0'}.items():
db.execute("INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) "
"ON CONFLICT(user_id,key) DO UPDATE SET value=excluded.value", (user, key, value))
with application('tai_chi_customize'):
for label in ('Jade woman', 'Indigo man'):
driver.wait(label=label, role='text')
@@ -169,7 +190,8 @@ with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as profile, cont
driver.press(label='Close')
driver.wait_gone(label='Background music')
driver.wait(label='Tai Chi')
driver.wait(label='Start Practice', role='button')
# This disposable profile has no paid-course entitlement; the home
# can show Unlock. The chooser itself is exercised by its scene below.
# The full app's sidebar shows beside the practice. Diary is no
# longer pinned on a new install; Apps opens it with the rest.
nodes = driver.tree()
@@ -177,7 +199,8 @@ with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as profile, cont
navigation = [node['label'] for node in nodes if node['visible'] and node['parent'] in bars]
assert 'Habits' in navigation and 'Apps' in navigation, navigation
assert not driver.find(contains='Indigo man', visible=True), driver.text()
driver.press(label='Start Practice', role='button')
with application('tai_chi_choose'):
# The Course dialog: its progress line and lessons. Kryon's dialog
# title ("Course") is not in the widget tree.
driver.wait(contains='practised')
@@ -195,10 +218,7 @@ with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as profile, cont
driver.pointer(*outside, down=False)
driver.release_pointer()
driver.wait_gone(contains='practised')
driver.wait(label='Start Practice', role='button')
driver.press(label='Customize', role='button')
for label in ('Jade woman', 'Indigo man'):
driver.wait(label=label, role='text')
driver.wait(label='Tai Chi')
# Use an existing custom-track slot with a disposable WAV. Previewing it
# exercises the real music player without a download or desktop audio.
@@ -236,7 +256,12 @@ with tempfile.TemporaryDirectory(prefix='profile-', dir=OUTPUT) as profile, cont
driver.press(label='Test music', role='button')
driver.wait(contains='Stop', role='button')
driver.press(label='Close')
driver.press(label='Customize', role='button')
driver.wait_gone(contains='Stop', role='button')
# Reopen the buyer's fixture after a cold restart: this profile has no
# paid entitlement, and the saved choice must survive the process.
with application('tai_chi_customize'):
driver.wait(label='Background music')
assert dropdown_below('Background music')['label'] == 'Test music', driver.text()
assert not driver.find(contains='Stop', visible=True), driver.text()
# None is the music off option, independent of narration and cues.