Skip to content

Investigate: db.Entry(job).ReloadAsync(ct) interaction with tracked tracks entities #178

Description

@negativeeddy

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions