Finding
aggelmata::MediaType owns the canonical eight-variant media domain and its Display strings, but it does not own the inverse parse. Kritike health checking and Apotheke play history therefore each carry an exact private parser for the same eight strings.
This is distinct from the already-canonical wants.media_type mapping (music_album / tv_series etc.). The duplicated functions reverse the ordinary Display representation exactly, including news.
Verified against main 65644113e47814c87eaba14a6f322820974b8780.
Evidence
crates/aggelmata/src/media.rs:8-32 defines the eight MediaType variants and their canonical display strings: music, audiobook, book, comic, podcast, news, movie, tv.
aggelmata/src/media.rs:35-71 already demonstrates the intended ownership pattern for the separate wants-schema vocabulary through as_want_str and parse_want_str, explicitly calling itself the single source of truth.
crates/kritike/src/health.rs:181-193 defines parse_media_type by matching those eight Display strings to the eight variants.
crates/apotheke/src/repo/play_history/mod.rs:162-174 defines the same parse_media_type byte-for-byte.
- Both callers deliberately return
None for unknown/future values rather than defaulting to Music; that error policy can be preserved by a canonical FromStr/parse implementation.
No open issue owns this inverse mapping.
Why this matters
A new media type or rename currently requires changing the enum/Display implementation and then discovering every private inverse matcher. Missing one makes persisted/query data readable in some subsystems and silently skipped in others.
The type already exists specifically to prevent primitive string drift across subsystem boundaries. Leaving its ordinary string parser outside the type defeats that ownership on the read path.
Desired correction
Add one canonical parser for the ordinary MediaType string representation in aggelmata—for example FromStr or MediaType::parse—with an explicit unknown-value error/Option contract. Make Kritike and Apotheke delegate to it and retain parse_want_str for the intentionally different wants-table vocabulary.
Done when:
- every string emitted by
MediaType::Display round-trips through one parser;
- unknown/future strings fail explicitly rather than defaulting;
- Kritike and Apotheke contain no local eight-way media-type match;
- wants-schema parsing remains a separate named mapping; and
- a test fails if a new
MediaType variant gains a Display value without inverse parsing support.
Finding
aggelmata::MediaTypeowns the canonical eight-variant media domain and itsDisplaystrings, but it does not own the inverse parse. Kritike health checking and Apotheke play history therefore each carry an exact private parser for the same eight strings.This is distinct from the already-canonical
wants.media_typemapping (music_album/tv_seriesetc.). The duplicated functions reverse the ordinaryDisplayrepresentation exactly, includingnews.Verified against
main65644113e47814c87eaba14a6f322820974b8780.Evidence
crates/aggelmata/src/media.rs:8-32defines the eightMediaTypevariants and their canonical display strings:music,audiobook,book,comic,podcast,news,movie,tv.aggelmata/src/media.rs:35-71already demonstrates the intended ownership pattern for the separate wants-schema vocabulary throughas_want_strandparse_want_str, explicitly calling itself the single source of truth.crates/kritike/src/health.rs:181-193definesparse_media_typeby matching those eight Display strings to the eight variants.crates/apotheke/src/repo/play_history/mod.rs:162-174defines the sameparse_media_typebyte-for-byte.Nonefor unknown/future values rather than defaulting to Music; that error policy can be preserved by a canonicalFromStr/parseimplementation.No open issue owns this inverse mapping.
Why this matters
A new media type or rename currently requires changing the enum/Display implementation and then discovering every private inverse matcher. Missing one makes persisted/query data readable in some subsystems and silently skipped in others.
The type already exists specifically to prevent primitive string drift across subsystem boundaries. Leaving its ordinary string parser outside the type defeats that ownership on the read path.
Desired correction
Add one canonical parser for the ordinary
MediaTypestring representation inaggelmata—for exampleFromStrorMediaType::parse—with an explicit unknown-value error/Optioncontract. Make Kritike and Apotheke delegate to it and retainparse_want_strfor the intentionally different wants-table vocabulary.Done when:
MediaType::Displayround-trips through one parser;MediaTypevariant gains a Display value without inverse parsing support.