← Files ForgeMindARCHIVED FILE
src/design-fidelity-control-receipts.mjs
1.19 KB · Oct 4, 2026 · 12:31 UTC
export function verifyControlContract({ contract, observations = [] }) { const receipts = []; const gaps = []; for (const control of contract.controls ?? []) { const observed = observations.find((item) => item?.id === control.id); if (!observed || observed.role !== control.role || observed.name !== control.name || (control.visibleText && observed.visibleText !== control.visibleText) || observed.status !== 'passed') { gaps.push({ code: 'FM_DESIGN_FIDELITY_CONTROL_NOT_EVIDENCED', controlId: control.id, message: `Required ${control.role} "${control.name}" is not evidenced.` }); continue; } if (control.safeInteraction && (!observed.interaction || observed.interaction.type !== control.safeInteraction.type || (control.safeInteraction.target && !String(observed.interaction.url ?? '').endsWith(control.safeInteraction.target)))) { gaps.push({ code: 'FM_DESIGN_FIDELITY_INTERACTION_NOT_EVIDENCED', controlId: control.id, message: `Safe interaction for ${control.id} is not evidenced.` }); continue; } receipts.push({ controlId: control.id, role: observed.role, name: observed.name, status: 'passed', evidence: observed.evidence ?? [] }); } return { receipts, gaps, status: gaps.length ? 'gaps-found' : 'passed' }; }
SHA-256: 9a5da834d12a05de9bb39c22dde8613b0242db45a1644a6e8014f6e3139736c9