v1.0.11 · Release snapshot

Documentation comes from this release commit, without inheriting newer content. Commit: cc3dd17e61.

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:

bun runtime:start
  1. computes the native fingerprint of your checkout,
  2. downloads the matching prebuilt .app from the registry if it is not already cached/installed (~/.piano-runtime/<fingerprint>/),
  3. boots a simulator and installs it,
  4. starts Metro (the project's start script) and opens the app on it.

There is no local native build and no expo-updates/OTA: JS always comes from Metro.

FlagMeaning
--udid <udid>Simulator to use (default: the booted iPhone, else the newest iOS runtime's first iPhone).
--port 8081Metro port. A Metro already running there is reused.
--latestUse the newest published runtime instead of the fingerprint match (native features that changed since may be missing/crash).
--no-metroInstall + launch only.

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:

export GITLAB_TOKEN=glpat-…                 # personal / project access token
# or a deploy token (gldt-…): detected from the prefix, sent as DEPLOY-TOKEN
# export GITLAB_TOKEN=gldt-…

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>

PackageVersionFiles
magic-piano-sim<fingerprint> (immutable)MagicPiano-<fingerprint>.tar.gz, manifest.json (runtime version, commit, sha256, size, …)
magic-piano-sim-indexlatestreleases.json — newest 20 builds, used by --latest and error messages

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=1 baked 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, so runtime:start is 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.

Buildfastlane ios release_simulator (ARM64_ONLY=1, unsigned) → sim:pack → sim:publish
Registrymagic-piano-sim-release/<full commit sha>/{MagicPiano-release-<sha>.tar.gz, manifest.json}, plus magic-piano-sim-release/latest/manifest.json (copy of the newest manifest). Newest 10 commits are kept — pruning needs a token that may delete packages; with a job token it is skipped with a log line
AdsGoogle demo units (EXPO_PUBLIC_ADMOB_USE_TEST_IDS=1 is set by the job), never real ads
Not includedMetro, DevTool (EXPO_PUBLIC_ENABLE_DESKTOP_TOOLS is not set), local overrides

On a developer / tester machine (same GITLAB_TOKEN as above):

bun sim:install                         # newest build → boot a simulator → install → launch
bun sim:install --commit <40-char sha>  # a specific merge
bun sim:install --clean                 # uninstall first (no persisted app state)
bun sim:install --udid <udid> --no-launch

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.

bun run e2e:release                                        # install the newest published build clean, run all flows
bash .maestro/run-release.sh .maestro/flows/03-gameplay-scoring.yaml   # only some flows
E2E_COMMIT=<40-char sha> bun run e2e:release               # a specific merge

.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:

set -a; . .maestro/e2e.env; set +a                         # the env the flows assume
NODE_ENV=production ARM64_ONLY=1 bunx expo prebuild --clean --platform ios
bundle exec fastlane ios release_simulator                 # -> build/ios-sim/…/Release-iphonesimulator/MagicPiano.app
LOCAL=1 bash .maestro/run-release.sh                       # install it clean + run all flows
SKIP_INSTALL=1 bash .maestro/run-release.sh .maestro/flows/05-profile.yaml    # re-run one flow on what is installed (fast loop)

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:

claude mcp add maestro -- maestro mcp      # add --scope project to share it

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).