Ossatura del progetto: soluzione, contratti, specifica, mockup, carattere e icone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 14:47:06 +00:00
1 parent 10a9ed3ec3
commit db3d9f1aa4
123 files changed
+3763 -1

No files matched your search

+143
View File
@@ -0,0 +1,143 @@
using Febe.Core.Abstractions;
namespace Febe.Core.Domain;
/// <summary>An hourly and daily budget for one action category.</summary>
public sealed record Budget(int PerHour, int PerDay);
/// <summary>
/// Values of a caution profile (spec §7.5). These are cautious starting estimates, not official limits
/// and not measurements: the interface must say so.
/// </summary>
public sealed record CautionProfile
{
public required CautionProfileKind Kind { get; init; }
/// <summary>Start of the daily active window (local time).</summary>
public required TimeOnly WindowStart { get; init; }
/// <summary>End of the daily active window (local time); may be after midnight (e.g. 00:30).</summary>
public required TimeOnly WindowEnd { get; init; }
/// <summary>Random daily shift applied to start and end, ± this amount.</summary>
public required TimeSpan WindowJitter { get; init; }
public required TimeSpan SessionMin { get; init; }
public required TimeSpan SessionMax { get; init; }
public required TimeSpan PauseMin { get; init; }
public required TimeSpan PauseMax { get; init; }
/// <summary>Budgets per category, excluding <see cref="ActionKind.DataDownload"/>.</summary>
public required IReadOnlyDictionary<ActionKind, Budget> Budgets { get; init; }
/// <summary>Daily download budget in bytes.</summary>
public required long DataPerDayBytes { get; init; }
/// <summary>Default per-account backfill limit (posts per day).</summary>
public required int BackfillPostsPerAccountPerDay { get; init; }
/// <summary>Gradual start: days to go from half to full budgets.</summary>
public required int RampUpDays { get; init; }
/// <summary>Active weekdays (all by default).</summary>
public IReadOnlySet<DayOfWeek> ActiveDays { get; init; } = new HashSet<DayOfWeek>(Enum.GetValues<DayOfWeek>());
public bool GradualStart { get; init; } = true;
public GesturePace Pace { get; init; } = GesturePace.Natural;
private const long GB = 1024L * 1024 * 1024;
public static CautionProfile Prudent { get; } = new()
{
Kind = CautionProfileKind.Prudent,
WindowStart = new TimeOnly(7, 30),
WindowEnd = new TimeOnly(23, 30),
WindowJitter = TimeSpan.FromMinutes(40),
SessionMin = TimeSpan.FromMinutes(2),
SessionMax = TimeSpan.FromMinutes(10),
PauseMin = TimeSpan.FromMinutes(20),
PauseMax = TimeSpan.FromMinutes(90),
Budgets = new Dictionary<ActionKind, Budget>
{
[ActionKind.Home] = new(4, 30),
[ActionKind.ProfileOpen] = new(12, 100),
[ActionKind.StoryView] = new(50, 300),
[ActionKind.BackfillPage] = new(20, 100),
[ActionKind.SinglePost] = new(10, 60),
[ActionKind.FollowingListPage] = new(15, 60),
},
DataPerDayBytes = 4 * GB,
BackfillPostsPerAccountPerDay = 300,
RampUpDays = 7,
};
public static CautionProfile Balanced { get; } = new()
{
Kind = CautionProfileKind.Balanced,
WindowStart = new TimeOnly(7, 0),
WindowEnd = new TimeOnly(0, 0),
WindowJitter = TimeSpan.FromMinutes(30),
SessionMin = TimeSpan.FromMinutes(3),
SessionMax = TimeSpan.FromMinutes(14),
PauseMin = TimeSpan.FromMinutes(12),
PauseMax = TimeSpan.FromMinutes(60),
Budgets = new Dictionary<ActionKind, Budget>
{
[ActionKind.Home] = new(5, 45),
[ActionKind.ProfileOpen] = new(20, 180),
[ActionKind.StoryView] = new(80, 500),
[ActionKind.BackfillPage] = new(30, 180),
[ActionKind.SinglePost] = new(15, 100),
[ActionKind.FollowingListPage] = new(20, 90),
},
DataPerDayBytes = 8 * GB,
BackfillPostsPerAccountPerDay = 500,
RampUpDays = 5,
};
public static CautionProfile Fast { get; } = new()
{
Kind = CautionProfileKind.Fast,
WindowStart = new TimeOnly(6, 30),
WindowEnd = new TimeOnly(0, 30),
WindowJitter = TimeSpan.FromMinutes(30),
SessionMin = TimeSpan.FromMinutes(4),
SessionMax = TimeSpan.FromMinutes(18),
PauseMin = TimeSpan.FromMinutes(8),
PauseMax = TimeSpan.FromMinutes(40),
Budgets = new Dictionary<ActionKind, Budget>
{
[ActionKind.Home] = new(6, 60),
[ActionKind.ProfileOpen] = new(30, 300),
[ActionKind.StoryView] = new(120, 800),
[ActionKind.BackfillPage] = new(45, 300),
[ActionKind.SinglePost] = new(20, 160),
[ActionKind.FollowingListPage] = new(30, 150),
},
DataPerDayBytes = 16 * GB,
BackfillPostsPerAccountPerDay = 800,
RampUpDays = 3,
};
public static CautionProfile For(CautionProfileKind kind) => kind switch
{
CautionProfileKind.Prudent => Prudent,
CautionProfileKind.Balanced => Balanced,
CautionProfileKind.Fast => Fast,
_ => throw new ArgumentOutOfRangeException(nameof(kind), kind, "Custom profiles are stored values, not presets."),
};
/// <summary>Limits enforced by the interface (spec §7.5): minimum pause 5 min, session ≤ 30 min, window ≤ 20 h, no budget above twice «Rapido».</summary>
public static class Limits
{
public static readonly TimeSpan MinPause = TimeSpan.FromMinutes(5);
public static readonly TimeSpan MaxSession = TimeSpan.FromMinutes(30);
public static readonly TimeSpan MaxWindow = TimeSpan.FromHours(20);
public static Budget MaxBudget(ActionKind kind) =>
new(Fast.Budgets[kind].PerHour * 2, Fast.Budgets[kind].PerDay * 2);
public static long MaxDataPerDayBytes => Fast.DataPerDayBytes * 2;
}
}