Intelligence, Advanced Charting & Trading Platform
feature/chartnova-multimarket-chart-ws-foundation
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 | import test from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { buildDataProofArtifact } from '../src/data-proof-artifact.mjs'; |
| 4 | |
| 5 | test('builds immutable evidence artifact from three required Phase 1 reports', () => { |
| 6 | const artifact = buildDataProofArtifact({ |
| 7 | generatedAt: new Date('2026-10-05T12:10:00Z'), |
| 8 | reports: [ |
| 9 | { providerCode: 'navasan', canonicalSymbol: 'USD_IRT_FREE', status: 'PASS', checkedAt: '2026-10-05T12:09:00Z' }, |
| 10 | { providerCode: 'navasan', canonicalSymbol: 'GOLD18_IRT', status: 'PASS', checkedAt: '2026-10-05T12:09:00Z' }, |
| 11 | { providerCode: 'alpha_vantage', canonicalSymbol: 'XAU_USD', status: 'PASS', checkedAt: '2026-10-05T12:09:00Z' }, |
| 12 | ], |
| 13 | }); |
| 14 | assert.equal(artifact.phase, 1); |
| 15 | assert.equal(artifact.status, 'PASS'); |
| 16 | assert.deepEqual(artifact.requiredSymbols, ['GOLD18_IRT','USD_IRT_FREE','XAU_USD']); |
| 17 | }); |
| 18 | |
| 19 | test('fails aggregate proof when any required report fails', () => { |
| 20 | const artifact = buildDataProofArtifact({ |
| 21 | generatedAt: new Date('2026-10-05T12:10:00Z'), |
| 22 | reports: [ |
| 23 | { providerCode: 'navasan', canonicalSymbol: 'USD_IRT_FREE', status: 'PASS', checkedAt: '2026-10-05T12:09:00Z' }, |
| 24 | { providerCode: 'navasan', canonicalSymbol: 'GOLD18_IRT', status: 'FAIL', checkedAt: '2026-10-05T12:09:00Z' }, |
| 25 | { providerCode: 'alpha_vantage', canonicalSymbol: 'XAU_USD', status: 'PASS', checkedAt: '2026-10-05T12:09:00Z' }, |
| 26 | ], |
| 27 | }); |
| 28 | assert.equal(artifact.status, 'FAIL'); |
| 29 | }); |
| 30 | |
| 31 | test('refuses to certify Phase 1 when a required symbol is missing or duplicated', () => { |
| 32 | const base = [ |
| 33 | { providerCode: 'navasan', canonicalSymbol: 'USD_IRT_FREE', status: 'PASS', checkedAt: '2026-10-05T12:09:00Z' }, |
| 34 | { providerCode: 'navasan', canonicalSymbol: 'GOLD18_IRT', status: 'PASS', checkedAt: '2026-10-05T12:09:00Z' }, |
| 35 | ]; |
| 36 | assert.throws(() => buildDataProofArtifact({ generatedAt: new Date('2026-10-05T12:10:00Z'), reports: base }), /required/i); |
| 37 | assert.throws(() => buildDataProofArtifact({ generatedAt: new Date('2026-10-05T12:10:00Z'), reports: [...base, base[0]] }), /duplicate/i); |
| 38 | }); |