refactor(server): inline client capability parsing

With capability negotiation in place, the consumer-side tolerance pattern is unnecessary. Drop the dead readDeclaredClientCapabilities helper, inline the parsing in ClientCapabilities.fromHello, delete a tautological assertion in the relay reconnect test, and document the compatibility rules in architecture.md.
This commit is contained in:
Mohamed Boudra
2026-05-02 20:30:25 +07:00
parent ca318f29cf
commit d53d601043
4 changed files with 31 additions and 41 deletions
@@ -3,21 +3,3 @@ export const CLIENT_CAPS = {
} as const;
export type ClientCapability = (typeof CLIENT_CAPS)[keyof typeof CLIENT_CAPS];
const CLIENT_CAPABILITY_SET = new Set<string>(Object.values(CLIENT_CAPS));
export function isClientCapability(value: string): value is ClientCapability {
return CLIENT_CAPABILITY_SET.has(value);
}
export function readDeclaredClientCapabilities(
capabilities: Record<string, unknown> | null | undefined,
): ClientCapability[] {
if (!capabilities) {
return [];
}
return Object.entries(capabilities).flatMap(([key, value]) =>
value === true && isClientCapability(key) ? [key] : [],
);
}