core: write only new history and share files on Windows
The store rewrote all of history.json, 19 MB here, on every 60 s refresh. It now appends each refresh's changes to a journal and compacts into monthly files and a state checkpoint at 8 MiB, so an idle refresh writes only snapshot.json. Bucket updates are keyed, unchanged limit samples are kept at most hourly, Codex replays are bounded by session totals, and Claude dedupe keys expire after 60 days. Readers of atomically replaced files allow delete sharing, and the replace retries briefly, so the Stream Deck plugin reading snapshot.json cannot make a refresh fail. Claude's <synthetic> entries are skipped, and repeated diagnostics fold into one entry with a count. Refs #1
This commit is contained in:
@@ -66,4 +66,26 @@ public class CliTests
|
||||
}
|
||||
finally { Directory.Delete(directory, true); }
|
||||
}
|
||||
[Fact]
|
||||
public async Task PrintsFoldedDiagnosticCountAndLastTime()
|
||||
{
|
||||
var directory = Path.Combine(Path.GetTempPath(), "finaltoken-cli-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(directory);
|
||||
try
|
||||
{
|
||||
using var output = new StringWriter();
|
||||
using var error = new StringWriter();
|
||||
var result = await CliApplication.RunAsync(["status", "--no-probe"], output, error, directory, path =>
|
||||
{
|
||||
var engine = new RefreshEngine(path, claudeDirectory: path, codexDirectory: path,
|
||||
cliDiscovery: (_, _) => new(null, "Fixture CLI missing."));
|
||||
for (var i = 0; i < 20; i++) engine.Diagnostics.Add(Provider.Claude, "fixture-parse", "Malformed usage.");
|
||||
return engine;
|
||||
}, TestContext.Current.CancellationToken);
|
||||
Assert.Equal(0, result);
|
||||
Assert.Contains("fixture-parse (x20, last ", error.ToString());
|
||||
Assert.Equal(1, error.ToString().Split('\n').Count(line => line.StartsWith("fixture-parse", StringComparison.Ordinal)));
|
||||
}
|
||||
finally { Directory.Delete(directory, true); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user