@davoodmehraban89 / VELYQOR / commits / 724976b
Fork 0

Intelligence, Advanced Charting & Trading Platform

Phase 1: record live Neon PostgreSQL proof

Phase 1: record live Neon PostgreSQL proof

Davood Mehraban committed Oct 7, 2026 at 01:23 UTC 724976b54e0e141e92f4abdab9ded0ee097361bc
2 files changed +83 -19
PROJECT_STATE.md
+26 -19
@@ -1,6 +1,6 @@
1 # VELYQOR Project State
2
3 -Last updated: 2026-10-05
3 +Last updated: 2026-10-07
4
5 ## Current phase
6 Phase 1 — Market Data Integrity & Data Proof.
@@ -17,7 +17,8 @@ Phase 1 — Market Data Integrity & Data Proof.
17 - Modular monolith for MVP, with independently schedulable ingestion workers.
18 - TypeScript/React/Next.js web application.
19 - PostgreSQL is the canonical database contract; hosting is replaceable through `DATABASE_URL`.
20 -- Cloudflare is edge/runtime/cache/protection. Hyperdrive is configured only after a reachable PostgreSQL endpoint exists.
20 +- Neon is the current zero-cost Phase 1 PostgreSQL host; it is infrastructure, not a product dependency.
21 +- Cloudflare is edge/runtime/cache/protection. Hyperdrive is configured only when justified by the deployment path.
22 - Provider adapters feed immutable raw observations, normalization, quality gates, candle construction, and derived-series calculation.
23 - UTC canonical storage; Asia/Tehran presentation.
24 - No UI timeframe may imply precision not supported by observed source cadence.
@@ -27,39 +28,45 @@ Phase 1 — Market Data Integrity & Data Proof.
28 - Canonical instruments, raw observations, ticks, candles, derived values, quality events, workspaces and drawings schema defined.
29 - Deterministic theoretical 18K gold and premium calculations implemented.
30 - Timestamp alignment, staleness, provider normalization and provider health implemented.
31 +- Deterministic multi-timeframe candle builder implemented with no synthetic gap filling.
32 +- Numeric quality scoring and propagation into candles/derived data implemented.
33 - GOOD / DEGRADED / STALE / INVALID quality classification implemented.
34 - Provider-neutral ingestion and derived-gold pipeline implemented.
35 - Navasan adapters implemented for USD_IRT_FREE and GOLD18_IRT, including IRR→IRT normalization and historical daily OHLC parsing.
36 - Alpha Vantage XAU/USD spot adapter implemented.
34 -- Data Proof metrics implemented for cadence, gaps, duplicates and out-of-order observations.
35 -- Provider source matrix documented.
36 -- Render Free PostgreSQL was tested and rejected because provisioning required payment credentials.
37 +- Data Proof metrics and aggregate evidence artifact implemented for cadence, freshness, gaps, duplicates and out-of-order observations.
38 +- Market calendar, price-spike detection, provider failure/recovery state machine and persistence hardening implemented.
39 +- Provider source matrix documented, including unresolved domestic redundancy risk.
40 +- PostgreSQL 18 persistence invariants execute successfully in CI.
41 +- Reachable Neon PostgreSQL provisioned for VELYQOR.
42 +- All three database migrations executed successfully against live Neon PostgreSQL.
43 +- Both SQL invariant suites executed successfully against live Neon PostgreSQL.
44 +- Live database proof recorded in `docs/data/phase1-live-postgres-proof.md`.
45 +- Domain regression suite passes: 66/66 tests.
46
47 ## In progress
39 -- Deterministic multi-timeframe candle builder with no synthetic gap filling.
40 -- Numeric quality scoring and propagation into candles/derived data.
48 - Live Data Proof for USD_IRT_FREE, GOLD18_IRT and XAU_USD.
42 -- Managed PostgreSQL provisioning on a no-card free provider.
49 - Secondary legally usable Iranian source research for cross-check/failover.
50
51 ## External blockers
46 -1. No live VELYQOR PostgreSQL endpoint is connected, so production-like migration/invariant execution and Hyperdrive binding cannot yet be completed.
47 -2. Live provider credentials are not connected to the runtime, so real cadence/quota/freshness measurements cannot yet be completed.
52 +1. `NAVASAN_API_KEY` is not connected to the runtime, so live USD_IRT_FREE and GOLD18_IRT cadence/quota/freshness proof cannot yet execute.
53 +2. `ALPHAVANTAGE_API_KEY` is not connected to the runtime, so live XAU_USD proof cannot yet execute.
54
55 ## Phase 1 exit gates
50 -1. PostgreSQL migrations and invariants execute successfully against a live reachable PostgreSQL instance.
51 -2. USD_IRT_FREE, GOLD18_IRT and XAU_USD each have a live tested ingestion path.
52 -3. Observed cadence, latency, gaps, duplicates, out-of-order behavior and failure/recovery are recorded for each source.
53 -4. Candle construction is deterministic and never invents missing observations.
54 -5. Quality state/score propagates into candles and derived values.
55 -6. At least one secondary legally usable reference is identified for Iranian market cross-check, or the lack of one is explicitly accepted as a launch risk.
56 -7. Secrets are runtime-only and absent from the repository.
57 -8. CI is green for all Phase 1 domain behavior.
56 +1. PostgreSQL migrations and invariants execute successfully against a live reachable PostgreSQL instance. **PASS**
57 +2. USD_IRT_FREE, GOLD18_IRT and XAU_USD each have a live tested ingestion path. **BLOCKED — provider credentials**
58 +3. Observed cadence, latency, gaps, duplicates, out-of-order behavior and failure/recovery are recorded for each source. **BLOCKED — provider credentials**
59 +4. Candle construction is deterministic and never invents missing observations. **PASS**
60 +5. Quality state/score propagates into candles and derived values. **PASS**
61 +6. At least one secondary legally usable reference is identified for Iranian market cross-check, or the lack of one is explicitly accepted as a launch risk. **PASS as documented unresolved launch risk**
62 +7. Secrets are runtime-only and absent from the repository. **PASS**
63 +8. CI is green for all Phase 1 domain behavior. **PASS**
64
65 ## Risks
66 - Iranian market-data licensing, timestamp quality, anti-bot restrictions, history and reliability.
67 - Free source cadence may be insufficient for intraday timeframes; unsupported timeframes must stay disabled.
68 +- The current domestic-source stack does not yet have a second zero-cost legally usable failover source.
69 - Free database hosting is temporary infrastructure and must not become a product dependency.
70
71 ## Next checkpoint
65 -Finish all non-external Phase 1 gates, then execute live PostgreSQL and provider Data Proof immediately when runtime credentials/endpoints are available.
72 +Connect the Navasan and Alpha Vantage runtime credentials without committing them, execute continuous live Data Proof for all three required instruments, record provider evidence, then close Phase 1 only if the live gates pass.
docs/data/phase1-live-postgres-proof.md new
+57
@@ -0,0 +1,57 @@
1 +# Phase 1 Live PostgreSQL Proof — Neon
2 +
3 +Date: 2026-10-07
4 +
5 +## Scope
6 +
7 +This record captures the external PostgreSQL acceptance evidence for Phase 1. Credentials and connection strings are intentionally excluded.
8 +
9 +## Environment
10 +
11 +- Provider: Neon
12 +- Project: VELYQOR
13 +- Branch: production
14 +- Database: neondb
15 +- Role: neondb_owner
16 +- Engine observed: PostgreSQL 18.6
17 +- Transport: TLS connection
18 +- Application credential source: local runtime-only `.env.local`
19 +- Repository secret exposure: none
20 +
21 +## Live execution result
22 +
23 +Connection to the reachable Neon PostgreSQL endpoint succeeded.
24 +
25 +Applied migrations, in lexical order:
26 +
27 +1. `0001_market_core.sql` — PASS
28 +2. `0002_workspaces.sql` — PASS
29 +3. `0003_phase1_persistence_hardening.sql` — PASS
30 +
31 +Executed database invariant suites:
32 +
33 +1. `market_core_invariants.sql` — PASS
34 +2. `phase1_persistence_invariants.sql` — PASS
35 +
36 +Post-execution verification:
37 +
38 +- Canonical instruments: 6
39 +- Public tables: 11
40 +- Invalid OHLC rejection: verified
41 +- Duplicate canonical tick rejection: verified
42 +- Future provider timestamp rejection: verified
43 +- Test transaction rollback behavior: verified
44 +
45 +## Domain regression
46 +
47 +Local market-domain regression suite executed after the live database proof:
48 +
49 +- Tests: 66
50 +- Passed: 66
51 +- Failed: 0
52 +
53 +## Acceptance impact
54 +
55 +Phase 1 exit gate 1 is satisfied: PostgreSQL migrations and invariants execute successfully against a live reachable PostgreSQL instance.
56 +
57 +Remaining external provider gates are not satisfied yet because `NAVASAN_API_KEY` and `ALPHAVANTAGE_API_KEY` are not present in the runtime. No provider result is claimed without those credentials.