Item 5 of the owner's beta.6 list: after the USB drive's letter changed and changed back (H: on 2026-09-22 morning, D: after the reboot), the library showed two entries side by side for the games played from it, and the relocator's NOT EXISTS refused every move onto the other entry's path - 5,675 "could not be moved" lines that day. D26 (owner): two entries for one executable merge, in the Agent. - ExecutableRelocator: a same-bytes move refused because another library entry holds the path becomes a merge (IGameMerge / SqliteGameMerge, one transaction; GameMergePlan picks the entry made first, a tie keeping the lower id). Sessions are re-parented before the dropped row is deleted (sessions.game_id cascades), the survivor takes the path after (UNIQUE). A block either carried is kept (hooking off), a crash auto-disable still in force is kept, crash counts add; no consent moves between the rows - hook_enabled only ever goes to 0. The merge re-reads both rows in the transaction and writes nothing unless they are as planned. - It waits while a session of either entry runs (CaptureOrchestrator. IsRecording) or waits in a .partial to be recovered (IPartialSessionStore. PendingGameIds, read beside a running writer with FileShare.ReadWrite). - Never with an entry removed from the library; other bytes under a twin are not merged - the log says once which entry to remove. D27 (owner): when the only file at the entry's path on another letter has other bytes (updated meanwhile), the entry follows it through the Change executable write: hooking off, consent cleared, block kept. The watcher's adopt follows the same rule. Also: - LibraryImporter no longer adds a twin: a store executable that is a library entry's path on another letter, with that entry's file gone, is shown "In the library under another drive letter" (Import_Note_Moved, en/vi/ja) and skipped at import. - DetectionSweep does not call a merged-away entry unreadable. - DetectionHostedService catches DbException: a service that throws stops the Agent's host, and a busy ledger is a retry. Tests: relocator (merge, survivor choice, busy, refused merge, removed owner, other bytes not merged, D27 sweep and watcher, ambiguity), plan, SqliteGameMerge on a real ledger (sessions re-parented, block and auto-disable carried or not, no consent moved, nothing written when a row changed), sweep, importer, import review, .partial headers beside a writer. Docs: 19_SAFETY, 06_DATA_MODEL, HANDOFF D24 done + D26/D27 + traps, CHANGELOG. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.5 KiB
C#
37 lines
1.5 KiB
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using FrameLedger.App.Services;
|
|
using FrameLedger.Application.Import;
|
|
|
|
namespace FrameLedger.App.ViewModels;
|
|
|
|
/// <summary>One row of FR-1.2's review checklist: ticked by default when it can be imported, with the store, the name, the executable the import would add, and why it cannot when it cannot.</summary>
|
|
public sealed partial class ImportCandidateViewModel : ObservableObject
|
|
{
|
|
[ObservableProperty]
|
|
private bool _isSelected;
|
|
|
|
public ImportCandidateViewModel(ImportCandidate candidate)
|
|
{
|
|
Candidate = candidate ?? throw new ArgumentNullException(nameof(candidate));
|
|
_isSelected = candidate.CanImport;
|
|
Note = candidate.AlreadyInLibrary ? Strings.Import_Note_Already
|
|
: candidate.MovedFrom is not null ? Strings.Import_Note_Moved
|
|
: candidate.ExePath is null || candidate.ExecutableMissing ? Strings.Import_Note_NoExe
|
|
: candidate.ExecutableGuessed ? Strings.Import_Note_Guessed
|
|
: string.Empty;
|
|
}
|
|
|
|
public ImportCandidate Candidate { get; }
|
|
|
|
public bool CanImport => Candidate.CanImport;
|
|
|
|
public string PlatformText => Formats.Platform(Candidate.Game.Platform);
|
|
|
|
public string Name => Candidate.Game.Name;
|
|
|
|
public string ExeText => Candidate.ExePath ?? Strings.Common_Dash;
|
|
|
|
/// <summary>Already in the library (under this drive letter or, since 2026-09-23, another), no executable found, or a guessed executable the user should check.</summary>
|
|
public string Note { get; }
|
|
}
|