Files
wyndham-ARR/.project-docs/50-evidence/topics/2026-07-29-channel-bi-database-runtime-verification.md
2026-07-31 15:11:42 +08:00

3.0 KiB

Evidence Topic: Channel BI database runtime verification

Metadata

  • Date: 2026-07-29
  • Status: Superseded
  • Scope: Local Web channel-BI read path from browser through PostgreSQL
  • Confidence: Fact
  • Source: Live local HTTP responses, browser DOM/console inspection, process/listener inspection and targeted automated tests
  • Last verified: 2026-07-29
  • Stale trigger: Restart or reconfiguration of the 8765 Web process; database migration or fact changes; changes to arr_web, channel_analytics or the BI frontend

Superseded for current values by 2026-07-30-channel-bi-post-update-data-contamination.md after real uploads changed the Finance projection. The connection-path finding remains valid.

Question

Is the current Web “渠道BI” page actually connected to PostgreSQL, rather than only having an unverified code path or mock response?

Evidence

  • Static path: arr_web/static/app.js requests /api/months and /api/analytics; arr_web/app.py delegates the analytics route to PostgresPortalRepository; channel_analytics/postgres.py reads current Finance facts in REPEATABLE READ READ ONLY transactions and validates the target database as booking_test.
  • Live health: GET http://127.0.0.1:8765/api/health returned HTTP 200 with database_ready=true.
  • Live database-backed requests: /api/months returned the 2026-07 projection with one channel and one row; /api/analytics?month=2026-07 returned BI schema 1.2 with QBD, one sold room, three room nights and total price 5400.
  • Browser verification: the live “渠道BI” tab rendered the same month, KPIs, QBD ranking and channel-by-room-type matrix; browser console error count was zero.
  • Runtime identity: the existing Web process uses the controlled booking-test-db.env and is bound to 0.0.0.0:8765; upload processing is disabled, matching processing_ready=false.
  • Regression: 24 tests covering channel analytics PostgreSQL behavior, analytics contracts, Web routes and repository schema passed.

Finding

The current local Web channel-BI path is fully connected and functioning from the rendered page through the live Web API to PostgreSQL. No connection code change is required for this task. processing_ready=false is a separate XML-upload runtime state and does not invalidate the BI read path.

Impact

Future channel-BI work should not begin by replacing or re-wiring the current repository. Reverify the live endpoints after process, configuration, migration or fact changes. Treat the existing all-interface listener as a local test process, not a production security boundary: bind it to loopback for local-only use or place it behind the documented Caddy HTTPS plus ARR application-login boundary.

Open Items

  • Reverify database_ready=true, /api/months and one known /api/analytics month after the formal server deployment.
  • Do not expose port 8765 directly; use loopback for local testing or the Caddy boundary for deployment.