warn on cache miss in restrictChatSettings

surfaces the regression vector where an empty cache could drop or downgrade
a server-side value for a dimension we're not restricting (PR review feedback)
This commit is contained in:
Samuel Newman
2026-06-04 18:14:59 +03:00
parent f412de521d
commit 2a334c0932
@@ -35,6 +35,18 @@ export async function restrictChatSettings({
}): Promise<void> {
const cached = getOtherRequiredDataFromCache({did})?.actorDeclaration
// When the cache is empty we fall back to defaults for any dimension we're
// not explicitly restricting, which could drop/downgrade a value the user
// has actually set server-side. The cache should be hydrated by
// prefetchOtherRequiredData before any of these paths fire, so log if that
// assumption ever breaks. (Restricting both dimensions is unaffected, so
// don't warn for the common signup/birthdate-change case.)
if (!cached && (!restrictIncoming || !restrictGroupInvites)) {
logger.warn(
`restrictChatSettings: cache miss, falling back to defaults for unrestricted dimensions`,
)
}
const record: ChatBskyActorDeclaration.Main = {
$type: 'chat.bsky.actor.declaration',
allowIncoming: restrictIncoming