Skip to content

feat(utilities): SettingsSnapshot.Copy<T> — reflection settings snapshot (no dropped fields)#617

Open
RicherTunes wants to merge 1 commit into
mainfrom
chore/settings-snapshot-helper
Open

feat(utilities): SettingsSnapshot.Copy<T> — reflection settings snapshot (no dropped fields)#617
RicherTunes wants to merge 1 commit into
mainfrom
chore/settings-snapshot-helper

Conversation

@RicherTunes
Copy link
Copy Markdown
Owner

What

Adds SettingsSnapshot.Copy<T>(this) — reflection-copies every read-write property of a settings object into a fresh instance for the download-client pre-await snapshot.

Why

Hand-written field-by-field snapshot copies silently dropped fields across plugins, disabling features in background downloads (which read the snapshot, not the live settings):

  • amazonmusicarr: dropped EnableDrm → native Widevine CDM never activated in real downloads.
  • tidalarr: dropped SaveSyncedLyrics + UseLRCLIB → background ignored the user's lyric settings.

The host-shape settings classes are hard to unit-test, so the drops went unnoticed. Copying by reflection makes the snapshot structurally unable to drop a field — a newly-added setting is captured automatically. Get-only/computed properties are skipped.

Adoption

Lets all five plugins replace their bespoke snapshot copies with one shared, tested helper (find-once → fix-once-in-Common → all adopt). Plugins re-pin to this Common SHA and call SettingsSnapshot.Copy(this) in their download-client snapshotter once merged.

Tests

4 unit tests: copies-all / independent-of-source / ignores-get-only / null-throws.

🤖 Generated with Claude Code

…hot (no dropped fields)

Download clients snapshot their settings synchronously before the background download's first await, so the
deferred work sees a stable view even if the host repoints live settings mid-download. Hand-written
field-by-field copies proved fragile: across plugins a copy silently dropped a field (amazonmusicarr's
EnableDrm, tidalarr's SaveSyncedLyrics/UseLRCLIB), so a feature the user enabled was ignored in the
background download — and the host-shape settings classes are hard to unit-test, so the drop went unnoticed.

SettingsSnapshot.Copy<T>(this) reflection-copies every public read-write instance property into a fresh
instance — structurally cannot drop a field; a newly-added setting is captured automatically. Get-only /
computed properties are skipped. Lets all five plugins replace their bespoke snapshot copies with one shared,
tested helper (find-once -> fix-once-in-Common -> all adopt).

TDD: 4 tests (copies-all / independent-of-source / ignores-get-only / null-throws). Declared in PublicAPI.

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