fix: channel cache fail-close, group conflict check across pages, status toggle stale data

- GetGroupPlatforms failure now stores error-TTL cache and returns error (fail-close)
- Frontend group-to-channel conflict map loads all channels instead of current page only
- Toggle channel status reloads list when active filter would hide the changed item
This commit is contained in:
erio
2026-04-04 11:25:01 +08:00
parent 71f61bbc47
commit feb6999d9a
4 changed files with 35 additions and 11 deletions
@@ -1182,12 +1182,15 @@ func TestBuildCache_GroupPlatformError(t *testing.T) {
}
svc := newTestChannelService(repo)
// Should degrade gracefully: channel is found, but without platform info
// pricing won't match because platform will be "" and pricing platform is "anthropic"
// Should fail-close: error propagated when group platforms cannot be loaded
result, err := svc.GetChannelForGroup(context.Background(), 10)
require.NoError(t, err)
require.NotNil(t, result) // channel still found
require.Equal(t, int64(1), result.ID)
require.Error(t, err)
require.Nil(t, result)
// Within error-TTL, second call should hit cache (empty) and return nil, nil
result2, err2 := svc.GetChannelForGroup(context.Background(), 10)
require.NoError(t, err2)
require.Nil(t, result2)
}
func TestBuildCache_MultipleGroupsSameChannel(t *testing.T) {