Add administrative room close and reopen controls
Preserve readable private tables, discussion and pending games while closure blocks new play, joins, messages, AI and seat mutations. Add live-authorized atomic closure audits, room-version/revision fences, dedicated controls and exact saved retries. Reopen with the saved pause/join settings and current credentials; restoring a removed but closed room keeps its AI stopped. Verified types, lint, 5356 offline tests, 52 HTTP tests and build. Seventeen dedicated authenticated HTTP groups and independent privacy/persistence review passed. Desktop/mobile browser QA confirmed one close after a lost response and refresh, persistent readable notices, retained private draft, mobile reopening and saved-seat refresh. All 2,001 baseline rooms, 4,243 seats and related records preserved. Positive production admin acceptance awaits authorized QA access; full admin and rules gates remain open.
This commit is contained in:
1 parent
238de3860d
commit
98b1b3261b
49 files changed
+4255
-86
No files matched your search
@@ -0,0 +1,63 @@
|
||||
export type AdminClosureInput = {
|
||||
operationId: string;
|
||||
expectedVersion: number;
|
||||
expectedRevision: number;
|
||||
closed: boolean;
|
||||
reason: string;
|
||||
};
|
||||
|
||||
export type AdminClosureView = {
|
||||
removed: boolean;
|
||||
code: string;
|
||||
version: number;
|
||||
closed: boolean;
|
||||
revision: number;
|
||||
closedAt: number | null;
|
||||
updatedAt: number | null;
|
||||
paused: boolean;
|
||||
joinLocked: boolean;
|
||||
};
|
||||
|
||||
export type AdminClosureResult = {
|
||||
operationId: string;
|
||||
replayed: boolean;
|
||||
appliedRevision: number;
|
||||
appliedVersion: number;
|
||||
room: AdminClosureView;
|
||||
};
|
||||
|
||||
export function validAdminClosureInput(
|
||||
value: unknown,
|
||||
): value is AdminClosureInput {
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
|
||||
const input = value as Record<string, unknown>;
|
||||
const fields = [
|
||||
'operationId',
|
||||
'expectedVersion',
|
||||
'expectedRevision',
|
||||
'closed',
|
||||
'reason',
|
||||
];
|
||||
return (
|
||||
Object.keys(input).length === fields.length &&
|
||||
fields.every((field) => Object.hasOwn(input, field)) &&
|
||||
typeof input.operationId === 'string' &&
|
||||
input.operationId.length === 36 &&
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(
|
||||
input.operationId,
|
||||
) &&
|
||||
[input.expectedVersion, input.expectedRevision].every(
|
||||
(version) =>
|
||||
Number.isSafeInteger(version) &&
|
||||
Number(version) >= 0 &&
|
||||
Number(version) < Number.MAX_SAFE_INTEGER,
|
||||
) &&
|
||||
typeof input.closed === 'boolean' &&
|
||||
typeof input.reason === 'string' &&
|
||||
!!input.reason.trim() &&
|
||||
input.reason.length <= 300 &&
|
||||
!input.reason
|
||||
.split('')
|
||||
.some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127)
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user