Skip to content

fix(onboarding): make reset/restore-onboarding.sh build-kind aware (ENG-340) - #520

Open
pnewsam wants to merge 2 commits into
stagingfrom
paul/eng-340-onboarding-scripts-build-kind-aware
Open

fix(onboarding): make reset/restore-onboarding.sh build-kind aware (ENG-340)#520
pnewsam wants to merge 2 commits into
stagingfrom
paul/eng-340-onboarding-scripts-build-kind-aware

Conversation

@pnewsam

@pnewsam pnewsam commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What & why

Since ENG-324, each build kind keeps its state in a separate config home so builds never share a SQLite DB (an older build reopening a DB a newer build advanced fails to start on an unrecognized Alembic migration):

  • dev~/.cowork-dev
  • preview~/.cowork-preview
  • stable~/.cowork-stable
  • prod~/.cowork

The onboarding reset/restore scripts never got the memo — they only touched ~/.anton and the prod ~/.cowork. So running reset-onboarding.sh against a dev/preview/stable build did nothing to the home that build actually uses, and you couldn't get a clean first-run state to test onboarding.

Changes

  • reset-onboarding.sh / restore-onboarding.sh take the build kind as an argument (default dev) and reset/restore the matching per-kind home.
  • For prod only, the reset moves the legacy ~/.anton migration sources aside so first-run migrateLegacyHome can't re-seed credentials and defeat the reset. Non-prod homes never inherit that prod-era state, so they're left untouched.

Also: per-channel Electron userData dir

Companion to the per-channel app-identity work in #387. Once each non-prod build kind gets its own Electron app name (app.setName → a separate ~/Library/Application Support/<name> dir), a reset must clear that dir, not the shared anton one. So the scripts now derive ELECTRON_DIR from a per-kind app-name map (prod stays anton; the stable kind targets the staging env, so its app is labelled "Staging"). Kept here — rather than in #387 — so this PR owns all onboarding-script changes and stays independently mergeable on staging. The map is forward-compatible: before #387 ships every kind is still anton, so the per-kind dirs simply don't exist yet and the reset skips them.

Risk

None to production. These are hand-run local dev-QA scripts — they touch no application code, no CI, and nothing that ships. Split out of #385 (the build-channel consolidation) because it's a separate concern (ENG-340) with no review risk.

Test plan

Run ./scripts/reset-onboarding.sh dev then ./scripts/restore-onboarding.sh dev and confirm ~/.cowork-dev is backed up and restored.

🤖 Generated with Claude Code

…NG-340)

Since ENG-324 each build kind keeps its state in a separate home
(~/.cowork-dev / -preview / -stable, ~/.cowork for prod) so builds never share a
SQLite DB. The onboarding reset/restore scripts still only touched ~/.anton and
the prod ~/.cowork, so resetting a dev/preview/stable build did nothing to the
home it actually uses.

- Take the build kind as an argument (default dev) and reset the matching
  per-kind home (~/.cowork-<kind>, ~/.cowork for prod).
- For prod only, move the legacy ~/.anton migration sources aside so first-run
  migrateLegacyHome can't re-seed credentials and defeat the reset; non-prod
  homes never inherit that prod-era state.
- restore-onboarding.sh reverses the same per-kind backups.

Dev tooling only: these scripts are run by hand for local onboarding QA and
touch nothing in the app, CI, or production.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… (ENG-340)

Follow-on to the per-channel app-identity work (#387): since each non-prod build
kind gets its own Electron app name (app.setName → a separate userData dir), the
reset/restore scripts must target the channel-specific dir, not the shared
~/Library/Application Support/anton.

- Derive ELECTRON_DIR from a per-kind app-name map (prod stays 'anton'; non-prod
  kinds mirror channels.ts appName — the `stable` kind targets the staging env so
  its app is labelled "Staging").
- Reword the localStorage/consent comments: state now lives under the channel's
  OWN userData dir, so a reset clears only the kind you pass.

Kept here (rather than in #387) so #520 owns all onboarding-script changes and
stays independently mergeable on staging; the app-name map is a hardcoded mirror
either way (bash can't import channels.ts).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant