core: require account attribution for legacy imports

Apply provider and historical account identity checks to the designated hourly import source. Retain previously attributed history when a CLI signs out, while excluding mismatched or unknown accounts.

Refs #19
This commit is contained in:
Florian Schmidt
2026-11-15 11:14:52 +01:00
parent b23b7289c7
commit 583f920307
3 changed files with 27 additions and 3 deletions
+2 -2
View File
@@ -56,8 +56,8 @@ public static class FleetAnalysis
List<ModelTokenPoint> tokens = reconciled.Select(u => new ModelTokenPoint(Hour(u.Time), u.Model, u.Counts)).ToList();
if (account.HistoryBefore is { } before)
{
var legacy = profiles.SingleOrDefault(p => p.Machine == account.LegacyMachine && p.Profile.Id == account.LegacyProfile).Profile;
if (legacy is null) warnings.Add("Designated legacy history source has not reported.");
var legacy = verified.SingleOrDefault(p => p.Machine == account.LegacyMachine && p.Profile.Id == account.LegacyProfile).Profile;
if (legacy is null) warnings.Add("Designated legacy history source is unavailable or unverified.");
else tokens.AddRange(legacy.LegacyTokens.Where(t => t.Time < before));
warnings.Add("Before the migration cutoff, history uses one designated machine; cross-machine attribution is unavailable.");
}