[ID3v2] Eager Loading for Text Frames#137
Conversation
There was a problem hiding this comment.
Pull request overview
Switches TextInformationFrame and UserTextInformationFrame from lazy parsing of raw data to eager parsing at construction time (similar to PR #134 for URL frames). Removes the _rawData/_rawVersion deferred-parsing mechanism, splits UserTextInformationFrame to manage its own description/text fields independently, and rewrites renderFields to build output from the parsed fields rather than echoing raw data. A new ByteVector.join helper is added to support the rewrite, and tests are extensively reworked to cover the new behavior.
Changes:
- Drop lazy raw-data parsing in text information frames; parse eagerly in
parseFieldsand add dedicated parse/render inUserTextInformationFrame(with its own_descriptionfield). - Add
ByteVector.join(separator, values)and corresponding tests. - Rework text frame tests for the eager model (constructor body bytes, parameterized cases for falsy values, multi-version render coverage) and add a
findUserTextInformationFrametruthiness guard.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/id3v2/frames/textInformationFrame.ts | Removes lazy raw-data fields; eager parseFields; rewrites renderFields for v3/v4; adds dedicated _description plus parse/render in UserTextInformationFrame. |
| src/byteVector.ts | Adds ByteVector.join static helper; @TODO comment on get bounds check. |
| test-unit/byteVectorConstructorTests.ts | Adds coverage for ByteVector.join (truthiness, empty, separator and value variations). |
| test-unit/id3v2/textInformationFrameTests.ts | Rewrites parse/render tests around eager loading; adds parameterized invalid-version and empty/falsy render cases; covers toString. |
| test-unit/id3v2/userTextInformationFrameTests.ts | Adds eager-parse tests (well-formed, ill-formed), description/text setters, find/render/toString coverage. |
| test-unit/id3v2/userUrlLinkFrameTests.ts | Consolidates Latin1/UTF16 fromOffsetRawData tests into a parameterized case. |
| test-unit/id3v2/id3v2TagTests.ts | Sets text on TYER test frame so it actually renders content after eager-loading change. |
| test-unit/id3v2/frameFactoryTests.ts | Populates text on TCOM frame before render so the round-trip has content. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I'm really sleepy... 💤
Um, this makes text frames eagerly loaded, just like in #134. Tests were added and reworked.
🤖
Initial implementation was done via 🤖 , but it didn't get everything right, so there was a bunch of corrective work after the fact.