// Deterministic response fixture for bridge acceptance, never a real-model // solution or a modification to the sealed pilot's original project. export const nativeContextSpecification = { tests: 9, checks: ['test', 'build'], initial: null, fixes: { 'src/amount.mjs': `export function amountToCents(value) { if (typeof value !== 'string' && (typeof value !== 'number' || !Number.isFinite(value))) throw new TypeError('Decimal amount required'); const match = /^([+-]?)(\\d+)(?:\\.(\\d{1,2}))?$/.exec(String(value).trim()); if (!match) throw new TypeError('At most two decimal places required'); const cents = (BigInt(match[2]) * 100n + BigInt((match[3] ?? '').padEnd(2, '0'))) * (match[1] === '-' ? -1n : 1n); if (cents > BigInt(Number.MAX_SAFE_INTEGER) || cents < BigInt(Number.MIN_SAFE_INTEGER)) throw new TypeError('Safe cents required'); return Number(cents); } `, 'src/summary.mjs': `import { amountToCents } from './amount.mjs'; export function summarize(rows) { if (!Array.isArray(rows)) throw new TypeError('Rows required'); const totals = new Map(); for (const row of rows) { if (!row || typeof row.currency !== 'string' || !/^[A-Za-z]{3}$/.test(row.currency.trim())) throw new TypeError('Three-letter currency required'); const currency = row.currency.trim().toUpperCase(), previous = totals.get(currency) ?? { currency, cents: 0, count: 0 }; const cents = previous.cents + amountToCents(row.amount); if (!Number.isSafeInteger(cents)) throw new TypeError('Safe aggregate required'); totals.set(currency, { currency, cents, count: previous.count + 1 }); } return [...totals.values()].sort((left, right) => left.currency.localeCompare(right.currency)); } `, 'src/report.mjs': `export function formatReport(groups) { if (!Array.isArray(groups)) throw new TypeError('Groups required'); return groups.map(({ currency, cents, count }) => { if (!/^[A-Z]{3}$/.test(currency) || !Number.isSafeInteger(cents) || !Number.isSafeInteger(count) || count < 0) throw new TypeError('Valid report group required'); const absolute = Math.abs(cents); return currency + ' ' + (cents < 0 ? '-' : '') + Math.trunc(absolute / 100) + '.' + String(absolute % 100).padStart(2, '0') + ' (' + count + ')'; }).join('\\n'); } `, }, };