feat(home): implement count for home auth dispatch requests and enable usage statistics

- Added `count` attribute to `homeAuthCount` requests to improve home message batching.
- Enabled usage statistics for home mode by default and added config-level enforcement.
- Adjusted failure logging to include detailed metadata in `UsageReporter`.
- Updated multiple executors to pass error details to `PublishFailure` for better debugging.
- Enhanced unit tests to validate `count` behavior and usage statistics enforcement across components.
This commit is contained in:
Luis Pater
2026-05-10 01:30:43 +08:00
parent 1abf8625d8
commit 66c3dae06b
21 changed files with 281 additions and 52 deletions
+29
View File
@@ -99,3 +99,32 @@ func TestServiceApplyCoreAuthAddOrUpdate_DeleteReAddDoesNotInheritStaleRuntimeSt
t.Fatalf("expected re-added auth to re-register models in global registry")
}
}
func TestForceHomeRuntimeConfigEnablesUsageStatistics(t *testing.T) {
cfg := &config.Config{
UsageStatisticsEnabled: false,
}
forceHomeRuntimeConfig(cfg)
if !cfg.UsageStatisticsEnabled {
t.Fatal("expected home runtime config to force usage statistics enabled")
}
}
func TestApplyHomeOverlayForcesUsageStatisticsEnabled(t *testing.T) {
baseCfg := &config.Config{}
baseCfg.Home.Enabled = true
service := &Service{cfg: baseCfg}
service.applyHomeOverlay(&config.Config{
UsageStatisticsEnabled: false,
})
if service.cfg == nil || !service.cfg.UsageStatisticsEnabled {
t.Fatal("expected home overlay to force usage statistics enabled")
}
if !service.cfg.Home.Enabled {
t.Fatal("expected home overlay to preserve local home settings")
}
}