Documentation comes from this release commit, without inheriting newer content. Commit: 35589c6fda.
Prebuilt Debug simulator runtime (@piano/runtime-provider)
Developers write JavaScript only. The native iOS shell — the Expo dev client with Skia, Firebase, AdMob, the audio engine, … — is built once by CI and published to this project's GitLab generic package registry. On a developer machine:
- computes the native fingerprint of your checkout,
- downloads the matching prebuilt
.appfrom the registry if it is not already cached/installed (~/.piano-runtime/<fingerprint>/), - boots a simulator and installs it,
- starts Metro (the project's
startscript) and opens the app on it.
There is no local native build and no expo-updates/OTA: JS always comes from Metro.
bun runtime:fingerprint prints the fingerprint.
One-time setup: registry token
The project is private, so downloading needs a token with the read_package_registry scope — a personal access token, or a deploy token:
or save it once to ~/.piano-runtime/config.json (chmod 600): {"token": "glpat-…"} ("kind": "private"|"deploy" only to override the prefix detection). The token is only needed when something must be downloaded; a cached runtime starts offline. Never commit it.
When runtime:start says "No prebuilt runtime is published"
You changed something that alters the native shell (a native dependency, a config plugin in plugins/, a module in modules/, app.config.ts, config/runtime-shell.env) and CI has not built that combination yet. Ask someone to trigger the build (below) — or, if you have not touched native code, update your branch from dev. --latest is the explicit escape hatch.
JS-only changes (anything under src/, app/, packages/* that is not native, package.json scripts) never change the fingerprint.
Building a new runtime (CI, manual)
Build → Pipelines → Run pipeline on the branch and pick PIPELINE_TARGET = runtime in the dropdown (the same dropdown offers the TestFlight builds: internal, release). There is nothing else to fill in: the runtime is labelled with the app version in package.json. The label is informational (shown in manifest.json, the index and error messages); the registry key is the native fingerprint, so several builds can share one version.
The runtime_sim_publish job (runtime.yml) uses the same toolchain steps as the TestFlight jobs: fingerprint → exits early if already published (and prints which version owns it) → .prebuild_ios (expo prebuild) → fastlane ios runtime_simulator (Debug build_app for the simulator; streams progress and writes the usual gym logs, which are tailed and uploaded on failure) → ci:pack (embeds the build identity, tarball, manifest.json) → ci:publish. It never runs on push/tag/MR, and not the quality gate.
Registry layout
https://gitlab.amanotes.net/api/v4/projects/1572/packages/generic/<package>/<version>/<file>
manifest.json is uploaded last, so its presence means "fully published". The index is overwritten on every publish, so the project's Allow duplicates package setting must stay on. Downloads are verified against the manifest's sha256 and tarball paths are checked before extraction.
How the fingerprint stays equal on CI and every machine
fingerprint.config.js (balanced @expo/fingerprint preset; hashes plugins/ and modules/ by content; ignores package.json scripts and .gitignore) evaluated with a pinned env: the committed .env plus config/runtime-shell.env. .env.local is never read, so a local override cannot make you miss the published app — and your Metro still sees your own .env.local for JS. Changing runtime-shell.env changes the fingerprint (CI then needs a new build). The generated ios/ folder is gitignored and ignored by the fingerprint; CI asserts it is unchanged by expo prebuild.
Not covered / limits
- iOS Simulator only (arm64); no Android, no device builds.
- The shell is built with the Debug configuration and
EXPO_PUBLIC_ENABLE_DESKTOP_TOOLS=1,EXPO_PUBLIC_ADMOB_USE_TEST_IDS=1baked into the native project (Info.plist / AdMob App ID); JS-side values come from your Metro env. - Concurrent publishes can race on
releases.json; the manifests stay correct, soruntime:startis unaffected.
Release simulator build (merge to dev)
The Debug runtime above needs Metro. For testing the whole app there is a second artifact: the Release simulator app (JS bundled, minified Hermes bytecode, console stripped — the same JS and native config as TestFlight), built by CI job sim_release_publish (runtime.yml) manually only: Run pipeline → PIPELINE_TARGET=sim-release for any branch (never on a push or merge — rebuild it when native code or .maestro/e2e.env changes). e2e_maestro downloads a published build only when you start it with Run pipeline → PIPELINE_TARGET=e2e. A push to dev does not run it.
On a developer / tester machine (same GITLAB_TOKEN as above):
Builds are cached under ~/.piano-runtime/sim-release/<sha>/. The app has the same bundle id as the Debug runtime, so installing it replaces that one (and vice versa).
E2E with Maestro
The flows in .maestro/flows/ cover the app's logic end to end (first run incl. practice training, navigation, keyboard, real gameplay + scoring, song catalog, profile + persistence). They assume the env in .maestro/e2e.env: app variant sim (stub IAP / ads), demo ad units, no intro film and a mock catalog (three known songs on a hand-authored chart: single notes + a hold), so flows play songs for real — no finish shortcut — and 00-first-run walks the whole first run (intro, tutorial practice, tutorial song, pick a free song). The CI build job exports the env. How the flows work around iOS UI automation limits (idle app, Reduce Motion, landscape orientation) is in the .maestro README.
Running / developing flows — always against the Release simulator app (JS bundled; the same artifact CI tests). The Debug dev client is not used for e2e: its dev-menu overlay hides the app from Maestro's accessibility tree.
.maestro/run-release.sh boots a simulator with Reduce Motion on, installs the app clean and runs maestro test with a JUnit report and screenshots in build/e2e/. Needs Maestro CLI + a GITLAB_TOKEN (see above) for the registry.
Editing a flow or testing before a merge — use your own local build, no registry:
The app code does not change while you edit flows, so the build is a one-off. bun run e2e:catalog drives the Debug dev client with its own Metro and is a separate path.
CI (runtime.yml): two jobs, one runner, the same artifacts. e2e_mr is a manual job on the merge request pipeline (when: manual, allow_failure): play it to build that MR's Release simulator app on the VM (LOCAL=1) and run all flows. It does not start when the MR is opened or updated, and an unplayed or failed run does not block the merge (ci-cd.md). e2e_maestro builds nothing and is manual only: Run pipeline → PIPELINE_TARGET=e2e (E2E_COMMIT, default the newest build in the package registry). A push to dev does not start it. Both keep build/e2e/ for two weeks, pass or fail: the JUnit report (Tests tab), failure screenshots and the run video video/e2e-run.mp4, linked from the merge request. Maestro is pinned to 2.5.1. Not yet verified on a real runner: simulator boot and video recording inside the Tart VM, and the Maestro / ffmpeg install steps.
Maestro MCP
Maestro MCP lets a coding agent drive that simulator: list_devices, inspect_screen (view hierarchy), take_screenshot, run (inline YAML / files), cheat_sheet, open_maestro_viewer; run_on_cloud needs maestro login. It ships inside the Maestro CLI:
Restart the agent afterwards. Repo rule: agents may inspect, screenshot and author flows, but do not execute e2e flows (run) — the user or CI does (testing-and-quality.mdc).