package file→ .shtukbase/packages/norms-core/checks/waivers.ts
checks/waivers.ts
20 lines, 947 B.
- // NS-R03. A waiver is a record with rule, where, because, simplerRejected, allowedBy and expires; an allowed
- // waiver past its date is a finding.
- import { day, empty, main, records, status, today } from './pagelib.ts';
- const FIELDS = ['rule', 'where', 'because', 'simplerRejected', 'allowedBy', 'expires'];
- export const RULE = { id: 'ns-r03', title: 'A waiver is only a record with a reason and a deadline' };
- export function check(): string[] {
- const out: string[] = [];
- for (const [addr, head] of records('norms/waivers')) {
- const miss = FIELDS.filter((f) => empty(head[f]));
- if (miss.length) out.push(`${addr}: the waiver does not fill ${miss.join(', ')}`);
- const end = day(head.expires);
- if (status(head) === 'allowed' && end !== null && end < today()) out.push(`${addr}: the waiver expired on ${end} — close it or extend it with a new permission`);
- }
- return out;
- }
- if (import.meta.main) main({ RULE, check });