/** Compare a hand-entered source identity with the official directory before loading. */ export function assertEventSchoolIdentity(schoolNumber: string, sourceName: string, directoryName?: string) { if (!sourceName.trim()) return; const normalize = (name: string) => name.normalize("NFKD").toUpperCase().replace(/[^A-Z0-9]/g, ""); if (!directoryName || normalize(sourceName) !== normalize(directoryName)) { throw new Error(`[events] ${schoolNumber}: source school '${sourceName}' does not match directory '${directoryName ?? "MISSING"}'`); } }