db.Entry(job).ReloadAsync(ct) interaction with tracked tracks entities
Source: Code review (automated)
Date: 2026-09-02
Scope: Recent changes (Manual Selection rip mode, PR #144)
File(s): src/ArmRipper.Core/Rip/ArmRipperService.cs
Problem
After the manual selection wait, the code calls db.Entry(job).ReloadAsync(ct) to pick up the API-persisted ManualSelectionTrackNumbers. The local tracks list entities were added to the context earlier via db.Tracks.Add(track). If ReloadAsync also reloads the job.Tracks navigation (when loaded), it could detach/replace the tracked track entities, causing the subsequent db.Entry(track).Property(x => x.Process).IsModified = true to throw on a detached entity. The unit test passes, but it uses a specific setup; the behavior under a fully-loaded job.Tracks navigation is not covered.
Proposed Fix
Verify (and add a test for) the case where job.Tracks is already loaded before the manual selection wait, to confirm the reload doesn't detach the track entities.
Notes
Needs deeper investigation before a fix can be prescribed.
db.Entry(job).ReloadAsync(ct) interaction with tracked tracks entities
Source: Code review (automated)
Date: 2026-09-02
Scope: Recent changes (Manual Selection rip mode, PR #144)
File(s):
src/ArmRipper.Core/Rip/ArmRipperService.csProblem
After the manual selection wait, the code calls
db.Entry(job).ReloadAsync(ct)to pick up the API-persistedManualSelectionTrackNumbers. The localtrackslist entities were added to the context earlier viadb.Tracks.Add(track). IfReloadAsyncalso reloads thejob.Tracksnavigation (when loaded), it could detach/replace the tracked track entities, causing the subsequentdb.Entry(track).Property(x => x.Process).IsModified = trueto throw on a detached entity. The unit test passes, but it uses a specific setup; the behavior under a fully-loadedjob.Tracksnavigation is not covered.Proposed Fix
Verify (and add a test for) the case where
job.Tracksis already loaded before the manual selection wait, to confirm the reload doesn't detach the track entities.Notes
Needs deeper investigation before a fix can be prescribed.