Skip to content

bug(app-state): rehydrate never resolves when migrating legacy standalone prompt templates #686

Description

@Juliusolsson05

Found while working on #681. Unrelated to that change — reproduces on a clean main with the branch stashed.

Expected

useAppStore.persist.rehydrate() resolves when upgrading a version-5 settings blob that also has legacy standalone prompt templates in their own storage key.

Actual

It never resolves. The test hangs until Vitest's 5s limit:

× app store > hydrates legacy standalone prompt templates into persisted
    settings during a version upgrade   5006ms
  Error: Test timed out in 5000ms.

src/renderer/src/app-state/store.test.ts:40. Deterministic — three runs, 5006ms / 5017ms / 5008ms.

What narrows it

The sibling test immediately below (backfills built-in MCP defaults when hydrating a version-7 settings blob, line 65) uses the same harness, the same createStorageMock, the same dynamic import and the same await useAppStore.persist.rehydrate() — and passes. The only material difference is that the failing case seeds PROMPT_TEMPLATES_STORAGE_KEY alongside the app-store key and enters the legacy prompt-template migration path.

So the suspicion is the migration itself, not the persist harness.

Impact — genuinely unknown, and that is the concerning part

If the hang is specific to the storage mock, this is only a red test. If it reflects the real migration, a user upgrading from a v5 settings blob who has standalone prompt templates saved would have rehydrate() never resolve — which is an app that does not finish starting.

I did not investigate far enough to tell which, and did not want to guess in either direction. Worth someone establishing that before it is triaged as low priority.

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions