Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-flight Checklist
Please ensure you've completed all of the following.
Description of Change
Importing a file exported from a Ferdium server (like api.ferdium.org) into a local account failed with
SQLITE_CONSTRAINT: NOT NULL constraint failed: services.recipeIdand no services were created. The server serializes its models with snake_case keys (service_id,recipe_id), while_createAndCacheService()in the internal server only readserviceIdandrecipeId, which is the shape of the internal server's own export. It now reads both, the same way the import in ferdium-server already acceptsservice.recipe_id || service.recipeId. Readingservice_idmatters as well: with only the recipe key renamed (the workaround in the issue), the services are created but every workspace ends up with[null, null]instead of its services.Tested with a new Jest test in
test/internal-server/UserController.test.tsthat imports a server export and an internal export and checks the recipe ids and the workspace service mapping; the first test fails without the change. The test lives intest/because the Jest config ignoressrc/internal-server. I also ranpnpm typecheck,pnpm lint,pnpm biome:check, prettier and the fullpnpm test, and started the internal server under Node with a stubbedelectronmodule to post both formats to/transfer: before the change the server export failed with the same constraint error, after it the services and workspaces came through with the workspaces pointing to the new service ids. I did not run it in the packaged app.Motivation and Context
Fixes #2182
Checklist
pnpm prepare-code)pnpm testpassesRelease Notes
Exports from a Ferdium server can now be imported into a local account.