core: keep an estimated day baseline fixed and the tile rows equal
agent-review agent review: fail

An estimated day baseline took its scale from the newest sample, so use
from the web lowered the budget while today stayed within it. It now takes
the scale from the first sample at or after the day start (D7). The stale
sample warning moves into the "used" caption, so tiles of one kind keep the
same rows (D8). Both answer the first review of #15.

Refs #13
This commit is contained in:
Florian Schmidt
2026-10-18 10:08:59 +02:00
parent 158572c2ba
commit 09f7633eb5
5 changed files with 92 additions and 9 deletions
+3 -2
View File
@@ -198,7 +198,9 @@ public sealed class PanelWindow : Window
DockPanel.SetDock(chip, Dock.Right); title.Children.Add(chip); title.Children.Add(Ui.Text(w.Provider + " · " + w.Label, 15));
var card = Ui.Stack(title);
void Row(string name, Control control) { control.Name = name; card.Children.Add(control); }
Row("Percent", Ui.Text($"{w.UsedPercent:0.#} %", 36)); Row("Used", Ui.Text("used", 12, "Muted"));
Row("Percent", Ui.Text($"{w.UsedPercent:0.#} %", 36));
Row("Used", Ui.Text(now - w.SampleTime > model.ProbeInterval * 2
? $"used · ⚠ sample {Display.Duration(now - w.SampleTime)} old" : "used", 12, "Muted"));
Row("Pace", new PaceBar(window, now) { Height = 10 });
Row("Reset", Ui.Text(w.ResetsAt is { } reset ? $"Resets in {Display.Duration(reset - now)} · {Display.Projection(reset, clock)}" : "Reset unknown", 13, "Secondary"));
if (pace.Projection is { } projection)
@@ -233,7 +235,6 @@ public sealed class PanelWindow : Window
else if (days?.TodayBudget is not null && w.ResetsAt is { } lastReset) plan += " · last day, resets " + Display.Time(lastReset, clock);
Row("Plan", Ui.Text(plan, 13, "Secondary"));
}
if (now - w.SampleTime > model.ProbeInterval * 2) Row("Stale", Ui.Text($"⚠ sample {Display.Duration(now - w.SampleTime)} old", 12, "Muted"));
var tile = Ui.Card(card); tile.Name = $"LimitTile-{w.Provider}-{w.Id}";
ToolTip.SetTip(tile, new DataTooltip(w.Provider + " · " + w.Label, new("Used", $"{w.UsedPercent:0.##} %"), new("Expected", $"{pace.ElapsedFraction * 100:0.##} %"),
new("State", Display.State(pace.State)), new("Reset", w.ResetsAt is { } r ? Display.Projection(r, clock) : "Unknown"), new("Sample", w.SampleTime.LocalDateTime.ToString("g")))); return tile;