Repository navigation
Conversation
…urrent one to the device The library already keeps every archive of a UUID (the editor names them <title>-<uuid>-v<version>.zip), so a story could exist as v1 and v2 side by side. But the group was ordered by file modification time: a v1 copied in after the v2 was saved became "latest", lent its title and thumbnail to the tile, and was what a drop on the device sent. The device has one slot per UUID and no notion of version (FORMATS.md §9), so that silently replaced the newer story. The story pack version is the one piece of identity the formats carry for this, so it now decides: - LibraryService orders a group highest version first, modification time only breaking ties within a version; the unofficial metadata is refreshed from that first entry. - chooseDropAction only considers artefacts of the current (highest) version: an older version's conversion, however recent and device-readable, is neither reused nor offered as a source. Artefacts without a version are grouped as before, so every existing case holds. - isDowngrade + a confirmation dialog: sending a lower version than the one the device holds asks first. Every path to the device funnels through doAddToDevice, so the guard covers transfer, convert and re-convert alike. Missing versions on either side do not fire it. - The library tile shows the current version. No editor change: the version field exists and already names the file; re-exporting keeps the UUID. Choosing an older version explicitly is not offered yet. Tests: LibraryVersionOrderingTest (3), packs.test.js (+13). Closes #16 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 11, 2026
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.
What
The library already keeps every archive of a UUID — the editor names them
<title>-<uuid>-v<version>.zip— so a story can exist as v1 and v2 side by side. But a UUID's group was ordered by file modification time: a v1 copied in after the v2 was saved became "latest", lent its title and thumbnail to the tile, and was what a drop on the device sent. The device has one slot per UUID and no notion of version (seeFORMATS.md§9, #59), so that silently replaced the newer story. The card that motivated this held the same story under three UUIDs for exactly that reason.The story pack version is the one piece of identity the formats carry for this, so it now decides:
LibraryService.packs()orders a group highest version first; modification time only breaks ties within a version. The unofficial metadata (title, thumbnail) is refreshed from that first entry.chooseDropActiononly considers artefacts of the current (highest) version. An older version's conversion, however recent and device-readable, is neither reused nor offered as the source of a re-conversion. Artefacts without a version are grouped as before, so every existing C7 case holds unchanged.isDowngrade+ a confirmation dialog: sending a lower version than the one the device holds asks first (en/fr). Every path to the device funnels throughdoAddToDevice, so the guard covers transfer, convert and re-convert alike. A missing version on either side does not fire it — a guard that fires on missing data would block every legacy pack.vNbadge, same style as device tiles).Not done, on purpose: no editor change — the version field exists and already names the file, and re-exporting keeps the UUID. Explicitly choosing an older version to send is not offered yet; the per-file rows still list every version.
Tests
LibraryVersionOrderingTest(3): highest version first even when the older file is newer; timestamp breaks ties within a version; the tile's title comes from the highest version. Red before the change ([1, 2]where[2, 1]was expected).packs.test.js(+13):currentVersion, the four cross-version drop cases (V1–V4, V4 pinning that version-less packs behave as before),isDowngradeincluding the missing-version cases.Locally:
mvn … test→ 330 run, 0 failures (39 FAT32 opt-in skips);yarn test→ 67 passed;yarn buildcompiles.git diff --exit-codeclean.Tracked in lgnap#16.
🤖 Generated with Claude Code