{
  "schema": "flowid.static.audit.v1",
  "run_id": "a733fa37cd13687d",
  "scope": "Static Pages release; live capture and Python tests ran with local PostgreSQL. No hosted Python worker is included.",
  "note": "The timestamped code review is preserved unchanged. Its then-pending live campaign is documented separately by live_capture_validation.",
  "code_review": {
    "id": "cloud-code-local-postgresql-closeout-2026-11-04",
    "created_ms": 1793764291706,
    "reviewed_code_hash": "c99bbf687fc75951604835078b6d5651282e8f6a05bba3be311acde0a8e0e0a1",
    "reviewed_files": [
      "flowid/cloud.py",
      "flowid/worker.py",
      "flowid/cloud_api.py",
      "flowid/pgstore.py",
      "flowid/pipeline.py",
      "flowid/market.py",
      "flowid/ethereum.py",
      "flowid/store.py",
      "api/index.py",
      "site/dist/app.js",
      "vercel.json",
      "Dockerfile",
      "requirements.txt",
      "requirements-cloud.lock",
      "tests/test_cloud_api.py",
      "tests/test_cloud_worker.py",
      "tests/test_pgstore.py",
      "tests/test_capture_provenance.py",
      "tests/site_cloud.test.cjs"
    ],
    "artifact_sha256": {
      "flowid/cloud.py": "1ca6627a956a9cecfc0e46ebb59621a84fbc5ebef90c3cbaf8aa0e7e6d002ffa",
      "flowid/worker.py": "c2bea4d53757421b6792f2a82969c4872fd2bba4097ad112e2abbe3cfdf45a6a",
      "flowid/cloud_api.py": "dd1b019720ca61fd69718d73e94bf3d20d919ceac27c9d15c42787b4950b9ad8",
      "flowid/pgstore.py": "e04a3454f76d680f67aa0ca8a49d1f84a2709fa6dc1c63e45516f6d54e790e05",
      "flowid/pipeline.py": "9ed3f83532a539d7abca1689f71ba55973ff730fbbda9b3128aeeaa0fddbc8ee",
      "flowid/market.py": "1bad2c943b5eceb55c506ef10543189e35a82dc8c858fab57626d2c168b5b51c",
      "flowid/ethereum.py": "f7f7f10c927e56fe559b7d68a5800bdf1d9e30b6f518b3f6ffb73222099dfc6a",
      "flowid/store.py": "ff888bc60db441bbded0132e8946e0d5c48cb55d0f5c2164c2d8078a70e950c4",
      "api/index.py": "d4a397e70a013f95aae21e3fe1d23f5baa7c67df237e99d217878ca3842ee8fa",
      "site/dist/app.js": "d48871e6f72411163b3fa7c42146ef798b3fbb4ebca107c477502f1c959e8647",
      "vercel.json": "a288ca8cce1d02377d7bb7beca082b7dfbb03b8f6a153869f45c684b1a33a2ba",
      "Dockerfile": "42b9c695108703161f33c2b48c3c20a86a42a1ce51cb1128a7eb582f9ea6d737",
      "requirements.txt": "c7e8f3f2e306c83ac1d1c288269adf9afa645100f0517f092257191f665576df",
      "requirements-cloud.lock": "04fd26c88ece3cf2755f7b07f83794ef1b01e9d4abf62210b636d93d840667ee",
      "tests/test_cloud_api.py": "a1365fe19ee3a789b223ff3cb5579c1facfe53cac6c5fe3135a57c85039ebba8",
      "tests/test_cloud_worker.py": "00ef3bfad3890252fc03c0b3458d6fd803697ae89fc9ea094ca2c154b4f68f4f",
      "tests/test_pgstore.py": "4fe5a054c61038bb3415cb852f8a13a01b8bde5d376174ae172f0ab06ddaba86",
      "tests/test_capture_provenance.py": "ba6f96b62af11d66f9bc3dffcef118ceca8392fa1f06f6b51779d611e4b9cbcb",
      "tests/site_cloud.test.cjs": "a9f08fa313e6b608f4cebff7664bd2160f04995890189afa8a225a4b390c0862"
    },
    "status": "code_and_local_postgresql_verified_not_vercel_deployed",
    "scope": "Independent review of cloud API authentication, origin checks, worker leases and fenced publication, concurrent append-only PostgreSQL writes, consistent analytical snapshots, interruption provenance, browser cloud-session behavior, and deployment configuration.",
    "independence": "Read-only audit; fixes implemented by coordinated storage and implementation agents, then independently inspected and tested. Auditor changed only this audit record during cloud review.",
    "relationship_to_prior_audit": "Prior local-release audit, counts and findings above are retained as historical evidence. This record describes the newer cloud implementation; it does not retrospectively claim that the earlier static site had a cloud worker.",
    "assurance": {
      "open_high_priority_code_findings": [],
      "decision": "Reviewed corrections pass code and local integration verification. End-to-end Vercel deployment is not certified.",
      "no_scientific_upgrade": "Cloud persistence and worker scheduling do not establish Binance control attribution, causal separation or predictive profitability."
    },
    "resolved_findings": [
      {
        "id": "CLD-001",
        "severity": "high",
        "status": "fixed_and_independently_verified",
        "path": "flowid/pgstore.py",
        "problem": "Ledger connections had no statement or lock deadline, allowing an advisory-lock wait to stall collection and shutdown indefinitely.",
        "before_evidence": {
          "statement_timeout": "0",
          "lock_timeout": "0",
          "idle_in_transaction_session_timeout": "0",
          "bounded_reproduction": "An isolated test-schema write stayed blocked for 2 seconds and completed only after its blocker released the advisory lock."
        },
        "correction": "Finite startup SQL/lock/idle-transaction limits plus TCP liveness settings; bounded environment overrides; preserve existing provider options.",
        "after_evidence": {
          "statement_timeout_ms": 30000,
          "lock_timeout_ms": 5000,
          "idle_transaction_timeout_ms": 60000,
          "tests": "Real database regressions force 150 ms lock contention and 250 ms statement timeout, then prove rollback and subsequent connection reuse."
        }
      },
      {
        "id": "CLD-002",
        "severity": "medium",
        "status": "fixed_and_independently_verified",
        "path": "flowid/pipeline.py:31",
        "problem": "A process killed before capture completion could leave durable raw records without durable producing-code provenance.",
        "correction": "Append capture_started coverage with collector_code_hash, symbol, requested duration and chain before any source network call.",
        "after_evidence": "tests/test_capture_provenance.py verifies start provenance survives collector failure; included in the 86 passing Python tests."
      },
      {
        "id": "CLD-003",
        "severity": "low",
        "status": "fixed_and_reviewed",
        "path": "Dockerfile:2",
        "problem": "Docker set FLOWID_WORK_DIR while worker read FLOWID_WORK_ROOT.",
        "correction": "Docker now sets FLOWID_WORK_ROOT=/tmp/flowid, matching worker configuration."
      }
    ],
    "verification": {
      "python": {
        "passed": 86,
        "failed": 0,
        "skipped": 0,
        "independently_executed": true,
        "command": "python -m unittest discover -s tests -p test_*.py",
        "reported_runtime_seconds": 7.548,
        "database": "Explicitly supplied disposable local PostgreSQL; random test namespaces/schemas cleaned up. Live verification namespace was not altered."
      },
      "javascript": {
        "passed": 16,
        "failed": 0,
        "skipped": 0,
        "independently_executed": true,
        "command": "node --test tests/site.test.cjs tests/site_sessions.test.cjs tests/site_cloud.test.cjs",
        "reported_runtime_ms": 157.3657
      },
      "coverage": [
        "auth fails closed and hides backend secrets",
        "HttpOnly secure cookie and same-origin writes",
        "single manual enqueue under concurrency",
        "lease exclusion and stale-owner publication fencing",
        "atomic report publication with capture-time ordering",
        "parallel raw writers preserve hash chain",
        "event batch rollback and immutable database triggers",
        "repeatable-read snapshot matches ledger contract",
        "SQL timeout rollback and connection reuse",
        "capture provenance survives failure",
        "late browser responses cannot restore logged-out state",
        "packaged synthetic lab survives cloud report refresh",
        "rejected session cookie leaves login open"
      ],
      "deployment_config": {
        "region": "fra1",
        "instances": 1,
        "memory": "1Gi",
        "termination_grace_seconds": 300,
        "config_inspected": true,
        "container_built": false,
        "vercel_production_tested": false
      },
      "live_market_campaign": "Implementation owner is running the 600 second real-market PostgreSQL campaign and will report its outcome separately in docs/cloud-validation.json. This audit record does not assert its completion."
    },
    "remaining_acceptance_limits": [
      "Vercel has not been deployed or tested end-to-end. Local API/worker/PostgreSQL tests do not prove hosted routing, cookies, image startup or daemon uptime.",
      "The real-data PostgreSQL campaign uses a private local test database, not a deployed Neon service or Neon pooler. Provider-specific startup-option, transaction-pooler, TLS and network behavior still require verification.",
      "Docker is unavailable in the current environment; Dockerfile inspection is not evidence of a successful image build or container run.",
      "Configured shutdown grace is 300 seconds. Draining analysis is not an absolute end-to-end deadline; forced termination can leave a durable ledger with an interrupted job awaiting operational recovery.",
      "Retention, archival and automatic pruning are not implemented. Each segment retains its own durable ledger and report.",
      "Multi-day load, memory capacity for maximum-duration jobs, database growth, prolonged outages, deployment rollovers and restart recovery under production load remain pending.",
      "Preview reports may be downsampled; full reports remain in PostgreSQL. Scientific inference remains restricted to the stated model assumptions and observed capture segments."
    ],
    "reference_docs": [
      {
        "title": "Vercel Daemon Configuration Reference",
        "url": "https://vercel.com/docs/daemons/config-reference"
      },
      {
        "title": "Vercel Daemons limits",
        "url": "https://vercel.com/docs/daemons/limits"
      },
      {
        "title": "Vercel Python runtime",
        "url": "https://vercel.com/docs/functions/runtimes/python"
      }
    ]
  },
  "live_capture_validation": {
    "run_id": "a733fa37cd13687d",
    "checks": {
      "persisted_report_hash": true,
      "fresh_connection_ledger_integrity": true,
      "fresh_snapshot_book_replay": true,
      "postgresql_analysis_provenance": true,
      "over_10000_observed_events": true,
      "unauthenticated_report_rejected": true,
      "authenticated_report_matches": true,
      "authenticated_health_and_jobs": true,
      "causal_attribution_not_claimed": true
    }
  }
}