You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
review: Address Copilot feedback on unified Tag views
Five review comments on #30 identified that the CombinedTag and FlacTag
facades had semantics inconsistent with the Tag abstraction and with
the rest of the IMediaFile implementations. All five are addressed:
1. CombinedTag.Render was a silent no-op returning empty bytes. A
CombinedTag is a view, not a serializable block -- rendering it
should surface misuse. Now throws NotSupportedException with a
message pointing callers to the owning file or a specific underlying
tag.
2. CombinedTag.Clear was a silent no-op. "Clear the tag" must actually
zero out the metadata, not succeed while leaving the values intact.
Now clears every non-null underlying tag.
3. CombinedTag setters were silent no-ops. Code in this repo and
documented examples assume `file.Tag.Title = "x"` mutates the file,
so silently dropping writes broke a load-bearing contract. Setters
now write through to every non-null underlying tag, which also keeps
ID3v2 + ID3v1 consistent on save.
4. FlacFile.Tag and Mp3File.Tag always returned a non-null facade even
on files with no metadata. Other IMediaFile implementations (Dsf,
Dff, Musepack, WavPack, MonkeysAudio, Ogg*, Asf, Mp4, Aiff) return
null when the tag block is absent. Both now match that convention:
null when the file has neither an underlying tag nor pictures.
5. FlacTag.Render/Clear had the same issue as #1-2. Render now throws
NotSupportedException (a FlacTag spans multiple metadata blocks --
render the FlacFile); Clear now wipes the VorbisComment fields
(including embedded METADATA_BLOCK_PICTURE entries via
VorbisComment.Clear) and removes native PICTURE blocks.
Test updates:
* CombinedTagTests: replaced the three no-op characterization tests with
their mirror-image positive tests (setters write through, Render
throws, Clear clears every member).
* FlacTagTests: replaced the combined "Render+Clear are no-ops" test
with separate positive tests for Render throwing and Clear clearing.
Added Tag_AbsentMetadata_ReturnsNull to lock in the nullability
contract. Updated tests that started from a CreateMinimal() FLAC
(Tag == null now) to seed with a VorbisComment first.
* Mp3FileTests: added Tag_NoTagsPresent_ReturnsNull for the nullability
contract and Tag_Setter_WritesThroughToBothIdTags to verify the
write-through behavior keeps v2 and v1 in sync.
All 3807 functional tests pass on net8.0 and net10.0.
0 commit comments