core: add limit forecasts, week days and per-model series (D7)
LimitAnalysis computes the use at reset at the average rate, a recent-rate forecast from the last 24 h of samples, and for windows longer than a day the use of each local day, today's use, the even pace and the daily budget. Pace now projects the date of reaching 100 % whenever usage is over pace, not only past the threshold. Samples whose resets lie within 15 minutes form one window instance, because Claude's reset times drift by a minute between probes. TokenSeriesByModel replaces one query per chart point, and a missing settings.json on first start is no longer a diagnostic. Refs #5
This commit is contained in:
@@ -5,6 +5,23 @@ namespace FinalToken.Core.Tests;
|
||||
|
||||
public sealed class PartialSettingsTests
|
||||
{
|
||||
[Fact]
|
||||
public void MissingSettingsIsNormalFirstStart()
|
||||
{
|
||||
using var directory = new TestDirectory();
|
||||
var diagnostics = new DiagnosticLog();
|
||||
Assert.Equal(new Settings(), SettingsFile.Load(directory.Path, diagnostics));
|
||||
Assert.Empty(diagnostics.Recent);
|
||||
}
|
||||
[Fact]
|
||||
public void PresentMalformedSettingsIsDiagnostic()
|
||||
{
|
||||
using var directory = new TestDirectory();
|
||||
directory.Write("settings.json", "{broken");
|
||||
var diagnostics = new DiagnosticLog();
|
||||
Assert.Equal(new Settings(), SettingsFile.Load(directory.Path, diagnostics));
|
||||
Assert.Equal("settings-defaults", Assert.Single(diagnostics.Recent).Code);
|
||||
}
|
||||
[Theory]
|
||||
[InlineData("{}")]
|
||||
[InlineData("{\"refreshInterval\":\"00:00:30\"}")]
|
||||
|
||||
Reference in New Issue
Block a user