Intelligence, Advanced Charting & Trading Platform
phase-1/live-proof-runner
diagnostics/chartnova-blank-screen-2026-10-15
diagnostics/chartnova-stage2-v27-preview-2026-10-15
docs/chartnova-stage1-reconcile-manifest-2026-10-15
feature/chartnova-ios-widget
feature/chartnova-light-catalog-lazy-series-2026-10-15
feature/chartnova-market-terminal
feature/chartnova-multimarket-chart-ws-foundation
feature/chartnova-neon-direct-history
feature/chartnova-neon-history
feature/paper-trading-risk-controls-2026-10-14
fix/alpha-vantage-live-payload
fix/chartnova-progressive-loading-2026-10-15
fix/live-proof-runner-cwd-2026-10-14
foundation/phase-0
foundation/postgres-core
main
ops/chartnova-emergency-rollback-2026-10-15
phase-1/candle-builder
phase-1/data-proof-artifact
phase-1/data-proof-metrics
phase-1/data-proof-report
phase-1/external-gates-state
phase-1/gold-api-fallback
phase-1/ingestion-pipeline
phase-1/live-proof-runner
phase-1/market-calendar
phase-1/market-domain
phase-1/neon-live-proof
phase-1/persistence-contract
phase-1/postgres-ci
phase-1/provider-adapters
phase-1/provider-recovery
phase-1/quality-propagation
phase-1/spike-detection
phase-1/xau-provider-adapter
risk/chartnova-alert-runtime-atomic-2026-10-22
risk/chartnova-atomic-outbox-2026-10-22
risk/chartnova-seven-track-safety-2026-10-21
safety/p0-triage-2026-10-13
| 1 | const REQUIRED = Object.freeze(['GOLD18_IRT', 'USD_IRT_FREE', 'XAU_USD']); |
| 2 | |
| 3 | export function buildDataProofArtifact({ generatedAt, reports }) { |
| 4 | if (!(generatedAt instanceof Date) || Number.isNaN(generatedAt.valueOf())) throw new TypeError('generatedAt must be a valid Date'); |
| 5 | if (!Array.isArray(reports)) throw new TypeError('reports must be an array'); |
| 6 | |
| 7 | const seen = new Set(); |
| 8 | for (const report of reports) { |
| 9 | if (!report || typeof report !== 'object') throw new TypeError('each report must be an object'); |
| 10 | if (!report.providerCode || !report.canonicalSymbol) throw new TypeError('report providerCode and canonicalSymbol are required'); |
| 11 | if (!['PASS', 'FAIL'].includes(report.status)) throw new RangeError('report status must be PASS or FAIL'); |
| 12 | if (seen.has(report.canonicalSymbol)) throw new RangeError(`duplicate report for ${report.canonicalSymbol}`); |
| 13 | seen.add(report.canonicalSymbol); |
| 14 | const checked = new Date(report.checkedAt); |
| 15 | if (Number.isNaN(checked.valueOf())) throw new TypeError('report checkedAt must be valid'); |
| 16 | if (checked > generatedAt) throw new RangeError('report checkedAt cannot be after generatedAt'); |
| 17 | } |
| 18 | |
| 19 | const missing = REQUIRED.filter(symbol => !seen.has(symbol)); |
| 20 | if (missing.length) throw new RangeError(`required Phase 1 reports missing: ${missing.join(', ')}`); |
| 21 | |
| 22 | const requiredReports = reports |
| 23 | .filter(report => REQUIRED.includes(report.canonicalSymbol)) |
| 24 | .sort((a, b) => a.canonicalSymbol.localeCompare(b.canonicalSymbol)); |
| 25 | |
| 26 | return Object.freeze({ |
| 27 | phase: 1, |
| 28 | generatedAt: generatedAt.toISOString(), |
| 29 | status: requiredReports.every(report => report.status === 'PASS') ? 'PASS' : 'FAIL', |
| 30 | requiredSymbols: [...REQUIRED], |
| 31 | reports: requiredReports.map(report => Object.freeze({ ...report })), |
| 32 | }); |
| 33 | } |