Skip to content

feat(favorites): export and import a library as JSON - #616

Merged
EVWorth merged 1 commit into
mainfrom
feat/favorites-import-export
Sep 10, 2026
Merged

EVWorth merged 1 commit into
mainfrom
feat/favorites-import-export

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Closes #335.

Someone with two hundred favorites had no way to back them up or hand them to a colleague. Both directions now exist, from the panel's header.

Design points

  • Versioned from the start. Something people are told to keep and share will outlive the shape that wrote it, and a reader that can't tell which version it holds is left guessing.
  • Import merges, not replaces — what FR-9.2.4 asks for. Identity is name-and-category, the pair the store already refuses to duplicate, so importing the same file twice imports nothing the second time.
  • Ids are regenerated. They're per-install counters; a file from someone else's machine could collide with a local one.
  • Empty categories carry across. Someone who organised their library before filling it should get the shelves as well as the books.
  • Imports are scrubbed — an export written before [P1/security] Favorites persist raw SQL with user-supplied values — no scrubbing/redaction #339 can carry a credential.

The report says what happened to the whole file

"Imported 3" when the file held forty is a report worth doubting, so skipped and unreadable entries are counted and shown. A file that isn't JSON, or is JSON but isn't an export, says so rather than importing nothing and calling it success.

A test-isolation note

The api mocks live in a module factory and keep their calls between tests. One test's export looked like the next one's until they were reset — caught by the cancelled-dialog test, which is exactly the one that would notice.

Verification

13 store tests, 7 UI tests. Unit 2074, browser 297, 0 lint errors.

Someone with two hundred favorites had no way to back them up or hand them
to a colleague (#335). Both directions now exist, from the panel's header.

The file is versioned from the start. Something people are told to keep and
share will outlive the shape that wrote it, and a reader that cannot tell
which version it holds is left guessing.

Import merges rather than replacing, which is what FR-9.2.4 asks for.
Identity for merging is name-and-category — the pair the store already
refuses to duplicate — so importing the same file twice imports nothing the
second time. Ids are regenerated, because they are per-install counters and
a file from someone else's machine could collide with a local one.

Empty categories carry across too: someone who organised their library
before filling it should get the shelves as well as the books.

An import is scrubbed on the way in, since an export written before #339
can carry a credential.

The report says what happened to everything in the file, not just the good
half. "Imported 3" when the file held forty is a report worth doubting, so
skipped and unreadable entries are counted and shown. A file that is not
JSON, or is JSON but not an export, says so rather than importing nothing
and calling it success.

Closes #335

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth merged commit f4257d3 into main Sep 10, 2026
12 checks passed
@EVWorth
EVWorth deleted the feat/favorites-import-export branch September 10, 2026 11:31
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.

[P1/doc-drift] FR-9.2.4 import/export favorites as JSON — not implemented

1 participant