New migration

From jellyrock/jellyrock · View interactive version

New migration is an AI agent skill from the GitHub repository jellyrock/jellyrock. Guided workflow for writing a registry migration in JellyRock when a setting key is renamed, removed, or its data shape changes. Walks docs/dev/registry-migrations.md (add a version constant, add the migration's function and its gated call in the runner for the right scope in source/migrations.bs, u

How to use this skill

Skill file

/new-migration: a guided workflow

Wraps CODE0 as a step-by-step. The guide is the source of truth and has the full examples; read its section for each step before doing it. Main() in CODE2 runs the migrations before it creates the scene, so once a migration has run, the rest of the app sees only the new names.

Step 0: Confirm a migration is needed

You need one only when you change something users have already stored (the guide's list):

You don't need one to add a setting (use CODE0), to change a default, or to change a label or description. If none of the triggers apply, stop.

Step 1: Pick the scope

Main() calls two runners in CODE1, in this order:

Step 2: Add a version constant

Each migration is a named function that the runner calls behind a version constant (the guide's step 1). At the top of source/migrations.bs, after the last constant, add one with a comment saying what changed:

' client version when homeSection settings were removed from registry (now server-authoritative via DisplayPreferences)
const HOMESECTION_CLEANUP_VERSION = "2.13.0"

Step 3: Add the function and its gated call

Write the migration as its own function below the runner, taking reg and section, so its spec can call it alone and a later migration can never change what that spec sees. Then add the gated call at the end of the runner for your scope, so the gates stay in version order. It runs when the section was last used by an older version:

if isValid(lastRunVersion) and not versionChecker(lastRunVersion, MY_CHANGE_VERSION)
  m.wasMigrated = true
  migrateMyChange(reg, section)
end if

runGlobalMigrations() still keeps its blocks inline; give a global migration a function the same way when it needs a spec of its own. Copy the shape of the guide's example (migrateAudioCodecSetting), and follow its rules:

Step 4: Update the code that used the old name

After a rename, nothing may read the old name (the guide's step 3):

  1. settings/settings.json: change the settingName.
  2. components/data/jellyfin/JellyfinUserSettings.xml: change the field's id, since a registry key with no field of the same name is never loaded.
  3. Everything else outside source/migrations.bs, docs and agent files included:

```bash

git grep -n "<old-name>" -- source components settings tests docs .claude ':!source/migrations.bs'

```

Leave alone what is meant to keep the old name: earlier migrations' mappings in source/migrations.bs, legacy inputs in the migration specs and mocks, and docs/user/app-settings.md, which is generated.

  1. Existing cases that go through the runner from an old LastRunVersion (the version-gate cases, and the whole-chain case in SettingsMigration.spec.bs) now run your migration too. One that reads the setting you changed (GlobalSettingsCleanup.spec.bs, SplashSettingRemoval.spec.bs) needs its assertions moved to the new name.

Step 5: Write the integration test

Follow the guide's Test it. The test goes in tests/source/integration/migration/, in a spec named for the migration. In short:

Step 6: Run it on hardware

Run npm run device:check first. The migration and registry tags keep those suites out of test:all and test:integration, and that includes every existing spec Step 4 changed (the guide's Run the tests), so run them one of two ways:

Then try it with real data: sideload the last release, store the old key, sideload your build over it, and watch the console. If the probe fails, say the probe failed: a migration that builds can still fail at runtime.

Step 7: Record a non-obvious rename (optional)

If the reason for the new name isn't obvious, invoke /log decision with a slug like rename-<old>-to-<new>.

When not to use

Sub-agent invocation

To run it from a sub-agent, the parent passes Read .claude/skills/new-migration/SKILL.md and follow the steps for the change <rename-or-removal-description>; surface each step's diff but do not commit in the Agent prompt.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.