Skip to content

Round trip for the FS format, the one that goes onto the card - #65

Open
lgnap wants to merge 1 commit into
antoinevalentinHA:masterfrom
lgnap:test/issue-2-fs-round-trip
Open

lgnap wants to merge 1 commit into
antoinevalentinHA:masterfrom
lgnap:test/issue-2-fs-round-trip

Conversation

@lgnap

@lgnap lgnap commented Sep 11, 2026

Copy link
Copy Markdown

What

The third of the three formats, and the only one without a round-trip test: FsStoryPackWriter and FsStoryPackReader produce and consume the folder that ends up under .content/ on a device. FsPackRoundTripTest, ten cases, specifications and characterization together, in the mould of BinaryPackRoundTripTest and ArchivePackRoundTripTest.

What survives: version, night mode marker, nodes in order, asset bytes exactly and per node, transitions, the shared action node, control settings; an asset used by several nodes is stored once (header counts and one file each).

What does not, pinned as KNOWN GAP:

  • the pack uuid — the writer names the folder by the last eight hex digits of the uuid (the device's convention) and the reader takes the folder name as the uuid, so read back from the folder it wrote, the pack comes out as 56789ABC. LibraryService sidesteps this by renaming to <full uuid>.converted_<millis>, which the second case shows works;
  • the node uuids — no room in the 44-byte record; the reader gives node 0 the folder name and invents the rest, differently on every read (the FIXME in FsStoryPackReader);
  • a missing audio — the writer substitutes a silent MP3 the device needs, and the reader cannot tell it from a real one.

Two cases pin the bytes on disk against the layout verified on a real card in FORMATS.md §5–6 (#59): the 512-byte ni header field by field, the 44-byte node record and its padding, the 12-byte ri/si entries (000\00000000), li as node indices, .cleartext present, bt absent.

Fixtures

The writer refuses anything but a 320×240 4-bit RLE bitmap and an ID3-less mono MP3, so PackFixtures' pattern bytes cannot be used. The assets go through the project's own ImageConversion.anyToRLECompressedBitmap and AudioConversion.anyToMp3 from a drawn image and a synthesised tone — one MP3 encode per class (~0.5 s), and the two converters exercised on the way. No device data, no third-party content.

TESTING.md coverage map updated with the row. The count row is not touched: it reports the Windows CI figure, which this PR's run will give.

Locally: mvn … test → 340 run, 0 failures (39 FAT32 opt-in skips). git diff --exit-code clean.

Part of lgnap#2 — remaining there: cross-format conversions, PackAssetsCompression, failure paths.

🤖 Generated with Claude Code

The third of the three formats, and the only one not covered by a
round-trip test: FsStoryPackWriter and FsStoryPackReader produce and
consume the folder that ends up under .content/ on a device. Ten cases,
specifications and characterization together.

What survives: version, night mode marker, nodes in order, asset bytes
exactly and per node, transitions, the shared action node, control
settings; an asset used by several nodes is stored once. What does not,
pinned as KNOWN GAP: the pack uuid (the writer names the folder by its
last eight hex digits, the reader takes the folder name — the library
sidesteps this by renaming), the node uuids (no room in the 44-byte
record, invented on read), and a missing audio (a silent placeholder
comes back).

Two cases pin the bytes on disk against the layout verified on a device
in FORMATS.md: the 512-byte ni header and 44-byte node records, the
12-byte ri/si entries, li as node indices, .cleartext present, bt absent.

The writer refuses anything but a 320x240 RLE bitmap and an ID3-less
mono MP3, so the fixtures go through ImageConversion and AudioConversion
from a drawn image and a synthesised tone: one MP3 encode per class, and
the two converters exercised on the way. No device data.

Part of #2

Co-Authored-By: Claude Opus 5 (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